[Feat][Qwen3.5 Mamba] Prefix caching all-mode + operator state writeback + runtime unblock fixes#8
Closed
lHrHenry233 wants to merge 4 commits intomainfrom
Closed
[Feat][Qwen3.5 Mamba] Prefix caching all-mode + operator state writeback + runtime unblock fixes#8lHrHenry233 wants to merge 4 commits intomainfrom
lHrHenry233 wants to merge 4 commits intomainfrom
Conversation
- add worker patch module for mamba batch memcpy kernel override\n- register patch import in worker patch init to apply override at runtime Signed-off-by: lHrenry <luohairui@luohairuideMacBook-Air.local>
This reverts commit 4e3cbe5.
- support mamba all-mode across config/scheduler/model runner and qwen3.5 patch flow\n- extend causal_conv1d host/kernel to handle 2D token-level cache indices\n- add UT/e2e coverage for prefill/decode all-mode paths and token snapshot writeback Signed-off-by: lHrHenry233 <lHrHenry233@users.noreply.github.com>
- make draft proposer import optional to avoid hard dependency when MTP draft module is absent - remove stale NPUInputBatch argument max_num_blocks_per_req for branch compatibility - cast recurrent state to bf16 before npu_recurrent_gated_delta_rule to satisfy NPU op dtype constraints These fixes are required to keep Qwen3.5-9B prefix-caching perf runs stable and comparable between mamba_cache_mode=align and all. Signed-off-by: lHrHenry233 <lHrHenry233@users.noreply.github.com>
|
👋 Hi! Thank you for contributing to the vLLM Ascend project. The following points will speed up your PR merge:
If CI fails, you can run linting and testing checks locally according Contributing and Testing. |
|
This pull request has conflicts, please resolve those before we can evaluate the pull request. |
lHrHenry233
pushed a commit
that referenced
this pull request
Apr 10, 2026
…(v3.1) - Port upstream _causal_conv1d_fwd_kernel as NPU Triton kernel - Handles initial/final/intermediate conv state in-kernel - Supports APC block boundary state writes - NPU adaptations: removed .cache_modifier, kept debug_barrier - Rewrite causal_conv1d_fn to dispatch to new Triton kernel - Rewrite gdn.py conv1d path: split decode/prefill like upstream - Decode: causal_conv1d_update_npu with block params - Prefill: causal_conv1d_fn with APC params (new kernel) - Fix SSM #6: _build_initial_state only zeros prefill sequences - Fix SSM #7: _write_final_states adds slot >= 0 validation - Fix SSM #8: _scatter_intermediate_states adds unaligned offset - Update all 36 UTs to pass with new num_computed_tokens_all field Alignment status vs upstream #26807: #1 conv1d prefill kernel: FIXED (kernel ported) #3 causal_conv1d_fn params: FIXED (rewritten) #4 intermediate conv state: FIXED (kernel internal) #6 SSM zeroing scope: FIXED #7 _write_final_states guard: FIXED #8 SSM scatter alignment: FIXED #9 causal_conv1d_fn signature: FIXED #2 decode pre-copy: KEEP (NPU needs it) #5 SSM decode index: OK (correct approach) #10 conv layout hardcoded: DEFERRED Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What this PR does / why we need it?
This PR contains the full difference from
mainfor the Qwen3.5 Mamba prefix-caching workstream, including:mamba_cache_mode=allThe goal is to make
allmode actually executable and verifiable end-to-end on Ascend, not only at config level but down to operator state handling.Scope (main -> this branch)
Commits in this PR
feat: add qwen3.5 all-mode prefix caching and token-state writebackfix(qwen3.5): unblock 9b perf validation in align/all modesChanged files
csrc/causal_conv1d/op_host/causal_conv1d_tiling.cppcsrc/causal_conv1d/op_host/causal_conv1d_tiling.hcsrc/causal_conv1d/op_kernel/causal_conv1d.htests/e2e/nightly/single_node/ops/singlecard_ops/triton/test_causal_conv1d.pytests/ut/core/test_recompute_scheduler.pytests/ut/patch/platform/test_patch_mamba_config.pytests/ut/patch/worker/patch_common/test_patch_qwen3_5.pyvllm_ascend/core/recompute_scheduler.pyvllm_ascend/patch/platform/patch_mamba_config.pyvllm_ascend/patch/worker/patch_qwen3_5.pyvllm_ascend/patch/worker/patch_qwen3_next.pyvllm_ascend/worker/model_runner_v1.pyDetailed design and motivation
1) Prefix caching all-mode integration across scheduler/platform/worker
2) Operator-level token/state writeback support (causal_conv1d)
3) Runtime unblock fixes from real service validation
3.1 Optional draft proposer import
vllm_ascend/worker/model_runner_v1.pydraft_proposermodule gracefully using optional import and dynamic type tuple checks.3.2 Remove stale
NPUInputBatchargumentvllm_ascend/worker/model_runner_v1.pymax_num_blocks_per_reqfrom constructor call to match branch signature.TypeErrorcaused by branch API mismatch.3.3 Enforce BF16 recurrent state
vllm_ascend/patch/worker/patch_qwen3_next.pystateto BF16 beforetorch_npu.npu_recurrent_gated_delta_rulein both spec/non-spec paths.Testing and validation
Added/updated tests in this PR
tests/ut/core/test_recompute_scheduler.pytests/ut/patch/platform/test_patch_mamba_config.pytests/ut/patch/worker/patch_common/test_patch_qwen3_5.pytests/e2e/nightly/single_node/ops/singlecard_ops/triton/test_causal_conv1d.pyRuntime validation performed
Qwen/Qwen3.5-9Bmamba_cache_mode=alignvsall/v1/completionssucceed after fixes.allis better thanalignin this environment.Does this PR introduce any user-facing change?
Yes.
Risk assessment
Changes include scheduler + worker + operator surfaces, but are covered by targeted UT/E2E additions.
Runtime unblock fixes are minimal and localized to compatibility/dtype enforcement.
vLLM version: v0.16.0
vLLM main: vllm-project/vllm@4034c3d