[clang] [llvm] [clang][SYCL] Add -fno-sycl-rdc to finalize device code per translation unit (PR #218089)

Yury Plyakhin via cfe-commits cfe-commits at lists.llvm.org
Mon Aug 31 18:56:48 PDT 2026


================
@@ -7735,6 +7735,15 @@ def fsycl_host_only : Flag<["-"], "fsycl-host-only">,
 def sycl_link : Flag<["--"], "sycl-link">, Flags<[HelpHidden]>,
   HelpText<"Perform link through clang-sycl-linker via the target "
   "offloading toolchain.">;
+def : Flag<["-"], "fsycl-rdc">, Alias<fgpu_rdc>;
+def : Flag<["-"], "fno-sycl-rdc">, Alias<fno_gpu_rdc>,
+  HelpText<"Generate non-relocatable device code during SYCL offload target "
+           "compilation. Use of this option in combination with '-c' will "
+           "produce final device binaries within the generated fat object. "
+           "When using this option, each kernel must be self-contained within "
+           "its translation unit (source file); a device function defined in "
+           "another translation unit cannot be called, even if declared "
+           "SYCL_EXTERNAL.">;
----------------
YuriPlyakhin wrote:

Agreed on the direction, but I'd rather not settle it inside this patch — an `-foffload-rdc` spelling with `-fgpu-rdc`/`-fcuda-rdc` demoted to aliases touches CUDA and HIP, so it deserves its own review and its own discussion and I don't want the no-RDC functionality in SYCL to wait on that.

So I've gone the other way here and removed the SYCL-specific `-fsycl-rdc`/`-fno-sycl-rdc` aliases. This patch now uses only the existing `-fgpu-rdc`/`-fno-gpu-rdc`.

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


More information about the cfe-commits mailing list