Imagine a high-end restaurant where the menu changes every few seconds based on what the customers order. This is the chaotic reality of Mixture-of-Experts (MoE) models, the architecture behind giants like DeepSeek and Qwen. In these models, only a few "experts" (specialized neural network layers) are activated for any given word or "token."
The problem? Because routing is dynamic, we never know which GPU will be slammed with work and which will be waiting for data. A new paper, "Weave: Routing-Adaptive Runtime Warp Scheduling for MoE Megakernels," introduces a clever way to manage this chaos by turning the GPU's internal "workers" into a flexible, multi-tasking workforce.
TL;DR
Weave is a runtime scheduler for MoE models that dynamically reassigns GPU "warps" (tiny groups of parallel threads) between communication and computation tasks based on real-time demand. By eliminating idle "bubbles" in the execution flow, it speeds up MoE layers by up to 2.87× over state-of-the-art baselines across NVIDIA and AMD hardware.
What Problem Does This Paper Address?
In large-scale MoE deployments, we use Expert Parallelism (EP), where different experts live on different GPUs. When a token needs a specific expert, it has to be "dispatched" to the correct GPU, processed, and then the result is "scattered" back.
Current systems use "megakernels"—massive, fused blocks of code—to handle this. But they have a major flaw: they are rigid. They decide how many workers (warps) focus on "talking" (communication) versus "crunching" (computation) at compile time.
Because token routing is unpredictable, this rigidity leads to bubbles: periods where computation warps sit idle waiting for data to arrive, or communication warps do nothing while the math is being done. The authors found that these bubbles can waste over 30% of a GPU's potential performance.
Methods
Weave introduces three key innovations to make the GPU more "elastic":
- Spatial Scheduling (The Warp Ratio): Instead of dedicating entire Streaming Multiprocessors (SMs) to communication—which leaves their powerful Tensor Cores idle—Weave splits warps within each SM. It chooses a specific ratio of "comm" warps to "compute" warps for each GPU at launch time to match that GPU's specific workload.
- Temporal Scheduling (Role Switching): Weave doesn't keep warps locked in one role. In the "head" phase, all warps help pull data from other GPUs to get the math started faster. In the "tail" phase, everyone chips in to reduce the final results.
- Fused Cost Model: To make these decisions, Weave uses a lightweight mathematical model that runs on the GPU itself. In just a few microseconds, it analyzes the routing statistics for the current batch and picks the optimal spatial and temporal plan.
Datasets
The researchers evaluated Weave using routing distributions from real-world datasets and model configurations:
- Models: Qwen (2.4T to 397B), MiniMax-M3, and DeepSeek-V4.
- Routing: Real traces from the ShareGPT dataset to simulate authentic user interactions.
- Hardware: NVIDIA H100 (SM103), H800 (SM90), and AMD MI300X (CDNA3).
Key Insights and Ideas
- Granularity is King: Scheduling at the SM level is too coarse; scheduling at the instruction level is too complex. The "warp" is the Goldilocks zone for MoE scheduling.
- The Cost of Silence: Static schedules are particularly bad at the beginning and end of a layer. By enlisting "compute" warps to help with the initial data "pull," Weave slashes the "head bubble" significantly.
- Hardware Sensitivity: The "bottleneck" shifts depending on the chip. On the NVIDIA H100, the system is often bound by NVLink bandwidth, while on the H800, it's more about raw math throughput. Weave’s cost model adapts to these hardware-specific quirks automatically.
Key Results
Weave consistently outperformed the strongest existing baselines:
- NVIDIA H100 (SM103): 1.30× faster on average than DeepGEMM-MegaMoE, with peaks up to 1.97×.
- NVIDIA H800 (SM90): 1.24× faster on average than MegaMoE.
- AMD MI300X (CDNA3): 1.44× faster than the official RCCL+AITER baseline, reaching up to 2.87× speedup in specific scenarios.
- End-to-End: For full model inference (decoding), Weave provided an 8% total speedup for Qwen models on H800 clusters.
Limitations and Future Work
While Weave is a significant step forward, the authors note a few areas for growth:
- Hardware Scope: The current implementation is optimized for NVIDIA and AMD GPUs. Adapting it to other AI accelerators (like TPUs or custom NPUs) would require re-calibrating the cost models for different memory and DMA hierarchies.
- Expert Replication: Weave is "orthogonal" to expert load balancing (like EPLB). While they work well together, future work could more deeply integrate scheduling with how experts are placed across a cluster.
In short, Weave proves that in the world of MoE, being a "jack of all trades" (a flexible warp) is much better than being a master of only one.
Summary updated