agx: ingest undefs in the backend

in prep for doing smarter things with them. stats changes seem to be RA
lottery, maybe?

total instructions in shared programs: 2277305 -> 2278756 (0.06%)
instructions in affected programs: 4003 -> 5454 (36.25%)
helped: 0
HURT: 9
Instructions are HURT.

total bytes in shared programs: 15000418 -> 15008934 (0.06%)
bytes in affected programs: 27072 -> 35588 (31.46%)
helped: 0
HURT: 9
Bytes are HURT.

total halfregs in shared programs: 519229 -> 519245 (<.01%)
halfregs in affected programs: 30 -> 46 (53.33%)
helped: 0
HURT: 2

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26976>
This commit is contained in:
Alyssa Rosenzweig
2024-01-08 21:48:30 -04:00
committed by Marge Bot
parent b14987bf90
commit 9dfb072ae3

View File

@@ -1990,7 +1990,16 @@ agx_emit_undef(agx_builder *b, nir_undef_instr *instr)
* the lowering happens in NIR and this just allows for late lowering passes
* to result in undefs.
*/
agx_mov_imm_to(b, agx_def_index(&instr->def), 0);
if (instr->def.num_components > 1) {
assert(instr->def.num_components <= 4);
agx_index zero = agx_mov_imm(b, instr->def.bit_size, 0);
agx_emit_collect_to(b, agx_def_index(&instr->def),
instr->def.num_components,
(agx_index[4]){zero, zero, zero, zero});
} else {
agx_mov_imm_to(b, agx_def_index(&instr->def), 0);
}
}
static void
@@ -2372,7 +2381,6 @@ agx_optimize_loop_nir(nir_shader *nir)
NIR_PASS(progress, nir, nir_opt_constant_folding);
NIR_PASS(progress, nir, nir_opt_undef);
NIR_PASS(progress, nir, nir_lower_undef_to_zero);
NIR_PASS(progress, nir, nir_opt_shrink_vectors);
NIR_PASS(progress, nir, nir_opt_loop_unroll);