Skip to content

[Triton/Gluon] Add config-aware repr to the MOE and fusion kernels - #5098

Merged
Boss2002n merged 2 commits into
mainfrom
satya/triton-kernel-repr-moe-fusions
Sep 1, 2026
Merged

Boss2002n merged 2 commits into
mainfrom
satya/triton-kernel-repr-moe-fusions

Conversation

@Boss2002n

Copy link
Copy Markdown
Contributor

No description provided.

@Boss2002n
Boss2002n requested review from a team and a lite review from Copilot August 29, 2026 04:43
@github-actions github-actions Bot changed the title [Triton] Add config-aware repr to the MOE and fusion kernels [Triton/Gluon] Add config-aware repr to the MOE and fusion kernels Aug 29, 2026
@github-actions

Copy link
Copy Markdown
Contributor

🏷️ CI Guide

Runs automatically on every PR:

  • ✅ Pre-checks (submodule verification, code formatting)
  • ✅ Aiter op tests (gfx942 + gfx950)
  • ✅ Triton tests on MI35X (only when aiter/ops/triton/** or related paths are changed)

Extended tests (opt-in via labels):

Label Tests
ci:gfx1250-ffm-triton Run the five-shard gfx1250 FFM Triton test suite
ci:triton-300x Run an additional Triton test job on MI300X in PRs; main branch always runs both MI35X and MI300X
multigpu Aiter multi-GPU tests on the 8-GPU runner
ci:sglang SGLang integration tests: DeepSeek-R1-MXFP4 accuracy, Qwen 3.5 accuracy
ci:atom ATOM benchmark: DeepSeek-R1-0528, GPT-OSS-120B
ci:atom_full ATOM accuracy suite for PR and main models from ATOM models_accuracy.json
ci:vllm vLLM benchmark: GPT-OSS-120B, DeepSeek-R1-0528, Kimi-K2.5
ci:all All standard extended tests (excludes ci:atom_full)

Only add ci:atom_full for FlyDSL or Triton upgrades.
Add labels via the sidebar or gh pr edit 5098 --add-label <label>

PR title tags:
Component tags ([Triton/Gluon], [HIP], [CK], [ASM], ...) are added to the PR title automatically from the changed files and re-synced on every push — change-type tags like [fix]/[Perf] and op tags like [MLA] are left untouched. Add the no-auto-title label to opt this PR out of title tagging.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR standardizes Triton and Gluon kernel naming by adding config-aware repr functions (via make_kernel_repr) to MOE routing/reduction/GEMM kernels and several fusion kernels, improving traceability of compiled specializations in profiling, caching, and debug artifacts.

Changes:

  • Add make_kernel_repr(...) definitions capturing relevant tl.constexpr / gl.constexpr specialization keys.
  • Attach those repr functions to entry kernels using @triton.jit(repr=...) / @gluon.jit(repr=...).
  • Extend this across MOE kernels (routing, quant helpers, GEMMs) and fusion kernels (attention residual, KV cache, qk concat, mul-add, mHC).

Reviewed changes

Copilot reviewed 16 out of 16 changed files in this pull request and generated no comments.

Show a summary per file
File Description
aiter/ops/triton/_triton_kernels/moe/reduce.py Add config-aware repr for _reduce_grouped and pass it to @triton.jit.
aiter/ops/triton/_triton_kernels/moe/quant_moe.py Add config-aware reprs for quantize/downcast/upcast and smoothquant fused kernels.
aiter/ops/triton/_triton_kernels/moe/moe_routing/topk.py Add config-aware reprs for _topk, _hash_routing, and _grouped_topk.
aiter/ops/triton/_triton_kernels/moe/moe_routing/routing.py Add config-aware reprs for _combined_routing and _combined_routing_fused.
aiter/ops/triton/_triton_kernels/moe/moe_routing/minunique.py Add config-aware repr for _keepk_sort0.
aiter/ops/triton/_triton_kernels/moe/moe_routing/bitmatrix.py Add config-aware reprs for bitmatrix memset and row-sum kernels.
aiter/ops/triton/_triton_kernels/moe/moe_op_gemm_int8_smoothquant.py Add config-aware repr for the Int8 SmoothQuant MoE GEMM kernel.
aiter/ops/triton/_triton_kernels/moe/moe_op_gemm_a8w8.py Add config-aware repr for A8W8 MoE GEMM kernel.
aiter/ops/triton/_triton_kernels/moe/moe_op_gemm_a8w8_blockscale.py Add config-aware repr for A8W8 blockscale MoE GEMM kernel.
aiter/ops/triton/_triton_kernels/moe/moe_op_gemm_a4w4.py Add config-aware repr for the MXFP4 quant kernel.
aiter/ops/triton/_triton_kernels/fusions/mhc.py Add config-aware reprs for multiple mHC fused/split/reduce/post kernels.
aiter/ops/triton/_triton_kernels/fusions/fused_qk_concat.py Add config-aware reprs for q/k concat kernels (with and without RoPE).
aiter/ops/triton/_triton_kernels/fusions/fused_mul_add.py Add config-aware repr for fused mul-add kernel.
aiter/ops/triton/_triton_kernels/fusions/fused_kv_cache.py Add config-aware reprs for fused RoPE+reshape+cache kernels.
aiter/ops/triton/_triton_kernels/fusions/attn_res.py Add config-aware repr for attnres_fwd_kernel and pass it to @triton.jit.
aiter/ops/triton/_gluon_kernels/gfx942/moe/moe_op_gemm_int8_smoothquant.py Add config-aware repr for the Gluon Int8 SmoothQuant MoE GEMM kernel.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Copilot AI review requested due to automatic review settings August 29, 2026 15:11

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 16 out of 16 changed files in this pull request and generated no new comments.

@zufayu
zufayu requested review from a team and vgokhale August 31, 2026 01:18
@Boss2002n Boss2002n closed this Aug 31, 2026
@Boss2002n Boss2002n reopened this Aug 31, 2026
@Boss2002n
Boss2002n marked this pull request as draft August 31, 2026 05:37
@github-actions

Copy link
Copy Markdown
Contributor

🏷️ CI Guide

Runs automatically on every PR:

  • ✅ Pre-checks (submodule verification, code formatting)
  • ✅ Aiter op tests (gfx942 + gfx950)
  • ✅ Triton tests on MI35X (only when aiter/ops/triton/** or related paths are changed)

Extended tests (opt-in via labels):

Label Tests
ci:gfx1250-ffm-triton Run the five-shard gfx1250 FFM Triton test suite
ci:triton-300x Run an additional Triton test job on MI300X in PRs; main branch always runs both MI35X and MI300X
multigpu Aiter multi-GPU tests on the 8-GPU runner
ci:sglang SGLang integration tests: DeepSeek-R1-MXFP4 accuracy, Qwen 3.5 accuracy
ci:atom ATOM benchmark: DeepSeek-R1-0528, GPT-OSS-120B
ci:atom_full ATOM accuracy suite for PR and main models from ATOM models_accuracy.json
ci:vllm vLLM benchmark: GPT-OSS-120B, DeepSeek-R1-0528, Kimi-K2.5
ci:all All standard extended tests (excludes ci:atom_full)

Only add ci:atom_full for FlyDSL or Triton upgrades.
Add labels via the sidebar or gh pr edit 5098 --add-label <label>

PR title tags & labels:
Component tags ([Triton/Gluon], [HIP], [CK], [ASM], ...) are added to the PR title and as PR labels automatically from the changed files and re-synced on every push — change-type tags like [fix]/[Perf], op tags like [MLA], and human labels (ci:*) are left untouched. Add the no-auto-title label to opt this PR out.

31 launchable kernels across the MOE GEMMs, quant_moe, reduce, the moe_routing
package, and _triton_kernels/fusions/{attn_res,fused_kv_cache,fused_mul_add,
fused_qk_concat,mhc}.py.

Two of those are only reachable indirectly and a name grep misses them:
fused_kv_cache's _fused_qk_rope_cat_and_cache_mla_kernel and
_fused_qk_rope_reshape_and_cache_kernel are imported under aliases, bound to a
local behind a gfx1250 branch, and launched through that local.

31 jit device helpers are left alone. Two of them carry a _kernel suffix but
are not launchable: _store_kv_cache_kernel is called as a device function from
inside another kernel, and _dequant_int8_to_fp32_kernel has no references
anywhere in the tree.

Float tolerances are excluded from the key lists (eps, out_eps, scale, FP8_MAX
in attn_res; the four hc_* values in mhc) -- they would put raw floats in kernel
names without identifying a config, and mhc's existing repr already lists only
shape and block keys. ROUTED_SCALING is kept despite being a float: it is a
routing config with no companion flag, and logit_cap sets the precedent.

Key lists follow the neighbouring kernels in each subtree: tuned block/tile
sizes and the meaningful compile-time flags, with runtime pointers, strides and
grid-extent constexprs excluded (the launch site was checked before deciding on
each one). A key that is not a real parameter renders as NONE in every trace
name, so every list was re-parsed from the file and cross-checked against the
kernel signature, then rendered through the real make_kernel_repr to confirm no
NONE appears. Bare @triton.jit(repr=...) is used throughout, matching the
majority of the reprs already in the tree.

Full-tree ruff (0.16.0, the CI pin) and black report exactly the same findings
as main.


Keys whose value can be negative or a non-integral float are deliberately
excluded. make_kernel_repr renders the value into the kernel name, and Triton
then rejects the name -- "CompilationError: invalid function identifier" -- so
e.g. a 2.5 becomes "..._2.5" and the name breaks at the dot, and a -448 breaks
at the minus. Every key list here was checked against the values its launch
sites actually pass.
Dropped on that basis: ROUTED_SCALING on _topk / _hash_routing / _grouped_topk /
_keepk_sort0. It takes routed_scaling_factor straight from the caller, and the
routing tests pass 2.5 -- which is exactly the failure this note describes.
@Boss2002n
Boss2002n force-pushed the satya/triton-kernel-repr-moe-fusions branch from 428aee1 to 26e62a7 Compare August 31, 2026 06:06
@Boss2002n
Boss2002n marked this pull request as ready for review August 31, 2026 06:06
Copilot AI review requested due to automatic review settings August 31, 2026 06:06

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 16 out of 16 changed files in this pull request and generated no new comments.

@Boss2002n
Boss2002n requested a review from lburzawa August 31, 2026 14:30
One conflict, in _triton_kernels/fusions/mhc.py. #5149 reverted the Triton
parts of #4978, which removed _mhc_asymmetric_sinkhorn_kernel and
_mhc_head_kernel outright; this branch had added a repr to each. Took the
deletion -- both kernels and both repr definitions are gone -- and kept the
_mhc_fused_kernel repr, which sat in the same hunk and whose kernel main still
has.

31 of the branch's 33 reprs survive; the two dropped are exactly the two whose
kernels no longer exist. No reference to either name is left anywhere in the
tree, and every remaining @triton.jit(repr=...) resolves to a definition.
Copilot AI review requested due to automatic review settings September 1, 2026 13:18

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 16 out of 16 changed files in this pull request and generated no new comments.

@Boss2002n
Boss2002n merged commit 7a5d2ad into main Sep 1, 2026
71 checks passed
@Boss2002n
Boss2002n deleted the satya/triton-kernel-repr-moe-fusions branch September 1, 2026 16:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants