tune(sm90): improve W4A16 indexed MoE block-M selection - #67
Open
Missyinlll wants to merge 1 commit into
Open
Conversation
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
BLOCK_Mselection.BLOCK_M.BK=64) configs for targeted W4A16 indexed cases whenBM >= 32.Context
This builds on the SM90 indexed-A16 scheduling and bounded candidate framework introduced in #58 and #59.
The existing candidate flow already owns the indexed-A16 base schedule, legality checks, residency analysis, and schedule transforms. This PR keeps that structure intact and only extends the W4A16 indexed
BLOCK_Mselection and half-K preference.It is based on the latest main including #65 and preserves the short-K large-M scheduling guard added there.
Motivation
The existing indexed-A16 policy can switch to a larger
BLOCK_Mtoo aggressively near routed-M boundaries.For MoE workloads, only a small subset of experts may cross the next BM boundary, while increasing BM for all experts can introduce substantially more padding for only a small reduction in M tiles.
The updated selector uses deterministic per-expert tile estimates to choose BM and applies a small guard when a larger BM provides little tile-count reduction but significantly increases padding.
This also avoids the observed
BK=128performance cliff for larger W4A16 indexed tiles by preferring legal half-K configs whenBM >= 32.Validation
Benchmarked on an NVIDIA H100 80GB HBM3 against the latest
upstream/main.Representative workloads:
GLM-5.2
N=4096, K=6144N=6144, K=2048DeepSeek-V4
N=4096, K=4096N=4096, K=2048132 routed-M cases were tested in total.
Performance:
Several shapes around BM transition regions show substantially larger gains:
32/256/12824/256/12832/256/12824/256/12832/256/12824/256/12832/256/12832/256/64The largest improvements occur where the existing policy selects a substantially more expensive configuration near a BM/BK transition, while unchanged regions retain the existing configuration and performance.
Correctness:
rtol=0.02,atol=2.0