ir3/legalize: emit predication quirk nops in next block

Emitting in the same block as the pred[tfe] caused helper_sched to
sometimes insert unnecessary (eq). For example:

block i:
...
prede
(eq)(rpt6)nop
block i+1:
(eq)nop

Emitting the quirk nops in the next block (i+1 in this case) prevents
this.

Note that the small number of shaders where NOPs regress, are cases
where an extra (eq)nop is inserted in a block that doesn't contain any
other nops (but did contain the quirk nop before this change).

Totals from 3814 (2.32% of 164575) affected shaders:
Instrs: 6732543 -> 6732252 (-0.00%); split: -0.01%, +0.00%
CodeSize: 11978286 -> 11978086 (-0.00%); split: -0.00%, +0.00%
NOPs: 1683239 -> 1682948 (-0.02%); split: -0.02%, +0.01%
(ss)-stall: 635237 -> 634077 (-0.18%)
(sy)-stall: 2562027 -> 2533761 (-1.10%); split: -1.10%, +0.00%
Cat0: 1849898 -> 1849607 (-0.02%); split: -0.02%, +0.01%

Signed-off-by: Job Noorman <jnoorman@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/35934>
This commit is contained in:
Job Noorman
2025-07-04 11:17:52 +02:00
committed by Marge Bot
parent 62b3fd0a5e
commit 39ff20b757
+4 -4
View File
@@ -1319,17 +1319,17 @@ add_predication_workaround(struct ir3_compiler *compiler,
struct ir3_instruction *prede)
{
if (predtf && compiler->predtf_nop_quirk) {
struct ir3_builder build = ir3_builder_at(ir3_after_block(predtf->block));
struct ir3_builder build = ir3_builder_at(
ir3_before_block(predtf->block->predecessors[0]->successors[1]));
struct ir3_instruction *nop = ir3_NOP(&build);
nop->repeat = 4;
ir3_instr_move_after(nop, predtf);
}
if (compiler->prede_nop_quirk) {
struct ir3_builder build = ir3_builder_at(ir3_after_block(prede->block));
struct ir3_builder build =
ir3_builder_at(ir3_before_block(prede->block->successors[0]));
struct ir3_instruction *nop = ir3_NOP(&build);
nop->repeat = 6;
ir3_instr_move_after(nop, prede);
}
}