From b0a7db1d3b486cea9e5273d05da10614e2a162ac Mon Sep 17 00:00:00 2001 From: =?utf8?q?Timur=20Krist=C3=B3f?= Date: Mon, 18 Jul 2022 15:42:57 +0200 Subject: [PATCH] ac/nir/ngg: Move primitive ID workgroup barrier to proper place. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit 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 Reviewed-by: Qiang Yu Part-of: --- src/amd/common/ac_nir_lower_ngg.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/amd/common/ac_nir_lower_ngg.c b/src/amd/common/ac_nir_lower_ngg.c index b7e7ec8..fdb3827 100644 --- a/src/amd/common/ac_nir_lower_ngg.c +++ b/src/amd/common/ac_nir_lower_ngg.c @@ -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; -- 2.7.4