Skip to content

[SYCL][Driver][libdevice] Link libspirv in -fsycl-device-only mode #19136

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 1 commit into
base: review/Maetveis/libspirv-unused-argument
Choose a base branch
from

Conversation

Maetveis
Copy link
Contributor

@Maetveis Maetveis commented Jun 25, 2025

Based on PR #19135

Chain of upstream PRs as of 2025-06-25

Previously, the -fsycl-device-only mode disabled linking libspirv.

-fsycl-device-only should produce the same LLVM-IR as -fsycl would,
but without any host actions.

Libdevice is the likely reason why this was done as is, but it should
not be the default. This patch changes libdevice options to disable
libspirv linking there, and enables linking by default in
-fsycl-device-only mode.

@Maetveis Maetveis self-assigned this Jun 25, 2025
@Maetveis Maetveis force-pushed the review/Maetveis/libspirv-unused-argument branch from eb713e6 to 8badf3c Compare June 25, 2025 09:02
@Maetveis Maetveis force-pushed the review/Maetveis/link_libsycl_device_only branch 2 times, most recently from bca7c8e to 2e71452 Compare June 25, 2025 09:33
@Maetveis Maetveis force-pushed the review/Maetveis/libspirv-unused-argument branch from 8badf3c to db2c9d8 Compare June 26, 2025 15:59
@Maetveis Maetveis force-pushed the review/Maetveis/link_libsycl_device_only branch from 2e71452 to 3dc3b8d Compare June 26, 2025 15:59
@Maetveis Maetveis force-pushed the review/Maetveis/libspirv-unused-argument branch from db2c9d8 to eac8168 Compare June 27, 2025 07:23
steffenlarsen pushed a commit that referenced this pull request Jun 27, 2025
)

<!-- start git-machete generated -->

# Based on PR #18956

## Tree of downstream PRs as of 2025-06-25

* **PR #19130 (THIS ONE)**

    * PR #19131

      * PR #19134

        * PR #19135

          * PR #19136

<!-- end git-machete generated -->

In the next commits I'd like to refactor and fix SYCL libspirv linking.
This adds a few tests to cover the current behavior. Some of it is
buggy, and not consistent between NVPTX and AMDGPU, it will be improved
in the next commits.
@Maetveis Maetveis force-pushed the review/Maetveis/libspirv-unused-argument branch 2 times, most recently from 11e238c to d5440ef Compare June 27, 2025 07:37
@Maetveis Maetveis force-pushed the review/Maetveis/link_libsycl_device_only branch from 3dc3b8d to bfe4aa4 Compare June 27, 2025 07:37
@Maetveis Maetveis force-pushed the review/Maetveis/libspirv-unused-argument branch from d5440ef to e5c3890 Compare June 27, 2025 08:33
@Maetveis Maetveis force-pushed the review/Maetveis/link_libsycl_device_only branch from bfe4aa4 to 955affd Compare June 27, 2025 08:33
bader pushed a commit that referenced this pull request Jun 27, 2025
<!-- start git-machete generated -->

# Based on PR #19130

## Chain of upstream PRs & tree of downstream PRs as of 2025-06-25

* PR #19130

  * **PR #19131 (THIS ONE)**

      * PR #19134

        * PR #19135

          * PR #19136

<!-- end git-machete generated -->

Move the logic for finding and linking libspirv into
SYCLInstallationDetector.
This code was basically duplicated between the CUDA and HIP toolchains,
and was also present in the Driver sources.
This is NFC, aside from the fact that the code in the HIP toolchain
lacked the special handling for the `-###` driver option present in the
other two places.
Previously, the `-fsycl-device-only` mode disabled linking libspirv.

`-fsycl-device-only` should produce the same LLVM-IR as `-fsycl` would,
but without any host actions.

Libdevice is the likely reason why this was done as is, but it should
not be the default. This patch changes libdevice options to disable
libspirv linking there, and enables linking by default in
`-fsycl-device-only` mode.
@Maetveis Maetveis force-pushed the review/Maetveis/libspirv-unused-argument branch from e5c3890 to 0bb5db5 Compare June 28, 2025 06:47
@Maetveis Maetveis force-pushed the review/Maetveis/link_libsycl_device_only branch from 955affd to e405eb0 Compare June 28, 2025 06:47
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.

1 participant