[PATCH] D120272: [CUDA] Add driver support for compiling CUDA with the new driver

Joseph Huber via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Apr 22 11:13:38 PDT 2022


jhuber6 added inline comments.


================
Comment at: clang/lib/Driver/ToolChains/Clang.cpp:6225
   if (IsCuda || IsHIP) {
-    if (Args.hasFlag(options::OPT_fgpu_rdc, options::OPT_fno_gpu_rdc, false))
+    if (Args.hasArg(options::OPT_fno_gpu_rdc) && IsCudaDevice &&
+        Args.hasArg(options::OPT_foffload_new_driver))
----------------
tra wrote:
> This has to be `Args.hasArg(options::OPT_fno_gpu_rdc) && Args.hasFlag(options::OPT_fgpu_rdc, options::OPT_fno_gpu_rdc, false) == false`
> 
> E.g. we don't want a warning if we have `-foffload-new-driver -fno-gpu-rdc -fgpu-rdc`.
K, will do


================
Comment at: clang/lib/Driver/ToolChains/Clang.cpp:6228
+        D.Diag(diag::warn_drv_no_rdc_new_driver) 
+            << "SampleUse with PGO options";
+    if (Args.hasFlag(options::OPT_fgpu_rdc, options::OPT_fno_gpu_rdc, false) ||
----------------
tra wrote:
> The warning does not take any parameters and this one looks wrong anyways.
Whoops, deleted that previously but had a little SNAFU with my commits and forgot to do it again.


================
Comment at: clang/lib/Driver/ToolChains/Clang.cpp:6896
+      if (Args.hasFlag(options::OPT_fgpu_rdc, options::OPT_fno_gpu_rdc,
+                       false))
         CmdArgs.push_back("-fgpu-rdc");
----------------
tra wrote:
> I'm not sure why we're no longer checking for `OPT_foffload_new_driver` here. Don't we want to have the same RDC mode on the host and device sides?
> I think we do as that affects the way we mangle some symbols and it has to be consistent on both sides.
> 
> 
This is only checked with `CudaDeviceInput` which we don't use with the new driver.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D120272/new/

https://reviews.llvm.org/D120272



More information about the cfe-commits mailing list