Polly 20.0.0git
Public Member Functions | List of all members
polly::ParallelLoopGeneratorGOMP Class Referencefinal

This ParallelLoopGenerator subclass handles the generation of parallelized code, utilizing the GNU OpenMP library. More...

#include <LoopGeneratorsGOMP.h>

Inheritance diagram for polly::ParallelLoopGeneratorGOMP:
Inheritance graph
[legend]

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
PollyIRBuilderBuilder
 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.
 

Detailed Description

This ParallelLoopGenerator subclass handles the generation of parallelized code, utilizing the GNU OpenMP library.

Definition at line 25 of file LoopGeneratorsGOMP.h.

Constructor & Destructor Documentation

◆ ParallelLoopGeneratorGOMP()

polly::ParallelLoopGeneratorGOMP::ParallelLoopGeneratorGOMP ( PollyIRBuilder Builder,
const DataLayout &  DL 
)
inline

Create a parallel loop generator for the current function.

Definition at line 28 of file LoopGeneratorsGOMP.h.

Member Function Documentation

◆ createCallCleanupThread()

void ParallelLoopGeneratorGOMP::createCallCleanupThread ( )

Create a runtime library call to allow cleanup of the thread.

Note
This function is called right before the thread will exit the subfunction and only if the runtime system depends on it.

Definition at line 216 of file LoopGeneratorsGOMP.cpp.

References polly::ParallelLoopGenerator::Builder, polly::ParallelLoopGenerator::DLGenerated, Function, and polly::ParallelLoopGenerator::M.

Referenced by createSubFn().

◆ createCallGetWorkItem()

Value * ParallelLoopGeneratorGOMP::createCallGetWorkItem ( Value *  LBPtr,
Value *  UBPtr 
)

Create a runtime library call to get the next work item.

Parameters
LBPtrA pointer value to store the work item begin in.
UBPtrA pointer value to store the work item end in.
Returns
A true value if the work item is not empty.

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().

◆ createCallJoinThreads()

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().

◆ createCallSpawnThreads()

void ParallelLoopGeneratorGOMP::createCallSpawnThreads ( Value *  SubFn,
Value *  SubFnParam,
Value *  LB,
Value *  UB,
Value *  Stride 
)

Create a runtime library call to spawn the worker threads.

Parameters
SubFnThe subfunction which holds the loop body.
SubFnParamThe parameter for the subfunction (basically the struct filled with the outside values).
LBThe lower bound for the loop we parallelize.
UBThe upper bound for the loop we parallelize.
StrideThe 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().

◆ createSubFn()

std::tuple< Value *, Function * > ParallelLoopGeneratorGOMP::createSubFn ( Value *  Stride,
AllocaInst *  Struct,
SetVector< Value * >  UsedValues,
ValueMapT VMap 
)
overridevirtual

Create the parallel subfunction.

Parameters
StrideThe induction variable increment.
StructA struct holding all values in Values.
ValuesA set of LLVM-IR Values that should be available in the new loop body.
VMapA map to allow outside access to the new versions of the values in Values.
SubFnThe newly created subfunction is returned here.
Returns
The newly created induction variable.

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.

◆ deployParallelExecution()

void ParallelLoopGeneratorGOMP::deployParallelExecution ( Function *  SubFn,
Value *  SubFnParam,
Value *  LB,
Value *  UB,
Value *  Stride 
)
overridevirtual

Create the runtime library calls for spawn and join of the worker threads.

Additionally, places a call to the specified subfunction.

Parameters
SubFnThe subfunction which holds the loop body.
SubFnParamThe parameter for the subfunction (basically the struct filled with the outside values).
LBThe lower bound for the loop we parallelize.
UBThe upper bound for the loop we parallelize.
StrideThe 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.

◆ prepareSubFnDefinition()

Function * ParallelLoopGeneratorGOMP::prepareSubFnDefinition ( Function *  F) const
overridevirtual

Prepare the definition of the parallel subfunction.

Creates the argument list and names them (as well as the subfunction).

Parameters
FA pointer to the (parallel) subfunction's parent function.
Returns
The pointer to the (parallel) subfunction.

Implements polly::ParallelLoopGenerator.

Definition at line 63 of file LoopGeneratorsGOMP.cpp.

References polly::ParallelLoopGenerator::Builder, Function, and polly::ParallelLoopGenerator::M.


The documentation for this class was generated from the following files: