diff options
author | Alex Lorenz <arphaman@gmail.com> | 2017-08-08 11:20:17 +0000 |
---|---|---|
committer | Alex Lorenz <arphaman@gmail.com> | 2017-08-08 11:20:17 +0000 |
commit | 7e9c478cda26a71dc4efbf96183738171eb9b721 (patch) | |
tree | 049f28e4557708aed1e41fa9e838c37baadd30ab /clang/lib/Driver/ToolChains/Cuda.cpp | |
parent | ef44228acba499cba328ad7ce399be21462e584c (diff) | |
download | bcm5719-llvm-7e9c478cda26a71dc4efbf96183738171eb9b721.tar.gz bcm5719-llvm-7e9c478cda26a71dc4efbf96183738171eb9b721.zip |
Revert r310291, r310300 and r310332 because of test failure on Darwin
The commit r310291 introduced the failure. r310332 was a test fix commit and
r310300 was a followup commit. I reverted these two to avoid merge conflicts
when reverting.
The 'openmp-offload.c' test is failing on Darwin because the following
run lines:
// RUN: touch %t1.o
// RUN: touch %t2.o
// RUN: %clang -### -no-canonical-prefixes -fopenmp=libomp -fopenmp-targets=nvptx64-nvidia-cuda -save-temps -no-canonical-prefixes %t1.o %t2.o 2>&1 \
// RUN: | FileCheck -check-prefix=CHK-TWOCUBIN %s
trigger the following assertion:
Driver.cpp:3418:
assert(CachedResults.find(ActionTC) != CachedResults.end() &&
"Result does not exist??");
llvm-svn: 310345
Diffstat (limited to 'clang/lib/Driver/ToolChains/Cuda.cpp')
-rw-r--r-- | clang/lib/Driver/ToolChains/Cuda.cpp | 95 |
1 files changed, 3 insertions, 92 deletions
diff --git a/clang/lib/Driver/ToolChains/Cuda.cpp b/clang/lib/Driver/ToolChains/Cuda.cpp index 927704a6857..ab133bba5b1 100644 --- a/clang/lib/Driver/ToolChains/Cuda.cpp +++ b/clang/lib/Driver/ToolChains/Cuda.cpp @@ -9,9 +9,7 @@ #include "Cuda.h" #include "InputInfo.h" -#include "CommonArgs.h" #include "clang/Basic/Cuda.h" -#include "clang/Config/config.h" #include "clang/Basic/VirtualFileSystem.h" #include "clang/Driver/Compilation.h" #include "clang/Driver/Driver.h" @@ -281,20 +279,13 @@ void NVPTX::Assembler::ConstructJob(Compilation &C, const JobAction &JA, CmdArgs.push_back("--gpu-name"); CmdArgs.push_back(Args.MakeArgString(CudaArchToString(gpu_arch))); CmdArgs.push_back("--output-file"); - SmallString<256> OutputFileName(Output.getFilename()); - if (JA.isOffloading(Action::OFK_OpenMP)) - llvm::sys::path::replace_extension(OutputFileName, "cubin"); - CmdArgs.push_back(Args.MakeArgString(OutputFileName)); + CmdArgs.push_back(Args.MakeArgString(Output.getFilename())); for (const auto& II : Inputs) CmdArgs.push_back(Args.MakeArgString(II.getFilename())); 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(); @@ -347,92 +338,14 @@ void NVPTX::Linker::ConstructJob(Compilation &C, const JobAction &JA, C.addCommand(llvm::make_unique<Command>(JA, *this, Exec, CmdArgs, Inputs)); } -void NVPTX::OpenMPLinker::ConstructJob(Compilation &C, const JobAction &JA, - const InputInfo &Output, - const InputInfoList &Inputs, - const ArgList &Args, - const char *LinkingOutput) const { - const auto &TC = - static_cast<const toolchains::CudaToolChain &>(getToolChain()); - assert(TC.getTriple().isNVPTX() && "Wrong platform"); - - ArgStringList CmdArgs; - - // OpenMP uses nvlink to link cubin files. The result will be embedded in the - // host binary by the host linker. - assert(!JA.isHostOffloading(Action::OFK_OpenMP) && - "CUDA toolchain not expected for an OpenMP host device."); - - if (Output.isFilename()) { - CmdArgs.push_back("-o"); - CmdArgs.push_back(Output.getFilename()); - } else - assert(Output.isNothing() && "Invalid output."); - if (Args.hasArg(options::OPT_g_Flag)) - CmdArgs.push_back("-g"); - - if (Args.hasArg(options::OPT_v)) - CmdArgs.push_back("-v"); - - StringRef GPUArch = - Args.getLastArgValue(options::OPT_march_EQ); - assert(!GPUArch.empty() && "At least one GPU Arch required for ptxas."); - - CmdArgs.push_back("-arch"); - CmdArgs.push_back(Args.MakeArgString(GPUArch)); - - // Add paths specified in LIBRARY_PATH environment variable as -L options. - addDirectoryList(Args, CmdArgs, "-L", "LIBRARY_PATH"); - - // Add paths for the default clang library path. - SmallString<256> DefaultLibPath = - llvm::sys::path::parent_path(TC.getDriver().Dir); - llvm::sys::path::append(DefaultLibPath, "lib" CLANG_LIBDIR_SUFFIX); - CmdArgs.push_back(Args.MakeArgString(Twine("-L") + DefaultLibPath)); - - // Add linking against library implementing OpenMP calls on NVPTX target. - CmdArgs.push_back("-lomptarget-nvptx"); - - for (const auto &II : Inputs) { - if (II.getType() == types::TY_LLVM_IR || - II.getType() == types::TY_LTO_IR || - II.getType() == types::TY_LTO_BC || - II.getType() == types::TY_LLVM_BC) { - C.getDriver().Diag(diag::err_drv_no_linker_llvm_support) - << getToolChain().getTripleString(); - continue; - } - - // Currently, we only pass the input files to the linker, we do not pass - // any libraries that may be valid only for the host. - if (!II.isFilename()) - continue; - - SmallString<256> Name = llvm::sys::path::filename(II.getFilename()); - llvm::sys::path::replace_extension(Name, "cubin"); - - const char *CubinF = - C.addTempFile(C.getArgs().MakeArgString(Name)); - - CmdArgs.push_back(CubinF); - } - - AddOpenMPLinkerScript(getToolChain(), C, Output, Inputs, Args, CmdArgs, JA); - - const char *Exec = - Args.MakeArgString(getToolChain().GetProgramPath("nvlink")); - C.addCommand(llvm::make_unique<Command>(JA, *this, Exec, CmdArgs, Inputs)); -} - /// CUDA toolchain. Our assembler is ptxas, and our "linker" is fatbinary, /// which isn't properly a linker but nonetheless performs the step of stitching /// together object files from the assembler into a single blob. CudaToolChain::CudaToolChain(const Driver &D, const llvm::Triple &Triple, - const ToolChain &HostTC, const ArgList &Args, - const Action::OffloadKind OK) + const ToolChain &HostTC, const ArgList &Args) : ToolChain(D, Triple, Args), HostTC(HostTC), - CudaInstallation(D, HostTC.getTriple(), Args), OK(OK) { + CudaInstallation(D, HostTC.getTriple(), Args) { if (CudaInstallation.isValid()) getProgramPaths().push_back(CudaInstallation.getBinPath()); } @@ -575,8 +488,6 @@ Tool *CudaToolChain::buildAssembler() const { } Tool *CudaToolChain::buildLinker() const { - if (OK == Action::OFK_OpenMP) - return new tools::NVPTX::OpenMPLinker(*this); return new tools::NVPTX::Linker(*this); } |