Skip to content

[Feature][Core] Prefix checkpoint coordination and same-step pairing in V1 scheduler - #55875

Open
nicholaskh-ai wants to merge 3 commits into
vllm-project:mainfrom
nicholaskh-ai:feat/mamba-checkpoint-scheduler-coordination
Open

nicholaskh-ai wants to merge 3 commits into
vllm-project:mainfrom
nicholaskh-ai:feat/mamba-checkpoint-scheduler-coordination

Conversation

@nicholaskh-ai

@nicholaskh-ai nicholaskh-ai commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

Purpose

Implements RFC #55697.

Part 2 of 3 for Application-Directed Mamba Prefix Checkpointing (depends on PR #55873).

This PR introduces scheduler coordination, checkpoint boundary chunk splitting, and a dependency state machine for hybrid Mamba/GDN models in the V1 engine:

  • Producer Truncation: Enforces prefill chunk splitting exactly at mamba_checkpoint_position so that the recorded state snapshot is anchored precisely at the checkpoint boundary.
  • Unready State Machine: When a Producer is scheduled, its checkpoint block hash is marked unready in BlockPool to prevent concurrent consumers from reading uncomputed states. Consumers arriving while the checkpoint is unready are deferred (waiting_for_mamba_checkpoint = True) and prepended to step_skipped_waiting without blocking unrelated requests.
  • Ready State Wakeup: When the Producer's prefill completes, mark_checkpoint_ready() unlocks the block hash, resuming deferred consumers as normal cache hits.
  • Same-Step Pairing: When a Producer and Consumer arrive in the same scheduling pass, the Consumer inherits the Producer's prefix blocks directly and registers mamba_prefix_producer_id, enabling them to execute in the same engine step.

Duplicate-work Check

Test Plan

  • Unit test for scheduler checkpoint coordination, same-step pairing, and unready-wakeup state machine:
    pytest tests/v1/core/test_mamba_checkpoint_scheduler.py -v
  • Unit test for Mamba aligned chunk splitting at checkpoint stops:
    pytest tests/v1/core/test_mamba_align_chunk_split.py -k "test_internal_checkpoint_split" -v

AI 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

@claude claude Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Claude Code Review

This pull request is from a fork — automated review is disabled. A repository maintainer can comment @claude review to run a one-time review.

@mergify

mergify Bot commented Sep 8, 2026

Copy link
Copy Markdown
Contributor

This pull request has merge conflicts that must be resolved before it can be
merged. Please rebase the PR, @nicholaskh-ai.

https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/syncing-a-fork

@nicholaskh-ai

Copy link
Copy Markdown
Contributor Author

CC @WoosukKwon @yewentao256

Hi reviewers, this is Part 2 of the implementation stack for RFC #55697. It adds scheduler-level checkpoint truncation, same-step Producer/Consumer pairing, and the unready/ready state machine in V1 scheduler.

Whenever you have a moment, we would appreciate your feedback. Thanks!

@nicholaskh-ai
nicholaskh-ai force-pushed the feat/mamba-checkpoint-scheduler-coordination branch from c8db32b to 5e7228e Compare September 9, 2026 12:24
@mergify

mergify Bot commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

This pull request has merge conflicts that must be resolved before it can be
merged. Please rebase the PR, @nicholaskh-ai.

https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/syncing-a-fork

@mergify mergify Bot added the needs-rebase label Sep 9, 2026
@nicholaskh-ai
nicholaskh-ai force-pushed the feat/mamba-checkpoint-scheduler-coordination branch from 5e7228e to 6183fb1 Compare September 9, 2026 12:46
@mergify mergify Bot removed the needs-rebase label Sep 9, 2026
@nicholaskh-ai
nicholaskh-ai force-pushed the feat/mamba-checkpoint-scheduler-coordination branch 2 times, most recently from eba6359 to 297c208 Compare September 9, 2026 16:09

@yewentao256 yewentao256 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the work! Will this apply to MRv2? We will deprecate V1 soon

@nicholaskh-ai

Copy link
Copy Markdown
Contributor Author

Hi @yewentao256, thanks for the review and great question!

Yes, absolutely! Here is the compatibility breakdown across the stack:

…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>
@nicholaskh-ai
nicholaskh-ai force-pushed the feat/mamba-checkpoint-scheduler-coordination branch from 297c208 to a054f9b Compare September 10, 2026 05:52
@nicholaskh-ai

nicholaskh-ai commented Sep 10, 2026

Copy link
Copy Markdown
Contributor Author

Update: We have implemented native MRv2 compatibility in PR #55876!

  1. Full MRv2 Wiring:
    The checkpoint metadata (mamba_prefix_producer_indices, mamba_checkpoint_positions, and mamba_checkpoint_source_block_ids) is now fully wired through vllm/v1/worker/gpu/model_states/mamba_hybrid.py and input_batch.py with passing unit tests (test_prepare_attn_forwards_mamba_checkpoint_metadata).

  2. Feature-Gated Execution:
    To ensure 100% production stability and zero regression as MRv2 undergoes ongoing upstream refactoring, the batched grouped GDN kernel in MRv2 is gated behind VLLM_ENABLE_MRV2_GROUPED_GDN=1 (disabled by default in MRv2).

  3. End-to-End Verification:
    In our standard MRv2 production deployment, PR 1 (input token alignment) + PR 2 (scheduler prefix coordination) achieve 99.97% classification consistency and Pearson correlation > 0.9988 on 3,428 real-world multimodal requests.

The entire 3-PR stack is rebased, clean, conflict-free, and fully verified for both MRv1 and MRv2!

@mergify

mergify Bot commented Sep 11, 2026

Copy link
Copy Markdown
Contributor

This pull request has merge conflicts that must be resolved before it can be
merged. Please rebase the PR, @nicholaskh-ai.

https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/working-with-forks/syncing-a-fork

@mergify mergify Bot added the needs-rebase label Sep 11, 2026
KonnyakuMatcha added a commit to KonnyakuMatcha/vllm-HOT that referenced this pull request Sep 14, 2026
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>
@mergify mergify Bot removed the needs-rebase label Sep 14, 2026
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.

2 participants