[compiler-rt] [compiler-rt][asan] Add AMDGPU ASan support via HSA API interceptors. (PR #192240)
via llvm-commits
llvm-commits at lists.llvm.org
Thu Apr 23 08:29:21 PDT 2026
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {darker}-->
:warning: Python code formatter, darker found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
darker --check --diff -r origin/main...HEAD compiler-rt/test/asan/TestCases/AMDGPU/lit.local.cfg.py compiler-rt/test/lit.common.cfg.py
``````````
:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:
</details>
<details>
<summary>
View the diff from darker here.
</summary>
``````````diff
--- asan/TestCases/AMDGPU/lit.local.cfg.py 2026-04-23 15:25:41.000000 +0000
+++ asan/TestCases/AMDGPU/lit.local.cfg.py 2026-04-23 15:28:41.602925 +0000
@@ -4,14 +4,16 @@
# SANITIZER_AMDGPU enabled. The suite uses the dynamic ASan runtime only.
import glob
import os
+
def getRoot(config):
if not config.parent:
return config
return getRoot(config.parent)
+
def walk_config_attr(cfg, name):
"""Return the first defined attribute `name` walking cfg -> parents."""
while cfg is not None:
if hasattr(cfg, name):
@@ -19,27 +21,30 @@
if val is not None:
return val
cfg = cfg.parent
return None
+
def rocm_lib_dir(rocm_root):
"""Return lib or lib64 under rocm_root that provides libhsa-runtime64."""
for libname in ("lib", "lib64"):
libdir = os.path.join(rocm_root, libname)
if not os.path.isdir(libdir):
continue
if glob.glob(os.path.join(libdir, "libhsa-runtime64.so*")):
return libdir
return None
+
def rocm_is_available(rocm_root):
if not rocm_root or not os.path.isdir(rocm_root):
return False
hsa_h = os.path.join(rocm_root, "include", "hsa", "hsa.h")
if not os.path.isfile(hsa_h):
return False
return rocm_lib_dir(rocm_root) is not None
+
root = getRoot(config)
# AMDGPU ASan tests are only run with the dynamic ASan runtime (-shared-libasan).
if "asan-static-runtime" in root.available_features:
config.unsupported = True
``````````
</details>
https://github.com/llvm/llvm-project/pull/192240
More information about the llvm-commits
mailing list