Mesa (staging/20.1): aco: don't split store data if it was already split into more elements

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Jul 24 10:35:52 UTC 2020


Module: Mesa
Branch: staging/20.1
Commit: 9657d672a940784534fa0f305461fb22a14b6c71
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=9657d672a940784534fa0f305461fb22a14b6c71

Author: Daniel Schürmann <daniel at schuermann.dev>
Date:   Wed Jul 22 18:41:53 2020 +0200

aco: don't split store data if it was already split into more elements

Cc: 20.1 <mesa-stable at lists.freedesktop.org>
Reviewed-by: Rhys Perry <pendingchaos02 at gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6024>
(cherry picked from commit 626081fe4bf653a18cff9e25e6da2636bc58774a)

---

 .pick_status.json                              |  2 +-
 src/amd/compiler/aco_instruction_selection.cpp | 15 +++++++++------
 2 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/.pick_status.json b/.pick_status.json
index c8c6f7ea6a5..e0d78d33be5 100644
--- a/.pick_status.json
+++ b/.pick_status.json
@@ -310,7 +310,7 @@
         "description": "aco: don't split store data if it was already split into more elements",
         "nominated": true,
         "nomination_type": 0,
-        "resolution": 0,
+        "resolution": 1,
         "master_sha": null,
         "because_sha": null
     },
diff --git a/src/amd/compiler/aco_instruction_selection.cpp b/src/amd/compiler/aco_instruction_selection.cpp
index 0d50ca1149c..587ed98c14d 100644
--- a/src/amd/compiler/aco_instruction_selection.cpp
+++ b/src/amd/compiler/aco_instruction_selection.cpp
@@ -3648,13 +3648,15 @@ void split_store_data(isel_context *ctx, RegType dst_type, unsigned count, Temp
       /* use allocated_vec if possible */
       auto it = ctx->allocated_vec.find(src.id());
       if (it != ctx->allocated_vec.end()) {
-         unsigned total_size = 0;
-         for (unsigned i = 0; it->second[i].bytes() && (i < NIR_MAX_VEC_COMPONENTS); i++)
-            total_size += it->second[i].bytes();
-         if (total_size != src.bytes())
+         if (!it->second[0].id())
             goto split;
-
          unsigned elem_size = it->second[0].bytes();
+         assert(src.bytes() % elem_size == 0);
+
+         for (unsigned i = 0; i < src.bytes() / elem_size; i++) {
+            if (!it->second[i].id())
+               goto split;
+         }
 
          for (unsigned i = 0; i < count; i++) {
             if (offsets[i] % elem_size || dst[i].bytes() % elem_size)
@@ -3686,10 +3688,11 @@ void split_store_data(isel_context *ctx, RegType dst_type, unsigned count, Temp
       }
    }
 
+   split:
+
    if (dst_type == RegType::sgpr)
       src = bld.as_uniform(src);
 
-   split:
    /* just split it */
    aco_ptr<Instruction> split{create_instruction<Pseudo_instruction>(aco_opcode::p_split_vector, Format::PSEUDO, 1, count)};
    split->operands[0] = Operand(src);



More information about the mesa-commit mailing list