Mesa (master): nir/opt_uniform_atomics: fix elect detection

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Mon Jan 25 21:25:46 UTC 2021


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

Author: Rhys Perry <pendingchaos02 at gmail.com>
Date:   Thu Jan 21 17:27:31 2021 +0000

nir/opt_uniform_atomics: fix elect detection

fossil-db (GFX10.3):
Totals from 30 (0.02% of 139391) affected shaders:
SGPRs: 1736 -> 1712 (-1.38%)
CodeSize: 262116 -> 254728 (-2.82%)
Instrs: 50341 -> 48857 (-2.95%)
Cycles: 486384 -> 477556 (-1.82%)
VMEM: 4821 -> 4589 (-4.81%)
Copies: 5013 -> 4890 (-2.45%)
Branches: 2108 -> 1983 (-5.93%)
PreSGPRs: 1444 -> 1418 (-1.80%)

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

---

 src/compiler/nir/nir_opt_uniform_atomics.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/src/compiler/nir/nir_opt_uniform_atomics.c b/src/compiler/nir/nir_opt_uniform_atomics.c
index 1b7d6708a5e..f2a4cca8c06 100644
--- a/src/compiler/nir/nir_opt_uniform_atomics.c
+++ b/src/compiler/nir/nir_opt_uniform_atomics.c
@@ -128,13 +128,11 @@ get_dim(nir_ssa_scalar scalar)
 static unsigned
 match_invocation_comparison(nir_ssa_scalar scalar)
 {
-   if (!nir_ssa_scalar_is_alu(scalar))
-      return 0;
-
-   if (nir_ssa_scalar_alu_op(scalar) == nir_op_iand) {
+   bool is_alu = nir_ssa_scalar_is_alu(scalar);
+   if (is_alu && nir_ssa_scalar_alu_op(scalar) == nir_op_iand) {
       return match_invocation_comparison(nir_ssa_scalar_chase_alu_src(scalar, 0)) |
              match_invocation_comparison(nir_ssa_scalar_chase_alu_src(scalar, 1));
-   } else if (nir_ssa_scalar_alu_op(scalar) == nir_op_ieq) {
+   } else if (is_alu && nir_ssa_scalar_alu_op(scalar) == nir_op_ieq) {
       if (!nir_ssa_scalar_chase_alu_src(scalar, 0).def->divergent)
          return get_dim(nir_ssa_scalar_chase_alu_src(scalar, 1));
       if (!nir_ssa_scalar_chase_alu_src(scalar, 1).def->divergent)



More information about the mesa-commit mailing list