diff --git a/src/amd/vulkan/radv_pipeline_compute.c b/src/amd/vulkan/radv_pipeline_compute.c index 9863a6c7bb8..057abd480fd 100644 --- a/src/amd/vulkan/radv_pipeline_compute.c +++ b/src/amd/vulkan/radv_pipeline_compute.c @@ -129,14 +129,15 @@ radv_compile_cs(struct radv_device *device, struct vk_pipeline_cache *cache, str } } - char *nir_string = NULL; - if (keep_executable_info || dump_shader) - nir_string = radv_dump_nir_shaders(instance, &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); + /* Dump NIR after nir_to_asm, because ACO modifies it. */ + char *nir_string = NULL; + if (keep_executable_info || dump_shader) + nir_string = radv_dump_nir_shaders(instance, &cs_stage->nir, 1); + cs_shader = radv_shader_create(device, cache, *cs_binary, skip_shaders_cache || dump_shader); cs_shader->nir_string = nir_string; diff --git a/src/amd/vulkan/radv_pipeline_graphics.c b/src/amd/vulkan/radv_pipeline_graphics.c index e45deeabcd2..07a5fa3c096 100644 --- a/src/amd/vulkan/radv_pipeline_graphics.c +++ b/src/amd/vulkan/radv_pipeline_graphics.c @@ -2313,12 +2313,13 @@ radv_create_gs_copy_shader(struct radv_device *device, struct vk_pipeline_cache if (dump_shader) simple_mtx_lock(&instance->shader_dump_mtx); + *gs_copy_binary = radv_shader_nir_to_asm(device, &gs_copy_stage, &nir, 1, &key.gfx_state, keep_executable_info, + keep_statistic_info); + char *nir_string = NULL; if (keep_executable_info || dump_shader) nir_string = radv_dump_nir_shaders(instance, &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, skip_shaders_cache || dump_shader); @@ -2386,12 +2387,14 @@ radv_graphics_shaders_nir_to_asm(struct radv_device *device, struct vk_pipeline_ } } + binaries[s] = radv_shader_nir_to_asm(device, &stages[s], nir_shaders, shader_count, gfx_state, + keep_executable_info, keep_statistic_info); + + /* Dump NIR after nir_to_asm, because ACO modifies it. */ char *nir_string = NULL; if (keep_executable_info || dump_shader) nir_string = radv_dump_nir_shaders(instance, 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], skip_shaders_cache || dump_shader); shaders[s]->nir_string = nir_string; diff --git a/src/amd/vulkan/radv_pipeline_rt.c b/src/amd/vulkan/radv_pipeline_rt.c index e906494f827..ef5af35d76c 100644 --- a/src/amd/vulkan/radv_pipeline_rt.c +++ b/src/amd/vulkan/radv_pipeline_rt.c @@ -452,13 +452,15 @@ radv_rt_nir_to_asm(struct radv_device *device, struct vk_pipeline_cache *cache, } } + /* Compile NIR shader to AMD assembly. */ + binary = + radv_shader_nir_to_asm(device, stage, shaders, num_shaders, NULL, keep_executable_info, keep_statistic_info); + + /* Dump NIR after nir_to_asm, because ACO modifies it. */ char *nir_string = NULL; if (keep_executable_info || dump_shader) nir_string = radv_dump_nir_shaders(instance, 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); struct radv_shader *shader; if (replay_block || replayable) { VkResult result = radv_shader_create_uncached(device, binary, replayable, replay_block, &shader);