Mesa (master): pan/mdg: Vectorize vlut operations

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Jul 2 19:11:40 UTC 2020


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

Author: Icecream95 <ixn at keemail.me>
Date:   Sun May 24 00:23:25 2020 +1200

pan/mdg: Vectorize vlut operations

total instructions in shared programs: 49462 -> 49458 (<.01%)
instructions in affected programs: 348 -> 344 (-1.15%)
helped: 2
HURT: 0

total bundles in shared programs: 25201 -> 25199 (<.01%)
bundles in affected programs: 142 -> 140 (-1.41%)
helped: 2
HURT: 0

total quadwords in shared programs: 40273 -> 40269 (<.01%)
quadwords in affected programs: 244 -> 240 (-1.64%)
helped: 2
HURT: 0

Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig at collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5513>

---

 src/panfrost/midgard/midgard_compile.c | 19 ++++++++++++++++++-
 1 file changed, 18 insertions(+), 1 deletion(-)

diff --git a/src/panfrost/midgard/midgard_compile.c b/src/panfrost/midgard/midgard_compile.c
index f9198288ba8..1460f6c23b2 100644
--- a/src/panfrost/midgard/midgard_compile.c
+++ b/src/panfrost/midgard/midgard_compile.c
@@ -1245,6 +1245,9 @@ emit_alu(compiler_context *ctx, nir_alu_instr *instr)
                 unsigned swizzle_back[MIR_VEC_COMPONENTS];
                 memcpy(&swizzle_back, ins.swizzle[0], sizeof(swizzle_back));
 
+                midgard_instruction ins_split[MIR_VEC_COMPONENTS];
+                unsigned ins_count = 0;
+
                 for (int i = 0; i < nr_components; ++i) {
                         /* Mask the associated component, dropping the
                          * instruction if needed */
@@ -1252,13 +1255,27 @@ emit_alu(compiler_context *ctx, nir_alu_instr *instr)
                         ins.mask = 1 << i;
                         ins.mask &= orig_mask;
 
+                        for (unsigned j = 0; j < ins_count; ++j) {
+                                if (swizzle_back[i] == ins_split[j].swizzle[0][0]) {
+                                        ins_split[j].mask |= ins.mask;
+                                        ins.mask = 0;
+                                        break;
+                                }
+                        }
+
                         if (!ins.mask)
                                 continue;
 
                         for (unsigned j = 0; j < MIR_VEC_COMPONENTS; ++j)
                                 ins.swizzle[0][j] = swizzle_back[i]; /* Pull from the correct component */
 
-                        emit_mir_instruction(ctx, ins);
+                        ins_split[ins_count] = ins;
+
+                        ++ins_count;
+                }
+
+                for (unsigned i = 0; i < ins_count; ++i) {
+                        emit_mir_instruction(ctx, ins_split[i]);
                 }
         } else {
                 emit_mir_instruction(ctx, ins);



More information about the mesa-commit mailing list