[clang] 53d474a - [Clang][OpenMP][NVPTX] Fixed failure in openmp-offload-gpu.c if the system has CUDA
Shilei Tian via cfe-commits
cfe-commits at lists.llvm.org
Tue Apr 13 10:22:55 PDT 2021
Author: Shilei Tian
Date: 2021-04-13T13:22:49-04:00
New Revision: 53d474abc92c42bed5d0cab5c79ee9ea5666aad1
URL: https://github.com/llvm/llvm-project/commit/53d474abc92c42bed5d0cab5c79ee9ea5666aad1
DIFF: https://github.com/llvm/llvm-project/commit/53d474abc92c42bed5d0cab5c79ee9ea5666aad1.diff
LOG: [Clang][OpenMP][NVPTX] Fixed failure in openmp-offload-gpu.c if the system has CUDA
https://lists.llvm.org/pipermail/openmp-dev/2021-March/003940.html reports
test failure in `openmp-offload-gpu.c`. The failure is, when using `-S` in the
clang driver, it still reports bitcode library doesn't exist. However, it is not
exposed in my local run and Phabiractor test. The reason it escaped from Phabricator
test is, the test machine doesn't have CUDA, so `LibDeviceFile` is empty. In this
case, the check of `OPT_S` will be hit, and we get "expected" result. However, if
the test machine has CUDA, `LibDeviceFile` will not be empty, then the check will
not be done, and it just proceeds, trying to add the bitcode library. The reason
it escaped from my local run is, I didn't build ALL targets, so this case was
marked UNSUPPORTED.
Reviewed By: kkwli0
Differential Revision: https://reviews.llvm.org/D98902
Added:
Modified:
clang/lib/Driver/ToolChains/Cuda.cpp
Removed:
################################################################################
diff --git a/clang/lib/Driver/ToolChains/Cuda.cpp b/clang/lib/Driver/ToolChains/Cuda.cpp
index be81d0f26f684..9e2dd515da4d7 100644
--- a/clang/lib/Driver/ToolChains/Cuda.cpp
+++ b/clang/lib/Driver/ToolChains/Cuda.cpp
@@ -696,13 +696,12 @@ void CudaToolChain::addClangTargetOptions(
if (DriverArgs.hasArg(options::OPT_nogpulib))
return;
- std::string LibDeviceFile = CudaInstallation.getLibDeviceFile(GpuArch);
+ if (DeviceOffloadingKind == Action::OFK_OpenMP &&
+ DriverArgs.hasArg(options::OPT_S))
+ return;
+ std::string LibDeviceFile = CudaInstallation.getLibDeviceFile(GpuArch);
if (LibDeviceFile.empty()) {
- if (DeviceOffloadingKind == Action::OFK_OpenMP &&
- DriverArgs.hasArg(options::OPT_S))
- return;
-
getDriver().Diag(diag::err_drv_no_cuda_libdevice) << GpuArch;
return;
}
More information about the cfe-commits
mailing list