Skip to content

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

Description

@gnzlbg

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.

Activity

  1. added
    A-LLVMArea: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.
    on May 23, 2017
  2. added
    C-feature-requestCategory: A feature request, i.e: not implemented / a PR.
    and removed on Jul 27, 2017
  3. matthiaskrgr commented on Feb 11, 2018

    @matthiaskrgr
    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. :)

  4. gnzlbg commented on Feb 12, 2018

    @gnzlbg
    ContributorAuthor

    Could we build with it by default?

  5. matthiaskrgr commented on Feb 12, 2018

    @matthiaskrgr
    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?

  6. DiamondLovesYou commented on Feb 21, 2018

    @DiamondLovesYou
    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).

  7. hanna-kruppe commented on Feb 21, 2018

    @hanna-kruppe
    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.

  8. steveklabnik commented on Nov 20, 2018

    @steveklabnik
    Contributor

    Triage: #51061 exists 🎊

  9. changed the title [-]Provide an easy way to use llvm's polly[/-] [+]Provide an easy way to use LLVM's Polly[/+] on Jan 15, 2019
  10. memoryruins commented on Dec 18, 2020

    @memoryruins
    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.

  11. added
    T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.
    on Apr 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-LLVMArea: Code generation parts specific to LLVM. Both correctness bugs and optimization-related issues.C-feature-requestCategory: A feature request, i.e: not implemented / a PR.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions