[Mlir-commits] [mlir] [mlir][bufferization] Support custom types (1/N) (PR #142986)

Han-Chung Wang llvmlistbot at llvm.org
Mon Jun 30 12:17:29 PDT 2025


================
@@ -739,6 +740,19 @@ AliasingValueList unknownGetAliasingValues(OpOperand &opOperand);
 /// This is the default implementation of
 /// BufferizableOpInterface::hasTensorSemantics
 bool defaultHasTensorSemantics(Operation *op);
+
+/// This is a helper function used when buffer type is guaranteed to be memref.
+/// It performs two actions: failure state checking and an explicit llvm::cast<>
+/// from the buffer-like type interface to a BaseMemRefType. This allows easier
+/// management of differences in C++ types at the API boundaries. Valid buffer
+/// type is casted to the memref type. Otherwise, the failure state is
+/// propagated i.e. asMemRefType(mlir::failure()) returns mlir::failure().
+FailureOr<BaseMemRefType> asMemRefType(FailureOr<BufferLikeType> bufferType);
----------------
hanhanW wrote:

It is weird that you declare this in `detail` namespace, but you use it like public API in other places. My understanding is that the methods within `detail` namespace are not intended to be used widely. With your change, it is used in many other dialects like Linalg/SCF/Arith/etc. Are you going to remove this function? Is it just for the transition state?

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


More information about the Mlir-commits mailing list