From cf36fc134e43d9bfb85d0fc38ca01290a860e078 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timur=20Krist=C3=B3f?= Date: Tue, 12 Nov 2024 11:35:27 +0100 Subject: [PATCH] radv: Set dump flags in a smarter way by default. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit If shader stages are specified but compilation stages aren't, dump NIR, backend IR and disassembly. If compilation stages are specified but shader stages aren't, dump all shader stages. Signed-off-by: Timur Kristóf Reviewed-by: Konstantin Seurer Reviewed-by: Samuel Pitoiset Acked-by: Daniel Schürmann Part-of: --- src/amd/vulkan/radv_instance.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/amd/vulkan/radv_instance.c b/src/amd/vulkan/radv_instance.c index 448654140e9..103ccc50542 100644 --- a/src/amd/vulkan/radv_instance.c +++ b/src/amd/vulkan/radv_instance.c @@ -370,6 +370,25 @@ radv_CreateInstance(const VkInstanceCreateInfo *pCreateInfo, const VkAllocationC instance->trap_excp_flags = parse_debug_string(getenv("RADV_TRAP_HANDLER_EXCP"), radv_trap_excp_options); instance->profile_pstate = radv_parse_pstate(debug_get_option("RADV_PROFILE_PSTATE", "peak")); + const uint64_t shader_stage_flags = 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; + + const uint64_t compilation_stage_flags = RADV_DEBUG_DUMP_SPIRV | RADV_DEBUG_DUMP_NIR | RADV_DEBUG_DUMP_PREOPT_IR | + RADV_DEBUG_DUMP_BACKEND_IR | RADV_DEBUG_DUMP_ASM; + + if ((instance->debug_flags & shader_stage_flags) && !(instance->debug_flags & compilation_stage_flags)) { + /* When shader stages are specified but compilation stages aren't: + * use a default set of compilation stages. + */ + instance->debug_flags |= RADV_DEBUG_DUMP_NIR | RADV_DEBUG_DUMP_BACKEND_IR | RADV_DEBUG_DUMP_ASM; + } else if (!(instance->debug_flags & shader_stage_flags) && (instance->debug_flags & compilation_stage_flags)) { + /* When compilation stages are specified but shader stages aren't: + * dump all shader stages. + */ + instance->debug_flags |= shader_stage_flags; + } + /* When RADV_FORCE_FAMILY is set, the driver creates a null * device that allows to test the compiler without having an * AMDGPU instance.