Skip to content

Estimate checkpoint work without quoting snapshot storage - #354

Merged
yatesdr merged 1 commit into
NVIDIA:mainfrom
yatesdr:fix/helios-checkpoint-work-estimate
Nov 18, 2026
Merged

yatesdr merged 1 commit into
NVIDIA:mainfrom
yatesdr:fix/helios-checkpoint-work-estimate

Conversation

@yatesdr

@yatesdr yatesdr commented Nov 18, 2026

Copy link
Copy Markdown
Collaborator

Part of #335. Fixes the scheduler CPU regression from 617ef92 reported in #335 (comment with the cn4 bisect). Supersedes #329.

Estimate checkpoint work without quoting snapshot storage

Prefill scoring and service-rate normalization perform checkpoint storage
simulations for waiting requests, including during commit. Estimating only
persisted cuts or the anchor avoids those simulations but can overstate
work before an optional cut, leaving a short lane on an oversized graph.

Use the checkpoint selection loop for estimates with storage quoting
disabled, preserving its split and copy budgets. Cache estimates and
quoted selections separately within each planning scope. Score estimates,
then materialize the chosen row using quoted selection and shared
endpoint clipping. Add a four-request regression and update the scheduling
specification.

This removes waiting-row storage simulations while keeping graph sizing
consistent with selected cuts when storage is sufficient. This change
supersedes #329: checkpoint_cut is called once per select_plan for the
chosen prefill row, and commit performs no quoted checkpoint selection
through service_rates. An anchor-only cut can still become stale if
retain_window_ends moves the anchor after selection, causing an extra
split at the former anchor without data loss (a follow-up).

The regression fails on main with 16 simulations against a limit of six,
fails against the previous estimate with capacity 512 instead of 128,
and passes with this change. The scheduler filter passes 316 tests and
runtime phase tests pass 101. In the 32-request cold CPU reproduction,
both versions complete 406,400 prompt tokens in 253 plans. Plan/commit
CPU falls from 2,566/14,312 ms to 338/84 ms, and simulations fall from
7,366 to 254. These are macOS CPU measurements with synthetic completions.
On DeepSeek-V4.1-Flash TP4 (4x RTX PRO 6000), 32 concurrent cold ~12.7K-token
requests start in 29.0 s median (28.5 s on a second burst), against 161-188 s
on main, 213.8 s at 617ef92 and 28.8 s at its parent c74b613.

Not tested: TLA+, Kani, the four ignored scheduler checks, and the anchor-only edge.

Prefill scoring and service-rate normalization perform checkpoint storage
simulations for waiting requests, including during commit. Estimating only
persisted cuts or the anchor avoids those simulations but can overstate
work before an optional cut, leaving a short lane on an oversized graph.

Use the checkpoint selection loop for estimates with storage quoting
disabled, preserving its split and copy budgets. Cache estimates and
quoted selections separately within each planning scope. Score estimates,
then materialize the chosen row using quoted selection and shared
endpoint clipping. Add a four-request regression and update the scheduling
specification.

This removes waiting-row storage simulations while keeping graph sizing
consistent with selected cuts when storage is sufficient. This change
supersedes NVIDIA#329: checkpoint_cut is called once per select_plan for the
chosen prefill row, and commit performs no quoted checkpoint selection
through service_rates. An anchor-only cut can still become stale if
retain_window_ends moves the anchor after selection, causing an extra
split at the former anchor without data loss (a follow-up).

The regression fails on main with 16 simulations against a limit of six,
fails against the previous estimate with capacity 512 instead of 128,
and passes with this change. The scheduler filter passes 316 tests and
runtime phase tests pass 101. In the 32-request cold CPU reproduction,
both versions complete 406,400 prompt tokens in 253 plans. Plan/commit
CPU falls from 2,566/14,312 ms to 338/84 ms, and simulations fall from
7,366 to 254. These are macOS CPU measurements with synthetic completions.
On DeepSeek-V4.1-Flash TP4 (4x RTX PRO 6000), 32 concurrent cold ~12.7K-token
requests start in 29.0 s median (28.5 s on a second burst), against 161-188 s
on main, 213.8 s at 617ef92 and 28.8 s at its parent c74b613.

Not tested: TLA+, Kani, the four ignored scheduler checks, and the anchor-only edge.

Design-Signed-Off-By: yatesdr; design-review=ed22
@yatesdr
yatesdr merged commit d0ce8a2 into NVIDIA:main Nov 18, 2026
2 checks passed
yatesdr added a commit to yatesdr/flare-local-inference that referenced this pull request Nov 18, 2026
Snapshot selection repeatedly walks per-page postings when aliases overlap,
making heavily overlapping cache layouts expensive to select. Each alias
is a validated contiguous page range, so prefix sums can count its free
backing and pairwise overlap exactly.

Replace candidate page vectors and posting lists with free-page and
blocked-page prefix sums. Use an excluded-page bitmap and prefix sum for
larger greedy witnesses, and reject insufficient candidate sets early.
Retain the reference tests and replace the posting-offset helper test
with selection over the same large overlap geometry.

Preserve minimum-cost selection and lowest-ID ties for one or two rows,
and preserve the greedy witness for larger counts, while removing page
work proportional to aggregate pair overlaps. No candidate cap is added.

In a macOS scratch build with platform shims, 310 scheduler tests and both
production-geometry tests passed. Randomized selection matched the
reference in 41,910 comparisons. Main exceeded the nested-alias work bound
with 5,732,032 page visits; the replacement used 256 for two rows.
The production fixture showed no two-row quote-time improvement.

On Linux (rebased on main with NVIDIA#354), scheduler:: and
server::runtime::phase_tests pass 422 tests. An independent comparison of
the compiled select_snapshots from main and from this change matched on
18,054,687 randomized inputs (6.9M feasible), including nested, random
and short-window shapes; eight injected mutations were each caught by the
change's own comparison test. On a nested shape with 1,986 aliases over
327,680 pages, one two-row selection takes 10.23 s on main and 0.84 ms
here; one-row selection takes 14.8 ms and 0.88 ms. On DeepSeek-V4.1-Flash
TP4 (4x RTX PRO 6000), 32 cold ~12.7K-token requests start in 28.8 s
median (main with NVIDIA#354: 29.0 s), and 10 minutes of the NVIDIA#319 agent load
(12 conversations, ~70K shared prefix, 60% cancelled mid-stream) ran 210
requests with no errors and no wedge.

Not tested: TLA+, Kani, and the remaining cost of re-selecting after each
eviction inside one quote (a follow-up).

Design-Signed-Off-By: yatesdr; design-review=ed22
yatesdr added a commit that referenced this pull request Nov 18, 2026
Follow-up to #354. Prefill candidates are scored with a checkpoint
estimate that skips the snapshot-storage quote, and the submitted lane
uses the quoted selection. When storage is short, the quoted selection
can drop or move the estimated cut, so a lane submitted different work
than its graph capacity was chosen for: a 200-token prompt ran as 128
tokens on a 128-token graph, chunking prefill exactly when checkpoint
storage is full.

Before materializing an ordinary prefill plan whose quoted work differs
from its estimate, pick the smallest catalog capacity covering the
quoted work and recompute duration and value with the lane prices the
selection already holds. The prefill value formula is shared through
lane_value_for_tokens. A missing duration or catalog entry keeps the
candidate and clips its work, as before. Refresh and discovery plans
keep their selected shapes, so a refresh still measures its target.

With storage exhausted, a 200-token prompt now runs as 200 tokens on a
256-token graph; with sufficient storage nothing changes. A resized plan
can run longer, up to the chunk-size graph, and is not re-compared with
other candidates. Mixed plans keep the old clip, a known remaining gap.

The shortage regression (200, 300 and 1,024-token prompts and an
unchanged refresh target, with every snapshot slot held) fails on
abd5646 and passes with the fix. A fallback test checks that a missing
duration leaves the candidate unchanged.

Not tested: GPU serving with snapshot storage exhausted.

Design-Signed-Off-By: yatesdr; design-review=ed22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant