[PATCH] D29658: [OpenMP] Customize CUDA-based tool chain selection
Gheorghe-Teodor Bercea via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Apr 13 11:10:55 PDT 2017
gtbercea updated this revision to Diff 95171.
gtbercea added a comment.
Remove tests which belong into a different patch.
Repository:
rL LLVM
https://reviews.llvm.org/D29658
Files:
lib/Driver/Driver.cpp
Index: lib/Driver/Driver.cpp
===================================================================
--- lib/Driver/Driver.cpp
+++ lib/Driver/Driver.cpp
@@ -553,8 +553,22 @@
if (TT.getArch() == llvm::Triple::UnknownArch)
Diag(clang::diag::err_drv_invalid_omp_target) << Val;
else {
- const ToolChain &TC = getToolChain(C.getInputArgs(), TT);
- C.addOffloadDeviceToolChain(&TC, Action::OFK_OpenMP);
+ const ToolChain *TC = nullptr;
+ // CUDA toolchains have to be selected differently. They pair host
+ // and device in their implementation.
+ if (TT.isNVPTX()) {
+ const ToolChain *HostTC =
+ C.getSingleOffloadToolChain<Action::OFK_Host>();
+ assert(HostTC && "Host toolchain should be always defined.");
+ auto &CudaTC =
+ ToolChains[TT.str() + "/" + HostTC->getTriple().normalize()];
+ if (!CudaTC)
+ CudaTC = llvm::make_unique<toolchains::CudaToolChain>(
+ *this, TT, *HostTC, C.getInputArgs());
+ TC = CudaTC.get();
+ } else
+ TC = &getToolChain(C.getInputArgs(), TT);
+ C.addOffloadDeviceToolChain(TC, Action::OFK_OpenMP);
}
}
} else
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D29658.95171.patch
Type: text/x-patch
Size: 1332 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20170413/584d0cf6/attachment.bin>
More information about the cfe-commits
mailing list