Skip to content

[ASan][AMDGPU] Retry HSA resolution after late HIP load - #3827

Draft
sa-faizal wants to merge 1 commit into
ROCm:amd-stagingfrom
sa-faizal:fix/asan-amdgpu-late-hsa-init
Draft

[ASan][AMDGPU] Retry HSA resolution after late HIP load#3827
sa-faizal wants to merge 1 commit into
ROCm:amd-stagingfrom
sa-faizal:fix/asan-amdgpu-late-hsa-init

Conversation

@sa-faizal

@sa-faizal sa-faizal commented Aug 9, 2026

Copy link
Copy Markdown

ASan can initialize before applications that dlopen() HIP have loaded ROCr. The initial RTLD_NEXT lookups then leave the AMDGPU HSA callback table incomplete.

After the real hsa_init() succeeds, retry the idempotent HSA symbol lookup before registering the shutdown callback. If resolution still fails, reset the registration guard and return instead of calling through a null function pointer.

Add a regression that starts ASan first, dlopens libamdhip64.so.7, and calls hipInit.

Validation:

  • clang_rt.asan-dynamic-x86_64 rebuilt successfully.
  • The regression reproduces the null-PC abort with the old runtime.
  • The rebuilt runtime prints hipInit succeeded.
  • The matching ctypes/GPU probe returns hipInit_status 0.
  • clang-format --dry-run --Werror and git diff --check pass.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant