mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-06 05:08:08 +02:00
aco: add a helper to dump SGPR to memory for the trap handler
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/32026>
This commit is contained in:
parent
8c6f2fef1b
commit
494050d2ea
1 changed files with 22 additions and 24 deletions
|
|
@ -12405,6 +12405,26 @@ select_program(Program* program, unsigned shader_count, struct nir_shader* const
|
|||
}
|
||||
}
|
||||
|
||||
void
|
||||
dump_sgpr_to_mem(isel_context* ctx, Operand rsrc, Operand data, uint32_t offset)
|
||||
{
|
||||
Builder bld(ctx->program, ctx->block);
|
||||
|
||||
ac_hw_cache_flags cache_glc;
|
||||
cache_glc.value = ac_glc;
|
||||
|
||||
if (ctx->program->gfx_level >= GFX9) {
|
||||
bld.copy(Definition(PhysReg{256}, v1) /* v0 */, data);
|
||||
|
||||
bld.mubuf(aco_opcode::buffer_store_dword, Operand(rsrc), Operand(v1), Operand::c32(0u),
|
||||
Operand(PhysReg{256}, v1) /* v0 */, offset, false /* offen */, false /* idxen */,
|
||||
/* addr64 */ false, /* disable_wqm */ false, cache_glc);
|
||||
} else {
|
||||
bld.smem(aco_opcode::s_buffer_store_dword, Operand(rsrc), Operand::c32(offset), data,
|
||||
memory_sync_info(), cache_glc);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
select_trap_handler_shader(Program* program, struct nir_shader* shader, ac_shader_config* config,
|
||||
const struct aco_compiler_options* options,
|
||||
|
|
@ -12501,35 +12521,13 @@ select_trap_handler_shader(Program* program, struct nir_shader* shader, ac_shade
|
|||
bld.sopk(aco_opcode::s_getreg_b32, Definition(ttmp0_reg, s1),
|
||||
((32 - 1) << 11) | hw_regs_idx[i]);
|
||||
|
||||
if (ctx.program->gfx_level >= GFX9) {
|
||||
bld.copy(Definition(PhysReg{256}, v1) /* v0 */, Operand(ttmp0_reg, s1));
|
||||
|
||||
bld.mubuf(aco_opcode::buffer_store_dword, Operand(tma_rsrc, s4), Operand(v1),
|
||||
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(tma_rsrc, s4), Operand::c32(offset),
|
||||
Operand(ttmp0_reg, s1), memory_sync_info(), cache_glc);
|
||||
}
|
||||
|
||||
dump_sgpr_to_mem(&ctx, Operand(tma_rsrc, s4), Operand(ttmp0_reg, s1), offset);
|
||||
offset += 4;
|
||||
}
|
||||
|
||||
/* Dump all SGPRs. */
|
||||
for (uint32_t i = 0; i < program->dev.sgpr_limit; i++) {
|
||||
if (ctx.program->gfx_level >= GFX9) {
|
||||
bld.copy(Definition(PhysReg{256}, v1) /* v0 */, Operand(PhysReg{i}, s1));
|
||||
|
||||
bld.mubuf(aco_opcode::buffer_store_dword, Operand(tma_rsrc, s4), Operand(v1),
|
||||
Operand::c32(0u), Operand(PhysReg{256}, v1) /* v0 */, offset, false /* offen */,
|
||||
false /* idxen */, /* addr64 */ false,
|
||||
/* disable_wqm */ false, cache_glc);
|
||||
} else {
|
||||
bld.smem(aco_opcode::s_buffer_store_dword, Operand(tma_rsrc, s4), Operand::c32(offset),
|
||||
Operand(PhysReg{i}, s1), memory_sync_info(), cache_glc);
|
||||
}
|
||||
|
||||
dump_sgpr_to_mem(&ctx, Operand(tma_rsrc, s4), Operand(PhysReg{i}, s1), offset);
|
||||
offset += 4;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue