[PATCH] D43197: [OpenMP] Add flag for linking runtime bitcode library
Gheorghe-Teodor Bercea via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Mon Feb 12 09:26:53 PST 2018
gtbercea updated this revision to Diff 133882.
gtbercea added a comment.
Fix warning message.
Repository:
rC Clang
https://reviews.llvm.org/D43197
Files:
include/clang/Basic/DiagnosticDriverKinds.td
lib/Driver/ToolChains/Cuda.cpp
Index: lib/Driver/ToolChains/Cuda.cpp
===================================================================
--- lib/Driver/ToolChains/Cuda.cpp
+++ lib/Driver/ToolChains/Cuda.cpp
@@ -529,6 +529,36 @@
CC1Args.push_back("-target-feature");
CC1Args.push_back("+ptx42");
}
+
+ if (DeviceOffloadingKind == Action::OFK_OpenMP) {
+ SmallVector<std::string, 8> LibraryPaths;
+ if (char *env = ::getenv("LIBRARY_PATH")) {
+ StringRef CompilerPath = env;
+ while (!CompilerPath.empty()) {
+ std::pair<StringRef, StringRef> Split =
+ CompilerPath.split(llvm::sys::EnvPathSeparator);
+ LibraryPaths.push_back(Split.first);
+ CompilerPath = Split.second;
+ }
+ }
+
+ std::string LibOmpTargetName =
+ "libomptarget-nvptx-" + GpuArch.str() + ".bc";
+ bool FoundBCLibrary = false;
+ for (std::string LibraryPath : LibraryPaths) {
+ SmallString<128> LibOmpTargetFile(LibraryPath);
+ llvm::sys::path::append(LibOmpTargetFile, LibOmpTargetName);
+ if (llvm::sys::fs::exists(LibOmpTargetFile)) {
+ CC1Args.push_back("-mlink-cuda-bitcode");
+ CC1Args.push_back(DriverArgs.MakeArgString(LibOmpTargetFile));
+ FoundBCLibrary = true;
+ break;
+ }
+ }
+ if (!FoundBCLibrary)
+ getDriver().Diag(diag::remark_drv_omp_offload_target_missingbcruntime)
+ << LibOmpTargetName;
+ }
}
void CudaToolChain::AddCudaIncludeArgs(const ArgList &DriverArgs,
Index: include/clang/Basic/DiagnosticDriverKinds.td
===================================================================
--- include/clang/Basic/DiagnosticDriverKinds.td
+++ include/clang/Basic/DiagnosticDriverKinds.td
@@ -196,6 +196,9 @@
def warn_drv_omp_offload_target_duplicate : Warning<
"The OpenMP offloading target '%0' is similar to target '%1' already specified - will be ignored.">,
InGroup<OpenMPTarget>;
+def remark_drv_omp_offload_target_missingbcruntime : Warning<
+ "Expect degraded performance on the target device due to missing '%0' in LIBRARY_PATH.">,
+ InGroup<OpenMPTarget>;
def err_drv_bitcode_unsupported_on_toolchain : Error<
"-fembed-bitcode is not supported on versions of iOS prior to 6.0">;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D43197.133882.patch
Type: text/x-patch
Size: 2206 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20180212/95a0b2fe/attachment-0001.bin>
More information about the cfe-commits
mailing list