Mesa (master): nir: gather shader_info::needs_all_helper_invocations

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Nov 12 21:21:53 UTC 2020


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

Author: Marek Olšák <marek.olsak at amd.com>
Date:   Mon Sep 21 20:35:06 2020 -0400

nir: gather shader_info::needs_all_helper_invocations

Reviewed-by: Rhys Perry <pendingchaos02 at gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7586>

---

 src/compiler/nir/nir_gather_info.c | 28 ++++++++++++++++++++++++++++
 src/compiler/shader_info.h         |  6 ++++++
 2 files changed, 34 insertions(+)

diff --git a/src/compiler/nir/nir_gather_info.c b/src/compiler/nir/nir_gather_info.c
index a7f1d895b28..ef2cbefeb51 100644
--- a/src/compiler/nir/nir_gather_info.c
+++ b/src/compiler/nir/nir_gather_info.c
@@ -533,6 +533,33 @@ gather_intrinsic_info(nir_intrinsic_instr *instr, nir_shader *shader,
          shader->info.fs.needs_quad_helper_invocations = true;
       break;
 
+   case nir_intrinsic_vote_any:
+   case nir_intrinsic_vote_all:
+   case nir_intrinsic_vote_feq:
+   case nir_intrinsic_vote_ieq:
+   case nir_intrinsic_ballot:
+   case nir_intrinsic_ballot_bit_count_exclusive:
+   case nir_intrinsic_ballot_bit_count_inclusive:
+   case nir_intrinsic_ballot_bitfield_extract:
+   case nir_intrinsic_ballot_bit_count_reduce:
+   case nir_intrinsic_ballot_find_lsb:
+   case nir_intrinsic_ballot_find_msb:
+   case nir_intrinsic_first_invocation:
+   case nir_intrinsic_read_invocation:
+   case nir_intrinsic_read_first_invocation:
+   case nir_intrinsic_elect:
+   case nir_intrinsic_reduce:
+   case nir_intrinsic_inclusive_scan:
+   case nir_intrinsic_exclusive_scan:
+   case nir_intrinsic_shuffle:
+   case nir_intrinsic_shuffle_xor:
+   case nir_intrinsic_shuffle_up:
+   case nir_intrinsic_shuffle_down:
+   case nir_intrinsic_write_invocation_amd:
+      if (shader->info.stage == MESA_SHADER_FRAGMENT)
+         shader->info.fs.needs_all_helper_invocations = true;
+      break;
+
    case nir_intrinsic_end_primitive:
    case nir_intrinsic_end_primitive_with_counter:
       assert(shader->info.stage == MESA_SHADER_GEOMETRY);
@@ -808,6 +835,7 @@ nir_shader_gather_info(nir_shader *shader, nir_function_impl *entrypoint)
       shader->info.fs.color_is_dual_source = false;
       shader->info.fs.uses_fbfetch_output = false;
       shader->info.fs.needs_quad_helper_invocations = false;
+      shader->info.fs.needs_all_helper_invocations = false;
    }
    if (shader->info.stage == MESA_SHADER_TESS_CTRL) {
       shader->info.tess.tcs_cross_invocation_inputs_read = 0;
diff --git a/src/compiler/shader_info.h b/src/compiler/shader_info.h
index 2a919bb436f..e1be926e6e1 100644
--- a/src/compiler/shader_info.h
+++ b/src/compiler/shader_info.h
@@ -274,6 +274,12 @@ typedef struct shader_info {
           */
          bool needs_quad_helper_invocations:1;
 
+         /**
+          * True if this fragment shader requires helper invocations for
+          * all subgroup operations, not just quad ops and derivatives.
+          */
+         bool needs_all_helper_invocations:1;
+
          /**
           * Whether any inputs are declared with the "sample" qualifier.
           */



More information about the mesa-commit mailing list