radv: Add RADV_DEBUG=nort

This makes vkCmdTraceRaysKHR and ray queries no-ops and is useful
for triaging GPU hangs with raytracing.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23603>
This commit is contained in:
Friedrich Vock
2023-06-12 19:41:18 +02:00
committed by Marge Bot
parent c17d0cc488
commit fa7c7791ee
7 changed files with 16 additions and 3 deletions

View File

@@ -1160,6 +1160,9 @@ RADV driver environment variables
disable NGG for GFX10 and GFX10.3 disable NGG for GFX10 and GFX10.3
``nonggc`` ``nonggc``
disable NGG culling on GPUs where it's enabled by default (GFX10.3+ only). disable NGG culling on GPUs where it's enabled by default (GFX10.3+ only).
``nort``
skip executing vkCmdTraceRays and ray queries (RT extensions will still be
advertised)
``notccompatcmask`` ``notccompatcmask``
disable TC-compat CMASK for MSAA surfaces disable TC-compat CMASK for MSAA surfaces
``noumr`` ``noumr``

View File

@@ -27,6 +27,7 @@
#include "util/hash_table.h" #include "util/hash_table.h"
#include "bvh/bvh.h" #include "bvh/bvh.h"
#include "radv_debug.h"
#include "radv_nir.h" #include "radv_nir.h"
#include "radv_private.h" #include "radv_private.h"
#include "radv_rt_common.h" #include "radv_rt_common.h"
@@ -372,7 +373,7 @@ enum rq_intersection_type {
static void static void
lower_rq_initialize(nir_builder *b, nir_ssa_def *index, nir_intrinsic_instr *instr, lower_rq_initialize(nir_builder *b, nir_ssa_def *index, nir_intrinsic_instr *instr,
struct ray_query_vars *vars) struct ray_query_vars *vars, struct radv_instance *instance)
{ {
rq_store_var(b, index, vars->flags, instr->src[2].ssa, 0x1); rq_store_var(b, index, vars->flags, instr->src[2].ssa, 0x1);
rq_store_var(b, index, vars->cull_mask, nir_ishl_imm(b, instr->src[3].ssa, 24), 0x1); rq_store_var(b, index, vars->cull_mask, nir_ishl_imm(b, instr->src[3].ssa, 24), 0x1);
@@ -420,7 +421,8 @@ lower_rq_initialize(nir_builder *b, nir_ssa_def *index, nir_intrinsic_instr *ins
rq_store_var(b, index, vars->trav.top_stack, nir_imm_int(b, -1), 1); rq_store_var(b, index, vars->trav.top_stack, nir_imm_int(b, -1), 1);
rq_store_var(b, index, vars->incomplete, nir_imm_bool(b, true), 0x1); rq_store_var(b, index, vars->incomplete,
nir_imm_bool(b, !(instance->debug_flags & RADV_DEBUG_NO_RT)), 0x1);
} }
static nir_ssa_def * static nir_ssa_def *
@@ -741,7 +743,7 @@ radv_nir_lower_ray_queries(struct nir_shader *shader, struct radv_device *device
lower_rq_generate_intersection(&builder, index, intrinsic, vars); lower_rq_generate_intersection(&builder, index, intrinsic, vars);
break; break;
case nir_intrinsic_rq_initialize: case nir_intrinsic_rq_initialize:
lower_rq_initialize(&builder, index, intrinsic, vars); lower_rq_initialize(&builder, index, intrinsic, vars, device->instance);
break; break;
case nir_intrinsic_rq_load: case nir_intrinsic_rq_load:
new_dest = lower_rq_load(&builder, index, intrinsic, vars); new_dest = lower_rq_load(&builder, index, intrinsic, vars);

View File

@@ -10037,6 +10037,9 @@ static void
radv_trace_rays(struct radv_cmd_buffer *cmd_buffer, const VkTraceRaysIndirectCommand2KHR *tables, radv_trace_rays(struct radv_cmd_buffer *cmd_buffer, const VkTraceRaysIndirectCommand2KHR *tables,
uint64_t indirect_va, enum radv_rt_mode mode) uint64_t indirect_va, enum radv_rt_mode mode)
{ {
if (cmd_buffer->device->instance->debug_flags & RADV_DEBUG_NO_RT)
return;
struct radv_compute_pipeline *pipeline = &cmd_buffer->state.rt_pipeline->base; struct radv_compute_pipeline *pipeline = &cmd_buffer->state.rt_pipeline->base;
struct radv_shader *rt_prolog = cmd_buffer->state.rt_prolog; struct radv_shader *rt_prolog = cmd_buffer->state.rt_prolog;
uint32_t base_reg = rt_prolog->info.user_data_0; uint32_t base_reg = rt_prolog->info.user_data_0;

View File

@@ -71,6 +71,7 @@ enum {
RADV_DEBUG_EXTRA_MD = 1ull << 40, RADV_DEBUG_EXTRA_MD = 1ull << 40,
RADV_DEBUG_NO_GPL = 1ull << 41, RADV_DEBUG_NO_GPL = 1ull << 41,
RADV_DEBUG_VIDEO_ARRAY_PATH = 1ull << 42, RADV_DEBUG_VIDEO_ARRAY_PATH = 1ull << 42,
RADV_DEBUG_NO_RT = 1ull << 43,
}; };
enum { enum {

View File

@@ -77,6 +77,7 @@ static const struct debug_control radv_debug_options[] = {
{"extra_md", RADV_DEBUG_EXTRA_MD}, {"extra_md", RADV_DEBUG_EXTRA_MD},
{"nogpl", RADV_DEBUG_NO_GPL}, {"nogpl", RADV_DEBUG_NO_GPL},
{"videoarraypath", RADV_DEBUG_VIDEO_ARRAY_PATH}, {"videoarraypath", RADV_DEBUG_VIDEO_ARRAY_PATH},
{"nort", RADV_DEBUG_NO_RT},
{NULL, 0}}; {NULL, 0}};
const char * const char *

View File

@@ -204,6 +204,8 @@ radv_get_hash_flags(const struct radv_device *device, bool stats)
hash_flags |= RADV_HASH_SHADER_NO_FMASK; hash_flags |= RADV_HASH_SHADER_NO_FMASK;
if (device->physical_device->use_ngg_streamout) if (device->physical_device->use_ngg_streamout)
hash_flags |= RADV_HASH_SHADER_NGG_STREAMOUT; hash_flags |= RADV_HASH_SHADER_NGG_STREAMOUT;
if (device->instance->debug_flags & RADV_DEBUG_NO_RT)
hash_flags |= RADV_HASH_SHADER_NO_RT;
return hash_flags; return hash_flags;
} }

View File

@@ -2162,6 +2162,7 @@ struct radv_event {
#define RADV_HASH_SHADER_RT_WAVE64 (1 << 18) #define RADV_HASH_SHADER_RT_WAVE64 (1 << 18)
#define RADV_HASH_SHADER_NO_FMASK (1 << 19) #define RADV_HASH_SHADER_NO_FMASK (1 << 19)
#define RADV_HASH_SHADER_NGG_STREAMOUT (1 << 20) #define RADV_HASH_SHADER_NGG_STREAMOUT (1 << 20)
#define RADV_HASH_SHADER_NO_RT (1 << 21)
struct radv_pipeline_key; struct radv_pipeline_key;
struct radv_ray_tracing_group; struct radv_ray_tracing_group;