Skip to content

train 1125005303: #3523 (CI only) - #4978

Open
ashhart wants to merge 10 commits into
mainfrom
lead/train-1125005303
Open

ashhart wants to merge 10 commits into
mainfrom
lead/train-1125005303

Conversation

@ashhart

@ashhart ashhart commented Nov 25, 2026

Copy link
Copy Markdown
Owner

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

BadAd84 and others added 10 commits November 25, 2026 00:53
The CUDA path took the routing width (top-10, 11 slots) and the shared expert's width (640) from
constants. config.json now selects one of two supported shapes, top-10 with a 640-wide shared
expert or top-5 with a 1280-wide one, and refuses any other value by the field's name. The
pass reads the slots from its scratch, which is sized by the shape; the shared expert's width
is its gate_proj's rows. The MTP layer routes at the main layers' top-k. A captured kernel set
serves the default shape only. The default shape's launches take the same integers as before.

Refs #3368
…ment names the width it reads

Head.init read config.json a second time through widthsIn, after Engine.init had already
selected the same shape into e.widths, so a change to one read could leave the other stale.
It now takes the engine's widths as an argument, and the MTP rule is unchanged: the head's
shared expert may be the main layers' width or the routed width (640), and any other row
count stops the load naming mtp.layers.0.mlp.shared_expert.gate_proj. The lanes load, the
drafted check and the device parity test pass e.widths.

The one-row split path gathers [2, 1, width] blocks into the row the down projection reads,
and that row's width is native.shared_width, not the halved per-rank width; the comment now
names it.

A host test pins the single reader: cuda_mtp.zig holds no widthsIn, its init takes the
engine's widths, and both callers pass them.

Re-pins cuda_mtp.zig, cuda_lanes_load.zig and cuda_mtp_check.zig in the serving fixture.
headBytes priced the shared expert at the 640-wide constant, so a 1280-wide
one was undercounted by its three projections' 3,072,000 bytes: gate, up and
down at 5/8 of a byte a weight over 640 rows.

The estimate now takes the width as an argument. headSharedWidth reads it from
the head's own gate_proj rows: whole routed experts beside it are the modelopt
load, which holds every row, while the legacy path keeps the first 640 rows of
a taught folder's wider expert, and a checkpoint with no head prices the 640
constants. deviceWeightBytes degrades as before, pricing the 640 width when
only the width probe fails; placement propagates the error and refuses
admission.

A host test pins the 1280 case: the head's bytes grow by exactly 3,072,000 at
either routed format, and a fixture checkpoint with a 1280-wide shared expert
prices that tensor's rows, while 640-wide, 768-row legacy and head-less
checkpoints price the default.

Re-pins cuda_mtp.zig in gradient-serving.tsv.
…umming it

config.json's tensorfold_learned_neurons went straight into the supported shared width's sum, so the
standalone engine's read (cuda_config.zig's widthsIn, which cuda_prompt.zig's initialization takes) overflowed
on a count near the signed maximum instead of refusing the checkpoint by field name; the server's read
checked the count before its selection, so the two paths disagreed.

cuda_widths.zig now owns the rule (whole 32-neuron groups, 128 at most) as learnedOk, and select applies it
before the sum. cuda_config.zig's geometry calls the same rule, and the field name comes from cuda_widths.zig
rather than being spelled again there.

Tests: select on the signed maximum, the signed minimum, 129 and 40, and the taught 704-row shape; the
standalone widthsIn on a 64-neuron folder's config.json plus the same fields with the signed maximum, which
the selection refuses by field.
…ed in

headBytes priced every shared projection at 5/8 of a byte a weight, the affine pair's cost, so a whole head
whose shared expert is kept BF16 or MXFP8 was estimated short. For a 1280-wide expert the 640 rows past the
640 constants cost 9,830,400 bytes BF16 and 5,068,800 MXFP8, against the 3,072,000 the width correction
priced: 6,758,400 and 1,996,800 short.

headBytes now takes a Shared: the intermediate width and each of the gate, up and down projections' stored
form, priced 5/8 a weight affine, two bytes BF16, a code and a scale byte a 32 MXFP8. headShared reads each
form from the tensor the checkpoint holds: F8_E4M3 codes are MXFP8, BF16 is kept, anything else is the
affine pair.

Tests: the whole 1280-wide expert against no shared rows, 6,144,000 affine, 19,660,800 BF16 and 10,137,600
MXFP8; the 640-row correction's 6,758,400 and 1,996,800 shortfalls; one projection at another form;
headShared's forms over affine, BF16 and MXFP8 checkpoints.
…a_mtp.zig keeps to 600 lines

Main's cuda_mtp.zig grew since #3523 was last rebased, and the merged file came to 649 lines. The head's byte
pricing moves whole to cuda_mtp_bytes.zig with its three tests: split_bytes, the shared projection's Format,
Shared, sharedBytes and headBytes. cuda_mtp.zig re-exports split_bytes, Format, Shared and headBytes, so
every caller is unchanged. No behaviour change. Re-pins cuda_mtp.zig.

This branch has not been deployed

No deployments
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.

2 participants