#include "mlir/Dialect/Bufferization/IR/BufferizableOpInterface.h"
#include "mlir/Dialect/Bufferization/IR/Bufferization.h"
#include "mlir/Dialect/Func/IR/FuncOps.h"
#include "mlir/Dialect/MemRef/IR/MemRef.h"
#include "mlir/Dialect/Tensor/IR/Tensor.h"
#include "mlir/IR/AsmState.h"
#include "mlir/IR/BuiltinOps.h"
#include "mlir/IR/IRMapping.h"
#include "mlir/IR/Operation.h"
#include "mlir/IR/TypeUtilities.h"
#include "mlir/IR/Value.h"
#include "mlir/Interfaces/ControlFlowInterfaces.h"
#include "mlir/Interfaces/FunctionInterfaces.h"
#include "llvm/ADT/ScopeExit.h"
#include "llvm/Support/Debug.h"
namespace mlir {
namespace bufferization {
#include "mlir/Dialect/Bufferization/IR/BufferizableOpInterface.cpp.inc"
}
}
MLIR_DEFINE_EXPLICIT_TYPE_ID(mlir::bufferization::AnalysisState)
#define DEBUG_TYPE …
#define DBGS() …
#define LDBG(X) …
usingnamespacemlir;
usingnamespacebufferization;
static bool isRepetitiveRegion(Region *region,
const BufferizationOptions &options) { … }
Region *AnalysisState::getEnclosingRepetitiveRegion(
Operation *op, const BufferizationOptions &options) { … }
Region *AnalysisState::getEnclosingRepetitiveRegion(
Value value, const BufferizationOptions &options) { … }
Region *AnalysisState::getEnclosingRepetitiveRegion(
Block *block, const BufferizationOptions &options) { … }
void AnalysisState::resetCache() { … }
Region *bufferization::getNextEnclosingRepetitiveRegion(
Region *region, const BufferizationOptions &options) { … }
Region *bufferization::getParallelRegion(Region *region,
const BufferizationOptions &options) { … }
Operation *bufferization::getOwnerOfValue(Value value) { … }
FailureOr<Value> bufferization::allocateTensorForShapedValue(
OpBuilder &b, Location loc, Value shapedValue,
const BufferizationOptions &options, bool copy) { … }
LogicalResult BufferizableOpInterface::resolveTensorOpOperandConflicts(
RewriterBase &rewriter, const AnalysisState &state) { … }
bool OpFilter::isOpAllowed(Operation *op) const { … }
namespace {
BaseMemRefType
defaultFunctionArgTypeConverter(TensorType type, Attribute memorySpace,
FunctionOpInterface funcOp,
const BufferizationOptions &options) { … }
BaseMemRefType
defaultUnknownTypeConverter(Value value, Attribute memorySpace,
const BufferizationOptions &options) { … }
}
BufferizationOptions::BufferizationOptions()
: … { … }
bool BufferizationOptions::isOpAllowed(Operation *op) const { … }
BufferizableOpInterface
BufferizationOptions::dynCastBufferizableOp(Operation *op) const { … }
BufferizableOpInterface
BufferizationOptions::dynCastBufferizableOp(Value value) const { … }
void BufferizationOptions::setFunctionBoundaryTypeConversion(
LayoutMapOption layoutMapOption) { … }
static void setInsertionPointAfter(OpBuilder &b, Value value) { … }
AliasingOpOperandList AnalysisState::getAliasingOpOperands(Value value) const { … }
AliasingValueList AnalysisState::getAliasingValues(OpOperand &opOperand) const { … }
bool AnalysisState::bufferizesToMemoryRead(OpOperand &opOperand) const { … }
bool AnalysisState::bufferizesToMemoryWrite(OpOperand &opOperand) const { … }
bool AnalysisState::bufferizesToAliasOnly(OpOperand &opOperand) const { … }
bool AnalysisState::bufferizesToMemoryWrite(Value value) const { … }
bool AnalysisState::isValueRead(Value value) const { … }
llvm::SetVector<Value> AnalysisState::findValueInReverseUseDefChain(
Value value, llvm::function_ref<bool(Value)> condition,
TraversalConfig config) const { … }
llvm::SetVector<Value> AnalysisState::findDefinitions(Value value) const { … }
AnalysisState::AnalysisState(const BufferizationOptions &options)
: … { … }
AnalysisState::AnalysisState(const BufferizationOptions &options, TypeID type)
: … { … }
bool AnalysisState::canOmitTensorCopy(OpOperand &opOperand) const { … }
bool AnalysisState::isInPlace(OpOperand &opOperand) const { … }
bool AnalysisState::areEquivalentBufferizedValues(Value v1, Value v2) const { … }
bool AnalysisState::areAliasingBufferizedValues(Value v1, Value v2) const { … }
bool AnalysisState::hasUndefinedContents(OpOperand *opOperand) const { … }
static void ensureToMemrefOpIsValid(Value tensor, Type memrefType) { … }
FailureOr<Value> bufferization::getBuffer(RewriterBase &rewriter, Value value,
const BufferizationOptions &options) { … }
FailureOr<BaseMemRefType>
bufferization::getBufferType(Value value, const BufferizationOptions &options) { … }
FailureOr<BaseMemRefType>
bufferization::getBufferType(Value value, const BufferizationOptions &options,
SmallVector<Value> &invocationStack) { … }
bool bufferization::hasTensorSemantics(Operation *op) { … }
void bufferization::replaceOpWithBufferizedValues(RewriterBase &rewriter,
Operation *op,
ValueRange values) { … }
FailureOr<Value> BufferizationOptions::createAlloc(OpBuilder &b, Location loc,
MemRefType type,
ValueRange dynShape) const { … }
LogicalResult BufferizationOptions::createMemCpy(OpBuilder &b, Location loc,
Value from, Value to) const { … }
BaseMemRefType bufferization::getMemRefType(Value value,
const BufferizationOptions &options,
MemRefLayoutAttrInterface layout,
Attribute memorySpace) { … }
BaseMemRefType
bufferization::getMemRefTypeWithFullyDynamicLayout(TensorType tensorType,
Attribute memorySpace) { … }
BaseMemRefType
bufferization::getMemRefTypeWithStaticIdentityLayout(TensorType tensorType,
Attribute memorySpace) { … }
bool bufferization::detail::defaultResultBufferizesToMemoryWrite(
OpResult opResult, const AnalysisState &state) { … }
AliasingOpOperandList bufferization::detail::defaultGetAliasingOpOperands(
Value value, const AnalysisState &state) { … }
FailureOr<BaseMemRefType> bufferization::detail::defaultGetBufferType(
Value value, const BufferizationOptions &options,
SmallVector<Value> &invocationStack) { … }
bool bufferization::detail::defaultIsRepetitiveRegion(
BufferizableOpInterface bufferizableOp, unsigned index) { … }
AliasingOpOperandList
bufferization::detail::unknownGetAliasingOpOperands(Value value) { … }
AliasingValueList
bufferization::detail::unknownGetAliasingValues(OpOperand &opOperand) { … }
bool bufferization::detail::defaultHasTensorSemantics(Operation *op) { … }