Mesa (master): nir: detect more dynamically uniform expressions

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Jun 14 06:05:30 UTC 2019


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

Author: Iago Toral Quiroga <itoral at igalia.com>
Date:   Wed Jun 12 13:57:03 2019 +0200

nir: detect more dynamically uniform expressions

Shader-db results for v3d:

total instructions in shared programs: 9132728 -> 9119238 (-0.15%)
instructions in affected programs: 596886 -> 583396 (-2.26%)
helped: 1118
HURT: 224

total threads in shared programs: 234298 -> 234308 (<.01%)
threads in affected programs: 10 -> 20 (100.00%)
helped: 5
HURT: 0

total uniforms in shared programs: 3022949 -> 3022622 (-0.01%)
uniforms in affected programs: 29163 -> 28836 (-1.12%)
helped: 108
HURT: 37

total max-temps in shared programs: 1328030 -> 1327762 (-0.02%)
max-temps in affected programs: 10097 -> 9829 (-2.65%)
helped: 263
HURT: 15

total spills in shared programs: 3793 -> 3777 (-0.42%)
spills in affected programs: 432 -> 416 (-3.70%)
helped: 16
HURT: 0

total fills in shared programs: 4380 -> 4266 (-2.60%)
fills in affected programs: 828 -> 714 (-13.77%)
helped: 16
HURT: 0

Reviewed-by: Eric Anholt <eric at anholt.net>

---

 src/compiler/nir/nir.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/src/compiler/nir/nir.c b/src/compiler/nir/nir.c
index 5b75585498e..524b9445b11 100644
--- a/src/compiler/nir/nir.c
+++ b/src/compiler/nir/nir.c
@@ -1333,6 +1333,19 @@ nir_src_is_dynamically_uniform(nir_src src)
          return true;
    }
 
+   /* Operating together dynamically uniform expressions produces a
+    * dynamically uniform result
+    */
+   if (src.ssa->parent_instr->type == nir_instr_type_alu) {
+      nir_alu_instr *alu = nir_instr_as_alu(src.ssa->parent_instr);
+      for (int i = 0; i < nir_op_infos[alu->op].num_inputs; i++) {
+         if (!nir_src_is_dynamically_uniform(alu->src[i].src))
+            return false;
+      }
+
+      return true;
+   }
+
    /* XXX: this could have many more tests, such as when a sampler function is
     * called with dynamically uniform arguments.
     */




More information about the mesa-commit mailing list