radv/llvm: Emit s_barrier at the beginning of NGG non-GS shaders.

This is to fix a hang that can potentially happen when not every
wave had launched when a gs_alloc_req is executed.

Cc: mesa-stable
Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10837>
(cherry picked from commit 25314996d0)
This commit is contained in:
Timur Kristóf 2021-05-17 14:00:58 +02:00 committed by Eric Engestrom
parent 20acb90a67
commit 20df6c58cb
2 changed files with 5 additions and 1 deletions

View file

@ -2650,7 +2650,7 @@
"description": "radv/llvm: Emit s_barrier at the beginning of NGG non-GS shaders.",
"nominated": true,
"nomination_type": 0,
"resolution": 0,
"resolution": 1,
"main_sha": null,
"because_sha": null
},

View file

@ -3023,6 +3023,10 @@ ac_translate_nir_to_llvm(struct ac_llvm_compiler *ac_llvm, struct nir_shader *co
LLVMSetInitializer(ctx.gs_ngg_scratch, LLVMGetUndef(asi32));
LLVMSetAlignment(ctx.gs_ngg_scratch, 4);
}
/* GFX10 hang workaround - there needs to be an s_barrier before gs_alloc_req always */
if (ctx.ac.chip_class == GFX10 && shader_count == 1)
ac_build_s_barrier(&ctx.ac);
}
for (int shader_idx = 0; shader_idx < shader_count; ++shader_idx) {