Skip to content

[Fix] mem_cache: Skip Mamba checkpoint donation when slots are exhausted - #47680

Merged
BBuf merged 11 commits into
sgl-project:mainfrom
yihong-w:codex/mamba-donation-exhaustion
Nov 2, 2026
Merged

BBuf merged 11 commits into
sgl-project:mainfrom
yihong-w:codex/mamba-donation-exhaustion

Conversation

@yihong-w

@yihong-w yihong-w commented Oct 31, 2026 •

Copy link
Copy Markdown
Contributor

Motivation

Fixes #43204. When all Mamba state slots are held by active requests or locked prefixes, optional checkpoint donation can exhaust the pool and terminate the scheduler.

Modifications

  • Skip unfinished-request checkpoint donation when allocation remains unavailable after eviction.
  • Keep strict failure for slots required by active request state or load-back.
  • Extend CPU regression coverage to all three allocation-based checkpoint paths, successful allocation, and strict required allocation.

Accuracy Tests

  • Seven local behavioral cases against the edited methods passed using a simulated slot pool.
  • The registered unit test could not collect on macOS because the SGLang import requires Triton. Linux CI is still needed to validate it in the repository environment.

Speed Tests and Profiling

Not run; this changes the exhausted-pool fallback and does not change the successful allocation path's work.

Checklist

  • Format and targeted lint checks passed for both changed files.
  • Added focused regression tests in the registered CPU suite, using CustomTestCase.
  • Reviewed documentation impact; no user-facing API or configuration changed.
  • Registered CPU test and required CI checks pass. Requires an authorized user to apply run-ci and trigger a run.

CI States

Latest PR Test (Base): ✅ Run #41350364239
Latest PR Test (Extra): ❌ Run #41350364311
Latest PR Test (AMD ROCm 10): ❌ Run #41350364273

Tip

Base CI only covers the core cases, and its workload may not exercise your change. Use /rerun-test to run the tests your change touches, or copy this prompt for an agent:

Find the registered tests this PR affects and run them with /rerun-test, following https://github.com/sgl-project/sglang/blob/main/.agents/skills/rerun-test/SKILL.md

@yihong-w
yihong-w requested a review from merrymercy as a code owner October 31, 2026 19:25

@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.

@github-actions

This comment has been minimized.

@yihong-w yihong-w changed the title Fix Mamba checkpoint donation when state pool is exhausted [Fix] mem_cache: Skip Mamba checkpoint donation when slots are exhausted Oct 31, 2026

@BBuf BBuf left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

[BBuf Review Agent] LGTM. Please wait for the related cache CI.

@BBuf

BBuf commented Nov 1, 2026

Copy link
Copy Markdown
Collaborator

/tag-and-rerun-ci

@github-actions github-actions Bot added the run-ci CI: run the baseline test suite on this PR label Nov 1, 2026
@BBuf

BBuf commented Nov 1, 2026

Copy link
Copy Markdown
Collaborator

[BBuf Review Agent] @yihong-w these CI failures look related to this change, could you take a look?

  • base-a-test-cpu (7): AttributeError: 'MambaComponent' object has no attribute 'host_only_checkpoint'. Did you mean: '_mamba_host_only_checkpoint'?" The traceback originates in the newly added test_unfinished_checkpoint_sk

@github-actions

This comment has been minimized.

@yihong-w

yihong-w commented Nov 1, 2026

Copy link
Copy Markdown
Contributor Author

/rerun-failed-ci

@yihong-w

yihong-w commented Nov 1, 2026

Copy link
Copy Markdown
Contributor Author

/rerun-failed-ci

yihong-w commented Nov 1, 2026

Copy link
Copy Markdown
Contributor Author

/rerun-test --changed registered/radix_cache/unified_radix_tree/test_unified_radix_cache_kl_mamba.py::TestUnifiedMambaRadixCache registered/radix_cache/test_int8_mamba_checkpoint_e2e.py::TestInt8MambaCheckpointE2E registered/radix_cache/test_mamba_cache_kl.py::TestMambaLazyInplaceKL.test_lazy_donation_with_four_slots_and_one_request

@github-actions

github-actions Bot commented Nov 1, 2026

Copy link
Copy Markdown
Contributor

⛔ /rerun-test requires cooldown_interval_minutes: 0 in .github/CI_PERMISSIONS.json, or write permission on the repo.

Please ask a maintainer to run this command, or use the normal CI flow.

yihong-w commented Nov 1, 2026

Copy link
Copy Markdown
Contributor Author

/rerun-failed-ci

@BBuf BBuf left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

[BBuf Review Agent] LGTM. Please wait for the related cache CI.

@BBuf

BBuf commented Nov 2, 2026

Copy link
Copy Markdown
Collaborator

/rerun-test test/registered/radix_cache/unified_radix_tree/test_unified_radix_cache_kl_mamba.py

@github-actions

github-actions Bot commented Nov 2, 2026 •

Copy link
Copy Markdown
Contributor

🚀 4-gpu-h100 (1 test): ✅ View workflow run

cd test/ && python3 registered/radix_cache/unified_radix_tree/test_unified_radix_cache_kl_mamba.py

@BBuf
BBuf merged commit 96b5d05 into sgl-project:main Nov 2, 2026
166 of 173 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

run-ci CI: run the baseline test suite on this PR unified-radix-cache

Projects

None yet

Development

Successfully merging this pull request may close these issues.

AssertionError: Can not alloc mamba cache kills the engine when every cached mamba state is locked

2 participants