[Mlir-commits] [mlir] [mlir][bufferization] Add `BufferizableOpInterface::hasTensorSemantics` (PR #75273)

Matthias Springer llvmlistbot at llvm.org
Fri Jan 5 08:13:53 PST 2024


================
@@ -575,6 +575,28 @@ def BufferizableOpInterface : OpInterface<"BufferizableOpInterface"> {
           return false;
         }]
       >,
+      InterfaceMethod<
+        /*desc=*/[{
+          Return "true" if the this op has tensor semantics and should be
+          bufferized. By default, ops with tensor operands, tensor op results
+          and/or tensor block arguments have tensor semantics.
+
+          This interface methods can be implemented by ops that should be
+          bufferized but do not have tensor semantics according to the above
+          definition. E.g., this function can return "true" for symbols.
+
+          TODO: This interface method should be called `hasTensorSemantics`, but
----------------
matthias-springer wrote:

Oh, there is actually a difference:
```
    /// Return whether the op has tensor semantics. That is the case if the op
    /// has no memref operands and at least one ranked tensor operand.
```
We may want to drop the part that checks for memrefs operands. (We also have `hasBufferSemantics` and it would make sense to me if both returned "true" when there are mixed tensors/memref; this is somewhat of an edge case, we usually don't have mixed tensors/memrefs.)


https://github.com/llvm/llvm-project/pull/75273


More information about the Mlir-commits mailing list