radv: move RADV_HASH_SHADER_KEEP_STATISTICS to radv_pipeline_key

This is more like a per-pipeline option.

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26948>
This commit is contained in:
Samuel Pitoiset 2024-01-09 09:25:06 +01:00 committed by Marge Bot
parent 4455c79299
commit 10a25f39df
6 changed files with 10 additions and 12 deletions

View file

@ -224,6 +224,8 @@ radv_generate_pipeline_key(const struct radv_device *device, const VkPipelineSha
key.mesh_fast_launch_2 = 1u;
}
key.keep_statistic_info = radv_pipeline_capture_shader_stats(device, flags);
return key;
}
@ -232,7 +234,6 @@ radv_generate_pipeline_key(const struct radv_device *device, const VkPipelineSha
#define RADV_HASH_SHADER_GE_WAVE32 (1 << 3)
#define RADV_HASH_SHADER_LLVM (1 << 4)
#define RADV_HASH_SHADER_CLEAR_LDS (1 << 5)
#define RADV_HASH_SHADER_KEEP_STATISTICS (1 << 8)
#define RADV_HASH_SHADER_USE_NGG_CULLING (1 << 13)
#define RADV_HASH_SHADER_EMULATE_RT (1 << 16)
#define RADV_HASH_SHADER_SPLIT_FMA (1 << 17)
@ -242,7 +243,7 @@ radv_generate_pipeline_key(const struct radv_device *device, const VkPipelineSha
#define RADV_HASH_SHADER_DUAL_BLEND_MRT1 (1 << 21)
uint32_t
radv_get_hash_flags(const struct radv_device *device, bool stats)
radv_get_hash_flags(const struct radv_device *device)
{
uint32_t hash_flags = 0;
@ -260,8 +261,6 @@ radv_get_hash_flags(const struct radv_device *device, bool stats)
hash_flags |= RADV_HASH_SHADER_GE_WAVE32;
if (device->physical_device->use_llvm)
hash_flags |= RADV_HASH_SHADER_LLVM;
if (stats)
hash_flags |= RADV_HASH_SHADER_KEEP_STATISTICS;
if (device->instance->debug_flags & RADV_DEBUG_SPLIT_FMA)
hash_flags |= RADV_HASH_SHADER_SPLIT_FMA;
if (device->instance->debug_flags & RADV_DEBUG_NO_FMASK)

View file

@ -204,8 +204,7 @@ radv_compute_pipeline_compile(struct radv_compute_pipeline *pipeline, struct rad
radv_pipeline_stage_init(pStage, pipeline_layout, &cs_stage);
radv_hash_shaders(hash, &cs_stage, 1, pipeline_layout, pipeline_key,
radv_get_hash_flags(device, keep_statistic_info));
radv_hash_shaders(hash, &cs_stage, 1, pipeline_layout, pipeline_key, radv_get_hash_flags(device));
pipeline->base.pipeline_hash = *(uint64_t *)hash;

View file

@ -2647,7 +2647,7 @@ radv_graphics_pipeline_compile(struct radv_graphics_pipeline *pipeline, const Vk
if (radv_should_compute_pipeline_hash(device, pipeline, fast_linking_enabled)) {
radv_hash_shaders(hash, stages, MESA_VULKAN_SHADER_STAGES, pipeline_layout, pipeline_key,
radv_get_hash_flags(device, keep_statistic_info));
radv_get_hash_flags(device));
pipeline->base.pipeline_hash = *(uint64_t *)hash;
}

View file

@ -287,7 +287,7 @@ radv_init_rt_stage_hashes(struct radv_device *device, const VkRayTracingPipeline
struct radv_shader_stage stage;
radv_pipeline_stage_init(&pCreateInfo->pStages[idx], pipeline_layout, &stage);
radv_hash_shaders(stages[idx].sha1, &stage, 1, NULL, key, radv_get_hash_flags(device, false));
radv_hash_shaders(stages[idx].sha1, &stage, 1, NULL, key, radv_get_hash_flags(device));
}
}
@ -783,11 +783,9 @@ radv_rt_pipeline_create(VkDevice _device, VkPipelineCache _cache, const VkRayTra
if (result != VK_SUCCESS)
goto fail;
bool keep_statistic_info = radv_pipeline_capture_shader_stats(device, pipeline->base.base.create_flags);
bool keep_executable_info = radv_pipeline_capture_shaders(device, pipeline->base.base.create_flags);
radv_hash_rt_shaders(pipeline->sha1, pCreateInfo, &key, pipeline->groups,
radv_get_hash_flags(device, keep_statistic_info));
radv_hash_rt_shaders(pipeline->sha1, pCreateInfo, &key, pipeline->groups, radv_get_hash_flags(device));
pipeline->base.base.pipeline_hash = *(uint64_t *)pipeline->sha1;
bool cache_hit = false;

View file

@ -1990,7 +1990,7 @@ void radv_hash_rt_shaders(unsigned char *hash, const VkRayTracingPipelineCreateI
const struct radv_pipeline_key *key, const struct radv_ray_tracing_group *groups,
uint32_t flags);
uint32_t radv_get_hash_flags(const struct radv_device *device, bool stats);
uint32_t radv_get_hash_flags(const struct radv_device *device);
bool radv_enable_rt(const struct radv_physical_device *pdevice, bool rt_pipelines);

View file

@ -138,6 +138,8 @@ struct radv_pipeline_key {
uint32_t vertex_robustness1 : 1;
uint32_t mesh_fast_launch_2 : 1;
uint32_t keep_statistic_info : 1;
/* Pipeline shader version (up to 8) to force re-compilation when RADV_BUILD_ID_OVERRIDE is enabled. */
uint32_t shader_version : 3;