Page MenuHomePhabricator

[PIR] Add fork, join and halt instructions
Needs ReviewPublic

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

Details

Summary

With this commit, low-level fork-join parallelism can be natively
expressed in LLVM IR. To this end, three new terminators are added:
fork, join, and halt.

A brief description of the syntax and semantics of the each terminator
follows:

(1) fork label %task.block, label %continuation.block
A fork terminator marks the beginning of a (possibly nested) parallel
region. Conceptually the %task.block and the %continuation.block
represent the two tasks to be executed in parallel. We denote the two
successors of a fork instruction as siblings.

(2) halt label %continuation.block
A halt marks the end of a forked task. The sibling continuation block of
the tasks starting block is the operand of the halt terminator.

(3) join label %sequential.block
A join specifies a synchronization point, or barrier, for a parallel
region. Once a join terminator is reached by a thread, execution stops
in that thread until all tasks spawned by this thread finish their work,
thus reach their respective halt instruction.

For more details, please refer to the following resources:
[0] PIR Wiki: https://github.com/Parallel-IR/llvm-pir/wiki.

Here, you will find the RFC document for the first stage of our proposal.

[1] Tapir: http://wsmoses.com/tapir.pdf.
[2] PIR (white paper): http://compilers.cs.uni-saarland.de/people/doerfert/parallelcfg.pdf

Disclaimer:

This patch, the PIR RFC, the PIR wiki, etc. are a joint effort by Tao B.
Schardl (MIT), Charles E. Leiserson (MIT), Kareem Ergawy (Saarland
University), Simon Moll (Saarland University) and Johannes Doerfert
(Saarland University). However, we are grateful for all the ideas and
feedback that came from various people in the community.

Event Timeline

jdoerfert created this revision.Jan 28 2017, 5:49 AM
deadalnix edited edge metadata.Jan 28 2017, 5:59 AM

I'm not sure who's the proper person to review that, but that wouldn't be me. Did you discussed adding these instruction with someone ? If so, who is that ? maybe you want to add these people as reviewer.

I'm not sure who's the proper person to review that, but that wouldn't be me. Did you discussed adding these instruction with someone ? If so, who is that ? maybe you want to add these people as reviewer.

A herald rule added you automatically, sorry for that. I was not going to add any specific reviewer for the time beeing but just let people that read the RFC take a look (and comment if they like).

Is there another patch which updates the langref? The semantics are most important of all.
Also, how do you discover where a region begins and ends?

Is there another patch which updates the langref? The semantics are most important of all.

Good points, thanks. So far there is no lang ref patch but we'll work on it now. However, the RFC email does define a semantics and how the regions have to look like.

Also, how do you discover where a region begins and ends?

At this point a parallel region starts with a fork and spreads till all paths from there end in a join. Detecting the regions can be therefor done in a single sweep that looks for the fork (, halt) and join instructions.

simoll added a subscriber: simoll.Jan 31 2017, 6:59 AM
ergawy added a subscriber: ergawy.Feb 9 2017, 1:26 AM
jdoerfert updated this revision to Diff 89355.Feb 22 2017, 6:41 AM

Fix smaller issues and minor renaming

Is there another patch which updates the langref? The semantics are most important of all.

Please see https://reviews.llvm.org/D30353 for a draft documentation and semantics.

Also, how do you discover where a region begins and ends?

Please see https://reviews.llvm.org/D30354 for a draft parallel region info implementation that discovers and maintains parallel region information.