MLIR 23.0.0git
mlir::omp Namespace Reference

Namespaces

namespace  impl

Classes

struct  DeclareTargetDefaultModel
struct  DeviceTypeClauseOps
struct  OffloadModuleDefaultModel
struct  OffloadModuleOpts

Typedefs

using HostEvaluatedOperands
 Clauses that correspond to operations other than omp.target, but might have to be evaluated outside of a parent target region.
using DeclareTargetOperands = detail::Clauses<DeviceTypeClauseOps>
using TargetEnterExitUpdateDataOperands = TargetEnterDataOperands
 omp.target_enter_data, omp.target_exit_data and omp.target_update take the same clauses, so we give the structure to be shared by all of them a representative name.

Functions

std::tuple< NewCliOp, OpOperand *, OpOperand * > decodeCli (mlir::Value cli)
 Find the omp.new_cli, generator, and consumer of a canonical loop info.
static void setOffloadModuleInterfaceAttributes (ModuleOp module, OffloadModuleOpts opts)
 Sets OpenMP offload module interface attributes on a ModuleOp, shared between Flang and Clang (CIR) frontends.
static void setOpenMPVersionAttribute (ModuleOp module, int64_t version)
static int64_t getOpenMPVersionAttribute (ModuleOp module, int64_t fallback=-1)
std::unique_ptr<::mlir::PasscreateMarkDeclareTargetPass ()
std::unique_ptr<::mlir::PasscreatePrepareForOMPOffloadPrivatizationPass ()
std::unique_ptr<::mlir::PasscreateStackToSharedPass ()
void registerMarkDeclareTargetPass ()
void registerMarkDeclareTargetPassPass ()
void registerPrepareForOMPOffloadPrivatizationPass ()
void registerPrepareForOMPOffloadPrivatizationPassPass ()
void registerStackToSharedPass ()
void registerStackToSharedPassPass ()
void registerOpenMPPasses ()
bool allocaUsesRequireSharedMem (Value alloc)
 Check whether the value representing an allocation, assumed to have been defined in a shared device context, is used in a manner that would require device shared memory for correctness.
bool opInSharedDeviceContext (Operation &op)
 Check whether the given operation is located in a context where an allocation to be used by multiple threads in a parallel region would have to be placed in device shared memory to be accessible.

Typedef Documentation

◆ DeclareTargetOperands

Definition at line 47 of file OpenMPClauseOperands.h.

◆ HostEvaluatedOperands

Initial value:
detail::Clauses<CollapseClauseOps, LoopRelatedClauseOps, NumTeamsClauseOps,
NumThreadsClauseOps, ThreadLimitClauseOps>

Clauses that correspond to operations other than omp.target, but might have to be evaluated outside of a parent target region.

Definition at line 42 of file OpenMPClauseOperands.h.

◆ TargetEnterExitUpdateDataOperands

using mlir::omp::TargetEnterExitUpdateDataOperands = TargetEnterDataOperands

omp.target_enter_data, omp.target_exit_data and omp.target_update take the same clauses, so we give the structure to be shared by all of them a representative name.

Definition at line 52 of file OpenMPClauseOperands.h.

Function Documentation

◆ allocaUsesRequireSharedMem()

bool mlir::omp::allocaUsesRequireSharedMem ( Value alloc)

Check whether the value representing an allocation, assumed to have been defined in a shared device context, is used in a manner that would require device shared memory for correctness.

When a use takes place inside an omp.parallel region and it's not as a private clause argument, or when it is a reduction argument passed to omp.parallel or a function call argument, then the defining allocation is eligible for replacement with shared memory.

See also
mlir::omp::opInSharedDeviceContext().

Definition at line 51 of file Utils.cpp.

References allocaUseRequiresSharedMem(), mlir::Operation::getResults(), mlir::Value::getUses(), and result.

Referenced by allocatePrivateVars(), cleanupPrivateVars(), and createDeviceArgumentAccessor().

◆ createMarkDeclareTargetPass()

std::unique_ptr<::mlir::Pass > mlir::omp::createMarkDeclareTargetPass ( )

We declare an explicit private instantiation because Pass classes should only be visible by the current library.

Definition at line 81 of file MarkDeclareTarget.cpp.

◆ createPrepareForOMPOffloadPrivatizationPass()

std::unique_ptr<::mlir::Pass > mlir::omp::createPrepareForOMPOffloadPrivatizationPass ( )

We declare an explicit private instantiation because Pass classes should only be visible by the current library.

Definition at line 156 of file OpenMPOffloadPrivatizationPrepare.cpp.

References mlir::Operation::user_begin(), and mlir::Operation::user_end().

◆ createStackToSharedPass()

std::unique_ptr<::mlir::Pass > mlir::omp::createStackToSharedPass ( )

We declare an explicit private instantiation because Pass classes should only be visible by the current library.

Definition at line 231 of file StackToShared.cpp.

◆ decodeCli()

std::tuple< NewCliOp, OpOperand *, OpOperand * > mlir::omp::decodeCli ( mlir::Value cli)

Find the omp.new_cli, generator, and consumer of a canonical loop info.

Definition at line 3844 of file OpenMPDialect.cpp.

References mlir::Value::getContext(), mlir::Value::getDefiningOp(), mlir::Value::getType(), and mlir::Value::getUses().

Referenced by checkApplyeesNesting().

◆ getOpenMPVersionAttribute()

int64_t mlir::omp::getOpenMPVersionAttribute ( ModuleOp module,
int64_t fallback = -1 )
static

Definition at line 97 of file OpenMPOffloadUtils.h.

◆ opInSharedDeviceContext()

bool mlir::omp::opInSharedDeviceContext ( Operation & op)

Check whether the given operation is located in a context where an allocation to be used by multiple threads in a parallel region would have to be placed in device shared memory to be accessible.

That means that it is inside of a target device module, it is a non-SPMD target region, is inside of one or it's located in a device function, and it is not not inside of a parallel region.

This represents a necessary but not sufficient set of conditions to use device shared memory in place of regular allocas. For some variables, the associated OpenMP construct or their uses might also need to be taken into account.

See also
mlir::omp::allocaUsesRequireSharedMem().

Definition at line 66 of file Utils.cpp.

References mlir::Operation::getParentOfType().

Referenced by allocatePrivateVars(), allocReductionVars(), cleanupPrivateVars(), createDeviceArgumentAccessor(), createReductionsAndCleanup(), and shouldReplaceAllocaWithDeviceSharedMem().

◆ registerMarkDeclareTargetPass()

void mlir::omp::registerMarkDeclareTargetPass ( )
inline

Definition at line 248 of file Passes.h.

◆ registerMarkDeclareTargetPassPass()

void mlir::omp::registerMarkDeclareTargetPassPass ( )
inline

Definition at line 255 of file Passes.h.

◆ registerOpenMPPasses()

void mlir::omp::registerOpenMPPasses ( )
inline

Definition at line 311 of file Passes.h.

Referenced by mlir::registerAllPasses().

◆ registerPrepareForOMPOffloadPrivatizationPass()

void mlir::omp::registerPrepareForOMPOffloadPrivatizationPass ( )
inline

Definition at line 269 of file Passes.h.

◆ registerPrepareForOMPOffloadPrivatizationPassPass()

void mlir::omp::registerPrepareForOMPOffloadPrivatizationPassPass ( )
inline

Definition at line 276 of file Passes.h.

◆ registerStackToSharedPass()

void mlir::omp::registerStackToSharedPass ( )
inline

Definition at line 290 of file Passes.h.

◆ registerStackToSharedPassPass()

void mlir::omp::registerStackToSharedPassPass ( )
inline

Definition at line 297 of file Passes.h.

◆ setOffloadModuleInterfaceAttributes()

◆ setOpenMPVersionAttribute()

void mlir::omp::setOpenMPVersionAttribute ( ModuleOp module,
int64_t version )
static

Definition at line 89 of file OpenMPOffloadUtils.h.