Mixture-of-Experts kernel engineering on Amazon SageMaker AI
AWS engineers share kernel optimizations for fused Mixture-of-Experts (MoE) models on Amazon SageMaker AI: Swap-AB for WGMMA utilization, Triton backend routing for FP8 quantization, and eliminating Triton JIT recompilation. Together they deliver up to 10% higher throughput and up to 9% faster Time to First Token on H200 GPUs.
Mixture-of-Experts (MoE) is an architecture that efficiently scales large language models (LLMs) while maintaining low per-token compute. Optimizing MoE operations through kernel engineering presents the greatest opportunity for performance improvements. A key optimization technique is fused MoE, which combines token routing, data shuffling, and specialized network calculations into a single batched operation on the GPU.
This reduces latency but introduces complexity in kernel implementation and debugging. High GPU utilization for this architecture necessitates hardware-specific optimizations. In this post, the different kernel optimizations for fused MoE models are described, and benefits are demonstrated. Using a representative MoE model as the primary example, Swap-AB for WGMMA utilization is discussed.
To maximize tensor processing throughput, the NVIDIA Hopper architecture utilizes the Warp Group Matrix Multiply Accumulate (WGMMA) instruction protocol. This instruction executes collectively across a cooperative warpgroup of 128 threads, with the matrix row dimension (M) fixed at a constant scale of 64 and the column dimension (N) remaining highly variable.
Operand A maps across the fixed M dimension, while Operand B maps across the variable N dimension. This operand asymmetry becomes a severe performance bottleneck during the decode phase of MoE networks, especially when the batch space or token row size is thin (M < 64). By transposing the matrices before reaching the PTX assembly layer, hardware utilization can be maximized, and Tensor Cores can operate at maximum local density.
Rewritten by urgent.news; may contain errors — check the original.
Source: aws.amazon.com
This story
This is one outlet's version. Read the fullest account.
- Deploy decision models with llama.cpp on Amazon SageMaker AI aws.amazon.com