This is an archive of the discontinued LLVM Phabricator instance.

[Polly] Add -polly-flatten-schedule pass.
ClosedPublic

Authored by Meinersbur on Sep 7 2016, 1:00 PM.

Details

Summary

The -polly-flatten-schedule pass reduces the number of scattering dimensions in its isl_union_map form to make then easier to understand. It is not meant to be used in production, only for debugging and regression tests.

To illustrate, how it can make sets simpler, here is a lifetime set used computed by DeLICM without flattening:

{ Stmt_reduction_for[0, 4] -> [0, 2, o2, o3] : o2 < 0; Stmt_reduction_for[0, 4] -> [0, 1, o2, o3] : o2 >= 5; Stmt_reduction_for[0, 4] -> [0, 1, 4, o3] : o3 > 0; Stmt_reduction_for[0, i1] -> [0, 1, i1, 1] : 0 <= i1 <= 3; Stmt_reduction_for[0, 4] -> [0, 2, 0, o3] : o3 <= 0 }

And here the same lifetime for a semantically identical one-dimensional schedule:

{ Stmt_reduction_for[0, i1] -> [2 + 3i1] : 0 <= i1 <= 4 }

Diff Detail

Repository
rL LLVM

Event Timeline

Meinersbur updated this revision to Diff 70587.Sep 7 2016, 1:00 PM
Meinersbur retitled this revision from to [Polly] Add -polly-flatten-schedule pass..
Meinersbur updated this object.
Meinersbur added a project: Restricted Project.
Meinersbur added subscribers: pollydev, llvm-commits.
grosser accepted this revision.Sep 7 2016, 1:41 PM
grosser edited edge metadata.

This looks good to me. Thank you Michael.

include/polly/Support/GICHelper.h
230 ↗(On Diff #70587)

Rewrap the paragraph?

239 ↗(On Diff #70587)

The IslPtr ...

I don't get the grammar here.

352 ↗(On Diff #70587)

Interesting!

lib/Transform/FlattenAlgo.cpp
24 ↗(On Diff #70587)

a a

36 ↗(On Diff #70587)

has is

This revision is now accepted and ready to land.Sep 7 2016, 1:41 PM
jdoerfert edited edge metadata.Sep 7 2016, 1:50 PM

my 2 cents.

include/polly/Support/GICHelper.h
409 ↗(On Diff #70587)

Tobias accepted this already but I would have assumed all these things to be in different patches. Maybe I'm wrong since I didnt read the whole patch but I just don't know what these isl++ replacements and the new isl foreach functions have to do with the flatten algorithm (or with Polly for that matter).

Meinersbur marked 4 inline comments as done.Sep 8 2016, 3:37 AM
Meinersbur added inline comments.
include/polly/Support/GICHelper.h
409 ↗(On Diff #70587)

I proposed this, but in the long-term we'd want a proper ISL C++ interface. We do not want to port other code to use this smart pointer, making FlattenSchedule currently the only place where it is used.

Meinersbur updated this revision to Diff 70683.Sep 8 2016, 5:24 AM
Meinersbur edited edge metadata.

Address Tobias' comments.

Rename isl_foreach to foreachElt and isl_foreach_with_break to foreach(Elt|Piece)WithBreak to match naming scheme.
I also considered "foreach" but clang-format treats it as a keyword.

This revision was automatically updated to reflect the committed changes.