aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorNicolai Hähnle <[email protected]>2019-04-29 16:02:29 +0200
committerMarek Olšák <[email protected]>2019-06-12 20:28:23 -0400
commit2d114e6267cdce330ed43af66a03c5836129506d (patch)
tree2f93bc5dfeae27e4b26c12851bf42f55c933af9f /src
parent3bde69e789ca75d6b5dc9afc48dcb1675714769c (diff)
radeonsi: add radeonsi_debug_disassembly option
This dumps disassembly to the pipe_debug_callback together with shader stats. Can be used together with shader-db to get full disassembly of all shaders in the database. Reviewed-by: Marek Olšák <[email protected]>
Diffstat (limited to 'src')
-rw-r--r--src/gallium/drivers/radeonsi/si_debug_options.h1
-rw-r--r--src/gallium/drivers/radeonsi/si_shader.c15
2 files changed, 10 insertions, 6 deletions
diff --git a/src/gallium/drivers/radeonsi/si_debug_options.h b/src/gallium/drivers/radeonsi/si_debug_options.h
index 64a1d2a5985..aa8d64e1b88 100644
--- a/src/gallium/drivers/radeonsi/si_debug_options.h
+++ b/src/gallium/drivers/radeonsi/si_debug_options.h
@@ -3,6 +3,7 @@ OPT_BOOL(enable_nir, false, "Enable NIR")
OPT_BOOL(aux_debug, false, "Generate ddebug_dumps for the auxiliary context")
OPT_BOOL(sync_compile, false, "Always compile synchronously (will cause stalls)")
OPT_BOOL(dump_shader_binary, false, "Dump shader binary as part of ddebug_dumps")
+OPT_BOOL(debug_disassembly, false, "Report shader disassembly as part of driver debug messages (for shader db)")
OPT_BOOL(vs_fetch_always_opencode, false, "Always open code vertex fetches (less efficient, purely for testing)")
OPT_BOOL(prim_restart_tri_strips_only, false, "Only enable primitive restart for triangle strips")
diff --git a/src/gallium/drivers/radeonsi/si_shader.c b/src/gallium/drivers/radeonsi/si_shader.c
index f4e522dd7c1..92c68f21459 100644
--- a/src/gallium/drivers/radeonsi/si_shader.c
+++ b/src/gallium/drivers/radeonsi/si_shader.c
@@ -5237,13 +5237,8 @@ static void si_shader_dump_disassembly(struct si_screen *screen,
if (!ac_rtld_get_section_by_name(&rtld_binary, ".AMDGPU.disasm", &disasm, &nbytes))
goto out;
- fprintf(file, "Shader %s disassembly:\n", name);
- if (nbytes > INT_MAX) {
- fprintf(file, "too long\n");
+ if (nbytes > INT_MAX)
goto out;
- }
-
- fprintf(file, "%*s", (int)nbytes, disasm);
if (debug && debug->debug_message) {
/* Very long debug messages are cut off, so send the
@@ -5273,6 +5268,11 @@ static void si_shader_dump_disassembly(struct si_screen *screen,
"Shader Disassembly End");
}
+ if (file) {
+ fprintf(file, "Shader %s disassembly:\n", name);
+ fprintf(file, "%*s", (int)nbytes, disasm);
+ }
+
out:
ac_rtld_close(&rtld_binary);
}
@@ -5338,6 +5338,9 @@ void si_shader_dump_stats_for_shader_db(struct si_screen *screen,
{
const struct ac_shader_config *conf = &shader->config;
+ if (screen->options.debug_disassembly)
+ si_shader_dump_disassembly(screen, &shader->binary, debug, "main", NULL);
+
pipe_debug_message(debug, SHADER_INFO,
"Shader Stats: SGPRS: %d VGPRS: %d Code Size: %d "
"LDS: %d Scratch: %d Max Waves: %d Spilled SGPRs: %d "