Skip to content

train 1119075648: #3578 #2825 #3329 (CI only) - #3929

Closed
ashhart wants to merge 175 commits into
mainfrom
lead/train-1119075648
Closed

ashhart wants to merge 175 commits into
mainfrom
lead/train-1119075648

Conversation

@ashhart

@ashhart ashhart commented Nov 19, 2026

Copy link
Copy Markdown
Owner

CI for a landing train: #3578 #2825 #3329 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.

Bizuayeu and others added 30 commits November 19, 2026 01:13
…ared gate-up, after its router

Site f read a MoE layer's router alone. The shared expert's gate-up runs on the same window once the routed
experts are done, and its scales and codes now follow the router in the site's rows, inside the same budget.
The table's test gives layer 1 a block FP8 shared gate-up and checks where the 12 MiB budget cuts it.
…age cache after load

Shard 15 of the NVFP4 checkpoint holds the n-gram table beside 3.27 GiB of load-only tensors (embedding, HC,
MTP, vision); the runtimePages guard skipped its release whole, and the final sweep listed only top-level
*.safetensors while this checkpoint keeps its shards under tensors/. Now a shard drops everything but the
n-gram tensors' pages (releaseExcept), and the sweep walks the index's shards (core.checkpoint.shardFiles).
Split ling_mla_gpu.zig past 600 lines by job. One-line comments in mla.metal
and one-line docstrings in the python oracle. Lean new vs main is 0.
Register tf_ling_mla_rope_cache, tf_ling_mla_rope_q and tf_ling_mla_gate_expand
with planted source controls, the way Ling KDA and route were done in #3055.
AutoGPTQ v1 stores a 4-bit symmetric weight as qweight int32 [k / 8, n] with
eight inputs a word, scales fp16 [k / 128, n], and qzeros int32 [k / 128, n / 8]
whose every nibble is 7, so a weight is (nibble - 8) * scale.

core/quant/gptq.zig reads that form. The config side admits quant_method gptq
with bits 4, group_size 128, sym, no act order and a quantized lm_head, and keeps
its dynamic rules in declaration order, so the last rule matching a module
decides whether it is stored quantized. A rule is matched with Python's re.match
over the subset the rules use: literals, '.', '\x' escapes, '*' and '+' after an
atom and a final '$'. A rule outside that subset, an unprefixed rule key and a
rule whose own bits or group_size differ are refused by the rule's name rather
than guessed at. Anything else stops the load naming the field, the rule or the
tensor: bits, group_size, sym, desc_act, lm_head, a missing or malformed
dynamic, a qweight, scales or qzeros of another dtype or shape, a qzeros byte
other than 0x77 with its offset and value, and a non-empty g_idx, because act
order is not read.

read returns the three stored tensors as views and reference writes every
dequantized weight as binary64: q - 8 is an integer and the scale an fp16 value,
so each product is exact.

Host only: no family calls it, no kernel reads it and no setting is added, so
every checkpoint served today takes the path it took before. The test builds a
synthetic GPTQ checkpoint (config.json and a safetensors image packed by the
format's own definition) and checks a binary64 fixture of hand-derived values,
every refusal by name, the matcher on the rules a real export writes, and the
reader on both modules of the checkpoint.

Refs #3368
…nd a non-bool desc_act

A rule's backslash escape was read as the character that followed it, whatever that was,
so ".*layers\.\d+\.mlp.*" matched "layers.d.mlp" here while Python's re matches
"layers.12.mlp" there: a module the rule leaves BF16 could read as int4, or the reverse,
with no error. supported admits an escape only before a non-alphanumeric character, which
is that character itself in Python's re and here, and refuses "\d", "\w", "\s", "\b" and
the rest by the rule's name as "(" and "[" already were.

desc_act went through flag, which answers null for a value that is not a bool, so
"desc_act": "false" was read as false. It is refused by name now, saying what it found in
place of a bool, for the reason sym is.

checkpoint_format was ignored. It is admitted as "gptq" only and refused by name
otherwise, and dialect's doc comment no longer claims every field the reader does not read
is refused.

The tests add the rule above and "\w" and "\s\b" beside it, an escape of a non-alphanumeric
character read as the character, a rule using one admitted, the desc_act refusals, the
checkpoint_format refusals, and checkpoint_format "gptq" on the admitted config.

The published AutoRound export (Qwen3.8-Flash-Next-125B-A5B-INT4-AutoRound, revision
1464274) stores no g_idx tensor: 70 shards, 224454 tensors, none named *.g_idx, so the
refusal of a non-empty one is unchanged.
ashhart and others added 27 commits November 19, 2026 07:56
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).
… re-pinned

Review follow-up for #3106.

- zig/tests/fixtures/gradient-serving.tsv: the zig/src/cuda/nccl.zig row carries
  the new hash and this PR's number, so test-gradient-serving passes again.
- Library.pathFrom(raw) holds the one rule (a path is kept as written; unset,
  empty and blank keep libnccl.so.2; a control byte is refused). Library.open
  applies it to the process environment as before, and fabric/tp/config.zig
  applies it to its own getter, so a set-but-blank TF_NCCL_LIB no longer opens
  a blank path there. A malformed value is error.BadSetting, like the other
  TP settings.

Checked on a CPU-only host with Zig 0.17.0: test-gradient-serving (fails before
the re-pin with "serving source changed: zig/src/cuda/nccl.zig", passes after),
test-tp (the new config test fails on the old line and passes on the new one),
test-runtime-host, test-environment-host, the nccl.zig tests, zig fmt --check
and the lean check (0 new). No device run.
Reads Inkling 2 Small's config.json into the shapes the engine needs and
refuses by key every layout it does not run: the layer types, the fixed
switches, the quantization, the draft head and the vision tower. Fixtures
are the release's config.json and the tiny-random checkpoint's. The host
step is test-inkling2-host.
Reads a safetensors header into entries of name, dtype and shape, sorted
by name, for the dtypes this family stores: BF16, F32, F8_E4M3 and U8. A
dtype it does not store, a rank past four, a length past the file and bad
JSON are each refused.
The map names every tensor a config implies, backbone, vision tower and
draft head, with its dtype and shape, and checks a safetensors header
against it: missing, wrong and unknown tensors are reported by name. A
layer's expert format is read from its tensors, U8 for NVFP4 and F8 for
MXFP8. The plan derives sliding and global layers, the block boundaries
and the number of states each attention-residual input sums over.

The draft head's rnn_proj sizes and fuse_weight's columns are read from
two headers, tiny-random/inkling-2 and the release, not from code;
fuse_weight's six rows stay open. The fixtures fold the two header tables
of tiny-random/inkling-2 with their sha256. Real headers are checked when
TF_INKLING2_TINY names tiny-random's two files, and when TF_INKLING2_REAL
names the release's 24 shard headers and mtp.safetensors.
Image parts (image, input_image, image_url) and --vision are refused with
their own words until the vision tower has kernels; audio and unknown part
types are refused too, and text parts, plain strings and string parts
pass. A part without a type is read as text, as the chat template reads
it. Nothing calls these checks yet: there is no host.
The release's chat template renders 24 chat cases byte for byte, thinking
effort names and numbers included, and raises for an unknown effort or one
out of range. The tokenizer encodes the rendered prompts and 6 plain
texts to the reference's ids and decodes them back when TF_INKLING2_CKPT
names the release's tokenizer.json. A cut tokenizer.json (its added
tokens, its byte alphabet and the first 1,500 merges, same split regex)
runs on every build against 14 cases, with a control that another split
regex changes its ids. The expected prompts and ids come from the
transformers and tokenizers libraries.
inkling2_fixtures.py writes the files under zig/src/families/inkling2/
fixtures from the release's files and the tiny-random checkpoint's
safetensors headers: the prompt and id cases through transformers, the
cut tokenizer and its cases through tokenizers, and the folded tensor
tables with their sha256. The library versions are pinned and checked;
--check compares the committed files without writing.
The notice for the files taken from the Inkling 2 Small release and from
the tiny-random checkpoint.
refusal.zig and its test have no caller: the server that would call them
is not in this slice. They move to the slice that adds the host. The step
description and the package's test list no longer name them.
The AutoTokenizer.from_pretrained call in inkling2_fixtures.py takes
local_files_only=True, so a mistyped --release fails instead of
reaching the hub.
names.check and names.precisions take core/safetensors.zig's Header, read
with its headerSize and parseHeader, in place of the family's own parser
and dtype enum. header.zig and its test are gone, and the host test module
imports the core reader. names.merge joins the headers of a checkpoint's
files and refuses a name held twice.
…he K loop

Each thread's input, weight and scale/bias cp.async addresses are set up once; a stage only adds its group offset.
The copies, their order and their shared-memory bytes are unchanged, so outputs stay bit-equal to prefill_kernel.

Co-authored-by: terrapinelf <166810331+terrapinelf@users.noreply.github.com>
C4 of #2444: a store that declares tails cuts at any row its request
schedule allows, and a keep off a page edge holds one copy of the
partial page per prefix group, made by copy_rows and never written
again; a later prompt that repeats those rows, their lookahead,
images and namespace resumes there and copies the page into its own.
Tails count in the page limits, reclaim and eviction like parts, and
a store without them keeps every mark, hit and eviction of P2.2.
A resume at a tail takes its private page from the stream's promise,
trims it back on failure, and leaves the store's copy unwritten; an
idle tail is reclaimed before a page a stream still maps, so the
pool's census stays exact across the tail's whole life.
@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-1119075648 branch November 19, 2026 11:07
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.