[llvm] AMDGPU/GFX12: Do not wait unnecessarily before barriers (PR #154970)
Nicolai Hähnle via llvm-commits
llvm-commits at lists.llvm.org
Mon Aug 25 06:40:03 PDT 2025
nhaehnle wrote:
Pre-GFX12 hardware has a single barrier object per workgroup, and the trap handler needs to be able to use barriers at least for CWSR. So on pre-GFX12, when a wave is at S_BARRIER and a trap arrives, handling the trap safely requires the HW to reliably back off the barrier in the sense of *undoing* the barrier signal since the signal and wait parts of the barrier are part of the same instruction, and so the instruction has already affected state if it gets interrupted by a trap.
With split barriers, the signal and wait parts are separate *and* there are separate user and trap barrier objects. So, once the use barrier is signaled, that signal never has to be undone. The trap handler uses the trap barrier object to do its thing, and in CWSR the state of the user barrier can simply be saved and then later restored by the trap handler. S_BARRIER_WAIT doesn't need to back off the barrier because it doesn't actually do anything (doesn't change any state) until the barrier is signaled as complete. So, there literally is no back-off.
https://github.com/llvm/llvm-project/pull/154970
More information about the llvm-commits
mailing list