[clang] 0ad5d40 - [CUDA] Relax restrictions on variadics in host-side compilation.

Artem Belevich via cfe-commits cfe-commits at lists.llvm.org
Thu May 25 11:58:38 PDT 2023


Author: Artem Belevich
Date: 2023-05-25T11:57:54-07:00
New Revision: 0ad5d40fa19f27db0e5f999d0e17b0c18b811019

URL: https://github.com/llvm/llvm-project/commit/0ad5d40fa19f27db0e5f999d0e17b0c18b811019
DIFF: https://github.com/llvm/llvm-project/commit/0ad5d40fa19f27db0e5f999d0e17b0c18b811019.diff

LOG: [CUDA] Relax restrictions on variadics in host-side compilation.

D150718 allows variadics during GPU compilation, but we also need to do it for
the host compilation as well, as it will see the same code.

Differential Revision: https://reviews.llvm.org/D151359

Added: 
    

Modified: 
    clang/lib/Driver/ToolChains/Clang.cpp

Removed: 
    


################################################################################
diff  --git a/clang/lib/Driver/ToolChains/Clang.cpp b/clang/lib/Driver/ToolChains/Clang.cpp
index eb15c17870e33..e1adff4e0751c 100644
--- a/clang/lib/Driver/ToolChains/Clang.cpp
+++ b/clang/lib/Driver/ToolChains/Clang.cpp
@@ -4677,6 +4677,13 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
           CmdArgs.push_back(Args.MakeArgString(
               Twine("-target-sdk-version=") +
               CudaVersionToString(CTC->CudaInstallation.version())));
+        // Unsized function arguments used for variadics were introduced in
+        // CUDA-9.0. We still do not support generating code that actually uses
+        // variadic arguments yet, but we do need to allow parsing them as
+        // recent CUDA headers rely on that.
+        // https://github.com/llvm/llvm-project/issues/58410
+        if (CTC->CudaInstallation.version() >= CudaVersion::CUDA_90)
+          CmdArgs.push_back("-fcuda-allow-variadic-functions");
       }
     }
     CmdArgs.push_back("-aux-triple");


        


More information about the cfe-commits mailing list