Skip to content

[Triton/Gluon] Allow a strided feature dim in conv_state for single-token conv1d update - #6925

Merged
zufayu merged 3 commits into
ROCm:mainfrom
AndreasKaratzas:akaratza_conv1d_strided_state
Nov 3, 2026
Merged

zufayu merged 3 commits into
ROCm:mainfrom
AndreasKaratzas:akaratza_conv1d_strided_state

Conversation

@AndreasKaratzas

@AndreasKaratzas AndreasKaratzas commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

vLLM can store the GDN conv state as (blocks, dim, state_len) (VLLM_SSM_CONV_STATE_LAYOUT=DS). Then conv_state.stride(-2) == state_len. causal_conv1d_update_single_token and fused_reshape_causal_conv1d_update_single_token assert conv_state.stride(-2) == 1 when validate_data=True. vLLM calls the fused op with validate_data=True, so Qwen3.5 decode with the DS layout fails with an AssertionError (vLLM AMD CI, "Hybrid SSM NixlConnector PD accuracy"). Until this lands, vllm-project/vllm#63558 (open) proposes to turn off this AITER fast path for DS. The kernels read and write conv_state through all three strides, so the assertion is stale. The vLLM reference causal_conv1d_update has no such check.

  • conv/causal_conv1d_update_single_token.py: remove the conv_state.stride(-2) == 1 assertion in both wrappers. The kernels do not change.
  • test_causal_conv1d_update_single_token.py: add one test per wrapper. Each runs with an SD and a DS conv state (padded page views, as in the vLLM cache) and validate_data=True, and compares the output and the full conv state with the existing ref_causal_conv1d_update_single_token. The single-token case uses dim=1000 with state_len > width - 1, the fused case the small interleaved-qkvz head config; both have a pad slot. The conv state must match exactly, also the columns after width - 1 and the lines that the batch does not use.

Validated with pytest op_tests/triton_tests/conv/test_causal_conv1d_update_single_token.py on MI355X (gfx950), torch 2.13.0+rocm10.0.0, triton 3.8.0.

origin/main this PR
new tests, SD conv state 2 passed 2 passed
new tests, DS conv state 2 failed (AssertionError: expect contiguous along feat-dim) 2 passed
whole file (26 tests) - 26 passed, 10 of 10 runs

Kernel time is not changed by this PR. For reference, the DS layout on Qwen3.5-0.8B decode shapes on MI350X (validate_data=False, CUDA graph of 100 calls, median of 7 replays, mean of 2 runs, microseconds per call):

batch fused conv SD fused conv DS conv + GDR SD conv + GDR DS
1 2.43 2.58 6.02 6.14
16 2.80 3.03 10.38 10.60
64 4.52 5.56 27.73 28.66
256 11.70 16.12 98.00 101.51
512 20.98 28.92 239.60 245.82

At each batch size above, the DS output and the DS conv state are bit-identical to SD.

AI assistance (Claude Code) was used to draft this change. Every line was reviewed by the submitter.

PR Self-Review

Reviewed revision

9b9cdc1

Behavior and intent

causal_conv1d_update_single_token and fused_reshape_causal_conv1d_update_single_token no longer assert conv_state.stride(-2) == 1 when validate_data=True. The kernels already read and write conv_state through all three strides, so a conv state stored as (blocks, dim, state_len) (vLLM VLLM_SSM_CONV_STATE_LAYOUT=DS) is handled correctly; only the stale assertion rejected it, which breaks Qwen3.5 decode in vLLM with that layout. Kernel code and the SD path are unchanged.

Validation and unverified scope

pytest op_tests/triton_tests/conv/test_causal_conv1d_update_single_token.py on MI355X (gfx950), torch 2.13.0+rocm10.0.0, triton 3.8.0: 26 passed in 10 of 10 runs. On origin/main the two new DS cases fail with the removed assertion and the two SD cases pass. Earlier timing on MI350X (table above) showed DS output and conv state bit-identical to SD on Qwen3.5-0.8B decode shapes. Unverified: gfx942, fp16/fp32 conv states with the DS layout (the kernels share the stride arithmetic across dtypes), and the end-to-end vLLM CI job, which needs vLLM to call this path with the DS layout.

PR-specific question

Before this PR, the DS parametrization of both new tests fails with AssertionError: expect contiguous along feat-dim of conv_state from the wrapper; the SD parametrization passes and pins the existing behavior on the same padded page view. No existing test covers this: every existing case in the file builds a feature-contiguous conv state, so stride(-2) == 1 always held and the assertion was never exercised with another layout.

Changed op tests

op_tests/triton_tests/conv/test_causal_conv1d_update_single_token.py: adds test_causal_conv1d_update_single_token_conv_state_layout and test_fused_reshape_causal_conv1d_update_single_token_conv_state_layout, 2 cases each (SD and DS conv state on a padded page view, validate_data=True, pad slot, exact conv-state check including untouched columns and lines). They are the only tests with a non-feature-contiguous conv state, one per public wrapper, so they are not redundant with the existing shape and dtype sweeps.

…onv1d update

causal_conv1d_update_single_token and
fused_reshape_causal_conv1d_update_single_token asserted
conv_state.stride(-2) == 1 when validate_data=True. The kernels read and
write conv_state through all three strides, so a (lines, dim, state_len)
cache with stride(-2) == state_len (vLLM VLLM_SSM_CONV_STATE_LAYOUT=DS)
is correct but failed the assertion. Remove the assertion, as in the vLLM
causal_conv1d_update reference, and test both layouts against a torch
reference.

Co-Authored-By: Claude <[email protected]>
Signed-off-by: Andreas Karatzas <[email protected]>
@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 (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
ci:windows Windows JIT op smoke test on the gfx1201 ROCm runner
ci:multi-gpu 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: DeepSeek-V4-Pro, MiniMax-M3-MXFP4
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 6925 --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.

@AndreasKaratzas
AndreasKaratzas marked this pull request as ready for review October 26, 2026 01:43
@AndreasKaratzas
AndreasKaratzas requested a review from a team October 26, 2026 01:43
@github-actions github-actions Bot changed the title [Triton] Allow a strided feature dim in conv_state for single-token conv1d update [Triton/Gluon] Allow a strided feature dim in conv_state for single-token conv1d update Oct 26, 2026
@Boss2002n
Boss2002n requested a balanced review from Copilot October 26, 2026 05:33

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.

🟡 Changes recommended

The new convolution reference must be consolidated with the existing helper to satisfy the repository’s reuse requirement.

1 open issue
What changed in this PR

This PR allows single-token convolution updates to accept vLLM’s DS conv-state layout with validation enabled, without changing the kernels.

Changes:

  • Remove the feature-dimension stride assertion from both wrappers.
  • Add SD and DS layout tests covering padded views, pad slots, larger state buffers, and flat or interleaved qkvz inputs.
  • Check outputs against a PyTorch reference and verify the full conv state exactly.
File Description
op_tests/​triton_tests/​conv/​test_causal_conv1d_update_single_token.py Add layout regression tests for both wrappers.
aiter/​ops/​triton/​conv/​causal_conv1d_update_single_token.py Remove both restrictive conv-state stride assertions.

Review effort: Balanced

@zufayu
zufayu requested review from a team and Boss2002n October 27, 2026 01:14
@azaidy azaidy assigned vgokhale and unassigned Boss2002n Oct 27, 2026
@azaidy
azaidy requested a review from vgokhale October 27, 2026 14:33
@azaidy azaidy assigned azaidy and unassigned vgokhale Oct 29, 2026
…ange affects

Keep one shape per kernel and run it with both conv_state layouts: the
feature-contiguous one that was already supported and the state-contiguous
one this change allows. Reuse ref_causal_conv1d_update_single_token instead
of a second reference. 56 parametrized cases become 4.

Co-Authored-By: Claude <[email protected]>
Signed-off-by: Andreas Karatzas <[email protected]>
@aiter-bot

aiter-bot commented Oct 29, 2026 •

Copy link
Copy Markdown

READY FOR HUMAN REVIEW

PR Self-Review

Revision 9b9cdc13e277 · mode shadow

Author self-review accepted. Readiness report:

Author answers

  • PASS — current-SHA answers are present and structurally specific
Show the author's self-review answers

Behavior and intent

`causal_conv1d_update_single_token` and `fused_reshape_causal_conv1d_update_single_token` no longer assert `conv_state.stride(-2) == 1` when `validate_data=True`. The kernels already read and write `conv_state` through all three strides, so a conv state stored as `(blocks, dim, state_len)` (vLLM `VLLM_SSM_CONV_STATE_LAYOUT=DS`) is handled correctly; only the stale assertion rejected it, which breaks Qwen3.5 decode in vLLM with that layout. Kernel code and the SD path are unchanged.

Validation and unverified scope

`pytest op_tests/triton_tests/conv/test_causal_conv1d_update_single_token.py` on MI355X (gfx950), torch 2.13.0+rocm10.0.0, triton 3.8.0: 26 passed in 10 of 10 runs. On origin/main the two new DS cases fail with the removed assertion and the two SD cases pass. Earlier timing on MI350X (table above) showed DS output and conv state bit-identical to SD on Qwen3.5-0.8B decode shapes. Unverified: gfx942, fp16/fp32 conv states with the DS layout (the kernels share the stride arithmetic across dtypes), and the end-to-end vLLM CI job, which needs vLLM to call this path with the DS layout.

PR-specific question

Before this PR, the DS parametrization of both new tests fails with `AssertionError: expect contiguous along feat-dim of conv_state` from the wrapper; the SD parametrization passes and pins the existing behavior on the same padded page view. No existing test covers this: every existing case in the file builds a feature-contiguous conv state, so `stride(-2) == 1` always held and the assertion was never exercised with another layout.

Changed op tests

`op_tests/triton_tests/conv/test_causal_conv1d_update_single_token.py`: adds `test_causal_conv1d_update_single_token_conv_state_layout` and `test_fused_reshape_causal_conv1d_update_single_token_conv_state_layout`, 2 cases each (SD and DS conv state on a padded page view, `validate_data=True`, pad slot, exact conv-state check including untouched columns and lines). They are the only tests with a non-feature-contiguous conv state, one per public wrapper, so they are not redundant with the existing shape and dtype sweeps.

PR state

  • PASS — pull request is marked ready for review

Copilot findings

  • PASS — no active Copilot finding lacks a substantive author reply
  • ADVISORY — Copilot did not review the current head SHA

Code and op-test hygiene

  • PASS — no committed artifact or conflict marker detected

Required CI

  • PASS — Black: passed
  • PASS — Ruff: passed
  • PASS — Repository dependency: passed
  • PASS — Aiter Test Gate: passed

Shadow mode reports what would block but keeps the status successful. Set AITER_PR_SELF_REVIEW_MODE=enforce only after reviewing real false positives.

@AndreasKaratzas

Copy link
Copy Markdown
Contributor Author

Trimmed to 4 cases: both conv_state layouts on one shape per kernel, reusing the existing reference (also addresses the duplicate-reference comment). The new state-contiguous cases still fail on main without this change.

@zufayu
zufayu merged commit fa0100e into ROCm:main Nov 3, 2026
59 checks passed
@AndreasKaratzas
AndreasKaratzas deleted the akaratza_conv1d_strided_state branch November 3, 2026 05:13
shantipriya-amd pushed a commit to shantipriya-amd/aiter that referenced this pull request Nov 18, 2026
…oken conv1d update (ROCm#6925)

* [Triton] Allow a strided feature dim in conv_state for single-token conv1d update

causal_conv1d_update_single_token and
fused_reshape_causal_conv1d_update_single_token asserted
conv_state.stride(-2) == 1 when validate_data=True. The kernels read and
write conv_state through all three strides, so a (lines, dim, state_len)
cache with stride(-2) == state_len (vLLM VLLM_SSM_CONV_STATE_LAYOUT=DS)
is correct but failed the assertion. Remove the assertion, as in the vLLM
causal_conv1d_update reference, and test both layouts against a torch
reference.

Co-Authored-By: Claude <[email protected]>
Signed-off-by: Andreas Karatzas <[email protected]>

* [Triton/Gluon] Trim the conv_state layout tests to the layouts the change affects

Keep one shape per kernel and run it with both conv_state layouts: the
feature-contiguous one that was already supported and the state-contiguous
one this change allows. Reuse ref_causal_conv1d_update_single_token instead
of a second reference. 56 parametrized cases become 4.

Co-Authored-By: Claude <[email protected]>
Signed-off-by: Andreas Karatzas <[email protected]>

---------

Signed-off-by: Andreas Karatzas <[email protected]>
Co-authored-by: Claude <[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.

7 participants