summaryrefslogtreecommitdiffstats
path: root/clang/lib
diff options
context:
space:
mode:
authorGheorghe-Teodor Bercea <gheorghe-teod.bercea@ibm.com>2017-08-07 20:31:51 +0000
committerGheorghe-Teodor Bercea <gheorghe-teod.bercea@ibm.com>2017-08-07 20:31:51 +0000
commitceb422236a9278a5c2bce5cdfc239180550f4961 (patch)
treeb6ca8233dc12ea8a3a9bc7bde9c35598a4330c88 /clang/lib
parentbc30b699b73f44e35c47fa4a9f4ba8cbd219d859 (diff)
downloadbcm5719-llvm-ceb422236a9278a5c2bce5cdfc239180550f4961.tar.gz
bcm5719-llvm-ceb422236a9278a5c2bce5cdfc239180550f4961.zip
[OpenMP] Make OpenMP generated code for the NVIDIA device relocatable by default
Summary: When device offloading is enabled and the device is an NVIDIA GPU, OpenMP target regions must be compiled with relocation enabled by passing the "-c" flag to the PTXAS invocation. Reviewers: arpith-jacob, caomhin, carlo.bertolli, ABataev, Hahnfeld, jlebar, hfinkel, tstellar Reviewed By: Hahnfeld Subscribers: Hahnfeld, rengolin, mkuron, cfe-commits Differential Revision: https://reviews.llvm.org/D29642 llvm-svn: 310300
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/Driver/ToolChains/Cuda.cpp4
1 files changed, 4 insertions, 0 deletions
diff --git a/clang/lib/Driver/ToolChains/Cuda.cpp b/clang/lib/Driver/ToolChains/Cuda.cpp
index 70f472fb025..927704a6857 100644
--- a/clang/lib/Driver/ToolChains/Cuda.cpp
+++ b/clang/lib/Driver/ToolChains/Cuda.cpp
@@ -291,6 +291,10 @@ void NVPTX::Assembler::ConstructJob(Compilation &C, const JobAction &JA,
for (const auto& A : Args.getAllArgValues(options::OPT_Xcuda_ptxas))
CmdArgs.push_back(Args.MakeArgString(A));
+ // In OpenMP we need to generate relocatable code.
+ if (JA.isOffloading(Action::OFK_OpenMP))
+ CmdArgs.push_back("-c");
+
const char *Exec;
if (Arg *A = Args.getLastArg(options::OPT_ptxas_path_EQ))
Exec = A->getValue();
OpenPOWER on IntegriCloud