Repository navigation
[Triton/Gluon] Moe routing optimizations - #5038
Conversation
🏷️ CI GuideRuns automatically on every PR:
Extended tests (opt-in via labels):
PR title tags: |
There was a problem hiding this comment.
🟡 Changes recommended
Address zero-row token-offset initialization and provide reproducible performance benchmarks.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
Optimizes MoE routing metadata propagation and reduces redundant stores between routing stages.
Changes:
- Uses
tl.gatherto pass tile offsets directly. - Masks histogram loads and limits metadata writes.
- Updates fused and non-fused routing paths.
File summaries
| File | Summary |
|---|---|
aiter/ops/triton/_triton_kernels/moe/moe_routing/routing.py |
Consumes returned tile offsets in routing kernels. |
aiter/ops/triton/_triton_kernels/moe/moe_routing/expt_data.py |
Refactors metadata computation; zero-row inputs may leave token offsets uninitialized, and benchmark evidence is missing. |
Review details
Suppressed comments (1)
aiter/ops/triton/_triton_kernels/moe/moe_routing/expt_data.py:35
- Calling
tl.gatherdirectly here makes this routing kernel depend on a Triton build that exposes that API. The repository already detectshasattr(triton.language, "gather")and provides a fallback inaiter/ops/triton/_triton_kernels/chunk_delta_attn/intra_attn.py; on a system-Triton build without it, the first routing compilation fails instead of falling back. Author must route this through a guarded helper/fallback or explicitly enforce the minimum Triton version.
tile_start = tl.gather(tile_starts, expt_id, 0)
- Files reviewed: 2/2 changed files
- Comments generated: 2
- Review effort level: Lite
💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Motivation
Optimize stores in routing kernels to reduce number of pids writing to the same address and prevent cash thrashing. Issue originally pointed out by @amd-hhashemi.
Technical Details
Issue only the stores that are necessary. Pass data between expert metadata kernels using tl.gather instead of store->load sequence.
Test Plan
UTs and performance.
Test Result
UTs pass. Significant performance improvement on cache coherent driver on MI450.
Submission Checklist