clang 24.0.0git
CGOpenMPRuntimeGPU.cpp File Reference
#include "CGOpenMPRuntimeGPU.h"
#include "CGDebugInfo.h"
#include "CodeGenFunction.h"
#include "TargetInfo.h"
#include "clang/AST/Attr.h"
#include "clang/AST/DeclOpenMP.h"
#include "clang/AST/OpenMPClause.h"
#include "clang/AST/StmtOpenMP.h"
#include "clang/AST/StmtVisitor.h"
#include "llvm/ADT/SmallPtrSet.h"
#include "llvm/Frontend/OpenMP/OMPDeviceConstants.h"
#include "llvm/Frontend/OpenMP/OMPGridValues.h"
#include "llvm/IR/IRBuilder.h"
#include "llvm/IR/Instructions.h"
#include "llvm/TargetParser/NVPTXTargetParser.h"

Go to the source code of this file.

Functions

static bool hasNestedSPMDDirective (ASTContext &Ctx, const OMPExecutableDirective &D)
 Check for inner (nested) SPMD construct, if any.
static bool supportsSPMDExecutionMode (ASTContext &Ctx, const OMPExecutableDirective &D)
static void getDistributeLastprivateVars (ASTContext &Ctx, const OMPExecutableDirective &D, llvm::SmallVectorImpl< const ValueDecl * > &Vars)
 Get list of lastprivate variables from the teams distribute ... or teams {distribute ...} directives.
static void getTeamsReductionVars (ASTContext &Ctx, const OMPExecutableDirective &D, llvm::SmallVectorImpl< const ValueDecl * > &Vars)
 Get list of reduction variables from the teams ... directives.
static llvm::ValuecastValueToType (CodeGenFunction &CGF, llvm::Value *Val, QualType ValTy, QualType CastTy, SourceLocation Loc)
 Cast value to the specified type.
static std::optional< BinaryOperatorKindgetReductionBinOpKind (const Expr *ReductionOp)
 Extracts the built-in reduction operator from a combiner of the form x = x / <op> rhs (or the min/max conditional), or nullopt if the shape is not recognized (e.g.
static std::optional< llvm::AtomicRMWInst::BinOp > getReductionAtomicRMWOp (BinaryOperatorKind BOK, QualType Ty)
 Maps a built-in reduction operator to an atomicrmw opcode for the atomic cross-team reduction fast path, or nullopt if there is no direct atomicrmw (e.g.

Function Documentation

◆ castValueToType()

◆ getDistributeLastprivateVars()

void getDistributeLastprivateVars ( ASTContext & Ctx,
const OMPExecutableDirective & D,
llvm::SmallVectorImpl< const ValueDecl * > & Vars )
static

Get list of lastprivate variables from the teams distribute ... or teams {distribute ...} directives.

Definition at line 969 of file CGOpenMPRuntimeGPU.cpp.

References clang::C, getPrivateItem(), clang::CodeGen::CGOpenMPRuntime::getSingleCompoundChild(), clang::isOpenMPDistributeDirective(), and clang::isOpenMPTeamsDirective().

Referenced by clang::CodeGen::CGOpenMPRuntimeGPU::emitTeamsOutlinedFunction().

◆ getReductionAtomicRMWOp()

std::optional< llvm::AtomicRMWInst::BinOp > getReductionAtomicRMWOp ( BinaryOperatorKind BOK,
QualType Ty )
static

Maps a built-in reduction operator to an atomicrmw opcode for the atomic cross-team reduction fast path, or nullopt if there is no direct atomicrmw (e.g.

user-defined, complex, fp min/max) so the buffer path is used instead.

Definition at line 1476 of file CGOpenMPRuntimeGPU.cpp.

References clang::Type::hasSignedIntegerRepresentation(), clang::Type::isFloatingType(), and clang::Type::isIntegerType().

Referenced by clang::CodeGen::CGOpenMPRuntimeGPU::emitReduction().

◆ getReductionBinOpKind()

std::optional< BinaryOperatorKind > getReductionBinOpKind ( const Expr * ReductionOp)
static

Extracts the built-in reduction operator from a combiner of the form x = x / <op> rhs (or the min/max conditional), or nullopt if the shape is not recognized (e.g.

user-defined reductions).

Definition at line 1457 of file CGOpenMPRuntimeGPU.cpp.

References clang::Expr::IgnoreParenImpCasts().

Referenced by clang::CodeGen::CGOpenMPRuntimeGPU::emitReduction().

◆ getTeamsReductionVars()

void getTeamsReductionVars ( ASTContext & Ctx,
const OMPExecutableDirective & D,
llvm::SmallVectorImpl< const ValueDecl * > & Vars )
static

Get list of reduction variables from the teams ... directives.

Definition at line 994 of file CGOpenMPRuntimeGPU.cpp.

References clang::C, getPrivateItem(), and clang::isOpenMPTeamsDirective().

Referenced by clang::CodeGen::CGOpenMPRuntimeGPU::emitTeamsOutlinedFunction().

◆ hasNestedSPMDDirective()

bool hasNestedSPMDDirective ( ASTContext & Ctx,
const OMPExecutableDirective & D )
static

Check for inner (nested) SPMD construct, if any.

Definition at line 518 of file CGOpenMPRuntimeGPU.cpp.

References clang::CodeGen::CGOpenMPRuntime::getSingleCompoundChild(), and clang::isOpenMPParallelDirective().

Referenced by supportsSPMDExecutionMode().

◆ supportsSPMDExecutionMode()

bool supportsSPMDExecutionMode ( ASTContext & Ctx,
const OMPExecutableDirective & D )
static

Definition at line 621 of file CGOpenMPRuntimeGPU.cpp.

References hasNestedSPMDDirective().