Mesa (master): aco: sign-extend the input and identity for 8-bit subgroup operations

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu May 21 15:15:03 UTC 2020


Module: Mesa
Branch: master
Commit: 2d4493ee11aa653ed4c2cc51b37f9e60b534b8bc
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=2d4493ee11aa653ed4c2cc51b37f9e60b534b8bc

Author: Samuel Pitoiset <samuel.pitoiset at gmail.com>
Date:   Wed May 20 11:32:50 2020 +0200

aco: sign-extend the input and identity for 8-bit subgroup operations

Signed-off-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
Reviewed-by: Rhys Perry <pendingchaos02 at gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4494>

---

 src/amd/compiler/aco_lower_to_hw_instr.cpp | 12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/src/amd/compiler/aco_lower_to_hw_instr.cpp b/src/amd/compiler/aco_lower_to_hw_instr.cpp
index 1d3061d5dd9..3bd9647f781 100644
--- a/src/amd/compiler/aco_lower_to_hw_instr.cpp
+++ b/src/amd/compiler/aco_lower_to_hw_instr.cpp
@@ -506,6 +506,18 @@ void emit_reduction(lower_context *ctx, aco_opcode op, ReduceOp reduce_op, unsig
                    Operand(stmp, bld.lm));
    }
 
+   if (src.regClass() == v1b) {
+      aco_ptr<SDWA_instruction> sdwa{create_instruction<SDWA_instruction>(aco_opcode::v_mov_b32, asSDWA(Format::VOP1), 1, 1)};
+      sdwa->operands[0] = Operand(PhysReg{tmp}, v1);
+      sdwa->definitions[0] = Definition(PhysReg{tmp}, v1);
+      if (reduce_op == imin8 || reduce_op == imax8)
+         sdwa->sel[0] = sdwa_sbyte;
+      else
+         sdwa->sel[0] = sdwa_ubyte;
+      sdwa->dst_sel = sdwa_udword;
+      bld.insert(std::move(sdwa));
+   }
+
    bool reduction_needs_last_op = false;
    switch (op) {
    case aco_opcode::p_reduce:



More information about the mesa-commit mailing list