[compiler-rt] [compiler-rt][asan] Add AMDGPU ASan support via HSA API interceptors. (PR #192240)

Amit Kumar Pandey via llvm-commits llvm-commits at lists.llvm.org
Wed May 27 09:06:04 PDT 2026


ampandey-1995 wrote:

> Thanks for the updates. My earlier comments look substantially addressed in the latest revision.

Thanks for the review comments.
 
> My remaining concern is VMEM. The PR intercepts `hsa_amd_vmem_address_reserve_align()` and returns an ASan-adjusted user pointer, but I do not see the same translation carried through the downstream HSA VMEM APIs that consume the reserved VA. That makes me uneasy that we are not preserving the full VMEM contract yet, especially for callers that use the returned VA for later address arithmetic or mapping operations.

GPU only VMEM support for ASan  tracking is limited. The `hsa_amd_vmem_address_reserve_align` can handle both the HOST assisted and GPU(KFD-runtime) assisted VMEM. There is no asan tracking happening for GPU assisted VMEM as that would require interception of other HSA VMEM api's and other complexities (partial handling of mapping/unmapping memory redzones, quarantine memory tracking for reporting double free for these  partial  mapped/unmapped redzones)  etc 

> Outside of VMEM, the rest of the PR looks close to being in good shape. But I do not think the current VMEM interception approach is ready for approval yet, so I am staying non-approving for that reason.

Current PR objective is to only support host assisted VMEM (used by callers like hipMallocManaged) . Commit https://github.com/llvm/llvm-project/pull/192240/commits/c02522484bd1c38ebf45a3ccb034cfc35e7ca723 adds a simple GPU only assisted VMEM tracker internally by `sanitizer_allocator_amdgpu` with appropriate asan redzone allocation bypassing. 


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


More information about the llvm-commits mailing list