From 6082e126ebf157adfbc4b4295ff59e6da6a99a8e Mon Sep 17 00:00:00 2001 From: Vitaliy Triang3l Kuzmin Date: Sat, 15 Apr 2023 21:45:12 +0300 Subject: [PATCH] aco: Skip waitcnt insertion in the discard early exit block MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Waits are needed for early exits from inside a Primitive Ordered Pixel Shading ordered section, but that code doesn't insert them reliably anyway because it doesn't obtain the counters for the exact locations of the jumps, which may be anywhere inside the predecessor blocks. Reviewed-by: Timur Kristóf Signed-off-by: Vitaliy Triang3l Kuzmin Part-of: --- src/amd/compiler/aco_insert_waitcnt.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/amd/compiler/aco_insert_waitcnt.cpp b/src/amd/compiler/aco_insert_waitcnt.cpp index 985a8e1d944..64fdd87653d 100644 --- a/src/amd/compiler/aco_insert_waitcnt.cpp +++ b/src/amd/compiler/aco_insert_waitcnt.cpp @@ -1037,6 +1037,15 @@ insert_wait_states(Program* program) for (unsigned i = 0; i < program->blocks.size();) { Block& current = program->blocks[i++]; + + if (current.kind & block_kind_discard_early_exit) { + /* Because the jump to the discard early exit block may happen anywhere in a block, it's + * not possible to join it with its predecessors this way. + * We emit all required waits when emitting the discard block. + */ + continue; + } + wait_ctx ctx = in_ctx[current.index]; if (current.kind & block_kind_loop_header) {