r.RDG.VerboseCSVStats

r.RDG.VerboseCSVStats

#Overview

name: r.RDG.VerboseCSVStats

This variable is created as a Console Variable (cvar).

It is referenced in 10 C++ source files.

#Summary

#Usage in the C++ source code

The purpose of r.RDG.VerboseCSVStats is to control the verbosity of CSV (Comma-Separated Values) profiling stats for the Render Dependency Graph (RDG) system in Unreal Engine 5. This setting variable is primarily used for performance analysis and debugging of the rendering pipeline.

The Unreal Engine subsystem that relies on this setting variable is the Render Dependency Graph (RDG) system, which is part of the rendering core. It’s specifically used in the RenderCore module, as evident from the file paths in the callsites.

The value of this variable is set through the console variable system, as shown in the FAutoConsoleVariableRef declaration. It can be changed at runtime using console commands or through configuration files.

The associated variable GRDGVerboseCSVStats interacts directly with r.RDG.VerboseCSVStats. They share the same value, with GRDGVerboseCSVStats being the actual integer variable used in the code, while r.RDG.VerboseCSVStats is the console variable name.

Developers must be aware that:

  1. This variable is render thread safe (ECVF_RenderThreadSafe).
  2. It has two modes: 0 for basic profiling and 1 for more detailed profiling.
  3. Using verbose stats (value 1) may impact performance due to additional profiling overhead.

Best practices when using this variable:

  1. Use it primarily for debugging and performance analysis, not in shipping builds.
  2. Be cautious of performance impact when enabling verbose stats.
  3. Combine with other profiling tools for a comprehensive performance analysis.

Regarding the associated variable GRDGVerboseCSVStats:

#References in C++ code

#Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/RenderCore/Private/RenderGraphPrivate.cpp:435

Scope: file

Source code excerpt:

int32 GRDGVerboseCSVStats = 0;
FAutoConsoleVariableRef CVarRDGVerboseCSVStats(
	TEXT("r.RDG.VerboseCSVStats"),
	GRDGVerboseCSVStats,
	TEXT("Controls the verbosity of CSV profiling stats for RDG.\n")
	TEXT(" 0: emits one CSV profile for graph execution;\n")
	TEXT(" 1: emits a CSV profile for each phase of graph execution."),
	ECVF_RenderThreadSafe);
#endif

#Associated Variable and Callsites

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

#Loc: <Workspace>/Engine/Source/Runtime/RenderCore/Private/RenderGraphAllocator.cpp:71

Scope (from outer to inner):

file
function     void FRDGAllocator::ReleaseAll

Source code excerpt:

void FRDGAllocator::ReleaseAll()
{
	CSV_SCOPED_TIMING_STAT_EXCLUSIVE_CONDITIONAL(RDGAllocator_Clear, GRDGVerboseCSVStats != 0 && IsInRenderingThread());
	TRACE_CPUPROFILER_EVENT_SCOPE(FRDGAllocator::ReleaseAll);

	for (int32 Index = Objects.Num() - 1; Index >= 0; --Index)
	{
#if RDG_USE_MALLOC
		delete Objects[Index];

#Loc: <Workspace>/Engine/Source/Runtime/RenderCore/Private/RenderGraphBuilder.cpp:1202

Scope (from outer to inner):

file
function     void FRDGBuilder::Compile

Source code excerpt:

{
	SCOPE_CYCLE_COUNTER(STAT_RDG_CompileTime);
	CSV_SCOPED_TIMING_STAT_EXCLUSIVE_CONDITIONAL(RDG_Compile, GRDGVerboseCSVStats != 0);

	const FRDGPassHandle ProloguePassHandle = GetProloguePassHandle();
	const FRDGPassHandle EpiloguePassHandle = GetEpiloguePassHandle();

	const uint32 CompilePassCount = Passes.Num();

#Loc: <Workspace>/Engine/Source/Runtime/RenderCore/Private/RenderGraphBuilder.cpp:2401

Scope (from outer to inner):

file
function     FRDGPass* FRDGBuilder::SetupParameterPass

Source code excerpt:

{
	IF_RDG_ENABLE_DEBUG(UserValidation.ValidateAddPass(Pass, AuxiliaryPasses.IsActive()));
	CSV_SCOPED_TIMING_STAT_EXCLUSIVE_CONDITIONAL(RDGBuilder_SetupPass, GRDGVerboseCSVStats != 0);

	SetupPassInternals(Pass);

	if (ParallelSetup.bEnabled)
	{
		MarkResourcesAsProduced(Pass);

#Loc: <Workspace>/Engine/Source/Runtime/RenderCore/Private/RenderGraphBuilder.cpp:2422

Scope (from outer to inner):

file
function     FRDGPass* FRDGBuilder::SetupEmptyPass

Source code excerpt:

{
	IF_RDG_ENABLE_DEBUG(UserValidation.ValidateAddPass(Pass, AuxiliaryPasses.IsActive()));
	CSV_SCOPED_TIMING_STAT_EXCLUSIVE_CONDITIONAL(RDGBuilder_SetupPass, GRDGVerboseCSVStats != 0);

	Pass->bEmptyParameters = true;
	SetupPassInternals(Pass);
	SetupAuxiliaryPasses(Pass);
	return Pass;
}

#Loc: <Workspace>/Engine/Source/Runtime/RenderCore/Private/RenderGraphBuilder.cpp:2886

Scope (from outer to inner):

file
function     void FRDGBuilder::ExecutePassPrologue

Source code excerpt:

void FRDGBuilder::ExecutePassPrologue(FRHIComputeCommandList& RHICmdListPass, FRDGPass* Pass)
{
	CSV_SCOPED_TIMING_STAT_EXCLUSIVE_CONDITIONAL(RDGBuilder_ExecutePassPrologue, GRDGVerboseCSVStats != 0);

	IF_RDG_ENABLE_DEBUG(UserValidation.ValidateExecutePassBegin(Pass));

#if RDG_CMDLIST_STATS
	if (Pass->bSetCommandListStat)
	{

#Loc: <Workspace>/Engine/Source/Runtime/RenderCore/Private/RenderGraphBuilder.cpp:2928

Scope (from outer to inner):

file
function     void FRDGBuilder::ExecutePassEpilogue

Source code excerpt:

void FRDGBuilder::ExecutePassEpilogue(FRHIComputeCommandList& RHICmdListPass, FRDGPass* Pass)
{
	CSV_SCOPED_TIMING_STAT_EXCLUSIVE_CONDITIONAL(RDGBuilder_ExecutePassEpilogue, GRDGVerboseCSVStats != 0);

	EndUAVOverlap(Pass, RHICmdListPass);

	const ERDGPassFlags PassFlags = Pass->Flags;
	const ERHIPipeline PassPipeline = Pass->Pipeline;
	const FRDGParameterStruct PassParameters = Pass->GetParameters();

#Loc: <Workspace>/Engine/Source/Runtime/RenderCore/Private/RenderGraphBuilder.cpp:3322

Scope (from outer to inner):

file
function     void FRDGBuilder::CollectPassBarriers

Source code excerpt:

	SCOPED_NAMED_EVENT_TEXT("FRDGBuilder::CollectBarriers", FColor::Magenta);
	SCOPE_CYCLE_COUNTER(STAT_RDG_CollectBarriersTime);
	CSV_SCOPED_TIMING_STAT_EXCLUSIVE_CONDITIONAL(RDG_CollectBarriers, GRDGVerboseCSVStats != 0);
	FRDGAllocatorScope AllocatorScope(Allocators.Transition);

	for (FRDGPassHandle PassHandle = GetProloguePassHandle() + 1; PassHandle < GetEpiloguePassHandle(); ++PassHandle)
	{
		CollectPassBarriers(PassHandle);
	}

#Loc: <Workspace>/Engine/Source/Runtime/RenderCore/Private/RenderGraphPrivate.cpp:433

Scope: file

Source code excerpt:


#if CSV_PROFILER
int32 GRDGVerboseCSVStats = 0;
FAutoConsoleVariableRef CVarRDGVerboseCSVStats(
	TEXT("r.RDG.VerboseCSVStats"),
	GRDGVerboseCSVStats,
	TEXT("Controls the verbosity of CSV profiling stats for RDG.\n")
	TEXT(" 0: emits one CSV profile for graph execution;\n")
	TEXT(" 1: emits a CSV profile for each phase of graph execution."),
	ECVF_RenderThreadSafe);
#endif

#Loc: <Workspace>/Engine/Source/Runtime/RenderCore/Private/RenderGraphPrivate.h:136

Scope: file

Source code excerpt:


#if CSV_PROFILER
extern int32 GRDGVerboseCSVStats;
#else
const int32 GRDGVerboseCSVStats = 0;
#endif

CSV_DECLARE_CATEGORY_EXTERN(RDGCount);

#define RDG_STATS STATS || COUNTERSTRACE_ENABLED