MLIR: lib/Dialect/Bufferization/Transforms/TensorCopyInsertion.cpp Source File (original) (raw)
1
2
3
4
5
6
7
8
10
18
19 namespace mlir {
20 namespace bufferization {
21 #define GEN_PASS_DEF_TENSORCOPYINSERTION
22 #include "mlir/Dialect/Bufferization/Transforms/Passes.h.inc"
23 }
24 }
25
26 using namespace mlir;
28
34
35
36
37 if (options.bufferizeFunctionBoundaries) {
38 if (failed(analyzeModuleOp(cast(op), analysisState, statistics)))
39 return failure();
40 } else {
41 if (failed(analyzeOp(op, analysisState, statistics)))
42 return failure();
43 }
44
45 if (options.testAnalysisOnly)
46 return success();
47
49 }
50
55
56
57
58
59
60
65
66 auto bufferizableOp =
68 if (!bufferizableOp)
70
71
72
74 if (failed(bufferizableOp.resolveConflicts(rewriter, analysisState,
75 bufferizationState)))
77
79 });
80
82 }
static llvm::ManagedStatic< PassManagerOptions > options
This class coordinates rewriting a piece of IR outside of a pattern rewrite, providing a way to keep ...
void setInsertionPoint(Block *block, Block::iterator insertPoint)
Set the insertion point to the specified location.
A trait used to provide symbol table functionalities to a region operation.
Operation is the basic unit of execution within MLIR.
bool hasTrait()
Returns true if the operation was registered with a particular trait, e.g.
std::enable_if_t< llvm::function_traits< std::decay_t< FnT > >::num_args==1, RetT > walk(FnT &&callback)
Walk the operation by calling the callback for each nested operation (including this one),...
MLIRContext * getContext()
Return the context this operation is associated with.
Operation * getParentWithTrait()
Returns the closest surrounding parent operation with trait Trait.
A utility result that is used to signal how to proceed with an ongoing walk:
static WalkResult advance()
bool wasInterrupted() const
Returns true if the walk was interrupted.
static WalkResult interrupt()
AnalysisState provides a variety of helper functions for dealing with tensor values.
const BufferizationOptions & getOptions() const
Return a reference to the BufferizationOptions.
BufferizationState provides information about the state of the IR during the bufferization process.
State for analysis-enabled bufferization.
LogicalResult analyzeOp(Operation *op, OneShotAnalysisState &state, BufferizationStatistics *statistics=nullptr)
Analyze op and its nested ops.
LogicalResult insertTensorCopies(Operation *op, const OneShotBufferizationOptions &options, const BufferizationState &bufferizationState, BufferizationStatistics *statistics=nullptr)
Resolve RaW and other conflicts by inserting bufferization.alloc_tensor ops.
llvm::LogicalResult analyzeModuleOp(ModuleOp moduleOp, OneShotAnalysisState &state, BufferizationStatistics *statistics=nullptr)
Analyze moduleOp and its nested ops.
Include the generated interface declarations.
BufferizableOpInterface dynCastBufferizableOp(Operation *op) const
Try to cast the given op to BufferizableOpInterface if the op is allow listed.
Bufferization statistics for debugging.
Options for analysis-enabled bufferization.