-
Notifications
You must be signed in to change notification settings - Fork 923
feat(LLVM): use no-opt for extremely large functions #5997
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
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 introduces a compile-time optimization that selectively disables LLVM optimizations for extremely large functions (>100KB of LLVM IR). This reduces total build time from 600s to 200s by avoiding expensive optimization passes on functions where the optimization overhead outweighs the runtime benefits.
Key Changes:
- Added optional unoptimized target machine to
FuncTranslatorfor handling large functions - Introduced
target_machine_with_opt()method to create target machines with configurable optimization levels - Implemented size-based threshold (100KB) to switch between optimized and unoptimized compilation
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 6 comments.
| File | Description |
|---|---|
| lib/compiler-llvm/src/translator/code.rs | Added optional unoptimized target machine field and logic to select between optimized/unoptimized compilation based on function size |
| lib/compiler-llvm/src/config.rs | Added target_machine_with_opt() method to create target machines with configurable optimization levels |
| lib/compiler-llvm/src/compiler.rs | Updated FuncTranslator initialization in parallel compilation path to pass both optimized and unoptimized target machines |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Arshia001
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.
- zen mode activated *
|
What is the speed difference when running Python? Also, can we have just some passes but detect which one is actually slowing things down? (rather than just have 0 passes) |
On my AMD 12-core Zen machine, My expectation is the outliers are so huge that there will be multiple LLVM passes struggling. Should I create an issue and address it in a more detail? |
|
I've just checked the |
Yes, please |
|
I collected statistics for all our current Python WA modules where the change helps to reduce the compilation outliers. The total build of all the modules shrinks from 600s to 200s. The selected function threshold (100KB of LLVM IR) was selected based on the following numbers: