diff options
author | root <raul@tambre.ee> | 2021-07-27 23:38:36 +0300 |
---|---|---|
committer | root <raul@tambre.ee> | 2021-07-29 13:19:37 +0300 |
commit | 3975678fcc3928f2a7dcd79fe9b9e9ebf3abe2b2 (patch) | |
tree | d05cd8b351a616278cc788cb06af35186f819693 /Source/cmMakefileTargetGenerator.cxx | |
parent | 0b1cea66cd1f80458f0da579d0182d908874939d (diff) | |
download | cmake-3975678fcc3928f2a7dcd79fe9b9e9ebf3abe2b2.tar.gz |
CUDA/Clang: Simplify --register-link-binaries logic
Move the logic for appending cubin afterwards, so the check can simply be
empty().
With the Makefile generator the option is now at the front instead of being
intermixed with the actual bins.
Diffstat (limited to 'Source/cmMakefileTargetGenerator.cxx')
-rw-r--r-- | Source/cmMakefileTargetGenerator.cxx | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/Source/cmMakefileTargetGenerator.cxx b/Source/cmMakefileTargetGenerator.cxx index 6324b2ef83..98c61fe8be 100644 --- a/Source/cmMakefileTargetGenerator.cxx +++ b/Source/cmMakefileTargetGenerator.cxx @@ -1519,22 +1519,13 @@ void cmMakefileTargetGenerator::WriteDeviceLinkRule( // Link device code for each architecture. for (const std::string& architectureKind : architectures) { - // Clang always generates real code, so strip the specifier. - const std::string architecture = - architectureKind.substr(0, architectureKind.find('-')); - const std::string cubin = - cmStrCat(objectDir, "sm_", architecture, ".cubin"); - - profiles += cmStrCat(" -im=profile=sm_", architecture, ",file=", cubin); - fatbinaryDepends.emplace_back(cubin); - std::string registerFileCmd; // The generated register file contains macros that when expanded // register the device routines. Because the routines are the same for // all architectures the register file will be the same too. Thus // generate it only on the first invocation to reduce overhead. - if (fatbinaryDepends.size() == 1) { + if (fatbinaryDepends.empty()) { std::string const registerFileRel = cmStrCat(relPath, relObjectDir, "cmake_cuda_register.h"); registerFileCmd = @@ -1542,6 +1533,15 @@ void cmMakefileTargetGenerator::WriteDeviceLinkRule( cleanFiles.push_back(registerFileRel); } + // Clang always generates real code, so strip the specifier. + const std::string architecture = + architectureKind.substr(0, architectureKind.find('-')); + const std::string cubin = + cmStrCat(objectDir, "sm_", architecture, ".cubin"); + + profiles += cmStrCat(" -im=profile=sm_", architecture, ",file=", cubin); + fatbinaryDepends.emplace_back(cubin); + std::string command = cmStrCat( this->Makefile->GetRequiredDefinition("CMAKE_CUDA_DEVICE_LINKER"), " -arch=sm_", architecture, registerFileCmd, " -o=$@ ", |