Mesa (master): aco: don't store byte-aligned short stores

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Jun 24 11:12:49 UTC 2020


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

Author: Rhys Perry <pendingchaos02 at gmail.com>
Date:   Tue May 26 16:43:05 2020 +0100

aco: don't store byte-aligned short stores

The ISA docs don't seem to say if this is allowed, so just assume short
stores require short alignment.

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/5207>

---

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

diff --git a/src/amd/compiler/aco_instruction_selection.cpp b/src/amd/compiler/aco_instruction_selection.cpp
index 94a076f4917..73be000351c 100644
--- a/src/amd/compiler/aco_instruction_selection.cpp
+++ b/src/amd/compiler/aco_instruction_selection.cpp
@@ -3857,10 +3857,10 @@ void split_buffer_store(isel_context *ctx, nir_intrinsic_instr *instr, bool smem
 
       /* dword or larger stores have to be dword-aligned */
       unsigned align_mul = instr ? nir_intrinsic_align_mul(instr) : 4;
-      unsigned align_offset = instr ? nir_intrinsic_align_offset(instr) : 0;
-      bool dword_aligned = (align_offset + offset) % 4 == 0 && align_mul % 4 == 0;
-      if (bytes >= 4 && !dword_aligned)
-         bytes = MIN2(bytes, 2);
+      unsigned align_offset = (instr ? nir_intrinsic_align_offset(instr) : 0) + offset;
+      bool dword_aligned = align_offset % 4 == 0 && align_mul % 4 == 0;
+      if (!dword_aligned)
+         bytes = MIN2(bytes, (align_offset % 2 == 0 && align_mul % 2 == 0) ? 2 : 1);
 
       advance_write_mask(&todo, offset, bytes);
       write_count_with_skips++;



More information about the mesa-commit mailing list