diff --git a/mlir/lib/Bindings/Python/NanobindUtils.h b/mlir/lib/Bindings/Python/NanobindUtils.h index 64ea4329f65f1..6e42334f369be 100644 --- a/mlir/lib/Bindings/Python/NanobindUtils.h +++ b/mlir/lib/Bindings/Python/NanobindUtils.h @@ -357,7 +357,7 @@ class Sliceable { // that should throw in a non-terminal way, so we forgo further // exception marshalling. // See: https://github.com/pybind/nanobind/issues/2842 - auto heap_type = reinterpret_cast(clazz.ptr()); + auto *heap_type = reinterpret_cast(clazz.ptr()); assert(heap_type->ht_type.tp_flags & Py_TPFLAGS_HEAPTYPE && "must be heap type"); heap_type->as_sequence.sq_length = +[](PyObject *rawSelf) -> Py_ssize_t { diff --git a/mlir/test/python/dialects/memref.py b/mlir/test/python/dialects/memref.py index b91fdc367cf30..ee30be731155d 100644 --- a/mlir/test/python/dialects/memref.py +++ b/mlir/test/python/dialects/memref.py @@ -249,3 +249,20 @@ def check_strides_offset(memref, np_view): check_strides_offset(memref.subview(mem3, (0, 0), (4, 4), (1, 1)), golden_mem[0:4, 0:4]) check_strides_offset(memref.subview(mem3, (4, 4), (4, 4), (1, 1)), golden_mem[4:8, 4:8]) # fmt: on + +# CHECK-LABEL: TEST: testExtractStridedMetadataOp +@run +def testExtractStridedMetadataOp(): + S = ShapedType.get_dynamic_size() + shape = [S] * 4 + with Context() as ctx, Location.unknown(ctx): + dynamc_memref_t = T.memref( + *shape, + element_type=T.f32(), + layout=StridedLayoutAttr.get(offset=S, strides=shape, context=ctx) + ) + module = Module.create() + with InsertionPoint(module.body): + A = memref.alloc(dynamc_memref_t, [], []) + A_base, A_offset, A_sizes, A_strides = memref.extract_strided_metadata(A) +