Mesa (main): aco: use p_parallelcopy for uniform reduction with zero source

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue May 31 18:32:15 UTC 2022


Module: Mesa
Branch: main
Commit: 8384189b6c9a98624ac6c5fbeb1ac3eef5ebf0b5
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=8384189b6c9a98624ac6c5fbeb1ac3eef5ebf0b5

Author: Rhys Perry <pendingchaos02 at gmail.com>
Date:   Fri May 13 13:39:01 2022 +0100

aco: use p_parallelcopy for uniform reduction with zero source

I think v_mov_b32 was only used because a sub-dword p_parallelcopy
couldn't take constants on some gfx levels. That shouldn't be the case
anymore.

Signed-off-by: Rhys Perry <pendingchaos02 at gmail.com>
Reviewed-by: Timur Kristóf <timur.kristof at gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16595>

---

 src/amd/compiler/aco_instruction_selection.cpp | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/src/amd/compiler/aco_instruction_selection.cpp b/src/amd/compiler/aco_instruction_selection.cpp
index 5b337f78029..51285cfe272 100644
--- a/src/amd/compiler/aco_instruction_selection.cpp
+++ b/src/amd/compiler/aco_instruction_selection.cpp
@@ -7725,10 +7725,8 @@ emit_addition_uniform_reduce(isel_context* ctx, nir_op op, Definition dst, nir_s
          bld.pseudo(aco_opcode::p_extract_vector, dst, count, Operand::zero());
       else if (nir_src_as_uint(src) == 1)
          bld.copy(dst, count);
-      else if (nir_src_as_uint(src) == 0 && dst.bytes() <= 2)
-         bld.vop1(aco_opcode::v_mov_b32, dst, Operand::zero()); /* RA will use SDWA if possible */
       else if (nir_src_as_uint(src) == 0)
-         bld.copy(dst, Operand::zero());
+         bld.copy(dst, Operand::zero(dst.bytes()));
       else if (count.type() == RegType::vgpr)
          bld.v_mul_imm(dst, count, nir_src_as_uint(src));
       else



More information about the mesa-commit mailing list