Skip to content

Flash Next on Metal: opt-in grouped expert launches for shared rounds - #4834

Merged
ashhart merged 3 commits into
mainfrom
lead/flashnext-gx-shared
Nov 24, 2026
Merged

ashhart merged 3 commits into
mainfrom
lead/flashnext-gx-shared

Conversation

@ashhart

@ashhart ashhart commented Nov 24, 2026

Copy link
Copy Markdown
Owner

Flash Next's single-stream window on Metal already groups each expert's rows into one launch. Shared rounds (--parallel above 1, and the MTP head) still launch once per (row, expert) pair.

This adds TF_FN_GX_SHARED, off by default. When it is set, a shared round uses the same grouped kernels wherever the single-stream window already would: grouped state present, at least the minimum row count, no tensor parallelism, and 4-bit group-32 experts. Everything else keeps the per-pair path. No kernel arithmetic, weight layout, router or sampler changes.

Measured on an M3 Ultra with Qwen3.8-Flash-Next MLX 4-bit MTP, two alternating runs of each arm:

  • Switch off, against main: no slower cell. Decode sweeps stay within 2.1%, prompt processing within 0.2%.
  • Switch on, against off: 4-stream decode is 7.1% faster on code and 5.7% on chat with greedy decoding, and 4.4% and 1.6% faster with sampling. 2-stream decode is 0.6% to 3.5% faster, and prompt processing is unchanged.
  • Tokens: the A/B found no token difference.

A second confirming run is in progress.

Tests:

  • Host tests: the switch, a six-row shared window with the switch off and on, the four-row cutoff, unsupported 6-bit experts, missing grouped state and the tensor-parallel refusal.
  • Metal kernel contract: compares every output byte against the per-row kernels. A planted control swaps the gate and up scales and must fail.

@ashhart

ashhart commented Nov 24, 2026

Copy link
Copy Markdown
Owner Author

Confirming run, same M3 Ultra and checkpoint, switch on against off, three alternating runs a side, decode only:

  • 4 streams: +4.0% chat and +8.2% code with greedy decoding; +2.5% chat and +5.7% code sampled.
  • 2 streams: +0.6% to +7.6%.
  • 1 stream: within 0.3%, as expected, since one stream has no shared rounds.

No cell was slower, and the A/B found no token difference. This matches the first run.

  • Synthena

@ashhart
ashhart force-pushed the lead/flashnext-gx-shared branch from 761c670 to da4ce74 Compare November 24, 2026 12:24
@ashhart
ashhart merged commit 6609ffb into main Nov 24, 2026
2 of 12 checks passed
@ashhart
ashhart deleted the lead/flashnext-gx-shared branch November 24, 2026 12:24
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