Skip to content

[SYCL] Implement loading SYCLBIN into kernel_bundle #18949

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

Open
wants to merge 16 commits into
base: sycl
Choose a base branch
from

Conversation

steffenlarsen
Copy link
Contributor

This commit implements the functionality for loading SYCLBIN files into kernel bundles. This is done by mimicking the structure of regular device binaries, then letting the existing functionality handle compiling and linking.

This implements part of the sycl_ext_oneapi_syclbin extension.

Note that parts of this implementation uses functionality copied from LLVMSupport and LLVMObject. Eventually they should be replaced in favor of using the LLVM libraries directly.

This commit implements the functionality for loading SYCLBIN files into
kernel bundles. This is done by mimicing the structure of regular device
binaries, then letting the existing functionality handle compiling and
linking.

This implements part of the sycl_ext_oneapi_syclbin extension.

Signed-off-by: Larsen, Steffen <[email protected]>
@steffenlarsen steffenlarsen requested a review from a team as a code owner June 12, 2025 09:26
@steffenlarsen steffenlarsen requested review from jopperm, sommerlukas and uditagarwal97 and removed request for uditagarwal97 June 12, 2025 09:26
Signed-off-by: Larsen, Steffen <[email protected]>
Signed-off-by: Larsen, Steffen <[email protected]>
@steffenlarsen steffenlarsen requested a review from a team as a code owner June 12, 2025 13:50
Signed-off-by: Larsen, Steffen <[email protected]>
Signed-off-by: Larsen, Steffen <[email protected]>
Signed-off-by: Larsen, Steffen <[email protected]>
@steffenlarsen steffenlarsen removed the request for review from a team June 12, 2025 14:47
Signed-off-by: Larsen, Steffen <[email protected]>
Signed-off-by: Larsen, Steffen <[email protected]>
Signed-off-by: Larsen, Steffen <[email protected]>
Signed-off-by: Larsen, Steffen <[email protected]>
Copy link
Contributor

@jopperm jopperm left a comment

Choose a reason for hiding this comment

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

Looks super neat, just two nits and a question:

You don't seem to go through ProgramManager::addImage/removeImages for SYCLBINs -- do you still get support for eliminated arguments, and are the PM's datastructures cleaned when a SYCLBIN kernel bundle is destroyed?

@steffenlarsen
Copy link
Contributor Author

You don't seem to go through ProgramManager::addImage/removeImages for SYCLBINs -- do you still get support for eliminated arguments, and are the PM's datastructures cleaned when a SYCLBIN kernel bundle is destroyed?

Good question! I intentionally didn't want to go through addImages/removeImages to avoid the program manager being too aware of the contents of the binaries. I wanted kernel_bundle and device image structures to be the primary owners of the binaries. Looking at the parts that removeImages clean up, I definitely need to investigate whether the eliminated args mask and the device global variables work here. Maybe we can refactor their registration.


#if __has_include(<filesystem>)
#include <filesystem>
#endif
Copy link
Contributor

Choose a reason for hiding this comment

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

Don't these need an #else ? What will happen if the compiler doesn't have filesystem or span? IIRC, we are still trying to support GCC 7.5 whose support of C++17 filesystem feature is not complete. Take a look at what is done in os_util.cpp, where the fallback includes experimental/filesystem.

Also, std::span is C++20, iirc. But we have sycl::span , so maybe use that?

OR if I'm operating on yesterdays information and this is no longer a problem, let me know.

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.

3 participants