[KMCompiler]Fused moe: add thead (PPU-ZW810E) backend - #696
Open
LittleShun1214 wants to merge 1 commit into
Open
[KMCompiler]Fused moe: add thead (PPU-ZW810E) backend#696LittleShun1214 wants to merge 1 commit into
LittleShun1214 wants to merge 1 commit into
Conversation
LittleShun1214
marked this pull request as ready for review
August 18, 2026 12:35
LittleShun1214
force-pushed
the
feat/thead-backend
branch
2 times, most recently
from
August 26, 2026 08:58
cb024e4 to
5cd5bf3
Compare
LittleShun1214
force-pushed
the
feat/thead-backend
branch
from
August 26, 2026 09:02
5cd5bf3 to
c5baef6
Compare
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.
PR Category
[ Operator | Benchmark ]
Type of Change
[ New Feature | Performance Optimization ]
Description
Add a new
_theadbackend implementing a pure-Triton fused MoE (fused_experts_impl) specialized for the T-Head PPU (ZW810E, compute_89 / AIU MMA instructions), modeled on the existing_metax/_mthreadsvendor backends.Key points:
moe_align_block_size, transpose-cached weights (reusing the commonpermute_copyoperator synchronized from FlagGems for the transpose), per-tilemoe_sumreduction, nodeep_gemmdependency in the production path.Mwith config tiering by token count (MOE_GEMM_TUNING_MIN_TOKENS, split gemm1/gemm2 stages) and a GEMV-style kernel for smallM(fused_moe_gemv_kernel,N >= 1024, row-count gated) that mimics DeepGemm'sGemvton PPU.BLOCK_SIZEsweep for the PPU; GEMV configBLOCK_N=128, BLOCK_K=32, num_warps=1, num_stages=2.weakref-based lifetime synchronization and config-dependent capacity degradation; the FlagGems-synchronizedpermute_copyoperator is updated with int64 indexing to support tensors with >2^31 elements (DeepSeek-like shapes), which is required by the weight transpose path.The backend is selected via
torch_device_fn(vendor probe); no change to other backends or the default dispatch.Issue
Progress
Performance
Benchmarked against the vLLM production DeepGemm path, cudagraph mode, 24 real shapes (Qwen3-6B-like: M in 1..16384, 2I in 512/2048, E=256, topk=8), 10 successful runs, speedup = mean over runs:
Summary (mean over 10 runs):