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.