diff --git a/src/amd/vulkan/radv_pipeline_compute.c b/src/amd/vulkan/radv_pipeline_compute.c index 32d04d44257..99fe27eb581 100644 --- a/src/amd/vulkan/radv_pipeline_compute.c +++ b/src/amd/vulkan/radv_pipeline_compute.c @@ -125,12 +125,18 @@ radv_compile_cs(struct radv_device *device, struct vk_pipeline_cache *cache, str nir_print_shader(cs_stage->nir, stderr); } + char *nir_string = NULL; + if (keep_executable_info || dump_shader) + nir_string = radv_dump_nir_shaders(&cs_stage->nir, 1); + /* Compile NIR shader to AMD assembly. */ *cs_binary = radv_shader_nir_to_asm(device, cs_stage, &cs_stage->nir, 1, NULL, keep_executable_info, keep_statistic_info); cs_shader = radv_shader_create(device, cache, *cs_binary, keep_executable_info || dump_shader); + cs_shader->nir_string = nir_string; + radv_shader_generate_debug_info(device, dump_shader, keep_executable_info, *cs_binary, cs_shader, &cs_stage->nir, 1, &cs_stage->info); diff --git a/src/amd/vulkan/radv_pipeline_graphics.c b/src/amd/vulkan/radv_pipeline_graphics.c index 70529c9d600..53213bfafb5 100644 --- a/src/amd/vulkan/radv_pipeline_graphics.c +++ b/src/amd/vulkan/radv_pipeline_graphics.c @@ -2275,13 +2275,20 @@ radv_create_gs_copy_shader(struct radv_device *device, struct vk_pipeline_cache if (dump_shader) simple_mtx_lock(&instance->shader_dump_mtx); + char *nir_string = NULL; + if (keep_executable_info || dump_shader) + nir_string = radv_dump_nir_shaders(&nir, 1); + *gs_copy_binary = radv_shader_nir_to_asm(device, &gs_copy_stage, &nir, 1, &key.gfx_state, keep_executable_info, keep_statistic_info); struct radv_shader *copy_shader = radv_shader_create(device, cache, *gs_copy_binary, keep_executable_info || dump_shader); - if (copy_shader) + + if (copy_shader) { + copy_shader->nir_string = nir_string; radv_shader_generate_debug_info(device, dump_shader, keep_executable_info, *gs_copy_binary, copy_shader, &nir, 1, &gs_copy_stage.info); + } if (dump_shader) simple_mtx_unlock(&instance->shader_dump_mtx); @@ -2335,9 +2342,16 @@ radv_graphics_shaders_nir_to_asm(struct radv_device *device, struct vk_pipeline_ nir_print_shader(nir_shaders[i], stderr); } + char *nir_string = NULL; + if (keep_executable_info || dump_shader) + nir_string = radv_dump_nir_shaders(nir_shaders, shader_count); + binaries[s] = radv_shader_nir_to_asm(device, &stages[s], nir_shaders, shader_count, gfx_state, keep_executable_info, keep_statistic_info); shaders[s] = radv_shader_create(device, cache, binaries[s], keep_executable_info || dump_shader); + + shaders[s]->nir_string = nir_string; + radv_shader_generate_debug_info(device, dump_shader, keep_executable_info, binaries[s], shaders[s], nir_shaders, shader_count, &stages[s].info); diff --git a/src/amd/vulkan/radv_pipeline_rt.c b/src/amd/vulkan/radv_pipeline_rt.c index 8d9ba4d6047..4565f845473 100644 --- a/src/amd/vulkan/radv_pipeline_rt.c +++ b/src/amd/vulkan/radv_pipeline_rt.c @@ -444,6 +444,10 @@ radv_rt_nir_to_asm(struct radv_device *device, struct vk_pipeline_cache *cache, nir_print_shader(shaders[i], stderr); } + char *nir_string = NULL; + if (keep_executable_info || dump_shader) + nir_string = radv_dump_nir_shaders(shaders, num_shaders); + /* Compile NIR shader to AMD assembly. */ binary = radv_shader_nir_to_asm(device, stage, shaders, num_shaders, NULL, keep_executable_info, keep_statistic_info); @@ -461,6 +465,8 @@ radv_rt_nir_to_asm(struct radv_device *device, struct vk_pipeline_cache *cache, shader = radv_shader_create(device, cache, binary, keep_executable_info || dump_shader); if (shader) { + shader->nir_string = nir_string; + radv_shader_generate_debug_info(device, dump_shader, keep_executable_info, binary, shader, shaders, num_shaders, &stage->info); diff --git a/src/amd/vulkan/radv_shader.c b/src/amd/vulkan/radv_shader.c index fbefedde9e5..bdc3098e73d 100644 --- a/src/amd/vulkan/radv_shader.c +++ b/src/amd/vulkan/radv_shader.c @@ -2851,7 +2851,7 @@ radv_shader_part_cache_get(struct radv_device *device, struct radv_shader_part_c return shader_part; } -static char * +char * radv_dump_nir_shaders(struct nir_shader *const *shaders, int shader_count) { char *data = NULL; @@ -2968,8 +2968,6 @@ radv_capture_shader_executable_info(struct radv_device *device, struct radv_shad struct nir_shader *const *shaders, int shader_count, const struct radv_shader_binary *binary) { - shader->nir_string = radv_dump_nir_shaders(shaders, shader_count); - if (binary->type == RADV_BINARY_TYPE_RTLD) { #if !defined(USE_LIBELF) return; diff --git a/src/amd/vulkan/radv_shader.h b/src/amd/vulkan/radv_shader.h index 8a71e577460..c796fc62090 100644 --- a/src/amd/vulkan/radv_shader.h +++ b/src/amd/vulkan/radv_shader.h @@ -547,6 +547,8 @@ void radv_shader_generate_debug_info(struct radv_device *device, bool dump_shade struct nir_shader *const *shaders, int shader_count, struct radv_shader_info *info); +char *radv_dump_nir_shaders(struct nir_shader *const *shaders, int shader_count); + VkResult radv_shader_wait_for_upload(struct radv_device *device, uint64_t seq); struct radv_shader_dma_submission *radv_shader_dma_pop_submission(struct radv_device *device);