Skip to content

[Triton/Gluon] [HIP] [FlyDSL] Gluon PA decode: ragged (varlen) query support - #6099

Closed
sshlyapn wants to merge 2 commits into
ROCm:mainfrom
sshlyapn:sshliapn/features/gluon-pa-ragged
Closed

sshlyapn wants to merge 2 commits into
ROCm:mainfrom
sshlyapn:sshliapn/features/gluon-pa-ragged

Conversation

@sshlyapn

@sshlyapn sshlyapn commented Oct 2, 2026

Copy link
Copy Markdown
Contributor

Motivation

pa_decode_gluon needs the same query_length for every sequence, so it can't take a decode batch with mixed lengths, e.g. speculative decodes next to plain decodes. vLLM's ROCM_AITER_FA backend sends such batches to unified_attention, which doesn't support the shuffled KV layout. With shuffled KV it asserts instead.

Example: MiniMax-M3-MXFP8 on MI355X (TP4, ROCM_AITER_FA, shuffled fp8 KV, EAGLE3 with 3 draft tokens). The server dies during warmup on the mixed spec/non-spec decode step: AssertionError: Shuffle KV cache layout is not supported with sliding window, sinks, or speculative decoding (multi-token decode).

This PR adds ragged (varlen) input, so each sequence uses only its own rows. With this PR plus a vLLM change that passes query_start_loc for ragged decode batches, the same server starts and answers correctly (see Accuracy).

Changes

  • New optional query_start_loc ([num_seqs + 1], int32) for pa_decode_gluon, PS path only. Sequence i owns packed query/output rows [query_start_loc[i], query_start_loc[i + 1]). query_length must be >= every per-sequence length. Rows not owned by any sequence are left untouched. Non-PS paths assert on it.
  • Supported in the gluon head_1 and multi-KV attention kernels and in all three PS reduces (Triton, HIP, FlyDSL). In each one the varlen code sits behind a compile-time flag (constexpr / const_expr / IS_VARLEN template parameter, which is also part of the HIP JIT cache key), so uniform kernels don't contain it.
  • Fix the default temporary_output dtype. It was query.dtype, but the attention kernels store bf16 for fp8 compute (otherwise compute_type). Before this fix, an fp8 query with fp8 compute and no temporary_output failed to compile (amdg.buffer_store element type mismatch). Configs that compiled before are unaffected.
  • New test op_tests/triton_tests/test_pa_decode_gluon_varlen.py. Each sequence of a ragged call must match a batch-1 uniform call, and unowned rows must keep a sentinel value. Coverage:
    • bf16, fp8 KV, fp8 Q+KV, sinks, sliding window
    • block 16/64/128 with shuffled V
    • head_1 and multi-KV, one-shot and 8 splits, all 3 reduces
    • zero-length sequences

Uniform path impact

  • Gluon attention and Triton/FlyDSL reduces: the varlen code is gated at compile time.
  • HIP reduce: query_start_loc_ptr is only read under if constexpr(IS_VARLEN). Uniform calls build the IS_VARLEN=false instance and pass nullptr, so uniform kernels never touch it.

Reproduce

pytest -q op_tests/triton_tests/test_pa_decode_gluon_varlen.py

Optional query_start_loc for pa_decode_gluon (PS path): gluon head_1 and
multi-head attention kernels, PS reduce in Triton, HIP and FlyDSL. Uniform
path unchanged. Tests in op_tests/triton_tests/test_pa_decode_gluon_varlen.py.

Signed-off-by: Sergei Shliapnikov <[email protected]>
@sshlyapn
sshlyapn requested review from a team and a balanced review from Copilot October 2, 2026 16:24
@github-actions

github-actions Bot commented Oct 2, 2026

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 (added automatically when gfx942 configs change); main branch always runs both MI35X and MI300X
ci:triton-355 Run the full Triton test suite on MI35X, not only the tests the change affects
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 6099 --add-label <label>

One backend per PR:
A PR changes one kernel backend: [Triton/Gluon] (Triton and Gluon count as one), [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 stop the title rewrites; labels stay in sync either way.

@github-actions github-actions Bot changed the title [Triton/Gluon] Gluon PA decode: ragged (varlen) query support [Triton/Gluon] [HIP] [FlyDSL] Gluon PA decode: ragged (varlen) query support Oct 2, 2026
@sshlyapn

sshlyapn commented Oct 2, 2026

Copy link
Copy Markdown
Contributor Author

@ukannika could you please take a look at these changes when you get a chance?

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

Backend scope, device validation, test organization/runtime, and the temporary-buffer contract require correction.

Review effort: Balanced
Findings: 1 High severity · 2 Medium severity · 2 Low severity

Open (5)
What changed in this PR

Adds ragged-query support to Gluon paged-attention decode across PS attention and reduction backends.

Changes:

  • Adds packed query_start_loc handling.
  • Extends Triton, HIP, and FlyDSL reducers.
  • Adds broad ragged-query coverage and corrects temporary-buffer dtype allocation.
File Description
op_tests/​triton_tests/​test_pa_decode_gluon_varlen.py Tests ragged decode configurations.
csrc/​cpp_itfs/​pa/​pa_ps.py Extends HIP JIT launcher.
csrc/​cpp_itfs/​pa/​pa_ps.cuh Adds packed-row HIP reduction.
csrc/​cpp_itfs/​pa/​pa_ps.cpp.jinja Threads ragged metadata into HIP.
aiter/​ops/​triton/​gluon/​pa_decode_gluon.py Implements ragged Gluon/Triton dispatch.
aiter/​ops/​flydsl/​pa_decode.py Extends FlyDSL reduction launcher.
aiter/​ops/​flydsl/​kernels/​pa_decode_reduce.py Adds packed-row FlyDSL stores.

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

Comment thread aiter/ops/flydsl/pa_decode.py Resolved
@zufayu
zufayu requested review from a team and vgokhale October 3, 2026 00:35
Copilot AI balanced review requested due to automatic review settings October 5, 2026 06:18
@github-actions github-actions Bot added the CI label Oct 5, 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

Packed inputs lack necessary shape validation, and the PR violates established backend-scope and test-placement rules.

Review effort: Balanced
Findings: 1 High severity

Open (1)
Resolved since last review (5)

Copilot AI balanced review requested due to automatic review settings October 5, 2026 06:42
@sshlyapn
sshlyapn force-pushed the sshliapn/features/gluon-pa-ragged branch from 0a7c04c to e90a906 Compare October 5, 2026 06:42

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

The multi-KV zero-length path performs unnecessary full attention work, and the new test violates the required mirrored folder layout.

Review effort: Balanced
Findings: 1 Medium severity

Open (1)
Resolved since last review (1)

@andrei-kochin

Copy link
Copy Markdown
Contributor

Per the CI guide's one-backend-per-PR rule, this PR is now split, with @sshlyapn kept as commit author:

  1. [HIP] PA decode PS reduce: optional query_start_loc for ragged (varlen) output #6444 — [HIP] PA decode PS reduce: optional query_start_loc for ragged (varlen) output (based on main)
  2. [Triton/Gluon] Gluon PA decode: ragged (varlen) query support #6445 — [Triton/Gluon] Gluon PA decode: ragged (varlen) query support (stacked on [HIP] PA decode PS reduce: optional query_start_loc for ragged (varlen) output #6444; review only its last commit)

This PR conflicted with main, so the split is rebased:

The HIP files are byte-identical to this PR. Suggest closing this PR once the split is acknowledged.

@vgokhale

Copy link
Copy Markdown
Contributor

@andrei-kochin can we close this PR now?

sshlyapn added a commit to andrei-kochin/aiter that referenced this pull request Oct 14, 2026
New optional query_start_loc ([num_seqs + 1], int32) for pa_decode_gluon,
PS path only. Sequence i owns packed query/output rows
[query_start_loc[i], query_start_loc[i + 1]); query_length must be >= every
per-sequence length; rows not owned by any sequence are left untouched.
Non-PS paths assert on it.

- Supported in the gluon head_1 and multi-KV attention kernels and in the
  Triton PS reduce, each behind a compile-time IS_VARLEN flag; the HIP PS
  reduce is used through its query_start_loc argument.
- Causal masks use the per-sequence query length, on top of the per-split
  causal mask from ROCm#5915.
- Fix the default temporary_output dtype: the attention kernels store bf16
  for fp8 compute (otherwise compute_type), not query.dtype. An fp8 query
  with fp8 compute and no temporary_output failed to compile before.
- New test op_tests/triton_tests/test_pa_decode_gluon_varlen.py: each
  sequence of a ragged call must match a batch-1 uniform call, and unowned
  rows must keep a sentinel. Covers bf16, fp8 KV, fp8 Q+KV, sinks, sliding
  window, block 16/64/128 with shuffled V, head_1 and multi-KV, one-shot and
  split runs through the HIP and Triton reduces, and zero-length sequences.

Split out of ROCm#6099, rebased onto main. The FlyDSL reduce part of ROCm#6099 is
dropped: since ROCm#5809 the Gluon path no longer dispatches to the FlyDSL PS
reduce, and the no-work-plan mode it extended no longer exists.

Signed-off-by: Sergei Shliapnikov <[email protected]>
Signed-off-by: Andrei Kochin <[email protected]>
Co-authored-by: Cursor <[email protected]>
@andrei-kochin

Copy link
Copy Markdown
Contributor

@vgokhale yes, let's continue in other PRs #6444 and #6445

sshlyapn added a commit to andrei-kochin/aiter that referenced this pull request Oct 15, 2026
…n) output

Optional query_start_loc ([num_seqs + 1], int32) for the HIP partitioned-
softmax reduce. With it, the output is packed per token as
[1, num_tokens, num_kv_heads, group, head] and sequence b writes rows
[query_start_loc[b], query_start_loc[b + 1]); rows past a sequence's query
length are not stored.

- The varlen code sits behind the IS_VARLEN template parameter, which is also
  part of the JIT cache key; uniform calls build IS_VARLEN=false and pass
  nullptr, so uniform kernels never touch the pointer.
- Bump the launcher ABI version: the JIT cache is keyed on the template
  kwargs, not the source, and the C signature gained a parameter.

Split out of ROCm#6099; the Gluon PA decode consumer and its tests follow in a
stacked PR.

Signed-off-by: Sergei Shliapnikov <[email protected]>
Signed-off-by: Andrei Kochin <[email protected]>
Co-authored-by: Cursor <[email protected]>
sshlyapn added a commit to andrei-kochin/aiter that referenced this pull request Oct 15, 2026
New optional query_start_loc ([num_seqs + 1], int32) for pa_decode_gluon,
PS path only. Sequence i owns packed query/output rows
[query_start_loc[i], query_start_loc[i + 1]); query_length must be >= every
per-sequence length; rows not owned by any sequence are left untouched.
Non-PS paths assert on it.

- Supported in the gluon head_1 and multi-KV attention kernels and in the
  Triton PS reduce, each behind a compile-time IS_VARLEN flag; the HIP PS
  reduce is used through its query_start_loc argument.
- Causal masks use the per-sequence query length, on top of the per-split
  causal mask from ROCm#5915.
- Fix the default temporary_output dtype: the attention kernels store bf16
  for fp8 compute (otherwise compute_type), not query.dtype. An fp8 query
  with fp8 compute and no temporary_output failed to compile before.
- New test op_tests/triton_tests/test_pa_decode_gluon_varlen.py: each
  sequence of a ragged call must match a batch-1 uniform call, and unowned
  rows must keep a sentinel. Covers bf16, fp8 KV, fp8 Q+KV, sinks, sliding
  window, block 16/64/128 with shuffled V, head_1 and multi-KV, one-shot and
  split runs through the HIP and Triton reduces, and zero-length sequences.

Split out of ROCm#6099, rebased onto main. The FlyDSL reduce part of ROCm#6099 is
dropped: since ROCm#5809 the Gluon path no longer dispatches to the FlyDSL PS
reduce, and the no-work-plan mode it extended no longer exists.

Signed-off-by: Sergei Shliapnikov <[email protected]>
Signed-off-by: Andrei Kochin <[email protected]>
Co-authored-by: Cursor <[email protected]>
sshlyapn added a commit to andrei-kochin/aiter that referenced this pull request Oct 15, 2026
New optional query_start_loc ([num_seqs + 1], int32) for pa_decode_gluon,
PS path only. Sequence i owns packed query/output rows
[query_start_loc[i], query_start_loc[i + 1]); query_length must be >= every
per-sequence length; rows not owned by any sequence are left untouched.
Non-PS paths assert on it.

- Supported in the gluon head_1 and multi-KV attention kernels and in the
  Triton PS reduce, each behind a compile-time IS_VARLEN flag; the HIP PS
  reduce is used through its query_start_loc argument.
- Causal masks use the per-sequence query length, on top of the per-split
  causal mask from ROCm#5915.
- Fix the default temporary_output dtype: the attention kernels store bf16
  for fp8 compute (otherwise compute_type), not query.dtype. An fp8 query
  with fp8 compute and no temporary_output failed to compile before.
- New test op_tests/triton_tests/test_pa_decode_gluon_varlen.py: each
  sequence of a ragged call must match a batch-1 uniform call, and unowned
  rows must keep a sentinel. Covers bf16, fp8 KV, fp8 Q+KV, sinks, sliding
  window, block 16/64/128 with shuffled V, head_1 and multi-KV, one-shot and
  split runs through the HIP and Triton reduces, and zero-length sequences.

Split out of ROCm#6099, rebased onto main. The FlyDSL reduce part of ROCm#6099 is
dropped: since ROCm#5809 the Gluon path no longer dispatches to the FlyDSL PS
reduce, and the no-work-plan mode it extended no longer exists.

Signed-off-by: Sergei Shliapnikov <[email protected]>
Signed-off-by: Andrei Kochin <[email protected]>
Co-authored-by: Cursor <[email protected]>
@sshlyapn sshlyapn closed this Oct 15, 2026
sshlyapn added a commit to andrei-kochin/aiter that referenced this pull request Oct 16, 2026
…n) output

Optional query_start_loc ([num_seqs + 1], int32) for the HIP partitioned-
softmax reduce. With it, the output is packed per token as
[1, num_tokens, num_kv_heads, group, head] and sequence b writes rows
[query_start_loc[b], query_start_loc[b + 1]); rows past a sequence's query
length are not stored.

- The varlen code sits behind the IS_VARLEN template parameter, which is also
  part of the JIT cache key; uniform calls build IS_VARLEN=false and pass
  nullptr, so uniform kernels never touch the pointer.
- Bump the launcher ABI version: the JIT cache is keyed on the template
  kwargs, not the source, and the C signature gained a parameter.

Split out of ROCm#6099; the Gluon PA decode consumer and its tests follow in a
stacked PR.

Signed-off-by: Sergei Shliapnikov <[email protected]>
Signed-off-by: Andrei Kochin <[email protected]>
Co-authored-by: Cursor <[email protected]>
sshlyapn added a commit to andrei-kochin/aiter that referenced this pull request Oct 16, 2026
New optional query_start_loc ([num_seqs + 1], int32) for pa_decode_gluon,
PS path only. Sequence i owns packed query/output rows
[query_start_loc[i], query_start_loc[i + 1]); query_length must be >= every
per-sequence length; rows not owned by any sequence are left untouched.
Non-PS paths assert on it.

- Supported in the gluon head_1 and multi-KV attention kernels and in the
  Triton PS reduce, each behind a compile-time IS_VARLEN flag; the HIP PS
  reduce is used through its query_start_loc argument.
- Causal masks use the per-sequence query length, on top of the per-split
  causal mask from ROCm#5915.
- Fix the default temporary_output dtype: the attention kernels store bf16
  for fp8 compute (otherwise compute_type), not query.dtype. An fp8 query
  with fp8 compute and no temporary_output failed to compile before.
- New test op_tests/triton_tests/test_pa_decode_gluon_varlen.py: each
  sequence of a ragged call must match a batch-1 uniform call, and unowned
  rows must keep a sentinel. Covers bf16, fp8 KV, fp8 Q+KV, sinks, sliding
  window, block 16/64/128 with shuffled V, head_1 and multi-KV, one-shot and
  split runs through the HIP and Triton reduces, and zero-length sequences.

Split out of ROCm#6099, rebased onto main. The FlyDSL reduce part of ROCm#6099 is
dropped: since ROCm#5809 the Gluon path no longer dispatches to the FlyDSL PS
reduce, and the no-work-plan mode it extended no longer exists.

Signed-off-by: Sergei Shliapnikov <[email protected]>
Signed-off-by: Andrei Kochin <[email protected]>
Co-authored-by: Cursor <[email protected]>
sshlyapn added a commit to andrei-kochin/aiter that referenced this pull request Oct 19, 2026
…n) output

Optional query_start_loc ([num_seqs + 1], int32) for the HIP partitioned-
softmax reduce. With it, the output is packed per token as
[1, num_tokens, num_kv_heads, group, head] and sequence b writes rows
[query_start_loc[b], query_start_loc[b + 1]); rows past a sequence's query
length are not stored.

- The varlen code sits behind the IS_VARLEN template parameter, which is also
  part of the JIT cache key; uniform calls build IS_VARLEN=false and pass
  nullptr, so uniform kernels never touch the pointer.
- Bump the launcher ABI version: the JIT cache is keyed on the template
  kwargs, not the source, and the C signature gained a parameter.

Split out of ROCm#6099; the Gluon PA decode consumer and its tests follow in a
stacked PR.

Signed-off-by: Sergei Shliapnikov <[email protected]>
Signed-off-by: Andrei Kochin <[email protected]>
Co-authored-by: Cursor <[email protected]>
sshlyapn added a commit to andrei-kochin/aiter that referenced this pull request Oct 19, 2026
New optional query_start_loc ([num_seqs + 1], int32) for pa_decode_gluon,
PS path only. Sequence i owns packed query/output rows
[query_start_loc[i], query_start_loc[i + 1]); query_length must be >= every
per-sequence length; rows not owned by any sequence are left untouched.
Non-PS paths assert on it.

- Supported in the gluon head_1 and multi-KV attention kernels and in the
  Triton PS reduce, each behind a compile-time IS_VARLEN flag; the HIP PS
  reduce is used through its query_start_loc argument.
- Causal masks use the per-sequence query length, on top of the per-split
  causal mask from ROCm#5915.
- Fix the default temporary_output dtype: the attention kernels store bf16
  for fp8 compute (otherwise compute_type), not query.dtype. An fp8 query
  with fp8 compute and no temporary_output failed to compile before.
- New test op_tests/triton_tests/test_pa_decode_gluon_varlen.py: each
  sequence of a ragged call must match a batch-1 uniform call, and unowned
  rows must keep a sentinel. Covers bf16, fp8 KV, fp8 Q+KV, sinks, sliding
  window, block 16/64/128 with shuffled V, head_1 and multi-KV, one-shot and
  split runs through the HIP and Triton reduces, and zero-length sequences.

Split out of ROCm#6099, rebased onto main. The FlyDSL reduce part of ROCm#6099 is
dropped: since ROCm#5809 the Gluon path no longer dispatches to the FlyDSL PS
reduce, and the no-work-plan mode it extended no longer exists.

Signed-off-by: Sergei Shliapnikov <[email protected]>
Signed-off-by: Andrei Kochin <[email protected]>
Co-authored-by: Cursor <[email protected]>
sshlyapn added a commit to andrei-kochin/aiter that referenced this pull request Oct 19, 2026
…n) output

Optional query_start_loc ([num_seqs + 1], int32) for the HIP partitioned-
softmax reduce. With it, the output is packed per token as
[1, num_tokens, num_kv_heads, group, head] and sequence b writes rows
[query_start_loc[b], query_start_loc[b + 1]); rows past a sequence's query
length are not stored.

- The varlen code sits behind the IS_VARLEN template parameter, which is also
  part of the JIT cache key; uniform calls build IS_VARLEN=false and pass
  nullptr, so uniform kernels never touch the pointer.
- Bump the launcher ABI version: the JIT cache is keyed on the template
  kwargs, not the source, and the C signature gained a parameter.

Split out of ROCm#6099; the Gluon PA decode consumer and its tests follow in a
stacked PR.

Signed-off-by: Sergei Shliapnikov <[email protected]>
Signed-off-by: Andrei Kochin <[email protected]>
Co-authored-by: Cursor <[email protected]>
sshlyapn added a commit to andrei-kochin/aiter that referenced this pull request Oct 19, 2026
New optional query_start_loc ([num_seqs + 1], int32) for pa_decode_gluon,
PS path only. Sequence i owns packed query/output rows
[query_start_loc[i], query_start_loc[i + 1]); query_length must be >= every
per-sequence length; rows not owned by any sequence are left untouched.
Non-PS paths assert on it.

- Supported in the gluon head_1 and multi-KV attention kernels and in the
  Triton PS reduce, each behind a compile-time IS_VARLEN flag; the HIP PS
  reduce is used through its query_start_loc argument.
- Causal masks use the per-sequence query length, on top of the per-split
  causal mask from ROCm#5915.
- Fix the default temporary_output dtype: the attention kernels store bf16
  for fp8 compute (otherwise compute_type), not query.dtype. An fp8 query
  with fp8 compute and no temporary_output failed to compile before.
- New test op_tests/triton_tests/test_pa_decode_gluon_varlen.py: each
  sequence of a ragged call must match a batch-1 uniform call, and unowned
  rows must keep a sentinel. Covers bf16, fp8 KV, fp8 Q+KV, sinks, sliding
  window, block 16/64/128 with shuffled V, head_1 and multi-KV, one-shot and
  split runs through the HIP and Triton reduces, and zero-length sequences.

Split out of ROCm#6099, rebased onto main. The FlyDSL reduce part of ROCm#6099 is
dropped: since ROCm#5809 the Gluon path no longer dispatches to the FlyDSL PS
reduce, and the no-work-plan mode it extended no longer exists.

Signed-off-by: Sergei Shliapnikov <[email protected]>
Signed-off-by: Andrei Kochin <[email protected]>
Co-authored-by: Cursor <[email protected]>
sshlyapn added a commit to andrei-kochin/aiter that referenced this pull request Oct 28, 2026
…n) output

Optional query_start_loc ([num_seqs + 1], int32) for the HIP partitioned-
softmax reduce. With it, the output is packed per token as
[1, num_tokens, num_kv_heads, group, head] and sequence b writes rows
[query_start_loc[b], query_start_loc[b + 1]); rows past a sequence's query
length are not stored.

- The varlen code sits behind the IS_VARLEN template parameter, which is also
  part of the JIT cache key; uniform calls build IS_VARLEN=false and pass
  nullptr, so uniform kernels never touch the pointer.
- Bump the launcher ABI version: the JIT cache is keyed on the template
  kwargs, not the source, and the C signature gained a parameter.

Split out of ROCm#6099; the Gluon PA decode consumer and its tests follow in a
stacked PR.

Signed-off-by: Sergei Shliapnikov <[email protected]>
Signed-off-by: Andrei Kochin <[email protected]>
Co-authored-by: Cursor <[email protected]>
amd-ruitang3 pushed a commit that referenced this pull request Nov 23, 2026
…n) output (#6444)

* [HIP] PA decode PS reduce: optional query_start_loc for ragged (varlen) output

Optional query_start_loc ([num_seqs + 1], int32) for the HIP partitioned-
softmax reduce. With it, the output is packed per token as
[1, num_tokens, num_kv_heads, group, head] and sequence b writes rows
[query_start_loc[b], query_start_loc[b + 1]); rows past a sequence's query
length are not stored.

- The varlen code sits behind the IS_VARLEN template parameter, which is also
  part of the JIT cache key; uniform calls build IS_VARLEN=false and pass
  nullptr, so uniform kernels never touch the pointer.
- Bump the launcher ABI version: the JIT cache is keyed on the template
  kwargs, not the source, and the C signature gained a parameter.

Split out of #6099; the Gluon PA decode consumer and its tests follow in a
stacked PR.

Signed-off-by: Sergei Shliapnikov <[email protected]>
Signed-off-by: Andrei Kochin <[email protected]>
Co-authored-by: Cursor <[email protected]>

* [HIP] Update the OPUS MLA sparse prefill caller to the new PS reduce kernel signature.

Signed-off-by: Sergei Shliapnikov <[email protected]>

---------

Signed-off-by: Sergei Shliapnikov <[email protected]>
Signed-off-by: Andrei Kochin <[email protected]>
Co-authored-by: Sergei Shliapnikov <[email protected]>
Co-authored-by: Cursor <[email protected]>
sshlyapn added a commit to andrei-kochin/aiter that referenced this pull request Nov 24, 2026
New optional query_start_loc ([num_seqs + 1], int32) for pa_decode_gluon,
PS path only. Sequence i owns packed query/output rows
[query_start_loc[i], query_start_loc[i + 1]); query_length must be >= every
per-sequence length; rows not owned by any sequence are left untouched.
Non-PS paths assert on it.

- Supported in the gluon head_1 and multi-KV attention kernels and in the
  Triton PS reduce, each behind a compile-time IS_VARLEN flag; the HIP PS
  reduce is used through its query_start_loc argument.
- Causal masks use the per-sequence query length, on top of the per-split
  causal mask from ROCm#5915.
- Fix the default temporary_output dtype: the attention kernels store bf16
  for fp8 compute (otherwise compute_type), not query.dtype. An fp8 query
  with fp8 compute and no temporary_output failed to compile before.
- New test op_tests/triton_tests/test_pa_decode_gluon_varlen.py: each
  sequence of a ragged call must match a batch-1 uniform call, and unowned
  rows must keep a sentinel. Covers bf16, fp8 KV, fp8 Q+KV, sinks, sliding
  window, block 16/64/128 with shuffled V, head_1 and multi-KV, one-shot and
  split runs through the HIP and Triton reduces, and zero-length sequences.

Split out of ROCm#6099, rebased onto main. The FlyDSL reduce part of ROCm#6099 is
dropped: since ROCm#5809 the Gluon path no longer dispatches to the FlyDSL PS
reduce, and the no-work-plan mode it extended no longer exists.

Signed-off-by: Sergei Shliapnikov <[email protected]>
Signed-off-by: Andrei Kochin <[email protected]>
Co-authored-by: Cursor <[email protected]>
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