-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Pass tune-cpu to LLVM #76830
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
Pass tune-cpu to LLVM #76830
Conversation
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @lcnr (or someone else) soon. If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes. Please see the contribution instructions for more information. |
Not an area I am familiar with, maybe r? @nagisa |
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.
This needs a dedicated test which uses the newly added -Z
flag.
@@ -530,6 +530,19 @@ This also supports the feature `+crt-static` and `-crt-static` to control | |||
Each target and [`target-cpu`](#target-cpu) has a default set of enabled | |||
features. | |||
|
|||
## tune-cpu |
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.
Moving this option to -Z
made it unstable and not-actually-a-codegen-option. At the very least this should be annotated as unstable.
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.
Annotated, but not moved yet since I don't know where unstable opts should be documented.
This overall LGTM. There are remaining compilation issues remaining before this can land and the |
might make your code run a bit faster on the selected CPU. | ||
|
||
You can run `rustc --print target-cpus` to see the valid options to pass | ||
here. Additionally, `native` can be passed to use the processor of the host |
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.
Might also be a good idea to explain generic
in here and target-cpu
: it's basically a profile for ancient instructions tuned for modern CPU.
Probably I can explain it in target-cpu
and just defer to it here.
## tune-cpu | ||
|
||
This instructs `rustc` to schedule code specifically for a particular processor. | ||
This does not affect what instruction sets are used or the compatibility, but |
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.
should be "does not affect compatibility (features and ABI)".
Still blocked on a squash. |
I think this is how it should work...
@bors r+ rollup=iffy |
📌 Commit a35a93f has been approved by |
⌛ Testing commit a35a93f with merge 2df1a8d661057e1889d837fd41d16821b6acd167... |
💥 Test timed out |
wha--what? |
@bors retry |
☀️ Test successful - checks-actions, checks-azure |
Wait, can I ask why |
I agree that this should probably be removed. I just added it because |
I think this is how it should work...
See https://internals.rust-lang.org/t/expose-tune-cpu-from-llvm/13088 for the background. Or the documentation diff.