aco: fix demote in header of single iteration loop

The control is not divergent before a divergent break in a single iteration loop,
but we already pushed the loop mask on the stack.

Fixes: 90faadae72 ("aco/insert_exec_mask: don't disable dead quads on demote in divergent CF")
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/14733
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
(cherry picked from commit 4b1996b1c7)

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39745>
This commit is contained in:
Georg Lehmann 2026-01-26 13:59:16 +01:00 committed by Dylan Baker
parent 1d0d045dca
commit 82e682e3c0
2 changed files with 12 additions and 5 deletions

View file

@ -204,7 +204,7 @@
"description": "aco: fix demote in header of single iteration loop",
"nominated": true,
"nomination_type": 2,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": "90faadae72280f0da4abef016889bfbdb6a4d3d9",
"notes": null

View file

@ -484,10 +484,17 @@ process_instructions(exec_ctx& ctx, Block* block, std::vector<aco_ptr<Instructio
Operand exit_cond = Operand(exec, bld.lm);
if (state == Exact) {
assert(info.exec.size() == 1);
bld.sop2(Builder::s_andn2, Definition(exec, bld.lm), bld.def(s1, scc), info.exec[0].op,
src);
info.exec[0].op = Operand(exec, bld.lm);
bld.sop2(Builder::s_andn2, Definition(exec, bld.lm), bld.def(s1, scc),
info.exec.back().op, src);
info.exec.back().op = Operand(exec, bld.lm);
/* Although this is in uniform CF, it might be a loop without back-edge.
* Update the loop restore mask as well.
*/
for (unsigned i = 0; i < info.exec.size() - 1; i++) {
assert(info.exec[i + 1].type & mask_type_loop);
info.exec[i].op = bld.copy(bld.def(bld.lm), Operand(exec, bld.lm));
}
} else {
Temp cond = bld.tmp(s1);
info.exec[0].op = bld.sop2(Builder::s_andn2, bld.def(bld.lm), Definition(cond, scc),