Polly 20.0.0git
|
This ParallelLoopGenerator subclass handles the generation of parallelized code, utilizing the GNU OpenMP library. More...
#include <LoopGeneratorsGOMP.h>
Public Member Functions | |
ParallelLoopGeneratorGOMP (PollyIRBuilder &Builder, const DataLayout &DL) | |
Create a parallel loop generator for the current function. | |
void | createCallSpawnThreads (Value *SubFn, Value *SubFnParam, Value *LB, Value *UB, Value *Stride) |
Create a runtime library call to spawn the worker threads. | |
void | deployParallelExecution (Function *SubFn, Value *SubFnParam, Value *LB, Value *UB, Value *Stride) override |
Create the runtime library calls for spawn and join of the worker threads. | |
Function * | prepareSubFnDefinition (Function *F) const override |
Prepare the definition of the parallel subfunction. | |
std::tuple< Value *, Function * > | createSubFn (Value *Stride, AllocaInst *Struct, SetVector< Value * > UsedValues, ValueMapT &VMap) override |
Create the parallel subfunction. | |
void | createCallJoinThreads () |
Create a runtime library call to join the worker threads. | |
Value * | createCallGetWorkItem (Value *LBPtr, Value *UBPtr) |
Create a runtime library call to get the next work item. | |
void | createCallCleanupThread () |
Create a runtime library call to allow cleanup of the thread. | |
Public Member Functions inherited from polly::ParallelLoopGenerator | |
ParallelLoopGenerator (PollyIRBuilder &Builder, const DataLayout &DL) | |
Create a parallel loop generator for the current function. | |
virtual | ~ParallelLoopGenerator () |
Value * | createParallelLoop (Value *LB, Value *UB, Value *Stride, SetVector< Value * > &Values, ValueMapT &VMap, BasicBlock::iterator *LoopBody) |
Create a parallel loop. | |
DominatorTree * | getCalleeDominatorTree () const |
Returns the DominatorTree for the generated subfunction. | |
LoopInfo * | getCalleeLoopInfo () const |
Returns the LoopInfo for the generated subfunction. | |
AllocaInst * | storeValuesIntoStruct (SetVector< Value * > &Values) |
Create a struct for all Values and store them in there. | |
void | extractValuesFromStruct (SetVector< Value * > Values, Type *Ty, Value *Struct, ValueMapT &VMap) |
Extract all values from the Struct and construct the mapping. | |
Function * | createSubFnDefinition () |
Create the definition of the parallel subfunction. | |
virtual void | deployParallelExecution (Function *SubFn, Value *SubFnParam, Value *LB, Value *UB, Value *Stride)=0 |
Create the runtime library calls for spawn and join of the worker threads. | |
virtual Function * | prepareSubFnDefinition (Function *F) const =0 |
Prepare the definition of the parallel subfunction. | |
virtual std::tuple< Value *, Function * > | createSubFn (Value *Stride, AllocaInst *Struct, SetVector< Value * > UsedValues, ValueMapT &VMap)=0 |
Create the parallel subfunction. | |
Additional Inherited Members | |
Protected Attributes inherited from polly::ParallelLoopGenerator | |
PollyIRBuilder & | Builder |
The IR builder we use to create instructions. | |
std::unique_ptr< LoopInfo > | SubFnLI |
The loop info for the generated subfunction. | |
std::unique_ptr< DominatorTree > | SubFnDT |
The dominance tree for the generated subfunction. | |
Type * | LongType |
The type of a "long" on this hardware used for backend calls. | |
Module * | M |
The current module. | |
llvm::DebugLoc | DLGenerated |
Debug location for generated code without direct link to any specific line. | |
This ParallelLoopGenerator subclass handles the generation of parallelized code, utilizing the GNU OpenMP library.
Definition at line 25 of file LoopGeneratorsGOMP.h.
|
inline |
Create a parallel loop generator for the current function.
Definition at line 28 of file LoopGeneratorsGOMP.h.
void ParallelLoopGeneratorGOMP::createCallCleanupThread | ( | ) |
Create a runtime library call to allow cleanup of the thread.
Definition at line 216 of file LoopGeneratorsGOMP.cpp.
References polly::ParallelLoopGenerator::Builder, polly::ParallelLoopGenerator::DLGenerated, Function, and polly::ParallelLoopGenerator::M.
Referenced by createSubFn().
Value * ParallelLoopGeneratorGOMP::createCallGetWorkItem | ( | Value * | LBPtr, |
Value * | UBPtr | ||
) |
Create a runtime library call to get the next work item.
LBPtr | A pointer value to store the work item begin in. |
UBPtr | A pointer value to store the work item end in. |
Definition at line 177 of file LoopGeneratorsGOMP.cpp.
References polly::ParallelLoopGenerator::Builder, polly::ParallelLoopGenerator::DLGenerated, Function, polly::ParallelLoopGenerator::LongType, polly::ParallelLoopGenerator::M, and polly::Value.
Referenced by createSubFn().
void ParallelLoopGeneratorGOMP::createCallJoinThreads | ( | ) |
Create a runtime library call to join the worker threads.
Definition at line 199 of file LoopGeneratorsGOMP.cpp.
References polly::ParallelLoopGenerator::Builder, polly::ParallelLoopGenerator::DLGenerated, Function, and polly::ParallelLoopGenerator::M.
Referenced by deployParallelExecution().
void ParallelLoopGeneratorGOMP::createCallSpawnThreads | ( | Value * | SubFn, |
Value * | SubFnParam, | ||
Value * | LB, | ||
Value * | UB, | ||
Value * | Stride | ||
) |
Create a runtime library call to spawn the worker threads.
SubFn | The subfunction which holds the loop body. |
SubFnParam | The parameter for the subfunction (basically the struct filled with the outside values). |
LB | The lower bound for the loop we parallelize. |
UB | The upper bound for the loop we parallelize. |
Stride | The stride of the loop we parallelize. |
Definition at line 21 of file LoopGeneratorsGOMP.cpp.
References polly::ParallelLoopGenerator::Builder, polly::ParallelLoopGenerator::DLGenerated, Function, polly::ParallelLoopGenerator::LongType, polly::ParallelLoopGenerator::M, polly::PollyNumThreads, and polly::Value.
Referenced by deployParallelExecution().
|
overridevirtual |
Create the parallel subfunction.
Stride | The induction variable increment. |
Struct | A struct holding all values in Values . |
Values | A set of LLVM-IR Values that should be available in the new loop body. |
VMap | A map to allow outside access to the new versions of the values in Values . |
SubFn | The newly created subfunction is returned here. |
Implements polly::ParallelLoopGenerator.
Definition at line 94 of file LoopGeneratorsGOMP.cpp.
References polly::ParallelLoopGenerator::Builder, createCallCleanupThread(), createCallGetWorkItem(), polly::createLoop(), polly::ParallelLoopGenerator::createSubFnDefinition(), polly::ParallelLoopGenerator::extractValuesFromStruct(), Function, polly::ParallelLoopGenerator::LongType, polly::PollyChunkSize, polly::PollyScheduling, polly::Runtime, polly::ParallelLoopGenerator::SubFnDT, polly::ParallelLoopGenerator::SubFnLI, and polly::Value.
|
overridevirtual |
Create the runtime library calls for spawn and join of the worker threads.
Additionally, places a call to the specified subfunction.
SubFn | The subfunction which holds the loop body. |
SubFnParam | The parameter for the subfunction (basically the struct filled with the outside values). |
LB | The lower bound for the loop we parallelize. |
UB | The upper bound for the loop we parallelize. |
Stride | The stride of the loop we parallelize. |
Implements polly::ParallelLoopGenerator.
Definition at line 52 of file LoopGeneratorsGOMP.cpp.
References polly::ParallelLoopGenerator::Builder, createCallJoinThreads(), createCallSpawnThreads(), and polly::ParallelLoopGenerator::DLGenerated.
|
overridevirtual |
Prepare the definition of the parallel subfunction.
Creates the argument list and names them (as well as the subfunction).
F | A pointer to the (parallel) subfunction's parent function. |
Implements polly::ParallelLoopGenerator.
Definition at line 63 of file LoopGeneratorsGOMP.cpp.
References polly::ParallelLoopGenerator::Builder, Function, and polly::ParallelLoopGenerator::M.