r.Vulkan.PipelineLRUCacheEvictBinary
r.Vulkan.PipelineLRUCacheEvictBinary
#Overview
name: r.Vulkan.PipelineLRUCacheEvictBinary
This variable is created as a Console Variable (cvar).
- type:
Var
- help:
0: create pipelines in from the binary PSO cache and binary shader cache and evict them only as it fills up.\n1: don\'t create pipelines....just immediately evict them
It is referenced in 4
C++ source files.
#Summary
#Usage in the C++ source code
The purpose of r.Vulkan.PipelineLRUCacheEvictBinary is to control the behavior of pipeline creation and eviction in the Vulkan rendering system of Unreal Engine 5. Specifically, it determines whether pipelines should be created from the binary PSO (Pipeline State Object) cache and binary shader cache, or if they should be immediately evicted.
This setting variable is primarily used by the Vulkan RHI (Rendering Hardware Interface) subsystem of Unreal Engine 5. It is part of the rendering system, particularly the pipeline management for Vulkan graphics API.
The value of this variable is set through a console variable (CVarPipelineLRUCacheEvictBinary) in the Vulkan pipeline management code. It can be changed at runtime through console commands or configuration files.
The associated variable CVarPipelineLRUCacheEvictBinary directly interacts with r.Vulkan.PipelineLRUCacheEvictBinary. They share the same value and purpose.
Developers must be aware that:
- Setting this variable to 0 (default) allows the creation of pipelines from the binary PSO cache and shader cache, evicting them only as the cache fills up.
- Setting it to 1 prevents pipeline creation and immediately evicts them, which could impact performance but may be useful for debugging or specific optimization scenarios.
Best practices when using this variable include:
- Leave it at the default value (0) for normal operation to benefit from pipeline caching.
- Use it for debugging pipeline-related issues or when investigating performance anomalies related to pipeline creation.
- Be cautious when setting it to 1 in production environments, as it may significantly impact rendering performance.
Regarding the associated variable CVarPipelineLRUCacheEvictBinary:
- It is an auto console variable of type int32.
- It is defined with the same name as the setting variable (r.Vulkan.PipelineLRUCacheEvictBinary).
- It is used to actually implement the functionality described by the setting variable.
- It is accessed in the code to determine the behavior of pipeline creation and eviction.
- When using this variable in C++ code, developers should use CVarPipelineLRUCacheEvictBinary.GetValueOnAnyThread() to retrieve its current value.
#References in C++ code
#Callsites
This variable is referenced in the following C++ source code:
#Loc: <Workspace>/Engine/Source/Runtime/VulkanRHI/Private/VulkanPipeline.cpp:76
Scope: file
Source code excerpt:
TAutoConsoleVariable<int32> CVarPipelineLRUCacheEvictBinary(
TEXT("r.Vulkan.PipelineLRUCacheEvictBinary"),
0,
TEXT("0: create pipelines in from the binary PSO cache and binary shader cache and evict them only as it fills up.\n")
TEXT("1: don't create pipelines....just immediately evict them"),
ECVF_RenderThreadSafe | ECVF_ReadOnly);
#Associated Variable and Callsites
This variable is associated with another variable named CVarPipelineLRUCacheEvictBinary
. They share the same value. See the following C++ source code.
#Loc: <Workspace>/Engine/Source/Runtime/VulkanRHI/Private/VulkanPipeline.cpp:75
Scope: file
Source code excerpt:
ECVF_RenderThreadSafe | ECVF_ReadOnly);
TAutoConsoleVariable<int32> CVarPipelineLRUCacheEvictBinary(
TEXT("r.Vulkan.PipelineLRUCacheEvictBinary"),
0,
TEXT("0: create pipelines in from the binary PSO cache and binary shader cache and evict them only as it fills up.\n")
TEXT("1: don't create pipelines....just immediately evict them"),
ECVF_RenderThreadSafe | ECVF_ReadOnly);
#Loc: <Workspace>/Engine/Source/Runtime/VulkanRHI/Private/VulkanPipeline.cpp:547
Scope (from outer to inner):
file
function void FVulkanPipelineStateCacheManager::OnShaderPipelineCacheOpened
Source code excerpt:
PlatformFile.MoveFile(*CompiledPSOCacheFolderName, *TempName);
if (CVarPipelineLRUCacheEvictBinary.GetValueOnAnyThread())
{
bEvictImmediately = true;
}
}
else
{
#Loc: <Workspace>/Engine/Source/Runtime/VulkanRHI/Private/VulkanPipeline.cpp:1537
Scope (from outer to inner):
file
function VkResult FVulkanPipelineStateCacheManager::CreateVKPipeline
Source code excerpt:
#if PLATFORM_ANDROID
if (bIsPrecompileJob && FVulkanAndroidPlatform::AreRemoteCompileServicesActive() /*&&
CVarPipelineLRUCacheEvictBinary.GetValueOnAnyThread()*/)
{
FVulkanShader::FSpirvCode VS = PSO->GetPatchedSpirvCode(Shaders[ShaderStage::Vertex]);
FVulkanShader::FSpirvCode PS = PSO->GetPatchedSpirvCode(Shaders[ShaderStage::Pixel]);
TArrayView<uint32_t> VSCode = VS.GetCodeView();
TArrayView<uint32_t> PSCode = PS.GetCodeView();
size_t AfterSize = 0;