MLIR  16.0.0git
Namespaces | Macros | Functions
TensorCopyInsertion.cpp File Reference
#include "mlir/Dialect/Bufferization/Transforms/Passes.h"
#include "mlir/Dialect/Bufferization/IR/BufferizableOpInterface.h"
#include "mlir/Dialect/Bufferization/IR/Bufferization.h"
#include "mlir/Dialect/Bufferization/Transforms/Bufferize.h"
#include "mlir/Dialect/Bufferization/Transforms/OneShotAnalysis.h"
#include "mlir/Dialect/Bufferization/Transforms/OneShotModuleBufferize.h"
#include "mlir/Dialect/Bufferization/Transforms/TensorCopyInsertion.h"
#include "mlir/Dialect/Func/IR/FuncOps.h"
#include "mlir/Dialect/Bufferization/Transforms/Passes.h.inc"
+ Include dependency graph for TensorCopyInsertion.cpp:

Go to the source code of this file.

Namespaces

 mlir
 Include the generated interface declarations.
 
 mlir::bufferization
 

Macros

#define GEN_PASS_DEF_TENSORCOPYINSERTION
 

Functions

static void resolveUsesInRepetitiveRegions (Operation *op, const BufferizationOptions &options)
 Resolve all operands that are also used inside of repetitive regions of the same op. More...
 

Macro Definition Documentation

◆ GEN_PASS_DEF_TENSORCOPYINSERTION

#define GEN_PASS_DEF_TENSORCOPYINSERTION

Definition at line 21 of file TensorCopyInsertion.cpp.

Function Documentation

◆ resolveUsesInRepetitiveRegions()

static void resolveUsesInRepetitiveRegions ( Operation op,
const BufferizationOptions options 
)
static

Resolve all operands that are also used inside of repetitive regions of the same op.

Such cases are not fully supported by One-Shot Bufferize.

E.g.: r = scf.for ... iter_args(t = tensor) -> tensor<?xf32> { "some_use"(tensor) ... }

Is converted to: tensor_copy = bufferization.alloc_tensor copy(tensor) r = scf.for ... iter_args(t = tensor) -> tensor<?xf32> { "some_use"(tensor_copy) ... }

Definition at line 45 of file TensorCopyInsertion.cpp.

References mlir::WalkResult::advance(), mlir::Type::cast(), mlir::Operation::getContext(), mlir::Value::getType(), mlir::Value::getUses(), mlir::Type::isa(), mlir::bufferization::BufferizationOptions::isOpAllowed(), and mlir::Operation::walk().

Referenced by mlir::bufferization::insertTensorCopies().