From 901bc6d53ca24d0128a925d2efb96084f8b9ec81 Mon Sep 17 00:00:00 2001 From: Caio Oliveira Date: Sun, 26 Feb 2023 21:57:49 -0800 Subject: [PATCH] pan/midgard: Handle nir_intrinsic_scoped_barrier in Midgard compiler Behave the same as the existing more specific barrier intrinsics. Reviewed-by: Alyssa Rosenzweig Part-of: --- src/panfrost/midgard/midgard_compile.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/panfrost/midgard/midgard_compile.c b/src/panfrost/midgard/midgard_compile.c index 94a59adabd2..6a1db58333b 100644 --- a/src/panfrost/midgard/midgard_compile.c +++ b/src/panfrost/midgard/midgard_compile.c @@ -2120,6 +2120,22 @@ emit_intrinsic(compiler_context *ctx, nir_intrinsic_instr *instr) schedule_barrier(ctx); break; + case nir_intrinsic_scoped_barrier: + if (nir_intrinsic_execution_scope(instr) != NIR_SCOPE_NONE) { + schedule_barrier(ctx); + emit_control_barrier(ctx); + schedule_barrier(ctx); + } else if (nir_intrinsic_memory_scope(instr) != NIR_SCOPE_NONE) { + /* Midgard doesn't seem to want special handling, though we do need to + * take care when scheduling to avoid incorrect reordering. + * + * Note this is an "else if" since the handling for the execution scope + * case already covers the case when both scopes are present. + */ + schedule_barrier(ctx); + } + break; + ATOMIC_CASE(ctx, instr, add, add); ATOMIC_CASE(ctx, instr, and, and); ATOMIC_CASE(ctx, instr, comp_swap, cmpxchg);