[llvm] [AMDGPU] Rewrite SADDR memory ops to VADDR reduce xcnt stalls (PR #190654)

Vigneshwar Jayakumar via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 8 13:40:32 PDT 2026


VigneshwarJ wrote:

The previous implementation in PR had an ordering bug with LiveIntervals (LIS): the address VGPR intervals were computed before the new load was inserted, making them appear as dead single-point defs and  caused the compiler to crash when the Machine Verifier was enabled.

Because the RA thought the VGPRs were dead, it completely bypassed emitting v_mov_b64_e32 copies and instead folded the address computation natively into the VALU. , the code was broken. This different allocation pattern accidentally produced great xcnt stall numbers (since there were no VGPR copies to stall on).

So going back to adding Kills.
Quentin's patch had a kill pseudos idea to extend the VGPR live range, but has a bad hit in occupancy due to increased VGPR pressure.

The fix now inserts a KILL after every N conversions (default 16, configurable via -amdgpu-saddr-vaddr-liveness-group). This forces the RA to assign different physical registers within each group, natively preventing the xcnt stalls. After inserting the KILL, the affected intervals are recomputed with removeInterval + createAndComputeVirtRegInterval so the RA respects the extended liveness.

For the example kernel

Group | xcnt | VGPRs | Occupancy
-- | -- | -- | --
no KILL | 41 | 101 | 9
Kill (no window) | 10 | 147 | 6
16 (default) | 12 | 115 | 8


https://github.com/llvm/llvm-project/pull/190654


More information about the llvm-commits mailing list