Individual skill

build-triton-ascend-moe-gather-scatter

Build Ascend-friendly MoE gather, scatter, and router-weight-gradient kernels with vector-core-sized grids, UB-aware row/column tiling, and CANN slice extensions. Use when an agent ports MegaBlocks-style unbinned token routing to Triton-Ascend, reorders top-k token assignments, combines weighted expert outputs, or computes per-route weight gradients.

skills/build-triton-ascend-moe-gather-scatter/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
No
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 MoE Gather and Scatter

## Goal

Implement the unbinned routing triplet over assignment IDs: gather token rows into routing order, scatter weighted rows back to tokens, and compute one router-weight gradient per assignment.

## Workflow

1. Define L = tokens * TOP_K and require indices to be a permutation of assignment IDs in [0, L).
2. Gather routed row i from token row indices[i] // TOP_K.
3. Scatter routed row i into assignment slot indices[i], optionally scale by weights[indices[i]], then reduce the TOP_K slots per token.
4. Compute wgrad[indices[i]] as the float32 dot product of routed row i and grads[indices[i] // TOP_K].
5. Split L approximately evenly across the target vector cores.
6. Process SUB_BLOCK_SIZE assignments and BLOCK_X feature columns at a time.