Skip to content

Conversation

@ZuseZ4
Copy link
Member

@ZuseZ4 ZuseZ4 commented Jan 9, 2026

Right now we initialize the omp/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

@rustbot rustbot added A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Jan 9, 2026
@rustbot
Copy link
Collaborator

rustbot commented Jan 9, 2026

oli-obk is not on the review rotation at the moment.
They may take a while to respond.

@rust-log-analyzer

This comment has been minimized.

@ZuseZ4 ZuseZ4 force-pushed the move-un-register-lib branch 2 times, most recently from 788ce48 to 542e8e2 Compare January 9, 2026 21:24
@rust-log-analyzer

This comment has been minimized.

@ZuseZ4 ZuseZ4 force-pushed the move-un-register-lib branch 2 times, most recently from b305773 to c5134ae Compare January 9, 2026 23:43
@ZuseZ4 ZuseZ4 force-pushed the move-un-register-lib branch from c5134ae to 79a9d30 Compare January 10, 2026 00:06
@ZuseZ4 ZuseZ4 mentioned this pull request Jan 10, 2026
5 tasks
@ZuseZ4
Copy link
Member Author

ZuseZ4 commented Jan 11, 2026

@kevinsala #150683 fails with the commit where I drop init_all_rtls(), it also mentions that 0 devices are available.

omptarget fatal error -1: "invalid value" device number '-1' out of range, only 0 devices available

@ZuseZ4 ZuseZ4 force-pushed the move-un-register-lib branch from c0920cd to 6073368 Compare January 13, 2026 23:19
@ZuseZ4
Copy link
Member Author

ZuseZ4 commented Jan 13, 2026

I dropped the last commit, since we'll still need init_all_rtls till I replace the clang-linker-wrapper. I left a note instead.
@rustbot ready

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants