aco: Assert that workgroup barriers are not used inappropriately.

Example:
It is possible for some NGG GS waves to have 0 ES and/or GS invocations,
and in that case having an s_barrier inside divergent control flow can
very possibly hang the GPU.

Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7232>
This commit is contained in:
Timur Kristóf 2020-10-15 10:58:34 +02:00
parent 915f2919f6
commit 9757c3cb6b

View file

@ -6559,6 +6559,11 @@ void emit_scoped_barrier(isel_context *ctx, nir_intrinsic_instr *instr) {
assert(!(nir_semantics & (NIR_MEMORY_MAKE_AVAILABLE | NIR_MEMORY_MAKE_VISIBLE)));
/* Workgroup barriers can hang merged shaders that can potentially have 0 threads in either half. */
assert(exec_scope != scope_workgroup ||
ctx->shader->info.stage == MESA_SHADER_COMPUTE ||
ctx->shader->info.stage == MESA_SHADER_TESS_CTRL);
bld.barrier(aco_opcode::p_barrier,
memory_sync_info((storage_class)storage, (memory_semantics)semantics, mem_scope),
exec_scope);