Skip to content

train 1124131642: #1501 #4801 #4856 (CI only) - #4893

Closed
ashhart wants to merge 18 commits into
mainfrom
lead/train-1124131642
Closed

ashhart wants to merge 18 commits into
mainfrom
lead/train-1124131642

Conversation

@ashhart

@ashhart ashhart commented Nov 24, 2026

Copy link
Copy Markdown
Owner

CI for a landing train: #1501 #4801 #4856 stacked on main in that order. Nothing merges from this PR: each PR above lands on its own once this tip is green, and this PR is then closed.

BlivionIaG and others added 18 commits November 24, 2026 13:16
A Tier beside the Pool for families whose pages are cached on the device from a host store. The pool stays the only
owner of page ids and of what is promised; the tier adds a second currency (device frames a stream may pin at once),
the page-to-frame mapping, an LRU order, pins for the frames a call reads, a dirty flag so a frame is dropped only
once its rows reached the host store, and a generation per frame so a table written before a frame was recycled is
told from a current one. A stream can also be lent frames for its life, mapped to no page, for a family that manages
them itself. The pool tells the tier when a page loses its last holder. It moves no bytes and uses no device API: the
family copies what a miss names, and a snapshot reads canonical rows from the host store.

Tests: reservation conservation in both currencies, eviction order, pin rules, lent frames, generation safety,
canonical rows, a randomised serving loop that audits the mapping and checks every row read against the last write,
two ranks in lockstep (and a step or a lent count taken by one rank caught by the digest), and mutants (no generation,
no pin rule, dirty frames unpinned) that the checks fail on.

A failed batch unmaps the misses it mapped (their generation moves on), a page is marked dirty only under a pin
of the marking lease, a stream cannot end while it holds the last pin of a dirty page, and a family can lend a run of
consecutive frames (lendRun).
Avoid indexing tier state with the pool sentinel left by a retired page.
ArrayList.toOwnedSlice remaps in place when it can, so the pack reader's allocation count varied with allocator state and checkAllAllocationFailures reported NondeterministicMemoryUsage. Duplicate the slice so the count is fixed.
- a rank holding an unflushed page it cannot evict no longer matches one that flushed, so the open check sees it
partRows sized the pass scratch's part for two consumers: an out projection's
slice plus the zero slice at cap rows, and a legacy lane tile's out_sk slices
below 64 rows. The MTP head's fc_h lane is a third one. It runs over streams *
rows rows (four streams by a pass's rows), and the lane writes one fp32 slice
of them and zeroes a second, so it needs 2 * streams * rows rows of part.

cuda_tiles.matmul zeroes at part + m rows and cuda_batch_ops.sumSlices then
reads that slice back, so a head pass over more than cap / 4 rows leaves part:
at four streams and a 256-row piece the lane needs 2,048 rows, against 2 * cap
below a 1,024-row scratch, and 4 * cap while the piece is half the scratch.

A head pass takes at most piece_rows rows (cuda_mtp_ops.zig's forwardHead and
headGroup), so any pass over 63 rows can ask for more than part below a
1,024-row scratch. The single-stream path, whose piece is half the scratch,
first overruns at 128 rows, a prompt chunk of about 128 tokens, and runs short
to 1,023.

partRows now takes the maximum over every consumer, the head's term being
2 * streams * min(cap, piece_rows). The term changes nothing from a 1,024-row
scratch up, where the out projection's two cap-stride slices already dominate,
so a long cache's part keeps its 671,088,640 bytes at 32,768 rows. Below that
it costs at most 15,728,640 bytes, at 256 rows.

The host test sweeps every cap against each consumer's write range, with the
head's lane under both a reachable pass and the widest pass the lane admits.
…' disk states

A retain count above zero chose disk states with the resume predicate, which
accepts any state whose tokens are a proper prefix of a retained entry's: a
shorter state on the retained conversation's own path survived, while the
retained entry's own state was deleted with no lookahead (its position equals
its token count) and under planned chunk starts (empty starts never match a
recorded schedule). A disk state now stays only when it is a retained entry's
own: the same position, tokens and decoded spans.

A dropped entry's write already staged on the I/O worker owns no entry, and
the flush fenced the writer only when it removed a published state, so such a
write could publish afterwards. The flush now fences whenever a staged write
is not a retained entry's own.

A retain count of zero still takes the full flush unchanged.
…n's full flush

Main read the flush route's body and dropped it, whatever its framing, and
then flushed every state with a 200 reply. The retention change answered a
refused body (one past the 32 MiB limit, an invalid or short length, or a
length beside a transfer coding) with a 400 and flushed nothing, and a
failed read with a 500. Such a body now means no retention, as on main:
the full flush with its usual reply, and the connection still closes after
a refused body as before. When a readable body's JSON cannot be parsed for
lack of memory, a body that cannot name retain is the full flush too.

Only a body that names retain takes the new path; a retain value that is
present but not a nonnegative 32-bit integer is still refused with a 400.
…s, not with a panic

The dispatcher helper read every reply body as JSON and took its ok field,
so a plain 500 (as the parse-failure path answered before its fix) ended
the test run with an inactive-union panic. A body that is not JSON now
reads as null, and the test reports the status it expected and found.
@ashhart

ashhart commented Nov 24, 2026

Copy link
Copy Markdown
Owner Author

Landed: #1501 #4801 #4856 as main 5c9e83e. This PR only carried their CI.

@ashhart ashhart closed this Nov 24, 2026
@ashhart
ashhart deleted the lead/train-1124131642 branch November 24, 2026 15:16
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.

3 participants