mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-05 07:28:11 +02:00
agx: add spilling debug helpers
I keep typing these Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31532>
This commit is contained in:
parent
8f6ba21627
commit
eae4c50be9
2 changed files with 22 additions and 0 deletions
|
|
@ -151,6 +151,13 @@ agx_split_width(const agx_instr *I)
|
|||
static unsigned
|
||||
agx_calc_register_demand(agx_context *ctx)
|
||||
{
|
||||
/* Print detailed demand calculation, helpful to debug spilling */
|
||||
bool debug = false;
|
||||
|
||||
if (debug) {
|
||||
agx_print_shader(ctx, stdout);
|
||||
}
|
||||
|
||||
uint8_t *widths = calloc(ctx->alloc, sizeof(uint8_t));
|
||||
enum ra_class *classes = calloc(ctx->alloc, sizeof(enum ra_class));
|
||||
|
||||
|
|
@ -201,6 +208,10 @@ agx_calc_register_demand(agx_context *ctx)
|
|||
*/
|
||||
unsigned late_kill_count = 0;
|
||||
|
||||
if (debug) {
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
agx_foreach_instr_in_block(block, I) {
|
||||
/* Phis happen in parallel and are already accounted for in the live-in
|
||||
* set, just skip them so we don't double count.
|
||||
|
|
@ -208,6 +219,11 @@ agx_calc_register_demand(agx_context *ctx)
|
|||
if (I->op == AGX_OPCODE_PHI)
|
||||
continue;
|
||||
|
||||
if (debug) {
|
||||
printf("%u: ", demand);
|
||||
agx_print_instr(I, stdout);
|
||||
}
|
||||
|
||||
if (I->op == AGX_OPCODE_PRELOAD) {
|
||||
unsigned size = agx_size_align_16(I->src[0].size);
|
||||
max_demand = MAX2(max_demand, I->src[0].value + size);
|
||||
|
|
|
|||
|
|
@ -683,6 +683,12 @@ min_algorithm(struct spill_ctx *ctx)
|
|||
agx_foreach_instr_in_block(ctx->block, I) {
|
||||
assert(ctx->nW <= ctx->k && "invariant");
|
||||
|
||||
/* Debug to check against our RA demand calculations */
|
||||
if (0) {
|
||||
printf("%u: ", ctx->nW);
|
||||
agx_print_instr(I, stdout);
|
||||
}
|
||||
|
||||
/* Phis are special since they happen along the edge. When we initialized
|
||||
* W and S, we implicitly chose which phis are spilled. So, here we just
|
||||
* need to rewrite the phis to write into memory.
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue