arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2605.23911cs.DCcs.ETcs.PF
收藏

跨平台融合MoE调度在Triton中的实现:无需CUDA的可移植专家路由

Cross-Platform Fused MoE Dispatch in Triton: Portable Expert Routing Without CUDA

Subhadip Mitra

AI总结:

提出TritonMoE,一种完全基于OpenAI Triton的融合MoE调度内核,通过融合门控和上投影GEMM核减少35%全局内存流量,在NVIDIA A100上达到CUDA优化Megablocks的89-131%吞吐量,并在NVIDIA A100和AMD MI300X上零代码修改通过所有正确性测试,验证了跨平台可移植性。

摘要:

混合专家(MoE)架构驱动了大多数前沿大型语言模型,但其推理受到不规则内存访问模式和专家路由开销的瓶颈。现有的优化MoE内核(Megablocks、Tutel、FasterMoE)使用CUDA实现,并锁定在NVIDIA硬件上。我们提出了TritonMoE,一个完全用OpenAI Triton编写的融合MoE调度内核,它仅使用可移植的Triton原语执行完整的前向传播——路由器评分、令牌排列、专家GEMM和加权输出组合。我们的关键优化是一个融合的门控+上投影GEMM内核,它从共享的L2缓存输入块中计算两个SwiGLU投影,并在寄存器中执行SiLU激活,消除了35%的全局内存流量。在NVIDIA A100上,TritonMoE在推理批大小(<=512个令牌)下,针对Mixtral-8x7B、DeepSeek-V3和Qwen2-MoE配置,达到了CUDA优化Megablocks吞吐量的89-131%。所有162个正确性测试在NVIDIA A100和AMD MI300X上均零代码修改通过,验证了跨平台可移植性。此外,我们表征了在Zipf偏斜专家分配下对路由不平衡的敏感性,并确定了在极端偏斜下64个以上专家的场景,其中我们的固定块调度性能低于Megablocks的块稀疏布局,这激励了未来的动态块到专家分配工作。代码可在https://github.com/bassrehab/triton-kernels获取。

英文摘要:

Mixture-of-Experts (MoE) architectures power the majority of frontier large language models, but their inference is bottlenecked by irregular memory access patterns and expert routing overhead. Existing optimized MoE kernels (Megablocks, Tutel, FasterMoE) are implemented in CUDA and locked to NVIDIA hardware. We present TritonMoE, a fused MoE dispatch kernel written entirely in OpenAI Triton that performs the complete forward pass -- router scoring, token permutation, expert GEMMs, and weighted output combination -- using only portable Triton primitives. Our key optimization is a fused gate+up GEMM kernel that computes both SwiGLU projections from shared L2-cached input tiles with in-register SiLU activation, eliminating 35% of global memory traffic. On an NVIDIA A100, TritonMoE achieves 89-131% of the throughput of the CUDA-optimized Megablocks at inference batch sizes (<= 512 tokens) across Mixtral-8x7B, DeepSeek-V3, and Qwen2-MoE configurations. All 162 correctness tests pass on both NVIDIA A100 and AMD MI300X with zero code changes, validating cross-platform portability. We additionally characterize sensitivity to routing imbalance under Zipfian-skewed expert assignments and identify the regime -- 64+ experts under extreme skew -- where our fixed-tile scheduling underperforms Megablocks' block-sparse layout, motivating dynamic block-to-expert assignment as future work. Code is available at https://github.com/bassrehab/triton-kernels.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑