From e111bfdb5c938c7a3dfdc81ca0ab21acc42899b4 Mon Sep 17 00:00:00 2001 From: Faith Ekstrand Date: Wed, 25 Oct 2023 08:59:56 -0500 Subject: [PATCH] nak: Emit MemBar before Bar This is what NVIDIA does. I'm not sure why this order but it seems necessary to pass some of the 1.1 memory model tests. Part-of: --- src/nouveau/compiler/nak_from_nir.rs | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/nouveau/compiler/nak_from_nir.rs b/src/nouveau/compiler/nak_from_nir.rs index 19e4f3f463a..5137288c31f 100644 --- a/src/nouveau/compiler/nak_from_nir.rs +++ b/src/nouveau/compiler/nak_from_nir.rs @@ -1862,6 +1862,15 @@ impl<'a> ShaderFromNir<'a> { addr_offset: 0, }); } + match intrin.execution_scope() { + SCOPE_NONE => (), + SCOPE_WORKGROUP => { + if self.nir.info.stage() == MESA_SHADER_COMPUTE { + b.push_op(OpBar {}).deps.yld = true; + } + } + _ => panic!("Unhandled execution scope"), + } if intrin.memory_scope() != SCOPE_NONE { let mem_scope = match intrin.memory_scope() { SCOPE_INVOCATION | SCOPE_SUBGROUP => MemScope::CTA, @@ -1872,15 +1881,6 @@ impl<'a> ShaderFromNir<'a> { }; b.push_op(OpMemBar { scope: mem_scope }); } - match intrin.execution_scope() { - SCOPE_NONE => (), - SCOPE_WORKGROUP => { - if self.nir.info.stage() == MESA_SHADER_COMPUTE { - b.push_op(OpBar {}).deps.yld = true; - } - } - _ => panic!("Unhandled execution scope"), - } if (modes & nir_var_mem_global) != 0 && (semantics & NIR_MEMORY_ACQUIRE) != 0 {