Skip to content

[SYCL][Driver] Add device symbols to -fsycl-host-only objects - #23681

Draft
mdtoguchi wants to merge 3 commits into
intel:syclfrom
mdtoguchi:sycl-host-only-tgtsym
Draft

mdtoguchi wants to merge 3 commits into
intel:syclfrom
mdtoguchi:sycl-host-only-tgtsym

Conversation

@mdtoguchi

Copy link
Copy Markdown
Contributor

Since #22365, -fsycl-host-only objects (old offload model) carry no device bundle or .tgtsym section. When the host objects and the -fsycl-device-only code ship in separate static archives, the device link no longer sees the kernels used by the host objects, and llvm-link --only-needed drops them without a diagnostic.

For host-only compilations that create an object, compile the device side to IR and bundle it with the new clang-offload-bundler option -target-symbols-only. This adds the .tgtsym section without embedding any device code, so the object stays host-only while the device link can still find the device code it needs. -S, -fsyntax-only, -emit-llvm and -flto keep the syntax-only device compilation.

This fix is for the old offloading model only - a separate fix will be needed to address this issue in the new model.

Since intel#22365, -fsycl-host-only objects (old offload model) carry no device bundle or .tgtsym section. When the host objects and the -fsycl-device-only code ship in separate static archives, the device link no longer sees the kernels used by the host objects, and llvm-link --only-needed drops them without a diagnostic.

For host-only compilations that create an object, compile the device side to IR and bundle it with the new clang-offload-bundler option -target-symbols-only. This adds the .tgtsym section without embedding any device code, so the object stays host-only while the device link can still find the device code it needs. -S, -fsyntax-only, -emit-llvm and -flto keep the syntax-only device compilation.

This fix is for the old offloading model only - a separate fix will be needed to address this issue in the new model.
@bader

bader commented Oct 31, 2026

Copy link
Copy Markdown
Contributor

"-fsycl-device-only code ship"

Doesn't -fsycl-device-only exist only for debugging by compiler developers? I don't think the compiler behavior for this option is well defined.

@mdtoguchi

Copy link
Copy Markdown
Contributor Author

"-fsycl-device-only code ship"

Doesn't -fsycl-device-only exist only for debugging by compiler developers? I don't think the compiler behavior for this option is well defined.

There is nothing restricting the usage of -fsycl-device-only beyond compiler developers. We can attempt to reduce usage of the option and steer those who are using it away and use just regular fat objects.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants