Mesa (main): aco: disallow SMEM offsets that are not multiples of 4

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Dec 17 22:46:51 UTC 2021


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

Author: Rhys Perry <pendingchaos02 at gmail.com>
Date:   Tue Nov 30 15:45:12 2021 +0000

aco: disallow SMEM offsets that are not multiples of 4

These can't be encoded on GFX6/7, and combining these additions causes
CTS failures on GFX10.3.

I think the low 2 MSBs are ignored before the addition, not after, so
load(a + 3, 0) becomes load(a, 3), which is the same as load(a, 0).

No fossil-db changes.

Signed-off-by: Rhys Perry <pendingchaos02 at gmail.com>
Reviewed-by: Daniel Schürmann <daniel at schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13755>

---

 src/amd/compiler/aco_optimizer.cpp | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/amd/compiler/aco_optimizer.cpp b/src/amd/compiler/aco_optimizer.cpp
index 9b1ac026b89..8ea5dac94ec 100644
--- a/src/amd/compiler/aco_optimizer.cpp
+++ b/src/amd/compiler/aco_optimizer.cpp
@@ -1189,7 +1189,8 @@ label_instruction(opt_ctx& ctx, aco_ptr<Instruction>& instr)
             continue;
          } else if (i == 1 &&
                     parse_base_offset(ctx, instr.get(), i, &base, &offset, prevent_overflow) &&
-                    base.regClass() == s1 && offset <= 0xFFFFF && ctx.program->chip_class >= GFX9) {
+                    base.regClass() == s1 && offset <= 0xFFFFF && ctx.program->chip_class >= GFX9 &&
+                    offset % 4u == 0) {
             bool soe = smem.operands.size() >= (!smem.definitions.empty() ? 3 : 4);
             if (soe && (!ctx.info[smem.operands.back().tempId()].is_constant_or_literal(32) ||
                         ctx.info[smem.operands.back().tempId()].val != 0)) {



More information about the mesa-commit mailing list