Individual skill

build-triton-ascend-padded-moe-routing

Build padded MoE gather, scatter, and router-weight-gradient kernels for Triton-Ascend using real cumulative bins, padded cumulative bins, UB slice assembly, and vector-core-aware tiling. Use when an agent ports MegaBlocks padded routing, aligns each expert's token segment to a fixed multiple, restores weighted top-k outputs, or maps gradients through padded expert storage.

skills/build-triton-ascend-padded-moe-routing/SKILL.md

Read pinned source

Source commit 4ab5ee7adf47755ecd42723f55f4c58e38be95a7

What was checked

Matches the observed repository HEAD
Yes
Scanner rules are current
Yes
Repository scan complete
No
Skill scan complete
Yes
Observed behavior
Instructions only
Last checked
Nov 4, 2026

These are observations at the recorded commit, not a guarantee of safety. Review the source before running it.

Install this skill

Choose an agent in your Stack or copy a command below. Commands fetch the pinned commit and copy only this skill directory. Existing destinations are refused. Copying a command does not install anything.

An install command is unavailable: current rules, complete repository and skill scans, an eligible behavior level and a permitted license are required.

Repository context

Repository stars (not skill ratings)
189
Repository last updated
Aug 15, 2026
License
Apache-2.0

Observed agent integration: No specific integration evidence. Standard SKILL.md installation does not imply verified compatibility.

Files and excerpt

File metadata and permitted, redacted excerpts come from the recorded scan. Source links are pinned to that commit.

Browse files
Read excerpt

# Build Triton-Ascend Padded MoE Routing

## Goal

Store every expert's real assignments in a separately padded segment, preserve zero-filled gaps, and implement inverse scatter and per-assignment weight gradients.

## Workflow

1. Sort assignments by expert to obtain aligned indices and nondecreasing bin_ids.
2. Build bins from real cumulative counts.
3. Round each expert count to the required padding multiple and build padded_bins from cumulative padded counts.
4. Map sorted position i to offset_in_expert = i - bins[e-1] and padded row = padded_bins[e-1] + offset_in_expert.
5. Gather token indices[i] // TOP_K into that padded row.
6. Scatter real rows back through unique assignment IDs and compute wgrad with the same mapping.