Skip to content
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

Enable LLVM Polly via llvm-args. #78566

Merged
merged 1 commit into from
Nov 10, 2020
Merged

Enable LLVM Polly via llvm-args. #78566

merged 1 commit into from
Nov 10, 2020

Conversation

JRF63
Copy link
Contributor

@JRF63 JRF63 commented Oct 30, 2020

I think doing it this way is better than in #51061. Polly has other useful options and we probably don't want to create a -Z flag for each one of them.

results

Benchmark

I noticed that -lto seems to interfere with polly in this specific microbenchmark, as enabling it causes the perf to drop to that of non-polly builds.

Other related PRs: #75615

@rust-highfive
Copy link
Collaborator

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @Mark-Simulacrum (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 Oct 30, 2020
@Mark-Simulacrum
Copy link
Member

@bors r+

AFAICT, this should not change anything for users not building the compiler locally (and enabling this option).

@bors
Copy link
Contributor

bors commented Nov 6, 2020

📌 Commit 301bb12 has been approved by Mark-Simulacrum

@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 Nov 6, 2020
bors added a commit to rust-lang-ci/rust that referenced this pull request Nov 10, 2020
Rollup of 12 pull requests

Successful merges:

 - rust-lang#74754 (Add `#[cfg(panic = '...')]`)
 - rust-lang#76468 (Improve lifetime name annotations for closures & async functions)
 - rust-lang#77016 (Test clippy on PR CI on changes)
 - rust-lang#78480 (BTreeMap: fix pointer provenance rules)
 - rust-lang#78502 (Update Chalk to 0.36.0)
 - rust-lang#78513 (Infer the default host target from the host toolchain if possible)
 - rust-lang#78566 (Enable LLVM Polly via llvm-args.)
 - rust-lang#78580 (inliner: Break inlining cycles)
 - rust-lang#78710 (rustc_ast: Do not panic by default when visiting macro calls)
 - rust-lang#78746 (Demote i686-unknown-freebsd to tier 2 compiler target)
 - rust-lang#78830 (fix `super_visit_with` for `Terminator`)
 - rust-lang#78844 (Monomorphize a type argument of size-of operation during codegen)

Failed merges:

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 7ac079f into rust-lang:master Nov 10, 2020
@rustbot rustbot added this to the 1.49.0 milestone Nov 10, 2020
@ManuelCostanzo
Copy link

Hi ! Sory, but how can I use this ? I execute rustup update but I don't have the -C llvm-args=--polly. Thanks

@JRF63
Copy link
Contributor Author

JRF63 commented Dec 15, 2020

This optimization pass isn't available by default in the the nightly builds. You have to clone the repo, enable it in config.toml and build the compiler.

@ManuelCostanzo
Copy link

ManuelCostanzo commented Apr 13, 2021

Hi, I compiled with this flags:

RUSTFLAGS='-Ctarget-feature=+avx512f -Cllvm-args=--polly -Cllvm-args=--polly-vectorizer=stripmine' cargo run --release --bin program
But I find no difference if I take out the -Cllvm-args=--polly -Cllvm-args=--polly-vectorizer=stripmine'.

My program is a N-body algorithm. I'm using jemallocator as default allocator.

Any ideas ? Thank you.

@JRF63
Copy link
Contributor Author

JRF63 commented Apr 22, 2021

Check the emitted LLVM IR if they're the same. Polly won't vectorize loops if it thinks it's detrimental to performance.

cargo rustc --release -- --emit=llvm-ir

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants