Skip to content

[Fix] hicache: Report a deadline-cut storage prefetch separately and keep its storage beliefs - #44338

Closed
metamergebot wants to merge 1 commit into
mainfrom
oss-sync-315fcdc573
Closed

metamergebot wants to merge 1 commit into
mainfrom
oss-sync-315fcdc573

Conversation

@metamergebot

@metamergebot metamergebot commented Oct 14, 2026 •

Copy link
Copy Markdown
Collaborator

Motivation

A storage prefetch that the stop policy ends before the read completes is not a storage shortfall: the span is still in the store, and the hit count the query agreed on may be a MIN over lookups that were skipped rather than a verdict about what is stored. A partial hybrid transfer is nevertheless resolved as storage_transfer, which heals the storage-existence beliefs beyond the completed span, so the next insert re-writes pages the store already holds and lookups skip them until it does.

Modifications

  • PrefetchOperation.deadline_expired marks an operation whose read was ended by the stop policy. _handle_prefetch_result then reports the unfulfilled tokens under a new deadline reason and leaves the KV and auxiliary-pool beliefs untouched; _invalidate_absent_from_hit_query skips such a cut query. The flag is set by a cache or controller implementation that cancels an in-flight read under its stop policy; the in-tree timeout check in check_prefetch_progress keeps its current handling in this PR.
  • storage_prefetch_unfulfilled_tokens gains the deadline reason label, pre-registered like the others.
  • PrefillAdder finishes storage-prefetch admission for a retracted request (with reason=None, so nothing is logged) after discarding its accounting, so a cache implementation that keeps per-request admission state sees the same lifecycle end as every other admitted request. In the base cache this call is a no-op for that request because its accounting was already discarded. test_prefill_adder.py asserts the call.
  • The buffer-mode hit-drain fixture in test_storage_prefetch_lifecycle.py gains deadline_expired=False, since the drain now reads it.

Accuracy Tests

Not applicable: no change to model outputs.

Speed Tests and Profiling

Not applicable: the change only affects how a cut prefetch is attributed and whether its storage beliefs are healed.

Unit tests run locally on this head:

  • test/registered/unit/managers/test_prefill_adder.py: 52 passed, 49 subtests passed
  • test_storage_prefetch_lifecycle.py + test_hicache_pp_sync_drain.py: 14 passed, 10 subtests passed
  • test_buffer_mode_sidecar.py, test_unified_hicache_transfer_lifecycle.py, test_pp_prefetch_ticket.py, test_unified_radix_cache_unittest.py: 1370 passed, 1555 skipped (no GPU-dependent cases run); the 5 failures seen locally (TestSwaLoadBackReservation, TestLoadBackAdmission, TestWritePolicySwitch, test_ledgers_count_reclaimable_tokens) fail identically on upstream main in this environment (pinned-host-memory / CUDA stream errors) and are unrelated to this change

Checklist

Review and Merge Process

  1. Ping Merge Oncalls to start the process. See the PR Merge Process.
  2. Get approvals from CODEOWNERS and other reviewers.
  3. Trigger CI tests with comments or contact authorized users to do so.
    • Common commands include /tag-and-rerun-ci, /tag-run-ci-label, /rerun-failed-ci
  4. After green CI and required approvals, ask Merge Oncalls or people with Write permission to merge the PR.

CI States

Latest PR Test (Base): 🚫 Run #38640749839
Latest PR Test (Extra): ❌ Run #38640750291
Latest PR Test (AMD ROCm 10): 🚫 Run #38640756438

…keep its storage beliefs

A storage prefetch that the stop policy ends before the read completes is
not a storage shortfall: the span is still stored, and the hit the query
agreed on may be a MIN over lookups that were skipped rather than a verdict.
A partial hybrid transfer is nevertheless resolved as `storage_transfer`,
which heals the storage-existence beliefs beyond the completed span and
makes the next insert re-write pages the store already holds.

- `PrefetchOperation.deadline_expired` marks an operation whose read was
  ended by the stop policy. `_handle_prefetch_result` then reports the
  unfulfilled tokens under the new `deadline` reason and leaves the KV and
  auxiliary-pool beliefs untouched, and `_invalidate_absent_from_hit_query`
  skips such a cut query. The flag is set by a cache or controller
  implementation that cancels an in-flight read under its stop policy; the
  in-tree `timeout` check in `check_prefetch_progress` keeps its current
  handling.
- `storage_prefetch_unfulfilled_tokens` gains the `deadline` reason label.
- `PrefillAdder` finishes storage-prefetch admission for a retracted request
  (with no reason, so nothing is logged) after discarding its accounting, so
  a cache implementation that keeps per-request admission state sees the
  same lifecycle end as every other admitted request.
- The buffer-mode hit-drain fixture in `test_storage_prefetch_lifecycle.py`
  gains the new field, since the drain now reads it.

Co-authored-by: xiezhq-hermann <[email protected]>
@metamergebot

Copy link
Copy Markdown
Collaborator Author

Closing in favor of #44340, which carries these same hunks as part of the complete change (it also sets the flag on the in-tree timeout path, which this PR left out).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

hicache Hierarchical Caching for SGLang 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.

1 participant