D3D12.PSO.StallWarningThresholdInMs

D3D12.PSO.StallWarningThresholdInMs

#Overview

name: D3D12.PSO.StallWarningThresholdInMs

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 D3D12.PSO.StallWarningThresholdInMs is to set a threshold for logging warning messages about stalls due to Pipeline State Object (PSO) creation in the DirectX 12 rendering system.

This setting variable is primarily used in the D3D12RHI (DirectX 12 Render Hardware Interface) module of Unreal Engine 5, which is responsible for interfacing with the DirectX 12 API for rendering.

The value of this variable is set through a console variable (CVarPSOStallWarningThresholdInMs) with a default value of 100.0 milliseconds. It can be modified at runtime through console commands or configuration files.

The associated variable CVarPSOStallWarningThresholdInMs interacts directly with this setting. It’s an instance of TAutoConsoleVariable, which allows for runtime modification and querying of the value.

Developers must be aware that this variable affects the logging behavior of the engine, specifically for PSO creation stalls. Setting it too low might result in excessive logging, while setting it too high might cause important stalls to go unnoticed.

Best practices when using this variable include:

  1. Adjusting the value based on the specific needs of the project and hardware capabilities.
  2. Monitoring logs during development to catch any PSO creation stalls that might impact performance.
  3. Using this in conjunction with other PSO-related optimizations to improve overall rendering performance.

Regarding the associated variable CVarPSOStallWarningThresholdInMs:

The purpose of CVarPSOStallWarningThresholdInMs is to provide a runtime-configurable way to access and modify the D3D12.PSO.StallWarningThresholdInMs setting.

This variable is used directly in the D3D12RHI module, specifically in the FD3D12PipelineState::InternalGetPipelineState function. It’s used to determine when to log warnings about PSO creation stalls.

The value of this variable is set when it’s declared, but can be modified at runtime through console commands.

It interacts directly with the D3D12.PSO.StallWarningThresholdInMs setting, effectively serving as its interface within the C++ code.

Developers should be aware that changes to this variable will immediately affect the engine’s logging behavior for PSO creation stalls.

Best practices for using this variable include:

  1. Using it for debugging and performance tuning during development.
  2. Considering performance implications when modifying it, especially in shipping builds.
  3. Documenting any non-default values used in the project for easier maintenance and debugging.

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/D3D12RHI/Private/D3D12Pipelinestate.cpp:9

Scope: file

Source code excerpt:


static TAutoConsoleVariable<float> CVarPSOStallWarningThresholdInMs(
	TEXT("D3D12.PSO.StallWarningThresholdInMs"),
	100.0f,
	TEXT("Sets a threshold of when to logs messages about stalls due to PSO creation.\n")
	TEXT("Value is in milliseconds. (100 is the default)\n"),
	ECVF_ReadOnly);

int32 GPSOPrecacheKeepLowLevel = 0;

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/D3D12RHI/Private/D3D12Pipelinestate.cpp:8

Scope: file

Source code excerpt:

#include "Hash/CityHash.h"

static TAutoConsoleVariable<float> CVarPSOStallWarningThresholdInMs(
	TEXT("D3D12.PSO.StallWarningThresholdInMs"),
	100.0f,
	TEXT("Sets a threshold of when to logs messages about stalls due to PSO creation.\n")
	TEXT("Value is in milliseconds. (100 is the default)\n"),
	ECVF_ReadOnly);

#Loc: <Workspace>/Engine/Source/Runtime/D3D12RHI/Private/D3D12Pipelinestate.cpp:332

Scope (from outer to inner):

file
function     ID3D12PipelineState* FD3D12PipelineState::InternalGetPipelineState

Source code excerpt:

		{
			double StartTime = FPlatformTime::Seconds();
			double BusyWaitWarningTime = CVarPSOStallWarningThresholdInMs.GetValueOnAnyThread() * 0.001;
			while (InitState == PSOInitState::Uninitialized)
			{
				const double Time = FPlatformTime::Seconds();

				if (Time - StartTime > BusyWaitWarningTime)
				{