37void transform::BufferLoopHoistingOp::getEffects(
47LogicalResult transform::OneShotBufferizeOp::verify() {
48 if (getMemcpyOp() !=
"memref.copy" && getMemcpyOp() !=
"linalg.copy")
50 if (getPrintConflicts() && !getTestAnalysisOnly())
51 return emitOpError() <<
"'print_conflicts' requires 'test_analysis_only'";
52 if (getDumpAliasSets() && !getTestAnalysisOnly())
53 return emitOpError() <<
"'dump_alias_sets' requires 'test_analysis_only'";
62 options.allowReturnAllocsFromLoops = getAllowReturnAllocsFromLoops();
63 options.allowUnknownOps = getAllowUnknownOps();
64 options.bufferizeFunctionBoundaries = getBufferizeFunctionBoundaries();
65 options.dumpAliasSets = getDumpAliasSets();
66 options.testAnalysisOnly = getTestAnalysisOnly();
67 options.printConflicts = getPrintConflicts();
68 if (getFunctionBoundaryTypeConversion().has_value())
69 options.setFunctionBoundaryTypeConversion(
70 *getFunctionBoundaryTypeConversion());
71 if (getMemcpyOp() ==
"memref.copy") {
73 memref::CopyOp::create(
b, loc, from, to);
76 }
else if (getMemcpyOp() ==
"linalg.copy") {
78 linalg::CopyOp::create(
b, loc, from, to);
82 llvm_unreachable(
"invalid copy op");
86 BufferizationState bufferizationState;
89 if (!isa<ModuleOp, FunctionOpInterface>(
target))
90 return emitSilenceableError() <<
"expected module or function target";
91 auto moduleOp = dyn_cast<ModuleOp>(
target);
92 if (
options.bufferizeFunctionBoundaries) {
94 return emitSilenceableError() <<
"expected module target";
97 return emitSilenceableError() <<
"bufferization failed";
100 bufferizationState)))
101 return emitSilenceableError() <<
"bufferization failed";
107 transformResults.
set(cast<OpResult>(getTransformed()), payloadOps);
115void transform::EliminateEmptyTensorsOp::getEffects(
127 <<
"empty tensor elimination failed";
153class BufferizationTransformDialectExtension
155 BufferizationTransformDialectExtension> {
158 BufferizationTransformDialectExtension)
163 declareGeneratedDialect<bufferization::BufferizationDialect>();
164 declareGeneratedDialect<memref::MemRefDialect>();
166 registerTransformOps<
168#include "mlir/Dialect/Bufferization/TransformOps/BufferizationTransformOps.cpp.inc"
175#define GET_OP_CLASSES
176#include "mlir/Dialect/Bufferization/TransformOps/BufferizationTransformOps.cpp.inc"
178#include "mlir/Dialect/Bufferization/IR/BufferizationEnums.cpp.inc"
182 registry.
addExtensions<BufferizationTransformDialectExtension>();
p<< " : "<< getMemRefType()<< ", "<< getType();}static LogicalResult verifyVectorMemoryOp(Operation *op, MemRefType memrefType, VectorType vectorType) { if(memrefType.getElementType() !=vectorType.getElementType()) return op-> emitOpError("requires memref and vector types of the same elemental type")
Given a list of lists of parsed operands, populates uniqueOperands with unique operands.
static llvm::ManagedStatic< PassManagerOptions > options
#define MLIR_DEFINE_EXPLICIT_INTERNAL_INLINE_TYPE_ID(CLASS_NAME)
The result of a transform IR operation application.
static DiagnosedSilenceableFailure success()
Constructs a DiagnosedSilenceableFailure in the success state.
The DialectRegistry maps a dialect namespace to a constructor for the matching dialect.
void addExtensions()
Add the given extensions to the registry.
This class defines the main interface for locations in MLIR and acts as a non-nullable wrapper around...
This class helps build Operations.
void setInsertionPoint(Block *block, Block::iterator insertPoint)
Set the insertion point to the specified location.
Operation is the basic unit of execution within MLIR.
OpTy replaceOpWithNewOp(Operation *op, Args &&...args)
Replace the results of the given (original) op with a new op that is created without verification (re...
This class represents an instance of an SSA value in the MLIR system, representing a computable value...
Base class for extensions of the Transform dialect that supports injecting operations into the Transf...
void registerTransformDialectExtension(DialectRegistry ®istry)
void hoistBuffersFromLoops(Operation *op)
Within the given operation, hoist buffers from loops where possible.
LogicalResult runOneShotBufferize(Operation *op, const OneShotBufferizationOptions &options, BufferizationState &state, BufferizationStatistics *statistics=nullptr)
Run One-Shot Bufferize on the given op: Analysis + Bufferization.
LogicalResult eliminateEmptyTensors(RewriterBase &rewriter, Operation *op)
Try to eliminate "tensor.empty" ops inside op.
llvm::LogicalResult runOneShotModuleBufferize(Operation *moduleOp, const bufferization::OneShotBufferizationOptions &options, BufferizationState &state, BufferizationStatistics *statistics=nullptr)
Run One-Shot Module Bufferization on the given SymbolTable.
Include the generated interface declarations.
DiagnosedSilenceableFailure emitSilenceableFailure(Location loc, const Twine &message={})
Emits a silenceable failure with the given message.
Options for analysis-enabled bufferization.