From ad456a683c76a63f764be86d8fd8a0e81d2c92c6 Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Mon, 29 May 2023 22:51:29 -0400 Subject: [PATCH] agx: Wait for outstanding stores before barriers Signed-off-by: Alyssa Rosenzweig Part-of: --- src/asahi/compiler/agx_insert_waits.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/asahi/compiler/agx_insert_waits.c b/src/asahi/compiler/agx_insert_waits.c index 3ac4ea78f95..355455e0224 100644 --- a/src/asahi/compiler/agx_insert_waits.c +++ b/src/asahi/compiler/agx_insert_waits.c @@ -84,6 +84,16 @@ agx_insert_waits_local(agx_context *ctx, agx_block *block) } } + /* Check for barriers */ + if (I->op == AGX_OPCODE_THREADGROUP_BARRIER || + I->op == AGX_OPCODE_MEMORY_BARRIER) { + + for (unsigned slot = 0; slot < ARRAY_SIZE(slots); ++slot) { + if (slots[slot].nr_pending) + wait_mask |= BITSET_BIT(slot); + } + } + /* Try to assign a free slot */ if (instr_is_async(I)) { for (unsigned slot = 0; slot < ARRAY_SIZE(slots); ++slot) {