p.Chaos.PostIterationUpdates.ISPC

p.Chaos.PostIterationUpdates.ISPC

#Overview

name: p.Chaos.PostIterationUpdates.ISPC

This variable is created as a Console Variable (cvar).

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:

  1. It’s only effective in non-shipping builds and when INTEL_ISPC is defined.
  2. It affects performance and potentially the accuracy of physics simulations.
  3. The variable is used in performance-critical sections of the physics engine.

Best practices for using this variable include:

  1. Testing the performance impact with and without ISPC optimizations enabled.
  2. Ensuring that the results are consistent when enabling or disabling this option.
  3. Consider leaving it enabled for better performance unless specific issues are encountered.

Regarding the associated variable bChaos_PostIterationUpdates_ISPC_Enabled:

#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