[Mlir-commits] [mlir] [mlir] Convert TensorType and BaseMemRefType to interfaces (PR #133053)

Andrei Golubev llvmlistbot at llvm.org
Wed Mar 26 03:04:11 PDT 2025


================
@@ -77,9 +77,9 @@ struct CastOpInterface
     // Case 3: Ranked tensor -> ranked tensor. The offsets and strides do not
     // change.
     auto rankedResultType = cast<RankedTensorType>(castOp.getType());
-    return MemRefType::get(
+    return llvm::cast<BaseMemRefType>(MemRefType::get(
----------------
andrey-golubev wrote:

good point! i think this was due to [explicit conversion operator](https://github.com/llvm/llvm-project/pull/133053/files#diff-22ed3c7dd60fdeffb29de32ba1f6394beed753cbe7ee4ed48e6e14a40bc7a5d0L91) (there's same one for base memref as well).

i guess depending on what our long-term goal is, i may have similar thing for derived types.

actually, i just noticed i miss at least {TensorType, BaseMemRefType} -> ShapedType operators (but maybe this is no longer as important - again due to "indirect" inheritance).

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


More information about the Mlir-commits mailing list