class CGOpenMPRuntimeGPU

Declaration

class CGOpenMPRuntimeGPU : public CGOpenMPRuntime { /* full declaration omitted */ };

Declared at: clang/lib/CodeGen/CGOpenMPRuntimeGPU.h:24

Inherits from: CGOpenMPRuntime

Member Variables

private llvm::SmallVector<llvm::Function*, 16> Work
Parallel outlined function work for workers to execute.
private clang::CodeGen::CGOpenMPRuntimeGPU::ExecutionMode CurrentExecutionMode = EM_Unknown
Track the execution mode when codegening directives within a target region. The appropriate mode (SPMD/NON-SPMD) is set on entry to the target region and used by containing directives such as 'parallel' to emit optimized code.
private bool RequiresFullRuntime = true
Check if the full runtime is required (default - yes).
private bool IsInTargetMasterThreadRegion = false
true if we're emitting the code for the target region and next parallel region is L0 for sure.
private bool IsInTTDRegion = false
true if currently emitting code for target/teams/distribute region, false - otherwise.
private bool IsInParallelRegion = false
true if we're definitely in the parallel region.
private llvm::DenseMap<llvm::Function*, llvm::Function*> WrapperFunctionsMap
Map between an outlined function and its wrapper.
private llvm::SmallDenseMap<llvm::Function*, FunctionData> FunctionGlobalizedDecls
Maps the function to the list of the globalized variables with their addresses.
private llvm::GlobalVariable* KernelTeamsReductionPtr = nullptr
private llvm::SmallVector<const RecordDecl*, 4> TeamsReductions
List of the records with the list of fields for the reductions across the teams. Used to build the intermediate buffer for the fast teams reductions. All the records are gathered into a union `union.type` is created.
private llvm::GlobalVariable* KernelStaticGlobalized = nullptr
Shared pointer for the global memory in the global memory buffer used for the given kernel.
private std::pair<const Decl*, llvm::SmallVector<const ValueDecl*, 4>> TeamAndReductions
Pair of the Non-SPMD team and all reductions variables in this team region.

Inherited from CGOpenMPRuntime:

protected CGM
protected FirstSeparator
protected Separator
protected OMPBuilder

Method Overview

  • public CGOpenMPRuntimeGPU(clang::CodeGen::CodeGenModule & CGM)
  • public void adjustTargetSpecificDataForLambdas(clang::CodeGen::CodeGenFunction & CGF, const clang::OMPExecutableDirective & D) const
  • public void clear()
  • public llvm::FunctionCallee createNVPTXRuntimeFunction(unsigned int Function)
  • private void createOffloadEntry(llvm::Constant * ID, llvm::Constant * Addr, uint64_t Size, int32_t Flags, llvm::GlobalValue::LinkageTypes Linkage)
  • private llvm::Function * createParallelDataSharingWrapper(llvm::Function * OutlinedParallelFn, const clang::OMPExecutableDirective & D)
  • public void emitBarrierCall(clang::CodeGen::CodeGenFunction & CGF, clang::SourceLocation Loc, clang::OpenMPDirectiveKind Kind, bool EmitChecks = true, bool ForceSimpleCall = false)
  • public void emitCriticalRegion(clang::CodeGen::CodeGenFunction & CGF, llvm::StringRef CriticalName, const clang::CodeGen::RegionCodeGenTy & CriticalOpGen, clang::SourceLocation Loc, const clang::Expr * Hint = nullptr)
  • public void emitFunctionProlog(clang::CodeGen::CodeGenFunction & CGF, const clang::Decl * D)
  • private void emitGenericVarsEpilog(clang::CodeGen::CodeGenFunction & CGF, bool WithSPMDCheck = false)
  • private void emitGenericVarsProlog(clang::CodeGen::CodeGenFunction & CGF, clang::SourceLocation Loc, bool WithSPMDCheck = false)
  • private void emitKernelDeinit(clang::CodeGen::CodeGenFunction & CGF, clang::CodeGen::CGOpenMPRuntimeGPU::EntryFunctionState & EST, bool IsSPMD)
  • private void emitKernelInit(clang::CodeGen::CodeGenFunction & CGF, clang::CodeGen::CGOpenMPRuntimeGPU::EntryFunctionState & EST, bool IsSPMD)
  • private void emitNonSPMDKernel(const clang::OMPExecutableDirective & D, llvm::StringRef ParentName, llvm::Function *& OutlinedFn, llvm::Constant *& OutlinedFnID, bool IsOffloadEntry, const clang::CodeGen::RegionCodeGenTy & CodeGen)
  • private void emitNonSPMDParallelCall(clang::CodeGen::CodeGenFunction & CGF, clang::SourceLocation Loc, llvm::Value * OutlinedFn, ArrayRef<llvm::Value *> CapturedVars, const clang::Expr * IfCond)
  • public void emitNumTeamsClause(clang::CodeGen::CodeGenFunction & CGF, const clang::Expr * NumTeams, const clang::Expr * ThreadLimit, clang::SourceLocation Loc)
  • public void emitNumThreadsClause(clang::CodeGen::CodeGenFunction & CGF, llvm::Value * NumThreads, clang::SourceLocation Loc)
  • public void emitOutlinedFunctionCall(clang::CodeGen::CodeGenFunction & CGF, clang::SourceLocation Loc, llvm::FunctionCallee OutlinedFn, ArrayRef<llvm::Value *> Args = llvm::None) const
  • public void emitParallelCall(clang::CodeGen::CodeGenFunction & CGF, clang::SourceLocation Loc, llvm::Function * OutlinedFn, ArrayRef<llvm::Value *> CapturedVars, const clang::Expr * IfCond, llvm::Value * NumThreads)
  • public llvm::Function * emitParallelOutlinedFunction(const clang::OMPExecutableDirective & D, const clang::VarDecl * ThreadIDVar, clang::OpenMPDirectiveKind InnermostKind, const clang::CodeGen::RegionCodeGenTy & CodeGen)
  • public void emitProcBindClause(clang::CodeGen::CodeGenFunction & CGF, llvm::omp::ProcBindKind ProcBind, clang::SourceLocation Loc)
  • public void emitReduction(clang::CodeGen::CodeGenFunction & CGF, clang::SourceLocation Loc, ArrayRef<const clang::Expr *> Privates, ArrayRef<const clang::Expr *> LHSExprs, ArrayRef<const clang::Expr *> RHSExprs, ArrayRef<const clang::Expr *> ReductionOps, clang::CodeGen::CGOpenMPRuntime::ReductionOptionsTy Options)
  • private void emitSPMDKernel(const clang::OMPExecutableDirective & D, llvm::StringRef ParentName, llvm::Function *& OutlinedFn, llvm::Constant *& OutlinedFnID, bool IsOffloadEntry, const clang::CodeGen::RegionCodeGenTy & CodeGen)
  • private void emitSPMDParallelCall(clang::CodeGen::CodeGenFunction & CGF, clang::SourceLocation Loc, llvm::Function * OutlinedFn, ArrayRef<llvm::Value *> CapturedVars, const clang::Expr * IfCond)
  • private void emitTargetOutlinedFunction(const clang::OMPExecutableDirective & D, llvm::StringRef ParentName, llvm::Function *& OutlinedFn, llvm::Constant *& OutlinedFnID, bool IsOffloadEntry, const clang::CodeGen::RegionCodeGenTy & CodeGen)
  • public void emitTeamsCall(clang::CodeGen::CodeGenFunction & CGF, const clang::OMPExecutableDirective & D, clang::SourceLocation Loc, llvm::Function * OutlinedFn, ArrayRef<llvm::Value *> CapturedVars)
  • public llvm::Function * emitTeamsOutlinedFunction(const clang::OMPExecutableDirective & D, const clang::VarDecl * ThreadIDVar, clang::OpenMPDirectiveKind InnermostKind, const clang::CodeGen::RegionCodeGenTy & CodeGen)
  • public void functionFinished(clang::CodeGen::CodeGenFunction & CGF)
  • public clang::CodeGen::Address getAddressOfLocalVariable(clang::CodeGen::CodeGenFunction & CGF, const clang::VarDecl * VD)
  • public void getDefaultDistScheduleAndChunk(clang::CodeGen::CodeGenFunction & CGF, const clang::OMPLoopDirective & S, clang::OpenMPDistScheduleClauseKind & ScheduleKind, llvm::Value *& Chunk) const
  • protected unsigned int getDefaultLocationReserved2Flags() const
  • public void getDefaultScheduleAndChunk(clang::CodeGen::CodeGenFunction & CGF, const clang::OMPLoopDirective & S, clang::OpenMPScheduleClauseKind & ScheduleKind, const clang::Expr *& ChunkExpr) const
  • private clang::CodeGen::CGOpenMPRuntimeGPU::ExecutionMode getExecutionMode() const
  • public llvm::Value * getGPUNumThreads(clang::CodeGen::CodeGenFunction & CGF)
  • public llvm::Value * getGPUThreadID(clang::CodeGen::CodeGenFunction & CGF)
  • public llvm::Value * getGPUWarpSize(clang::CodeGen::CodeGenFunction & CGF)
  • protected llvm::StringRef getOutlinedHelperName() const
  • public clang::CodeGen::Address getParameterAddress(clang::CodeGen::CodeGenFunction & CGF, const clang::VarDecl * NativeParam, const clang::VarDecl * TargetParam) const
  • public bool hasAllocateAttributeForGlobalVar(const clang::VarDecl * VD, clang::LangAS & AS)
  • protected bool isDefaultLocationConstant() const
  • public void processRequiresDirective(const clang::OMPRequiresDecl * D)
  • private bool requiresFullRuntime() const
  • private void syncCTAThreads(clang::CodeGen::CodeGenFunction & CGF)
  • public const clang::VarDecl * translateParameter(const clang::FieldDecl * FD, const clang::VarDecl * NativeParam) const

Inherited from CGOpenMPRuntime:

Methods

CGOpenMPRuntimeGPU(
    clang::CodeGen::CodeGenModule& CGM)

Declared at: clang/lib/CodeGen/CGOpenMPRuntimeGPU.h:171

Parameters

clang::CodeGen::CodeGenModule& CGM

void adjustTargetSpecificDataForLambdas(
    clang::CodeGen::CodeGenFunction& CGF,
    const clang::OMPExecutableDirective& D) const

Description

Adjust some parameters for the target-based directives, like addresses of the variables captured by reference in lambdas.

Declared at: clang/lib/CodeGen/CGOpenMPRuntimeGPU.h:370

Parameters

clang::CodeGen::CodeGenFunction& CGF
const clang::OMPExecutableDirective& D

void clear()

Declared at: clang/lib/CodeGen/CGOpenMPRuntimeGPU.h:172

llvm::FunctionCallee createNVPTXRuntimeFunction(
    unsigned int Function)

Description

Returns specified OpenMP runtime function for the current OpenMP implementation. Specialized for the NVPTX device.

Declared at: clang/lib/CodeGen/CGOpenMPRuntimeGPU.h:313

Parameters

unsigned int Function
OpenMP runtime function.

Returns

Specified function.

void createOffloadEntry(
    llvm::Constant* ID,
    llvm::Constant* Addr,
    uint64_t Size,
    int32_t Flags,
    llvm::GlobalValue::LinkageTypes Linkage)

Description

Creates offloading entry for the provided entry ID \a ID, address \a Addr, size \a Size, and flags \a Flags.

Declared at: clang/lib/CodeGen/CGOpenMPRuntimeGPU.h:71

Parameters

llvm::Constant* ID
llvm::Constant* Addr
uint64_t Size
int32_t Flags
llvm::GlobalValue::LinkageTypes Linkage

llvm::Function* createParallelDataSharingWrapper(
    llvm::Function* OutlinedParallelFn,
    const clang::OMPExecutableDirective& D)

Description

Emit function which wraps the outline parallel region and controls the parameters which are passed to this function. The wrapper ensures that the outlined function is called with the correct arguments when data is shared.

Declared at: clang/lib/CodeGen/CGOpenMPRuntimeGPU.h:408

Parameters

llvm::Function* OutlinedParallelFn
const clang::OMPExecutableDirective& D

void emitBarrierCall(
    clang::CodeGen::CodeGenFunction& CGF,
    clang::SourceLocation Loc,
    clang::OpenMPDirectiveKind Kind,
    bool EmitChecks = true,
    bool ForceSimpleCall = false)

Description

Emit an implicit/explicit barrier for OpenMP threads.

Declared at: clang/lib/CodeGen/CGOpenMPRuntimeGPU.h:275

Parameters

clang::CodeGen::CodeGenFunction& CGF
clang::SourceLocation Loc
clang::OpenMPDirectiveKind Kind
Directive for which this implicit barrier call must be generated. Must be OMPD_barrier for explicit barrier generation.
bool EmitChecks = true
true if need to emit checks for cancellation barriers.
bool ForceSimpleCall = false
true simple barrier call must be emitted, false if runtime class decides which one to emit (simple or with cancellation checks).

void emitCriticalRegion(
    clang::CodeGen::CodeGenFunction& CGF,
    llvm::StringRef CriticalName,
    const clang::CodeGen::RegionCodeGenTy&
        CriticalOpGen,
    clang::SourceLocation Loc,
    const clang::Expr* Hint = nullptr)

Description

Emits a critical region.

Declared at: clang/lib/CodeGen/CGOpenMPRuntimeGPU.h:284

Parameters

clang::CodeGen::CodeGenFunction& CGF
llvm::StringRef CriticalName
Name of the critical region.
const clang::CodeGen::RegionCodeGenTy& CriticalOpGen
Generator for the statement associated with the given critical region.
clang::SourceLocation Loc
const clang::Expr* Hint = nullptr
Value of the 'hint' clause (optional).

void emitFunctionProlog(
    clang::CodeGen::CodeGenFunction& CGF,
    const clang::Decl* D)

Description

Emits OpenMP-specific function prolog. Required for device constructs.

Declared at: clang/lib/CodeGen/CGOpenMPRuntimeGPU.h:337

Parameters

clang::CodeGen::CodeGenFunction& CGF
const clang::Decl* D

void emitGenericVarsEpilog(
    clang::CodeGen::CodeGenFunction& CGF,
    bool WithSPMDCheck = false)

Description

Helper for generic variables globalization epilog.

Declared at: clang/lib/CodeGen/CGOpenMPRuntimeGPU.h:63

Parameters

clang::CodeGen::CodeGenFunction& CGF
bool WithSPMDCheck = false

void emitGenericVarsProlog(
    clang::CodeGen::CodeGenFunction& CGF,
    clang::SourceLocation Loc,
    bool WithSPMDCheck = false)

Description

Helper for generic variables globalization prolog.

Declared at: clang/lib/CodeGen/CGOpenMPRuntimeGPU.h:59

Parameters

clang::CodeGen::CodeGenFunction& CGF
clang::SourceLocation Loc
bool WithSPMDCheck = false

void emitKernelDeinit(
    clang::CodeGen::CodeGenFunction& CGF,
    clang::CodeGen::CGOpenMPRuntimeGPU::
        EntryFunctionState& EST,
    bool IsSPMD)

Description

Helper for target directive finalization.

Declared at: clang/lib/CodeGen/CGOpenMPRuntimeGPU.h:55

Parameters

clang::CodeGen::CodeGenFunction& CGF
clang::CodeGen::CGOpenMPRuntimeGPU:: EntryFunctionState& EST
bool IsSPMD

void emitKernelInit(
    clang::CodeGen::CodeGenFunction& CGF,
    clang::CodeGen::CGOpenMPRuntimeGPU::
        EntryFunctionState& EST,
    bool IsSPMD)

Description

Helper for target directive initialization.

Declared at: clang/lib/CodeGen/CGOpenMPRuntimeGPU.h:51

Parameters

clang::CodeGen::CodeGenFunction& CGF
clang::CodeGen::CGOpenMPRuntimeGPU:: EntryFunctionState& EST
bool IsSPMD

void emitNonSPMDKernel(
    const clang::OMPExecutableDirective& D,
    llvm::StringRef ParentName,
    llvm::Function*& OutlinedFn,
    llvm::Constant*& OutlinedFnID,
    bool IsOffloadEntry,
    const clang::CodeGen::RegionCodeGenTy&
        CodeGen)

Description

Emit outlined function specialized for the Fork-Join programming model for applicable target directives on the NVPTX device.

Declared at: clang/lib/CodeGen/CGOpenMPRuntimeGPU.h:84

Parameters

const clang::OMPExecutableDirective& D
Directive to emit.
llvm::StringRef ParentName
Name of the function that encloses the target region.
llvm::Function*& OutlinedFn
Outlined function value to be defined by this call.
llvm::Constant*& OutlinedFnID
Outlined function ID value to be defined by this call.
bool IsOffloadEntry
True if the outlined function is an offload entry. An outlined function may not be an entry if, e.g. the if clause always evaluates to false.
const clang::CodeGen::RegionCodeGenTy& CodeGen

void emitNonSPMDParallelCall(
    clang::CodeGen::CodeGenFunction& CGF,
    clang::SourceLocation Loc,
    llvm::Value* OutlinedFn,
    ArrayRef<llvm::Value*> CapturedVars,
    const clang::Expr* IfCond)

Description

Emits code for parallel or serial call of the \a OutlinedFn with variables captured in a record which address is stored in \a CapturedStruct. This call is for the Non-SPMD Execution Mode.

Declared at: clang/lib/CodeGen/CGOpenMPRuntimeGPU.h:131

Parameters

clang::CodeGen::CodeGenFunction& CGF
clang::SourceLocation Loc
llvm::Value* OutlinedFn
Outlined function to be run in parallel threads. Type of this function is void(*)(kmp_int32 *, kmp_int32, struct context_vars*).
ArrayRef<llvm::Value*> CapturedVars
A pointer to the record with the references to variables used in \a OutlinedFn function.
const clang::Expr* IfCond
Condition in the associated 'if' clause, if it was specified, nullptr otherwise.

void emitNumTeamsClause(
    clang::CodeGen::CodeGenFunction& CGF,
    const clang::Expr* NumTeams,
    const clang::Expr* ThreadLimit,
    clang::SourceLocation Loc)

Declared at: clang/lib/CodeGen/CGOpenMPRuntimeGPU.h:205

Parameters

clang::CodeGen::CodeGenFunction& CGF
const clang::Expr* NumTeams
An integer expression of teams.
const clang::Expr* ThreadLimit
An integer expression of threads.
clang::SourceLocation Loc

void emitNumThreadsClause(
    clang::CodeGen::CodeGenFunction& CGF,
    llvm::Value* NumThreads,
    clang::SourceLocation Loc)

Description

Emits call to void __kmpc_push_num_threads(ident_t *loc, kmp_int32 global_tid, kmp_int32 num_threads) to generate code for 'num_threads' clause.

Declared at: clang/lib/CodeGen/CGOpenMPRuntimeGPU.h:197

Parameters

clang::CodeGen::CodeGenFunction& CGF
llvm::Value* NumThreads
An integer value of threads.
clang::SourceLocation Loc

void emitOutlinedFunctionCall(
    clang::CodeGen::CodeGenFunction& CGF,
    clang::SourceLocation Loc,
    llvm::FunctionCallee OutlinedFn,
    ArrayRef<llvm::Value*> Args =
        llvm::None) const

Description

Emits call of the outlined function with the provided arguments, translating these arguments to correct target-specific arguments.

Declared at: clang/lib/CodeGen/CGOpenMPRuntimeGPU.h:331

Parameters

clang::CodeGen::CodeGenFunction& CGF
clang::SourceLocation Loc
llvm::FunctionCallee OutlinedFn
ArrayRef<llvm::Value*> Args = llvm::None

void emitParallelCall(
    clang::CodeGen::CodeGenFunction& CGF,
    clang::SourceLocation Loc,
    llvm::Function* OutlinedFn,
    ArrayRef<llvm::Value*> CapturedVars,
    const clang::Expr* IfCond,
    llvm::Value* NumThreads)

Description

Emits code for parallel or serial call of the \a OutlinedFn with variables captured in a record which address is stored in \a CapturedStruct.

Declared at: clang/lib/CodeGen/CGOpenMPRuntimeGPU.h:262

Parameters

clang::CodeGen::CodeGenFunction& CGF
clang::SourceLocation Loc
llvm::Function* OutlinedFn
Outlined function to be run in parallel threads. Type of this function is void(*)(kmp_int32 *, kmp_int32, struct context_vars*).
ArrayRef<llvm::Value*> CapturedVars
A pointer to the record with the references to variables used in \a OutlinedFn function.
const clang::Expr* IfCond
Condition in the associated 'if' clause, if it was specified, nullptr otherwise.
llvm::Value* NumThreads
The value corresponding to the num_threads clause, if any, or nullptr.

llvm::Function* emitParallelOutlinedFunction(
    const clang::OMPExecutableDirective& D,
    const clang::VarDecl* ThreadIDVar,
    clang::OpenMPDirectiveKind InnermostKind,
    const clang::CodeGen::RegionCodeGenTy&
        CodeGen)

Description

\a D. This outlined function has type void(*)(kmp_int32 *ThreadID, kmp_int32 BoundID, struct context_vars*).

Declared at: clang/lib/CodeGen/CGOpenMPRuntimeGPU.h:218

Parameters

const clang::OMPExecutableDirective& D
OpenMP directive.
const clang::VarDecl* ThreadIDVar
Variable for thread id in the current OpenMP region.
clang::OpenMPDirectiveKind InnermostKind
Kind of innermost directive (for simple directives it is a directive itself, for combined - its innermost directive).
const clang::CodeGen::RegionCodeGenTy& CodeGen
Code generation sequence for the \a D directive.

void emitProcBindClause(
    clang::CodeGen::CodeGenFunction& CGF,
    llvm::omp::ProcBindKind ProcBind,
    clang::SourceLocation Loc)

Description

Emit call to void __kmpc_push_proc_bind(ident_t *loc, kmp_int32 global_tid, int proc_bind) to generate code for 'proc_bind' clause.

Declared at: clang/lib/CodeGen/CGOpenMPRuntimeGPU.h:189

Parameters

clang::CodeGen::CodeGenFunction& CGF
llvm::omp::ProcBindKind ProcBind
clang::SourceLocation Loc

void emitReduction(
    clang::CodeGen::CodeGenFunction& CGF,
    clang::SourceLocation Loc,
    ArrayRef<const clang::Expr*> Privates,
    ArrayRef<const clang::Expr*> LHSExprs,
    ArrayRef<const clang::Expr*> RHSExprs,
    ArrayRef<const clang::Expr*> ReductionOps,
    clang::CodeGen::CGOpenMPRuntime::
        ReductionOptionsTy Options)

Description

Emit a code for reduction clause.

Declared at: clang/lib/CodeGen/CGOpenMPRuntimeGPU.h:302

Parameters

clang::CodeGen::CodeGenFunction& CGF
clang::SourceLocation Loc
ArrayRef<const clang::Expr*> Privates
List of private copies for original reduction arguments.
ArrayRef<const clang::Expr*> LHSExprs
List of LHS in \a ReductionOps reduction operations.
ArrayRef<const clang::Expr*> RHSExprs
List of RHS in \a ReductionOps reduction operations.
ArrayRef<const clang::Expr*> ReductionOps
List of reduction operations in form 'LHS binop RHS' or 'operator binop(LHS, RHS)'.
clang::CodeGen::CGOpenMPRuntime:: ReductionOptionsTy Options
List of options for reduction codegen: WithNowait true if parent directive has also nowait clause, false otherwise. SimpleReduction Emit reduction operation only. Used for omp simd directive on the host. ReductionKind The kind of reduction to perform.

void emitSPMDKernel(
    const clang::OMPExecutableDirective& D,
    llvm::StringRef ParentName,
    llvm::Function*& OutlinedFn,
    llvm::Constant*& OutlinedFnID,
    bool IsOffloadEntry,
    const clang::CodeGen::RegionCodeGenTy&
        CodeGen)

Description

Emit outlined function specialized for the Single Program Multiple Data programming model for applicable target directives on the NVPTX device.

Declared at: clang/lib/CodeGen/CGOpenMPRuntimeGPU.h:100

Parameters

const clang::OMPExecutableDirective& D
Directive to emit.
llvm::StringRef ParentName
Name of the function that encloses the target region.
llvm::Function*& OutlinedFn
Outlined function value to be defined by this call.
llvm::Constant*& OutlinedFnID
Outlined function ID value to be defined by this call.
bool IsOffloadEntry
True if the outlined function is an offload entry.
const clang::CodeGen::RegionCodeGenTy& CodeGen
Object containing the target statements. An outlined function may not be an entry if, e.g. the if clause always evaluates to false.

void emitSPMDParallelCall(
    clang::CodeGen::CodeGenFunction& CGF,
    clang::SourceLocation Loc,
    llvm::Function* OutlinedFn,
    ArrayRef<llvm::Value*> CapturedVars,
    const clang::Expr* IfCond)

Description

Emits code for parallel or serial call of the \a OutlinedFn with variables captured in a record which address is stored in \a CapturedStruct. This call is for a parallel directive within an SPMD target directive.

Declared at: clang/lib/CodeGen/CGOpenMPRuntimeGPU.h:147

Parameters

clang::CodeGen::CodeGenFunction& CGF
clang::SourceLocation Loc
llvm::Function* OutlinedFn
Outlined function to be run in parallel threads. Type of this function is void(*)(kmp_int32 *, kmp_int32, struct context_vars*).
ArrayRef<llvm::Value*> CapturedVars
A pointer to the record with the references to variables used in \a OutlinedFn function.
const clang::Expr* IfCond
Condition in the associated 'if' clause, if it was specified, nullptr otherwise.

void emitTargetOutlinedFunction(
    const clang::OMPExecutableDirective& D,
    llvm::StringRef ParentName,
    llvm::Function*& OutlinedFn,
    llvm::Constant*& OutlinedFnID,
    bool IsOffloadEntry,
    const clang::CodeGen::RegionCodeGenTy&
        CodeGen)

Description

Emit outlined function for 'target' directive on the NVPTX device.

Declared at: clang/lib/CodeGen/CGOpenMPRuntimeGPU.h:114

Parameters

const clang::OMPExecutableDirective& D
Directive to emit.
llvm::StringRef ParentName
Name of the function that encloses the target region.
llvm::Function*& OutlinedFn
Outlined function value to be defined by this call.
llvm::Constant*& OutlinedFnID
Outlined function ID value to be defined by this call.
bool IsOffloadEntry
True if the outlined function is an offload entry. An outlined function may not be an entry if, e.g. the if clause always evaluates to false.
const clang::CodeGen::RegionCodeGenTy& CodeGen

void emitTeamsCall(
    clang::CodeGen::CodeGenFunction& CGF,
    const clang::OMPExecutableDirective& D,
    clang::SourceLocation Loc,
    llvm::Function* OutlinedFn,
    ArrayRef<llvm::Value*> CapturedVars)

Description

Emits code for teams call of the \a OutlinedFn with variables captured in a record which address is stored in \a CapturedStruct.

Declared at: clang/lib/CodeGen/CGOpenMPRuntimeGPU.h:246

Parameters

clang::CodeGen::CodeGenFunction& CGF
const clang::OMPExecutableDirective& D
clang::SourceLocation Loc
llvm::Function* OutlinedFn
Outlined function to be run by team masters. Type of this function is void(*)(kmp_int32 *, kmp_int32, struct context_vars*).
ArrayRef<llvm::Value*> CapturedVars
A pointer to the record with the references to variables used in \a OutlinedFn function.

llvm::Function* emitTeamsOutlinedFunction(
    const clang::OMPExecutableDirective& D,
    const clang::VarDecl* ThreadIDVar,
    clang::OpenMPDirectiveKind InnermostKind,
    const clang::CodeGen::RegionCodeGenTy&
        CodeGen)

Description

\a D. This outlined function has type void(*)(kmp_int32 *ThreadID, kmp_int32 BoundID, struct context_vars*).

Declared at: clang/lib/CodeGen/CGOpenMPRuntimeGPU.h:233

Parameters

const clang::OMPExecutableDirective& D
OpenMP directive.
const clang::VarDecl* ThreadIDVar
Variable for thread id in the current OpenMP region.
clang::OpenMPDirectiveKind InnermostKind
Kind of innermost directive (for simple directives it is a directive itself, for combined - its innermost directive).
const clang::CodeGen::RegionCodeGenTy& CodeGen
Code generation sequence for the \a D directive.

void functionFinished(
    clang::CodeGen::CodeGenFunction& CGF)

Description

Cleans up references to the objects in finished function.

Declared at: clang/lib/CodeGen/CGOpenMPRuntimeGPU.h:356

Parameters

clang::CodeGen::CodeGenFunction& CGF

clang::CodeGen::Address getAddressOfLocalVariable(
    clang::CodeGen::CodeGenFunction& CGF,
    const clang::VarDecl* VD)

Description

Gets the OpenMP-specific address of the local variable.

Declared at: clang/lib/CodeGen/CGOpenMPRuntimeGPU.h:340

Parameters

clang::CodeGen::CodeGenFunction& CGF
const clang::VarDecl* VD

void getDefaultDistScheduleAndChunk(
    clang::CodeGen::CodeGenFunction& CGF,
    const clang::OMPLoopDirective& S,
    clang::OpenMPDistScheduleClauseKind&
        ScheduleKind,
    llvm::Value*& Chunk) const

Description

Choose a default value for the dist_schedule clause.

Declared at: clang/lib/CodeGen/CGOpenMPRuntimeGPU.h:359

Parameters

clang::CodeGen::CodeGenFunction& CGF
const clang::OMPLoopDirective& S
clang::OpenMPDistScheduleClauseKind& ScheduleKind
llvm::Value*& Chunk

unsigned int getDefaultLocationReserved2Flags()
    const

Description

Returns additional flags that can be stored in reserved_2 field of the default location. For NVPTX target contains data about SPMD/Non-SPMD execution mode + Full/Lightweight runtime mode. Used for better optimization.

Declared at: clang/lib/CodeGen/CGOpenMPRuntimeGPU.h:168

void getDefaultScheduleAndChunk(
    clang::CodeGen::CodeGenFunction& CGF,
    const clang::OMPLoopDirective& S,
    clang::OpenMPScheduleClauseKind& ScheduleKind,
    const clang::Expr*& ChunkExpr) const

Description

Choose a default value for the schedule clause.

Declared at: clang/lib/CodeGen/CGOpenMPRuntimeGPU.h:364

Parameters

clang::CodeGen::CodeGenFunction& CGF
const clang::OMPLoopDirective& S
clang::OpenMPScheduleClauseKind& ScheduleKind
const clang::Expr*& ChunkExpr

clang::CodeGen::CGOpenMPRuntimeGPU::ExecutionMode
getExecutionMode() const

Declared at: clang/lib/CodeGen/CGOpenMPRuntimeGPU.h:43

llvm::Value* getGPUNumThreads(
    clang::CodeGen::CodeGenFunction& CGF)

Description

Get the maximum number of threads in a block of the GPU.

Declared at: clang/lib/CodeGen/CGOpenMPRuntimeGPU.h:185

Parameters

clang::CodeGen::CodeGenFunction& CGF

llvm::Value* getGPUThreadID(
    clang::CodeGen::CodeGenFunction& CGF)

Description

Get the id of the current thread on the GPU.

Declared at: clang/lib/CodeGen/CGOpenMPRuntimeGPU.h:182

Parameters

clang::CodeGen::CodeGenFunction& CGF

llvm::Value* getGPUWarpSize(
    clang::CodeGen::CodeGenFunction& CGF)

Description

Get the GPU warp size.

Declared at: clang/lib/CodeGen/CGOpenMPRuntimeGPU.h:179

Parameters

clang::CodeGen::CodeGenFunction& CGF

llvm::StringRef getOutlinedHelperName() const

Description

Get the function name of an outlined region.

Declared at: clang/lib/CodeGen/CGOpenMPRuntimeGPU.h:156

clang::CodeGen::Address getParameterAddress(
    clang::CodeGen::CodeGenFunction& CGF,
    const clang::VarDecl* NativeParam,
    const clang::VarDecl* TargetParam) const

Description

Gets the address of the native argument basing on the address of the target-specific parameter.

Declared at: clang/lib/CodeGen/CGOpenMPRuntimeGPU.h:326

Parameters

clang::CodeGen::CodeGenFunction& CGF
const clang::VarDecl* NativeParam
Parameter itself.
const clang::VarDecl* TargetParam
Corresponding target-specific parameter.

bool hasAllocateAttributeForGlobalVar(
    const clang::VarDecl* VD,
    clang::LangAS& AS)

Description

Checks if the variable has associated OMPAllocateDeclAttr attribute with the predefined allocator and translates it into the corresponding address space.

Declared at: clang/lib/CodeGen/CGOpenMPRuntimeGPU.h:380

Parameters

const clang::VarDecl* VD
clang::LangAS& AS

bool isDefaultLocationConstant() const

Description

Check if the default location must be constant. Constant for NVPTX for better optimization.

Declared at: clang/lib/CodeGen/CGOpenMPRuntimeGPU.h:162

void processRequiresDirective(
    const clang::OMPRequiresDecl* D)

Description

Perform check on requires decl to ensure that target architecture supports unified addressing

Declared at: clang/lib/CodeGen/CGOpenMPRuntimeGPU.h:375

Parameters

const clang::OMPRequiresDecl* D

bool requiresFullRuntime() const

Declared at: clang/lib/CodeGen/CGOpenMPRuntimeGPU.h:45

void syncCTAThreads(
    clang::CodeGen::CodeGenFunction& CGF)

Description

Get barrier to synchronize all threads in a block.

Declared at: clang/lib/CodeGen/CGOpenMPRuntimeGPU.h:48

Parameters

clang::CodeGen::CodeGenFunction& CGF

const clang::VarDecl* translateParameter(
    const clang::FieldDecl* FD,
    const clang::VarDecl* NativeParam) const

Description

Translates the native parameter of outlined function if this is required for target.

Declared at: clang/lib/CodeGen/CGOpenMPRuntimeGPU.h:319

Parameters

const clang::FieldDecl* FD
Field decl from captured record for the parameter.
const clang::VarDecl* NativeParam
Parameter itself.