Skip to content

flashnext metal: scale index on Macs with tensor units too - #4547

Merged
ashhart merged 3 commits into
mainfrom
lead/fn-m5-scale-index
Nov 22, 2026
Merged

ashhart merged 3 commits into
mainfrom
lead/fn-m5-scale-index

Conversation

@ashhart

@ashhart ashhart commented Nov 22, 2026

Copy link
Copy Markdown
Owner

What this changes

TF_FLASHNEXT_SCALE_INDEX (on by default) reads each 4-bit expert group's bf16 scale and bias through a 16-bit index into a lossless table of the tensor's unique pairs, cutting about 10% of expert bytes. It was limited to Macs without tensor units; nothing in it depends on them, so this drops that condition. Docs updated.

Measured

M5 Ultra, Flash Next 4-bit MTP, one stream, main vs this change, order warm base new new base:

cell base tok/s new tok/s
chat, temperature 0 171.3 175.3 (+2.3%)
chat, temperature 1 132.0 138.2 (+4.7%)
code, temperature 0 234.5 240.3 (+2.5%)
code, temperature 1 193.9 197.9 (+2.1%)

Token hashes at temperature 0 are identical in all four runs (code and chat), and every reply matched its alone run.

Still to run

Prompt processing on the M5 (the prompt kernels also read through the index) at 2K-32K with tokens compared; queued.

@ashhart

ashhart commented Nov 22, 2026

Copy link
Copy Markdown
Owner Author

Prompt check on an M5 Ultra (Flash Next 4-bit MTP, one stream, main vs this change, order warm base new new base, prompts of 2K, 8K and 16K tokens at several start offsets):

  • Prompt tokens: 0 of 12 rows differ across runs.
  • Prompt processing: level (-0.5% to +1.1% per cell, repetitions overlapping).
  • Decode after those prompts: +1.6% to +3.0% in every cell.

With the decode sweep above (chat and code, +2.1% to +4.7%, identical tokens at temperature 0), this is exact and faster on M5, so it goes into the landing trains.

  • Synthena

The 4-bit expert scale and bias index (TF_FLASHNEXT_SCALE_INDEX, on by default)
was limited to Macs without tensor units. It looks up the same bf16 pair through
a lossless table, so it applies on M5 as well: one stream on an M5 Ultra kept
every token at temperature 0 and ran 2.1-4.7% faster on chat and code.
@ashhart
ashhart force-pushed the lead/fn-m5-scale-index branch from 4a4e4b3 to 4bcd9dd Compare November 22, 2026 10:05
@ashhart
ashhart merged commit 5c1fea6 into main Nov 22, 2026
2 of 12 checks passed
@ashhart
ashhart deleted the lead/fn-m5-scale-index branch November 22, 2026 10:06
ashhart added a commit that referenced this pull request Nov 22, 2026
…the scale index

The Nemotron HIP page-fault test built its pool's ids with pages.Ids.init, but
the family's pages.zig keeps Ids in hip_serve's shared pages and doesn't
re-export it, so the test didn't compile. It now calls
hip_serve.pages.Ids.init, as the pool's own field type does.

#4547 turned the Flash Next scale index on for M5 too; the recipe's paragraph
still said M1 through M4.

Both found in @AIFlowML's PR sweep.

Co-authored-by: AIFlowML <[email protected]>
ashhart added a commit that referenced this pull request Nov 22, 2026
…the scale index

The Nemotron HIP page-fault test built its pool's ids with pages.Ids.init, but
the family's pages.zig keeps Ids in hip_serve's shared pages and doesn't
re-export it, so the test didn't compile. It now calls
hip_serve.pages.Ids.init, as the pool's own field type does.

#4547 turned the Flash Next scale index on for M5 too; the recipe's paragraph
still said M1 through M4.

Both found in @AIFlowML's PR sweep.

Co-authored-by: AIFlowML <[email protected]>
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