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

Oleksandr Alex Zinenko llvmlistbot at llvm.org
Mon Jan 29 06:03:10 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);
----------------
ftynse wrote:

This will fail an assertion when the memref doesn't have a strided layout, and we currently don't seem to have a way to check that it is. I'd rather use the form returning `LogicalResult` and forward that to the caller for additional safety.

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


More information about the Mlir-commits mailing list