Mesa (main): aco: fix extract_vector optimization

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Jul 13 07:31:32 UTC 2021


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

Author: Daniel Schürmann <daniel at schuermann.dev>
Date:   Thu Jul  8 16:49:18 2021 +0200

aco: fix extract_vector optimization

If the allocated_vec map contains a different RegType
for the elements, ensure that the size matches exactly.

Otherwise, it could happen that extracting a dword
element matched with a subdword element.

No fossil-db changes.

Reviewed-by: Rhys Perry <pendingchaos02 at gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11823>

---

 src/amd/compiler/aco_instruction_selection.cpp | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/src/amd/compiler/aco_instruction_selection.cpp b/src/amd/compiler/aco_instruction_selection.cpp
index c7bdbb8b3c4..bcd8490f379 100644
--- a/src/amd/compiler/aco_instruction_selection.cpp
+++ b/src/amd/compiler/aco_instruction_selection.cpp
@@ -1329,9 +1329,8 @@ visit_alu_instr(isel_context* ctx, nir_alu_instr* instr)
          RegClass elem_rc = RegClass::get(RegType::vgpr, instr->dest.dest.ssa.bit_size / 8u);
          for (unsigned i = 0; i < num; ++i) {
             if (elems[i].type() == RegType::sgpr && elem_rc.is_subdword())
-               vec->operands[i] = Operand(emit_extract_vector(ctx, elems[i], 0, elem_rc));
-            else
-               vec->operands[i] = Operand{elems[i]};
+               elems[i] = emit_extract_vector(ctx, elems[i], 0, elem_rc);
+            vec->operands[i] = Operand{elems[i]};
          }
          vec->definitions[0] = Definition(dst);
          ctx->block->instructions.emplace_back(std::move(vec));



More information about the mesa-commit mailing list