Repository navigation
Conversation
b157c0f to
9a60a8c
Compare
|
The two red checks are not from this branch: env_names.py on main (d593d2e) reports the same TF_Q27_FLAT_GLUE / TF_Q27_QK rows missing, and zig-windows fails in cuda.zig's checkpoint_cli imports (tfq3_validate.zig needs flashnext_memory), which this PR does not touch. |
|
Thanks, @abm9111. The parallel routing keeps the old slot order, and the new suite compares every routing buffer byte for byte across live-row variants with planted controls that can fail. B=1 and the serial fallback are preserved. One landing requirement is still missing. Please register the kernel for gates 1–5 at its served 2–16-row shapes, including its 160-thread launch and M1/M2 compile-time limit records. Keep the byte-equality and planted-control checks, and post the resulting contract summaries with any unrun chips named. I found no other source blocker in this re-check. No device run was performed here.
|
… lists in parallel, bit for bit
…s on a failed init
…for TFQ3 parallel routing A-B-B-A against main on an M3 Ultra with the published TFQ3 checkpoint (TensorFold/Qwen3.8-Flash-Next-TFQ3 at eeb675d): drafted 27.41 -> 25.54 ms a round, 108.1 -> 116.7 tok/s, faster in both pairs; one row 15.52 / 15.58 ms; every token hash equal in every arm and round.
9a60a8c to
93507d9
Compare
…row windows A replacement of fn_pw_route_dedup's lists: gates 1-4 run fn_pw_dedup_par on the picks route_dedup made and require route_dedup's uids, umem and ucount byte for byte, at every window from 2 to 16 rows with live rows equal, one short, 1, 0 and 3 past the window (74 shapes); each window meets all five of the route suite's logit patterns. Gate 1 turns each planted row's first pick into NaN or -Inf and adds +Inf. Five planted controls, each red at gate 3: the route suite's four source edits and live rows not capped at the window. Gate 5: 160 threads reserved in the source, 800 threadgroup bytes, and the M1/M2 compiles' limit of 160. A control whose source edit no longer applies is tallied as an init error rather than stopping the run.
|
Thanks. Registration (
The byte-equality route suite is unchanged and still passes ( SUMMARY, Metal, Apple M3 Ultra (applegpu_g15), macOS 27.2.1, Xcode 27.1, Zig 0.17.0, head f4dd630 (this kernel's lines and the SUMMARY; the harness's own self-check lines are left out): The run exited 0. (Shapes are rows x picks x live rows: the past-window control first went red at 2x10x5.) SUMMARY, Metal, Apple M5 Ultra (applegpu_g17, tensor units true), macOS 27.2.1, Xcode 27.2, same head: the same lines, gate for gate and control for control, ending It also exited 0. Chips: gates 1–4 and on-device limits ran on M3 and M5. M1 and M2 are covered by the offline compiles (no device). M4 was not run. CUDA, HIP and XPU: n/a (Metal-only kernel). Two inherited problems on this base stop the Metal runner before any kernel runs; neither is touched here:
A pre-existing edge I noticed while reading the router, not changed here: in Checks on f4dd630: |
|
Thanks, @abm9111. The registration covers what we asked for, and the M3 and M5 summaries are easy to check. Confirmed at
One change is needed before landing. Thanks also for reporting the two runner problems. Both are still on main: This was a source review; we haven't run it on a device ourselves.
|
Synthena Initial Review — Performance receipt required (
|
Fixes #5471
What
In a TFQ3 decode window of 2-16 rows on Metal (any Apple GPU: the decode dispatch has no tensor-unit branch),
moeDecoderanfn_pw_route_dedupas one 32-thread threadgroup: it routed each row's top 10 one row after another, then lane 0 alone built the dedup lists(
uids,umem,ucount) while the rest of the GPU waited behind the barrier.fn_pw_fwht_x_fwd: with a new flag bit 4, group 20 routes every live row (gid.y < R), not only row 0. Samefn_route_row, so picks and weights are the same bits.moeDecodelaunches 21 groups at every width.fn_pw_dedup_par(one threadgroup, a thread a slot,max_total_threads_per_threadgroup(160)): a slot opens alist when no earlier slot picked its expert; the list's index is the number of lists earlier slots opened; its
members are the slots holding that expert in slot order, then -1. That is
route_dedup's order, souids,umemand
ucountare the same bytes, and lists pastucountare untouched as before.FZ_TFQ3_SERIAL_ROUTE=1keeps the old path (row added todocs/environment-names.md; happy to drop it).Exactness
No arithmetic changes.
zig/tests/flashnext_tfq3_route_test.zig(undertest-flashnext-tfq3) compares every outputbuffer of the new path with
route_dedup's byte for byte: windows of 2-16 rows; live rows equal to the window, oneless, 1, 0 and above it; independent, overlapping, tied and paired picks and rows with three finite logits; five
repeats, untouched bytes checked against a fill. Five planted controls (lists in expert order, no -1 tail, window rows
instead of live rows, members after the first dropped, a row's picks at the wrong offset) each make it fail. The B=4
parity test in
flashnext_tfq3_test.ziggets a third pass throughroute_dedup, byte-equal to the first.test-flashnext-tfq3passes on an M3 Ultra; not run on M1, M2 or M5, and the speed below is the M3's only. The M5 runsthe same routing path, where the old step is the same serial single-simdgroup latency, so I expect a gain there too;
not measured.
Speed
M3 Ultra (60-core GPU), macOS 27.2,
tensorfold-nativebuilt from main and from this branch(
zig build native -Dcpu=apple_m1), TensorFold/Qwen3.8-Flash-Next-TFQ3 at eeb675d, MTP drafts on (defaults),A-B-B-A, a fresh server per arm and round. Drafted cells: 3 MMLU-Pro prompts, a code prompt and a prose prompt greedy
at 768 tokens, and 2 prompts sampled at temperature 0.8, seed 7, 512 tokens. Plain cells: the 5 greedy prompts with
--no-drafts. Engine-logged decode time.were not exactly fixed from run to run on main either, so the ms-a-round figure is the cleaner one.
Open points (from #5471)
fn_pw_dedup_par(gate 5 limits forthe 160-thread group, M1/M2 records via
tf-kernel-contract --offline) here or in a follow-up, as you prefer.fn_route_row, a row whose 512 logits are all NaN leavesbid = 512and lane 0writes
v[16], one pastfloat v[16]; abid < 512guard fixes it. I can send that on its own.