[clang] [CUDA] Add device-side kernel launch support (PR #165519)

via cfe-commits cfe-commits at lists.llvm.org
Mon Nov 10 21:06:26 PST 2025


================
@@ -497,6 +497,11 @@ Expected<SmallVector<StringRef>> getInput(const ArgList &Args) {
       continue;
     }
 
+    // Skip '-lcudadevrt'.
+    if (Arg->getOption().matches(OPT_library) &&
+        StringRef(Arg->getValue()) == "cudadevrt")
----------------
darkbuck wrote:

`cudadevrt` is different from `libdevice`. The latter is a NVVM/LLVM bitcode library, but the former is a CUDA fatbin (`/usr/local/cuda/targets/x86_64-linux/lib/libcudadevrt.a` for the default installation), which has only stubs of those 2 device functions (in PTX and SASS) for device-side kernel launch. We need to pass `-lcudadevrt` to `nvlink`. AFAIK, there's no option to forward that optino as well as `-L <path>` from `clang-nvlink-wrapper` to `nvlink`. Do we need additional option to enable that forwarding from `clang-nvlink-wrapper` to `nvlink`.
I agreed that `-Xoffload-linker` makes the change to `clang-linker-wrapper` unnecessary.

https://github.com/llvm/llvm-project/pull/165519


More information about the cfe-commits mailing list