[llvm] [AMDGPU] Fix LDS access via flat pointer argument in amdgpu-sw-lower-lds (PR #209842)

via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 15 21:48:19 PDT 2026


skc7 wrote:

> Honestly this whole asan LDS thing was never correctly implemented and I'm still confused about what it actually does.The "SwLowerLDS" naming is a lie. We should have a straight LDS-to-global-memory pass, which is what the name suggests. Such a pass would also look much closer to all of the code you're adding here.
> 
> Instead it mixes in sanitizer handling and is largely a copy-paste of AMDGPULowerModuleLDSPass

Re: `copy-paste of AMDGPULowerModuleLDSPass`:
The common logic isn't copy-pasted  it's factored into `AMDGPUMemoryUtils` and consumed by both `AMDGPULowerModuleLDS` and this pass, so use-discovery and classification are single-sourced by design. I'm not sure where does this "copy-paste" characterization is coming from.

Re: `straight LDS→global then instrument`: 
That's effectively what the pass does, and the two steps are already separable using the `-amdgpu-asan-instrument-lds` flag (default `true`) gates instrumentation, so `=false` runs lowering-only. Since this pass runs only in the ASAN flow, even the lowering itself allocates via `__asan_malloc_impl/__asan_free_impl` (not plain malloc), so the relocated LDS is ASAN-tracked memory by construction.

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


More information about the llvm-commits mailing list