Skip to content

Commit 8a5c288

Browse files
jhuber6Icohedron
authored andcommitted
[AMDGPU] Do not enable GPU sanitizers by default (llvm#126090)
Summary: This probably wasn't the intended result, but the code here causes OpenMP to always link in `ockl.bc` which was intentionally not linked. This results in the OCKL definitions conflicting with the OpenMP ones and also prevents them from being optimized out (Might be fixed with newer ROCm that actually builds the visibility correctly). I'm pretty sure the only reason this didn't break the tests is because we're smart and pass `-nogpulib` there to keep the environment from being poisoned with stuff like this.
1 parent 05d5c3c commit 8a5c288

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

clang/lib/Driver/ToolChains/AMDGPU.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1066,7 +1066,7 @@ ROCMToolChain::getCommonDeviceLibNames(const llvm::opt::ArgList &DriverArgs,
10661066
// them all?
10671067
std::tuple<bool, const SanitizerArgs> GPUSan(
10681068
DriverArgs.hasFlag(options::OPT_fgpu_sanitize,
1069-
options::OPT_fno_gpu_sanitize, true),
1069+
options::OPT_fno_gpu_sanitize, false),
10701070
getSanitizerArgs(DriverArgs));
10711071
bool DAZ = DriverArgs.hasFlag(options::OPT_fgpu_flush_denormals_to_zero,
10721072
options::OPT_fno_gpu_flush_denormals_to_zero,
@@ -1099,7 +1099,7 @@ bool AMDGPUToolChain::shouldSkipSanitizeOption(
10991099
return false;
11001100

11011101
if (!DriverArgs.hasFlag(options::OPT_fgpu_sanitize,
1102-
options::OPT_fno_gpu_sanitize, true))
1102+
options::OPT_fno_gpu_sanitize, false))
11031103
return true;
11041104

11051105
auto &Diags = TC.getDriver().getDiags();

clang/test/Driver/hip-sanitize-options.hip

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// RUN: %clang -### --target=x86_64-unknown-linux-gnu --offload-arch=gfx900:xnack+ \
2-
// RUN: -fsanitize=address \
2+
// RUN: -fsanitize=address -fgpu-sanitize \
33
// RUN: -nogpuinc --rocm-path=%S/Inputs/rocm \
44
// RUN: %s 2>&1 | FileCheck -check-prefixes=NORDC %s
55

0 commit comments

Comments
 (0)