Commit aebb47b7 authored by Iago Toral's avatar Iago Toral Committed by Marge Bot
Browse files

compiler/nir: add a divergence analysis option for non-uniform workgroup id



The V3D hardware allows us to pack multiple workgroups together to avoid
wasting execution lanes in shader cores.

For example, if we dispatch 16 workgroups with a local size of 1 element, we
can pack all 16 workgroups in a single 16-wide dispatch where each lane
executes a different workgroup, instead of 16 1-wide dispatches.

When we do this, we don't have a uniform workgroup id any more.
Reviewed-by: Jason Ekstrand's avatarJason Ekstrand <jason@jlekstrand.net>
Reviewed-by: Alejandro Piñeiro's avatarAlejandro Piñeiro <apinheiro@igalia.com>
Part-of: <!10541>
parent caf9fb1a
......@@ -3126,6 +3126,7 @@ typedef enum {
nir_divergence_single_patch_per_tes_subgroup = (1 << 2),
nir_divergence_view_index_uniform = (1 << 3),
nir_divergence_single_frag_shading_rate_per_subgroup = (1 << 4),
nir_divergence_multiple_workgroup_per_compute_subgroup = (1 << 5),
} nir_divergence_options;
typedef struct nir_shader_compiler_options {
......
......@@ -101,7 +101,6 @@ visit_intrinsic(nir_shader *shader, nir_intrinsic_instr *instr)
case nir_intrinsic_vote_ieq:
case nir_intrinsic_load_push_constant:
case nir_intrinsic_load_work_dim:
case nir_intrinsic_load_work_group_id:
case nir_intrinsic_load_num_work_groups:
case nir_intrinsic_load_local_group_size:
case nir_intrinsic_load_subgroup_id:
......@@ -233,6 +232,11 @@ visit_intrinsic(nir_shader *shader, nir_intrinsic_instr *instr)
assert(stage == MESA_SHADER_TESS_CTRL);
break;
case nir_intrinsic_load_work_group_id:
assert(stage == MESA_SHADER_COMPUTE);
is_divergent |= (options & nir_divergence_multiple_workgroup_per_compute_subgroup);
break;
/* Clustered reductions are uniform if cluster_size == subgroup_size or
* the source is uniform and the operation is invariant.
* Inclusive scans are uniform if
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment