@@ -7748,9 +7748,17 @@ Action *Driver::BuildOffloadingActions(Compilation &C,
77487748 return HostAction;
77497749 }
77507750
7751+ // For SYCL offloading with -fsycl-host-compiler enabled, we do not have the
7752+ // ability to embed the packaged file.
7753+ bool SYCLBundleFile = C.isOffloadingHostKind (Action::OFK_SYCL) &&
7754+ Args.hasArg (options::OPT_fsycl_host_compiler_EQ) &&
7755+ isa<AssembleJobAction>(HostAction);
7756+
77517757 // Don't build offloading actions if we do not have a compile action. If
7752- // preprocessing only ignore embedding.
7753- if (!(isa<CompileJobAction>(HostAction) ||
7758+ // preprocessing only ignore embedding. When needing to do bundling for
7759+ // SYCL, allow the building of offloading actions to add the device side to
7760+ // the bundle.
7761+ if (!(isa<CompileJobAction>(HostAction) || SYCLBundleFile ||
77547762 getFinalPhase (Args) == phases::Preprocess))
77557763 return HostAction;
77567764
@@ -7888,6 +7896,17 @@ Action *Driver::BuildOffloadingActions(Compilation &C,
78887896 tools::SYCL::populateSYCLDeviceTraitsMacrosArgs (C, Args, TCAndArchs);
78897897 }
78907898
7899+ // Now that we have all of the offload actions populated, we special case
7900+ // SYCL -fsycl-host-compiler to perform a bundling action instead of a
7901+ // packaging action.
7902+ if (SYCLBundleFile) {
7903+ ActionList BundlingActions (OffloadActions);
7904+ BundlingActions.push_back (HostAction);
7905+ Action *BundlingAction =
7906+ C.MakeAction <OffloadBundlingJobAction>(BundlingActions);
7907+ return BundlingAction;
7908+ }
7909+
78917910 // HIP code in device-only non-RDC mode will bundle the output if it invoked
78927911 // the linker.
78937912 bool ShouldBundleHIP =
@@ -7933,6 +7952,11 @@ Action *Driver::BuildOffloadingActions(Compilation &C,
79337952 DDep.add (*LinkAction, *C.getSingleOffloadToolChain <Action::OFK_Host>(),
79347953 nullptr , C.getActiveOffloadKinds ());
79357954 return C.MakeAction <OffloadAction>(DDep, types::TY_Nothing);
7955+ } else if (C.isOffloadingHostKind (Action::OFK_SYCL) &&
7956+ Args.hasArg (options::OPT_fsycl_host_compiler_EQ)) {
7957+ // -fsycl-host-compiler will create a bundled object instead of an
7958+ // embedded packaged object. Effectively avoid doing the packaging.
7959+ return HostAction;
79367960 } else {
79377961 // Package all the offloading actions into a single output that can be
79387962 // embedded in the host and linked.
0 commit comments