Skip to content

Conversation

@jzc
Copy link
Contributor

@jzc jzc commented Oct 9, 2025

This PR updates the --bitcode-library option in clang-linker-wrapper to link bitcode device libraries that are used in NVIDIA and AMD GPU targets in SYCL offloading. This option had some previous behavior, but it was unused, so I deleted it and repurposed it for SYCL.

SYCL::getDeviceLibraries() returns both fat objects and bitcode device libraries mixed together, while the -sycl-device-libraries option only handles fat objects. This was causing clang-linker-wrapper to not link the libdevice for nvptx/AMD targets.

This PR also removes the -sycl-nvptx-device-libraries option, which seemed to be doing the same thing but only for nvptx targets.

@jzc jzc requested review from a team as code owners October 9, 2025 17:51
@bader
Copy link
Contributor

bader commented Oct 9, 2025

This PR adds the -sycl-bc-device-libraries option to clang-linker-wrapper properly link bitcode device libraries that are used in NVIDIA and AMD GPU targets in SYCL offloading.

SYCL::getDeviceLibraries() returns both fat objects and bitcode device libraries mixed together, while the -sycl-device-libraries option only handles fat objects. This was causing clang-linker-wrapper to not link the libdevice for nvptx/AMD targets.

This PR also removes the -sycl-nvptx-device-libraries option, which seemed to be doing the same thing but only for nvptx targets.

This seems unnecessary. clang-linker-wrapper already supports bitcode-library and builtin-bitcode options which driver can use to pass libdevice.

@jzc
Copy link
Contributor Author

jzc commented Oct 9, 2025

@bader I did try using these options, but I wasn't able to get them to work, although I'm unsure the reason. Let me try again see what went wrong and see if I can use these options

@jzc jzc temporarily deployed to WindowsCILock October 9, 2025 18:26 — with GitHub Actions Inactive
@jzc jzc temporarily deployed to WindowsCILock October 9, 2025 18:26 — with GitHub Actions Inactive
@bader
Copy link
Contributor

bader commented Oct 9, 2025

@bader I did try using these options, but I wasn't able to get them to work, although I'm unsure the reason. Let me try again see what went wrong and see if I can use these options

Please, pay attention to the way the driver builds command line arguments for the clang-linker-wrapper. SYCL specific option accepts a list of library paths separated by coma, whereas existing options accept only one path. To pass multiple libraries the driver must pass multiple arguments: one per library.

Copy link
Contributor

@YuriPlyakhin YuriPlyakhin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll review, after comments from Alexey are addressed.

@jzc jzc requested a review from a team as a code owner October 30, 2025 17:45
@jzc jzc requested a review from maarquitos14 October 30, 2025 17:45
@jzc jzc temporarily deployed to WindowsCILock October 30, 2025 18:22 — with GitHub Actions Inactive
return FileOrErr.takeError();
InputFiles[*FileOrErr].push_back(std::move(*FileOrErr));
}

Copy link
Contributor Author

@jzc jzc Nov 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This functionality is not used nor tested - searching for --bitcode-library, nothing comes up. The --bitcode-library seems to original came from upstream, but then was removed upstream, and never removed downstream. I deleted the old functionality and made --bitcode-library more SYCL specific (see linkDevice. The old functionality of --bitcode-library linked the user objects with the bitcode libraries in one link job. For SYCL, we need to link the bitcode libraries in a separated job with the --only-needed option.

@jzc jzc changed the title [SYCL][clang-linker-wrapper] Add -sycl-bc-device-libraries option for linking bitcode device libraries [SYCL][clang-linker-wrapper] Update --bitcode-libraries option for SYCL Nov 4, 2025
@jzc jzc changed the title [SYCL][clang-linker-wrapper] Update --bitcode-libraries option for SYCL [SYCL][clang-linker-wrapper] Update --bitcode-library option for SYCL Nov 4, 2025
@jzc jzc requested a review from bader November 4, 2025 15:59
@jzc jzc temporarily deployed to WindowsCILock November 4, 2025 16:42 — with GitHub Actions Inactive
@jzc jzc temporarily deployed to WindowsCILock November 4, 2025 16:42 — with GitHub Actions Inactive
@bader bader requested a review from maarquitos14 November 4, 2025 17:28
@bader
Copy link
Contributor

bader commented Nov 4, 2025

Please, fix CI issues.

@jzc jzc temporarily deployed to WindowsCILock November 4, 2025 18:00 — with GitHub Actions Inactive
Copy link
Contributor

@YuriPlyakhin YuriPlyakhin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. There are just a few minor nits.

Copy link
Contributor

@maarquitos14 maarquitos14 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are a couple of nits still unresolved from my review, but otherwise LGTM.

@jzc jzc temporarily deployed to WindowsCILock November 6, 2025 00:18 — with GitHub Actions Inactive
@jzc jzc temporarily deployed to WindowsCILock November 6, 2025 00:54 — with GitHub Actions Inactive
@jzc jzc temporarily deployed to WindowsCILock November 6, 2025 00:54 — with GitHub Actions Inactive
@jzc jzc temporarily deployed to WindowsCILock November 6, 2025 15:50 — with GitHub Actions Inactive
@jzc jzc temporarily deployed to WindowsCILock November 6, 2025 16:38 — with GitHub Actions Inactive
@jzc jzc temporarily deployed to WindowsCILock November 6, 2025 16:38 — with GitHub Actions Inactive
Copy link
Contributor

@srividya-sundaram srividya-sundaram left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Driver changes LGTM.

@jzc
Copy link
Contributor Author

jzc commented Nov 6, 2025

@intel/llvm-gatekeepers Failures are unrelated/flaky, this PR is ready to merge.

@sarnex sarnex merged commit 703d57e into intel:sycl Nov 6, 2025
24 of 27 checks passed
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.

6 participants