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

Provide an easy way to use LLVM's Polly #39884

Open
5 tasks
gnzlbg opened this issue Feb 16, 2017 · 7 comments
Open
5 tasks

Provide an easy way to use LLVM's Polly #39884

gnzlbg opened this issue Feb 16, 2017 · 7 comments
Labels
A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. C-feature-request Category: A feature request, i.e: not implemented / a PR. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@gnzlbg
Copy link
Contributor

gnzlbg commented Feb 16, 2017

To use polly with clang I just need to compile polly together with llvm and clang (just check it out and put it in the correct directory before compiling), load it as a clang plugin, and then enable -mllvm polly.

It would be nice if:

  • rustc always came with an LLVM compiled with polly
  • it had an easy option to enable it from rustc that:
    • loads polly's /lib/LLVMPolly.so as a plugin
    • enables it in llvm's opt: -mllvm polly.
  • had an easy way to pass polly options without having to do the -mllvm -polly-option_name=value dance over and over again.

This would allow to start experimenting with polly, to e.g. make sure that it gets proper aliasing information for Rust.

@Mark-Simulacrum Mark-Simulacrum added A-LLVM Area: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues. I-wishlist labels May 23, 2017
@Mark-Simulacrum Mark-Simulacrum added C-feature-request Category: A feature request, i.e: not implemented / a PR. and removed I-wishlist labels Jul 27, 2017
@matthiaskrgr
Copy link
Member

Hi, it seems I can simply checkout https://github.com/llvm-mirror/polly into src/llvm/tools/polly, checkout the release_60 branch and llvms cmake will do the rest of the configuration.
I rebuilt rust and was able to build a program with RUSTFLAGS="-C passes=polly,polly-parallel" for example. :)

@gnzlbg
Copy link
Contributor Author

gnzlbg commented Feb 12, 2018

Could we build with it by default?

@matthiaskrgr
Copy link
Member

I tried adding to the rust repos .gitmodules as a submodule however this did not work, probably because it would check out not into the root repo but rather into the directory of another submodule (llvm).
What is the best to handle this?
Add it as submodule of the llvm repo or add it to the llvm/tools/polly "manually" via some custom command in some build script?

@DiamondLovesYou
Copy link
Contributor

This isn't as straight forward as suggested. After cloning the polly repo into src/llvm/tools, the passes won't be available: you'll have to modify the librustc_llvm build script to add Polly and PollyISL to the link. Next, you'll need to modifiy rustllvm by initializing the polly passes into the llvm pass registry by calling polly::initializePollyPasses in LLVMInitializePasses, and lastly calling polly::registerPollyPasses in LLVMRustAddAnalysisPasses (probably not the best spot to do this, but required the fewest changes).

@hanna-kruppe
Copy link
Contributor

BTW there is an ongoing discussion in the LLVM community about moving Polly into LLVM proper, using its infrastructure in existing and new loop optimizations, and slowly moving at least some of Polly's capabilities into the default optimization pipeline. See here for example. This is a project that will take a long time to fully come to fruition but the end result will not just be easier to use from rustc, it will hopefully also result in better and more general optimizations overall.

@steveklabnik
Copy link
Member

Triage: #51061 exists 🎊

@sanxiyn sanxiyn changed the title Provide an easy way to use llvm's polly Provide an easy way to use LLVM's Polly Jan 15, 2019
@memoryruins
Copy link
Contributor

#78566 allows polly to be passed into llvm-args. It is not available by default on nightly, and to use the pass, one must currently build rustc with polly enabled.

@Noratrieb Noratrieb added the T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. label Apr 5, 2023
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. C-feature-request Category: A feature request, i.e: not implemented / a PR. T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

No branches or pull requests

8 participants