diff --git a/src/amd/vulkan/radv_pipeline_compute.c b/src/amd/vulkan/radv_pipeline_compute.c index 6c36bdb7291..8b9f0c6d3f9 100644 --- a/src/amd/vulkan/radv_pipeline_compute.c +++ b/src/amd/vulkan/radv_pipeline_compute.c @@ -210,6 +210,7 @@ radv_compute_pipeline_compile(struct radv_compute_pipeline *pipeline, struct rad VkPipelineCreationFeedback pipeline_feedback = { .flags = VK_PIPELINE_CREATION_FEEDBACK_VALID_BIT, }; + bool skip_shaders_cache = false; VkResult result = VK_SUCCESS; int64_t pipeline_start = os_time_get_nano(); @@ -220,8 +221,15 @@ radv_compute_pipeline_compile(struct radv_compute_pipeline *pipeline, struct rad pipeline->base.pipeline_hash = *(uint64_t *)hash; + /* Skip the shaders cache when any of the below are true: + * - shaders are captured because it's for debugging purposes + */ + if (keep_executable_info) { + skip_shaders_cache = true; + } + bool found_in_application_cache = true; - if (!keep_executable_info && + if (!skip_shaders_cache && radv_pipeline_cache_search(device, cache, &pipeline->base, hash, &found_in_application_cache)) { if (found_in_application_cache) pipeline_feedback.flags |= VK_PIPELINE_CREATION_FEEDBACK_APPLICATION_PIPELINE_CACHE_HIT_BIT; @@ -239,7 +247,7 @@ radv_compute_pipeline_compile(struct radv_compute_pipeline *pipeline, struct rad cs_stage.feedback.duration += os_time_get_nano() - stage_start; - if (!keep_executable_info) { + if (!skip_shaders_cache) { radv_pipeline_cache_insert(device, cache, &pipeline->base, hash); } diff --git a/src/amd/vulkan/radv_pipeline_rt.c b/src/amd/vulkan/radv_pipeline_rt.c index 39bd4757e4f..26e96c6ad39 100644 --- a/src/amd/vulkan/radv_pipeline_rt.c +++ b/src/amd/vulkan/radv_pipeline_rt.c @@ -842,6 +842,7 @@ radv_rt_pipeline_create(VkDevice _device, VkPipelineCache _cache, const VkRayTra VK_FROM_HANDLE(radv_device, device, _device); VK_FROM_HANDLE(vk_pipeline_cache, cache, _cache); VK_FROM_HANDLE(radv_pipeline_layout, pipeline_layout, pCreateInfo->layout); + bool skip_shaders_cache = false; VkResult result; const VkPipelineCreationFeedbackCreateInfo *creation_feedback = vk_find_struct_const(pCreateInfo->pNext, PIPELINE_CREATION_FEEDBACK_CREATE_INFO); @@ -892,8 +893,16 @@ radv_rt_pipeline_create(VkDevice _device, VkPipelineCache _cache, const VkRayTra radv_hash_rt_shaders(device, pipeline->sha1, stages, pCreateInfo, pipeline->groups); pipeline->base.base.pipeline_hash = *(uint64_t *)pipeline->sha1; + /* Skip the shaders cache when any of the below are true: + * - shaders are captured because it's for debugging purposes + * - ray history is enabled + */ + if (keep_executable_info || emit_ray_history) { + skip_shaders_cache = true; + } + bool cache_hit = false; - if (!keep_executable_info && !emit_ray_history) + if (!skip_shaders_cache) cache_hit = radv_ray_tracing_pipeline_cache_search(device, cache, pipeline, pCreateInfo); if (!cache_hit) { @@ -913,7 +922,7 @@ radv_rt_pipeline_create(VkDevice _device, VkPipelineCache _cache, const VkRayTra radv_rmv_log_rt_pipeline_create(device, pipeline); - if (!cache_hit && !emit_ray_history) + if (!cache_hit && !skip_shaders_cache) radv_ray_tracing_pipeline_cache_insert(device, cache, pipeline, pCreateInfo->stageCount, pipeline->sha1); /* write shader VAs into group handles */