p.Chaos.GC.InitConstantDataParallelForBatchSize

p.Chaos.GC.InitConstantDataParallelForBatchSize

#Overview

name: p.Chaos.GC.InitConstantDataParallelForBatchSize

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

It is referenced in 3 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of p.Chaos.GC.InitConstantDataParallelForBatchSize is to define the minimum size of a batch of vertices when using parallel processing for initializing constant data in the Geometry Collection system of Unreal Engine’s Chaos physics engine.

This setting variable is primarily used in the Geometry Collection module of the Chaos physics system, which is part of Unreal Engine’s experimental features. It’s specifically utilized in the GeometryCollectionComponent.

The value of this variable is set using an FAutoConsoleVariableRef, which means it can be adjusted at runtime through console commands or configuration files. Its default value is 5000.

This variable interacts closely with another boolean variable, bChaos_GC_InitConstantDataUseParallelFor. When this boolean is true, the InitConstantData function uses parallel processing, and p.Chaos.GC.InitConstantDataParallelForBatchSize determines the batch size for this parallelization.

Developers should be aware that this variable affects performance and memory usage. A larger batch size may improve performance but could increase memory usage, while a smaller batch size might be more memory-efficient but could potentially slow down processing.

Best practices when using this variable include:

  1. Adjusting it based on the specific hardware and project requirements.
  2. Profiling the application to find the optimal value for your specific use case.
  3. Considering the trade-off between performance and memory usage.

Regarding the associated variable bChaos_GC_InitConstantDataParallelForBatchSize:

This is an integer variable that directly stores the value set by p.Chaos.GC.InitConstantDataParallelForBatchSize. It’s used in the actual code implementation, specifically in the ParallelFor function call within the GetBoneColors method of UGeometryCollectionComponent.

The purpose of bChaos_GC_InitConstantDataParallelForBatchSize is to provide a quick, in-memory access to the batch size value for parallel processing. It’s used in conjunction with bChaos_GC_InitConstantDataUseParallelFor to determine how to process bone colors in the Geometry Collection component.

Developers should be aware that changes to p.Chaos.GC.InitConstantDataParallelForBatchSize will directly affect this variable, and vice versa. When optimizing performance, both variables should be considered together.

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Experimental/GeometryCollectionEngine/Private/GeometryCollection/GeometryCollectionComponent.cpp:116

Scope: file

Source code excerpt:


int32 bChaos_GC_InitConstantDataParallelForBatchSize = 5000;
FAutoConsoleVariableRef CVarChaosGCInitConstantDataParallelForBatchSize(TEXT("p.Chaos.GC.InitConstantDataParallelForBatchSize"), bChaos_GC_InitConstantDataParallelForBatchSize, TEXT("When parallelFor is used in InitConstantData, defined the minimium size of a batch of vertex "));

int32 MaxGeometryCollectionAsyncPhysicsTickIdleTimeMs = 30;
FAutoConsoleVariableRef CVarMaxGeometryCollectionAsyncPhysicsTickIdleTimeMs(TEXT("p.Chaos.GC.MaxGeometryCollectionAsyncPhysicsTickIdleTimeMs"), MaxGeometryCollectionAsyncPhysicsTickIdleTimeMs, TEXT("Amount of time in milliseconds before the async tick turns off when it is otherwise not doing anything."));

float GeometryCollectionRemovalMultiplier = 1.0f;
FAutoConsoleVariableRef CVarGeometryCollectionRemovalTimerMultiplier(TEXT("p.Chaos.GC.RemovalTimerMultiplier"), GeometryCollectionRemovalMultiplier, TEXT("Multiplier for the removal time evaluation ( > 1 : faster removal , > 1 slower"));

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Experimental/GeometryCollectionEngine/Private/GeometryCollection/GeometryCollectionComponent.cpp:115

Scope: file

Source code excerpt:

FAutoConsoleVariableRef CVarChaosGCInitConstantDataUseParallelFor(TEXT("p.Chaos.GC.InitConstantDataUseParallelFor"), bChaos_GC_InitConstantDataUseParallelFor, TEXT("When enabled, InitConstant data will use parallelFor for copying some of the data"));

int32 bChaos_GC_InitConstantDataParallelForBatchSize = 5000;
FAutoConsoleVariableRef CVarChaosGCInitConstantDataParallelForBatchSize(TEXT("p.Chaos.GC.InitConstantDataParallelForBatchSize"), bChaos_GC_InitConstantDataParallelForBatchSize, TEXT("When parallelFor is used in InitConstantData, defined the minimium size of a batch of vertex "));

int32 MaxGeometryCollectionAsyncPhysicsTickIdleTimeMs = 30;
FAutoConsoleVariableRef CVarMaxGeometryCollectionAsyncPhysicsTickIdleTimeMs(TEXT("p.Chaos.GC.MaxGeometryCollectionAsyncPhysicsTickIdleTimeMs"), MaxGeometryCollectionAsyncPhysicsTickIdleTimeMs, TEXT("Amount of time in milliseconds before the async tick turns off when it is otherwise not doing anything."));

float GeometryCollectionRemovalMultiplier = 1.0f;
FAutoConsoleVariableRef CVarGeometryCollectionRemovalTimerMultiplier(TEXT("p.Chaos.GC.RemovalTimerMultiplier"), GeometryCollectionRemovalMultiplier, TEXT("Multiplier for the removal time evaluation ( > 1 : faster removal , > 1 slower"));

#Loc: <Workspace>/Engine/Source/Runtime/Experimental/GeometryCollectionEngine/Private/GeometryCollection/GeometryCollectionComponent.cpp:3111

Scope (from outer to inner):

file
function     void UGeometryCollectionComponent::GetBoneColors

Source code excerpt:

	if (bChaos_GC_InitConstantDataUseParallelFor)
	{
		ParallelFor(TEXT("GC:InitBoneColors"), NumPoints, bChaos_GC_InitConstantDataParallelForBatchSize,
			[&](const int32 InPointIndex)
			{
				const int32 BoneIndex = BoneMap[InPointIndex];
				OutColors[InPointIndex] = BoneColors[BoneIndex].ToFColor(true);
			});
	}