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: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998>
This commit is contained in:
Faith Ekstrand 2023-10-25 08:59:56 -05:00 committed by Marge Bot
parent bc58620e1e
commit e111bfdb5c

View file

@ -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
{