We now have linking optimisation so we want to delay dumping the
nir until after these are complete.

Fixes: 06f05040eb73 (radv: Link shaders)
---
 src/amd/vulkan/radv_pipeline.c | 9 +++++++--
 src/amd/vulkan/radv_shader.c   | 3 ---
 2 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/src/amd/vulkan/radv_pipeline.c b/src/amd/vulkan/radv_pipeline.c
index 30a90ac960..d6b33a5327 100644
--- a/src/amd/vulkan/radv_pipeline.c
+++ b/src/amd/vulkan/radv_pipeline.c
@@ -1863,22 +1863,27 @@ void radv_create_shaders(struct radv_pipeline *pipeline,
                                                           code_size);
                }
                free(gs_copy_code);
        }
 
        radv_pipeline_cache_insert_shaders(device, cache, hash, 
pipeline->shaders,
                                           (const void**)codes, code_sizes);
 
        for (int i = 0; i < MESA_SHADER_STAGES; ++i) {
                free(codes[i]);
-               if (modules[i] && !pipeline->device->trace_bo)
-                       ralloc_free(nir[i]);
+               if (modules[i]) {
+                       if (device->instance->debug_flags & 
RADV_DEBUG_DUMP_SHADERS)
+                               nir_print_shader(nir[i], stderr);
+
+                       if (!pipeline->device->trace_bo)
+                               ralloc_free(nir[i]);
+               }
        }
 
        if (fs_m.nir)
                ralloc_free(fs_m.nir);
 }
 
 static VkResult
 radv_pipeline_init(struct radv_pipeline *pipeline,
                   struct radv_device *device,
                   struct radv_pipeline_cache *cache,
diff --git a/src/amd/vulkan/radv_shader.c b/src/amd/vulkan/radv_shader.c
index 6176a2e590..5903917068 100644
--- a/src/amd/vulkan/radv_shader.c
+++ b/src/amd/vulkan/radv_shader.c
@@ -284,23 +284,20 @@ radv_shader_compile_to_nir(struct radv_device *device,
        };
 
        nir_lower_tex(nir, &tex_options);
 
        nir_lower_vars_to_ssa(nir);
        nir_lower_var_copies(nir);
        nir_lower_global_vars_to_local(nir);
        nir_remove_dead_variables(nir, nir_var_local);
        radv_optimize_nir(nir);
 
-       if (device->instance->debug_flags & RADV_DEBUG_DUMP_SHADERS)
-               nir_print_shader(nir, stderr);
-
        return nir;
 }
 
 void *
 radv_alloc_shader_memory(struct radv_device *device,
                         struct radv_shader_variant *shader)
 {
        mtx_lock(&device->shader_slab_mutex);
        list_for_each_entry(struct radv_shader_slab, slab, 
&device->shader_slabs, slabs) {
                uint64_t offset = 0;
-- 
2.13.6

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to