p.Chaos.VelocityField.ISPC

p.Chaos.VelocityField.ISPC

#Overview

name: p.Chaos.VelocityField.ISPC

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

It is referenced in 7 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of p.Chaos.VelocityField.ISPC is to control whether ISPC (Intel SPMD Program Compiler) optimizations are used in velocity field calculations within the Chaos physics engine of Unreal Engine 5.

This setting variable is primarily used by the Chaos physics engine, which is part of Unreal Engine’s experimental physics simulation system. Specifically, it affects the VelocityField module within the Chaos namespace.

The value of this variable is set through a console variable (CVar) system. It’s initialized to true by default but can be changed at runtime in non-shipping builds.

The associated variable bChaos_VelocityField_ISPC_Enabled directly interacts with p.Chaos.VelocityField.ISPC. They share the same value and are used interchangeably in the code.

Developers must be aware that:

  1. This optimization is only available when INTEL_ISPC is defined and not in shipping builds.
  2. It affects performance of velocity field calculations, which could impact physics simulations.
  3. The optimization can be toggled at runtime in development builds, allowing for performance comparisons.

Best practices when using this variable include:

  1. Testing physics simulations with both enabled and disabled states to ensure consistency and performance gains.
  2. Considering platform-specific performance implications, as ISPC optimizations may have different impacts on various hardware.
  3. Keeping it enabled by default unless specific issues are encountered.

Regarding the associated variable bChaos_VelocityField_ISPC_Enabled:

Developers should use this variable in conjunction with performance profiling tools to determine the optimal setting for their specific use case and target hardware.

#References in C++ code

#Callsites

This variable is referenced in the following C++ source code:

#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/VelocityField.cpp:13

Scope: file

Source code excerpt:

#if INTEL_ISPC && !UE_BUILD_SHIPPING
bool bChaos_VelocityField_ISPC_Enabled = true;
FAutoConsoleVariableRef CVarChaosVelocityFieldISPCEnabled(TEXT("p.Chaos.VelocityField.ISPC"), bChaos_VelocityField_ISPC_Enabled, TEXT("Whether to use ISPC optimizations in velocity field calculations"));
#endif

namespace Chaos::Softs {

namespace Private
{

#Associated Variable and Callsites

This variable is associated with another variable named bChaos_VelocityField_ISPC_Enabled. They share the same value. See the following C++ source code.

#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/VelocityField.cpp:12

Scope: file

Source code excerpt:


#if INTEL_ISPC && !UE_BUILD_SHIPPING
bool bChaos_VelocityField_ISPC_Enabled = true;
FAutoConsoleVariableRef CVarChaosVelocityFieldISPCEnabled(TEXT("p.Chaos.VelocityField.ISPC"), bChaos_VelocityField_ISPC_Enabled, TEXT("Whether to use ISPC optimizations in velocity field calculations"));
#endif

namespace Chaos::Softs {

namespace Private
{

#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/VelocityField.cpp:314

Scope (from outer to inner):

file
namespace    Chaos::Softs
function     void FVelocityAndPressureField::UpdateForces

Source code excerpt:

	{
#if INTEL_ISPC
		if (bRealTypeCompatibleWithISPC && bChaos_VelocityField_ISPC_Enabled)
		{
			if (MaxVelocitySquared == TNumericLimits<FSolverReal>::Max())
			{
				ispc::UpdateField(
					(ispc::FVector3f*)Forces.GetData(),
					(const ispc::FIntVector*)Elements.GetData(),

#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/VelocityField.cpp:374

Scope (from outer to inner):

file
namespace    Chaos::Softs
function     void FVelocityAndPressureField::UpdateForces

Source code excerpt:

	{
#if INTEL_ISPC
		if (bRealTypeCompatibleWithISPC && bChaos_VelocityField_ISPC_Enabled)
		{
			if (MaxVelocitySquared == TNumericLimits<FSolverReal>::Max())
			{
				ispc::UpdateFieldWithWeightMaps(
					(ispc::FVector3f*)Forces.GetData(),
					(const ispc::FIntVector*)Elements.GetData(),

#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/VelocityField.cpp:458

Scope (from outer to inner):

file
namespace    Chaos::Softs
function     void FVelocityAndPressureField::Apply

Source code excerpt:

	{
#if INTEL_ISPC
		if (bRealTypeCompatibleWithISPC && bChaos_VelocityField_ISPC_Enabled && ConstraintsPerColorStartIndex.Num() > 1)
		{
			const int32 ConstraintColorNum = ConstraintsPerColorStartIndex.Num() - 1;
			if (MaxVelocitySquared == TNumericLimits<FSolverReal>::Max())
			{
				for (int32 ConstraintColorIndex = 0; ConstraintColorIndex < ConstraintColorNum; ++ConstraintColorIndex)
				{

#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/VelocityField.cpp:537

Scope (from outer to inner):

file
namespace    Chaos::Softs
function     void FVelocityAndPressureField::Apply

Source code excerpt:

	{
#if INTEL_ISPC
		if (bRealTypeCompatibleWithISPC && bChaos_VelocityField_ISPC_Enabled && ConstraintsPerColorStartIndex.Num() > 1)
		{
			const int32 ConstraintColorNum = ConstraintsPerColorStartIndex.Num() - 1;
			if (MaxVelocitySquared == TNumericLimits<FSolverReal>::Max())
			{
				for (int32 ConstraintColorIndex = 0; ConstraintColorIndex < ConstraintColorNum; ++ConstraintColorIndex)
				{

#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Public/Chaos/VelocityField.h:282

Scope: file

Source code excerpt:

// Support run-time toggling on supported platforms in non-shipping configurations
#if !INTEL_ISPC || UE_BUILD_SHIPPING
static constexpr bool bChaos_VelocityField_ISPC_Enabled = INTEL_ISPC && CHAOS_VELOCITY_FIELD_ISPC_ENABLED_DEFAULT;
#else
extern CHAOS_API bool bChaos_VelocityField_ISPC_Enabled;
#endif