p.Chaos.MinRangeBatchSize

p.Chaos.MinRangeBatchSize

#Overview

name: p.Chaos.MinRangeBatchSize

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

It is referenced in 4 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of p.Chaos.MinRangeBatchSize is to set the minimum range batch size for parallel processing in the Chaos physics system of Unreal Engine 5. This setting is used to control the granularity of parallel task distribution in physics simulations.

Regarding the associated variable MinRangeBatchSize:

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/Framework/Parallel.cpp:22

Scope (from outer to inner):

file
namespace    Chaos

Source code excerpt:

	FAutoConsoleVariableRef CVarDisableCollisionParallelFor(TEXT("p.Chaos.DisableCollisionParallelFor"), bDisableCollisionParallelFor, TEXT("Disable parallel execution for Chaos Collisions (also disabled by DisableParticleParallelFor)"));
	FAutoConsoleVariableRef CVarInnerPhysicsBatchSize(TEXT("p.Chaos.InnerParallelForBatchSize"), InnerParallelForBatchSize, TEXT("Set the batch size threshold for inner parallel fors"));
	FAutoConsoleVariableRef CVarMinRangeBatchSize(TEXT("p.Chaos.MinRangeBatchSize"), MinRangeBatchSize, TEXT("Set the min range batch size for parallel for"));
	FAutoConsoleVariableRef CVarMaxRangeBatchWorkers(TEXT("p.Chaos.MaxNumWorkers"), MaxNumWorkers, TEXT("Set the max number of workers for physics"));
	FAutoConsoleVariableRef CVarSmallBatchSize(TEXT("p.Chaos.SmallBatchSize"), SmallBatchSize, TEXT("Small batch size for chaos parallel loops"));
	FAutoConsoleVariableRef CVarLargeBatchSize(TEXT("p.Chaos.LargeBatchSize"), LargeBatchSize, TEXT("Large batch size for chaos parallel loops"));
#endif
}

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/Framework/Parallel.cpp:8

Scope (from outer to inner):

file
namespace    Chaos

Source code excerpt:

	CHAOS_API int32 GSingleThreadedPhysics = 0;
	CHAOS_API int32 InnerParallelForBatchSize = 0;
	CHAOS_API int32 MinRangeBatchSize = 0;
	CHAOS_API int32 MaxNumWorkers = 100;
	CHAOS_API int32 SmallBatchSize = 10;
	CHAOS_API int32 LargeBatchSize = 100;
	
#if !UE_BUILD_SHIPPING
	CHAOS_API bool bDisablePhysicsParallelFor = false;

#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/Framework/Parallel.cpp:22

Scope (from outer to inner):

file
namespace    Chaos

Source code excerpt:

	FAutoConsoleVariableRef CVarDisableCollisionParallelFor(TEXT("p.Chaos.DisableCollisionParallelFor"), bDisableCollisionParallelFor, TEXT("Disable parallel execution for Chaos Collisions (also disabled by DisableParticleParallelFor)"));
	FAutoConsoleVariableRef CVarInnerPhysicsBatchSize(TEXT("p.Chaos.InnerParallelForBatchSize"), InnerParallelForBatchSize, TEXT("Set the batch size threshold for inner parallel fors"));
	FAutoConsoleVariableRef CVarMinRangeBatchSize(TEXT("p.Chaos.MinRangeBatchSize"), MinRangeBatchSize, TEXT("Set the min range batch size for parallel for"));
	FAutoConsoleVariableRef CVarMaxRangeBatchWorkers(TEXT("p.Chaos.MaxNumWorkers"), MaxNumWorkers, TEXT("Set the max number of workers for physics"));
	FAutoConsoleVariableRef CVarSmallBatchSize(TEXT("p.Chaos.SmallBatchSize"), SmallBatchSize, TEXT("Small batch size for chaos parallel loops"));
	FAutoConsoleVariableRef CVarLargeBatchSize(TEXT("p.Chaos.LargeBatchSize"), LargeBatchSize, TEXT("Large batch size for chaos parallel loops"));
#endif
}

#Loc: <Workspace>/Engine/Source/Runtime/Experimental/Chaos/Private/Chaos/Framework/Parallel.cpp:106

Scope (from outer to inner):

file
function     void Chaos::PhysicsParallelForRange

Source code excerpt:

	check(NumWorkers > 0);
	int32 BatchSize = FMath::DivideAndRoundUp<int32>(InNum, NumWorkers);
	int32 MinBatchSize = FMath::Max(InMinBatchSize, MinRangeBatchSize);
	// @todo(mlentine): Find a better batch size in this case
	if (InNum < MinBatchSize)
	{
		NumWorkers = 1;
		BatchSize = InNum;
	}