agx: Implement image barriers

Or cache flushes or whatever these actually are. Probably could be optimized
once we understand what the 4 individual instructions are actually doing. Fixes
dEQP-GLES31.functional.image_load_store.2d.qualifiers.*.

Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24258>
This commit is contained in:
Alyssa Rosenzweig
2023-05-29 19:30:16 -04:00
committed by Marge Bot
parent ad456a683c
commit 76641762ce
2 changed files with 24 additions and 2 deletions

View File

@@ -970,6 +970,7 @@ agx_emit_intrinsic(agx_builder *b, nir_intrinsic_instr *instr)
assert(!b->shader->is_preamble && "invalid");
bool needs_threadgroup_barrier = false;
bool needs_image_barriers = false;
if (nir_intrinsic_execution_scope(instr) != SCOPE_NONE) {
assert(nir_intrinsic_execution_scope(instr) > SCOPE_SUBGROUP &&
@@ -987,6 +988,12 @@ agx_emit_intrinsic(agx_builder *b, nir_intrinsic_instr *instr)
if (modes & nir_var_mem_shared)
needs_threadgroup_barrier = true;
if (modes & nir_var_image) {
agx_image_barrier_1(b);
agx_image_barrier_2(b);
needs_image_barriers = true;
}
if (nir_intrinsic_memory_scope(instr) >= SCOPE_WORKGROUP)
needs_threadgroup_barrier = true;
}
@@ -994,6 +1001,11 @@ agx_emit_intrinsic(agx_builder *b, nir_intrinsic_instr *instr)
if (needs_threadgroup_barrier)
agx_threadgroup_barrier(b);
if (needs_image_barriers) {
agx_image_barrier_3(b);
agx_image_barrier_4(b);
}
return NULL;
}