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. #51061

Closed
wants to merge 1 commit into
base: master
from

Conversation

Projects
None yet
@DiamondLovesYou
Contributor

DiamondLovesYou commented May 25, 2018

Use can be triggered via -Z polly, when rustc uses an LLVM which includes polly.

Force LLVM rebuild on buildbots.

@rust-highfive

This comment has been minimized.

Collaborator

rust-highfive commented May 25, 2018

r? @estebank

(rust_highfive has picked a reviewer for you, use r? to override)

@rust-highfive

This comment has been minimized.

Collaborator

rust-highfive commented May 25, 2018

warning Warning warning

  • These commits modify submodules.

@DiamondLovesYou DiamondLovesYou force-pushed the DiamondLovesYou:polly branch from e67fd06 to 27586fd May 25, 2018

@DiamondLovesYou

This comment has been minimized.

Contributor

DiamondLovesYou commented May 25, 2018

@rust-highfive rust-highfive assigned kennytm and unassigned estebank May 25, 2018

@kennytm

This comment has been minimized.

Member

kennytm commented May 25, 2018

Previous discussion: #50044.

@kennytm

This comment has been minimized.

Member

kennytm commented May 27, 2018

@bors r+

@bors

This comment has been minimized.

Contributor

bors commented May 27, 2018

📌 Commit 27586fd has been approved by kennytm

@kennytm

This comment has been minimized.

Member

kennytm commented May 27, 2018

cc #39884

@bors

This comment has been minimized.

Contributor

bors commented May 27, 2018

⌛️ Testing commit 27586fd with merge 15d620c...

bors added a commit that referenced this pull request May 27, 2018

Auto merge of #51061 - DiamondLovesYou:polly, r=kennytm
Add Polly support.

Use can be triggered via `-Z polly`, when `rustc` uses an LLVM which includes polly.

Force LLVM rebuild on buildbots.
@bors

This comment has been minimized.

Contributor

bors commented May 27, 2018

💔 Test failed - status-appveyor

@kennytm

This comment has been minimized.

Member

kennytm commented May 27, 2018

It caused a bunch on undefined references when linking lib/LLVMPolly.dll (dll?) on Windows (i686-mingw-1).

[00:12:16] [2027/2254] Linking CXX shared module lib\LLVMPolly.dll
[00:12:16] FAILED: lib/LLVMPolly.dll 
[00:12:16] cmd.exe /C "cd . && C:\projects\rust\sccache.exe g++.exe  -ffunction-sections -fdata-sections -m32 -fno-omit-frame-pointer -Werror=date-time -std=gnu++11 -Wall -W -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wno-missing-field-initializers -pedantic -Wno-long-long -Wno-maybe-uninitialized -Wdelete-non-virtual-dtor -Wno-comment -fno-common -Woverloaded-virtual -Wno-long-long -Wall -W -Wno-unused-parameter -Wwrite-strings -fno-exceptions -fno-rtti  -O2   -shared -o lib\LLVMPolly.dll -Wl,--major-image-version,0,--minor-image-version,0 tools/polly/lib/CMakeFiles/PollyCore.dir/Analysis/DependenceInfo.cpp.obj tools/polly/lib/CMakeFiles/PollyCore.dir/Analysis/PolyhedralInfo.cpp.obj tools/polly/lib/CMakeFiles/PollyCore.dir/Analysis/ScopDetection.cpp.obj tools/polly/lib/CMakeFiles/PollyCore.dir/Analysis/ScopDetectionDiagnostic.cpp.obj tools/polly/lib/CMakeFiles/PollyCore.dir/Analysis/ScopInfo.cpp.obj tools/polly/lib/CMakeFiles/PollyCore.dir/Analysis/ScopBuilder.cpp.obj tools/polly/lib/CMakeFiles/PollyCore.dir/Analysis/ScopGraphPrinter.cpp.obj tools/polly/lib/CMakeFiles/PollyCore.dir/Analysis/ScopPass.cpp.obj tools/polly/lib/CMakeFiles/PollyCore.dir/Analysis/PruneUnprofitable.cpp.obj tools/polly/lib/CMakeFiles/PollyCore.dir/CodeGen/BlockGenerators.cpp.obj tools/polly/lib/CMakeFiles/PollyCore.dir/CodeGen/IslAst.cpp.obj tools/polly/lib/CMakeFiles/PollyCore.dir/CodeGen/IslExprBuilder.cpp.obj tools/polly/lib/CMakeFiles/PollyCore.dir/CodeGen/IslNodeBuilder.cpp.obj tools/polly/lib/CMakeFiles/PollyCore.dir/CodeGen/CodeGeneration.cpp.obj tools/polly/lib/CMakeFiles/PollyCore.dir/CodeGen/LoopGenerators.cpp.obj tools/polly/lib/CMakeFiles/PollyCore.dir/CodeGen/IRBuilder.cpp.obj tools/polly/lib/CMakeFiles/PollyCore.dir/CodeGen/Utils.cpp.obj tools/polly/lib/CMakeFiles/PollyCore.dir/CodeGen/RuntimeDebugBuilder.cpp.obj tools/polly/lib/CMakeFiles/PollyCore.dir/CodeGen/CodegenCleanup.cpp.obj tools/polly/lib/CMakeFiles/PollyCore.dir/CodeGen/PerfMonitor.cpp.obj tools/polly/lib/CMakeFiles/PollyCore.dir/Exchange/JSONExporter.cpp.obj tools/polly/lib/CMakeFiles/PollyCore.dir/Support/GICHelper.cpp.obj tools/polly/lib/CMakeFiles/PollyCore.dir/Support/SCEVAffinator.cpp.obj tools/polly/lib/CMakeFiles/PollyCore.dir/Support/SCEVValidator.cpp.obj tools/polly/lib/CMakeFiles/PollyCore.dir/Support/RegisterPasses.cpp.obj tools/polly/lib/CMakeFiles/PollyCore.dir/Support/ScopHelper.cpp.obj tools/polly/lib/CMakeFiles/PollyCore.dir/Support/ScopLocation.cpp.obj tools/polly/lib/CMakeFiles/PollyCore.dir/Support/ISLTools.cpp.obj tools/polly/lib/CMakeFiles/PollyCore.dir/Support/DumpModulePass.cpp.obj tools/polly/lib/CMakeFiles/PollyCore.dir/Support/VirtualInstruction.cpp.obj tools/polly/lib/CMakeFiles/PollyCore.dir/External/JSON/json_reader.cpp.obj tools/polly/lib/CMakeFiles/PollyCore.dir/External/JSON/json_value.cpp.obj tools/polly/lib/CMakeFiles/PollyCore.dir/External/JSON/json_writer.cpp.obj tools/polly/lib/CMakeFiles/PollyCore.dir/Transform/Canonicalization.cpp.obj tools/polly/lib/CMakeFiles/PollyCore.dir/Transform/CodePreparation.cpp.obj tools/polly/lib/CMakeFiles/PollyCore.dir/Transform/DeadCodeElimination.cpp.obj tools/polly/lib/CMakeFiles/PollyCore.dir/Transform/ScheduleOptimizer.cpp.obj tools/polly/lib/CMakeFiles/PollyCore.dir/Transform/FlattenSchedule.cpp.obj tools/polly/lib/CMakeFiles/PollyCore.dir/Transform/FlattenAlgo.cpp.obj tools/polly/lib/CMakeFiles/PollyCore.dir/Transform/ForwardOpTree.cpp.obj tools/polly/lib/CMakeFiles/PollyCore.dir/Transform/DeLICM.cpp.obj tools/polly/lib/CMakeFiles/PollyCore.dir/Transform/ZoneAlgo.cpp.obj tools/polly/lib/CMakeFiles/PollyCore.dir/Transform/Simplify.cpp.obj tools/polly/lib/CMakeFiles/PollyCore.dir/Transform/MaximalStaticExpansion.cpp.obj tools/polly/lib/CMakeFiles/PollyCore.dir/Transform/RewriteByReferenceParameters.cpp.obj tools/polly/lib/CMakeFiles/PollyCore.dir/Transform/ScopInliner.cpp.obj tools/polly/lib/CMakeFiles/LLVMPolly.dir/Polly.cpp.obj  lib/libPollyISL.a -lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32 && cd ."
[00:12:16] tools/polly/lib/CMakeFiles/PollyCore.dir/Analysis/DependenceInfo.cpp.obj:DependenceInfo.cpp:(.text$__tcf_2+0x11): undefined reference to `vtable for llvm::cl::Option'
...
[00:12:16] tools/polly/lib/CMakeFiles/LLVMPolly.dir/Polly.cpp.obj:Polly.cpp:(.text.startup._GLOBAL__sub_I_Polly.cpp+0x7): undefined reference to `llvm::PassRegistry::getPassRegistry()'
[00:12:16] collect2.exe: error: ld returned 1 exit status
@DiamondLovesYou

This comment has been minimized.

Contributor

DiamondLovesYou commented May 27, 2018

Huh, that's odd. Rust shouldn't ever try to link polly dynamically, due to the fact that it's in LLVM*.* form and not libLLVM*.* form. So we could, as a last resort, just not build Polly when the host is Windows. I don't develop on windows normally (or at all really); let me setup my gaming windows VM to try and reproduce this. It would be unfortunate to have to disable this for Windows devs.

@bors

This comment has been minimized.

Contributor

bors commented May 30, 2018

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

@bors

This comment has been minimized.

Contributor

bors commented Sep 7, 2018

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

@DiamondLovesYou DiamondLovesYou force-pushed the DiamondLovesYou:polly branch 2 times, most recently from e208473 to 6e97e37 Sep 10, 2018

@DiamondLovesYou

This comment has been minimized.

Contributor

DiamondLovesYou commented Sep 10, 2018

K, for future reference: on Msys2, use mingw-w64-x86_64-python2, not python2. Finally got LLVM to configure correctly.

@DiamondLovesYou DiamondLovesYou force-pushed the DiamondLovesYou:polly branch from 6e97e37 to 0225bbd Sep 10, 2018

@DiamondLovesYou

This comment has been minimized.

Contributor

DiamondLovesYou commented Sep 11, 2018

Patch to make Polly not try to build the loadable modules on all Windows platforms: https://reviews.llvm.org/D51904.

@mati865 I made a minor change: I used LLVM_ENABLE_PLUGINS instead of checking platform specific booleans.

@mati865

This comment has been minimized.

Contributor

mati865 commented Sep 11, 2018

@DiamondLovesYou MSYS2 builds LLVM with LLVM_BUILD_LLVM_DYLIB so it has LLVM_ENABLE_PLUGINS enabled and Polly doesn't build.

As long as Rust doesn't enable BUILD_SHARED_LIBS or LLVM_BUILD_LLVM_DYLIB for LLVM Polly should build on Windows.

@DiamondLovesYou

This comment has been minimized.

Contributor

DiamondLovesYou commented Sep 11, 2018

@mati865 Okay, I dug in and managed to (just now) fix the original issue. I built LLVM with LLVM_BUILD_LLVM_DYLIB && LLVM_LINK_LLVM_DYLIB on Msys/mingw/whatnot without disabling LLVMPolly!

Sadly, using LINK_POLLY_INTO_TOOLS and LLVM_LINK_LLVM_DYLIB together breaks some tools as Polly is linked into the dylib already.

@mati865

This comment has been minimized.

Contributor

mati865 commented Sep 12, 2018

@DiamondLovesYou nice work but maybe you are going too deep? This is pretty much uncharted territory.
Ofc having it fully working everwhere would be nice but it's a lot of effort and time.
This PR seems to be already on pair with LLVM with Polly working on UNIX like platforms and not regress on Windows.

@DiamondLovesYou

This comment has been minimized.

Contributor

DiamondLovesYou commented Sep 12, 2018

@mati865 Maybe, but it doesn't matter now.

New patch: https://reviews.llvm.org/D51963.

@bors

This comment has been minimized.

Contributor

bors commented Sep 12, 2018

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

@DiamondLovesYou

This comment has been minimized.

@bemeurer

This comment has been minimized.

Contributor

bemeurer commented Sep 14, 2018

@DiamondLovesYou You're an absolute hero for pushing this through, thank you so much! Hope to see those Polly patches landing soon.

@DiamondLovesYou

This comment has been minimized.

Contributor

DiamondLovesYou commented Sep 17, 2018

Thanks! Hopefully I can actually get it in; a lot of platform specific issues are coming up, which are breaking check-all in different ways for the BUILD_SHARED_LIBS && LLVM_LINK_LLVM_DYLIB && platform combinations.

Add Polly support. Use can be triggered via `-Z polly`, when `rustc` …
…uses an LLVM which includes polly.

Force LLVM rebuild on buildbots.

@DiamondLovesYou DiamondLovesYou force-pushed the DiamondLovesYou:polly branch from 0225bbd to d51fa91 Oct 18, 2018

[submodule "src/polly"]
path = src/polly
url = https://github.com/llvm-mirror/polly.git

This comment has been minimized.

@matthiaskrgr

matthiaskrgr Oct 19, 2018

Contributor

Perhaps rust-lang should have its own fork of this repo?
I could imagine that if upstream polly gets synced with upstream llvm but rustc uses rust-lang-llvm with llvm upstream polly, there might be conflicts between let's say polly 8.0 and llvm 7.0 (the rustc-lang fork).

This comment has been minimized.

@kennytm

kennytm Oct 19, 2018

Member

We could track the release_70 branch instead of master if version incompatibility is the only concern.

@bors

This comment has been minimized.

Contributor

bors commented Oct 21, 2018

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

@steveklabnik steveklabnik referenced this pull request Nov 20, 2018

Open

Provide an easy way to use llvm's polly #39884

0 of 5 tasks complete
@Centril

This comment has been minimized.

Contributor

Centril commented Dec 1, 2018

Ping from triage, @kennytm: should this PR be closed? @DiamondLovesYou any updates?

@Centril Centril added S-blocked and removed S-blocked labels Dec 1, 2018

@kennytm

This comment has been minimized.

Member

kennytm commented Dec 1, 2018

@Centril this was blocked by several patched on LLVM. If OP did not have any updates this could be closed as S-blocked-closed.

@Centril Centril added S-blocked-closed and removed S-blocked labels Dec 1, 2018

@Centril

This comment has been minimized.

Contributor

Centril commented Dec 1, 2018

Alright; closing as S-blocked-closed for the time being then.

@Centril Centril closed this Dec 1, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment