Repository navigation
[HIP] PA decode PS reduce: optional query_start_loc for ragged (varlen) output - #6444
Conversation
🏷️ CI GuideRuns automatically on every PR:
Extended tests (opt-in via labels):
One backend per PR: PR title tags & labels: |
There was a problem hiding this comment.
🟡 Changes recommended
The signature change breaks an existing gfx950 caller, input layout validation is incomplete, and the new path lacks standalone coverage.
3 open findings
What changed in this PR
Adds ragged-query output support to the HIP paged-attention partition reducer.
Changes:
- Adds optional
query_start_locdispatch and JIT specialization. - Packs variable-length sequence outputs by token.
- Updates the launcher ABI and kernel signature.
| File | Description |
|---|---|
csrc/cpp_itfs/pa/pa_ps.py |
Exposes ragged reduction and updates JIT caching. |
csrc/cpp_itfs/pa/pa_ps.cuh |
Implements packed-row addressing. |
csrc/cpp_itfs/pa/pa_ps.cpp.jinja |
Threads the new pointer and template flag into HIP. |
🧠 Review effort: Balanced
💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
e01d3e7 to
6562bac
Compare
6562bac to
dd912eb
Compare
|
@zufayu @amd-ruitang3 could you please take a look at this PR? |
…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]>
…kernel signature. Signed-off-by: Sergei Shliapnikov <[email protected]>
dd912eb to
4b06630
Compare
There was a problem hiding this comment.
🔵 Needs a closer look
The HIP launcher ABI and device-side indexing changes still need exact-head GPU compilation and execution on supported AMD targets for uniform, ragged, and zero-length cases, which this review environment could not validate.
3 open issues
Review effort: Balanced
|
No activity for 15 days, so this is now labelled |
|
LGTM |



Motivation
Part 1 of 2 split out of #6099 (author: @sshlyapn), so each PR changes one backend.
pa_decode_gluonneeds the samequery_lengthfor every sequence, so it can't take a decode batch with mixed lengths (e.g. speculative decodes next to plain decodes, as vLLM'sROCM_AITER_FAbackend sends with shuffled KV). The follow-up Gluon PR adds ragged (varlen) input; this PR adds the matching support to the HIP PS reduce it dispatches to.Changes
query_start_loc([num_seqs + 1], int32) forcsrc/cpp_itfs/pa/pa_ps.py::launch_pa_decode_ps_reduce. With it, the output is packed per token as[1, num_tokens, num_kv_heads, group, head](stride_output_bsunused), sequencebwrites rows[query_start_loc[b], query_start_loc[b + 1]), and rows past a sequence's query length are not stored (the whole block exits together, since the check depends onblockIdxonly).IS_VARLENtemplate parameter, which is also part of the HIP JIT cache key._LAUNCHER_ABI_VERSIONis bumped: the JIT build cache is keyed on the template kwargs, not the source, and the launcher's C signature gained a parameter.Uniform path impact
query_start_loc_ptris only read underif constexpr(IS_VARLEN). Uniform calls build theIS_VARLEN=falseinstance and passnullptr, so uniform kernels never touch it. Existing callers don't passquery_start_loc, so behaviour onmainis unchanged.Related PRs
main).Tests
These three files are byte-identical to #6099. The varlen HIP reduce is exercised by
op_tests/triton_tests/test_pa_decode_gluon_varlen.pyin the stacked Gluon PR (split runs with 8 and 4 partitions forced onto the HIP reduce).