mirror of
https://github.com/Niko1221/Strata.git
synced 2026-12-03 19:03:30 +07:00
[PR #4272] [Engine] Metal: opt-in routed-expert tiles (STRATA_METAL_MOE_GU/_DN); Q2_0 8,1,2 + 4,2,4 is 17-24% faster on M1 Max #4982
Labels
No labels
needs-format
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
Niko1221/Strata#4982
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/Niko1221/Strata/pull/4272
Author: @joseedson18jc
Created: 10/26/2026
Status: 🔄 Open
Base:
main← Head:m1-q2_0-expert-tiles📝 Commits (1)
461e9b9perf: metal: STRATA_METAL_MOE_GU / STRATA_METAL_MOE_DN, the routed experts' tiles as an opt-in knob📊 Changes
1 file changed (+38 additions, -6 deletions)
View changed files
📝
metal/src/engine/window.cpp(+38 -6)📄 Description
Problem and result
On the M1/M2 family the routed experts of a Q2_0 pack run with the gate/up tile 32,1,4 and the down tile 8,1,4 (the Q2_0 down is
moe_down_142). On an M1 Max these are not the fastest tiles thatmoe.metalalready instantiates.expert_parity --bench(Q2_0 gate/up + down, synthetic, M1 Max 64 GB):Live (Qwen3.8-Flash-Next Q2_0,
--spec 2+ MTP, throughserve/server.py) this is +5-7% greedy decode. This PR adds the tiles as an opt-in knob and does not change any default.Related discussion
#4238 does the same for the K quants on M1/M2 (gate/up 8,1,2) and leaves Q2_0 on the M5 tile. This is the Q2_0 counterpart, as an env knob rather than a default, because it was measured on one machine.
Approach
STRATA_METAL_MOE_GU/STRATA_METAL_MOE_DN("L,R,S") inmetal/src/engine/window.cpp, read once:moeblock andmtp_encode.gx_gu/gx_dnand the threadgroup widths follow the chosen tile, since they are computed from the same variables.GU_SET/DN_SET(the onesmoe.metalinstantiates) are accepted. Anything else is refused with a log line, and the default stays, so a typo cannot fail pipeline creation.strata metal: STRATA_METAL_MOE_GU=8,1,2).Validation
Passed:
expert_parity --gu Q2_0 --dn Q2_0 --ntok {1,2,3} --gucfg 8,1,2 --dncfg 4,2,4: y rel L2 5.3-6.3e-8, PASS (8,1,4 + 4,2,4 also passes).expert_parity --benchper config, two runs each, table above.--sweeppicks 8,1,2 / 8,1,4 for gate/up and 4,2,4 for down at every token count.fuse_parityfails onrouter_route, identically without the change (the known M1 Max routing issue)./metrics, no other traffic:main+ the commit) buildsstrataandexpert_paritywith no new warnings.Failed:
Not run:
mainunchanged.Limits
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.