Skip to content

Stream VecReduceBackend output into open chunks per tile - #828

Merged
frankmcsherry merged 2 commits into
master-nextfrom
vec-backend-stream-emit
Aug 12, 2026
Merged

Stream VecReduceBackend output into open chunks per tile#828
frankmcsherry merged 2 commits into
master-nextfrom
vec-backend-stream-emit

Conversation

@frankmcsherry

Copy link
Copy Markdown
Member

VecReduceBackend staged every retire's output as rows (tile_rows), building chunks only at finish. Instrumented at 4M-key churn, that staging was the backend's entire memory spike: a 336MB high-water mark, while the windowed presentation — the part the windowing design bounds — peaked at 2.6MB. At finish the staged rows and the built chunks were briefly co-resident besides.

emit's calls arrive per tile in disjoint, ascending key ranges (the windows partition the key space in order), each consolidated. So emit now resolves its records, restores row order within each hash (vid order need not be row order), and pushes straight into the tile's open VecChunk, sealing at TARGET; finish just wraps the sealed chunks in batches. The retire's output is never resident twice, and a chunk is immutable from the moment it seals — the shape that would let chunks spill. Bench times are neutral. This is a backend-local change: the tactic and its protocol are untouched.

Also records in merged_run's doc why its cross-batch merge must stay: the merge is load-bearing for the ordinal id scheme — grouping equal payloads across batches is what lets them share one id and net in the id-keyed accumulations — not for the record order. Presenting runs unmerged measured ~25% slower on churn overall.

🤖 Generated with Claude Code

frankmcsherry and others added 2 commits August 12, 2026 08:14
The backend staged every retire's output as rows in tile_rows,
building chunks only at finish — instrumented at a 336MB high-water
against a 2.6MB windowed presentation at 4M keys, the backend's whole
memory spike. Emits arrive per tile in disjoint ascending key ranges,
each consolidated, so emit can push rows straight into an open chunk
and seal at TARGET; finish just wraps the sealed chunks.

Also records why merged_run's cross-batch merge must stay: it is
load-bearing for ordinal id sharing (netting in the id-keyed
accumulations), measured at ~25% of churn when removed.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@frankmcsherry
frankmcsherry merged commit 2435346 into master-next Aug 12, 2026
6 checks passed
@frankmcsherry
frankmcsherry deleted the vec-backend-stream-emit branch August 12, 2026 15:46
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