Skip to content

spacemit: skip MoE M8 padding for narrow small-token projections - #89

Merged
alex-spacemit merged 2 commits into
spacemit-com:mtmd-backendfrom
co-seven:opt/spacemit-moe-small-t
Dec 2, 2026
Merged

alex-spacemit merged 2 commits into
spacemit-com:mtmd-backendfrom
co-seven:opt/spacemit-moe-small-t

Conversation

@co-seven

Copy link
Copy Markdown
Collaborator

Summary

  • Avoid M8 padding for narrow MoE projections in small-token workloads.

@github-actions github-actions Bot added the ggml label Nov 28, 2026

Copy link
Copy Markdown
Collaborator

Please name this as an exception to M8 tail padding, not a bypass of the M8 kernel. K=2048, N=512, T=2–4, and ne11 == 1 identify a shape and broadcast layout, not a gate/up operator or a specific per-expert row count. I'd keep the narrow guard, but please show A/B results for sparse and concentrated routing, including the M1/M4 paths, the edge of the token range, and a neighboring wider projection. That will make it clear why this is the right boundary. Please leave the unrelated Q4_1 trace deletion out.

@co-seven

co-seven commented Dec 1, 2026

Copy link
Copy Markdown
Collaborator Author

The guard uses the tensor shape and broadcast layout to decide when to skip M8 padding for a partial tail group. Full groups of eight rows still use the existing M8 path.

On K3, I tested 20 operator cases covering T=1–5, N=512 and 1024, and both sparse and concentrated expert routing. The maximum NMSE against the scalar reference was 1.58e-5. For the tested T=2–4 cases that hit the guard, throughput was 1.15–1.59× that of the padded path.

@alex-spacemit
alex-spacemit merged commit fee8e41 into spacemit-com:mtmd-backend Dec 2, 2026
13 of 22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants