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

Maksim Levental llvmlistbot at llvm.org
Mon Jan 29 10:53:36 PST 2024


================
@@ -426,6 +428,18 @@ MlirAttribute mlirMemRefTypeGetMemorySpace(MlirType type) {
   return wrap(llvm::cast<MemRefType>(unwrap(type)).getMemorySpace());
 }
 
+void mlirMemRefTypeGetStridesAndOffset(MlirType type, int64_t *strides,
+                                       int64_t *offset) {
+  MemRefType memrefType = llvm::cast<MemRefType>(unwrap(type));
+  std::pair<SmallVector<int64_t>, int64_t> stridesOffsets =
+      getStridesAndOffset(memrefType);
----------------
makslevental wrote:

Sorry don't understand? On this current PR, I can do

```python
mem1 = memref.alloc(T.memref(*shape, T.i32()), [], [])
print(mem1.owner)
> %alloc = memref.alloc() : memref<10x22x333x4444xi32>
print(mem1.type)
> memref<10x22x333x4444xi32>
print(mem1.type.layout)
> affine_map<(d0, d1, d2, d3) -> (d0, d1, d2, d3)>
```



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


More information about the Mlir-commits mailing list