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 <marek.olsak@amd.com>
This commit is contained in:
committed by
Marek Olšák
parent
3bde69e789
commit
2d114e6267
@@ -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")
|
||||
|
||||
|
||||
@@ -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 "
|
||||
|
||||
Reference in New Issue
Block a user