Repository navigation
Merge upstream main - #66
Merged
Merged
Conversation
Qwen 3.5 on CUDA reserves its forward scratch at startup in its own device allocation, separate from the weights arena, sized to the configured --context (capped at the largest forward pass) plus the verify window. The optional INT8 prompt workspace is reserved before serving too. A forward past either reservation is refused before any kernel launches.
fits unwraps pages with a capture, and ledgerPool and release cast in place of a local used once. The same calls on the same values.
Six growing agent conversations on a shared 8,192-token system prefix with one-offs between turns, two cohorts of interleaved chats, and unique one-off prompts, replayed through Store.begin/keep/lookup/restore/remove at 4, 8 and 16 GiB. Shared cuts reach the store, so a common system prompt restores as a prefix. A frequency/probation selector runs beside main's for comparison; production eviction is unchanged. zig build cache-agent-replay prints the records. Refs ashhart#3241
…in eviction (opt-in) A resumed snapshot gets eight store ticks of recency credit, at most two resumes' worth, so a conversation that keeps coming back outlives one-off prompts without outliving its use; redundant copies, the active rewind, borrowed entries and reservations keep main's protections. Off by default: unset, eviction is main's order exactly (host controls replay main's choices on every trace). Measured through the real store on frozen traces: at 16 GiB agent loops rebuild 28-34% fewer prompt rows and agent cohorts 24-30% fewer, at 4 GiB 4-18% fewer across agents and chats, no cell worse on seeds 7, 11 and 23. The replay gains an agent-cohort trace and confirmation runs per seed. Refs ashhart#3241
… windows (ashhart#2840) Bolt sizes its shared slot for every window row and plans its one-expert shared layer once at load for rows 1 to windowRows, with its own act and out rows, so the routed path's plan, act and ymoe are never shared. In a decode window with a side stream the shared up and down kernels run on f.side between a fork and a join; the main stream waits for the join before addBf16, so the sum keeps its order. Windows without a side stream run the same kernels serially; prompt chunks are unchanged. shared-fork covers Bolt with a NaN-poisoned slot and the side stream held back.
… as on one GPU The draft head's pieces and groups and the rollback replay ran eagerly whenever a collective was attached. None of them calls the collective: the head's pass carries no collective and loads its layer whole on rank 0, and the replay is local copies and DeltaNet launches on each rank. Each graph replays exactly the launches the eager pass makes, keyed as on one GPU. Main-model windows keep their one-GPU guard (their passes hold NCCL calls). Host tests drive runPiece, runGroup and the rollback through a recording driver with a collective attached, and check every per-round host value moves each key. test-flashnext-rank-graphs-host runs them. Part of ashhart#2835.
…the product At one row the ranks' gathered blocks [2, 1, width] are already the row [1, 2 * width], so the out projection reads the gather's buffer and its FP32 gather writes part's row directly, and the split shared expert's down projection reads its gather as it lands. The bytes each product reads and part holds are the ones the two-copy path made; more rows keep the copies. The launch-recording tests expect no interleave copy at one row. Part of ashhart#2835.
…ne comments; no code changed
…er 600 lines; one-line comments
C6 of ashhart#2444 makes reuse depend on more than the key: a request's image identities and frame, a namespace, its own chunk starts and the rows it prefills. The family's Query now carries them through kv_prompts (a core-side image identity, converted by the CUDA adapter) and GLM passes its stream's images. The store enforces none of them yet, so every store user is unchanged.
C6 of ashhart#2444 for the resume schedule: as in the copy store, a planned store cuts and resumes at a request's own chunk starts when it gives them and on its grid otherwise, so a grid point inside the request's chunk is never its resume point; the marks, keeps and both tree walks use one rule. A key of another length than its prompt now reuses and keeps nothing, and a keep past the rows a pass prefills is refused. Without starts every store user cuts where it did.
C6 of ashhart#2444 for content: a page matches only when its words, the words past it, the exact identities of the images over them, and its namespace and frame are all equal, as the copy store compares exact image identities beside its key. Two pictures under equal key words are two branches, text before them stays shared, and a split keeps an image on both sides. Eviction reads the same identity, so another namespace's longer prompt never counts as a conversation moving past a state. Text keys match as before.
A shared cut was recorded by its words alone, so a cut planned in one namespace or over one picture could flag another identity's state at the same words as shared, and keep it from its normal eviction order. The record now hashes the namespace, frame and image identities too (text in the default namespace hashes the same words as before). A test through the CUDA adapter shows a picture reaching the store: text pages shared, image pages not.
… reads: about 1 GiB less Every 4/64 dense projection got lane tiles, and their CPU tile jobs, on every Mac. Without tensor units every linear also has its row layout, and each tile reader tries the row kernels first, so the tiles were never read. The exception is the MTP head's eh, which coopParts reads directly. - Linear.lane marks a projection the lane kernels can take. The kernel choices that keyed on tiles (simd_bits pipelines, prompt chunks' MLX qmm, the mixers' qkv) now key on it, so every path picks the kernel it did before. - Builder.tiled() builds tiles only with tensor units, or for the pinned eh. On Nemotron 3.5 Lightning the load keeps 17.8 GiB wired, not 18.8; replies are unchanged.
…ites its rows and skips the tiles Without tensor units a 4/64 projection has rows and no tiles (Builder.tiled), but retile unwrapped them, so TF_SLIDE_EDIT=1 --slide crashed committing the shared down projection. retile now writes tiles only where they exist. A device test commits to a row-only projection and checks its row copy; on the old retile it crashes.
…ly as on main Linear.lane was a field, so every Linear grew by a word on every Mac, and the MTP eh was built before the head's norms to set pin, so tensor-unit chips allocated and queued its tiles in a new order. lane() is now derived (tiles first, then 4/64 rows where none are built), and eh is built in main's place with pin set around it. A device test pins the tensor-unit build: three 4/64 projections give three tile jobs, six tile buffers and no row copy.
…rted seed POST /v1/images/generations runs up to four pictures one after another through the engine's one-picture call, picture i with seed + i, or with its own seed drawn below 2^53 when the request has none. Each data item reports its seed, and each PNG is the n: 1 request's with that seed. A refusal, failure or cancel mid-way returns its error with no pictures; a client that leaves cancels the picture in flight and submits no more. n outside 1 to 4 is a 400 naming the range. Fixes ashhart#3223
… has Picture i of a request without seed uses 42 + i, so n: 1 without a seed gives the same picture as before and n above 1 gives distinct, reproducible pictures; the drawn per-picture seeds are gone.
The target-to-drafter table moves from benchmark_model.zig to drafter.zig, so serve and the benchmark read one table. With no --drafter, serve looks the target up there and resolves its drafter through the local hub resolver only, so nothing is downloaded, and logs one line naming it. A drafter it paired that does not open is dropped with one line and the target opens alone. --drafter none serves without one, and an explicit --drafter keeps its meaning. The benchmark's serve child gets --drafter none when the plan names no drafter, so it keeps the drafter it chose. Fixes ashhart#3173
C5 of ashhart#2444: a sliding window gives back the pages behind it while its stream runs. A retired page carries the token of the last forward that may read it until its last holder lets it go, waits pending until settle passes that token, and only then is free; the lease's promise for it comes back at settle, so no count names a page that is not free and no run takes a pending page. The state lives in one field, allocated at a pool's first retire.
P4 of ashhart#2444: a window helper lays a family's sliding layers out as bands in pool pages of its full pages' rows, each band its own table on one page-major lease. Before each forward it retires the pages no kernel can load again and covers the rows ahead, all or nothing, and it hands a keep each band's pages from the window's first loaded row.
P4 of ashhart#2444: the head dim 256 paged attention kernels already start at a window's first key and find each key's page by its absolute position, so the host now admits a window with pages there. Contract cells and a device test show the paged path gives the ring kernel's bits, with NaN in every page below each window, so no kernel reads a page a stream has retired.
Window.step settled its own forward's token before that forward ran, and settle is pool-wide, so it could free another lease's page retired under the same token while that forward might still read it. A step now only retires under its token; the caller settles the token once the forward's work is done, before the window's next step, and the window's promise covers one step's retired pages until then. Tests settle after each forward, show a page retired for forward t staying out of take, runs and available() until settle(t), and show a full pool's credit backed by reclaiming a kept page.
reclaimable() subtracted waiting(), which scanned every page of the pool once any page had been retired. The retire state now keeps a list of the pages that carry a token, each with its place in the list, so waiting() scans only those and a page leaves the list in constant time when its token clears. The scan oracle checks the list and waiting() against a full scan, and the first retire's allocation failures are covered at all five allocations.
Since 1.1.2 the recipe has said the opt-in --kv-cache fp8 cache's native quality and device qualification are pending. This receipt measures both on FP4-Local at main 3a56d4e on two GB10: over 360,418 teacher-forced positions the FP8 cache keeps the mean NLL within 0.06% of the BF16 cache with a top-20 KL of 0.016, a third of the 0.043 between NVIDIA's NVFP4 and FP4-Local, a BF16 rerun gives the same bytes, and drafted, concurrent and resumed replies stay token-equal. The recipe and ledger lines now cite it; the default stays BF16.
The FP8 latent cache changes all three golden replies against the BF16 cache, and a token-changing mode cannot be qualified, even as an opt-in, so the recipe, the optimization ledger and the receipt's scope now call the measurements diagnostic evidence of how far FP8 moves and say BF16 stays the only qualified cache; no number or file changes.
The "about a third smaller" figure divided a whole stream's 1.08 GiB, 231 MiB of fixed per-stream state included, by the window and set it against the BF16 page bytes alone; the recipe, the ledger and the receipt now give the cache's own 6,960 bytes a token on each rank against 13,056 (-47%), from cacheBytes and the 12 latent caches, with the fixed 231 MiB a stream stated beside it.
…eckpoint at TP=2 On Bizuayeu/GLM-5.3-Flash-Jammed-XSFP4, greedy, two GB10s at TP=2 with --parallel 4 and main 0fed2e4, copies kept every reply the same token for token, but sped some loads up and slowed others, so TF_GLM_COPIES=1 stays opt-in (the owner's answer on ashhart#1910). The Verified copy drafts section said device exactness and speed were pending; it now says what that checkpoint showed and gives its rows, in that scope.
…Target.qwen, as ashhart#3511's runtime does ashhart#3511 made the DFlash2 backend's target a runtime_target.Target value instead of a model pointer; these two fixtures still assigned a pointer, so test-metal-residency-owners-host stopped compiling on macOS (it runs only in the nightly).
…eam-main Conflicts: zig/src/server/benchmark_model.zig: drafter.zig owns the table; modelType still serves qwen4_moe as qwen4_exp zig/src/server/main.zig: loadText keeps the model type for woof; open pairs the drafter serve chose itself
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Merges
upstream/main(077998f7d) into my fork'smainas a normal merge — no rebase, no squash.Two conflicts, each resolved keeping what both sides meant:
zig/src/server/benchmark_model.zig: upstream moved the drafter table intodrafter.zig;modelTypestill namesqwen4_moeasqwen4_expfor the engine registry.zig/src/server/main.zig:loadTextkeeps the model type (a woof checkpoint ships no tokenizer), and startup opens throughdrafter.openOrPlain, so a drafter serve pairs by itself and falls back to the plain target if it does not open.zig build test test-goldenpasses on the merge: 13,326 tests, and the server goldens report 0 unexpected differences. I added no changelog entry and no tests; upstream's commits come in as they are.