[clang] [HIP] use offload wrapper for non-device-only non-rdc (PR #132869)

Yaxun Liu via cfe-commits cfe-commits at lists.llvm.org
Thu Mar 27 11:01:53 PDT 2025


================
@@ -4945,12 +4959,15 @@ Action *Driver::BuildOffloadingActions(Compilation &C,
       }
     }
 
-    // Compiling HIP in non-RDC mode requires linking each action individually.
+    // Compiling HIP in device-only non-RDC mode requires linking each action
+    // individually.
     for (Action *&A : DeviceActions) {
       if ((A->getType() != types::TY_Object &&
            A->getType() != types::TY_LTO_BC) ||
           Kind != Action::OFK_HIP ||
-          Args.hasFlag(options::OPT_fgpu_rdc, options::OPT_fno_gpu_rdc, false))
+          Args.hasFlag(options::OPT_fgpu_rdc, options::OPT_fno_gpu_rdc,
+                       false) ||
+          !offloadDeviceOnly())
----------------
yxsamliu wrote:

For HIP no-rdc device-only compilation, the existing HIP apps expect the output to be bundled or unbundled code objects so that they can be loaded directly without JIT at run time. We could use linker wrapper to generate them without wrapping them in a host object, but that would be a separate patch.

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


More information about the cfe-commits mailing list