Skip to content

Revert "[RL] KV offload on vLLM 0.33: drop the Mooncake no-forward save workaround" (#6389) - #6428

Merged
tianyu-l merged 1 commit into
mainfrom
kv-offload-skipped-waiting
Nov 28, 2026
Merged

tianyu-l merged 1 commit into
mainfrom
kv-offload-skipped-waiting

Conversation

@tianyu-l

@tianyu-l tianyu-l commented Nov 28, 2026 •

Copy link
Copy Markdown
Contributor

Summary (human-written)

Why

RL CPU Unit Tests fail on main since #6389:

FAILED tests/rl/unit_tests/cpu/test_kv_offload_coordination.py::test_terminal_cleanup_preserves_block_identity[FINISHED_ABORTED-True]
AttributeError: 'KVOffloadScheduler' object has no attribute 'skipped_waiting'

#6389 moves the KV offload code to vLLM 0.33.0 and says it depends on #5498 and #5967 (the vLLM 0.33 upgrade, both still open): "land this after them. Until then this PR's CI runs on the pinned nightly, where these changes fail." It landed first, so main runs it on the pinned vllm==1.0.0.dev20261107 (scripts/install_rl_env.sh), where each of its three changes is wrong. Checked against that wheel's source:

#6389 change On the pinned nightly
skipped_waiting -> kv_holding_waiting in KVOffloadScheduler, VLLMSessionKVHolder and tests the nightly has no kv_holding_waiting (blocked requests wait in skipped_waiting): the CPU test fails; the holder reads a queue that is missing under FCFS and never filled under priority; the shared-ID queue replaces a dead attribute
delete the _select_waiting_queue_for_scheduling override (shared-ID tie-break between the waiting and skipped_waiting heads) the nightly still chooses between the two heads, by per-process request ID: TP ranks can pick different requests
delete worker.py's kv_connector_no_forward override and its test the nightly still passes wait_for_save=False (vllm-project/vllm#69805): Mooncake skips finish-time saves scheduled on a step without a forward, silently

What changed

git revert of #6389 (8ab41b4), clean: no later commit touches its files. #6389 can reland on top of the vLLM 0.33 upgrade.

Alternatives considered

  • Renaming the queue back only (this PR's first revision): fixes the test but leaves the other two regressions on main.

Testing

@pytorch-bot pytorch-bot Bot added ciflow/fake-pg Run 1-GPU Fake PG integration tests ciflow/rl labels Nov 28, 2026
@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Nov 28, 2026
@tianyu-l

Copy link
Copy Markdown
Contributor Author

@claude review

@github-actions
github-actions Bot requested a review from pzhan9 November 28, 2026 05:05
@claude

claude Bot commented Nov 28, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @tianyu-l's task in 2m 3s —— View job


Request changes: this PR only undoes #6389's queue rename, so two other vLLM 0.33-only deletions from #6389 stay on main. Revert #6389 instead. Review

@claude claude Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Verdict: Request changes -- #6389 was written for vLLM 0.33.0 and landed before the PRs that move to 0.33 (#5498 and #5967, both still drafts). This PR undoes only the queue rename, so two other parts of #6389 that are wrong on the pinned nightly stay on main.

What this PR does. It renames kv_holding_waiting back to skipped_waiting in the KV offload scheduler, the session KV holder, and their CPU tests. That fixes the CPU test failure and the holder's AttributeError.

Example. Under the priority policy with TP=2, request r waits on a KV load in skipped_waiting, and request r-a sits in waiting with the same priority and arrival time.

  • Before #6389: the _select_waiting_queue_for_scheduling override picked between the two queue heads by shared ID, so both ranks picked r.
  • On main and with this PR: vLLM's own comparison picks the head (the new comment at kv_offload_scheduler.py:125 says vLLM schedules whichever head comes first), and it doesn't use shared IDs. Rank 0 and rank 1 can pick different requests.

Must fix

  1. Gate: revert #6389 instead of partly undoing it. This PR undoes only the rename. Two other deletions from #6389 also depend on 0.33:

    • kv_offload_scheduler.py:125 -- the _select_waiting_queue_for_scheduling override is still gone (details inline). That leaves the TP-divergence problem this PR's own description raises.
    • worker.py -- the TorchTitanGPUModelRunner.kv_connector_no_forward override is still gone, along with its TODO and its unit test in test_mooncake_coordination.py. #6389's own description says the pinned nightly passes wait_for_save=False (vllm-project/vllm#69805), and nothing in the repo references 69805 any more. So on main, Mooncake never submits finish-time saves scheduled on a step without a forward, and nothing reports it.

    The smallest correct change is git revert of #6389 (about +80/-25 lines, all restored code). #6389 then relands on top of #5967. If you keep this PR, it also has to restore those two overrides, the deleted Mooncake test, and the cross-queue assertion in test_priority_ties_use_shared_request_ids.

  2. tests/rl/unit_tests/cpu/test_session_kv_holder.py:423 -- the docstring now makes a claim that is wrong on the nightly (details inline).

  3. Description: "What changed" should say that #6389 landed before #5498/#5967, and which of its 0.33-only changes stay on main. As written, it reads as if a rename fully fixes main.

Questions

  • #6389's test edits also added 0.33-only scheduler state (_kv_fetch_stages, deferred_loads, deferred_waiting, _interval_load_blocks_completed, ...). Does the nightly read any of these? If not, they are dead setup that a revert would also remove.
Details
  • From #6389's description: "Depends on #5498 and #5967 ... land this after them. Until then this PR's CI runs on the pinned nightly, where these changes fail." Both are still open drafts, and scripts/install_rl_env.sh:75 still pins vllm==1.0.0.dev20261107.
  • grep kv_connector_no_forward|_select_waiting_queue_for_scheduling|69805 over the repo finds only tests/rl/unit_tests/gpu/test_kv_offload.py:228,242. The override and its TODO are gone from worker.py.
  • Searches: kv_holding_waiting OR skipped_waiting, kv_offload_scheduler, vLLM 0.33. Related open PRs: #5498 and #5967 (the 0.33 move), #5956 (vLLM 0.34 / runner V2). None of them fixes main in the meantime.
  • skipped_waiting also holds requests blocked on a grammar or streamed input, which don't hold KV blocks. The holder treats them like any other non-load waiter. That matches how things worked before #6389, so it is not a regression.

Not verified: the pinned wheel's scheduler.py source wasn't available here. The claims about queue selection and wait_for_save come from #6389's description and the code it deleted.

Before merge: fill in the human-written summary.

Comment on lines +125 to +127
# Waiting requests blocked on remote KV loads (or a grammar or streamed
# input); vLLM schedules whichever queue's head comes first.
self.skipped_waiting = _SharedIDRequestQueue()

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This comment says vLLM schedules whichever queue's head comes first, but #6389 deleted the _select_waiting_queue_for_scheduling override that broke ties between those two heads by shared ID. That deletion only made sense on 0.33, which drains kv_holding_waiting first. On the pinned nightly, vLLM's own head comparison decides when a waiting head and a skipped_waiting head have equal priority and arrival time, and that comparison is not by shared ID. So TP ranks can still pick different requests, which is the divergence this PR's description warns about. Using _SharedIDRequestQueue only fixes the order inside each queue.

Fix: restore the override as it was before #6389, using min((self.waiting, self.skipped_waiting), key=...) on (priority, arrival_time, shared_request_id). Also restore the cross-queue assertion in test_priority_ties_use_shared_request_ids. Simpler still, revert #6389 outright (see the review body).

def test_a_waiting_turn_gets_room_when_held_sessions_fill_the_pool(manager, queue):
"""Nothing runs, free >= floor, and the waiting turn needs more blocks than are free.
vLLM serves `kv_holding_waiting` first."""
vLLM serves `skipped_waiting` first."""

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The rename turned #6389's 0.33-specific claim ("drains kv_holding_waiting first") into "vLLM serves skipped_waiting first", which is not true on the pinned nightly. It also contradicts the new comment in kv_offload_scheduler.py:125-126, which says the earlier head wins. Before #6389 this docstring read "vLLM serves skipped_waiting first and leaves a refused request there". Restore that wording if it matches the nightly; otherwise describe the head-comparison behavior.

…ve workaround (#6389)"

This reverts commit 8ab41b4. #6389 moves the KV offload code to vLLM 0.33 and says
it depends on #5498 and #5967 (the vLLM 0.33 upgrade, still open); it landed first, so
main runs it on the pinned vllm==1.0.0.dev20261107, where all three of its changes are
wrong:
- the nightly has no Scheduler.kv_holding_waiting (blocked requests wait in
  skipped_waiting), so test_kv_offload_coordination fails in RL CPU Unit Tests,
  VLLMSessionKVHolder reads a missing (FCFS) or never-filled (priority) queue, and
  KVOffloadScheduler's shared-ID queue replaces a dead attribute;
- the nightly still chooses between the waiting and skipped_waiting heads
  (_select_waiting_queue_for_scheduling), whose shared-ID tie-break override was deleted,
  so TP ranks can pick different requests;
- the nightly's kv_connector_no_forward still passes wait_for_save=False
  (vllm-project/vllm#69805), whose override was deleted, so Mooncake skips finish-time
  saves scheduled on a step without a forward.
#6389 can reland on top of the vLLM 0.33 upgrade.
@tianyu-l
tianyu-l force-pushed the kv-offload-skipped-waiting branch from 8d85958 to 6d0fdf5 Compare November 28, 2026 05:20
@tianyu-l tianyu-l changed the title [rl] KV offload: use vLLM's skipped_waiting queue, not the removed kv_holding_waiting Revert "[RL] KV offload on vLLM 0.33: drop the Mooncake no-forward save workaround" (#6389) Nov 28, 2026
@tianyu-l

Copy link
Copy Markdown
Contributor Author

@claude review again

@pytorch-bot pytorch-bot Bot added the ci-no-td label Nov 28, 2026
@claude

claude Bot commented Nov 28, 2026 •

Copy link
Copy Markdown
Contributor

Claude finished @tianyu-l's task in 1m 16s —— View job


Approve: the PR is now an exact revert of #6389, and it resolves every must-fix item from the last review. A maintainer still needs to review. Review

@claude claude Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Verdict: Approve -- this PR is now an exact git revert of #6389. That puts main back on the code that works with the pinned vLLM nightly. #6389 can reland once the vLLM 0.33 upgrade (#5498/#5967) lands.

What this PR does. It restores the code from before #6389 that the pinned vllm==1.0.0.dev20261107 needs:

  • the skipped_waiting queue name in KVOffloadScheduler, VLLMSessionKVHolder and their tests
  • the _select_waiting_queue_for_scheduling override, which breaks ties between the two queue heads by shared ID
  • the Mooncake kv_connector_no_forward override, plus its TODO (vllm-project/vllm#69805) and its CPU test

It also drops the 0.33-only scheduler state that #6389 had added to the tests.

Example. Under the priority policy with TP=2, request r sits in skipped_waiting waiting on a KV load, and r-a sits in waiting with the same priority and arrival time.

  • On main: vLLM compares the two heads using per-process request IDs, so rank 0 and rank 1 can pick different requests.
  • With this PR: the override compares (priority, arrival_time, shared_request_id), so both ranks pick the same request.

Earlier must-fix items

  1. Revert #6389 instead of only undoing the rename: resolved. gh pr diff 6428 is the line-for-line inverse of gh pr diff 6389, across the same 7 files and hunks.
  2. test_session_kv_holder.py:423 docstring: resolved. It has the wording from before #6389 again.
  3. The description should say what was left on main: resolved. The table now covers all three changes from #6389.

The earlier question about the 0.33-only test state (_kv_fetch_stages, deferred_loads, ...) is moot: the revert removes it.

Details
  • At HEAD, grepping for kv_holding_waiting|deferred_waiting|_kv_fetch_stages finds nothing, so no 0.33 names are left. kv_connector_no_forward, _select_waiting_queue_for_scheduling and the vllm-project/vllm#69805 TODO are all back.
  • scripts/install_rl_env.sh:75 still pins vllm==1.0.0.dev20261107.
  • Overlap searches: kv offload vLLM 0.33, plus the files this PR changes. #6287 (draft, MTP spec decode) also edits session_kv_holder.py and worker.py. It will need a trivial rebase, which doesn't block this PR.
  • When #6389 relands, it should land in the same PR as the vLLM 0.33 upgrade, or after it.

Not verified: I didn't have the pinned wheel's scheduler source, so I didn't check its queue-selection and wait_for_save behavior myself. The reasoning rests on the description's source check and on this code working on that pin before #6389.

This touches RL generator code, so a maintainer still needs to review it.

Before merge: fill in the human-written summary.

@tianyu-l
tianyu-l merged commit b3e6a66 into main Nov 28, 2026
28 checks passed
@tianyu-l
tianyu-l deleted the kv-offload-skipped-waiting branch November 28, 2026 08:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci-no-td ciflow/fake-pg Run 1-GPU Fake PG integration tests ciflow/rl CLA Signed This label is managed by the Meta Open Source bot.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants