Skip to content

train 1119082255: #3314 #3521 #3665 (CI only) - #3931

Closed
ashhart wants to merge 203 commits into
mainfrom
lead/train-1119082255
Closed

ashhart wants to merge 203 commits into
mainfrom
lead/train-1119082255

Conversation

@ashhart

@ashhart ashhart commented Nov 19, 2026

Copy link
Copy Markdown
Owner

CI for a landing train: #3314 #3521 #3665 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 08:22
Every multi-rank family reads its own rank variables today, so no
two launch alike. mesh.launch resolves the server's flags and a
family's legacy world and rank variables once, field by field: a
partial or malformed pair refuses as the family readers did, a flag
and an alias that disagree refuse, GLM keeps refusing a launch with
neither, and alias-only values reach the family's own check.
The per-family rank variables become aliases of --tp and --rank, so
each needs a row that names its flag and the release from which the
server refuses it. Six rows, two family scopes and a semantic-version
retired() helper do that; the names keep parsing as whole numbers,
and GLM's start-up check now names their accepted forms.
--tp only took 1, 2, 4 or 8, so GLM at three ranks had to launch
through its own variables. It now takes 1 to 64, each family keeps
its own admission, --pp takes 1 until stages serve, and the engine
learns which of --tp and --rank were named, so a lone --rank can
wait for a family's world alias and an unranked family refuses it.
Without the CLI's --tp choices, Flash Next took --tp 3 or a lone
--rank 1 into memory admission, which exited with BadRank and a
trace. A given --rank not below --tp now refuses with main's text,
and a family listing its worlds refuses others by name, both before
admission; the alias release is one constant set at landing.
…r the kernel contract

A new HIP group, exl3/exl3.hip: tf_exl3_rot_in (x * suh rotated by 128 and rounded to fp16, CUDA's rot_in arithmetic)
and tf_exl3_linear at 2, 3, 4, 5, 6 and 8 bits (mul1) on 4 and 8 waves, the HIP side of what deepseek_v41's CUDA path
calls tensorfold_exl3_linear_v4.rot_in and .linear. A row's sums are v_dot2_f32_f16 chains whose bits do not depend on
the rows sharing its launch; the waves' sums and the output rotation follow CUDA's finish. Nothing launches them outside
their tests yet.

Kernel tests: the decoded weights against exl3_format bit for bit at every width, both wave counts and both trellis
layouts; a row's bits alone, in any window and in passes of 16; rot_in by its fp32 steps from fp32, fp16 and bf16 rows.
Contract: rot_in and the linear at each width against float64 (the linear's gate 4 exact), one control each, and gate-5
records from ROCm 10.1's hipcc.
….zig beside the other zig/tests/lighton_hip steps

hip.zig was at the 600-line cap with the exl3 group, and main's flashnext
draftBatch line takes a merge to 601. captureQwen and exactTool move
unchanged (pub, with hip.zig's Engine); their four call sites name the
file. hip.zig is 581 lines, lighton_hip.zig 38. zig build -l -Dhip=true
lists the same steps before and after.
…below the GEMM tile

Below 64 rows a routed prompt plan cut every expert into items of 8
pairs, the shared expert too. The shared expert holds every row
whatever the routing, so a prompt of N rows ran it as ceil(N / 8)
items, each reading its weights again.

`tf_moe_route` now takes the shared expert's id and a tile of its own.
In a prompt pass (`Ops.prefill`, outside a lane round) the stacked
shared expert is cut at the GEMM tile, 128 rows, so below 128 rows it
is one item; the routed experts keep `tile_for`'s rule. Decode, lane
rounds and the MTP draft head keep the 8-row tile for every expert,
and tp ranks and Nemotron, which do not stack it, pass none.

The routed launches' m stays the most rows an item holds
(`itemRowsFor`): the K-parallel tiers that do not loop cover only m
rows of an item and fit by it. The registry ignores m when it prices
a routed prompt plan, so the kernel chosen does not change. The served
fixture and `routedShape` plan as serving does.

The route tests move to kernel_tests/route.zig.
… from 33 rows

A routed prompt plan cut its routed experts into 8-pair items below 64
rows on every card. On gfx1151 the 35B-A3B's plan of 33 or more rows
already runs on the 64-row routed tile, which takes an item of up to 64
rows in one block, so the 8-pair items only split each busy expert's
rows into more items.

gfx1151's tuning table now sets `prompt_block_from = 33`: the fewest
rows a prompt pass's routed plan cuts at the 128-row GEMM tile. It
serves only the chip the table is named after (`promptBlockFrom`), so
gfx1150, gfx1152 and gfx1153, which share the table's costs, and the
other cards keep 64. `tile_for` reads it for prompt passes only
(`Ops.prefill`): decode, lane rounds and the MTP draft head keep the
8-row tile below 64 rows. The launches' m stays the most rows an item
holds (`itemRowsFor`), and the fixtures plan with the card's start.

The bytes hold: a prompt tile writes the same bits however a prompt's
rows are cut into items, which the served fixture checks entry by
entry, and the routed launches still cover every row of every item.
tf_moe_route joins the contract as the engine launches it: a prompt pass
with the GEMM tile from 33 and from 64 rows, a prompt pass with no stacked
shared expert, decode with the MTP draft head, and a lane round. Gates 1
and 3 check every member and item exactly against the contract's own
statement of the cut, gate 2 repeats it behind guard bytes, and gate 4 has
no sums to check. Two planted controls go red at gate 3: the stacked shared
expert cut at the routed 8-row tile, and a prompt planned from 64 rows
where the GEMM tile starts at 33. Its launch record holds ROCm 10.1's usage
on every served chip.
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.
@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-1119082255 branch November 19, 2026 11:08
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.