radv: add RADV_DEBUG=dumpibs to dump command buffers

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38366>
This commit is contained in:
Samuel Pitoiset 2025-11-11 10:04:32 +01:00 committed by Marge Bot
parent 842603dc4f
commit 75a1380355
6 changed files with 15 additions and 0 deletions

View file

@ -1388,6 +1388,8 @@ RADV driver environment variables
dump the BO history to /tmp/radv_bo_history.log after each BO operations
``checkir``
validate the LLVM IR before LLVM compiles the shader
``dumpibs``
dump IBs (command streams)
``dump_trap_handler``
dump the trap handler shader
``epilogs``

View file

@ -72,6 +72,7 @@ enum {
RADV_DEBUG_VALIDATE_VAS = 1ull << 57,
RADV_DEBUG_DUMP_BO_HISTORY = 1ull << 58,
RADV_DEBUG_NO_BO_LIST = 1ull << 59,
RADV_DEBUG_DUMP_IBS = 1ull << 60,
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,

View file

@ -87,6 +87,7 @@ static const struct debug_control radv_debug_options[] = {{"nofastclears", RADV_
{"validatevas", RADV_DEBUG_VALIDATE_VAS},
{"bo_history", RADV_DEBUG_DUMP_BO_HISTORY},
{"nobolist", RADV_DEBUG_NO_BO_LIST},
{"dumpibs", RADV_DEBUG_DUMP_IBS},
{NULL, 0}};
const char *

View file

@ -1142,6 +1142,9 @@ radv_amdgpu_winsys_cs_submit_internal(struct radv_amdgpu_ctx *ctx, int queue_idx
struct radv_amdgpu_cs *cs = radv_amdgpu_cs(preambles[i]);
struct radv_amdgpu_cs_ib_info ib;
if (ws->dump_ibs)
ws->base.cs_dump(&cs->base, stderr, NULL, 0, RADV_CS_DUMP_TYPE_PREAMBLE_IBS);
assert(cs->num_ib_buffers == 1);
ib = radv_amdgpu_cs_ib_to_info(cs, cs->ib_buffers[0]);
@ -1153,6 +1156,9 @@ radv_amdgpu_winsys_cs_submit_internal(struct radv_amdgpu_ctx *ctx, int queue_idx
struct radv_amdgpu_cs *cs = radv_amdgpu_cs(cs_array[cs_idx]);
struct radv_amdgpu_cs_ib_info ib;
if (ws->dump_ibs)
ws->base.cs_dump(&cs->base, stderr, NULL, 0, RADV_CS_DUMP_TYPE_MAIN_IBS);
if (cs_ib_idx == 0) {
/* Make sure the whole CS fits into the same submission. */
unsigned cs_num_ib = radv_amdgpu_submitted_ibs_per_cs(cs);
@ -1207,6 +1213,9 @@ radv_amdgpu_winsys_cs_submit_internal(struct radv_amdgpu_ctx *ctx, int queue_idx
struct radv_amdgpu_cs *cs = radv_amdgpu_cs(postamble_cs[i]);
struct radv_amdgpu_cs_ib_info ib;
if (ws->dump_ibs)
ws->base.cs_dump(&cs->base, stderr, NULL, 0, RADV_CS_DUMP_TYPE_POSTAMBLE_IBS);
assert(cs->num_ib_buffers == 1);
ib = radv_amdgpu_cs_ib_to_info(cs, cs->ib_buffers[0]);

View file

@ -281,6 +281,7 @@ radv_amdgpu_winsys_create(int fd, uint64_t debug_flags, uint64_t perftest_flags,
ws->chain_ib = !(debug_flags & RADV_DEBUG_NO_IB_CHAINING);
ws->debug_all_bos = !!(debug_flags & RADV_DEBUG_ALL_BOS);
ws->debug_log_bos = debug_flags & RADV_DEBUG_HANG;
ws->dump_ibs = !!(debug_flags & RADV_DEBUG_DUMP_IBS);
if (debug_flags & RADV_DEBUG_DUMP_BO_HISTORY) {
ws->bo_history_logfile = fopen("/tmp/radv_bo_history.log", "w+");

View file

@ -31,6 +31,7 @@ struct radv_amdgpu_winsys {
bool debug_all_bos;
bool debug_log_bos;
bool dump_ibs;
FILE *bo_history_logfile;
bool chain_ib;
bool zero_all_vram_allocs;