aco: don't use opsel to fold constants into dot accumulation sources
authorRhys Perry <pendingchaos02@gmail.com>
Mon, 2 May 2022 12:19:45 +0000 (13:19 +0100)
committerMarge Bot <emma+marge@anholt.net>
Tue, 5 Jul 2022 16:39:56 +0000 (16:39 +0000)
Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16296>

src/amd/compiler/aco_optimizer.cpp

index b844de2..88440c1 100644 (file)
@@ -912,6 +912,14 @@ propagate_constants_vop3p(opt_ctx& ctx, aco_ptr<Instruction>& instr, ssa_info& i
       return;
    }
 
+   /* The accumulation operand of dot product instructions ignores opsel. */
+   bool cannot_use_opsel =
+      (instr->opcode == aco_opcode::v_dot4_i32_i8 || instr->opcode == aco_opcode::v_dot2_i32_i16 ||
+       instr->opcode == aco_opcode::v_dot4_u32_u8 || instr->opcode == aco_opcode::v_dot2_u32_u16) &&
+      i == 2;
+   if (cannot_use_opsel)
+      return;
+
    /* try to fold inline constants */
    VOP3P_instruction* vop3p = &instr->vop3p();
    /* TODO: if bits==32, we might be able to get an inline constant if we sign-extend or shift left