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

Artem Belevich via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed May 24 12:16:26 PDT 2023


tra created this revision.
Herald added subscribers: mattd, bixia, yaxunl.
Herald added a project: All.
tra published this revision for review.
tra added a reviewer: jlebar.
Herald added subscribers: cfe-commits, MaskRay.
Herald added a project: clang.

D150718 <https://reviews.llvm.org/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.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D151359

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


Index: clang/lib/Driver/ToolChains/Clang.cpp
===================================================================
--- clang/lib/Driver/ToolChains/Clang.cpp
+++ clang/lib/Driver/ToolChains/Clang.cpp
@@ -4677,6 +4677,13 @@
           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");


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D151359.525288.patch
Type: text/x-patch
Size: 919 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230524/2dbf7669/attachment.bin>


More information about the cfe-commits mailing list