-
Notifications
You must be signed in to change notification settings - Fork 796
[OFFLOAD][L0] Use device ELF as image for L0ProgramTy #20712
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
base: l0_plugin
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR decouples the building and linking of device images from the creation of L0ProgramTy objects. The key improvement is using the GPU ELF binary retrieved from the Level Zero driver as the internal image data, rather than the original input image, which improves compatibility with the main library.
- Introduces L0ProgramBuilderTy class to handle module building and linking
- Modifies L0ProgramTy to store the final ELF binary instead of the original image
- Removes library module detection logic from L0ProgramTy
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| offload/plugins-nextgen/level_zero/src/L0Program.cpp | Refactors module building/linking into L0ProgramBuilderTy; adds getELF() to retrieve native binary |
| offload/plugins-nextgen/level_zero/src/L0DynWrapper.cpp | Adds zeModuleGetNativeBinary wrapper function |
| offload/plugins-nextgen/level_zero/src/L0Device.cpp | Updates loadBinaryImpl to use builder pattern and retrieve ELF before creating L0ProgramTy |
| offload/plugins-nextgen/level_zero/include/L0Program.h | Defines L0ProgramBuilderTy class and updates L0ProgramTy constructor |
| offload/plugins-nextgen/level_zero/include/L0Device.h | Changes addProgram to accept builder and return Expected<L0ProgramTy &> |
sarnex
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
seems ok to me until we decide on getting rid of the ELF requirement
pbalcer
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I checked docs, and level-zero doesn't guarantee what is the specific format of the binary returned by zeModuleGetNativeBinary. By reading it, we are relaying on implementation-defined behavior. While ok for now, we need to either work with the driver team to standardize this, or, preferably, move reading ELF metadata up to libomptarget.
Otherwise lgtm. Thanks for doing this, it does look like a smaller, likely less controversial, change than @lplewa proposal.
Decouple building and linking the device image from creating the L0ProgramTy representing it. Use the GPU ELF image as the internal Image data for L0ProgramTy. This improves compatibility with the main library which expects to be an ELF in several places.