radv/debug: dump ray tracing shaders in case of a hang
authorDaniel Schürmann <daniel@schuermann.dev>
Wed, 22 Mar 2023 20:21:31 +0000 (21:21 +0100)
committerMarge Bot <emma+marge@anholt.net>
Thu, 8 Jun 2023 00:37:03 +0000 (00:37 +0000)
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/22096>

src/amd/vulkan/radv_debug.c

index dc5a3a8..9872e3f 100644 (file)
@@ -499,6 +499,17 @@ radv_dump_queue_state(struct radv_queue *queue, const char *dump_dir, FILE *f)
             radv_dump_shader(device, &graphics_pipeline->base, graphics_pipeline->base.shaders[stage],
                              stage, dump_dir, f);
          }
+      } else if (pipeline->type == RADV_PIPELINE_RAY_TRACING) {
+         struct radv_ray_tracing_pipeline *rt_pipeline = radv_pipeline_to_ray_tracing(pipeline);
+         for (unsigned i = 0; i < rt_pipeline->stage_count; i++) {
+            if (radv_ray_tracing_stage_is_compiled(&rt_pipeline->stages[i])) {
+               struct radv_shader *shader =
+                  container_of(rt_pipeline->stages[i].shader, struct radv_shader, base);
+               radv_dump_shader(device, pipeline, shader, shader->info.stage, dump_dir, f);
+            }
+         }
+         radv_dump_shader(device, pipeline, pipeline->shaders[MESA_SHADER_INTERSECTION],
+                          MESA_SHADER_INTERSECTION, dump_dir, f);
       } else {
          struct radv_compute_pipeline *compute_pipeline =
             radv_pipeline_to_compute(pipeline);
@@ -526,6 +537,17 @@ radv_dump_queue_state(struct radv_queue *queue, const char *dump_dir, FILE *f)
                radv_dump_annotated_shader(graphics_pipeline->base.shaders[stage], stage, waves,
                                           num_waves, f);
             }
+         } else if (pipeline->type == RADV_PIPELINE_RAY_TRACING) {
+            struct radv_ray_tracing_pipeline *rt_pipeline = radv_pipeline_to_ray_tracing(pipeline);
+            for (unsigned i = 0; i < rt_pipeline->stage_count; i++) {
+               if (radv_ray_tracing_stage_is_compiled(&rt_pipeline->stages[i])) {
+                  struct radv_shader *shader =
+                     container_of(rt_pipeline->stages[i].shader, struct radv_shader, base);
+                  radv_dump_annotated_shader(shader, shader->info.stage, waves, num_waves, f);
+               }
+            }
+            radv_dump_annotated_shader(pipeline->shaders[MESA_SHADER_INTERSECTION],
+                                       MESA_SHADER_INTERSECTION, waves, num_waves, f);
          } else {
             struct radv_compute_pipeline *compute_pipeline =
                radv_pipeline_to_compute(pipeline);