radv: Refactor RADV_DEBUG=shaders to be a combination of other options.

Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Konstantin Seurer <konstantin.seurer@gmail.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Acked-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32079>
This commit is contained in:
Timur Kristóf 2024-11-12 10:52:55 +01:00
parent 6d5caabdd7
commit 8c1e2ac03b
5 changed files with 11 additions and 11 deletions

View file

@ -15,7 +15,6 @@
enum {
RADV_DEBUG_NO_FAST_CLEARS = 1ull << 0,
RADV_DEBUG_NO_DCC = 1ull << 1,
RADV_DEBUG_DUMP_SHADERS = 1ull << 2,
RADV_DEBUG_NO_CACHE = 1ull << 3,
RADV_DEBUG_DUMP_SHADER_STATS = 1ull << 4,
RADV_DEBUG_NO_HIZ = 1ull << 5,
@ -72,6 +71,9 @@ enum {
RADV_DEBUG_DUMP_NIR = 1ull << 56,
RADV_DEBUG_DUMP_ASM = 1ull << 57,
RADV_DEBUG_DUMP_BACKEND_IR = 1ull << 58,
RADV_DEBUG_DUMP_SHADERS = RADV_DEBUG_DUMP_VS | RADV_DEBUG_DUMP_TCS | RADV_DEBUG_DUMP_TES | RADV_DEBUG_DUMP_GS |
RADV_DEBUG_DUMP_PS | RADV_DEBUG_DUMP_TASK | RADV_DEBUG_DUMP_MESH | RADV_DEBUG_DUMP_CS |
RADV_DEBUG_DUMP_NIR | RADV_DEBUG_DUMP_ASM | RADV_DEBUG_DUMP_BACKEND_IR,
};
enum {

View file

@ -119,7 +119,7 @@ radv_compile_cs(struct radv_device *device, struct vk_pipeline_cache *cache, str
radv_postprocess_nir(device, NULL, cs_stage);
bool dump_shader = radv_can_dump_shader(device, cs_stage->nir);
bool dump_nir = dump_shader && (instance->debug_flags & (RADV_DEBUG_DUMP_NIR | RADV_DEBUG_DUMP_SHADERS));
bool dump_nir = dump_shader && (instance->debug_flags & RADV_DEBUG_DUMP_NIR);
if (dump_shader) {
simple_mtx_lock(&instance->shader_dump_mtx);

View file

@ -2340,7 +2340,7 @@ radv_graphics_shaders_nir_to_asm(struct radv_device *device, struct vk_pipeline_
for (unsigned i = 0; i < shader_count; ++i)
dump_shader |= radv_can_dump_shader(device, nir_shaders[i]);
bool dump_nir = dump_shader && (instance->debug_flags & (RADV_DEBUG_DUMP_NIR | RADV_DEBUG_DUMP_SHADERS));
bool dump_nir = dump_shader && (instance->debug_flags & RADV_DEBUG_DUMP_NIR);
if (dump_shader) {
simple_mtx_lock(&instance->shader_dump_mtx);

View file

@ -435,7 +435,7 @@ radv_rt_nir_to_asm(struct radv_device *device, struct vk_pipeline_cache *cache,
}
bool dump_shader = radv_can_dump_shader(device, shaders[0]);
bool dump_nir = dump_shader && (instance->debug_flags & (RADV_DEBUG_DUMP_NIR | RADV_DEBUG_DUMP_SHADERS));
bool dump_nir = dump_shader && (instance->debug_flags & RADV_DEBUG_DUMP_NIR);
bool replayable =
pipeline->base.base.create_flags & VK_PIPELINE_CREATE_2_RAY_TRACING_SHADER_GROUP_HANDLE_CAPTURE_REPLAY_BIT_KHR;

View file

@ -127,11 +127,10 @@ radv_can_dump_shader(struct radv_device *device, nir_shader *nir)
if (is_meta_shader(nir))
return instance->debug_flags & RADV_DEBUG_DUMP_META_SHADERS;
uint64_t flags = RADV_DEBUG_DUMP_SHADERS;
if (nir)
flags |= radv_dump_flag_for_stage(nir->info.stage);
if (!nir)
return false;
return instance->debug_flags & flags;
return instance->debug_flags & radv_dump_flag_for_stage(nir->info.stage);
}
bool
@ -3002,8 +3001,7 @@ radv_fill_nir_compiler_options(struct radv_nir_compiler_options *options, struct
options->wgp_mode = should_use_wgp;
options->info = &pdev->info;
options->dump_shader = can_dump_shader;
options->dump_ir =
options->dump_shader && instance->debug_flags & (RADV_DEBUG_DUMP_BACKEND_IR | RADV_DEBUG_DUMP_SHADERS);
options->dump_ir = options->dump_shader && (instance->debug_flags & RADV_DEBUG_DUMP_BACKEND_IR);
options->dump_preoptir = options->dump_shader && instance->debug_flags & RADV_DEBUG_PREOPTIR;
options->record_asm = keep_shader_info || options->dump_shader;
options->record_ir = keep_shader_info;
@ -3146,7 +3144,7 @@ radv_shader_generate_debug_info(struct radv_device *device, bool dump_shader, bo
const struct radv_physical_device *pdev = radv_device_physical(device);
const struct radv_instance *instance = radv_physical_device_instance(pdev);
if (instance->debug_flags & (RADV_DEBUG_DUMP_ASM | RADV_DEBUG_DUMP_SHADERS)) {
if (instance->debug_flags & RADV_DEBUG_DUMP_ASM) {
fprintf(stderr, "%s", radv_get_shader_name(info, shaders[0]->info.stage));
for (int i = 1; i < shader_count; ++i)
fprintf(stderr, " + %s", radv_get_shader_name(info, shaders[i]->info.stage));