Skip to content

train 1115114654: #3322 #3330 #3351 #3360 (CI only) - #3422

Closed
ashhart wants to merge 13 commits into
mainfrom
lead/train-1115114654
Closed

ashhart wants to merge 13 commits into
mainfrom
lead/train-1115114654

Conversation

@ashhart

@ashhart ashhart commented Nov 15, 2026

Copy link
Copy Markdown
Owner

CI for a landing train: #3322 #3330 #3351 #3360 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.

…tree's low levels in registers and skips the zero padding groups

Every output keeps its four MMA steps from zero a group and the same zero-padded pair tree, so prompt rows stay bit-equal to main and to the decode rows. Release layer 2 stage hashes match main at 2048 and 4096 rows.
…there and the rest by decode fmas

The simdgroup kernels already ran near the fp32 MMA rate. On M5 GPUs (macOS 27) a
routed expert's 32-wide group now goes to the tensor unit, fp4 weights read as
stored, when its act_quant codes bound every fp32 partial sum below 2^24 times their
lowest set bit: then any summation order gives the decode chain's bits. Other groups
(about 0.2% up, 0.3% down on layer 2) run the decode kernels' 32 fmas in k order.
The chains, scale fmas and tree are the decode kernels'; one simdgroup runs a chain
and the tree joins them in threadgroup memory. Down's input halves and flags come
from a small prep pass over act. Other GPUs keep the simdgroup kernels; the contract
gates both sets, and both match the decode kernels per row.
…generation 17

runtime_sources/dsv41.zig called the experts' source with the old three
arguments; it now lists the simdgroup source and, where the loader would take
it, the tensor-unit source, so the runtime compile gate builds experts_units.metal.
The tensor-unit kernels now run only on generation 17 (M5), the one checked; the
modes test holds the runtime list to that rule. CHANGELOG: 155 ms, #3330.
TF_CTL 6 sends every group to the tensor unit. The down gates' random data now
carries one group that decode's fmas round (2^24, 2^23, 2^16, then four terms of
half an fp32 ulp, landing on a bf16 tie) and exact sums do not: the kernels match
the oracle through the fallback, and the control goes red at the shapes gate.
…nd on an M5

units_test.zig checks xu_exact's rule against exact integer sums: a safe group's
fp32 sum is exact in six orders, and past the bound some order rounds. On an M5
it builds rows at and past the bound (tops at the largest code, lows at the lowest
bit, columns that swing and cancel), runs the production act_quant and dprep, then
the tensor unit as xu_chain does and decode's fmas as the fallback does. Every safe
sum matches the exact sum on both paths, past the bound the two paths split, and
the kernels' flags equal the rule. TF_DSV41_UNITS_BATCHES sets the batches (2).
…ough bfloat

tf_dsv41_attn_pre gives each simdgroup one row and two heads, so both heads' dots
use one load of each key. Keys come straight from device memory (no window tiles
or barriers), widen through the bfloat type, and a selected run's indices load
four at a time. Each key is one step: both dots, the pair-order butterfly, a
rescale of any head whose max rose, then each head's weight and sums, the steps
of tf_attn_update. Bits equal main's and the decode kernel's.
…ough bfloat

tf_dsv41_attn_pre gives each simdgroup one row and two heads, so both heads' dots
use one load of each key. Keys come straight from device memory (no window tiles
or barriers), widen through the bfloat type, and a selected run's indices load
four at a time. Each key is one step: both dots, the pair-order butterfly, a
rescale of any head whose max rose, then each head's weight and sums, the steps
of tf_attn_update. Bits equal main's and the decode kernel's.
…tched to 64 rows

tf_attn_lo and tf_attn_hi widen through the bfloat type (the same values), so the
decode kernel's dots and sums spend fewer instructions a key; the prompt kernel's
own widening copy goes. With that, loading each step's keys a step ahead wins at
every row count measured, so decode launches take the prefetch pipeline up to 64
rows. A 72-row decode shape keeps the plain pipeline under the contract. Bits equal
main's.
@ashhart

ashhart commented Nov 15, 2026

Copy link
Copy Markdown
Owner Author

Stopped at #3330.

@ashhart ashhart closed this Nov 15, 2026
@ashhart
ashhart deleted the lead/train-1115114654 branch November 15, 2026 12:43
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.

1 participant