MLIR  20.0.0git
Functions
GPUOpsLowering.cpp File Reference
#include "GPUOpsLowering.h"
#include "mlir/Conversion/GPUCommon/GPUCommonPass.h"
#include "mlir/Dialect/LLVMIR/LLVMDialect.h"
#include "mlir/IR/Attributes.h"
#include "mlir/IR/Builders.h"
#include "mlir/IR/BuiltinTypes.h"
#include "llvm/ADT/SmallVectorExtras.h"
#include "llvm/ADT/StringSet.h"
#include "llvm/Support/FormatVariadic.h"

Go to the source code of this file.

Functions

static SmallString< 16 > getUniqueFormatGlobalName (gpu::GPUModuleOp moduleOp)
 
static LLVM::GlobalOp getOrCreateFormatStringConstant (OpBuilder &b, Location loc, gpu::GPUModuleOp moduleOp, Type llvmI8, StringRef str, uint64_t alignment=0, unsigned addrSpace=0)
 Create an global that contains the given format string. More...
 
template<typename T >
static LLVM::LLVMFuncOp getOrDefineFunction (T &moduleOp, const Location loc, ConversionPatternRewriter &rewriter, StringRef name, LLVM::LLVMFunctionType type)
 
static IntegerAttr wrapNumericMemorySpace (MLIRContext *ctx, unsigned space)
 
LLVM::GlobalOp getDynamicSharedMemorySymbol (ConversionPatternRewriter &rewriter, gpu::GPUModuleOp moduleOp, gpu::DynamicSharedMemoryOp op, const LLVMTypeConverter *typeConverter, MemRefType memrefType, unsigned alignmentBit)
 Generates a symbol with 0-sized array type for dynamic shared memory usage, or uses existing symbol. More...
 

Function Documentation

◆ getDynamicSharedMemorySymbol()

LLVM::GlobalOp getDynamicSharedMemorySymbol ( ConversionPatternRewriter rewriter,
gpu::GPUModuleOp  moduleOp,
gpu::DynamicSharedMemoryOp  op,
const LLVMTypeConverter typeConverter,
MemRefType  memrefType,
unsigned  alignmentBit 
)

Generates a symbol with 0-sized array type for dynamic shared memory usage, or uses existing symbol.

Definition at line 637 of file GPUOpsLowering.cpp.

References mlir::LLVMTypeConverter::convertType(), mlir::OpBuilder::create(), mlir::get(), mlir::LLVMTypeConverter::getMemRefAddressSpace(), and mlir::OpBuilder::setInsertionPointToStart().

Referenced by mlir::GPUDynamicSharedMemoryOpLowering::matchAndRewrite().

◆ getOrCreateFormatStringConstant()

static LLVM::GlobalOp getOrCreateFormatStringConstant ( OpBuilder b,
Location  loc,
gpu::GPUModuleOp  moduleOp,
Type  llvmI8,
StringRef  str,
uint64_t  alignment = 0,
unsigned  addrSpace = 0 
)
static

Create an global that contains the given format string.

If a global with the same format string exists already in the module, return that global.

Definition at line 345 of file GPUOpsLowering.cpp.

References mlir::OpBuilder::create(), mlir::get(), mlir::Builder::getStringAttr(), getUniqueFormatGlobalName(), and mlir::OpBuilder::setInsertionPointToStart().

Referenced by mlir::GPUPrintfOpToHIPLowering::matchAndRewrite(), mlir::GPUPrintfOpToLLVMCallLowering::matchAndRewrite(), and mlir::GPUPrintfOpToVPrintfLowering::matchAndRewrite().

◆ getOrDefineFunction()

template<typename T >
static LLVM::LLVMFuncOp getOrDefineFunction ( T &  moduleOp,
const Location  loc,
ConversionPatternRewriter rewriter,
StringRef  name,
LLVM::LLVMFunctionType  type 
)
static

◆ getUniqueFormatGlobalName()

static SmallString<16> getUniqueFormatGlobalName ( gpu::GPUModuleOp  moduleOp)
static

Definition at line 331 of file GPUOpsLowering.cpp.

Referenced by getOrCreateFormatStringConstant().

◆ wrapNumericMemorySpace()

static IntegerAttr wrapNumericMemorySpace ( MLIRContext ctx,
unsigned  space 
)
static

Definition at line 631 of file GPUOpsLowering.cpp.

References mlir::get().

Referenced by mlir::populateGpuMemorySpaceAttributeConversions().