Skip to content

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

Merged
merged 1 commit into from
Oct 13, 2020
Merged

Pass tune-cpu to LLVM #76830

merged 1 commit into from
Oct 13, 2020

Conversation

Artoria2e5
Copy link
Contributor

@Artoria2e5 Artoria2e5 commented Sep 17, 2020

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.

@rust-highfive
Copy link
Contributor

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.

@rust-highfive rust-highfive added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Sep 17, 2020
@Artoria2e5 Artoria2e5 marked this pull request as ready for review September 17, 2020 09:42
@lcnr
Copy link
Contributor

lcnr commented Sep 17, 2020

Not an area I am familiar with, maybe r? @nagisa

@rust-highfive rust-highfive assigned nagisa and unassigned lcnr Sep 17, 2020
@jyn514 jyn514 added A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Sep 17, 2020
Copy link
Member

@nagisa nagisa left a 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
Copy link
Member

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.

Copy link
Contributor Author

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.

@nagisa
Copy link
Member

nagisa commented Sep 26, 2020

This overall LGTM. There are remaining compilation issues remaining before this can land and the tune-cpu documentation still needs a note that it is unstable. Please also squash.

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
Copy link
Contributor Author

@Artoria2e5 Artoria2e5 Sep 29, 2020

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
Copy link
Contributor Author

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)".

@nagisa
Copy link
Member

nagisa commented Oct 3, 2020

Still blocked on a squash.

I think this is how it should work...
@Artoria2e5
Copy link
Contributor Author

Artoria2e5 commented Oct 4, 2020

Grrr https://github.bestrui.topmunity/t/set-receive-shallowupdate-on-to-allow-pushing-from-shallow-clones/2424

@nagisa
Copy link
Member

nagisa commented Oct 9, 2020

@bors r+ rollup=iffy

@bors
Copy link
Collaborator

bors commented Oct 9, 2020

📌 Commit a35a93f has been approved by nagisa

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Oct 9, 2020
@bors
Copy link
Collaborator

bors commented Oct 9, 2020

⌛ Testing commit a35a93f with merge 2df1a8d661057e1889d837fd41d16821b6acd167...

@bors
Copy link
Collaborator

bors commented Oct 10, 2020

💥 Test timed out

@bors bors removed the S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. label Oct 10, 2020
@bors bors added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. label Oct 10, 2020
@Artoria2e5
Copy link
Contributor Author

wha--what?

@nagisa
Copy link
Member

nagisa commented Oct 13, 2020

@bors retry

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Oct 13, 2020
@bors
Copy link
Collaborator

bors commented Oct 13, 2020

⌛ Testing commit a35a93f with merge f54072b...

@bors
Copy link
Collaborator

bors commented Oct 13, 2020

☀️ Test successful - checks-actions, checks-azure
Approved by: nagisa
Pushing f54072b to master...

@bors bors added the merged-by-bors This PR was explicitly merged by bors. label Oct 13, 2020
@bors bors merged commit f54072b into rust-lang:master Oct 13, 2020
@rustbot rustbot added this to the 1.49.0 milestone Oct 13, 2020
@Artoria2e5 Artoria2e5 deleted the tune branch October 13, 2020 13:57
@khyperia
Copy link
Contributor

Wait, can I ask why tune_cpu was added to the backend interface? It doesn't seem to be called anywhere (deleting it and running ./x.py check seems fine). Same with target_cpu, actually, it doesn't seem to be called anywhere...

@Artoria2e5
Copy link
Contributor Author

I agree that this should probably be removed. I just added it because target_cpu was there, but yeah...

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. merged-by-bors This PR was explicitly merged by bors. S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. 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.

10 participants