This is an archive of the discontinued LLVM Phabricator instance.

[GPGPU] Correctly initialize array order and fixed_element information
ClosedPublic

Authored by grosser on Aug 19 2017, 12:06 PM.

Details

Summary

This information is necessary for PPCG to perform correct life range reordering.
With these changes applied we can live-range reorder some of the important
kernels in COSMO.

We also update and rename one test case, which previously could not be optimized
and now is optimized thanks to live-range reordering.

Diff Detail

Repository
rL LLVM

Event Timeline

grosser created this revision.Aug 19 2017, 12:06 PM
bollu requested changes to this revision.Aug 19 2017, 12:45 PM
bollu added a subscriber: philip.pfaffe.

It's cool that invariant-load-hoisting-with-failing-scop.ll now succeeds, but that's not the purpose of the test case :)

The test case was supposed to check that when we set BuildSuccessful = 0 when we fail the "scalar store check" Link to check here, we try to set the RTC to 0.

We used to do this incorrectly by making assumptions on the CFG that invariant load hoisting would wreck.

That is, invariant load hoisting would edit the CFG in such a way that us "looking up" the runtime check in the CFG would error out.

The correct way to update this test case is to make the test case more complex so we have an actual store to a scalar.

lib/CodeGen/PPCGCodeGeneration.cpp
2804 ↗(On Diff #111849)

Can you add a TODO, notifying that we can have fixed_element for pointers/arrays as well, and not just scalars? Eg. Only having A[0] accesses.

This would help with stuff that @philip.pfaffe was benchmarking (theoretically).

lib/External/ppcg/gpu.c
256 ↗(On Diff #111849)

Consider adding an

assert(0 && "should not reach here, polly should early-exit");

after the return?

This revision now requires changes to proceed.Aug 19 2017, 12:45 PM
grosser updated this revision to Diff 111852.Aug 19 2017, 1:09 PM
grosser edited edge metadata.

Add another test case to avoid us loosing test coverage

grosser updated this revision to Diff 111853.Aug 19 2017, 1:15 PM
grosser marked an inline comment as done.

Add the TODO requested by Siddharth

bollu accepted this revision.Aug 19 2017, 1:17 PM

Please add the comment I requested for cc->isLatestScalarKind() ? isl_bool_true : isl_bool_false; and the test cases. LGTM.

test/GPGPU/live-range-reordering-with-privatization.ll
32 ↗(On Diff #111852)

Please add a comment to this test case explaining what it tests now.

; This test case now tests the ability to infer that `t` is local to each loop iteration, and can therefore be privatized.
test/GPGPU/scalar-writes-in-scop-requires-abort.ll
19 ↗(On Diff #111852)

Could you please add the more descriptive comment I had written in the original test case?

comment
; This test case checks that we generate correct code if PPCGCodeGeneration
; decides a build is unsuccessful with invariant load hoisting enabled.
; There is a conditional branch which switches between the original code and
; the new code. We try to set this conditional branch to branch on false.
; However, invariant load hoisting changes the structure of the scop, so we
; need to change the way we *locate* this instruction.
This revision is now accepted and ready to land.Aug 19 2017, 1:17 PM
grosser updated this revision to Diff 111854.Aug 19 2017, 1:18 PM

Add the invariant loads to the test case and copy some more comments from
Siddharth's earlier test case over

This revision was automatically updated to reflect the committed changes.
polly/trunk/lib/External/ppcg/gpu.c