Skip to content

[Triton/Gluon] PA decode: config-driven v1/v2 dispatch, gfx950 always v2 wh… - #5859

Merged
azaidy merged 11 commits into
mainfrom
gfx950-pa-decode-v2
Oct 7, 2026
Merged

azaidy merged 11 commits into
mainfrom
gfx950-pa-decode-v2

Conversation

@NimitPtl

@NimitPtl NimitPtl commented Sep 25, 2026 •

Copy link
Copy Markdown
Contributor

…en split

Adds a PA-DECODE config (configs//triton/attention/pa_decode/DEFAULT.json) with a per-KV-dtype "dispatch" rule, read through resolve_config_dir / load_config_json by a torch-free _get_dispatch_config() in the kernel module. When a rule exists, v1 is used only for max_num_partitions <= v1_max_partitions; arches/dtypes without a rule (and the per-token-quant path) keep the existing heuristic, so only gfx950 bf16/fp16 changes.

gfx950 rule: v1_max_partitions = 1, i.e. v2 whenever the context spans more than one 1024-token partition. The old heuristic chose v1 for num_seqs * num_q_heads > 512 up to 8K context, where v2 is 1.02-4.5x faster on MI355X (5.3x at B=32, ctx 8K, D=64 with CUDA-graph timing).

test_pa_decode: 816 passed.

Motivation

Technical Details

Test Plan

The additional tests are to trigger V2 version which gets triggered only when context is >1024 tokens, which was not tested earlier. New test, basically helps trigger this part. This was getting bypassed earlier in the earlier test coverage.

Test Result

PA decode (Triton) — bf16, query len 1, page size 16 (TB/s of KV cache read)

Batch Context Q heads KV heads D Kernel path Before After Speedup
32 8192 64 8 64 V1 → V2 0.86 4.57 5.29x
128 8192 64 8 64 V1 → V2 1.64 4.78 2.92x
32 8192 64 8 128 V1 → V2 1.53 4.76 3.12x
128 8192 64 8 128 V1 → V2 2.74 5.48 2.00x
1 8192 64 8 64 V2 (unchanged) 0.50 0.50 0.99x
8 8192 64 8 64 V2 (unchanged) 3.25 3.25 1.00x
1 32768 64 8 64 V2 (unchanged) 1.68 1.68 1.00x
8 32768 64 8 64 V2 (unchanged) 4.54 4.55 1.00x
32 32768 64 8 64 V2 (unchanged) 4.82 4.83 1.00x
8 131072 64 8 64 V2 (unchanged) 4.80 4.80 1.00x
1 8192 64 8 128 V2 (unchanged) 1.06 1.07 1.00x
8 8192 64 8 128 V2 (unchanged) 5.31 5.41 1.02x
1 32768 64 8 128 V2 (unchanged) 3.28 3.28 1.00x
8 32768 64 8 128 V2 (unchanged) 4.48 4.47 1.00x
32 32768 64 8 128 V2 (unchanged) 5.49 5.50 1.00x
8 131072 64 8 128 V2 (unchanged) 5.57 5.57 1.00x
Geomean (all) 2.60 3.46 1.33x
Geomean (V1 → V2 shapes) 3.13x

Submission Checklist

…en split

Adds a PA-DECODE config (configs/<arch>/triton/attention/pa_decode/DEFAULT.json)
with a per-KV-dtype "dispatch" rule, read through resolve_config_dir /
load_config_json by a torch-free _get_dispatch_config() in the kernel module.
When a rule exists, v1 is used only for max_num_partitions <=
v1_max_partitions; arches/dtypes without a rule (and the per-token-quant path)
keep the existing heuristic, so only gfx950 bf16/fp16 changes.

gfx950 rule: v1_max_partitions = 1, i.e. v2 whenever the context spans more
than one 1024-token partition. The old heuristic chose v1 for
num_seqs * num_q_heads > 512 up to 8K context, where v2 is 1.02-4.5x faster
on MI355X (5.3x at B=32, ctx 8K, D=64 with CUDA-graph timing).

test_pa_decode: 816 passed.
@NimitPtl
NimitPtl requested a review from a team September 25, 2026 19:53
@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 5859 --add-label <label>

One backend per PR:
A PR changes one kernel backend ([Triton/Gluon], [HIP], [ASM], [CK], [OPUS] or [FlyDSL]). If the title ends up with two backend tags, split the PR -- as stacked pull requests when one part cannot merge without the other.

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.

@github-actions github-actions Bot changed the title [Triton] PA decode: config-driven v1/v2 dispatch, gfx950 always v2 wh… [Triton/Gluon] PA decode: config-driven v1/v2 dispatch, gfx950 always v2 wh… Sep 25, 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.

Copilot review overview

🟡 Changes recommended

Add regression coverage for longer scalar-cache cases and update the dispatch documentation.

Get a fresh assessment by requesting another Copilot review.

Review effort: Lite
Findings: 1 Medium severity · 1 Low severity

Open (2)
What changed in this PR

Adds config-driven Triton PA decode V1/V2 dispatch, routing gfx950 BF16/FP16 multi-partition workloads to V2.

Changes:

  • Adds gfx950 dispatch thresholds.
  • Loads per-dtype rules through shared config utilities.
  • Applies configured routing while preserving fallback behavior.
File Description
aiter/​ops/​triton/​configs/​gfx950/​triton/​attention/​pa_decode/​DEFAULT.json Defines gfx950 dispatch thresholds.
aiter/​ops/​triton/​attention/​pa_decode.py Selects V1/V2 using configured rules.
aiter/​ops/​triton/​_triton_kernels/​attention/​pa_decode.py Loads dispatch configuration.

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

Comment thread aiter/ops/triton/attention/pa_decode.py Resolved
Comment thread aiter/ops/triton/attention/pa_decode.py Resolved
@azaidy azaidy self-assigned this Sep 28, 2026
scxiao
scxiao previously approved these changes Sep 28, 2026
@NimitPtl
NimitPtl requested a review from scxiao October 5, 2026 19:36
@scxiao

scxiao commented Oct 7, 2026

Copy link
Copy Markdown
Contributor

Hi @NimitPtl, how is the perf number here compared to the TLX kernel with your changes?

@NimitPtl

NimitPtl commented Oct 7, 2026

Copy link
Copy Markdown
Contributor Author

@scxiao erf number in description of PR

@azaidy azaidy 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.

LGTM!

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.

4 participants