mirror of
https://github.com/ROCm/ROCm.git
synced 2026-04-05 03:01:17 -04:00
Add TRITON_BUILD_WITH_ASAN envvar. (#2537)
Note that asan doesn't work with programs that use the GPU, so this is only useful for running tools like triton-opt. I was not able to get msan working. libstdc++'s std::string implementation seems to use uninitialized memory in a way that seems safe but triggers an msan error. I tried and gave up on switching to libc++ and teaching msan to ignore this error.
This commit is contained in:
@@ -272,6 +272,20 @@ class CMakeBuild(build_ext):
|
||||
"-DCMAKE_MODULE_LINKER_FLAGS=-fuse-ld=lld",
|
||||
"-DCMAKE_SHARED_LINKER_FLAGS=-fuse-ld=lld"]
|
||||
|
||||
# Note that asan doesn't work with binaries that use the GPU, so this is
|
||||
# only useful for tools like triton-opt that don't run code on the GPU.
|
||||
#
|
||||
# I tried and gave up getting msan to work. It seems that libstdc++'s
|
||||
# std::string does not play nicely with clang's msan (I didn't try
|
||||
# gcc's). I was unable to configure clang to ignore the error, and I
|
||||
# also wasn't able to get libc++ to work, but that doesn't mean it's
|
||||
# impossible. :)
|
||||
if check_env_flag("TRITON_BUILD_WITH_ASAN"):
|
||||
cmake_args += [
|
||||
"-DCMAKE_C_FLAGS=-fsanitize=address",
|
||||
"-DCMAKE_CXX_FLAGS=-fsanitize=address",
|
||||
]
|
||||
|
||||
if check_env_flag("TRITON_BUILD_WITH_CCACHE"):
|
||||
cmake_args += [
|
||||
"-DCMAKE_CXX_COMPILER_LAUNCHER=ccache",
|
||||
|
||||
Reference in New Issue
Block a user