p.Chaos.PostIterationUpdates.ISPC
p.Chaos.PostIterationUpdates.ISPC
#Overview
name: p.Chaos.PostIterationUpdates.ISPC
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Whether to use ISPC optimizations in PBD Post iteration updates
It is referenced in 6
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of p.Chaos.PostIterationUpdates.ISPC is to control whether ISPC (Intel SPMD Program Compiler) optimizations are used in the post-iteration updates of the Chaos physics engine in Unreal Engine 5. This setting is specifically related to the physics simulation system, particularly the Position-Based Dynamics (PBD) and Newton evolution algorithms.
This setting variable is primarily used in the Chaos module, which is part of Unreal Engine’s experimental physics system. Based on the callsites, it’s utilized in the PBDEvolution and NewtonEvolution components of the Chaos system.
The value of this variable is set through a console variable (CVarChaosPostIterationUpdatesISPCEnabled) and is associated with the C++ boolean variable bChaos_PostIterationUpdates_ISPC_Enabled. It’s initialized to true by default but can be changed at runtime through the console.
This variable interacts closely with bChaos_PostIterationUpdates_ISPC_Enabled, which directly controls the behavior in the code. When enabled, it allows the use of ISPC optimizations in the post-iteration updates of the physics simulation.
Developers should be aware of several things when using this variable:
- It’s only effective in non-shipping builds and when INTEL_ISPC is defined.
- It affects performance and potentially the accuracy of physics simulations.
- The variable is used in performance-critical sections of the physics engine.
Best practices for using this variable include:
- Testing the performance impact with and without ISPC optimizations enabled.
- Ensuring that the results are consistent when enabling or disabling this option.
- Consider leaving it enabled for better performance unless specific issues are encountered.
Regarding the associated variable bChaos_PostIterationUpdates_ISPC_Enabled:
- Its purpose is to provide a runtime-modifiable flag for enabling ISPC optimizations.
- It’s used directly in the code to conditionally execute ISPC-optimized versions of the post-iteration updates.
- The value is set by the console variable p.Chaos.PostIterationUpdates.ISPC.
- It’s defined differently in shipping and non-shipping builds, with shipping builds using a compile-time constant.
- Developers should be aware that changing this variable at runtime can affect physics simulation performance and potentially behavior.
- Best practices include thoroughly testing any changes to this variable and considering its impact on different hardware configurations.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/PBDEvolution.cpp:41
Scope: file
Source code excerpt:
#if INTEL_ISPC && !UE_BUILD_SHIPPING
bool bChaos_PostIterationUpdates_ISPC_Enabled = true;
FAutoConsoleVariableRef CVarChaosPostIterationUpdatesISPCEnabled(TEXT("p.Chaos.PostIterationUpdates.ISPC"), bChaos_PostIterationUpdates_ISPC_Enabled, TEXT("Whether to use ISPC optimizations in PBD Post iteration updates"));
static_assert(sizeof(ispc::FVector3f) == sizeof(Chaos::Softs::FSolverVec3), "sizeof(ispc::FVector3f) != sizeof(Chaos::Softs::FSolverVec3");
#endif
namespace Chaos::Softs {
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/NewtonEvolution.cpp:42
Scope: file
Source code excerpt:
//#if INTEL_ISPC && !UE_BUILD_SHIPPING
//bool bChaos_PostIterationUpdates_ISPC_Enabled = true;
//FAutoConsoleVariableRef CVarChaosPostIterationUpdatesISPCEnabled(TEXT("p.Chaos.PostIterationUpdates.ISPC"), bChaos_PostIterationUpdates_ISPC_Enabled, TEXT("Whether to use ISPC optimizations in Newton Post iteration updates"));
//
//static_assert(sizeof(ispc::FVector3f) == sizeof(Chaos::Softs::FSolverVec3), "sizeof(ispc::FVector3f) != sizeof(Chaos::Softs::FSolverVec3");
//#endif
namespace Chaos::Softs {
#Associated Variable and Callsites
This variable is associated with another variable named bChaos_PostIterationUpdates_ISPC_Enabled
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/NewtonEvolution.cpp:41
Scope: file
Source code excerpt:
//#if INTEL_ISPC && !UE_BUILD_SHIPPING
//bool bChaos_PostIterationUpdates_ISPC_Enabled = true;
//FAutoConsoleVariableRef CVarChaosPostIterationUpdatesISPCEnabled(TEXT("p.Chaos.PostIterationUpdates.ISPC"), bChaos_PostIterationUpdates_ISPC_Enabled, TEXT("Whether to use ISPC optimizations in Newton Post iteration updates"));
//
//static_assert(sizeof(ispc::FVector3f) == sizeof(Chaos::Softs::FSolverVec3), "sizeof(ispc::FVector3f) != sizeof(Chaos::Softs::FSolverVec3");
//#endif
namespace Chaos::Softs {
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/PBDEvolution.cpp:40
Scope: file
Source code excerpt:
#if INTEL_ISPC && !UE_BUILD_SHIPPING
bool bChaos_PostIterationUpdates_ISPC_Enabled = true;
FAutoConsoleVariableRef CVarChaosPostIterationUpdatesISPCEnabled(TEXT("p.Chaos.PostIterationUpdates.ISPC"), bChaos_PostIterationUpdates_ISPC_Enabled, TEXT("Whether to use ISPC optimizations in PBD Post iteration updates"));
static_assert(sizeof(ispc::FVector3f) == sizeof(Chaos::Softs::FSolverVec3), "sizeof(ispc::FVector3f) != sizeof(Chaos::Softs::FSolverVec3");
#endif
namespace Chaos::Softs {
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/PBDEvolution.cpp:676
Scope (from outer to inner):
file
namespace Chaos::Softs
function void FPBDEvolution::AdvanceOneTimeStep
Source code excerpt:
// Particle update, V = (P - X) / Dt; X = P;
#if INTEL_ISPC
if (bChaos_PostIterationUpdates_ISPC_Enabled)
{
MParticlesActiveView.RangeFor(
[Dt](FSolverParticles& Particles, int32 Offset, int32 Range)
{
ispc::PostIterationUpdates(
(ispc::FVector3f*)Particles.GetV().GetData(),
#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Public/Chaos/PBDEvolution.h:263
Scope: file
Source code excerpt:
// Support ISPC enable/disable in non-shipping builds
#if !INTEL_ISPC || UE_BUILD_SHIPPING
static constexpr bool bChaos_PostIterationUpdates_ISPC_Enabled = INTEL_ISPC && CHAOS_POST_ITERATION_UPDATES_ISPC_ENABLED;
#else
extern CHAOS_API bool bChaos_PostIterationUpdates_ISPC_Enabled;
#endif