ac/nir/ngg: Move primitive ID workgroup barrier to proper place.

Previously, it was in a divergent branch, therefore
it could hang the GPU when a workgroup had a primitive-only wave.

Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Qiang Yu <yuq825@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17581>
This commit is contained in:
Timur Kristóf 2022-07-18 15:42:57 +02:00 committed by Marge Bot
parent 754e43369d
commit b0a7db1d3b
1 changed files with 4 additions and 4 deletions

View File

@ -480,10 +480,6 @@ emit_store_ngg_nogs_es_primitive_id(nir_builder *b)
nir_ssa_def *prim_id = NULL;
if (b->shader->info.stage == MESA_SHADER_VERTEX) {
/* Workgroup barrier - wait for GS threads to store primitive ID in LDS. */
nir_scoped_barrier(b, .execution_scope = NIR_SCOPE_WORKGROUP, .memory_scope = NIR_SCOPE_WORKGROUP,
.memory_semantics = NIR_MEMORY_ACQ_REL, .memory_modes = nir_var_mem_shared);
/* LDS address where the primitive ID is stored */
nir_ssa_def *thread_id_in_threadgroup = nir_load_local_invocation_index(b);
nir_ssa_def *addr = pervertex_lds_addr(b, thread_id_in_threadgroup, 4u);
@ -1466,6 +1462,10 @@ ac_nir_lower_ngg_nogs(nir_shader *shader,
}
emit_ngg_nogs_prim_id_store_shared(b, &state);
/* Wait for GS threads to store primitive ID in LDS. */
nir_scoped_barrier(b, .execution_scope = NIR_SCOPE_WORKGROUP, .memory_scope = NIR_SCOPE_WORKGROUP,
.memory_semantics = NIR_MEMORY_ACQ_REL, .memory_modes = nir_var_mem_shared);
}
nir_intrinsic_instr *export_vertex_instr;