[Feature][Mamba] Batched two-phase grouped prefill execution for hybrid GDN/Mamba (+7.58x) - #55876
nicholaskh-ai wants to merge 4 commits into
Conversation
|
This pull request has merge conflicts that must be resolved before it can be |
|
This pull request has merge conflicts that must be resolved before it can be |
|
CC @mgoin @jeejeelee Hi reviewers, this is Part 3 of the implementation stack for RFC #55697. It implements the batched two-phase grouped prefill execution in the GDN layer, cutting kernel launch overhead and delivering up to 7.58x speedup on NVIDIA L40S. Whenever you have a moment, we would love your review and feedback. Thanks! |
35ba5d9 to
9b0301e
Compare
|
This pull request has merge conflicts that must be resolved before it can be |
9b0301e to
2f53460
Compare
b85dd45 to
24bff32
Compare
|
This pull request has merge conflicts that must be resolved before it can be |
24bff32 to
a25a2fa
Compare
…rker and input processing - Add --enable-mamba-checkpoint and --mamba-checkpoint-token CLI & engine options - Register <|mamba_checkpoint|> token into tokenizer dynamically in HF renderer - Parse and strip mamba checkpoint token in InputProcessor with offset adjustments - Add unit tests for HF renderer and InputProcessor token extraction Co-authored-by: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com> Signed-off-by: nizhang1 <nizhang1@coupang.com>
…1 scheduler - Truncate Producer prefill chunks at mamba checkpoint boundary - Support same-step Producer/Consumer pairing and prefix block inheritance - Implement unready checkpoint locking in BlockPool and deferral in scheduler - Add ready state wakeup on step completion - Add unit tests for scheduler checkpoint coordination and chunk splitting Co-authored-by: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com> Signed-off-by: nizhang1 <nizhang1@coupang.com>
a25a2fa to
c6463cd
Compare
…DN/Mamba - Implement batched producer and consumer phases in GDN attention layer - Add grouped prefill metadata builder packing prefix ranges and state destinations - Add native MRv2 (ModelRunnerV2) and MRv1 compatibility for grouped checkpoint metadata - Add graceful fallback for mixed batches and add MRv2 MambaHybridModelState unit tests - Add kernel split verification tests and benchmark demonstrating up to 7.6x speedup Co-authored-by: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com> Signed-off-by: nizhang1 <nizhang1@coupang.com>
c6463cd to
e9d21b1
Compare
|
This pull request has merge conflicts that must be resolved before it can be |
Document the exact single-session HOT design, relationship to existing Mamba prefix-cache work (vllm-project#55697/vllm-project#55873/vllm-project#55875/vllm-project#55876, vllm-project#52959, vllm-project#45702), TTFT evaluation, correctness status, and async-scheduling limitations. Co-authored-by: OpenAI Codex <codex@openai.com> Signed-off-by: KonnyakuLC <1690982212@qq.com>
Signed-off-by: nicholaskh-ai <15652918035@163.com>
Purpose
Implements RFC #55697.
Part 3 of 3 for Application-Directed Mamba Prefix Checkpointing (depends on PR #55873 and PR #55875).
In hybrid GDN/Mamba models (such as Qwen3.5 35B-A3B), prefill batches containing shared prefixes (1 common Producer prompt + N distinct Consumer queries) previously required either sequential per-request execution or full prompt recomputation due to state recurrence.
This PR introduces batched two-phase grouped prefill execution in the worker and GDN layer:
index_select), copy them to private destination slots (index_copy_), and compute suffixes concurrently in a second packed kernel invocation.prefix_producer_ranges,consumer_ranges,consumer_shared_state_sources, andprivate_final_state_destinationto dispatch requests into packed phases.Microbenchmark Results (NVIDIA L40S, PyTorch 2.11.0+cu130)
Measured on an NVIDIA L40S GPU using
benchmarks/kernels/benchmark_grouped_gdn_prefill.py:Performance Highlights:
Duplicate-work Check
Test Plan
pytest tests/kernels/mamba/test_gdn_forward_core_split.py -vpytest tests/v1/attention/test_gdn_metadata_builder.py -k "test_grouped_metadata" -vpytest tests/kernels/mamba/cpu/test_cpu_gdn_ops.py -vpython -m benchmarks.kernels.benchmark_grouped_gdn_prefill --num-producers 1 --num-consumers 1 2 4 8 16AI assistance was used to prepare this change. The human submitter is responsible for reviewing the changed code and test results.
Generated with Devin
Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
Signed-off-by: nizhang1 nizhang1@coupang.com