MLIR 23.0.0git
MultiBuffer.cpp File Reference
#include "mlir/Dialect/Affine/IR/AffineOps.h"
#include "mlir/Dialect/Arith/Utils/Utils.h"
#include "mlir/Dialect/MemRef/IR/MemRef.h"
#include "mlir/Dialect/MemRef/Transforms/Transforms.h"
#include "mlir/IR/AffineExpr.h"
#include "mlir/IR/BuiltinAttributes.h"
#include "mlir/IR/Dominance.h"
#include "mlir/IR/PatternMatch.h"
#include "mlir/IR/ValueRange.h"
#include "mlir/Interfaces/LoopLikeInterface.h"
#include "llvm/ADT/STLExtras.h"
#include "llvm/ADT/TypeSwitch.h"
#include "llvm/Support/Debug.h"

Go to the source code of this file.

Macros

#define DEBUG_TYPE   "memref-transforms"
#define DBGS()
#define DBGSNL()

Functions

static bool overrideBuffer (Operation *op, Value buffer)
 Return true if the op fully overwrite the given buffer value.
static LogicalResult replaceUsesAndPropagateType (RewriterBase &rewriter, Operation *oldOp, Value val)
 Replace the uses of oldOp with the given val and for view-like uses propagate the type change.

Macro Definition Documentation

◆ DBGS

#define DBGS ( )
Value:
(llvm::dbgs() << "[" DEBUG_TYPE "]: ")
#define DEBUG_TYPE

Definition at line 30 of file MultiBuffer.cpp.

Referenced by mlir::memref::multiBuffer().

◆ DBGSNL

#define DBGSNL ( )
Value:
(llvm::dbgs() << "\n")

Definition at line 31 of file MultiBuffer.cpp.

◆ DEBUG_TYPE

#define DEBUG_TYPE   "memref-transforms"

Definition at line 29 of file MultiBuffer.cpp.

Function Documentation

◆ overrideBuffer()

bool overrideBuffer ( Operation * op,
Value buffer )
static

Return true if the op fully overwrite the given buffer value.

Definition at line 34 of file MultiBuffer.cpp.

Referenced by mlir::memref::multiBuffer().

◆ replaceUsesAndPropagateType()

LogicalResult replaceUsesAndPropagateType ( RewriterBase & rewriter,
Operation * oldOp,
Value val )
static

Replace the uses of oldOp with the given val and for view-like uses propagate the type change.

Changing the memref type may require propagating it through view-like ops (subview, expand_shape, collapse_shape, cast) so we need to propagate the type change and erase old view ops.

Only view-like ops whose result type can be recomputed from the new source type and existing op attributes are handled here. Other ops fall back to operand replacement without type propagation.

Definition at line 49 of file MultiBuffer.cpp.

References mlir::Operation::emitOpError(), mlir::RewriterBase::eraseOp(), mlir::RewriterBase::finalizeOpModification(), mlir::Builder::getType(), mlir::Value::getType(), mlir::Operation::getUses(), replacement(), replaceUsesAndPropagateType(), mlir::OpBuilder::setInsertionPoint(), mlir::RewriterBase::startOpModification(), and success().

Referenced by mlir::memref::multiBuffer(), and replaceUsesAndPropagateType().