MinimumWaveSize
MinimumWaveSize
#Overview
name: MinimumWaveSize
The value of this variable can be defined or overridden in .ini config files. 6
.ini config files referencing this setting variable.
It is referenced in 4
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of MinimumWaveSize is to define the minimum number of threads that can be grouped together for wave operations in GPU shader execution. This setting is crucial for the rendering system, particularly for optimizing shader performance on different GPU architectures.
Based on the callsites, this variable is primarily used within the RHI (Rendering Hardware Interface) subsystem of Unreal Engine. It’s a part of the data-driven shader platform information, which helps in configuring shader compilation and execution for various hardware platforms.
The value of this variable is set through the data-driven shader platform info parsing process, as seen in the ParseDataDrivenShaderInfo
function in DataDrivenShaderPlatformInfo.cpp
. It’s stored as an 8-bit field within the FGenericDataDrivenShaderPlatformInfo
class.
MinimumWaveSize interacts closely with MaximumWaveSize, and both are often used together to define the range of wave sizes supported by a particular GPU architecture. It also interacts with the bSupportsWaveOperations
flag, which indicates whether wave operations are supported at all.
Developers must be aware that this variable is platform-specific and can vary depending on the target GPU architecture. It’s crucial for optimizing shader performance, especially when using wave intrinsics or other wave-based operations in shaders.
Best practices when using this variable include:
- Always check
bSupportsWaveOperations
before relying on wave operations in shaders. - Use
GetMinimumWaveSize()
function to retrieve the value, ensuring you’re getting the correct platform-specific information. - Consider both MinimumWaveSize and MaximumWaveSize when optimizing shaders for wave operations.
- Be cautious when writing shaders that depend on specific wave sizes, as they may not be portable across all platforms.
- Use this information to make informed decisions about shader optimizations, balancing between performance and compatibility across different GPU architectures.
#Setting Variables
#References In INI files
Location: <Workspace>/Engine/Config/Android/DataDrivenPlatformInfo.ini:126, section: [ShaderPlatform VULKAN_SM5_ANDROID]
- INI Section:
ShaderPlatform VULKAN_SM5_ANDROID
- Raw value:
4
- Is Array:
False
Location: <Workspace>/Engine/Config/Mac/DataDrivenPlatformInfo.ini:39, section: [ShaderPlatform METAL_SM5]
- INI Section:
ShaderPlatform METAL_SM5
- Raw value:
32
- Is Array:
False
Location: <Workspace>/Engine/Config/Mac/DataDrivenPlatformInfo.ini:79, section: [ShaderPlatform METAL_SM6]
- INI Section:
ShaderPlatform METAL_SM6
- Raw value:
32
- Is Array:
False
Location: <Workspace>/Engine/Config/VulkanPC/DataDrivenPlatformInfo.ini:86, section: [ShaderPlatform VULKAN_SM5]
- INI Section:
ShaderPlatform VULKAN_SM5
- Raw value:
4
- Is Array:
False
Location: <Workspace>/Engine/Config/VulkanPC/DataDrivenPlatformInfo.ini:205, section: [ShaderPlatform VULKAN_SM6]
- INI Section:
ShaderPlatform VULKAN_SM6
- Raw value:
4
- Is Array:
False
Location: <Workspace>/Engine/Config/Windows/DataDrivenPlatformInfo.ini:109, section: [ShaderPlatform PCD3D_SM6]
- INI Section:
ShaderPlatform PCD3D_SM6
- Raw value:
4
- Is Array:
False
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/RHI/Private/DataDrivenShaderPlatformInfo.cpp:242
Scope (from outer to inner):
file
function void FGenericDataDrivenShaderPlatformInfo::ParseDataDrivenShaderInfo
Source code excerpt:
GET_SECTION_SUPPORT_HELPER(bSupportsWaveOperations);
GET_SECTION_BOOL_HELPER(bSupportsWavePermute);
GET_SECTION_INT_HELPER(MinimumWaveSize);
GET_SECTION_INT_HELPER(MaximumWaveSize);
GET_SECTION_BOOL_HELPER(bRequiresExplicit128bitRT);
GET_SECTION_BOOL_HELPER(bSupportsGen5TemporalAA);
GET_SECTION_BOOL_HELPER(bTargetsTiledGPU);
GET_SECTION_BOOL_HELPER(bNeedsOfflineCompiler);
GET_SECTION_BOOL_HELPER(bSupportsComputeFramework);
#Loc: <Workspace>/Engine/Source/Runtime/RHI/Public/DataDrivenShaderPlatformInfo.h:64
Scope (from outer to inner):
file
class class FGenericDataDrivenShaderPlatformInfo
Source code excerpt:
uint32 bSupportsWaveOperations : int32(ERHIFeatureSupport::NumBits);
uint32 bSupportsWavePermute : 1;
uint32 MinimumWaveSize : 8;
uint32 MaximumWaveSize : 8;
uint32 bSupportsIntrinsicWaveOnce : 1;
uint32 bSupportsConservativeRasterization : 1;
uint32 bRequiresExplicit128bitRT : 1;
uint32 bSupportsGen5TemporalAA : 1;
uint32 bTargetsTiledGPU : 1;
#Loc: <Workspace>/Engine/Source/Runtime/RHI/Public/DataDrivenShaderPlatformInfo.h:437
Scope (from outer to inner):
file
class class FGenericDataDrivenShaderPlatformInfo
function static const uint32 GetMinimumWaveSize
Source code excerpt:
{
check(IsValid(Platform));
return Infos[Platform].MinimumWaveSize;
}
static FORCEINLINE_DEBUGGABLE const uint32 GetMaximumWaveSize(const FStaticShaderPlatform Platform)
{
check(IsValid(Platform));
return Infos[Platform].MaximumWaveSize;
#Loc: <Workspace>/Engine/Source/Runtime/RHI/Public/RHIGlobals.h:461
Scope: file
Source code excerpt:
* Rendering code must always check SupportsWaveOperations in addition to wave min/max size.
*/
int32 MinimumWaveSize = 0;
int32 MaximumWaveSize = 0;
/** Whether or not the RHI supports 16bit VALU and resource loads (HLSL shader model 6.2). */
bool SupportsNative16BitOps = false;
/** Whether or not the RHI supports an RHI thread.