Repository navigation
[Triton/Gluon] Allow a strided feature dim in conv_state for single-token conv1d update - #6925
Conversation
…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]>
🏷️ 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 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
…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]>
READY FOR HUMAN REVIEWPR Self-ReviewRevision Author self-review accepted. Readiness report: Author answers
Show the author's self-review answersBehavior and intentValidation and unverified scopePR-specific questionChanged op testsPR state
Copilot findings
Code and op-test hygiene
Required CI
Shadow mode reports what would block but keeps the status successful. Set |
|
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. |
…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]>

vLLM can store the GDN conv state as
(blocks, dim, state_len)(VLLM_SSM_CONV_STATE_LAYOUT=DS). Thenconv_state.stride(-2) == state_len.causal_conv1d_update_single_tokenandfused_reshape_causal_conv1d_update_single_tokenassertconv_state.stride(-2) == 1whenvalidate_data=True. vLLM calls the fused op withvalidate_data=True, so Qwen3.5 decode with the DS layout fails with anAssertionError(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 writeconv_statethrough all three strides, so the assertion is stale. The vLLM referencecausal_conv1d_updatehas no such check.conv/causal_conv1d_update_single_token.py: remove theconv_state.stride(-2) == 1assertion 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) andvalidate_data=True, and compares the output and the full conv state with the existingref_causal_conv1d_update_single_token. The single-token case usesdim=1000withstate_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 afterwidth - 1and the lines that the batch does not use.Validated with
pytest op_tests/triton_tests/conv/test_causal_conv1d_update_single_token.pyon MI355X (gfx950), torch 2.13.0+rocm10.0.0, triton 3.8.0.AssertionError: expect contiguous along feat-dim)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):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_tokenandfused_reshape_causal_conv1d_update_single_tokenno longer assertconv_state.stride(-2) == 1whenvalidate_data=True. The kernels already read and writeconv_statethrough all three strides, so a conv state stored as(blocks, dim, state_len)(vLLMVLLM_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.pyon 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_statefrom 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, sostride(-2) == 1always 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: addstest_causal_conv1d_update_single_token_conv_state_layoutandtest_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.