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

Maksim Levental llvmlistbot at llvm.org
Wed Jan 24 18:17:01 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);
+  assert(stridesOffsets.first.size() == memrefType.getRank() &&
+         "Strides and rank don't match for memref");
+  (void)std::copy(stridesOffsets.first.begin(), stridesOffsets.first.end(),
----------------
makslevental wrote:

Yea sure no way to check (can you say "null terminated strings"...) but I don't know another C-ism for this. The header documents the requirement.

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


More information about the Mlir-commits mailing list