This is an archive of the discontinued LLVM Phabricator instance.

[PIR] A sequentialization pass for parallel regions
Needs ReviewPublic

Authored by jdoerfert on Jan 28 2017, 5:50 AM.

Details

Summary

This pass will lower all parallel regions to sequential IR. It replaces
PIR instruction by unconditional branch instructions as follows:

  • fork is replaced with a branch to the forked block.
  • halt is replaced with a branch to the sibling continuation block.
  • join is replaced with a branch to its destination block.

This approach:

  1. Does not need to scan the function if there are no parallel regions.
  2. Emits llvm.mem.parallel_loop_access metadata for parallel loops that have been sequentialized.
  3. Preserves the DominatorTree, LoopInfo and ParallelRegionInfo.

    This commit also includes general infrastructure needed for PIR passes as well as a library (libPIR) for the passes to live in.

Event Timeline

jdoerfert created this revision.Jan 28 2017, 5:50 AM
simoll added a subscriber: simoll.Jan 31 2017, 6:59 AM
ergawy added a subscriber: ergawy.Feb 9 2017, 1:30 AM
jdoerfert updated this revision to Diff 89364.Feb 22 2017, 7:56 AM

Update to match new D29250

jdoerfert added inline comments.Feb 27 2017, 2:57 AM
lib/Transforms/PIR/SequentializePIR.cpp
40

TODO: We can use the parallel region info pass to avoid a linear walk of the function here.

jdoerfert updated this revision to Diff 93785.Apr 2 2017, 7:47 AM

Utilize the ParallelRegionInfo pass and emit parallel loop metadata

jdoerfert marked an inline comment as done.
jdoerfert edited the summary of this revision. (Show Details)Apr 2 2017, 7:52 AM