Repository navigation
Conversation
This comment has been minimized.
This comment has been minimized.
020f669 to
555131e
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
72feb1c to
b6f4295
Compare
This comment has been minimized.
This comment has been minimized.
020f669 to
0228337
Compare
|
r? @oli-obk |
0228337 to
e0fd81c
Compare
This comment has been minimized.
This comment has been minimized.
e0fd81c to
1a22802
Compare
This comment has been minimized.
This comment has been minimized.
…-obk offload: move (un)register lib into global_ctors Right now we initialize the openmp/offload runtime before every single offload call, and tear it down directly afterwards. What we should rather do is initialize it once in the binary startup code, and tear it down at the end of the binary execution. Here I implement these changes. Together, our generated IR has a lot less usage of globals, which in turn simplifies the refactoring in rust-lang#150683, where I introduce a new variant of our offload intrinsic. r? oli-obk
…-obk offload: move (un)register lib into global_ctors Right now we initialize the openmp/offload runtime before every single offload call, and tear it down directly afterwards. What we should rather do is initialize it once in the binary startup code, and tear it down at the end of the binary execution. Here I implement these changes. Together, our generated IR has a lot less usage of globals, which in turn simplifies the refactoring in rust-lang#150683, where I introduce a new variant of our offload intrinsic. r? oli-obk
…-obk offload: move (un)register lib into global_ctors Right now we initialize the openmp/offload runtime before every single offload call, and tear it down directly afterwards. What we should rather do is initialize it once in the binary startup code, and tear it down at the end of the binary execution. Here I implement these changes. Together, our generated IR has a lot less usage of globals, which in turn simplifies the refactoring in rust-lang#150683, where I introduce a new variant of our offload intrinsic. r? oli-obk
…-obk offload: move (un)register lib into global_ctors Right now we initialize the openmp/offload runtime before every single offload call, and tear it down directly afterwards. What we should rather do is initialize it once in the binary startup code, and tear it down at the end of the binary execution. Here I implement these changes. Together, our generated IR has a lot less usage of globals, which in turn simplifies the refactoring in rust-lang#150683, where I introduce a new variant of our offload intrinsic. r? oli-obk
Rollup merge of #150893 - ZuseZ4:move-un-register-lib, r=oli-obk offload: move (un)register lib into global_ctors Right now we initialize the openmp/offload runtime before every single offload call, and tear it down directly afterwards. What we should rather do is initialize it once in the binary startup code, and tear it down at the end of the binary execution. Here I implement these changes. Together, our generated IR has a lot less usage of globals, which in turn simplifies the refactoring in #150683, where I introduce a new variant of our offload intrinsic. r? oli-obk
1a22802 to
f32d2da
Compare
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
f32d2da to
ac33037
Compare
|
Something changed after the last rebasing; two tests now fail. The query stack however also looks a lot more informative than I had it in mind, thanks to whoever improved that. I should add a proper detection of the case where people just add the declaration, but not the GPU implementation, so we can error instead of throwing an ICE. |
This comment has been minimized.
This comment has been minimized.
ac33037 to
a63cb61
Compare
This comment has been minimized.
This comment has been minimized.
a63cb61 to
9846fe8
Compare
This comment has been minimized.
This comment has been minimized.
9846fe8 to
da6041c
Compare
|
This PR was rebased onto a different main commit. Here's a range-diff highlighting what actually changed. Rebasing is a normal part of keeping PRs up to date, so no action is needed—this note is just to help reviewers. |
|
☔ The latest upstream changes (presumably #153379) made this pull request unmergeable. Please resolve the merge conflicts. |
View all comments
This intrinsic helps with supporting the various AMD & NVIDIA libraries like rocBLAS or cuBLAS.
They provide functions which must be called from the host, but require a mixture of host and device pointers.
This offload_args intrinsic maps our host allocations to device allocations and transfers memory as required.
It reuses the whole infrastructure which we already have for the main offload intrinsic.
Unlike the main offload intrinsic, this also already fully works with std. I also got it to work with a single cargo invocation:
RUSTFLAGS="-L native=/opt/rocm-6.4.0/lib -l dylib=rocblas -l dylib=amdhip64 -l dylib=omp -l dylib=omptarget -Zoffload=Args -Zunstable-options" cargo +offload run -rI'll rebase and drop the first 3 commits once the cleanup PR lands.
I updated
compiler/rustc_monomorphize/src/collector/autodiff.rs, it now works without no_mangle, otherwise the function won't be codegen'ed. It also works without lto=fat if we only have main.rsIf we put a function in lib.rs and call it in main.rs, then it currently trips the verifier. Happy to fix it either here or in a follow-up PR:
cc @kevinsala @Sa4dUs