Module: Mesa Branch: main Commit: 10a25f39df96af4c056711152d8603a15f09f468 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=10a25f39df96af4c056711152d8603a15f09f468
Author: Samuel Pitoiset <[email protected]> Date: Tue Jan 9 09:25:06 2024 +0100 radv: move RADV_HASH_SHADER_KEEP_STATISTICS to radv_pipeline_key This is more like a per-pipeline option. Signed-off-by: Samuel Pitoiset <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26948> --- src/amd/vulkan/radv_pipeline.c | 7 +++---- src/amd/vulkan/radv_pipeline_compute.c | 3 +-- src/amd/vulkan/radv_pipeline_graphics.c | 2 +- src/amd/vulkan/radv_pipeline_rt.c | 6 ++---- src/amd/vulkan/radv_private.h | 2 +- src/amd/vulkan/radv_shader.h | 2 ++ 6 files changed, 10 insertions(+), 12 deletions(-) diff --git a/src/amd/vulkan/radv_pipeline.c b/src/amd/vulkan/radv_pipeline.c index d7d25e304ad..fbc00cd069e 100644 --- a/src/amd/vulkan/radv_pipeline.c +++ b/src/amd/vulkan/radv_pipeline.c @@ -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) diff --git a/src/amd/vulkan/radv_pipeline_compute.c b/src/amd/vulkan/radv_pipeline_compute.c index edc14e6130c..27759fa645b 100644 --- a/src/amd/vulkan/radv_pipeline_compute.c +++ b/src/amd/vulkan/radv_pipeline_compute.c @@ -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; diff --git a/src/amd/vulkan/radv_pipeline_graphics.c b/src/amd/vulkan/radv_pipeline_graphics.c index 2e7078f3fe3..726f77c4dbf 100644 --- a/src/amd/vulkan/radv_pipeline_graphics.c +++ b/src/amd/vulkan/radv_pipeline_graphics.c @@ -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; } diff --git a/src/amd/vulkan/radv_pipeline_rt.c b/src/amd/vulkan/radv_pipeline_rt.c index 04bb1edd493..eb573da0a9c 100644 --- a/src/amd/vulkan/radv_pipeline_rt.c +++ b/src/amd/vulkan/radv_pipeline_rt.c @@ -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; diff --git a/src/amd/vulkan/radv_private.h b/src/amd/vulkan/radv_private.h index 46dc641bcd4..8106245403c 100644 --- a/src/amd/vulkan/radv_private.h +++ b/src/amd/vulkan/radv_private.h @@ -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); diff --git a/src/amd/vulkan/radv_shader.h b/src/amd/vulkan/radv_shader.h index 0925a4fc7a6..3b88e97470d 100644 --- a/src/amd/vulkan/radv_shader.h +++ b/src/amd/vulkan/radv_shader.h @@ -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;
