Skip to content

Commit

Permalink
[InMemoryDataset redesign] read_many_slices_param
Browse files Browse the repository at this point in the history
  • Loading branch information
crusaderky committed Oct 28, 2024
1 parent 2f7094f commit 4a53677
Show file tree
Hide file tree
Showing 3 changed files with 882 additions and 4 deletions.
32 changes: 32 additions & 0 deletions versioned_hdf5/subchunk_map.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ cdef class IndexChunkMapper:
cdef readonly hsize_t last_chunk_size

cpdef tuple[object, object, object] chunk_submap(self, hsize_t chunk_idx)
cpdef tuple[object, object | None] read_many_slices_params(self)

cpdef object chunks_indexer(self)
cpdef object whole_chunks_idxidx(self)
Expand All @@ -19,3 +20,34 @@ cdef class IndexChunkMapper:
cdef tuple[hsize_t, hsize_t] _chunk_start_stop(
self, hsize_t chunk_idx
) noexcept nogil


cpdef hsize_t[:, :, :] read_many_slices_params_nd(
transfer_type, # TransferType Python enum
list[IndexChunkMapper] mappers,
hsize_t[:, :] chunk_idxidx,
hsize_t[:] src_slab_offsets,
hsize_t[:] dst_slab_offsets,
)


# At the moment of writing, Cython enums are unusable in pure python mode:
# https://github.com/cython/cython/issues/4252
# The below is for user reference only and not actually used in the code.

cdef enum ReadManySlicesColumn:
"""Axis 1 of the return value of IndexChunkMapper.read_many_slices_params"""
chunk_sub_start = 0
value_sub_start = 1
count = 2
chunk_sub_stride = 3
value_sub_stride = 4


cdef enum ReadManySlicesNDColumn:
"""Axis 1 of the return value of read_many_slices_params_nd"""
src_start = 0
dst_start = 1
count_ = 2 # Two enums can't define the same label
src_stride = 3
dst_stride = 4
Loading

0 comments on commit 4a53677

Please sign in to comment.