[Mlir-commits] [mlir] [mlir][python] enable memref.subview (PR #79393)

Maksim Levental llvmlistbot at llvm.org
Wed Jan 24 18:15:53 PST 2024


================
@@ -618,6 +618,15 @@ class PyMemRefType : public PyConcreteType<PyMemRefType, PyShapedType> {
               return mlirMemRefTypeGetLayout(self);
             },
             "The layout of the MemRef type.")
+        .def_property_readonly(
+            "strides_and_offset",
+            [](PyMemRefType &self) -> std::pair<std::vector<int64_t>, int64_t> {
+              std::vector<int64_t> strides(mlirShapedTypeGetRank(self));
----------------
makslevental wrote:

MemRef is ranked right? ShapedType has a private method [https://github.com/llvm/llvm-project/blob/main/mlir/lib/Bindings/Python/IRTypes.cpp#L447](requireHasRank) that I thought about making public but then realized it's probably superfluous because MemRef must have been verified to be ranked at somet point (should double check though).

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


More information about the Mlir-commits mailing list