This is an archive of the discontinued LLVM Phabricator instance.

[Polly] [PPCGCodeGeneration] Teach PPCGCodeGen to use live range reordering.
ClosedPublic

Authored by bollu on Jul 3 2017, 6:38 AM.

Details

Summary
  • Currently, code is a big pile of hack. Need to generate correct

kill information. Probably can be done in DependenceInfo.

  • Contains changes to /lib/External/ppcg for debugging purposes. All

this will be removed before merging.

Event Timeline

bollu created this revision.Jul 3 2017, 6:38 AM
bollu updated this revision to Diff 105155.Jul 4 2017, 4:51 AM
  • [WIP] [2 failures] change algorithm to pick phi nodes. privatization passes, other tests fail
bollu updated this revision to Diff 105174.Jul 4 2017, 7:18 AM
  • [NFC] code is readable and sane now. Can be reviewed.

ping, @grosser, @singam-sanjay, @Meinersbur (post-commit, probably since you are busy)

bollu retitled this revision from [Polly] [PPCGCodeGeneration] [WIP] Teach PPCGCodeGen to use live range reordering. to [Polly] [PPCGCodeGeneration] Teach PPCGCodeGen to use live range reordering..Jul 4 2017, 7:33 AM
bollu updated this revision to Diff 105180.Jul 4 2017, 8:28 AM
  • Fix forgotten LHS assignment in isl_schedule_set(Info.KillsSchedule, KillSchedule);
bollu updated this revision to Diff 105182.Jul 4 2017, 8:32 AM
  • Fix forgotten LHS assignment in isl_schedule_set(Info.KillsSchedule, KillSchedule)
  • Push from correct branch (clean diff branch, not dirty dev branch with debug code)
bollu updated this revision to Diff 105185.Jul 4 2017, 9:35 AM
  • [NFC wrt patch] Updated clang, hence fixed diff in unittests/ScopPassManager/PassManagerTest.cpp
grosser edited edge metadata.Jul 4 2017, 9:50 AM

Hi Siddharth,

the patch looks already very good. I have a couple of stylistic comments below, but nothing fundamental.

lib/CodeGen/PPCGCodeGeneration.cpp
122

What does "grafted" mean.

You name your class according to the context it is used in, rather than what it does. As there may be different uses in the future, I would prefer to name it according to what it does -- aka compute kills.

127

Any reason you do not use the new C++ interface?

132

Say why we only derive kill information for PHI nodes. Something like:

We currently only derive kill information for phi nodes, as phi nodes allow us to easily derive kill information. PHI nodes are not alive outside the scop and can consequently all be "killed".

145

Just say you compute the kill information -- and define what a kill is.

161

Would it make sense to use all 80 columns, rather than to break early?

172

Why do you create multiple kill statements? Is a single kill statement not enough>

183

Why two white spaces?

191

Unnecessary newline?

193

The C++ bindings would allow this to be written in a single line. ;)

196

For some reason it feels more canonical to just append std::strings rather then using a stringstream. Not sure if you agree.

214

Use all 80 columns for the comments.

bollu added a comment.Jul 5 2017, 1:08 AM

the comments I haven't replied to, I agree with and will fix.

lib/CodeGen/PPCGCodeGeneration.cpp
127

I did not wish to mix the old C interface and the new C++ interface in the same file. I was considering a cleanup patch where I convert everything to C++ once this is done,

161

yes, I agree here.

172

I'm mimicking what PPCG does when it hands in the schedule to compute_dependences. I haven't tested with just one statement.

214

I wanted to emphasize the "[param] -> { Stmt_phantom[] }" so I broke it into a separate line.

I should probably write it as:

// 3. Create the kill schedule of the form:
// "[param] -> { Stmt_phantom[] }"
// Then add this to Info.KillsSchedule.

to show that the newline is deliberate.

bollu updated this revision to Diff 105227.Jul 5 2017, 1:35 AM
  • [NFC] style fixes.
bollu updated this revision to Diff 105247.Jul 5 2017, 4:25 AM
  • [NFC wrt patch] update to C++ API. Code reads much nicer now
bollu updated this revision to Diff 105249.Jul 5 2017, 4:30 AM
  • [NFC] remove sstream that is no longer used
grosser accepted this revision.Jul 5 2017, 4:43 AM

LGTM, just some minor comments!

lib/CodeGen/PPCGCodeGeneration.cpp
115

Talk about kill, not live-range reordering.

161

Still does not use 80 cols.

This revision is now accepted and ready to land.Jul 5 2017, 4:43 AM
This revision was automatically updated to reflect the committed changes.