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

Add Polly Support #75615

Closed
wants to merge 2 commits into from
Closed

Add Polly Support #75615

wants to merge 2 commits into from

Conversation

namibj
Copy link

@namibj namibj commented Aug 17, 2020

As the previous PR #51061 stalled due to upstream changes (I assume Polly getting merged into llvm's repository), I made the effort to resolve most of the conflicts that accumulated between the @DiamondLovesYou 's patch and the current master a few hours ago.

I deliberately left the changes originally made to src/librustc_codegen_llvm/back/write.rs and src/rustllvm/PassWrapper.cpp out of my commit, as there has been some heavy refactoring to the hooks used by the old patch, and there weren't enough comments for me to know what I'm doing.

I hope someone with a better understanding of rustc's llvm backend could take a look at re-adding the changes to the above-mentioned files that were done by d51fa91 (and reverted in ef47e71).

DiamondLovesYou and others added 2 commits October 18, 2018 18:38
…uses an LLVM which includes polly.

Force LLVM rebuild on buildbots.
Topic-branch changes to src/librustc_codegen_llvm/back/write.rs and src/rustllvm/PassWrapper.cpp were ignored as the needed Refactorings would require a detailed understanding of rustc's LLVM backend.
Further errors are expected.
@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 @davidtwco (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 Aug 17, 2020
@davidtwco
Copy link
Member

r? @nagisa

@rust-highfive rust-highfive assigned nagisa and unassigned davidtwco Aug 17, 2020
@@ -178,6 +177,11 @@ impl Step for Llvm {
.define("LLVM_TARGET_ARCH", target_native.split('-').next().unwrap())
.define("LLVM_DEFAULT_TARGET_TRIPLE", target_native);

if !self.emscripten {
let polly_src = builder.src.join("src/polly");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Polly is included in LLVM checkout, why don't just use it?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This was a minimal merge of the old patch into the current master. I already got rid of the Polly submodule, but I tried to not change the code to keep some separation between the updated base and the actual semantic changes that are needed to make this work.
It will use the LLVM submodule's Polly.

let cstr = path2cstr(&path);
let llmod = module.module_llvm.llmod();
llvm::LLVMWriteBitcodeToFile(llmod, cstr.as_ptr());
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This all seems to be a merge conflict resolve gone wrong.

@bjorn3
Copy link
Member

bjorn3 commented Aug 17, 2020

Please use rebase instead of merge.

https://rustc-dev-guide.rust-lang.org/contributing.html

Rust follows a no merge-commit policy, meaning, when you encounter merge conflicts you are expected to always rebase instead of merge. E.g. always use rebase when bringing the latest changes from the master branch to your feature branch.

@namibj
Copy link
Author

namibj commented Aug 17, 2020

Please use rebase instead of merge.
Is it ok to delay the rebase until this even builds? It was only a single commit at the start, so I'm planning to just squash-rebase it once it works. But keeping it like this while figuring out how to port the old patch to current master is easier, because the edit-history of this very effort will stay in tact while the work is on-going.

The only reason this PR exists is to allow collaboration on properly hooking the Polly passes into the restructured LLVM pass manager system.

I repeat: I know this doesn't compile, and I know I didn't "properly" resolve the merge conflicts.
If I had resolved them, I would have filed the PR with benchmarks attached.

@Dylan-DPC-zz Dylan-DPC-zz added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Aug 17, 2020
@bors
Copy link
Contributor

bors commented Aug 29, 2020

☔ The latest upstream changes (presumably #75713) made this pull request unmergeable. Please resolve the merge conflicts.

@DiamondLovesYou
Copy link
Contributor

I periodically rebase my original work on top of origin/master here: https://github.com/geobacter-rs/rust/tree/polly.

@Dylan-DPC-zz
Copy link

@namibj thanks for taking the time to contribute. I have to close this due to inactivity. If you wish and you have the time you can open a new PR with these changes and we'll take it from there. Thanks

@Dylan-DPC-zz Dylan-DPC-zz added S-inactive Status: Inactive and waiting on the author. This is often applied to closed PRs. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Oct 23, 2020
Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this pull request Nov 9, 2020
Enable LLVM Polly via llvm-args.

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

![results](https://user-images.githubusercontent.com/7283601/97695555-338f7180-1adf-11eb-82bd-5130e0e6fa89.png)

[Benchmark](https://gist.github.com/JRF63/9a6268b91720958e90dbe7abffe20298)

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: rust-lang#75615
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-inactive Status: Inactive and waiting on the author. This is often applied to closed PRs.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants