MLIR  16.0.0git
Typedefs | Functions | Variables
OpenACCToLLVMIRTranslation.cpp File Reference
#include "mlir/Target/LLVMIR/Dialect/OpenACC/OpenACCToLLVMIRTranslation.h"
#include "mlir/Conversion/OpenACCToLLVM/ConvertOpenACCToLLVM.h"
#include "mlir/Dialect/LLVMIR/LLVMDialect.h"
#include "mlir/Dialect/OpenACC/OpenACC.h"
#include "mlir/IR/BuiltinOps.h"
#include "mlir/IR/Operation.h"
#include "mlir/Support/LLVM.h"
#include "mlir/Target/LLVMIR/ModuleTranslation.h"
#include "llvm/ADT/TypeSwitch.h"
#include "llvm/Frontend/OpenMP/OMPConstants.h"
#include "llvm/Support/FormatVariadic.h"
+ Include dependency graph for OpenACCToLLVMIRTranslation.cpp:

Go to the source code of this file.

Typedefs

using OpenACCIRBuilder = llvm::OpenMPIRBuilder
 

Functions

static llvm::Constant * createSourceLocStrFromLocation (Location loc, OpenACCIRBuilder &builder, StringRef name, uint32_t &strLen)
 Create a constant string location from the MLIR Location information. More...
 
static llvm::Value * createSourceLocationInfo (OpenACCIRBuilder &builder, Operation *op)
 Create the location struct from the operation location information. More...
 
static llvm::Constant * createMappingInformation (Location loc, OpenACCIRBuilder &builder)
 Create a constant string representing the mapping information extracted from the MLIR location information. More...
 
static llvm::Function * getAssociatedFunction (OpenACCIRBuilder &builder, Operation *op)
 Return the runtime function used to lower the given operation. More...
 
static llvm::Value * getSizeInBytes (llvm::IRBuilderBase &builder, llvm::Value *basePtr)
 Computes the size of type in bytes. More...
 
static LogicalResult processOperands (llvm::IRBuilderBase &builder, LLVM::ModuleTranslation &moduleTranslation, Operation *op, ValueRange operands, unsigned totalNbOperand, uint64_t operandFlag, SmallVector< uint64_t > &flags, SmallVectorImpl< llvm::Constant *> &names, unsigned &index, struct OpenACCIRBuilder::MapperAllocas &mapperAllocas)
 Extract pointer, size and mapping information from operands to populate the future functions arguments. More...
 
static LogicalResult processDataOperands (llvm::IRBuilderBase &builder, LLVM::ModuleTranslation &moduleTranslation, acc::EnterDataOp op, SmallVector< uint64_t > &flags, SmallVectorImpl< llvm::Constant *> &names, struct OpenACCIRBuilder::MapperAllocas &mapperAllocas)
 Process data operands from acc::EnterDataOp. More...
 
static LogicalResult processDataOperands (llvm::IRBuilderBase &builder, LLVM::ModuleTranslation &moduleTranslation, acc::ExitDataOp op, SmallVector< uint64_t > &flags, SmallVectorImpl< llvm::Constant *> &names, struct OpenACCIRBuilder::MapperAllocas &mapperAllocas)
 Process data operands from acc::ExitDataOp. More...
 
static LogicalResult processDataOperands (llvm::IRBuilderBase &builder, LLVM::ModuleTranslation &moduleTranslation, acc::UpdateOp op, SmallVector< uint64_t > &flags, SmallVectorImpl< llvm::Constant *> &names, struct OpenACCIRBuilder::MapperAllocas &mapperAllocas)
 Process data operands from acc::UpdateOp. More...
 
static LogicalResult convertDataOp (acc::DataOp &op, llvm::IRBuilderBase &builder, LLVM::ModuleTranslation &moduleTranslation)
 Converts an OpenACC data operation into LLVM IR. More...
 
template<typename OpTy >
static LogicalResult convertStandaloneDataOp (OpTy &op, llvm::IRBuilderBase &builder, LLVM::ModuleTranslation &moduleTranslation)
 Converts an OpenACC standalone data operation into LLVM IR. More...
 

Variables

static constexpr uint64_t kCreateFlag = 0x000
 Flag values are extracted from openmp/libomptarget/include/omptarget.h and mapped to corresponding OpenACC flags. More...
 
static constexpr uint64_t kDeviceCopyinFlag = 0x001
 
static constexpr uint64_t kHostCopyoutFlag = 0x002
 
static constexpr uint64_t kCopyFlag = kDeviceCopyinFlag | kHostCopyoutFlag
 
static constexpr uint64_t kPresentFlag = 0x1000
 
static constexpr uint64_t kDeleteFlag = 0x008
 
static constexpr uint64_t kHoldFlag = 0x2000
 
static constexpr int64_t kDefaultDevice = -1
 Default value for the device id. More...
 

Typedef Documentation

◆ OpenACCIRBuilder

using OpenACCIRBuilder = llvm::OpenMPIRBuilder

Definition at line 29 of file OpenACCToLLVMIRTranslation.cpp.

Function Documentation

◆ convertDataOp()

static LogicalResult convertDataOp ( acc::DataOp &  op,
llvm::IRBuilderBase &  builder,
LLVM::ModuleTranslation moduleTranslation 
)
static

◆ convertStandaloneDataOp()

template<typename OpTy >
static LogicalResult convertStandaloneDataOp ( OpTy &  op,
llvm::IRBuilderBase &  builder,
LLVM::ModuleTranslation moduleTranslation 
)
static

◆ createMappingInformation()

static llvm::Constant* createMappingInformation ( Location  loc,
OpenACCIRBuilder builder 
)
static

Create a constant string representing the mapping information extracted from the MLIR location information.

Definition at line 80 of file OpenACCToLLVMIRTranslation.cpp.

References createSourceLocStrFromLocation(), and mlir::Location::dyn_cast().

Referenced by processOperands().

◆ createSourceLocationInfo()

static llvm::Value* createSourceLocationInfo ( OpenACCIRBuilder builder,
Operation op 
)
static

Create the location struct from the operation location information.

Definition at line 67 of file OpenACCToLLVMIRTranslation.cpp.

References mlir::Constant, createSourceLocStrFromLocation(), mlir::Operation::getLoc(), and mlir::Operation::getParentOfType().

Referenced by convertDataOp(), and convertStandaloneDataOp().

◆ createSourceLocStrFromLocation()

static llvm::Constant* createSourceLocStrFromLocation ( Location  loc,
OpenACCIRBuilder builder,
StringRef  name,
uint32_t &  strLen 
)
static

Create a constant string location from the MLIR Location information.

Definition at line 50 of file OpenACCToLLVMIRTranslation.cpp.

References mlir::Location::dyn_cast().

Referenced by createMappingInformation(), and createSourceLocationInfo().

◆ getAssociatedFunction()

static llvm::Function* getAssociatedFunction ( OpenACCIRBuilder builder,
Operation op 
)
static

Return the runtime function used to lower the given operation.

Definition at line 92 of file OpenACCToLLVMIRTranslation.cpp.

Referenced by convertStandaloneDataOp().

◆ getSizeInBytes()

static llvm::Value* getSizeInBytes ( llvm::IRBuilderBase &  builder,
llvm::Value *  basePtr 
)
static

Computes the size of type in bytes.

Definition at line 111 of file OpenACCToLLVMIRTranslation.cpp.

Referenced by convertArrayType(), mlir::spirv::CompositeType::getSizeInBytes(), isAsyncWithOneDependency(), and processOperands().

◆ processDataOperands() [1/3]

static LogicalResult processDataOperands ( llvm::IRBuilderBase &  builder,
LLVM::ModuleTranslation moduleTranslation,
acc::EnterDataOp  op,
SmallVector< uint64_t > &  flags,
SmallVectorImpl< llvm::Constant *> &  names,
struct OpenACCIRBuilder::MapperAllocas &  mapperAllocas 
)
static

Process data operands from acc::EnterDataOp.

Definition at line 197 of file OpenACCToLLVMIRTranslation.cpp.

References mlir::failed(), mlir::failure(), kCreateFlag, kDeviceCopyinFlag, processOperands(), and mlir::success().

Referenced by convertStandaloneDataOp().

◆ processDataOperands() [2/3]

static LogicalResult processDataOperands ( llvm::IRBuilderBase &  builder,
LLVM::ModuleTranslation moduleTranslation,
acc::ExitDataOp  op,
SmallVector< uint64_t > &  flags,
SmallVectorImpl< llvm::Constant *> &  names,
struct OpenACCIRBuilder::MapperAllocas &  mapperAllocas 
)
static

Process data operands from acc::ExitDataOp.

Definition at line 224 of file OpenACCToLLVMIRTranslation.cpp.

References mlir::failed(), mlir::failure(), kDeleteFlag, kHostCopyoutFlag, processOperands(), and mlir::success().

◆ processDataOperands() [3/3]

static LogicalResult processDataOperands ( llvm::IRBuilderBase &  builder,
LLVM::ModuleTranslation moduleTranslation,
acc::UpdateOp  op,
SmallVector< uint64_t > &  flags,
SmallVectorImpl< llvm::Constant *> &  names,
struct OpenACCIRBuilder::MapperAllocas &  mapperAllocas 
)
static

Process data operands from acc::UpdateOp.

Definition at line 251 of file OpenACCToLLVMIRTranslation.cpp.

References mlir::failed(), mlir::failure(), kDeviceCopyinFlag, kHostCopyoutFlag, processOperands(), and mlir::success().

◆ processOperands()

static LogicalResult processOperands ( llvm::IRBuilderBase &  builder,
LLVM::ModuleTranslation moduleTranslation,
Operation op,
ValueRange  operands,
unsigned  totalNbOperand,
uint64_t  operandFlag,
SmallVector< uint64_t > &  flags,
SmallVectorImpl< llvm::Constant *> &  names,
unsigned index,
struct OpenACCIRBuilder::MapperAllocas &  mapperAllocas 
)
static

Variable Documentation

◆ kCopyFlag

constexpr uint64_t kCopyFlag = kDeviceCopyinFlag | kHostCopyoutFlag
static

Definition at line 40 of file OpenACCToLLVMIRTranslation.cpp.

Referenced by convertDataOp().

◆ kCreateFlag

constexpr uint64_t kCreateFlag = 0x000
static

Flag values are extracted from openmp/libomptarget/include/omptarget.h and mapped to corresponding OpenACC flags.

Definition at line 37 of file OpenACCToLLVMIRTranslation.cpp.

Referenced by convertDataOp(), and processDataOperands().

◆ kDefaultDevice

constexpr int64_t kDefaultDevice = -1
static

Default value for the device id.

Definition at line 47 of file OpenACCToLLVMIRTranslation.cpp.

Referenced by convertDataOp(), and convertStandaloneDataOp().

◆ kDeleteFlag

constexpr uint64_t kDeleteFlag = 0x008
static

Definition at line 42 of file OpenACCToLLVMIRTranslation.cpp.

Referenced by processDataOperands().

◆ kDeviceCopyinFlag

constexpr uint64_t kDeviceCopyinFlag = 0x001
static

Definition at line 38 of file OpenACCToLLVMIRTranslation.cpp.

Referenced by convertDataOp(), and processDataOperands().

◆ kHoldFlag

constexpr uint64_t kHoldFlag = 0x2000
static

Definition at line 44 of file OpenACCToLLVMIRTranslation.cpp.

Referenced by convertDataOp().

◆ kHostCopyoutFlag

constexpr uint64_t kHostCopyoutFlag = 0x002
static

Definition at line 39 of file OpenACCToLLVMIRTranslation.cpp.

Referenced by convertDataOp(), and processDataOperands().

◆ kPresentFlag

constexpr uint64_t kPresentFlag = 0x1000
static

Definition at line 41 of file OpenACCToLLVMIRTranslation.cpp.

Referenced by convertDataOp().