Skip to content

train 1124193550: #3868 #4912 (CI only) - #4944

Closed
ashhart wants to merge 24 commits into
mainfrom
lead/train-1124193550
Closed

ashhart wants to merge 24 commits into
mainfrom
lead/train-1124193550

Conversation

@ashhart

@ashhart ashhart commented Nov 24, 2026

Copy link
Copy Markdown
Owner

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

gilby and others added 24 commits November 24, 2026 19:35
The net change of #3859 at c07419f over its merge base 6858510,
carried as one commit because four of the branch's merge commits hold changes of their own.
Main 881e224 added the prompt-tail slices retained by the rebase. Move the unchanged round fingerprint into its own module so the combined runner remains below 600 lines.
Main moved keysForward to prompt_tail.zig. This PR's copy passed the shifted norm and YaRN rope, so the moved one must too. Both default to the plain path, so other Qwen models are unchanged.
The net change of #3859 at c07419f over its merge base 6858510,
carried as one commit because four of the branch's merge commits hold changes of their own.
… each with its own host field and tap slots

Main's 4f8b193/090c9c4a9 line serves Qwen3.8-27B's MTP head under --mtp-drafts (Host.mtp: qwen27_mtp.zig's Mtp,
its taps through qwen27_features.zig's prepare and rows in the lane backend's table). This PR's head for
SenseNova-Loop came with a Host.mtp of its own type and the same two table slots, plus prefill_features.

- qwen27_served: the PR's head is Host.sn_mtp; it loads only when --mtp-drafts is off (so at most one head drafts),
  sets the backend's sn_features before its wrapper takes the backend's table, and frees as the PR placed it.
- qwen27_lanes: Metal.sn_features picks the table. With it, the PR's slots (sensenova_features.zig's
  prefill_features, prepare_features and features); without it, main's table unchanged, so a Qwen3.8-27B prompt under
  --mtp-drafts keeps main's prompt pass (Drafted streams prompts through prefill_features whenever one is set).
- residency: the PR's three resident-set lines name sn_mtp, the type whose buffers they add.

Main's Qwen3.8-27B MTP, DFlash2 and plain paths keep main's code; SenseNova-Loop's keeps the PR's.
…main

Main's growth beside this series' SenseNova-Loop lane changes put the file
at 605 lines. The tail encoder's choice becomes one if/else line and the
argmax tail's body one call; no behaviour changes.
…nto main

Main's table grew to 590 lines since the last rebase, and this stack's TF_MTP_DRAFTS
scope (Rule.also, matches, includesRule) took it to 601. The two blank lines before
the new matches and includesRule functions go; nothing else changes.
…s solo prompt rows

attention.zig, attention_plan.zig, decode_round.zig and qwen27_slots.zig now carry
main's solo prompt rows with this stack's SenseNova-Loop changes; their pins are
regenerated from the merged files, main's notes kept.
… for bit main's

Main's router computes 128 expert scores in one 256-thread group a row and
then picks on thread 0; the loop gates run one 256-thread group a row, with
64 threads on the down dot, and the forward called them once per row. Both
keep each output's FP32 dot as one serial ascending chain, which is what makes
them exact, and both leave most of the GPU idle.

The split keeps every chain and every expression as main wrote them and only
changes the launch shape:
- router: tf_inkling2_route_scores, one thread an (expert, row) score in
  32-expert groups, then tf_inkling2_route_select, one thread a row with
  main's top-8 and ascending-index combine over the stored scores;
- loop gates: tf_inkling2_loop_norm (main's reduction, its BF16 rows
  stored), tf_inkling2_loop_down (one thread a (rank, row), main's serial
  dot) and tf_inkling2_loop_apply (main's forget and gain), over every row
  of a controller in one call; m's rows are a token's message entries apart.

The forward uses the split by default; main's kernels stay in the library as
the contract's baseline. The contract compares the split's bytes (and the
router's expert ids) with main's kernels at 1, 33 and 64 rows, with inputs
that open each dot with +B x0 - B x0 so any other summation order shows; m
is laid out at production's stride with NaN between rows. A strided two-chain
dot and a one-index-off store are planted for each kernel and must go red.
… without their symbols

The inventory tests count each kernel symbol in the concatenated glue and loop shaders and require one; the
comments made it two.
tf_inkling2_route_scores and tf_inkling2_loop_down took their thread
position as a scalar uint beside a uint2 threadgroup position. Metal
requires a kernel's position inputs to be all scalars or all vectors of one
width, so the glue and loop libraries failed to compile on the device
("expecting input declarations with either all scalar types or all vector
types with the same number of elements") and the engine could not load
them. Both now take uint2 and use its x, the same thread index as before.
No arithmetic change.
On an M5 Ultra the split kernels made one-stream decode 3.6% slower (16.76
to 16.15 tok/s): at one row the router's two launches and the gates' three
cost more than the one launch each they replace, with nothing to run side
by side. From two rows they win (a 64-row prompt chunk 42% faster).

The forward now takes the split router and gates from two rows and main's
tf_inkling2_router and tf_inkling2_loop_gates below that, exactly as main
called them. Both paths give the same bits: the contract checks the split
kernels byte for byte against main's. A host test pins the switch at two
rows.
@ashhart ashhart closed this Nov 24, 2026
@ashhart ashhart reopened this Nov 24, 2026
@ashhart

ashhart commented Nov 24, 2026

Copy link
Copy Markdown
Owner Author

Stopped at #3868.

@ashhart ashhart closed this Nov 24, 2026
@ashhart
ashhart deleted the lead/train-1124193550 branch November 24, 2026 21:14
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