r.FASTBuild.JobProcessor.MinBatchSize
r.FASTBuild.JobProcessor.MinBatchSize
#Overview
name: r.FASTBuild.JobProcessor.MinBatchSize
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Minimum number of shaders to compile with FASTBuild.\nDefault = 100\n
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.FASTBuild.JobProcessor.MinBatchSize is to set the minimum number of shaders to compile with FASTBuild. This setting variable is used in the shader compilation system of Unreal Engine 5, specifically within the FastBuildController plugin.
The FastBuildController plugin relies on this setting variable to optimize shader compilation performance. It’s part of the job processing system that handles shader compilation tasks using FASTBuild, a distributed build system.
The value of this variable is set through the Unreal Engine console variable system. It’s defined using FAutoConsoleVariableRef, which allows it to be changed at runtime or through configuration files.
This variable interacts directly with the MinJobsToKickOff variable. They share the same value, with MinJobsToKickOff being the actual variable used in the code logic, while r.FASTBuild.JobProcessor.MinBatchSize is the console variable name used to set and access this value.
Developers must be aware that this variable affects the batching behavior of shader compilation jobs. Setting it too low might result in frequent small batches, potentially reducing overall efficiency, while setting it too high might delay the start of compilation until a large number of shaders are queued.
Best practices when using this variable include:
- Adjusting it based on the project’s size and the development team’s workflow.
- Monitoring compilation times and adjusting as needed.
- Considering the trade-off between compilation start latency and overall throughput.
Regarding the associated variable MinJobsToKickOff:
The purpose of MinJobsToKickOff is to store the actual value used in the code logic for determining when to kick off shader compilation jobs.
It’s used within the FFastBuildJobProcessor::Run function to decide whether to submit pending jobs for compilation. This occurs when either a certain condition (bShouldKickoffJobsAnyway) is met or when the number of pending tasks exceeds MinJobsToKickOff.
The value of MinJobsToKickOff is set directly by the r.FASTBuild.JobProcessor.MinBatchSize console variable.
Developers should be aware that changing r.FASTBuild.JobProcessor.MinBatchSize will directly affect the behavior controlled by MinJobsToKickOff. They should consider the impact on shader compilation performance and adjust accordingly based on their specific project needs and hardware capabilities.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Plugins/FastBuildController/Source/Private/FastBuildJobProcessor.cpp:20
Scope (from outer to inner):
file
namespace FastBuildJobProcessorOptions
Source code excerpt:
int32 MinJobsToKickOff = 100;
FAutoConsoleVariableRef CVarFASTBuildShaderMinJobsToKickOff(
TEXT("r.FASTBuild.JobProcessor.MinBatchSize"),
MinJobsToKickOff,
TEXT("Minimum number of shaders to compile with FASTBuild.\n")
TEXT("Default = 100\n"),
ECVF_Default);
int32 MaxTimeWithPendingJobs = 10;
#Associated Variable and Callsites
This variable is associated with another variable named MinJobsToKickOff
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Plugins/FastBuildController/Source/Private/FastBuildJobProcessor.cpp:18
Scope (from outer to inner):
file
namespace FastBuildJobProcessorOptions
Source code excerpt:
int32 MinJobsToKickOff = 100;
FAutoConsoleVariableRef CVarFASTBuildShaderMinJobsToKickOff(
TEXT("r.FASTBuild.JobProcessor.MinBatchSize"),
MinJobsToKickOff,
TEXT("Minimum number of shaders to compile with FASTBuild.\n")
TEXT("Default = 100\n"),
ECVF_Default);
int32 MaxTimeWithPendingJobs = 10;
FAutoConsoleVariableRef CVarFASTBuildShaderMaxTimeWithPendingJobs(
#Loc: <Workspace>/Engine/Plugins/FastBuildController/Source/Private/FastBuildJobProcessor.cpp:77
Scope (from outer to inner):
file
function uint32 FFastBuildJobProcessor::Run
Source code excerpt:
if (bShouldKickoffJobsAnyway || ControllerModule.GetPendingTasksAmount() > FastBuildJobProcessorOptions::MinJobsToKickOff)
{
LastTimeKickedOffJobs = FPlatformTime::Cycles();
SubmitPendingJobs();
}
if (ControllerModule.AreTasksDispatched())