r.Lumen.ThreadGroupSize32
r.Lumen.ThreadGroupSize32
#Overview
name: r.Lumen.ThreadGroupSize32
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
Whether to prefer dispatches in groups of 32 threads on HW which supports it (instead of standard 64).
It is referenced in 3
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.Lumen.ThreadGroupSize32 is to control the thread group size for Lumen, Unreal Engine’s global illumination system. It determines whether to prefer dispatches in groups of 32 threads on hardware that supports it, instead of the standard 64 threads.
This setting variable is primarily used by the Lumen subsystem within Unreal Engine’s rendering module. It’s part of the global illumination and lighting system, which is a crucial component of the engine’s graphics pipeline.
The value of this variable is set through a console variable (CVarLumenThreadGroupSize32) with a default value of 1 (enabled). It can be modified at runtime through console commands or project settings.
The associated variable CVarLumenThreadGroupSize32 directly interacts with r.Lumen.ThreadGroupSize32. They share the same value and purpose.
Developers must be aware that this variable only takes effect on hardware that supports wave operations and has a minimum wave size of 32 or less. The actual usage of this setting is determined by the UseThreadGroupSize32() function in the Lumen namespace.
Best practices when using this variable include:
- Ensuring it’s only modified on platforms that support the required hardware features.
- Testing performance with both 32 and 64 thread group sizes to determine the optimal setting for specific hardware configurations.
- Considering the impact on other parts of the rendering pipeline that may interact with Lumen.
Regarding the associated variable CVarLumenThreadGroupSize32:
This is the actual console variable that controls the r.Lumen.ThreadGroupSize32 setting. It’s defined as a TAutoConsoleVariable
The UseThreadGroupSize32() function in the Lumen namespace uses this variable to determine whether to use 32-thread groups. It checks if wave operations are supported (GRHISupportsWaveOperations), if the minimum wave size is 32 or less (GRHIMinimumWaveSize <= 32), and if the console variable is set to a non-zero value.
Developers should be cautious when modifying this variable, as it can affect performance and compatibility across different hardware configurations. It’s important to profile and test thoroughly when adjusting this setting.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/Lumen.cpp:25
Scope: file
Source code excerpt:
static TAutoConsoleVariable<int32> CVarLumenThreadGroupSize32(
TEXT("r.Lumen.ThreadGroupSize32"),
1,
TEXT("Whether to prefer dispatches in groups of 32 threads on HW which supports it (instead of standard 64)."),
ECVF_Scalability | ECVF_RenderThreadSafe
);
bool DoesRuntimePlatformSupportLumen()
#Associated Variable and Callsites
This variable is associated with another variable named CVarLumenThreadGroupSize32
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/Lumen.cpp:24
Scope: file
Source code excerpt:
);
static TAutoConsoleVariable<int32> CVarLumenThreadGroupSize32(
TEXT("r.Lumen.ThreadGroupSize32"),
1,
TEXT("Whether to prefer dispatches in groups of 32 threads on HW which supports it (instead of standard 64)."),
ECVF_Scalability | ECVF_RenderThreadSafe
);
#Loc: <Workspace>/Engine/Source/Runtime/Renderer/Private/Lumen/Lumen.cpp:52
Scope (from outer to inner):
file
function bool Lumen::UseThreadGroupSize32
Source code excerpt:
bool Lumen::UseThreadGroupSize32()
{
return GRHISupportsWaveOperations && GRHIMinimumWaveSize <= 32 && CVarLumenThreadGroupSize32.GetValueOnRenderThread() != 0;
}
namespace Lumen
{
bool AnyLumenHardwareRayTracingPassEnabled(const FScene* Scene, const FViewInfo& View)
{