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@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7586>
This commit is contained in:
Marek Olšák 2020-09-21 20:21:40 -04:00 committed by Marge Bot
parent 96c12b7dc2
commit baa5807e36
8 changed files with 13 additions and 12 deletions

View file

@ -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;

View file

@ -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.

View file

@ -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:

View file

@ -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;

View file

@ -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)) ||

View file

@ -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 ||

View file

@ -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;

View file

@ -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;
}