Repository navigation
Conversation
The native HIP server wraps the qwen3_5 dense target with the lane core's Drafted over the HIP DFlash2 drafter: taps are set from the drafter's config before streams are sized, the drafter's weights and per-stream state count in the memory plan, and window costs go to the drafter. - refuse --drafter under --tp > 1, at other --drafter-bits, and for HIP families without a DFlash2 drafter; benchmark --drafter on rocm - an absorb refuses kept rows past its features; features serve only rows the ring holds for the drafter's window - docs: the 27B recipe and community benchmarks A test pins that --no-drafts with --drafter loads no drafter and is not refused.
tf-qwen35-test check takes --drafter <dir>: the lanes session opens the HIP DFlash2 drafter as the native server does and wraps the target with Drafted, so drafted == serial, solo == together and graph == eager run for Qwen3.8-27B instead of skipping. The taps invariant restores the taps it found instead of switching them off. The lanes session likewise restores the taps it found when it ends or its drafter fails to open.
A stream resumed from a kept prompt state taps no rows below the resume point, so its ring holds zeros there while features() counted them as written. features() now refuses them with RowsNotHeld, as Nemotron and Gemma4 do. Drafted already absorbs from s.cached, so no served path asks for those rows.
…a fresh one The resumed invariant compares a resumed drafted run with a serial one. This adds the drafted run of the same prompts with every kept prompt evicted first: it must resume nothing and give the resumed run's tokens, and the check prints each run's drafts kept, drafted and rounds, so a resume's effect on acceptance is visible.
main now serves some BF16 qwen3_5 checkpoints (image towers the engine reads, and joint-head decisions), but the engine times no BF16 windows, so the DFlash2 drafter would run its rounds unpriced. A BF16 checkpoint with --drafter is refused by name before any load, as the drafter's stated limit says; quantized checkpoints and serves without --drafter are unchanged. A host test pins the refusal on a BF16 chat config and its absence on the same config quantized, or without --drafter.
… (six blank lines fewer) Main's 2027e7a ("flashnext hip: one refusal test for --drafter and --mtp-drafts, so hip.zig stays within 600 lines") left hip.zig at 599 lines, and the DFlash2 drafter's group check put it at 606. Six blank lines between adjacent tests at the end of the file go; no code changes.
…calls, after main's 1a10b0b Main's 1a10b0b ("hip flashnext: opt-in --mtp-drafts up to 7 on a lone stream (#3053)") gave checkGroup a comptime family parameter. The merged --drafter test's four calls pass qwen35.native, as main's own refusal tests do; at --tp 1 that family drafts at most 3, so the test's --mtp-drafts case keeps its message.
…n's 1a10b0b (one blank line fewer) Main's 1a10b0b ("hip flashnext: opt-in --mtp-drafts up to 7 on a lone stream (#3053)") added the mtp_drafts_hip_test.zig import, and with the DFlash2 drafter hip.zig came to 601 lines. The blank line between the group-flags test and the --drafter refusal test goes; no code changes.
…nly test may name its engine #3665 imports engine.zig as a module-level `engine` (for engine.tap_window); main's ed4e935 (Fixes #4061: price copies-only HIP plain rounds) added a test whose local `var engine: Engine` shadows it, which Zig refuses (hip_lanes.zig:537), so hip-host-test failed to compile. The import is renamed engine_mod; no other change.
…re each byte sits in its lease The rows store's view of a GLM kept state, without the store: the words (format, position, head rows, ring bases, KDA copy bits), the KDA prefix, each DSA layer's latent rows, scales and whole pools by position, its rings and pools in progress as the state's own, the head's caches at a whole verify window (rows past the head's own read as zeros), then the tail. Copies run a page of the lease at a time. Nothing is wired to --learn-conversations yet.
…state on disk Rank 0's engine thread leases, fills, reads and seals each rank's copy through the follow link (cuda_disk_ranks: blank, put, take, seal, prefixes). The store's image is rank 0's image followed by each other rank's prefix, the one part a rank holds alone; the rest are the same bytes on every rank, checked at start by the identity probe. A blank state is refused by restore until its seal. A blank whose disk step fails on the link gives rank 0's lease back, and its id goes on the dropped list, so the next step drops it on any rank the step reached; the id is not used again. An NCCL failure there already ends every rank (the liveness lines), but a CUDA error in the step's launch or upload returns to the disk read, which tries one shorter state and then prefills while the server goes on. cuda_disk_ranks_test.zig runs the steps on host memory with a fake link: that failed blank, a blank state refusing bytes past its words and front until sealed (DiskOrder), each BadStep a follower refuses before its states or the link, and each other rank's shared bytes taken past its prefix and compared to rank 0's (RanksDiffer, in ranks.same, which the probe calls). attach's refusals of the shared store and of more ranks than prefix_buf holds (KvShareWithLearnConversations, TooManyRanks) have their own test in cuda_glm_disk.zig. link and prefix_buf stay process-wide: the process serves one model. With TF_GLM_KV_LIVE_HALF=1 a keep holds one KDA half and the disk image both, so GLM refuses --learn-conversations with it by name at startup (cuda_refusal.zig); the test that pinned GLM refusing --learn-conversations outright now pins that it takes the flag alone and refuses it beside live-half keeps. Rank 0's link becomes the disk steps' link in `follow.Link.lead` (which also sets whether the other ranks begin asleep), at TP only, and `Link.deinit` clears it, so cuda_native.zig stays at its 600 lines. cuda_disk_ranks_test.zig: one rank leaves the steps local, two set the link, another link's deinit leaves it, its own clears it; the test fails with the clear removed.
…sk state into that storage A family whose kept states live in preallocated storage it reuses (GLM's snapshot pages on CUDA) and cannot trim never had a disk read chosen: the selection counted its spare storage as fixed and its kept states as not reclaimable, so no state ever fit. Such a family's room for a read is now its spare storage plus what evicting unborrowed states frees, and a read is ready once the family says its spare storage takes the state, as a keep's admission already asks. Families with trim, or without reused storage, are unchanged.
…t, as before The disk read's early admission for a family whose spare storage takes the state now applies only to a family without trim, as the selection's capacity already does. A family with trim, such as Flash Next's or Qwen3.8-27B's pools on Metal, makes room for a read by trimming its spare storage and evicting, exactly as it did before, and a new test pins that its read stays within the budget when its reuses answers yes.
…he state's rows An index ring based at `base` holds the rows from `base` up to the state's position, and the image keeps at most a ring's rows of each. The seal now checks the words' main base against the state's position and the head's base against its rows, so an image whose words name a ring that starts past them, or too far back to be held, is refused before the blank state is made whole.
…/O worker GLM's store uses The write-behind gave GLM's store its own I/O worker, while the grid test wrote on the test's thread (sync_writes). It now runs on each, drained by write.drain, so a worker path that loses the grid's chunk starts fails the test.
…rn-conversations alone keeps its states Since #1413 CUDA serves --spill-gib and --checkpoint-slots, and --learn-conversations admits GLM, so --learn-conversations --spill-gib (or --checkpoint-slots) opened GLM and ignored the flag: its disk store writes every rank's part between passes and stages nothing at eviction. GLM now refuses both by name. Its store's spill stays off, since an eviction would gather on rank 0 mid-pass while the other ranks wait in the gate's all-reduce. docs/api.md lists every CUDA family that keeps states on disk.
…he shared-store refusal names TF_KV_SHARE - A kept state's device pages are read out with cuda.memory.download, which stages through the pinned buffer on an integrated GPU (#2103, #2289), as every other synchronous readback does; the copy back in stays a direct HtoD. - The refusal beside share_pages names TF_KV_SHARE, the switch behind it since #2211, in its message and comment. - The disk image test's driver answers cuCtxGetDevice and cuDeviceGetAttribute (a discrete card).
…e owner, and a read refuses another by name The image's words gain three: the ranks that wrote it, its layout and the rank that owns its latent rows. Every image is unsplit so far (every rank holds every row): it records this server's world, layout 0 and no owner. A read refuses words of another world (DiskWorld) or another layout, or an owner its layout does not have (DiskLayout), before the blank state is sealed. The words are 72 bytes, the seal step 18 words. #1431's split states fill the layout and owner without another format. A disk read forgets a state's file refused as DiskWorld or DiskLayout after one recall, as it does one refused as DiskWords (rows_read.refused); rows_refusal_test.zig's cases include both.
… attach, so a long state is staged whole cuda_glm_disk.attach opened the store with rows.Rows.open, which keeps the 1 GiB default staging permit and skips the floor rows.attach applies (the longest state's charge, within the RAM store's budget). At about 18.5 KiB a token that stopped every state past roughly 55K tokens: `imprint: saving 124928 tokens skipped (StagingFull)`, whatever --learn-gib said, and a long conversation was recomputed cold after a restart (found by crystal8194 on #1411). attach now goes through rows.attach, as Qwen 3.5 27B does, with `longest` the capacity's whole pools (`image.longest`, the last position `parts` takes; rows.attach falls back to the default when pricing it fails, so the position matters). Spill stays off and the slots unset, as before. The start-up line gains the permit: "a save stages up to N MiB". Tests: - test-cuda-disk-open-host: GLM's own open over a store of 18,944-byte tokens. A 124,928-token state's charge is past the 1 GiB default and within the permit, which is the longest state's charge; with a RAM store too small to keep the state the permit stays the default. It fails with the floor gone (the permit is 1 GiB). It prices the permit a save's stage step asks; it does not write 2.3 GiB. - The GLM set: `longest` is a position the store's parts take at capacities on and off a pool's edge, and the next pool past it is refused.
…id from one class, and one class is today's pool A pool can hold W owner classes (Pool.initClasses, Layout.classes): page ids c, c + W, c + 2W ... form class c, each on its own free stack, as DeepSeek's sessions pool books ids by residue (pg = local*W + r). A lease names its class (Lease.owner) and every id it takes, adopts or shares is of that class; a promise fails when its class lacks the pages, though another has them. The owner rule lives in one function: roomiest, the class with the most available pages, the lowest on ties (#1313's). fitsAny answers as a promise from it would. planClasses floors a plan's pages to a multiple of the classes and refuses a class that holds less than one stream's window (ClassTooSmall); plan's error set is unchanged, and at one class planClasses is plan for the same budget, the cache's slots and slots_only (#2358) included. The class book lives in kv_pool_classes.zig (planClasses, the per-class counts, roomiest, fitsAny and the stacks' push and pop, and the class tests' imports); kv_pool.zig keeps the fields and names them, and promise and hold keep main's reclaim walk (#2528's chain) as it is: the class test comes after it. Above one class, runs are refused (claimRun null, coverRun as cover), since a run spans every class, and so is a reclaim store: joinReclaim returns OwnerClasses, since a store's eviction frees pages of any class and a promise needs its own class's. Nothing joins one there today (GLM refuses TF_KV_SHARE with the split); the refusal keeps it so. One class is today's pool, id for id and in the same order: init is initClasses(..., 1), and a scripted run of promise, cover, trim, finish, hold and release gives the trace main records (pinned by its hash). kv_pool_trace_test.zig goes past that script on one class: 400 seeded steps on 32 pages through adopt, share, drop, runs, reclaims and a shuffled stack, every operation taking effect, its store joining as any store does (joinReclaim), its hash recorded on main's kv_pool.zig (ddd2df8, again on 9c9bf54, and on f03e5aa, after #2528's chain).
…t one rank, without pages or with host pages The switch for #1431's per-rank latent book: unset, 0 or off (the default) and 1 or on; any other value is refused naming the choices. Every rank resolves it inside the watched start, after TF_KV_PAGES: one rank is KvSplitNeedsRanks (checked first, since auto pages are off there), pages off or fp8 windows KvSplitNeedsPages, TF_GLM_KV_HOST KvSplitOnHost, and TF_KV_SHARE KvSplitShare (the store's pages come from any owner's class). The fingerprint carries it (layout 21), so ranks started with different values stop with kv_split named. Nothing books by owner yet: this commit only reads, agrees and refuses. Its rows: environment.zig checks the same four words as a glm row, when GLM's CUDA family opens on every rank, so a typo never stops another family (docs/environment.md; cuda_env_test.zig), and profile.zig registers it beside TF_GLM_KV_HOST for glm5_next, identical, 1 and on reported as set, evidence #2415, since it changes how pages are booked and how many streams fit (docs/profiles.md).
…s lie in two regions, each with its own table The pool's arena is the same bytes, laid out as two regions: every page's pooled keys first, a pooled part apart, then every page's latent rows, a latent part apart. Both strides come from the weights (the DSA layers and the head times a cache's part), so a thin model's pages are laid out alike. Each paged sequence gets a second table after its first (State.ltable), and Caches a second (pkt): the latent launches (lat_write, the dense and sparse chunks, and dsa_tokens' rows) take the latent table and stride, the pooled-key launches (pool_keys, scores) the pooled table and stride. No kernel or launch is new. attend refuses a pooled table without its own stride before it launches. Every rank still holds every row, so the latent table holds the same ids: TF_KV_POISON fills both parts of a page, and kept states copy the same bytes. Off, every launch argument, table write and fill is as before.
…wner's class, sent with begin and checked by every rank With the switch on, the pool has an owner class a rank (Layout.classes = TF_GLM_WORLD). Rank 0 picks a stream's owner when it opens, by the pool's rule (the class with the most available pages, the lowest on ties), and takes every page from that class; admission asks whether that class holds the request. begin carries the owner in its unused depth word, and every other rank checks each id is of it before it maps anything (ResidueMismatch, or BadStep for an owner past the classes). The pool step carries the switch, and a rank whose own differs refuses it (RankMismatch). Every rank refuses a pool whose class holds less than one stream's window (ClassTooSmall), and the plan floors the pages to a multiple of the classes and refuses such a class with its numbers; it plans from the budget main's plan builds, the cache's `slots` and slots_only (#2358) included. A request longer than a class is refused by name, never requeued. The lane cost cache keys its prices on the switch (keyShape's split word): under it the timing stream books its pages from a class. Every rank still holds every latent row, so the owner is bookkeeping only for now; the start-up line says so, and the idle line counts each class. Off, there is one class: ids, admission, begin and the pool step are as before.
…r classes, each prompt on one, the classes in turn The check resolves the switch as serving does (cuda_start.splitting, refused by name at one rank) and, with it on, makes an owner class a rank of two windows and a page over each. Each prompt's paged stream and the stream that shuffles its pages open on the same class, k % W for prompt k, so every class serves and its pages still come out of order (jumps counted by W). Every stream is compared with its twin on a whole window, byte for byte, and every class must be idle after. Off, the check is as before.
…th regions of every leased page, once A paged sequence on two regions (every page's pooled keys first, then every page's latent rows) and one on interleaved pages, both on ten ids out of order, at a length whose latent rows and pooled keys reach every page, with and without the MTP head. The split plan's paged pieces, counted on a map of the pages, read every leased page in both regions, each row's bytes exactly once, and nothing else (no overlap, none missed); the rows are placed from the geometry alone, not from the state's fields. With the same rows in both layouts (every row on every rank), the split plan's bytes, in its order, equal the interleaved plan's and so do the lengths. Both tests fail when the pooled parts step by the latent stride (x.ps) or the latent parts by the pooled one. glm_snapshot_host.zig is at 600 lines, so the tests have their own file in the same step.
…links, Header bytes and all, to a follower's loop Rank 0 is a Leader on the pages' fake engine with a Link on host memory: Leader.pool and Leader.beginOn encode through Link.send's put path (tf_glm_put_words run on the host, word for word) and a host NCCL that keeps each broadcast. The pool step's 64 bytes carry the switch in flags, and begin's carry the lease's owner in depth, with its ids after; off, both are byte for byte the headers main sends (flags 0, depth 0). A second rank decodes them in follow itself, through Link.receive: its pool books an owner class a rank, and slot 1 maps rank 0's ids under that owner. A begin whose owner on the wire is not its ids' class is refused (ResidueMismatch) with nothing mapped, and a follower started without the switch refuses the pool step (RankMismatch) and makes no pool. Mutants, each alone: begin's depth left 0, the pool's flag dropped, the follower's begin calling map (owner 0) and its pool step ignoring the flag; each fails at least one of the three tests. The pages' split test's Fake is made pub for it.
…ions, each with a control given the other table No launch is new, so glm_cuda_records.zig is unchanged; what the split changes is the geometry the eight paged launches meet. contract_glm_pages.zig gains Geometry: in an arena of n pages, every page's pooled keys first (2 x 32,768 bytes apart), then every page's latent rows (2 x 524,288 apart), the second cache tested. With regions on, tf_glm_lat_write and tf_glm_chunks_16/32 (dense and sparse) take the latent region's table and stride, tf_glm_dsa_tokens rows of that stride (1,024 a page, not 1,088), and tf_glm_pool_keys and tf_glm_scores the pooled region's. Off, every argument and byte is as before. contract_glm_regions.zig's Set holds the eight cases at either geometry; contract_tests.zig registers the eight on two regions (2 lines), and Controls now holds both sets as controls (8 -> 16). A region control gives each launch the other region's table, a second shuffle of the same pages that differs at every entry (sparse chunks: token rows read through it), so its rows land on or come from other pages. glm-index-check gains a paged case at the pooled stride (12 x 32,768, which tf_glm_index_scores' fast path takes) with a latent table of its own for the token lists. docs/kernel-contract.md says so. Host tests (test-glm-page-contract-host, 3 -> 5): sixteen controls, the last eight on two regions; a disabled control in either set is refused; the region cases register apart from the interleaved ones at the same served shapes as their controls; the regions fill the interleaved arena exactly, pooled keys first, and off places everything as before; a region control's table differs at every entry (1-11 pages, 64 seeds each). Mutants, each caught: the fix-up of equal entries dropped, the latent rows placed at the first cache, Set ignoring regions, the region controls not planted. The GPU gates (each case green, each control red) are not run here; the contract's body cross-builds for aarch64-linux with empty images (-Dfatbins, -Dcontract-controls), which is what analyzes it.
…e inside the reservation Admit.need gives the pages a request needs a class (kv_classes.Need: one, or a spread for admission only). The lane host tests it in its ledger beside the family's fits, and refuses a request past a whole class by name even while other streams run. Gate.want takes a class, so a promise passes its class's test with the pool's bytes inside it. Pool.reserve picks the owner (a resumed prefix's class, else the roomiest) inside the reservation, and a failed one leaves the owner and every count as they were. No multi-class reclaim: joinReclaim still refuses above one class. At one class every answer is #2415's: the ledger-counted pool trace hash is the one #2415 records.
…y, no class hook refused, one notice a reservation A request past a whole owner class is refused at takeJob before a lane is asked for (lane_host_admit.refused), not only once one frees; requests waiting for a read or a prefix cut, or already cancelled, are left to their own path. Ledger.ofPages refuses a pool of several classes without the class hook (NoClassHook) instead of reading the whole pool as each class, and a resume's class the pool lacks never fits and is refused. Pool.reserve is one pool change: a failed reservation notifies once, with the owner already restored. One class: no answer changes.
…class-aware retire pushes Follows three moves main made under the stack: - Admit and Ledger moved out of engine_api.zig into engine_admission.zig, so the review's `need` hook lands there; cuda.zig's `.need = kvNeed` wiring and lane_host_ledger's class checks read it. - Mid-stream retirement (kv_pool_retire.zig) frees pages through freeOrPend/settle pushing straight onto free/nfree, which would leave cfree[0] behind nfree once classes split the stack; both pushes now go through owners.push like the other frees. - Main's launches take cuLaunchKernelEx once a dependent attribute is set (cuda.launch.launch picks the Ex entry when the config is not plain), and GLM's go through cuda_pdl.launch with PDL on by default; the disk and follow test rigs that stubbed only cuLaunchKernel now forward the Ex entry to the same recorder via cuda_pdl.forwardEx. - kv_pool.zig at the union of both sides is 605 lines, past the 600 cap; claimAt (one class only, like the runs around it) moves into kv_pool_classes.zig, and lane_host.zig / cuda_kv_pool.zig each drop a blank line against their hunks. zig fmt alignment on the merged keyShape arg table.
…main (nine blank lines fewer) lean_check failed on cuda_kv_pool.zig at 601 lines: main's file is at 600 and the C1 adapt adds a line. cuda_state.zig reached 608 with TF_GLM_KV_SPLIT's latent region and second table on main's Shape. One and eight blank lines between adjacent declarations go; no code changes.
7 of 8 tasks
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.
CI for a landing train: #3665 #3676 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.