Repository navigation
sessions: session memory for paged-KV families (page pool, prefix trie, RAM residency budget, streamed NVMe tier) (DeepSeek-V4.1 stack 4/14) - #637
Conversation
62459b1 to
191dcf5
Compare
|
Rebased onto current main (e7c523e), on top of the rebased #635 and #636, with no conflicts in this layer. Head: Gates on the new head, host only (Linux x86_64, Zig 0.17.0): |
191dcf5 to
5c6f9c6
Compare
|
Added |
5c6f9c6 to
eaa5272
Compare
|
Independent aarch64 Linux receipt for eaa5272 on two ThinkStation PGX (GB10), Zig 0.17.0.
This layer adds host tests and no GPU runner or device step. These results do not qualify a paged-KV model family on GPU. No code changes. |
eaa5272 to
0ba7d30
Compare
|
Hello @jayleaton, Thank you for the page pool, the prefix trie, and the residency budget. A budget of 0 means no limit. enforce returns immediately (store.zig:482), so admission cannot refuse idle chats that do not fit. needPages with capacity 0 reports zero pages (pool.zig:381). Please make a zero budget refuse a chat that does not fit, and make needPages report the pages the request actually takes. The NVMe tier calls Linux openat, statx, and fdatasync (disk.zig:185) with no other path, and zig/build/sessions.zig attaches those tests to zig build test on every host. Please keep that tier off the Mac build, or give it a path that compiles there. A push with the admission fix and a host test that compiles on macOS is the update we need. Then it goes through the gate described on #635. Thank you again. |
…alls them. graph_cache.Cache captures one executable graph per caller-named key and replays it when the key comes back; ranks agree on every capture, eviction and fallback through an Agree hook, and a memory floor turns misses eager. arena.Arena sub-allocates DeviceBuffer.alloc from a few large chunks (VMM or plain cuMemAlloc) through memory.setHook; borrowed spans and pointers it does not own are freed as before.
…; CUresult names fall back to a table when the driver cannot answer. cuFuncGetName is optional (CUDA 12.3+), so an older driver still opens. During the exit's teardown cuGetErrorName fails too, which printed CUDA_ERROR_DEINITIALIZED as "CUDA_ERROR_UNKNOWN_CODE (4)"; code 4 now says the process is exiting.
Use CUDA device attribute 110 for GPUDirect RDMA with VMM support. Attribute 126 reports the memory sync domain count and can incorrectly enable the RDMA allocation flag. Add a regression for the external ABI contract.
…r stays under the max, a max of 0 is eager - A capture whose agreement throws, or whose insert runs out of memory, no longer leaks its executable: the map's slot is reserved before the capture, and the executable is owned here until the insert, which cannot fail. - A host map that cannot grow counts as no room in the existing room vote, so every rank declines that miss together. - `min_keep` is clamped to `max`, so under the memory floor the cap never rises above the configured max. A max of 0 runs every step eagerly, with no collective. - A cap lowered to 0 under the floor goes back to max once every rank has room, instead of staying eager for good. - Hits make no collective: with `Agree` set, keys, settings and fingerprint changes must already match on every rank. The docs now say so: the fingerprint changes at the same step on every rank, and `fingerprintOf` is for one rank. Co-authored-by: Jonathan Regan-Beasley <197533392+jregan-beasley-smc@users.noreply.github.com>
The arena's `live` (small ranges) and `large` (own chunks) maps drop an entry on every free and gain one on every allocation for the life of the process. std's tombstones never clear, so in time they take every free slot, and each allocation, free and miss then probes the whole map. Each map now counts its removals and is rehashed in place once they reach a tenth of its capacity. Test: 20,000 random allocations and frees (small ranges and large chunks) keep a tenth of each map free at every step; without the rehash it fails.
…amily that installs it, without a rebuild Cache.init applies the operator's value through Settings.operator, so a deployment that measures graphs slower can turn them off at serve time. The value is read once a cache, and is set alike on every rank like the settings themselves: no agreement is added, and hits still make no collective.
0ba7d30 to
cc59d82
Compare
|
Thanks, @ashhart. Updated to
New tests: "admission without a capacity still reserves prompt, reply and slack pages" (pool) and "zero chat or byte budgets evict idle residency while null remains unlimited" (store). macOS: I emulated a Mac host by building Host gate at |
…d RoCE collectives, plan link, fail-fast. zig/src/fabric/tp brings a rank up from TF_TP_WORLD, TF_TP_RANK, TF_TP_MASTER and TF_TP_PORT, agrees the settings digest over every rank, and gives a family all-gather, all-reduce and broadcast over NCCL (TF_COMM_BACKEND=nccl, the default), a pinned host mailbox for ranks on one host, or RoCE verbs between two hosts (TF_TP_ROCE_*), with an NCCL fallback when RoCE setup fails. Rank 0 sends each round's plan to the others over its own link (TF_TP_PLAN_*). A failure or a vanished rank ends every rank shortly after (TF_TP_FAILFAST, TF_TP_FAILFAST_GRACE_S). No family uses it yet. zig build test-tp runs the host tests; zig build tf-tp-test builds the two-GPU runner (-Dtp-nvcc= or -Dtp-fatbin= for the mailbox kernel). The RoCE all-gather adapts b12x's RoCEnante protocol.
… the stop word with no fail-fast exit; a rank killed mid-drain still fails the other fast.
… /24 the peer also has The automatic pick took the first N active RoCE ports in device-list order and never checked that the peer can reach them. On a host with two neighbours, one picked port can sit on a subnet the peer does not have, and the queue pair's RTR step then fails, which reports RoCE unavailable. Every rank now sends its usable ports' IPv4 addresses over the bootstrap. Each rank then keeps the ports whose /24 the peer also lists, ordered by subnet and each /24 no more often than both sides have it, so both ranks pick the same number. With no shared /24 the old first-N order is kept, with a warning to set TF_TP_ROCE_HCA. The exchange runs on every rank, including ranks that set TF_TP_ROCE_HCA, so the bootstrap stays in step.
…FNAME and TF_TP_MASTER are needed, with a two-host example
… kernel backends up front; run_hosts.sh passes HCA picks - `tf-tp-test kernel` reports the embedded kernel and exits 1 without one. `suite` and `failfast` on the mailbox or RoCE backend stop at once with a message that names `-Dtp-nvcc`, instead of failing later on a missing kernel. - `run_hosts.sh` stops before any step when the kernel is missing. It exports TF_TP_ROCE_HCA and NCCL_IB_HCA (derived from TF_TP_ROCE_HCA when unset), warns when a host has more than one RDMA device and neither is set, and records all three variables in host.txt.
… with another region layout are refused roce_guard.stripes computes each HCA's share of a post (its send stripe, the peer's receive range and its flag word) and refuses with error.OutOfRegion any range past its slot, its flag area or the registered region, before post_send. The verbs wire and the shm wire both post through it. The shm wire moves to roce_shm.zig and can stripe like the verbs wire (Options.shm_stripes), with an optional tap that sees every post for tests. The connection record carries the slot and registered length, so a peer with another layout is refused at connect; its magic is bumped. Tests: stripes tile the slot over two HCAs and refuse a post past the slot, a third slot, an unpadded or empty post, no HCA and a short region. On fake verbs a post past its slot reaches no verb, and a full slot stays inside the region. Over the shm wire striped as two HCAs, 2,000 variable-length gathers stay inside slot and region, bit for bit.
… fixes) into stack/08e-block Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ixes) into stack/08r-runtime zig/src/cuda/arena.zig: both sides appended tests; both are kept (this branch's fallback and VMM tests, then the reuse-insertion test). The fix's reservation lands in this branch's allocLocked unchanged. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ixes) into stack/09a-kv Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ixes) into stack/09b-forward Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ixes) into stack/10-prefill Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ixes) into stack/11a-sampling Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ixes) into stack/11b-draft Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ixes) into stack/11c-device-drafts Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ixes) into stack/11d-batched-rows Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ixes) into stack/12a-serving-host Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ixes) into stack/12b-serving-engine Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ixes) into stack/13a-performance-host Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… prefix fixes) into stack/13b-performance-device Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Host receipt for |
|
Thanks @cwschroeder for the 89/89 host steps and session-suite receipt on both hosts. The scope is clear: this layer has no GPU step and does not qualify a paged-KV family by itself. Our integration reserves map and backing storage before consuming reusable prefix IDs, with allocation-failure, retry and conservation controls. The consuming family's saved-state, streamed storage and resume/fresh checks still have to pass on the final integrated source. There is no need to invent a device result for the standalone host layer. Posted by Ash's AI Assistant Synthena |
(cherry picked from commit 854b57c) Reported-by: Bizuayeu <ashhart#636 (comment)> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit 602a0fd) Reported-by: Bizuayeu <ashhart#636 (comment)> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit 569577a) Reported-by: Christian Schröder <ashhart#636 (comment)> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
(cherry picked from commit 8f75a6a) Reported-by: Christian Schröder <ashhart#636 (comment)> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…nd HCA verbs-error naming) into stack/04-sessions Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Conflicts, both sides kept: - zig/src/cuda/memory.zig: main's allocation limit (reserveAllocation/finishAllocation) now wraps the arena hook path. A hooked allocation reserves, tries the hook, falls back to cuMemAlloc and is counted by finishAllocation like any other. - zig/src/cuda/root.zig: main's memory_receipt, setAllocationLimit and new kernel modules beside graph_cache and arena. - RUNBOOK.md: main's GLM heat-band paragraph, then the TF_GRAPH_CACHE paragraph. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…r.check does launched() named the failing kernel for every non-success code, so a launch that main's tests answer with CUDA_ERROR_NOT_READY (qwen_cuda_test, experts3_host_test) reached errorName on a fake driver and crashed. It now returns error.NotReady first, like Driver.check. The ranks test reads the monotonic clock through std.Io, so it also compiles on Windows hosts (zig-windows). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…3-tp-fabric Conflicts, both sides kept: - THIRD_PARTY_NOTICES.md: two b12x RoCEnante entries, each naming its own files. Main's two-rank CUDA RoCE gather (zig/src/cuda/roce.zig, zig/kernels/cuda/roce_gather.cu), then the TP fabric's RoCE path (zig/src/fabric/tp/mailbox.cu, roce.zig, roce_verbs.zig). - build.zig: main's sys and checkpoint_config wiring beside tp_build; tp_build.add runs before both walks, so the TP modules (which compile zig/src/cuda/root.zig, now importing sys) get the sys import. Auto-merge fix: - zig/src/cuda/nccl.zig: main added ncclCommAbort and ncclCommGetAsyncError to Api too; one copy kept (main's). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Conflict, both sides kept: - build.zig: sessions_build.add beside main's sys and checkpoint_config wiring, declared before both walks. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Thanks @jayleaton, and @cwschroeder for the portable guard. 1.1.1 ships shared session memory, prefix reuse, bounded RAM residency and the Linux disk tier, with staged RAM promotion and failed-insert cleanup. The later 8900c7c strengthens allocation-failure bookkeeping and adds retry controls; we'll carry that into 1.1.2 with your credit and check it through the integrated session owner. Keeping this PR open for that remaining follow-up. Posted by Ash's AI Assistant Synthena |
|
Thank you. The session pieces here (page pool, disk format, RAM and NVMe store, zero-budget behaviour, reservation) are already on the 1.1.2 line, so we're closing this as superseded too, alongside #636. One part found a real bug, though. Your allocation-failure test from 8900c7c ( - Synthema, Ash's AI Assistant. |
Reserve node and entry free-list capacity before publishing a new slot, then return IDs with appendAssumeCapacity during removal and rollback. Preserve staged RAM token publication, node ownership checks and store policy rollback. The two allocation-failure tests are from @jayleaton's PR #637, commit 8900c7c. Keep both cases and register them in the portable and full Linux session test roots. Co-authored-by: Jay Leaton <58495321+jayleaton@users.noreply.github.com>
…dits The 1.1.2 section had no entries for the contributed pull requests carried into this release, so neither their changes nor their authors reached the release notes. Add an entry for each, written from its commits: Flash Next's CUDA prompt tiles and structured output (#1046, #1062), --thinking-reserve, the long-loop guard and the --vision template diagnostic (#1064, #1075, #1076), GLM's Metal eh_proj tile and CUDA waiting ranks (#1066, #1053), M1's simdgroup cap (#1055), Nemotron's CUDA image and shared-window fixes (#1057, #1058), Qwen's live-row expert routing (#1047), the shared CUDA operators and contract fixture (#1056, #1068, #1070, #1071, #1073), the ROCm receipt, drafter and draft-count work (#1043, #1044, #1045), the ModelOpt recipe numbers (#1042), the Windows host build (#1034) and the session store's allocation-free rollback (#637). Thank #643's and #1060's reporters as the other entries thank theirs.
What this changes
sessions: session memory for paged-KV families (page pool, prefix trie, RAM residency budget, streamed NVMe tier). Depends on #636. This cumulative PR targets
main; the incremental range ise2504f6d..dcdc30c9.Commits in this layer:
5410eac2Session memory for paged-KV families: page pool, prefix trie, RAM residency budget, streamed NVMe tier.0d0bdb21Sessions: the page map is rehashed before tombstones fill it2cf61d3cSessions: honor zero residency budgets and reserve uncapped requestsdcdc30c9Keep the Linux NVMe lane test out of portable host tests (@cwschroeder, from Skip the Linux NVMe lane test on portable hosts jayleaton/TensorFold#3)dcdc30c9fixes the macOStest-sessionsSIGSYS:portable_test.zig → format.zig → lanes.zigpulled the lane roundtrip test, which calls Linuxpread/pwrite, into the portable host run. The guard skips only that test off Linux:test "lanes write, read back and check chunks through bounded staging" { + if (@import("builtin").os.tag != .linux) return error.SkipZigTest;The combined correction removes personal MIT headers while retaining third-party notices, relocates development Python tools, and preserves stored fixtures with native consumers. Expanded provenance covers the EXL3 kernel stack; no copied text was found by the performed scan, and maintainer copy scanning remains authoritative.
Overlap with main
Main's
zig/src/core/kv_pool.zig(#935,ecfa8031) is "one pool of KV pages for every stream":Layout,Budget,Plan,Lease,TableandReclaimat lines 6–97, withPoolafter them, used by Nemotron on CUDA. This PR'szig/src/sessions/pool.zigis the paged KV pool's host book (residue lanes, holders, quotas) under the prefix trie,RAM tier and NVMe tier. The two do not conflict textually, and this PR does not use main's pool.
Receipt
dcdc30c9e79046ccfd7605bed34dccb04b5c259d(tree01cc6680, dirty 0), Linux x86_64, Zig 0.17.0, 2026-10-16. No GPU or checkpoint.2cf61d3c, after =dcdc30c9, same host):testcounts are the tests executed in that run; Zig reuses cached results for unchanged inputs, and each tree's suite ran on its own (running two trees at once collides on a shared on-disk path inprompt_cache_learn_teston both heads alike). On Linux the lane test still runs in full (zig test zig/src/sessions/lanes.zig --test-filter "lanes write": 1/1 OK, write/read-back roundtrip and the damaged-checksum refusal). The portable test root compiles foraarch64-macos(--test-no-exec).test-sessions8 passed, 1 Linux-only skip; whole-treetest162/162 steps; native-Dcpu=apple_m145/45.Known limitation: conflicts with current
main.mainat46a08c18(the 1.0.12 merge) conflicts with this branch inbuild.zig,zig/src/cuda/nccl.zigandzig/src/cuda/root.zig. All three come from the #635/#636 layers below this one;mainnow carries its own NCCL tensor parallelism (tp_group,tp_watch), which overlaps #636. That integration has to be resolved bottom-up from #635/#636 and is not part of this update.Checklist
"draft": false, a resumed prompt equals a fresh one, and concurrent equals solo.Merge Danger
Door: two-way. Reverting restores the parent without a data migration.
Blast Radius: engine. The incremental commits define the affected runtime, build and test surfaces;
dcdc30c9changes only which hosts run one test. The production branch is unchanged.