From b70ecfa58872abfa17b56d0b2486ed3df982fb7f Mon Sep 17 00:00:00 2001 From: Rhys Perry Date: Fri, 2 May 2025 16:01:05 +0100 Subject: [PATCH] aco: only join barrier_imm/barrier_events for logical edges fossil-db (gfx1201): Totals from 3 (0.00% of 79653) affected shaders: Instrs: 2904 -> 2893 (-0.38%) CodeSize: 14944 -> 14900 (-0.29%) Latency: 14703 -> 14248 (-3.09%) InvThroughput: 1237 -> 1210 (-2.18%) fossil-db (navi31): Totals from 3 (0.00% of 79653) affected shaders: Instrs: 2742 -> 2731 (-0.40%) CodeSize: 14136 -> 14092 (-0.31%) Latency: 14744 -> 14287 (-3.10%) InvThroughput: 1241 -> 1213 (-2.26%) fossil-db (navi21): Totals from 3 (0.00% of 79653) affected shaders: Instrs: 2326 -> 2315 (-0.47%) CodeSize: 12472 -> 12428 (-0.35%) Latency: 14921 -> 14465 (-3.06%) Signed-off-by: Rhys Perry Reviewed-by: Georg Lehmann Part-of: --- src/amd/compiler/aco_insert_waitcnt.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/amd/compiler/aco_insert_waitcnt.cpp b/src/amd/compiler/aco_insert_waitcnt.cpp index 2ebc80fb20f..025e8f14290 100644 --- a/src/amd/compiler/aco_insert_waitcnt.cpp +++ b/src/amd/compiler/aco_insert_waitcnt.cpp @@ -208,10 +208,12 @@ struct wait_ctx { } } - for (unsigned i = 0; i < storage_count; i++) { - changed |= barrier_imm[i].combine(other->barrier_imm[i]); - changed |= (other->barrier_events[i] & ~barrier_events[i]) != 0; - barrier_events[i] |= other->barrier_events[i]; + if (logical) { + for (unsigned i = 0; i < storage_count; i++) { + changed |= barrier_imm[i].combine(other->barrier_imm[i]); + changed |= (other->barrier_events[i] & ~barrier_events[i]) != 0; + barrier_events[i] |= other->barrier_events[i]; + } } return changed;