llvm icon indicating copy to clipboard operation
llvm copied to clipboard

[SYCL] Implement loading SYCLBIN into kernel_bundle

Open steffenlarsen opened this issue 5 months ago • 1 comments

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.

steffenlarsen avatar Jun 12 '25 09:06 steffenlarsen

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.

steffenlarsen avatar Jun 13 '25 10:06 steffenlarsen