Skip to content

Invalidations 6/6 (WIP): stop re-reading chunks in column-major iteration - #344

Draft
asinghvi17 wants to merge 1 commit into
inv/column-major-iterationfrom
inv/iterblocks-slab
Draft

asinghvi17 wants to merge 1 commit into
inv/column-major-iterationfrom
inv/iterblocks-slab

Conversation

@asinghvi17

@asinghvi17 asinghvi17 commented Oct 8, 2026 •

Copy link
Copy Markdown
Member

🚧 Under development, not ready for review. Part 6/6, on #343.

An experiment to stop #343 re-reading chunks. When a slab of chunks exceeds default_chunk_size, it reads the whole leading dimension and splits chunks along the next one, instead of reading single columns.

reads / bytes decoded ÷ array size #316 #343 this PR
36000×18000, 1024² chunks 648 / 1.0× 648,000 / 1010× 1,260 / 2.0×
256×256×8 cube, small budget 360 / 1.0× 192 / 8.0× 1,080 / 3.0×

This still buffers a slab of chunks and still re-reads some shapes, so the approach is likely to be replaced by one that reads one chunk at a time.

🤖 Generated with Claude Code

https://claude.ai/code/session_019Dfq6aDr3GqA8w61TsvMsc

Iteration read blocks of whole dimensions before `k`, chunk ranges along
`k` and single indices after it, with `k` the last dimension whose chunk
strip fits in `default_chunk_size`. When the strip of the next dimension
did not fit, every chunk was read once per index it spans after `k`: a
36000 x 18000 Float32 array in 1024 x 1024 chunks took 648,000 reads,
each chunk read 1024 times.

Now `k` is the first dimension that does not fit whole after the ones
before it, and chunks along `k` are split into equal pieces only when one
does not fit beside them. That array takes 2 reads per chunk. A block is
filled one chunk at a time, when iteration reaches the chunk's first
value, so `readblock!` calls match chunk-order iteration, and stopping
early reads only the chunks reached. The budget is at least one chunk.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_019Dfq6aDr3GqA8w61TsvMsc
@asinghvi17
asinghvi17 added this pull request to stack #342 October 8, 2026 15:41
@asinghvi17 asinghvi17 changed the title inv/iterblocks slab Invalidations 6/6 (WIP): stop re-reading chunks in column-major iteration Oct 8, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant