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.

Part 2 also removes the calls to @__tgt_init_all_rtls, since it doesn't seem to be needed right now and I also can't find it in similar clang IR anymore. It might also allow the ompOpt pass to perform more optimizations.

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.

@Sa4dUs can you please confirm that this doesn't break NVIDIA or any of your benchmarks?

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
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