r.RHICmdMinCmdlistForParallelSubmit

r.RHICmdMinCmdlistForParallelSubmit

#Overview

name: r.RHICmdMinCmdlistForParallelSubmit

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 r.RHICmdMinCmdlistForParallelSubmit is to control the minimum number of parallel translate command lists that should be submitted for parallel execution in the rendering pipeline. This setting is part of Unreal Engine’s rendering system, specifically related to the RHI (Rendering Hardware Interface) thread management and command list execution.

This setting variable is primarily used in the Renderer module of Unreal Engine, as evidenced by its declaration in the SceneRendering.cpp file.

The value of this variable is set through a console variable (CVarRHICmdMinCmdlistForParallelSubmit), which allows it to be adjusted at runtime. It’s initialized with a default value of 1.

The associated variable CVarRHICmdMinCmdlistForParallelSubmit directly interacts with r.RHICmdMinCmdlistForParallelSubmit, as they share the same value and purpose.

Developers must be aware that this variable affects the parallelization of command list submission. If the number of command lists is fewer than the value set by this variable, they will be executed on the RHI thread and immediate context instead of being parallelized.

Best practices when using this variable include:

  1. Adjusting it based on the specific hardware and workload of the game.
  2. Monitoring performance metrics to find the optimal value for your specific use case.
  3. Considering the trade-off between parallelization overhead and potential performance gains.

Regarding the associated variable CVarRHICmdMinCmdlistForParallelSubmit:

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/SceneRendering.cpp:348

Scope: file

Source code excerpt:


static TAutoConsoleVariable<int32> CVarRHICmdMinCmdlistForParallelSubmit(
	TEXT("r.RHICmdMinCmdlistForParallelSubmit"),
	1,
	TEXT("Minimum number of parallel translate command lists to submit. If there are fewer than this number, they just run on the RHI thread and immediate context."));

static TAutoConsoleVariable<int32> CVarRHICmdMinDrawsPerParallelCmdList(
	TEXT("r.RHICmdMinDrawsPerParallelCmdList"),
	64,

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/SceneRendering.cpp:347

Scope: file

Source code excerpt:

-----------------------------------------------------------------------------*/

static TAutoConsoleVariable<int32> CVarRHICmdMinCmdlistForParallelSubmit(
	TEXT("r.RHICmdMinCmdlistForParallelSubmit"),
	1,
	TEXT("Minimum number of parallel translate command lists to submit. If there are fewer than this number, they just run on the RHI thread and immediate context."));

static TAutoConsoleVariable<int32> CVarRHICmdMinDrawsPerParallelCmdList(
	TEXT("r.RHICmdMinDrawsPerParallelCmdList"),

#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/SceneRendering.cpp:780

Scope (from outer to inner):

file
function     void FParallelCommandListSet::Dispatch

Source code excerpt:

	ENamedThreads::Type RenderThread_Local = ENamedThreads::GetRenderThread_Local();

	bool bActuallyDoParallelTranslate = GRHISupportsParallelRHIExecute && QueuedCommandLists.Num() >= CVarRHICmdMinCmdlistForParallelSubmit.GetValueOnRenderThread();
	if (bActuallyDoParallelTranslate)
	{
		int32 Total = 0;
		bool bIndeterminate = false;
		for (auto const& CmdList : QueuedCommandLists)
		{