<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Fri, Oct 13, 2017 at 3:52 AM, Lionel Landwerlin <span dir="ltr"><<a href="mailto:lionel.g.landwerlin@intel.com" target="_blank">lionel.g.landwerlin@intel.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5">On 13/10/17 06:48, Jason Ekstrand wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
This commit pulls nir_lower_read_invocations_to_<wbr>scalar along with most<br>
of the guts of nir_opt_intrinsics (which mostly does subgroup lowering)<br>
into a new nir_lower_subgroups pass.  There are various other bits of<br>
subgroup lowering that we're going to want to do so it makes a bit more<br>
sense to keep it all together in one pass.  We also move it in i965 to<br>
happen after nir_lower_system_values to ensure that because we want to<br>
handle the subgroup mask system value intrinsics here.<br>
---<br>
  src/compiler/Makefile.sources                      |   2 +-<br>
  src/compiler/nir/nir.h                             |  12 +-<br>
  .../nir/nir_lower_read_invocat<wbr>ion_to_scalar.c      | 112 --------------<br>
  src/compiler/nir/nir_lower_sub<wbr>groups.c             | 161 +++++++++++++++++++++<br>
  src/compiler/nir/nir_opt_intri<wbr>nsics.c              |  51 +------<br>
  src/intel/compiler/brw_compile<wbr>r.c                  |   3 -<br>
  src/intel/compiler/brw_nir.c                       |   8 +-<br>
  7 files changed, 184 insertions(+), 165 deletions(-)<br>
  delete mode 100644 src/compiler/nir/nir_lower_rea<wbr>d_invocation_to_scalar.c<br>
  create mode 100644 src/compiler/nir/nir_lower_sub<wbr>groups.c<br>
<br>
diff --git a/src/compiler/Makefile.source<wbr>s b/src/compiler/Makefile.source<wbr>s<br>
index 2724a41..912c003 100644<br>
--- a/src/compiler/Makefile.source<wbr>s<br>
+++ b/src/compiler/Makefile.source<wbr>s<br>
@@ -232,11 +232,11 @@ NIR_FILES = \<br>
        nir/nir_lower_passthrough_edge<wbr>flags.c \<br>
        nir/nir_lower_patch_vertices.c \<br>
        nir/nir_lower_phis_to_scalar.c \<br>
-       nir/nir_lower_read_<wbr>invocation_to_scalar.c \<br>
        nir/nir_lower_regs_to_ssa.c \<br>
        nir/nir_lower_returns.c \<br>
        nir/nir_lower_samplers.c \<br>
        nir/nir_lower_samplers_as_dere<wbr>f.c \<br>
+       nir/nir_lower_subgroups.c \<br>
        nir/nir_lower_system_values.c \<br>
        nir/nir_lower_tex.c \<br>
        nir/nir_lower_to_source_mods.c \<br>
diff --git a/src/compiler/nir/nir.h b/src/compiler/nir/nir.h<br>
index 5af1503..1154c42 100644<br>
--- a/src/compiler/nir/nir.h<br>
+++ b/src/compiler/nir/nir.h<br>
@@ -1831,9 +1831,6 @@ typedef struct nir_shader_compiler_options {<br>
     bool lower_extract_byte;<br>
     bool lower_extract_word;<br>
  -   bool lower_vote_trivial;<br>
-   bool lower_subgroup_masks;<br>
-<br>
     /**<br>
      * Does the driver support real 32-bit integers?  (Otherwise, integers<br>
      * are simulated by floats.)<br>
@@ -2460,6 +2457,15 @@ bool nir_lower_samplers(nir_shader *shader,<br>
  bool nir_lower_samplers_as_deref(ni<wbr>r_shader *shader,<br>
                                   const struct gl_shader_program *shader_program);<br>
  +typedef struct nir_lower_subgroups_options {<br>
+   bool lower_to_scalar:1;<br>
+   bool lower_vote_trivial:1;<br>
+   bool lower_subgroup_masks:1;<br>
+} nir_lower_subgroups_options;<br>
+<br>
+bool nir_lower_subgroups(nir_shader *shader,<br>
+                         const nir_lower_subgroups_options *options);<br>
+<br>
  bool nir_lower_system_values(nir_sh<wbr>ader *shader);<br>
    typedef struct nir_lower_tex_options {<br>
diff --git a/src/compiler/nir/nir_lower_r<wbr>ead_invocation_to_scalar.c b/src/compiler/nir/nir_lower_r<wbr>ead_invocation_to_scalar.c<br>
deleted file mode 100644<br>
index 69e7c0a..0000000<br>
--- a/src/compiler/nir/nir_lower_r<wbr>ead_invocation_to_scalar.c<br>
+++ /dev/null<br>
@@ -1,112 +0,0 @@<br>
-/*<br>
- * Copyright © 2017 Intel Corporation<br>
- *<br>
- * Permission is hereby granted, free of charge, to any person obtaining a<br>
- * copy of this software and associated documentation files (the "Software"),<br>
- * to deal in the Software without restriction, including without limitation<br>
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,<br>
- * and/or sell copies of the Software, and to permit persons to whom the<br>
- * Software is furnished to do so, subject to the following conditions:<br>
- *<br>
- * The above copyright notice and this permission notice (including the next<br>
- * paragraph) shall be included in all copies or substantial portions of the<br>
- * Software.<br>
- *<br>
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR<br>
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,<br>
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL<br>
- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER<br>
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING<br>
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS<br>
- * IN THE SOFTWARE.<br>
- */<br>
-<br>
-#include "nir.h"<br>
-#include "nir_builder.h"<br>
-<br>
-/** @file nir_lower_read_invocation_to_s<wbr>calar.c<br>
- *<br>
- * Replaces nir_intrinsic_read_invocation/<wbr>nir_intrinsic_read_first_invoc<wbr>ation<br>
- * operations with num_components != 1 with individual per-channel operations.<br>
- */<br>
-<br>
-static void<br>
-lower_read_invocation_to_scal<wbr>ar(nir_builder *b, nir_intrinsic_instr *intrin)<br>
-{<br>
-   b->cursor = nir_before_instr(&intrin->inst<wbr>r);<br>
-<br>
-   nir_ssa_def *value = nir_ssa_for_src(b, intrin->src[0], intrin->num_components);<br>
-   nir_ssa_def *reads[4];<br>
-<br>
-   for (unsigned i = 0; i < intrin->num_components; i++) {<br>
-      nir_intrinsic_instr *chan_intrin =<br>
-         nir_intrinsic_instr_create(b-<wbr>>shader, intrin->intrinsic);<br>
-      nir_ssa_dest_init(&chan_intrin<wbr>->instr, &chan_intrin->dest,<br>
-                        1, intrin->dest.ssa.bit_size, NULL);<br>
-      chan_intrin->num_components = 1;<br>
-<br>
-      /* value */<br>
-      chan_intrin->src[0] = nir_src_for_ssa(nir_channel(b, value, i));<br>
-      /* invocation */<br>
-      if (intrin->intrinsic == nir_intrinsic_read_invocation)<br>
-         nir_src_copy(&chan_intrin->sr<wbr>c[1], &intrin->src[1], chan_intrin);<br>
-<br>
-      nir_builder_instr_insert(b, &chan_intrin->instr);<br>
-<br>
-      reads[i] = &chan_intrin->dest.ssa;<br>
-   }<br>
-<br>
-   nir_ssa_def_rewrite_uses(&int<wbr>rin->dest.ssa,<br>
-                            nir_src_for_ssa(nir_vec(b, reads,<br>
-                                                    intrin->num_components)));<br>
-   nir_instr_remove(&intrin->ins<wbr>tr);<br>
-}<br>
-<br>
-static bool<br>
-nir_lower_read_invocation_to_<wbr>scalar_impl(nir_function_impl *impl)<br>
-{<br>
-   bool progress = false;<br>
-   nir_builder b;<br>
-   nir_builder_init(&b, impl);<br>
-<br>
-   nir_foreach_block(block, impl) {<br>
-      nir_foreach_instr_safe(instr, block) {<br>
-         if (instr->type != nir_instr_type_intrinsic)<br>
-            continue;<br>
-<br>
-         nir_intrinsic_instr *intrin = nir_instr_as_intrinsic(instr);<br>
-<br>
-         if (intrin->num_components == 1)<br>
-            continue;<br>
-<br>
-         switch (intrin->intrinsic) {<br>
-         case nir_intrinsic_read_invocation:<br>
-         case nir_intrinsic_read_first_invoc<wbr>ation:<br>
-            lower_read_invocation_to_scala<wbr>r(&b, intrin);<br>
-            progress = true;<br>
-            break;<br>
-         default:<br>
-            break;<br>
-         }<br>
-      }<br>
-   }<br>
-<br>
-   if (progress) {<br>
-      nir_metadata_preserve(impl, nir_metadata_block_index |<br>
-                                  nir_metadata_dominance);<br>
-   }<br>
-   return progress;<br>
-}<br>
-<br>
-bool<br>
-nir_lower_read_invocation_to_<wbr>scalar(nir_shader *shader)<br>
-{<br>
-   bool progress = false;<br>
-<br>
-   nir_foreach_function(<wbr>function, shader) {<br>
-      if (function->impl)<br>
-         progress |= nir_lower_read_invocation_to_s<wbr>calar_impl(function->impl);<br>
-   }<br>
-<br>
-   return progress;<br>
-}<br>
diff --git a/src/compiler/nir/nir_lower_s<wbr>ubgroups.c b/src/compiler/nir/nir_lower_s<wbr>ubgroups.c<br>
new file mode 100644<br>
index 0000000..02738c4<br>
--- /dev/null<br>
+++ b/src/compiler/nir/nir_lower_s<wbr>ubgroups.c<br>
@@ -0,0 +1,161 @@<br>
+/*<br>
+ * Copyright © 2017 Intel Corporation<br>
+ *<br>
+ * Permission is hereby granted, free of charge, to any person obtaining a<br>
+ * copy of this software and associated documentation files (the "Software"),<br>
+ * to deal in the Software without restriction, including without limitation<br>
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,<br>
+ * and/or sell copies of the Software, and to permit persons to whom the<br>
+ * Software is furnished to do so, subject to the following conditions:<br>
+ *<br>
+ * The above copyright notice and this permission notice (including the next<br>
+ * paragraph) shall be included in all copies or substantial portions of the<br>
+ * Software.<br>
+ *<br>
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR<br>
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,<br>
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL<br>
+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER<br>
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING<br>
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS<br>
+ * IN THE SOFTWARE.<br>
+ */<br>
+<br>
+#include "nir.h"<br>
+#include "nir_builder.h"<br>
+<br>
+/**<br>
+ * \file nir_opt_intrinsics.c<br>
+ */<br>
+<br>
+static nir_ssa_def *<br>
+lower_read_invocation_to_scal<wbr>ar(nir_builder *b, nir_intrinsic_instr *intrin)<br>
+{<br>
+   nir_ssa_def *value = nir_ssa_for_src(b, intrin->src[0],<br>
+                                           intrin->num_components);<br>
+   nir_ssa_def *reads[4];<br>
+<br>
+   for (unsigned i = 0; i < intrin->num_components; i++) {<br>
+      nir_intrinsic_instr *chan_intrin =<br>
+         nir_intrinsic_instr_create(b-<wbr>>shader, intrin->intrinsic);<br>
+      nir_ssa_dest_init(&chan_intrin<wbr>->instr, &chan_intrin->dest,<br>
+                        1, intrin->dest.ssa.bit_size, NULL);<br>
+      chan_intrin->num_components = 1;<br>
+<br>
+      /* value */<br>
+      chan_intrin->src[0] = nir_src_for_ssa(nir_channel(b, value, i));<br>
+      /* invocation */<br>
+      if (intrin->intrinsic == nir_intrinsic_read_invocation)<br>
+         nir_src_copy(&chan_intrin->sr<wbr>c[1], &intrin->src[1], chan_intrin);<br>
+<br>
+      nir_builder_instr_insert(b, &chan_intrin->instr);<br>
+<br>
+      reads[i] = &chan_intrin->dest.ssa;<br>
+   }<br>
+<br>
+   return nir_vec(b, reads, intrin->num_components);<br>
+}<br>
+<br>
+static nir_ssa_def *<br>
+lower_subgroups_intrin(nir_bu<wbr>ilder *b, nir_intrinsic_instr *intrin,<br>
+                       const nir_lower_subgroups_options *options)<br>
+{<br>
+   switch (intrin->intrinsic) {<br>
+   case nir_intrinsic_vote_any:<br>
+   case nir_intrinsic_vote_all:<br>
+      if (options->lower_vote_trivial)<br>
+         return nir_ssa_for_src(b, intrin->src[0], 1);<br>
+      break;<br>
+<br>
+   case nir_intrinsic_vote_eq:<br>
+      if (options->lower_vote_trivial)<br>
+         return nir_imm_int(b, NIR_TRUE);<br>
+      break;<br>
+<br>
+   case nir_intrinsic_read_invocation:<br>
+   case nir_intrinsic_read_first_invoc<wbr>ation:<br>
+      if (options->lower_to_scalar)<br>
+         return lower_read_invocation_to_scala<wbr>r(b, intrin);<br>
+      break;<br>
+<br>
+   case nir_intrinsic_load_subgroup_eq<wbr>_mask:<br>
+   case nir_intrinsic_load_subgroup_ge<wbr>_mask:<br>
+   case nir_intrinsic_load_subgroup_gt<wbr>_mask:<br>
+   case nir_intrinsic_load_subgroup_le<wbr>_mask:<br>
+   case nir_intrinsic_load_subgroup_lt<wbr>_mask: {<br>
+      if (!options->lower_subgroup_mask<wbr>s)<br>
+         return NULL;<br>
+<br>
+      nir_ssa_def *count = nir_load_subgroup_invocation(b<wbr>);<br>
+<br>
+      switch (intrin->intrinsic) {<br>
+      case nir_intrinsic_load_subgroup_eq<wbr>_mask:<br>
+         return nir_ishl(b, nir_imm_int64(b, 1ull), count);<br>
+      case nir_intrinsic_load_subgroup_ge<wbr>_mask:<br>
+         return nir_ishl(b, nir_imm_int64(b, ~0ull), count);<br>
+      case nir_intrinsic_load_subgroup_gt<wbr>_mask:<br>
+         return nir_ishl(b, nir_imm_int64(b, ~1ull), count);<br>
+      case nir_intrinsic_load_subgroup_le<wbr>_mask:<br>
+         return nir_inot(b, nir_ishl(b, nir_imm_int64(b, ~1ull), count));<br>
+      case nir_intrinsic_load_subgroup_lt<wbr>_mask:<br>
+         return nir_inot(b, nir_ishl(b, nir_imm_int64(b, ~0ull), count));<br>
+      default:<br>
+         unreachable("you seriously can't tell this is unreachable?");<br>
+      }<br>
+      break;<br>
+   }<br>
+   default:<br>
+      break;<br>
+   }<br>
+<br>
+   return NULL;<br>
+}<br>
+<br>
+static bool<br>
+lower_subgroups_impl(nir_func<wbr>tion_impl *impl,<br>
+                     const nir_lower_subgroups_options *options)<br>
+{<br>
+   nir_builder b;<br>
+   nir_builder_init(&b, impl);<br>
+   bool progress = false;<br>
+<br>
+   nir_foreach_block(block, impl) {<br>
+      nir_foreach_instr_safe(instr, block) {<br>
+         if (instr->type != nir_instr_type_intrinsic)<br>
+            continue;<br>
+<br>
+         nir_intrinsic_instr *intrin = nir_instr_as_intrinsic(instr);<br>
+         b.cursor = nir_before_instr(instr);<br>
+<br>
+         nir_ssa_def *lower = lower_subgroups_intrin(&b, intrin, options);<br>
+         if (!lower)<br>
+            continue;<br>
+<br>
+         nir_ssa_def_rewrite_uses(&int<wbr>rin->dest.ssa, nir_src_for_ssa(lower));<br>
+         nir_instr_remove(instr);<br>
+         progress = true;<br>
+      }<br>
+   }<br>
+<br>
+   return progress;<br>
+}<br>
+<br>
+bool<br>
+nir_lower_subgroups(nir_shade<wbr>r *shader,<br>
+                    const nir_lower_subgroups_options *options)<br>
+{<br>
+   bool progress = false;<br>
+<br>
+   nir_foreach_function(<wbr>function, shader) {<br>
+      if (!function->impl)<br>
+         continue;<br>
+<br>
+      if (lower_subgroups_impl(function<wbr>->impl, options)) {<br>
+         progress = true;<br>
+         nir_metadata_preserve(functio<wbr>n->impl, nir_metadata_block_index |<br>
+                                               nir_metadata_dominance);<br>
+      }<br>
+   }<br>
+<br>
+   return progress;<br>
+}<br>
diff --git a/src/compiler/nir/nir_opt_int<wbr>rinsics.c b/src/compiler/nir/nir_opt_int<wbr>rinsics.c<br>
index 26a0f96..98c8b1a 100644<br>
--- a/src/compiler/nir/nir_opt_int<wbr>rinsics.c<br>
+++ b/src/compiler/nir/nir_opt_int<wbr>rinsics.c<br>
@@ -46,22 +46,14 @@ opt_intrinsics_impl(nir_functi<wbr>on_impl *impl)<br>
             switch (intrin->intrinsic) {<br>
           case nir_intrinsic_vote_any:<br>
-         case nir_intrinsic_vote_all: {<br>
-            nir_const_value *val = nir_src_as_const_value(intrin-<wbr>>src[0]);<br>
-            if (!val && !b.shader->options->lower_vote<wbr>_trivial)<br>
-               continue;<br>
-<br>
-            replacement = nir_ssa_for_src(&b, intrin->src[0], 1);<br>
+         case nir_intrinsic_vote_all:<br>
+            if (nir_src_as_const_value(intrin<wbr>->src[0]))<br>
+               replacement = nir_ssa_for_src(&b, intrin->src[0], 1);<br>
              break;<br>
-         }<br>
-         case nir_intrinsic_vote_eq: {<br>
-            nir_const_value *val = nir_src_as_const_value(intrin-<wbr>>src[0]);<br>
-            if (!val && !b.shader->options->lower_vote<wbr>_trivial)<br>
-               continue;<br>
-<br>
-            replacement = nir_imm_int(&b, NIR_TRUE);<br>
+         case nir_intrinsic_vote_eq:<br>
+            if (nir_src_as_const_value(intrin<wbr>->src[0]))<br>
+               replacement = nir_imm_int(&b, NIR_TRUE);<br>
              break;<br>
-         }<br>
           case nir_intrinsic_ballot: {<br>
              assert(b.shader->options->max_<wbr>subgroup_size != 0);<br>
              if (b.shader->options->max_subgro<wbr>up_size > 32 ||<br>
@@ -80,37 +72,6 @@ opt_intrinsics_impl(nir_functi<wbr>on_impl *impl)<br>
                                                   nir_imm_int(&b, 0));<br>
              break;<br>
           }<br>
-         case nir_intrinsic_load_subgroup_eq<wbr>_mask:<br>
-         case nir_intrinsic_load_subgroup_ge<wbr>_mask:<br>
-         case nir_intrinsic_load_subgroup_gt<wbr>_mask:<br>
-         case nir_intrinsic_load_subgroup_le<wbr>_mask:<br>
-         case nir_intrinsic_load_subgroup_lt<wbr>_mask: {<br>
-            if (!b.shader->options->lower_sub<wbr>group_masks)<br>
-               break;<br>
-<br>
-            nir_ssa_def *count = nir_load_subgroup_invocation(&<wbr>b);<br>
-<br>
-            switch (intrin->intrinsic) {<br>
-            case nir_intrinsic_load_subgroup_eq<wbr>_mask:<br>
-               replacement = nir_ishl(&b, nir_imm_int64(&b, 1ull), count);<br>
-               break;<br>
-            case nir_intrinsic_load_subgroup_ge<wbr>_mask:<br>
-               replacement = nir_ishl(&b, nir_imm_int64(&b, ~0ull), count);<br>
-               break;<br>
-            case nir_intrinsic_load_subgroup_gt<wbr>_mask:<br>
-               replacement = nir_ishl(&b, nir_imm_int64(&b, ~1ull), count);<br>
-               break;<br>
-            case nir_intrinsic_load_subgroup_le<wbr>_mask:<br>
-               replacement = nir_inot(&b, nir_ishl(&b, nir_imm_int64(&b, ~1ull), count));<br>
-               break;<br>
-            case nir_intrinsic_load_subgroup_lt<wbr>_mask:<br>
-               replacement = nir_inot(&b, nir_ishl(&b, nir_imm_int64(&b, ~0ull), count));<br>
-               break;<br>
-            default:<br>
-               unreachable("you seriously can't tell this is unreachable?");<br>
-            }<br>
-            break;<br>
-         }<br>
           default:<br>
              break;<br>
           }<br>
diff --git a/src/intel/compiler/brw_compi<wbr>ler.c b/src/intel/compiler/brw_compi<wbr>ler.c<br>
index 2f6af7d..a6129e9 100644<br>
--- a/src/intel/compiler/brw_compi<wbr>ler.c<br>
+++ b/src/intel/compiler/brw_compi<wbr>ler.c<br>
@@ -57,7 +57,6 @@ static const struct nir_shader_compiler_options scalar_nir_options = {<br>
     .lower_unpack_snorm_4x8 = true,<br>
     .lower_unpack_unorm_2x16 = true,<br>
     .lower_unpack_unorm_4x8 = true,<br>
-   .lower_subgroup_masks = true,<br>
     .max_subgroup_size = 32,<br>
     .max_unroll_iterations = 32,<br>
  };<br>
@@ -80,7 +79,6 @@ static const struct nir_shader_compiler_options vector_nir_options = {<br>
     .lower_unpack_unorm_2x16 = true,<br>
     .lower_extract_byte = true,<br>
     .lower_extract_word = true,<br>
-   .lower_vote_trivial = true,<br>
     .max_unroll_iterations = 32,<br>
  };<br>
  @@ -99,7 +97,6 @@ static const struct nir_shader_compiler_options vector_nir_options_gen6 = {<br>
     .lower_unpack_unorm_2x16 = true,<br>
     .lower_extract_byte = true,<br>
     .lower_extract_word = true,<br>
-   .lower_vote_trivial = true,<br>
     .max_unroll_iterations = 32,<br>
  };<br>
  diff --git a/src/intel/compiler/brw_nir.c b/src/intel/compiler/brw_nir.c<br>
index 0a41768..03ee862 100644<br>
--- a/src/intel/compiler/brw_nir.c<br>
+++ b/src/intel/compiler/brw_nir.c<br>
@@ -620,7 +620,6 @@ brw_preprocess_nir(const struct brw_compiler *compiler, nir_shader *nir)<br>
       OPT(nir_lower_tex, &tex_options);<br>
     OPT(nir_normalize_cubemap_coo<wbr>rds);<br>
-   OPT(nir_lower_read_<wbr>invocation_to_scalar);<br>
       OPT(nir_lower_global_vars_to_<wbr>local);<br>
  @@ -637,6 +636,13 @@ brw_preprocess_nir(const struct brw_compiler *compiler, nir_shader *nir)<br>
       OPT(nir_lower_system_values);<br>
  +   const nir_lower_subgroups_options subgroups_options = {<br>
+      .lower_to_scalar = true,<br>
+      .lower_subgroup_masks = true,<br>
</blockquote></div></div>
So we were lowering subgroup masks only for scalar before and now we do for non scalar too?<br>
</blockquote><div><br></div><div>I suppose we are.  Shouldn't hurt anything though.<br></div><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="HOEnZb"><div class="h5"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
+      .lower_vote_trivial = !is_scalar,<br>
+   };<br>
+   OPT(nir_lower_subgroups, &subgroups_options);<br>
+<br>
     OPT(nir_lower_clip_cull_dista<wbr>nce_arrays);<br>
       nir_variable_mode indirect_mask = 0;<br>
</blockquote>
<br>
<br>
</div></div></blockquote></div><br></div></div>