Skip to content

train 1119104613: #1426 #3475 #3680 #3807 (CI only) - #3948

Closed
ashhart wants to merge 53 commits into
mainfrom
lead/train-1119104613
Closed

ashhart wants to merge 53 commits into
mainfrom
lead/train-1119104613

Conversation

@ashhart

@ashhart ashhart commented Nov 19, 2026

Copy link
Copy Markdown
Owner

CI for a landing train: #1426 #3475 #3680 #3807 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.

plotarmordev and others added 30 commits November 19, 2026 10:45
…ute in every idle-manager state

I add three route-level tests that GET /metrics through the production
dispatch with no idle manager, a healthy manager, and a parked manager;
each asserts exactly one tensorfold:open_connections sample line, the
exact TYPE line, and the admitted count, and the parked body keeps its
request-and-process-only family split.

(cherry picked from commit 3806056)
metrics.zig crossed the 600-line lean rule, so the gauge renderer and its
unit test move to load_metrics.zig (engine_parked, lanes); the route calls
it from there. The help and docs now count Unix-socket clients too, the
docs line wraps with the surrounding prose, the smoke script is named in
zig/tests/server/README.md, and the lone test block in root.zig folds
into the previous one.
The ViT and aligner on Metal (--vision), bias_vl routing for image rows, Engram shut on image tokens, an image
span prefilled in one chunk, and the prompt cache keyed by the image's hash. The server writes the template's
image token for an image part when the engine reads images, and refuses the reserved mark in request text.
OCR reads PDF pages by index under a page budget sized for one
generation per page, and must know every page's size before any
inference while holding one rendered page at a time. renderPages
takes a page selection and caps from the caller over its running
budget, measurePages reports the document's page count and each
selected page's size and DPI without a bitmap, the render worker's
request carries both and renderer failures take the caller's error
kind. Chat PDF input keeps its limits, messages and error kinds.
A Mistral client sends whole PDFs and picks pages with pages, so the
route now reads PDF documents with --vision-pdf and the pages list
or range string, bounded before it expands and deduplicated under
the request's page budget. Every PDF is measured before the first
generation, so an index out of range or a request over the budget
is refused whole before any inference, and each page then renders
alone in its page arena just before it is read, so one rendered
page is in memory at a time; a client that leaves renders nothing.
The API guide described an image-only route. It now gives the PDF
render limits and DPI, the measuring before inference with one
rendered page in memory at a time, the shared page budget, PDF
fetches under --vision-pdf, renderer failures, and the pages field;
the changelog line names PDFs and the page budget.
…calls, for queues made with Device.queue4

A queue from Device.queue4 (macOS 26 and later) takes the same calls as a Metal 3 queue and sends them through
an MTL4CommandQueue: a ring of command buffers, each with its own allocator, argument table and constants pages
in place of setBytes; a queue barrier at each encoder's start where Metal 3's hazard tracking ordered encoders;
barriers that flush to the device's coherence point, and one after each dispatch of a serial encoder; copies and
fills on a compute encoder; a shared event for waits; commit feedback for GPU times and failures; and a residency
set that follows every buffer bound, releasing a freed buffer once the queue has nothing in flight. Metal 3
queues are unchanged. TF_METAL4_TIMELINE=n stamps every stage of n named rounds on a Metal 4 queue and logs their
GPU time by kernel and the longest stages. Pipelines carry their kernel's name as their label.
…ounds named for the timeline

boot.openQueue gives the family, and its test rigs, a Metal 4 queue under TF_METAL4=1 where the Mac has one, and
Metal 3 otherwise; the kernels and their order are the same. The decode forward names each round by its rows for
TF_METAL4_TIMELINE, and TF_DSV41_ROUND_PROF=1 logs rounds' host and GPU milliseconds by rows on either queue. A new
device test checks decode rounds of 1 to 16 rows, a prompt's chunks and timestamped rounds on a Metal 4 queue
against a Metal 3 queue, bit for bit.
…ps Metal 3

Served DeepSeek-V4.1 replies were equal on Metal 3 and Metal 4 (48 of 48 in every pairing of two runs each), and
decode rounds took less GPU time on Metal 4 at every row count, so the served family's queue is Metal 4 wherever
the device has Metal 4's command queues. Macs without it, and TF_METAL4=0, stay on Metal 3. The device test rigs
stay on Metal 3 unless TF_METAL4=1, as the timing harnesses sample Metal 3 encoders; metal4_test compares both.
ashhart and others added 23 commits November 19, 2026 10:46
… failure check awaits its own feedback

Review fixes. A queue's commit feedback handlers live in its State: close now waits for every commit's feedback
and, if one is still owed after 2 s, keeps the State's memory instead of freeing it, so a late handler never writes
freed storage (closeWithin is the bounded form; a test closes one queue with every feedback in and one with a
feedback owed). A command buffer's failure check waits for that use's own feedback (a short spin, then naps up to
2 s) before it reports no failure, since Metal 4 delivers errors in the handler apart from the GPU event a wait
watches; one that never arrives is a failure. The DeepSeek-V4.1 round profiler reads and drops its pending round
before the engine closes its queue (a test checks nothing is left pending). Pipelines carry their kernel's name
only under TF_METAL4_TIMELINE, the label's one reader, so other families' pipeline builds do no extra work.
…d in tests

A balanced 27B rerun on the native binary showed tiny but consistent losses against main under a rule fixed before the
run. The Metal 4 path is now compiled in only where the program's root asks for it (the server's root reads the
engines' `metal4`, which DeepSeek-V4.1's Metal entry sets) and in tests. Elsewhere the wrapper's calls go through
inline accessors that are compile-time null, so the Metal 3 path carries no Metal 4 branch, a buffer's release no
Metal 4 step (forget also sits behind a plain flag set when the first Metal 4 queue opens), queue4 is Unsupported and
pipelines take no label. The native binary has none of the Metal 4 selectors; tensorfold-dsv41 keeps them.
test-dsv41-metal still compares Metal 4 against Metal 3 bit for bit.
Drafter.blocks takes as many streams' blocks as a decode window's rows hold (two blocks of 7): their rows go
through the projections, MLPs and head together, so the drafter's weights are read once a pass, while each block
runs prep and attention on its own stream's cache and walks its own picks (256-byte pick sets keep the RoCE
gathers aligned). draftBlock absorbs every request's kept rows first, then runs the blocks in groups; one stream
is unchanged.

Two GB10s, #1388's EXL3 pack, recipe harness: one stream 24.4/39.2/29.7/30.1 -> 24.3/38.5/29.5/30.3 tok/s
(prose/code/structured/list), two streams 31.0/44.9/35.7/52.0 -> 33.3/49.0/39.4/55.3 in total; the quick plan
passes (drafted == plain, concurrent, soak, seeded sampling).
…alls on the fused form

With TF_FLASHNEXT_FUSED_SPLIT=1, a lane call that splits K over a cluster and has 2,048 output columns or more runs on
the fused form instead: one block a 64-column tile walks its K slices and adds them in slice order, the order the
cluster adds them, so the outputs keep the cluster kernel's bits. qmmf.cu gains the fused instances at the decode row
tiles 16 and 32 (MXFP8 and BF16, bf16 and fp32 out); row tile 64 already had one.

Unset, blank or 0 leaves cuda.qmmf.fuse_split_n at 0 and every lane call on main's kernels. Metal and HIP stop the
start on 1 by name. The kernel contract gains the fused form against the cluster kernel's K slices at served and
narrow split shapes, with a control that poses a 1.5x tensor scale as the cluster kernel.
…le and tokens a round

Main against the branch on one GB10, alternating M1 F1 M2 F2, one fresh server an arm: 0 of 22 cells slower, greedy
code faster outside the noise at 6 and 8 streams (+1.7% and +1.5%), the other 20 level, tokens a round main's in every
cell. Exactness holds on main and on the branch set to 1, unset and blank, and the branch's replies equal main's.
The changelog line goes under a new Unreleased section.
… row tiles 16 and 32

registry.cuda gains the eight fused instances (MXFP8 and BF16, bf16 and fp32 out) with nvcc 13.0.88's registers,
static shared bytes and launch bounds for sm_80, sm_86, sm_89, sm_120 and sm_121, read from a five-SM qmmf fatbin with
the contract's own cubin reader. nvcc 13.3 compiles them to the same usage, so no later set needs an override.
…sts, and zig build test reaches them

The three tests of TF_FLASHNEXT_FUSED_SPLIT's reader, its CUDA threshold and the Metal and HIP refusals had no build
step. They now have their own, test-flashnext-fused-split-host, which the test step depends on, as the RoPE refusal
tests beside it do.
…unset as a third arm

Main against the branch commit 4df765a on one GB10, both built the same way from their own commits, alternating M1
F1 U1 M2 U2 F2 with one fresh server an arm. With the setting 1: 14 of 22 decode cells faster (+1.0% to +1.8%), 8
level, 0 slower; unset: 21 level and 1 at +1.1%. Tokens a round are main's in every cell. Cold prompts of 2,048 to
65,536 tokens are level. Exactness holds on main and on the branch set to 1, unset and blank, and the branch's
replies equal main's. The changelog line takes the new numbers.
A fatbin set for sm_80, sm_86, sm_89, sm_120 and sm_121 built from
120123a by nvcc 13.3.73, then tf-cuda-test kernel-contract-limits over
it: the eight launches this change adds report record current on all five
SMs, both planted controls go red on all five, and the run's 834 problems
are other launches' nvcc 13.0 records that nvcc 13.3 compiles differently.
limits.txt is its output; the README says what the run proves and what it
does not, and records main 964174e as merged, which moves none of the
files the measured arms ran on.
…2b3722

The receipt's source section names both merges of main, 964174e at
120123a and d2b3722 at 1e24f26, and says what main changed between
41a72fd, where the arms ran, and d2b3722: 111 files, of which this
change touches CHANGELOG.md and docs/environment.md, and three are on a
Flash Next CUDA request's path (fp_pairs.cuh gains a function only
nvfp4_experts32.cu calls; lane_host.zig and lane_host_end.zig count a
cancelled request's work in the load ledger). No file of the fused split-K
path moved, so the arms describe both merges.
…not only an EXL3 one

The loader picks a dense layer's form from its stored dtype (mlp.held), and the B16 scratch plan counts the dense shapes whenever a dense layer is held bf16.
core: dfloat11.zig decodes one coded group, written from the format's description; dfloat11_config.zig reads
config.json's dfloat11_config (the pattern steps the published configs use, others refused by name);
checkpoint_coded.zig finds the groups in the headers, answers their members' weight names, decodes a group once and
frees it at release; checkpoint.zig's get, expect and has fall through to it. A checkpoint with no coding attached
reads as before.

glm: cuda_dfloat11.zig gives the shapes the files omit (q, k, v, o, kv_b, the embedding, the head) and attaches the
coding to the loader's two checkpoints; cuda_weights.zig's load calls it.

Refs #3649.
@ashhart

ashhart commented Nov 19, 2026

Copy link
Copy Markdown
Owner Author

Restacking: the train this one was stacked on did not land as tested.

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

7 participants