llvm-project
84382023 - [AMDGPU] Don't treat tensor.load.to.lds as a clobber of global loads (#247451)

Commit
1 day ago
[AMDGPU] Don't treat tensor.load.to.lds as a clobber of global loads (#247451) llvm/llvm-project#229728 removed the memory-effect restriction from the tensor load/store intrinsics, so every `llvm.amdgcn.tensor.load.to.lds` is now a possible write to any memory, and `isReallyAClobber` has no exception for it. Uniform global loads after a TDM load lose `amdgpu.noclobber` and select `global_load_b32` instead of `s_load_b32`. **Fix**: a tensor load reads global memory and writes only LDS, so isReallyAClobber now returns false for tensor.load.to.lds when the queried load is from a global address space (AMDGPU::isExtendedGlobalAddrSpace). Likewise, `tensor.store.from.lds` reads LDS and writes only global memory, so it no longer clobbers LDS loads. Flat loads, which may alias either, are still treated as clobbered. **Motivation:** paged attention. Before each TDM copy of a K/V tile, the kernel reads a read-only page table in global memory to find the physical page, and uses it as the TDM row coordinate. TDM coordinates are SGPR operands. In the pipelined loop this read is on the critical path and is issued right after a TDM copy, so the TDM call is the first possible writer the noclobber check meets. Without `noclobber`, each tile pays `global_load_b32`, `s_wait_loadcnt` (which also waits for older vector loads) and `v_readfirstlane` instead of one `s_load_b32`, delaying the next tile's prefetch. On MI450 (same-session A/B over 112 paged prefill shapes, outputs unchanged), the AITER Gluon prefill loop drops from 477 to 445 instructions. Gluon prefill gets 0.8% faster and TLX prefill 1.0% faster.
Author
Parents
Loading