Mesa (master): nir: rename needs_helper_invocations to needs_quad_helper_invocations

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


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

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

nir: rename needs_helper_invocations to needs_quad_helper_invocations

This indicates that only quad operations use helper invocations.
Also handle quad_swizzle_amd.

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                           | 9 +++++----
 src/compiler/shader_info.h                                   | 2 +-
 src/freedreno/ir3/ir3_compiler_nir.c                         | 2 +-
 src/freedreno/ir3/ir3_nir_lower_load_barycentric_at_offset.c | 2 +-
 src/gallium/drivers/panfrost/pan_assemble.c                  | 2 +-
 src/gallium/drivers/radeonsi/si_shader.c                     | 2 +-
 src/gallium/drivers/radeonsi/si_state_shaders.c              | 4 ++--
 src/panfrost/bifrost/bi_pack.c                               | 2 +-
 8 files changed, 13 insertions(+), 12 deletions(-)

diff --git a/src/compiler/nir/nir_gather_info.c b/src/compiler/nir/nir_gather_info.c
index 2271f8b6b7a..a7f1d895b28 100644
--- a/src/compiler/nir/nir_gather_info.c
+++ b/src/compiler/nir/nir_gather_info.c
@@ -528,8 +528,9 @@ gather_intrinsic_info(nir_intrinsic_instr *instr, nir_shader *shader,
    case nir_intrinsic_quad_swap_horizontal:
    case nir_intrinsic_quad_swap_vertical:
    case nir_intrinsic_quad_swap_diagonal:
+   case nir_intrinsic_quad_swizzle_amd:
       if (shader->info.stage == MESA_SHADER_FRAGMENT)
-         shader->info.fs.needs_helper_invocations = true;
+         shader->info.fs.needs_quad_helper_invocations = true;
       break;
 
    case nir_intrinsic_end_primitive:
@@ -682,7 +683,7 @@ gather_tex_info(nir_tex_instr *instr, nir_shader *shader)
 {
    if (shader->info.stage == MESA_SHADER_FRAGMENT &&
        nir_tex_instr_has_implicit_derivative(instr))
-      shader->info.fs.needs_helper_invocations = true;
+      shader->info.fs.needs_quad_helper_invocations = true;
 
    switch (instr->op) {
    case nir_texop_tg4:
@@ -706,7 +707,7 @@ gather_alu_info(nir_alu_instr *instr, nir_shader *shader)
    case nir_op_fddx_coarse:
    case nir_op_fddy_coarse:
       if (shader->info.stage == MESA_SHADER_FRAGMENT)
-         shader->info.fs.needs_helper_invocations = true;
+         shader->info.fs.needs_quad_helper_invocations = true;
       break;
    default:
       break;
@@ -806,7 +807,7 @@ nir_shader_gather_info(nir_shader *shader, nir_function_impl *entrypoint)
       shader->info.fs.uses_demote = false;
       shader->info.fs.color_is_dual_source = false;
       shader->info.fs.uses_fbfetch_output = false;
-      shader->info.fs.needs_helper_invocations = false;
+      shader->info.fs.needs_quad_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 a992ad5f4f3..2a919bb436f 100644
--- a/src/compiler/shader_info.h
+++ b/src/compiler/shader_info.h
@@ -272,7 +272,7 @@ typedef struct shader_info {
           * instructions which do implicit derivatives, and the use of quad
           * subgroup operations.
           */
-         bool needs_helper_invocations:1;
+         bool needs_quad_helper_invocations:1;
 
          /**
           * Whether any inputs are declared with the "sample" qualifier.
diff --git a/src/freedreno/ir3/ir3_compiler_nir.c b/src/freedreno/ir3/ir3_compiler_nir.c
index 3484cf16def..154666af8fa 100644
--- a/src/freedreno/ir3/ir3_compiler_nir.c
+++ b/src/freedreno/ir3/ir3_compiler_nir.c
@@ -3820,7 +3820,7 @@ ir3_compile_shader_nir(struct ir3_compiler *compiler,
 	collect_tex_prefetches(ctx, ir);
 
 	if (so->type == MESA_SHADER_FRAGMENT &&
-			ctx->s->info.fs.needs_helper_invocations)
+			ctx->s->info.fs.needs_quad_helper_invocations)
 		so->need_pixlod = true;
 
 out:
diff --git a/src/freedreno/ir3/ir3_nir_lower_load_barycentric_at_offset.c b/src/freedreno/ir3/ir3_nir_lower_load_barycentric_at_offset.c
index 5dcedfa436a..c7834836e18 100644
--- a/src/freedreno/ir3/ir3_nir_lower_load_barycentric_at_offset.c
+++ b/src/freedreno/ir3/ir3_nir_lower_load_barycentric_at_offset.c
@@ -63,7 +63,7 @@ ir3_nir_lower_load_barycentric_at_offset_instr(nir_builder *b,
 	nir_ssa_def *bar = nir_fddy(b, sij);
 
 	if (b->shader->info.stage == MESA_SHADER_FRAGMENT)
-		b->shader->info.fs.needs_helper_invocations = true;
+		b->shader->info.fs.needs_quad_helper_invocations = true;
 
 	nir_ssa_def *x, *y, *z, *i, *j;
 
diff --git a/src/gallium/drivers/panfrost/pan_assemble.c b/src/gallium/drivers/panfrost/pan_assemble.c
index b39ebfed2eb..fc645dcd953 100644
--- a/src/gallium/drivers/panfrost/pan_assemble.c
+++ b/src/gallium/drivers/panfrost/pan_assemble.c
@@ -336,7 +336,7 @@ panfrost_shader_compile(struct panfrost_context *ctx,
         }
 
         state->can_discard = s->info.fs.uses_discard;
-        state->helper_invocations = s->info.fs.needs_helper_invocations;
+        state->helper_invocations = s->info.fs.needs_quad_helper_invocations;
         state->stack_size = program->tls_size;
 
         state->reads_frag_coord = (s->info.inputs_read & (1 << VARYING_SLOT_POS)) ||
diff --git a/src/gallium/drivers/radeonsi/si_shader.c b/src/gallium/drivers/radeonsi/si_shader.c
index 2ab836febbe..cff0ca79871 100644
--- a/src/gallium/drivers/radeonsi/si_shader.c
+++ b/src/gallium/drivers/radeonsi/si_shader.c
@@ -2180,7 +2180,7 @@ void si_get_ps_prolog_key(struct si_shader *shader, union si_shader_part_key *ke
    key->ps_prolog.num_input_sgprs = shader->info.num_input_sgprs;
    key->ps_prolog.num_input_vgprs = shader->info.num_input_vgprs;
    key->ps_prolog.wqm =
-      info->base.fs.needs_helper_invocations &&
+      info->base.fs.needs_quad_helper_invocations &&
       (key->ps_prolog.colors_read || key->ps_prolog.states.force_persp_sample_interp ||
        key->ps_prolog.states.force_linear_sample_interp ||
        key->ps_prolog.states.force_persp_center_interp ||
diff --git a/src/gallium/drivers/radeonsi/si_state_shaders.c b/src/gallium/drivers/radeonsi/si_state_shaders.c
index bdb151ee96a..3d0baf04646 100644
--- a/src/gallium/drivers/radeonsi/si_state_shaders.c
+++ b/src/gallium/drivers/radeonsi/si_state_shaders.c
@@ -73,8 +73,8 @@ void si_get_ir_cache_key(struct si_shader_selector *sel, bool ngg, bool es,
    if (si_get_wave_size(sel->screen, sel->info.stage, ngg, es, false, false) == 32)
       shader_variant_flags |= 1 << 2;
    if (sel->info.stage == MESA_SHADER_FRAGMENT &&
-       /* Derivatives imply helper invocations so check for needs_helper_invocations. */
-       sel->info.base.fs.needs_helper_invocations &&
+       /* Derivatives imply helper invocations so check for needs_quad_helper_invocations. */
+       sel->info.base.fs.needs_quad_helper_invocations &&
        sel->info.base.fs.uses_discard &&
        sel->screen->debug_flags & DBG(FS_CORRECT_DERIVS_AFTER_KILL))
       shader_variant_flags |= 1 << 3;
diff --git a/src/panfrost/bifrost/bi_pack.c b/src/panfrost/bifrost/bi_pack.c
index 79f03cacb61..2122dc373fc 100644
--- a/src/panfrost/bifrost/bi_pack.c
+++ b/src/panfrost/bifrost/bi_pack.c
@@ -1142,7 +1142,7 @@ static bool
 bi_terminate_discarded_threads(bi_context *ctx)
 {
         if (ctx->stage == MESA_SHADER_FRAGMENT)
-                return !ctx->nir->info.fs.needs_helper_invocations;
+                return !ctx->nir->info.fs.needs_quad_helper_invocations;
         else
                 return false;
 }



More information about the mesa-commit mailing list