offload: automate manual clang-linker-wrapper step - #162309
Draft
sgasho wants to merge 1 commit into
Draft
Conversation
sgasho
commented
Sep 4, 2026
| pub(crate) struct OffloadEmbedFailed; | ||
|
|
||
| #[derive(Diagnostic)] | ||
| #[diag("call to WrapImages failed, `wrapper.o` was not created")] |
Contributor
Author
There was a problem hiding this comment.
TODO(before merge): I forgot to fix the diag comment. wrapper.o no longer exists.
ZuseZ4
reviewed
Sep 4, 2026
| ); | ||
|
|
||
| if sess.opts.unstable_opts.offload.iter().any(|o| matches!(o, config::Offload::Host(_))) { | ||
| cmd.link_dylib_by_name("omptarget", false, true); |
Member
There was a problem hiding this comment.
Thanks to your last PR, we should ship these in our sysroot. Is it guaranteed to be on our default search path? If not, we might want to add an rpath or -L, or?
Contributor
Author
There was a problem hiding this comment.
Yes, looking at walk_native_lib_search_dirs, it is on our default linker search path, so we don't need an additional -L, but we need an rpath for runtime. I also checked this on a UofT server.
Contributor
Author
|
I'm looking into this issue I encountered while testing on a gpu server shotasugano@gpunode1:/w/333/shotasugano/sample-offload$ ./target/x86_64-unknown-linux-gnu/release/sample-offload
PluginInterface error: Failure to load binary image 0x62597fffacf0 on device 0: "jit compile failure while processing binary image" failure to jit IR image: Unable to find target for this triple (no targets are registered)
omptarget error: Failed to load image "a provided binary image is malformed" failed to load binary 0x62597fffacf0
omptarget fatal error 0: "the plugin backend is in an invalid or unsupported state" failed to load images on device '0'
Aborted ./target/x86_64-unknown-linux-gnu/release/sample-offloadupdate: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
automate manual clang-linker-wrapper step from https://rustc-dev-guide.rust-lang.org/offload/usage.html
extract bitcode from device.bin and then wraps it into the host module.
needs some refactoring.
r? @ZuseZ4