@@ -18,23 +18,23 @@ def BufferizableOpInterface : OpInterface<"BufferizableOpInterface"> {
18
18
19
19
Note: All "bufferizesTo*" and "getAliasing*" interface methods must be
20
20
implemented conservatively. If it is not statically known whether an
21
- OpOperand/OpResult bufferizes in a certain way (e.g., to a memory write),
21
+ OpOperand/Value bufferizes in a certain way (e.g., to a memory write),
22
22
the worst case must be assumed (e.g., that it does). Similarly,
23
23
"getAliasing*" interface methods may always return additional OpOperands or
24
- OpResults , but must not miss an OpOperand or OpResult that could potentially
24
+ Values , but must not miss an OpOperand or Value that could potentially
25
25
alias at runtime.
26
26
}];
27
27
let cppNamespace = "::mlir::bufferization";
28
28
let methods = [
29
29
InterfaceMethod<
30
30
/*desc=*/[{
31
- Return `true` if the given OpResult may bufferize to a new buffer
32
- allocation. If it is statically unknown if the given OpResult
31
+ Return `true` if the given Value may bufferize to a new buffer
32
+ allocation. If it is statically unknown that the given Value
33
33
bufferizes to a buffer allocation, `true` should be returned.
34
34
}],
35
35
/*retType=*/"bool",
36
36
/*methodName=*/"bufferizesToAllocation",
37
- /*args=*/(ins "::mlir::OpResult ":$opResult ),
37
+ /*args=*/(ins "::mlir::Value ":$value ),
38
38
/*methodBody=*/"",
39
39
/*defaultImplementation=*/"return false;"
40
40
>,
@@ -68,10 +68,9 @@ def BufferizableOpInterface : OpInterface<"BufferizableOpInterface"> {
68
68
tensor type.
69
69
70
70
This method will never be called on OpOperands that do not have an
71
- aliasing OpResult. Intuitively, it does not make sense for an
72
- OpOperand to bufferize to a memory write without returning an aliasing
73
- tensor, because the write would have no visible effect outside of the
74
- op.
71
+ aliasing Value. Intuitively, it does not make sense for an OpOperand
72
+ to bufferize to a memory write without returning an aliasing tensor,
73
+ because the write would have no visible effect outside of the op.
75
74
76
75
Note: It is always safe to consider an OpOperand as a memory write,
77
76
even if it does actually not write; however, this can introduce
@@ -87,7 +86,7 @@ def BufferizableOpInterface : OpInterface<"BufferizableOpInterface"> {
87
86
/*defaultImplementation=*/[{
88
87
// Does not have to be implemented for ops without tensor OpOperands.
89
88
// Does not have to be implemented for OpOperands that do not have an
90
- // aliasing OpResult .
89
+ // aliasing Value .
91
90
llvm_unreachable("bufferizesToMemoryWrite not implemented");
92
91
}]
93
92
>,
@@ -221,21 +220,21 @@ def BufferizableOpInterface : OpInterface<"BufferizableOpInterface"> {
221
220
>,
222
221
InterfaceMethod<
223
222
/*desc=*/[{
224
- Return the OpResults that may alias with a given OpOperand when
223
+ Return the Values that may alias with a given OpOperand when
225
224
bufferized in-place. This method will never be called on OpOperands
226
225
that do not have a tensor type.
227
226
228
- This method can return multiple OpResults , indicating that a given
227
+ This method can return multiple Values , indicating that a given
229
228
OpOperand may at runtime alias with any (or multiple) of the returned
230
- OpResults .
229
+ Values .
231
230
232
231
Each alias is specified with a degree of certainty:
233
232
234
233
* MAYBE (`isDefinite = false`): At runtime, buffer(opOperand) may
235
- alias with the specified OpResult .
234
+ alias with the specified Value .
236
235
* DEFINITE (`isDefinite = true`, default): At runtime,
237
236
buffer(opOperand) is guaranteed to alias the buffer of the specified
238
- OpResult . This is a stronger property than MAYBE and allows for more
237
+ Value . This is a stronger property than MAYBE and allows for more
239
238
precise analyses. DEFINITE properties should be used when possible.
240
239
241
240
Furthermore, each alias is specified with a buffer relation:
@@ -245,69 +244,69 @@ def BufferizableOpInterface : OpInterface<"BufferizableOpInterface"> {
245
244
* `BufferRelation::Unknown`: There is no further information apart
246
245
from the fact that both buffers alias.
247
246
248
- False positives are allowed in the list of OpResults , but they can
247
+ False positives are allowed in the list of Values , but they can
249
248
adversely affect the accuracy of the anlysis. On the contrary,
250
249
omitting potential aliases is incorrect.
251
250
252
251
One possible (conservative) implementation of this interface method,
253
- that is always safe, is to return all tensor OpResults with
252
+ that is always safe, is to return all tensor Values with
254
253
BufferRelation::Unknown and MAYBE.
255
254
256
255
Examples:
257
256
258
257
```
259
- // aliasingOpResults (%t) = DEFINITE {Equivalent %r}
258
+ // aliasingValues (%t) = DEFINITE {Equivalent %r}
260
259
%r = tensor.insert_slice %f into %t : tensor<10xf32>
261
260
262
- // aliasingOpResults (%t) = DEFINITE {Unknown %r}
261
+ // aliasingValues (%t) = DEFINITE {Unknown %r}
263
262
// Note: "Buffer is subset of buffer" relationship are not yet
264
263
// supported, so "Unknown" is the best we can do for now.
265
264
%r = tensor.extract_slice %t[0]][5][1]
266
265
: tensor<10xf32> to tensor<5xf32>
267
266
268
- // aliasingOpResults (%t1) = MAYBE {Equivalent %r}
269
- // aliasingOpResults (%t2) = MAYBE {Equivalent %r}
267
+ // aliasingValues (%t1) = MAYBE {Equivalent %r}
268
+ // aliasingValues (%t2) = MAYBE {Equivalent %r}
270
269
%r = arith.select %c, %t1, %t2 : tensor<10xf32>
271
270
272
271
// A hypothetical op that bufferizes to rolling a dice and based on
273
272
// the result to either return buffer(%t) or a newly allocated copy
274
273
// thereof.
275
- // aliasingOpResults (%t) = MAYBE {Equivalent %r}
274
+ // aliasingValues (%t) = MAYBE {Equivalent %r}
276
275
%r = "dummy.alias_or_copy(%t) : (tensor<10xf32>) -> (tensor<10xf32>)"
277
276
```
278
277
}],
279
- /*retType=*/"::mlir::bufferization::AliasingOpResultList ",
280
- /*methodName=*/"getAliasingOpResults ",
278
+ /*retType=*/"::mlir::bufferization::AliasingValueList ",
279
+ /*methodName=*/"getAliasingValues ",
281
280
/*args=*/(ins "::mlir::OpOperand &":$opOperand,
282
281
"const ::mlir::bufferization::AnalysisState &":$state),
283
282
/*methodBody=*/"",
284
283
/*defaultImplementation=*/[{
285
284
// Does not have to be implemented for ops without tensor OpOperands.
286
285
assert(::llvm::isa<::mlir::TensorType>(opOperand.get().getType()) &&
287
286
"expected OpOperand with tensor type");
288
- llvm_unreachable("getAliasingOpResults not implemented");
287
+ llvm_unreachable("getAliasingValues not implemented");
289
288
}]
290
289
>,
291
290
InterfaceMethod<
292
291
/*desc=*/[{
293
- Return the OpOperands that alias with a given OpResult when
294
- bufferized in-place. This method will never be called on OpResults
295
- that do not have a tensor type.
292
+ Return the OpOperands that alias with a given Value when bufferized
293
+ in-place. This method will never be called on Values that do not
294
+ have a tensor type.
296
295
297
- By default, this method is the inverse of `getAliasingOpResults `. Ops
296
+ By default, this method is the inverse of `getAliasingValues `. Ops
298
297
with a region that yield values may want to override this method to
299
298
return the OpOperands that are yielded by the terminator.
300
299
301
300
This method can return multiple OpOperands, indicating that a given
302
- OpResult may at runtime alias with any (or multiple) of the returned
301
+ Value may at runtime alias with any (or multiple) of the returned
303
302
OpOperands.
304
303
305
304
This property is specified with a degree of certainty:
306
305
307
- * MAYBE (`isDefinite = false`): At runtime, buffer(opResult ) may
308
- alias with the specified OpOperand.
306
+ * MAYBE (`isDefinite = false`): At runtime, buffer(value ) may alias
307
+ with the specified OpOperand.
309
308
* DEFINITE (`isDefinite = true`, default): At runtime,
310
- buffer(opResult ) is guaranteed to alias the buffer of the specified
309
+ buffer(value ) is guaranteed to alias the buffer of the specified
311
310
OpOperand. This is a stronger property than MAYBE and allows for
312
311
more precise analyses. DEFINITE properties should be used when
313
312
possible.
@@ -350,14 +349,14 @@ def BufferizableOpInterface : OpInterface<"BufferizableOpInterface"> {
350
349
}],
351
350
/*retType=*/"::mlir::bufferization::AliasingOpOperandList",
352
351
/*methodName=*/"getAliasingOpOperands",
353
- /*args=*/(ins "::mlir::OpResult ":$opResult ,
352
+ /*args=*/(ins "::mlir::Value ":$value ,
354
353
"const ::mlir::bufferization::AnalysisState &":$state),
355
354
/*methodBody=*/"",
356
355
/*defaultImplementation=*/[{
357
- assert(::llvm:: isa<::mlir::TensorType>(opResult .getType()) &&
358
- "expected OpResult with tensor type");
356
+ assert(isa<::mlir::TensorType>(value .getType()) &&
357
+ "expected tensor type");
359
358
return ::mlir::bufferization::detail::defaultGetAliasingOpOperands(
360
- opResult , state);
359
+ value , state);
361
360
}]
362
361
>,
363
362
InterfaceMethod<
@@ -568,7 +567,7 @@ def BufferizableOpInterface : OpInterface<"BufferizableOpInterface"> {
568
567
::llvm::cast<::mlir::bufferization::BufferizableOpInterface>(getOperation());
569
568
return !bufferizableOp.bufferizesToMemoryRead(opOperand, state)
570
569
&& !bufferizableOp.bufferizesToMemoryWrite(opOperand, state)
571
- && bufferizableOp.getAliasingOpResults (opOperand, state)
570
+ && bufferizableOp.getAliasingValues (opOperand, state)
572
571
.getNumAliases() != 0;
573
572
}
574
573
}];
0 commit comments