radv,aco: dump all SGPRS from the trap handler

Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31960>
This commit is contained in:
Samuel Pitoiset 2024-11-01 12:32:18 +01:00 committed by Marge Bot
parent 45d56d9395
commit 81f4670ed6
2 changed files with 34 additions and 3 deletions

View file

@ -12476,6 +12476,7 @@ select_trap_handler_shader(Program* program, struct nir_shader* shader, ac_shade
5, /* WH_REG_GPR_ALLOC */
7, /* HW_REG_IB_STS */
};
uint32_t offset = 8;
/* Store some hardware registers. */
for (unsigned i = 0; i < ARRAY_SIZE(hw_regs_idx); i++) {
@ -12487,14 +12488,28 @@ select_trap_handler_shader(Program* program, struct nir_shader* shader, ac_shade
bld.copy(Definition(PhysReg{256}, v1) /* v0 */, Operand(PhysReg{ttmp8}, s1));
bld.mubuf(aco_opcode::buffer_store_dword, Operand(PhysReg{ttmp4}, s4), Operand(v1),
Operand::c32(8u + i * 4), Operand(PhysReg{256}, v1) /* v0 */, 0 /* offset */,
Operand::c32(offset), Operand(PhysReg{256}, v1) /* v0 */, 0 /* offset */,
false /* offen */, false /* idxen */, /* addr64 */ false,
/* disable_wqm */ false, cache_glc);
} else {
bld.smem(aco_opcode::s_buffer_store_dword, Operand(PhysReg{ttmp4}, s4),
Operand::c32(8u + i * 4), Operand(PhysReg{ttmp8}, s1), memory_sync_info(),
cache_glc);
Operand::c32(offset), Operand(PhysReg{ttmp8}, s1), memory_sync_info(), cache_glc);
}
offset += 4;
}
/* Dump all SGPRs. */
for (uint32_t i = 0; i < program->dev.sgpr_limit; i++) {
bld.copy(Definition(PhysReg{256}, v1) /* v0 */, Operand(PhysReg{i}, s1));
bld.copy(Definition(PhysReg{ttmp8}, s1), Operand::c32(offset));
bld.mubuf(aco_opcode::buffer_store_dword, Operand(PhysReg{ttmp4}, s4), Operand(v1),
Operand(PhysReg{ttmp8}, s1), Operand(PhysReg{256}, v1) /* v0 */, 0 /* offset */,
false /* offen */, false /* idxen */, /* addr64 */ false,
/* disable_wqm */ false, cache_glc);
offset += 4;
}
program->config->float_mode = program->blocks[0].fp_mode.val;

View file

@ -978,6 +978,8 @@ radv_dump_faulty_shader(struct radv_device *device, uint64_t faulty_pc)
free(instructions);
}
#define MAX_SGPRS 108
struct radv_trap_handler_layout {
uint32_t ttmp0;
uint32_t ttmp1;
@ -989,6 +991,8 @@ struct radv_trap_handler_layout {
uint32_t gpr_alloc;
uint32_t ib_sts;
} sq_wave_regs;
uint32_t sgprs[MAX_SGPRS];
};
static void
@ -1015,6 +1019,17 @@ radv_dump_sq_hw_regs(struct radv_device *device, const struct radv_trap_handler_
fprintf(stderr, "\n\n");
}
static void
radv_dump_sgprs(const struct radv_trap_handler_layout *layout)
{
fprintf(stderr, "\nSGPRS:\n");
for (uint32_t i = 0; i < MAX_SGPRS; i += 4) {
fprintf(stderr, "s[%d-%d]={0x%08x, 0x%08x, 0x%08x, 0x%08x}\n", i, i + 3, layout->sgprs[i], layout->sgprs[i + 1],
layout->sgprs[i + 2], layout->sgprs[i + 3]);
}
fprintf(stderr, "\n\n");
}
void
radv_check_trap_handler(struct radv_queue *queue)
{
@ -1040,6 +1055,7 @@ radv_check_trap_handler(struct radv_queue *queue)
#endif
radv_dump_sq_hw_regs(device, layout);
radv_dump_sgprs(layout);
uint32_t ttmp0 = layout->ttmp0;
uint32_t ttmp1 = layout->ttmp1;