ir3: Fix condition for using uniform predicates
Some checks are pending
macOS-CI / macOS-CI (dri) (push) Waiting to run
macOS-CI / macOS-CI (xlib) (push) Waiting to run

cat2_may_use_scalar_alu() was incorrect because the instruction could
use an indirectly-accessed const where a0.x (i.e. the offset) is
non-uniform. Fortunately, we already know whether this is the case,
because the original instruction would then write a non-shared GPR.
Also, the restrictions for scalar ALU are the same regardless of whether
we write up0.x or a shared GPR, and vice versa the restrictions for
normal cat2 are the same regardless of whether we write p0.x or a
non-shared GPR, so it should always be safe to write p0.x if non-shared
and up0.x if shared. So, just do that.

Fixes: 2a8c5ebc77 ("ir3: enable scalar predicates")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38895>
This commit is contained in:
Connor Abbott 2025-12-10 17:16:43 -05:00 committed by Marge Bot
parent d0bae6c1b3
commit da969df092

View file

@ -43,13 +43,6 @@ cat2_needs_scalar_alu(struct ir3_instruction *instr)
return cat2_all_srcs_have_flag(instr, IR3_REG_CONST | IR3_REG_SHARED);
}
static bool
cat2_may_use_scalar_alu(struct ir3_instruction *instr)
{
return cat2_all_srcs_have_flag(
instr, IR3_REG_CONST | IR3_REG_SHARED | IR3_REG_IMMED);
}
static struct ir3_instruction *
clone_with_predicate_dst(struct opt_predicates_ctx *ctx,
struct ir3_instruction *instr)
@ -67,7 +60,7 @@ clone_with_predicate_dst(struct opt_predicates_ctx *ctx,
clone->dsts[0]->flags &= ~(IR3_REG_HALF | IR3_REG_SHARED);
if (ctx->ir->compiler->has_scalar_predicates && opc_cat(instr->opc) == 2 &&
cat2_may_use_scalar_alu(instr)) {
(instr->dsts[0]->flags & IR3_REG_SHARED)) {
clone->dsts[0]->flags |= IR3_REG_UNIFORM;
}