Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion mlir/lib/Bindings/Python/NanobindUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<PyHeapTypeObject *>(clazz.ptr());
auto *heap_type = reinterpret_cast<PyHeapTypeObject *>(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 {
Expand Down
17 changes: 17 additions & 0 deletions mlir/test/python/dialects/memref.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Loading