Skip to content

train 1113113836: #2851 #2765 #2883 #2889 #2891 #2892 #2878 (CI only) - #3185

Closed
ashhart wants to merge 64 commits into
mainfrom
lead/train-1113113836
Closed

ashhart wants to merge 64 commits into
mainfrom
lead/train-1113113836

Conversation

@ashhart

@ashhart ashhart commented Nov 13, 2026

Copy link
Copy Markdown
Owner

CI for a landing train: #2851 #2765 #2883 #2889 #2891 #2892 #2878 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 30 commits November 13, 2026 10:55
A stream's words, a slot's descriptor and the rows its keep replays, one Plan a cache slot. No kernel launches yet.
…laying the kept rows

A window's conv split, gates and delta rule read its rows from the plan, and the keep rebuilds the conv tail from the kept inputs and re-runs the scan over the kept rows, so the state is serial decode's while the round writes no snapshot a row.
The engine makes a plan a cache slot where the shapes are the plan kernels' and sends its words inside a round's graph, a window's linear layer goes through the plan, and a keep replays the kept rows where the plan took it and copies the snapshots where it did not. The plan's bytes count in a stream's admission.
… k, v, state and conv tail

At Flash Next's shape: the plan's conv split against today's launch and the kept conv tail for one to four rows, the plan's delta rule y against serial and the state a keep replays for each kept row (a one-row window is its own keep; a longer one leaves the state as the round found it), and two streams each replayed from its own rows. Host: the words' layout, the kept sections' offsets, and the shape guard, which is the only choice now.
…paths

The kernel tests now reach the family's model-free side through kernel_reach, so a
conv split test can build a real plan and compare today's launch with the plan's
q, k, v, gate and beta bit for bit.
…bytes once

The slots follow the rest of the open path's errdefers, and streamBytes no longer
adds the plan: the slots are made for the streams asked for before room is measured
(#2728). Thanks to @gilby.
… and keep the kernel-test wiring out of hip.zig
A long prompt keeps only its history, shared and rewind marks, so a
later request that preserves a large prefix after compaction has no
state inside that prefix and prefills from the last shared cut.

Keep up to `intermediate_most` checkpoints at power-of-two multiples
of the ladder's spacing under the history mark. They are admitted
after the endpoint and rewind, inside the store's budget and slots,
and are exempt from superseded eviction, so they stay across append
turns while remaining evictable as ordinary oldest states.

Flash Next on CUDA opts in at 8,192-token spacing with four
checkpoints, behind `TF_PROMPT_INTERMEDIATE=1` until a served A/B
shows the extra marks pay. Host tests cover the ladder plan, a
compacted 160K-token prompt resuming at 64K against the 4K shared cut
without it, an append turn, admission beside the endpoint, and
eviction.
On one GB10 with nvidia/Qwen3.8-Flash-Next-NVFP4, --no-drafts and an
8 GiB cache, a 104K-token request that kept its first 100K resumed
65,536 tokens instead of 2 (TTFT 19.9 s against 50.7 s, same tokens).
A cold 165K prompt paid 0.9 s more and the cache held two more states.
The follow-up resumed 65,536 because the compacted turn had evicted
the larger states.
prompt_intermediate used a copy of prompt_interior's same check from
before the image-identity change, so it missed cache_images.matches.
Make the interior check public and call it, state that any kept state
at a rung position counts as intermediate, and test that passRules
leaves the ladder off with TF_PROMPT_INTERMEDIATE unset or 0.
The lean rule caps the file at 600 lines and main is already there. Move
the ladder's two values into cuda_snap.zig, expose them to the family
through one alias, and drop one blank line between the weight-byte
wrappers.
Since #2699 the victim order keeps each conversation's newest state
before redundant copies. A ladder checkpoint was exempt from the
superseded pick, so once the plain redundant copies were gone the
oldest state went next, which could be another conversation's newest.
A superseded checkpoint now goes after every other redundant copy and
before any newest state.

Under a reservation guard, fitting took the marks in position order,
so the low ladder positions could take the room the rewind state
needed. Ladder positions now fit last, after the endpoint and every
other mark, in the room other passes' promises leave.

Co-authored-by: javierbits <177527508+javierbits@users.noreply.github.com>
The switch is a CUDA-scope flag now, checked when the backend starts
like the other prompt-cache switches, and documented. The test's env
handle moves inside the test, since main's snap_tail test declares its
own.

Co-authored-by: javierbits <177527508+javierbits@users.noreply.github.com>
The rebase put it under 1.2.2. It now also says how its checkpoints
are evicted and fitted.

Co-authored-by: javierbits <177527508+javierbits@users.noreply.github.com>
The narrow tensor-unit default installs the existing greedy callback again.
Sampled and shared rounds retain their lane path, and explicit lane overrides
keep their meaning. Every copied token still goes through target verification.

Refs #3013
Use the lane selector sibling policy for the default narrow callback,
and require a confident suffix before appending copy rows. Explicit
serial overrides retain their original head, admission and submissions.
Keep dependent matching, taps and preparation of the same keep at the
existing verify tail, preserving target operators, budgets and EOS.

Refs #3013
BobClawblaw and others added 27 commits November 13, 2026 11:09
#1630 adds the bf16 experts format to Grouped (experts.zig) and registers the
experts_bf16 image (kernels.zig); no existing kernel source changed. Both rows
are recomputed on main after #3011, which re-pinned experts.zig for #2843.
Give tf_lane the reg path's 16-row grid axis and runtime sums
stride. Each block keeps the same group products, FMAs and K
reduction; cooperative and older-chip encodes retain 16 rows.
Qwen27 selects a whole-prompt key for non-reg widths behind
the existing Ultra gate. Decode and mixed stacks stay short.

Compare each width with main's frozen short kernel, including
ragged tails, producer sums, strided outputs and three controls.
Pin real quant dispatch counts with main-red host regressions.

Refs #2818
The full lane contract compiles all four tf_lane_sums sources
for M1 and M2 at a 1024-thread pipeline limit. Record those
measured values and keep the actual 256-thread launch.
Tensor-op sources remain explicitly unmeasured on these chips.
Pin the distinction in a host regression; no shader changes.

Refs #2818
Only whole-prompt layouts compile the independent row-block
header. Short layouts retain a scalar group coordinate and
their original row extent; guarded sums remain bounds-safe.
Keep older-chip sources on that short variant as well.
Compare both short and long programs against frozen main
at every maintained byte-check shape and row count.

Refs #2818
Leave other affine lane callers on their scalar 16-row source
and capacity. Only the Qwen prompt key and byte fixture request
independent row blocks. Pin the shared shader bytes, describe
the row layout accurately and cover the 16/17-row boundary.

Refs #2818
…, read at GLM's open

GLM-5.3-Flash's attention keeps no rotary positions, so only its trained length bounds the window.
TF_GLM_CONTEXT_CEILING, a .glm row, sets the window --context may ask for, up to 2^31 - 32, where the slots keep
i32 positions. GLM reads it at its open once its .glm rows are checked; unset, the ceiling and the refusal are main's.
A window past the trained length says so at startup.
…a_env.zig

cuda_native.zig had passed the 600-line limit. ceiling_switch and raisedCeiling move to cuda_env.zig, which owns the
.glm check, and the i32 test to cuda_env_test.zig; cuda_native.zig keeps the two names the CUDA open looks up.
…est file and cuda_window.zig

Main grew cuda.zig to 587 lines, so the branch's additions passed the 600-line limit again. The open-time test of
raised context ceilings moves to cuda_ceiling_test.zig, imported beside cuda_health_test.zig, and the lookup of a
family's raised ceiling and its switch to cuda_window.zig's familyCeiling; cuda.zig keeps one call.
…t.zig

Main's eb29a68 added a line to cuda_native.zig, so merged with main the file comes to 601 lines, past the 600-line
limit. The test that capacity keeps a verify window past the context, a multiple of 64, moves whole to
cuda_pages_test.zig, which tests GLM's pages at that capacity: 594 lines in cuda_native.zig here, 595 merged with main.
A fraction after --compact-at auto left auto mode on, because the
flag set compact_auto and a later fraction never cleared it, so the
server kept the first value where every other flag keeps the last.
Each occurrence now replaces both fields, which a config file's
value under a command-line override depends on, and a filtered host
step runs the test that fails without the change.
Pin eviction of redundant own history before another conversation's
newest state under pressure. Retain prompt-born provenance and prove
a same-prompt regenerate restores history when all three states fit.

Refs #2881
Give test-native a timed shard with the Metal toolchain. Keep it
nightly until the CI runner establishes its wall time.

Refs #2880
…xperts, Drama 3 and Kolibri-1 read through it
… of few rows

On gfx1151 a routed prompt holds about 80 experts of 8 rows or fewer at any
length. On the 64-row matrix tile each of their blocks reads 128 columns of
codes a stage, a page of weights every four columns, and the cost of those
reads follows the pages a block touches.

wmma_item_tile now runs gemm_kp_wave for an item of at most the launch's cut:
a lane a column's group, a column's whole row of codes read at once, no
barrier. gemm_kp_wave is a wave's passes of gemm_kp_tile, factored out so
both tiles run them; the K-parallel tiles keep their statement order and
their register and scratch use. A pass of the item tile takes 2 rows and
2 columns a lane, which stays in registers, and keeps its partials in the
block's code stages, so the tile's LDS is unchanged.

The cut is a card's: `few_rows` in the tuning row (8 on gfx1151's item64
row, none elsewhere), carried to the kernel in Routing.few by prefillLaunch.

A kernel test runs one plan through both paths at every width and compares
bytes; the contract runs the tile with the cut and a control whose passes
stop after a wave's first. The tile's record holds ROCm 10.1's hipcc. The
build now tracks tiles/matrix_item.hpp.

Refs #2795
…ks bounds (#2878 review)

The review's asks on the tile's cut for items of few rows:

- registry: `rowOf` returns null for an entry before the registry's own
  instead of subtracting first, which trapped. A toy-registry test covers
  a named entry, an unnamed one and entries before and after it.
- tuning: only `mlx.routed.prefill.item64` rows set `few_rows`, at no
  more than the tile's K-parallel passes take, and gfx1151's is set.
- launches: `prefillLaunch` over a registry of toy entries carries its
  row's cut in `route.few`, whatever the caller's route held, and none
  for a row without one. It fails when the copy is lost.

Refs #2795
@ashhart

ashhart commented Nov 13, 2026

Copy link
Copy Markdown
Owner Author

Conflicts with main (main moved after stacking); restacking.

@ashhart ashhart closed this Nov 13, 2026
@ashhart
ashhart deleted the lead/train-1113113836 branch November 13, 2026 11:54
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.

9 participants