MaximumWaveSize

MaximumWaveSize

#Overview

name: MaximumWaveSize

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 MaximumWaveSize is to define the maximum number of threads that can be grouped together for execution in a single wave or wavefront on a GPU. This setting is primarily used in the rendering system, specifically for shader execution and GPU resource management.

The Unreal Engine subsystem that relies on this setting variable is the RHI (Rendering Hardware Interface) module. This can be seen from the file paths in the callsites, which are all within the RHI directory.

The value of this variable is set in the FGenericDataDrivenShaderPlatformInfo class, which is part of the data-driven shader platform information system. It’s parsed from a configuration file using the GET_SECTION_INT_HELPER macro.

MaximumWaveSize interacts with other variables such as MinimumWaveSize and bSupportsWavePermute. These variables together define the characteristics of wave-based shader execution on a particular GPU platform.

Developers must be aware that this value is platform-specific and can vary depending on the GPU hardware. It’s crucial for optimizing shader performance and resource utilization, as it affects how shaders are compiled and executed.

Best practices when using this variable include:

  1. Always check the value for the target platform rather than assuming a specific size.
  2. Use it in conjunction with MinimumWaveSize to ensure shaders are optimized for a range of wave sizes.
  3. Consider this value when designing compute shaders or other parallel processing algorithms to maximize efficiency.
  4. Be aware that exceeding the maximum wave size in shader code can lead to compilation errors or suboptimal performance.

#Setting Variables

#References In INI files

Location: <Workspace>/Engine/Config/Android/DataDrivenPlatformInfo.ini:127, section: [ShaderPlatform VULKAN_SM5_ANDROID]

Location: <Workspace>/Engine/Config/Mac/DataDrivenPlatformInfo.ini:40, section: [ShaderPlatform METAL_SM5]

Location: <Workspace>/Engine/Config/Mac/DataDrivenPlatformInfo.ini:80, section: [ShaderPlatform METAL_SM6]

Location: <Workspace>/Engine/Config/VulkanPC/DataDrivenPlatformInfo.ini:87, section: [ShaderPlatform VULKAN_SM5]

Location: <Workspace>/Engine/Config/VulkanPC/DataDrivenPlatformInfo.ini:206, section: [ShaderPlatform VULKAN_SM6]

Location: <Workspace>/Engine/Config/Windows/DataDrivenPlatformInfo.ini:110, section: [ShaderPlatform PCD3D_SM6]

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/RHI/Private/DataDrivenShaderPlatformInfo.cpp:243

Scope (from outer to inner):

file
function     void FGenericDataDrivenShaderPlatformInfo::ParseDataDrivenShaderInfo

Source code excerpt:

	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);
	GET_SECTION_BOOL_HELPER(bSupportsAnisotropicMaterials);

#Loc: <Workspace>/Engine/Source/Runtime/RHI/Public/DataDrivenShaderPlatformInfo.h:65

Scope (from outer to inner):

file
class        class FGenericDataDrivenShaderPlatformInfo

Source code excerpt:

	uint32 bSupportsWavePermute : 1;
	uint32 MinimumWaveSize : 8;
	uint32 MaximumWaveSize : 8;
	uint32 bSupportsIntrinsicWaveOnce : 1;
	uint32 bSupportsConservativeRasterization : 1;
	uint32 bRequiresExplicit128bitRT : 1;
	uint32 bSupportsGen5TemporalAA : 1;
	uint32 bTargetsTiledGPU : 1;
	uint32 bNeedsOfflineCompiler : 1;

#Loc: <Workspace>/Engine/Source/Runtime/RHI/Public/DataDrivenShaderPlatformInfo.h:443

Scope (from outer to inner):

file
class        class FGenericDataDrivenShaderPlatformInfo
function     static const uint32 GetMaximumWaveSize

Source code excerpt:

	{
		check(IsValid(Platform));
		return Infos[Platform].MaximumWaveSize;
	}

	static FORCEINLINE_DEBUGGABLE const bool GetSupportsTemporalHistoryUpscale(const FStaticShaderPlatform Platform)
	{
		check(IsValid(Platform));
		return Infos[Platform].bSupportsTemporalHistoryUpscale;

#Loc: <Workspace>/Engine/Source/Runtime/RHI/Public/RHIGlobals.h:462

Scope: file

Source code excerpt:

	*/
	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.
	Requirements for RHI thread