9
9
#include " mlir/Dialect/Linalg/Transforms/BufferizableOpInterfaceImpl.h"
10
10
#include " mlir/Dialect/Bufferization/IR/BufferizableOpInterface.h"
11
11
#include " mlir/Dialect/Bufferization/IR/Bufferization.h"
12
+ #include " mlir/Dialect/Bufferization/IR/DstBufferizableOpInterfaceImpl.h"
12
13
#include " mlir/Dialect/Linalg/IR/Linalg.h"
13
14
#include " mlir/Dialect/Tensor/IR/Tensor.h"
14
15
#include " mlir/IR/Dialect.h"
@@ -89,8 +90,8 @@ bufferizeDestinationStyleOpInterface(RewriterBase &rewriter,
89
90
// / operates entirely on memrefs.
90
91
template <typename OpTy>
91
92
struct LinalgOpInterface
92
- : public BufferizableOpInterface::ExternalModel <LinalgOpInterface<OpTy>,
93
- OpTy> {
93
+ : public DstBufferizableOpInterfaceExternalModel <LinalgOpInterface<OpTy>,
94
+ OpTy> {
94
95
bool bufferizesToMemoryRead (Operation *op, OpOperand &opOperand,
95
96
const AnalysisState &state) const {
96
97
// Operand is read if it is used in the computation.
@@ -105,30 +106,6 @@ struct LinalgOpInterface
105
106
return !bufferizableOp.getAliasingOpResult (opOperand, state).empty ();
106
107
}
107
108
108
- SmallVector<OpOperand *>
109
- getAliasingOpOperand (Operation *op, OpResult opResult,
110
- const AnalysisState &state) const {
111
- auto genericOp = cast<DestinationStyleOpInterface>(op);
112
-
113
- // The i-th OpResult may alias with the i-th "out" tensor.
114
- return {genericOp.getDpsInitOperand (opResult.getResultNumber ())};
115
- }
116
-
117
- SmallVector<OpResult> getAliasingOpResult (Operation *op, OpOperand &opOperand,
118
- const AnalysisState &state) const {
119
- auto genericOp = cast<DestinationStyleOpInterface>(op);
120
-
121
- // The i-th "out" tensor may alias with the i-th OpResult.
122
- if (genericOp.isDpsInit (&opOperand))
123
- return {genericOp.getTiedOpResult (&opOperand)};
124
- return {};
125
- }
126
-
127
- BufferRelation bufferRelation (Operation *op, OpResult opResult,
128
- const AnalysisState &state) const {
129
- return BufferRelation::Equivalent;
130
- }
131
-
132
109
LogicalResult bufferize (Operation *op, RewriterBase &rewriter,
133
110
const BufferizationOptions &options) const {
134
111
return bufferizeDestinationStyleOpInterface (
0 commit comments