radv: Only generate debug info if required
authorKonstantin Seurer <konstantin.seurer@gmail.com>
Mon, 28 Aug 2023 13:39:44 +0000 (15:39 +0200)
committerMarge Bot <emma+marge@anholt.net>
Fri, 1 Sep 2023 07:23:33 +0000 (07:23 +0000)
Fixes: 51f2fa1a5ef ("radv: Break up radv_shader_nir_to_asm")
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24906>

src/amd/vulkan/radv_pipeline_compute.c
src/amd/vulkan/radv_pipeline_graphics.c
src/amd/vulkan/radv_pipeline_rt.c
src/amd/vulkan/radv_shader.c
src/amd/vulkan/radv_shader.h

index e44ccaa..2649899 100644 (file)
@@ -166,7 +166,8 @@ radv_compile_cs(struct radv_device *device, struct vk_pipeline_cache *cache, str
 
    cs_shader = radv_shader_create(device, cache, *cs_binary, keep_executable_info || dump_shader);
 
-   radv_shader_generate_debug_info(device, dump_shader, *cs_binary, cs_shader, &cs_stage->nir, 1, &cs_stage->info);
+   radv_shader_generate_debug_info(device, dump_shader, keep_executable_info, *cs_binary, cs_shader, &cs_stage->nir, 1,
+                                   &cs_stage->info);
 
    if (keep_executable_info && cs_stage->spirv.size) {
       cs_shader->spirv = malloc(cs_stage->spirv.size);
index c4742cf..861bcaf 100644 (file)
@@ -2241,7 +2241,8 @@ radv_create_gs_copy_shader(struct radv_device *device, struct vk_pipeline_cache
    struct radv_shader *copy_shader =
       radv_shader_create(device, cache, *gs_copy_binary, keep_executable_info || dump_shader);
    if (copy_shader)
-      radv_shader_generate_debug_info(device, dump_shader, *gs_copy_binary, copy_shader, &nir, 1, &gs_copy_stage.info);
+      radv_shader_generate_debug_info(device, dump_shader, keep_executable_info, *gs_copy_binary, copy_shader, &nir, 1,
+                                      &gs_copy_stage.info);
    return copy_shader;
 }
 
@@ -2283,8 +2284,8 @@ 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, pipeline_key,
                                            keep_executable_info, keep_statistic_info);
       shaders[s] = radv_shader_create(device, cache, binaries[s], keep_executable_info || dump_shader);
-      radv_shader_generate_debug_info(device, dump_shader, binaries[s], shaders[s], nir_shaders, shader_count,
-                                      &stages[s].info);
+      radv_shader_generate_debug_info(device, dump_shader, keep_executable_info, binaries[s], shaders[s], nir_shaders,
+                                      shader_count, &stages[s].info);
 
       if (s == MESA_SHADER_GEOMETRY && !stages[s].info.is_ngg) {
          *gs_copy_shader = radv_create_gs_copy_shader(device, cache, &stages[MESA_SHADER_GEOMETRY], pipeline_key,
index 9e5e998..d06ea9e 100644 (file)
@@ -434,7 +434,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) {
-      radv_shader_generate_debug_info(device, dump_shader, binary, shader, shaders, num_shaders, &stage->info);
+      radv_shader_generate_debug_info(device, dump_shader, keep_executable_info, binary, shader, shaders, num_shaders,
+                                      &stage->info);
 
       if (shader && keep_executable_info && stage->spirv.size) {
          shader->spirv = malloc(stage->spirv.size);
index e510ac0..075f6a6 100644 (file)
@@ -2383,11 +2383,12 @@ radv_shader_nir_to_asm(struct radv_device *device, struct radv_shader_stage *pl_
 }
 
 void
-radv_shader_generate_debug_info(struct radv_device *device, bool dump_shader, struct radv_shader_binary *binary,
-                                struct radv_shader *shader, struct nir_shader *const *shaders, int shader_count,
-                                struct radv_shader_info *info)
+radv_shader_generate_debug_info(struct radv_device *device, bool dump_shader, bool keep_shader_info,
+                                struct radv_shader_binary *binary, struct radv_shader *shader,
+                                struct nir_shader *const *shaders, int shader_count, struct radv_shader_info *info)
 {
-   radv_capture_shader_executable_info(device, shader, shaders, shader_count, binary);
+   if (dump_shader || keep_shader_info)
+      radv_capture_shader_executable_info(device, shader, shaders, shader_count, binary);
 
    if (dump_shader) {
       fprintf(stderr, "%s", radv_get_shader_name(info, shaders[0]->info.stage));
index 0c53695..9545bff 100644 (file)
@@ -657,8 +657,9 @@ struct radv_shader_binary *radv_shader_nir_to_asm(struct radv_device *device, st
                                                   const struct radv_pipeline_key *key, bool keep_shader_info,
                                                   bool keep_statistic_info);
 
-void radv_shader_generate_debug_info(struct radv_device *device, bool dump_shader, struct radv_shader_binary *binary,
-                                     struct radv_shader *shader, struct nir_shader *const *shaders, int shader_count,
+void radv_shader_generate_debug_info(struct radv_device *device, bool dump_shader, bool keep_shader_info,
+                                     struct radv_shader_binary *binary, struct radv_shader *shader,
+                                     struct nir_shader *const *shaders, int shader_count,
                                      struct radv_shader_info *info);
 
 VkResult radv_shader_wait_for_upload(struct radv_device *device, uint64_t seq);