MLIR  15.0.0git
Macros | Functions
Promotion.cpp File Reference
#include "PassDetail.h"
#include "mlir/Dialect/Arithmetic/IR/Arithmetic.h"
#include "mlir/Dialect/Complex/IR/Complex.h"
#include "mlir/Dialect/Linalg/IR/Linalg.h"
#include "mlir/Dialect/Linalg/Passes.h"
#include "mlir/Dialect/Linalg/Transforms/Transforms.h"
#include "mlir/Dialect/Linalg/Utils/Utils.h"
#include "mlir/Dialect/SCF/IR/SCF.h"
#include "mlir/IR/AffineExpr.h"
#include "mlir/IR/AffineExprVisitor.h"
#include "mlir/IR/AffineMap.h"
#include "mlir/IR/ImplicitLocOpBuilder.h"
#include "mlir/Support/LLVM.h"
#include "mlir/Transforms/FoldUtils.h"
#include "llvm/ADT/MapVector.h"
#include "llvm/ADT/SmallBitVector.h"
#include "llvm/ADT/TypeSwitch.h"
#include "llvm/Support/CommandLine.h"
#include "llvm/Support/Debug.h"
+ Include dependency graph for Promotion.cpp:

Go to the source code of this file.

Macros

#define DEBUG_TYPE   "linalg-promotion"
 

Functions

static Value allocBuffer (ImplicitLocOpBuilder &b, const LinalgPromotionOptions &options, Type elementType, Value allocSize, DataLayout &layout, Optional< unsigned > alignment=None)
 Alloc a new buffer of size * width i8; where width is given by the data layout for elementType. More...
 
static Optional< ValuedefaultAllocBufferCallBack (const LinalgPromotionOptions &options, OpBuilder &builder, memref::SubViewOp subView, ArrayRef< Value > boundingSubViewSize, Optional< unsigned > alignment, DataLayout &layout)
 Default allocation callback function. More...
 
static LogicalResult defaultDeallocBufferCallBack (const LinalgPromotionOptions &options, OpBuilder &b, Value fullLocalView)
 Default implementation of deallocation of the buffer use for promotion. More...
 
static FailureOr< MapVector< int64_t, PromotionInfo > > promoteSubViews (ImplicitLocOpBuilder &b, LinalgOpInstancePromotionOptions options, DataLayout &layout)
 
static FailureOr< LinalgOp > promoteSubViews (ImplicitLocOpBuilder &b, LinalgOp op, LinalgOpInstancePromotionOptions options, DataLayout &layout)
 

Macro Definition Documentation

◆ DEBUG_TYPE

#define DEBUG_TYPE   "linalg-promotion"

Definition at line 39 of file Promotion.cpp.

Function Documentation

◆ allocBuffer()

static Value allocBuffer ( ImplicitLocOpBuilder b,
const LinalgPromotionOptions options,
Type  elementType,
Value  allocSize,
DataLayout layout,
Optional< unsigned alignment = None 
)
static

Alloc a new buffer of size * width i8; where width is given by the data layout for elementType.

Use AllocOp or AllocaOp depending on options. Take an optional alignment.

Definition at line 45 of file Promotion.cpp.

References mlir::ImplicitLocOpBuilder::create(), mlir::ImplicitLocOpBuilder::createOrFold(), mlir::Value::getDefiningOp(), mlir::Builder::getI64IntegerAttr(), mlir::Builder::getIntegerType(), mlir::DataLayout::getTypeSize(), and mlir::linalg::LinalgPromotionOptions::useAlloca.

Referenced by defaultAllocBufferCallBack().

◆ defaultAllocBufferCallBack()

static Optional<Value> defaultAllocBufferCallBack ( const LinalgPromotionOptions options,
OpBuilder builder,
memref::SubViewOp  subView,
ArrayRef< Value boundingSubViewSize,
Optional< unsigned alignment,
DataLayout layout 
)
static

Default allocation callback function.

This allocates a promoted buffer when no call back to do so is provided. The default is to allocate a memref<..xi8> and return a view to get a memref type of shape boundingSubViewSize.

Definition at line 81 of file Promotion.cpp.

References allocBuffer(), mlir::ImplicitLocOpBuilder::createOrFold(), and mlir::detail::enumerate().

Referenced by defaultDeallocBufferCallBack().

◆ defaultDeallocBufferCallBack()

static LogicalResult defaultDeallocBufferCallBack ( const LinalgPromotionOptions options,
OpBuilder b,
Value  fullLocalView 
)
static

◆ promoteSubViews() [1/2]

static FailureOr<MapVector<int64_t, PromotionInfo> > promoteSubViews ( ImplicitLocOpBuilder b,
LinalgOpInstancePromotionOptions  options,
DataLayout layout 
)
static

◆ promoteSubViews() [2/2]

static FailureOr<LinalgOp> promoteSubViews ( ImplicitLocOpBuilder b,
LinalgOp  op,
LinalgOpInstancePromotionOptions  options,
DataLayout layout 
)
static