Skip to content

[Triton/Gluon] Add config-aware repr to the rope and normalization kernels - #5099

Open
Boss2002n wants to merge 1 commit into
mainfrom
satya/triton-kernel-repr-rope-norm
Open

[Triton/Gluon] Add config-aware repr to the rope and normalization kernels#5099
Boss2002n wants to merge 1 commit into
mainfrom
satya/triton-kernel-repr-rope-norm

Conversation

@Boss2002n

Copy link
Copy Markdown
Contributor

No description provided.

32 launchable kernels across _triton_kernels/rope/{rope,fused_qkv_split_qk_rope,
fused_qkv_split_qk_norm_rope_cache}.py and _triton_kernels/normalization/
{norm,rmsnorm,fused_add_rmsnorm_pad,fused_rmsnorm_add}.py had no repr.

12 jit device helpers are left alone (the _get_neox_rotated_x / _get_gptj_
rotated_x family, _rms_norm, _per_token_quant, _rmsnorm_op and friends) -- they
are inlined into other kernels, never launched.

NUM_PRGMS is excluded from the five rmsnorm kernels that declare it: every
launch site is literally grid = (NUM_PRGMS,) with NUM_PRGMS = min(rows,
get_num_sms()), so it is device occupancy rather than a tuned parameter and
would give a different trace name per input size. num_stages is kept for the
four rope kernels that take it as a real constexpr -- it is tuned at the launch
site, and attention/mla.py and unified_attention.py already list it.

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.
@Boss2002n
Boss2002n requested review from a team and a lite review from Copilot August 29, 2026 04:43
@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 5099 --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.

@github-actions github-actions Bot changed the title [Triton] Add config-aware repr to the rope and normalization kernels [Triton/Gluon] Add config-aware repr to the rope and normalization kernels Aug 29, 2026

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

Adds config-aware Triton repr functions (via make_kernel_repr) to RoPE and normalization kernels under aiter/ops/triton/_triton_kernels/, improving kernel naming/traceability of compiled specializations.

Changes:

  • Introduces make_kernel_repr usage and attaches @triton.jit(repr=...) to RoPE kernels (including fused QKV+RoPE variants).
  • Introduces make_kernel_repr usage and attaches @triton.jit(repr=...) to RMSNorm/LayerNorm kernels (including fused variants and some bwd kernels).
  • Adds per-kernel repr key lists intended to encode relevant tl.constexpr specialization parameters into artifact names.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
aiter/ops/triton/_triton_kernels/rope/rope.py Adds make_kernel_repr and config-aware repr= to multiple RoPE kernels.
aiter/ops/triton/_triton_kernels/rope/fused_qkv_split_qk_rope.py Adds config-aware repr= to the fused QKV split + RoPE kernel.
aiter/ops/triton/_triton_kernels/rope/fused_qkv_split_qk_norm_rope_cache.py Adds config-aware repr= to the fused QKV split + norm + RoPE + cache kernel.
aiter/ops/triton/_triton_kernels/normalization/rmsnorm.py Adds config-aware repr= to RMSNorm forward/fused/quant and bwd kernels.
aiter/ops/triton/_triton_kernels/normalization/norm.py Adds config-aware repr= to LayerNorm forward/fused/quant and bwd kernels.
aiter/ops/triton/_triton_kernels/normalization/fused_rmsnorm_add.py Adds config-aware repr= to the fused RMSNorm (+ optional residual) kernel.
aiter/ops/triton/_triton_kernels/normalization/fused_add_rmsnorm_pad.py Adds config-aware repr= to the fused add + RMSNorm + pad kernel.
Suppressed comments (4)

aiter/ops/triton/_triton_kernels/normalization/rmsnorm.py:183

  • This kernel takes NUM_PRGMS as a tl.constexpr and uses it in tl.range(..., NUM_PRGMS, ...), but NUM_PRGMS is missing from the repr keys, reducing trace-name fidelity across specializations.
        "DUMP_INTERMEDIATE",
        "BLOCK_SIZE",
        "USE_BLOCKED",
    ],
)

aiter/ops/triton/_triton_kernels/normalization/rmsnorm.py:422

  • NUM_PRGMS is a tl.constexpr parameter of this kernel and affects the persistent-loop traversal, but it’s not included in the repr keys; add it so specialization names remain config-aware.
    [
        "BLOCK_SIZE",
        "USE_BLOCKED",
    ],

aiter/ops/triton/_triton_kernels/normalization/rmsnorm.py:582

  • The kernel signature includes NUM_PRGMS (constexpr) but the repr key list omits it, so different NUM_PRGMS specializations will share the same compiled name suffix.
        "IS_SMOOTH",
        "BLOCK_SIZE",
        "USE_BLOCKED",
    ],

aiter/ops/triton/_triton_kernels/normalization/rmsnorm.py:820

  • NUM_PRGMS is a constexpr that changes which rows each program processes (tl.range stride), but it’s missing from the repr keys. Include it so the repr stays aligned with specialization-relevant constants.
    [
        "BLOCK_SIZE",
        "USE_BLOCKED",
    ],

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

Comment on lines +47 to +50
[
"BLOCK_SIZE",
"USE_BLOCKED",
],
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants