[llvm] [WIP][AMDGPU][ASAN] Add amdgpu-asan-instrument-lds pass to instrument LDS (PR #83287)

Jon Chesterfield via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 4 07:08:24 PST 2024


JonChesterfield wrote:

I think a simpler approach is available.

It looks like ASAN works with a block of "shadow memory" which essentially contains a bitmap for whether a given address corresponds to a currently allocated variable or not. LDS variables are all globals and their addresses are known at runtime. 

If that's a correct guess at what ASAN is doing, that's a const bitmap we can build at compile time and add to the module. No malloc involved.

The lower module lds pass does variable layout already, it can put padding bytes around variables on a per-kernel basis easily enough if the user wants that. It does something similar for alignment already.

Dynamic LDS seems in conflict with ASAN - out of bounds accesses to static LDS that hit within the dynamic LDS region might be uses of dynamic LDS. I don't think anything currently digs the extent of dynamic LDS out of the kernel packet - I think there's an intrinsic to get the start of it and there's definitely cuda style extern empty array syntax for the start - but an intrinsic to get the end of the dynamic lds section seems like a really sensible thing to add anyway,

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


More information about the llvm-commits mailing list