MLIR 23.0.0git
StackToShared.cpp File Reference
#include "mlir/Dialect/OpenMP/Transforms/Passes.h"
#include "mlir/Dialect/LLVMIR/LLVMDialect.h"
#include "mlir/Dialect/OpenMP/OpenMPDialect.h"
#include "mlir/Dialect/OpenMP/Utils/Utils.h"
#include "mlir/Pass/Pass.h"
#include "llvm/ADT/STLExtras.h"
#include "mlir/Dialect/OpenMP/Transforms/Passes.h.inc"

Go to the source code of this file.

Classes

class  mlir::omp::impl::StackToSharedPassBase< DerivedT >

Namespaces

namespace  mlir
 Include the generated interface declarations.
namespace  mlir::omp
namespace  mlir::omp::impl

Macros

#define GEN_PASS_DEF_STACKTOSHAREDPASS
#define GEN_PASS_DECL_MARKDECLARETARGETPASS
#define GEN_PASS_DECL_PREPAREFOROMPOFFLOADPRIVATIZATIONPASS
#define GEN_PASS_DECL_STACKTOSHAREDPASS
#define GEN_PASS_REGISTRATION_MARKDECLARETARGETPASS
#define GEN_PASS_REGISTRATION_PREPAREFOROMPOFFLOADPRIVATIZATIONPASS
#define GEN_PASS_REGISTRATION_STACKTOSHAREDPASS

Functions

std::unique_ptr<::mlir::Passmlir::omp::createMarkDeclareTargetPass ()
std::unique_ptr<::mlir::Passmlir::omp::createPrepareForOMPOffloadPrivatizationPass ()
std::unique_ptr<::mlir::Passmlir::omp::createStackToSharedPass ()
std::unique_ptr<::mlir::Passmlir::omp::impl::createStackToSharedPass ()
void mlir::omp::registerMarkDeclareTargetPass ()
void mlir::omp::registerMarkDeclareTargetPassPass ()
void mlir::omp::registerPrepareForOMPOffloadPrivatizationPass ()
void mlir::omp::registerPrepareForOMPOffloadPrivatizationPassPass ()
void mlir::omp::registerStackToSharedPass ()
void mlir::omp::registerStackToSharedPassPass ()
void mlir::omp::registerOpenMPPasses ()
static bool shouldReplaceAllocaWithDeviceSharedMem (Operation &op)
 Tell whether to replace an operation representing a stack allocation with a device shared memory allocation/deallocation pair based on the location of the allocation and its uses.
static void insertDeviceSharedMemDeallocation (OpBuilder &builder, TypeAttr elemType, Value arraySize, IntegerAttr alignment, Value allocVal)
 Based on the location of the definition of the given value representing the result of a device shared memory allocation, find the corresponding points where its deallocation should be placed and introduce omp.free_shared_mem ops at those points.

Macro Definition Documentation

◆ GEN_PASS_DECL_MARKDECLARETARGETPASS

#define GEN_PASS_DECL_MARKDECLARETARGETPASS

◆ GEN_PASS_DECL_PREPAREFOROMPOFFLOADPRIVATIZATIONPASS

#define GEN_PASS_DECL_PREPAREFOROMPOFFLOADPRIVATIZATIONPASS

◆ GEN_PASS_DECL_STACKTOSHAREDPASS

#define GEN_PASS_DECL_STACKTOSHAREDPASS

◆ GEN_PASS_DEF_STACKTOSHAREDPASS

#define GEN_PASS_DEF_STACKTOSHAREDPASS

Definition at line 24 of file StackToShared.cpp.

◆ GEN_PASS_REGISTRATION_MARKDECLARETARGETPASS

#define GEN_PASS_REGISTRATION_MARKDECLARETARGETPASS

◆ GEN_PASS_REGISTRATION_PREPAREFOROMPOFFLOADPRIVATIZATIONPASS

#define GEN_PASS_REGISTRATION_PREPAREFOROMPOFFLOADPRIVATIZATIONPASS

◆ GEN_PASS_REGISTRATION_STACKTOSHAREDPASS

#define GEN_PASS_REGISTRATION_STACKTOSHAREDPASS

Function Documentation

◆ insertDeviceSharedMemDeallocation()

void insertDeviceSharedMemDeallocation ( OpBuilder & builder,
TypeAttr elemType,
Value arraySize,
IntegerAttr alignment,
Value allocVal )
static

Based on the location of the definition of the given value representing the result of a device shared memory allocation, find the corresponding points where its deallocation should be placed and introduce omp.free_shared_mem ops at those points.

Definition at line 45 of file StackToShared.cpp.

References mlir::DominanceInfo::dominates(), mlir::Region::getBlocks(), mlir::Value::getLoc(), mlir::Value::getParentBlock(), mlir::Value::getParentRegion(), mlir::Operation::hasSuccessors(), and mlir::OpBuilder::setInsertionPoint().

◆ shouldReplaceAllocaWithDeviceSharedMem()

bool shouldReplaceAllocaWithDeviceSharedMem ( Operation & op)
static

Tell whether to replace an operation representing a stack allocation with a device shared memory allocation/deallocation pair based on the location of the allocation and its uses.

Definition at line 34 of file StackToShared.cpp.

References mlir::Operation::getResults(), mlir::omp::opInSharedDeviceContext(), and result.