[Mlir-commits] [mlir] [mlir][bufferization] Support custom types (1/N) (PR #142986)
Matthias Springer
llvmlistbot at llvm.org
Wed Jun 18 01:33:59 PDT 2025
================
@@ -1046,3 +1042,23 @@ bool bufferization::detail::defaultHasTensorSemantics(Operation *op) {
return true;
return any_of(op->getOperandTypes(), isaTensor);
}
+
+FailureOr<BaseMemRefType>
+bufferization::detail::castToMemRef(FailureOr<BufferLikeType> bufferType) {
+ if (failed(bufferType))
+ return failure();
+ assert(isa<BaseMemRefType>(*bufferType) && "expected memref type");
+ return cast<BaseMemRefType>(*bufferType);
+}
+
+bool bufferization::detail::typesMatchAfterBufferization(Operation &op,
+ Value tensor,
+ Value buffer) {
+ assert(isa<TensorLikeType>(tensor.getType()) && "expected TensorLikeType");
+ assert(isa<BufferLikeType>(buffer.getType()) && "expected BufferLikeType");
----------------
matthias-springer wrote:
I think `llvm::cast` still does the check and asserts. Actually, this means you can just remove the assertions entirely.
https://github.com/llvm/llvm-project/pull/142986
More information about the Mlir-commits
mailing list