microsoft/compiler: Change behavior for emitting inexpressible barriers

If the barrier tries to apply to memory that we can't express, just
don't apply the memory portion of the barrier. Similarly, if it tries
to apply a global memory barrier at invocation level, upgrade it to
thread-group.

Reviewed-by: Enrico Galli <enrico.galli@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11670>
This commit is contained in:
Jesse Natalie 2021-04-11 14:32:09 -07:00 committed by Marge Bot
parent 938ce8cdaf
commit 02efc5a099

View file

@ -2186,14 +2186,12 @@ emit_barrier(struct ntd_context *ctx, nir_intrinsic_instr *intr)
nir_variable_mode modes = nir_intrinsic_memory_modes(intr);
nir_scope mem_scope = nir_intrinsic_memory_scope(intr);
if (modes & ~(nir_var_mem_ssbo | nir_var_mem_global | nir_var_mem_shared))
return false;
if (mem_scope != NIR_SCOPE_DEVICE && mem_scope != NIR_SCOPE_WORKGROUP)
return false;
/* Currently vtn uses uniform to indicate image memory, which DXIL considers global */
if (modes & nir_var_uniform)
modes |= nir_var_mem_global;
if (modes & (nir_var_mem_ssbo | nir_var_mem_global)) {
if (mem_scope == NIR_SCOPE_DEVICE)
if (mem_scope > NIR_SCOPE_WORKGROUP)
flags |= DXIL_BARRIER_MODE_UAV_FENCE_GLOBAL;
else
flags |= DXIL_BARRIER_MODE_UAV_FENCE_THREAD_GROUP;