diff options
author | Justin Lebar <jlebar@google.com> | 2016-01-14 21:41:27 +0000 |
---|---|---|
committer | Justin Lebar <jlebar@google.com> | 2016-01-14 21:41:27 +0000 |
commit | 21e5d4fcfa4c8a2a198a968af5b7db1884b801b9 (patch) | |
tree | 678dba0dd9353eac0609f6eaaf55c43dbb6fc3cc /clang/lib/Driver/Tools.h | |
parent | b44f6fed4da5bc1d2983887f6ac933dd90f5c854 (diff) | |
download | bcm5719-llvm-21e5d4fcfa4c8a2a198a968af5b7db1884b801b9.tar.gz bcm5719-llvm-21e5d4fcfa4c8a2a198a968af5b7db1884b801b9.zip |
[CUDA] Invoke ptxas and fatbinary during compilation.
Summary:
Previously we compiled CUDA device code to PTX assembly and embedded
that asm as text in our host binary. Now we compile to PTX assembly and
then invoke ptxas to assemble the PTX into a cubin file. We gather the
ptx and cubin files for each of our --cuda-gpu-archs and combine them
using fatbinary, and then embed that into the host binary.
Adds two new command-line flags, -Xcuda_ptxas and -Xcuda_fatbinary,
which pass args down to the external tools.
Reviewers: tra, echristo
Subscribers: cfe-commits, jhen
Differential Revision: http://reviews.llvm.org/D16082
llvm-svn: 257809
Diffstat (limited to 'clang/lib/Driver/Tools.h')
-rw-r--r-- | clang/lib/Driver/Tools.h | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/clang/lib/Driver/Tools.h b/clang/lib/Driver/Tools.h index 2b137f4a6d0..69c046587f4 100644 --- a/clang/lib/Driver/Tools.h +++ b/clang/lib/Driver/Tools.h @@ -903,6 +903,41 @@ public: }; } // end namespace PS4cpu +namespace NVPTX { + +// Run ptxas, the NVPTX assembler. +class LLVM_LIBRARY_VISIBILITY Assembler : public Tool { + public: + Assembler(const ToolChain &TC) + : Tool("NVPTX::Assembler", "ptxas", TC, RF_Full, llvm::sys::WEM_UTF8, + "--options-file") {} + + bool hasIntegratedCPP() const override { return false; } + + void ConstructJob(Compilation &C, const JobAction &JA, + const InputInfo &Output, const InputInfoList &Inputs, + const llvm::opt::ArgList &TCArgs, + const char *LinkingOutput) const override; +}; + +// Runs fatbinary, which combines GPU object files ("cubin" files) and/or PTX +// assembly into a single output file. +class LLVM_LIBRARY_VISIBILITY Linker : public Tool { + public: + Linker(const ToolChain &TC) + : Tool("NVPTX::Linker", "fatbinary", TC, RF_Full, llvm::sys::WEM_UTF8, + "--options-file") {} + + bool hasIntegratedCPP() const override { return false; } + + void ConstructJob(Compilation &C, const JobAction &JA, + const InputInfo &Output, const InputInfoList &Inputs, + const llvm::opt::ArgList &TCArgs, + const char *LinkingOutput) const override; +}; + +} // end namespace NVPTX + } // end namespace tools } // end namespace driver } // end namespace clang |