Feat/pcp qwen36 hybrid - #299
Open
Yopry wants to merge 7 commits into
Open
Conversation
Add vllm_fl/patches/qwen36_pcp.py enabling tensor-parallel + prefill-context-parallel serving of Qwen3.6-style hybrid models (interleaved full-attention + GatedDeltaNet layers) on vLLM 0.20.2: - relax the three hybrid+PCP hard guards (block-size resolve, hybrid KV-cache coordinator, mamba cache-hit) so tp*pcp boots - sequence-split prefill in GPUModelRunner._prepare_inputs - all-gather K/V causal-prefix attention in FlashAttentionImpl - GDN full-sequence island (all-gather + redundant scan) for correct linear-attention state under the split - broadcast last-rank sample_hidden_states for correct sampling Wired into vllm_fl.register(); self-gates on prefill_context_parallel_size > 1, so it is a no-op without PCP. Scope: prefill correctness only (token[0] matches tp=4 baseline). Decode is out of scope (full-attn KV is seq-split, decode KV path not handled). Known limits: tp*pcp>4 crash, generate() teardown stall. Signed-off-by: yopry <yopry@users.noreply.github.com>
…fect in workers The PCP patches were only installed from register() (the platform plugin), which runs during early platform detection -- before vllm.v1.* attention/ model-runner/kv-cache classes are importable. So every patch hit `except ImportError` and silently skipped, meaning FlashAttentionImpl.supports_pcp was never set and the PCP attention-compat guard (cp_utils.check_attention_cp_compatibility) failed with "impl does not support PCP". Re-apply the (idempotent) patches from register_model(), the general-plugins hook, which runs in every worker via load_general_plugins() during init_worker -- after vLLM is fully imported and before the guard runs. Verified: tp=2/pcp=2 prefill matches the tp=4 baseline (271/271). Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Add an "Advanced use" section covering the env vars required to run PCP: VLLM_FL_PREFER_ENABLED=0 (force FlashAttention, since PCP does not support the FlagGems Triton backend yet), GEMS_VENDOR=nvidia (flag_gems device detection), the forward-compat LD_LIBRARY_PATH note for CUDA-13-on-old-driver, plus the --prefill-context-parallel-size flag, VLLM_PCP_DEBUG tracing, and scope/limits. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Removed section on Prefill Context Parallel (PCP) for Qwen3.6 hybrid models, including usage instructions and limitations.
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.
PR Type
New Features
Description
Enables tensor-parallel + Prefill Context Parallel (PCP) serving of Qwen3.6-style hybrid models (interleaved full-attention +
GatedDeltaNet/linear-attention layers, e.g. Qwen3.6-35B-A3B) on an unmodified vLLM 0.20.2, entirely through monkey-patches installed by the plugin.
vLLM 0.20.2 hard-rejects context parallelism (pcp/dcp > 1) for hybrid/mamba KV-cache layouts (multiple block sizes). This PR lifts that restriction
for Qwen3.6 and adds the sequence-splitting + cross-rank gather logic needed to make prefill run correctly under PCP. Every patch self-gates on
prefill_context_parallel_size > 1, so it is a no-op for non-PCP runs.
Scope is prefill correctness (verified: first-token argmax matches the tp=4, pcp=1 baseline). Decode is out of scope in this PR.
Known limitations:
Changes
MambaManager.find_longest_cache_hit) by presenting pcp==1 to block-size accounting; sequence splitting is done separately at the model-runner level.
local segment back out).
Prefill Context Parallel (PCP) for Qwen3.6 hybrid models
The plugin adds Prefill Context Parallel for the Qwen3.6 hybrid architecture
(Gated DeltaNet linear-attention layers + periodic full-attention layers). The
prompt is split across the PCP ranks; full-attention layers all-gather K/V and
run causal attention over the reconstructed sequence, while the GDN /
linear-attention layers run a redundant full-sequence scan so every rank ends
with the correct recurrent state.
Enable it with
--prefill-context-parallel-size N(vllm serve) orprefill_context_parallel_size=N(LLM(...)).Set
VLLM_PCP_DEBUG=1to print per-layer[PCP-DBG]traces (sequence split,K/V all-gather, GDN full-sequence island) for verifying that PCP actually runs.
Scope / limitations
baseline first token, within bf16 rounding).
attention backend does not yet declare
supports_pcp.Testing
128k / 256k) and across all three world-size-4 layouts (tp2pcp2, tp4pcp1, tp1pcp4). Matches the baseline golden token.
not exercise the PCP path. Correctness was verified with standalone scripts as above.
Checklist