[Mlir-commits] [mlir] [mlir][python] enable memref.subview (PR #79393)
Oleksandr Alex Zinenko
llvmlistbot at llvm.org
Tue Jan 30 07:59:08 PST 2024
================
@@ -618,6 +620,18 @@ class PyMemRefType : public PyConcreteType<PyMemRefType, PyShapedType> {
return mlirMemRefTypeGetLayout(self);
},
"The layout of the MemRef type.")
+ .def(
+ "get_strides_and_offset",
+ [](PyMemRefType &self) -> std::pair<std::vector<int64_t>, int64_t> {
+ std::vector<int64_t> strides(mlirShapedTypeGetRank(self));
+ int64_t offset;
+ if (mlirLogicalResultIsFailure(mlirMemRefTypeGetStridesAndOffset(
+ self, strides.data(), &offset)))
+ throw std::runtime_error(
+ "failed to extract strides and offset from memref");
----------------
ftynse wrote:
Ultra-nit: Capitalize Python error messages and terminate them with a period. (Yeah, I know, the opposite of C++ diagnostics).
https://github.com/llvm/llvm-project/pull/79393
More information about the Mlir-commits
mailing list