Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 10 additions & 9 deletions docs/cli-design.md
Original file line number Diff line number Diff line change
Expand Up @@ -696,15 +696,16 @@ The controls use the core's captured snapshot graphs and require no re-export.
`--scheduler-checkpoint-extra-work-fraction FRACTION` bounds optional checkpoint
work relative to productive request work. The default is `0.05`; values must be
finite and in `[0,1]`. It overrides
`[server] scheduler_checkpoint_extra_work_fraction`. With a nonzero fraction, the
scheduler considers the last eligible message endpoint as a best-effort
conversation anchor even when timing estimates are unavailable; when the fraction
is zero, an interior message endpoint is used as the anchor only when splitting
prefill there adds zero predicted prefill work, and otherwise the prompt end acts
as the anchor. Zero snapshot capacity disables all checkpoint cuts. Earlier messages
and a distinct prompt end consume the fraction of estimated uncached prefill
work; a distinct terminal endpoint earns its allowance from completed productive
decode. Extra work includes snapshot copies and additional prefill caused by
`[server] scheduler_checkpoint_extra_work_fraction`. An interior message endpoint before the prompt end serves as the conversation
anchor only when splitting prefill there adds predicted prefill work within the
request's extra-work allowance (reducing to zero added prefill work when the
fraction is zero), and otherwise the zero-split prompt end acts as the anchor.
When timing estimates are unavailable, a nonzero fraction keeps the last eligible
message endpoint as a best-effort anchor while zero falls back to the prompt end.
Zero snapshot capacity disables all checkpoint cuts. Any retained interior anchor
split, earlier messages, and a distinct prompt end share the fraction of estimated
uncached prefill work; a distinct terminal endpoint earns its allowance from
completed productive decode. Extra work includes snapshot copies and additional prefill caused by
splitting chunks. Snapshot storage remains globally shared and reclaimable for
mandatory execution. This option requires no core re-export.

Expand Down
40 changes: 21 additions & 19 deletions docs/core-design.md
Original file line number Diff line number Diff line change
Expand Up @@ -1434,25 +1434,27 @@ reuse depends on the actual prepared prefix identity; context-dependent changes
to earlier tokens cannot reuse a checkpoint for different tokens.

The scheduler chooses the last eligible complete-message boundary as the request's
conversation anchor. If no message boundary is eligible, the prompt end is the
anchor. When snapshot storage has zero capacity, the scheduler emits no checkpoint
cuts. Under a nonzero extra-work fraction, anchor retention is best effort and
independent of duration estimates; when `scheduler_checkpoint_extra_work_fraction`
is zero, an interior message boundary is retained as the anchor only if splitting
prefill there adds zero predicted prefill work, otherwise the prompt end serves as
the anchor. Earlier complete-message boundaries compete in reverse message order;
a distinct prompt end follows them. There is no capture-count limit or allocation
of a fixed snapshot share to each request.

Extra captures use a request-local work allowance. Its prefill component is
`scheduler_checkpoint_extra_work_fraction` times the estimated uncached prefill
work, with a default fraction of 0.05. An extra endpoint charges the additional
predicted prefill time caused by splitting its enclosing interval, plus its
snapshot-copy time. Prefill estimates retain measured costs after expiry, as
ordinary dispatch does. Unknown prefill costs or unknown or stale snapshot-copy
costs exclude extras without excluding the selected anchor; when the fraction is
zero, unknown prefill costs fall back from an interior message boundary to the
prompt-end anchor. Productive completed decode
candidate conversation anchor, or the prompt end if no message boundary is
eligible. When snapshot storage has zero capacity, the scheduler emits no
checkpoint cuts. An interior message boundary before the prompt end is retained as
the conversation anchor only when splitting prefill there adds predicted prefill
work within the request's extra-work allowance (`scheduler_checkpoint_extra_work_fraction`
times estimated uncached prefill work, reducing to exact zero split cost when the
fraction is zero); otherwise the zero-split prompt end serves as the anchor. When
an interior anchor is retained, its predicted split overhead is charged against
that same extra-work allowance while its single anchor snapshot copy remains
uncharged. Earlier complete-message boundaries before that candidate anchor
compete in reverse message order; a distinct prompt end follows them. There is no
capture-count limit or allocation of a fixed snapshot share to each request.

Extra captures share this request-local work allowance, with a default fraction of
0.05. An extra endpoint charges the additional predicted prefill time caused by
splitting its enclosing interval, plus its snapshot-copy time. Prefill estimates
retain measured costs after expiry, as ordinary dispatch does. Unknown prefill
costs or unknown or stale snapshot-copy costs exclude extras without excluding the
selected anchor; under a nonzero fraction unknown prefill costs retain the last
eligible interior message boundary as a best-effort anchor, whereas under a zero
fraction unknown prefill costs fall back to the prompt-end anchor. Productive completed decode
earns the same fraction of measured decode time for a distinct terminal
endpoint. A coincident prompt and terminal endpoint uses one capture. Mandatory
conditioned-input state transfers do not consume this allowance. Preemption
Expand Down
33 changes: 17 additions & 16 deletions docs/scheduling-runtime-design.md
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,9 @@ work, including optional cuts and their split and copy budgets
([checkpoint retention](#prerequisites-and-completion)), without quoting snapshot
storage. Estimates and quoted selections are cached separately within each
planning scope. Both paths reuse a stored selection when it contains any
non-anchor cut. Submission quotes storage for the winning prompt row. When no
non-anchor cut or an unreached anchor cut with an active guard, spent extra
work, or a nonzero charged split. Submission quotes storage for the winning
prompt row. When no
quote fails, estimated and submitted work agree. Storage shortage can change
which cuts fit the work budget, so the estimate and quoted selection can differ
in either direction. If the quoted work differs from the winning estimate, an
Expand Down Expand Up @@ -626,28 +628,27 @@ feedback. Dependency checks apply to the actual selected program. A finishing
prefill exposes its decoder and checkpoint operation only after completion.

Checkpoint retention uses the exact token endpoints supplied by the native
frontend. Zero snapshot capacity disables all checkpoint cuts. Otherwise, the last
eligible completed message is a best-effort conversation anchor, falling back to
the prompt end when no message is eligible or when
`scheduler_checkpoint_extra_work_fraction` is zero and splitting prefill at an
interior message boundary would add predicted prefill work. Earlier
messages are considered in reverse order, followed by a distinct prompt end.
Additional prefill splits and snapshot copies must fit a request-local allowance
of `scheduler_checkpoint_extra_work_fraction` times estimated uncached prefill
work, defaulting to 0.05. Prefill predictions use measured costs, including stale
frontend under the anchor-budgeting and shared request-local allowance rules in
[exact endpoint capture](core-design.md#exact-endpoint-capture): zero snapshot
capacity disables cuts; an interior message boundary is retained as the
conversation anchor only when its predicted prefill split fits the
`scheduler_checkpoint_extra_work_fraction` allowance (defaulting to 0.05,
charging the split while leaving the anchor snapshot copy uncharged); and
earlier messages plus a distinct prompt end compete within that same allowance.
Prefill predictions use measured costs, including stale
estimates retained for dispatch ranking. Pricing skips unmeasured capacities
that consume no additional tokens over a smaller capacity, and unmeasured
capacities other than the chunk's pricing capacity: the smallest catalog
capacity covering the tokens remaining before the chunk's limit, falling back
to the largest catalog capacity when none does. Pure prefill dispatch discovers
only the natural-fit capacity, and an atomic span can make the natural fit
smaller than the pricing capacity. An unmeasured pricing capacity that consumes
additional tokens leaves the prefill cost unknown. Unknown prefill costs and
unknown or stale snapshot-copy costs disable extras while preserving the
selected anchor; when the fraction is zero, unknown prefill costs fall back from
an interior message boundary to the prompt-end anchor. Productive completed
decode earns the same fraction of measured time for a distinct terminal capture.
There is no fixed capture count or concurrency-based snapshot share.
additional tokens leaves the prefill cost unknown, applying the unknown-cost
anchor and extra-cut rules in
[exact endpoint capture](core-design.md#exact-endpoint-capture). Productive
completed decode earns the same fraction of measured time for a distinct
terminal capture. There is no fixed capture count or concurrency-based snapshot
share.

An extra prefill cut is selected only with an obtainable snapshot destination.
If its cost expires after dispatch, its copy can be skipped after the split has
Expand Down
24 changes: 12 additions & 12 deletions helios/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -369,18 +369,18 @@ capacity. Among candidates of one graph kind and cohort that perform the same
logical work, selection first discards any shape whose capacities are all at
least as large as another candidate's and larger in at least one. An unmeasured
prefill graph is not explored when a smaller loaded capacity consumes the same
tokens. Checkpoint selection prioritizes the last eligible message boundary,
using the prompt end when no message boundary is eligible. Earlier messages and
a distinct prompt end compete within a work allowance of
`scheduler_checkpoint_extra_work_fraction` times estimated uncached prefill work,
defaulting to 0.05. Extra captures charge snapshot-copy cost and additional prefill
caused by splitting chunks. Productive completed decode earns the same fraction
of measured time for a distinct terminal capture. Unknown costs exclude extras
while preserving best-effort anchor retention. There is no capture-count cap or
per-request share of snapshot rows. The global allocator accounts for snapshot
aliases, guards a later anchor against earlier optional captures, and reclaims
unused guards for mandatory execution. Only obtainable capture destinations
introduce prefill cuts. See [checkpoint ownership](../docs/core-design.md#exact-endpoint-capture). `prefill_chunk_size` must be 64-aligned, at least 64, and within the
tokens. Checkpoint selection uses the last eligible message boundary as the
conversation anchor only when its predicted prefill split fits the request-local
`scheduler_checkpoint_extra_work_fraction` allowance (defaulting to 0.05),
otherwise falling back to the prompt end. A retained interior anchor charges its
split against that allowance (leaving its snapshot copy uncharged), and earlier
messages plus a distinct prompt end compete for the remaining headroom.
Productive completed decode earns the same fraction of measured time for a
distinct terminal capture. There is no capture-count cap or per-request share of
snapshot rows; the global allocator accounts for snapshot aliases, guards a later
anchor against earlier optional captures, and reclaims unused guards for
mandatory execution. Only obtainable capture destinations introduce prefill cuts.
See [checkpoint ownership](../docs/core-design.md#exact-endpoint-capture). `prefill_chunk_size` must be 64-aligned, at least 64, and within the
context capacity. Batched graphs declare batch capacities in `1..=request_slots`
(at most 64); Helios enumerates and schedules whatever valid batch capacities
the loaded core provides rather than requiring a hardcoded bucket list.
Expand Down
7 changes: 5 additions & 2 deletions helios/src/scheduler/boundary_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,7 @@ fn scheduler_with_concurrency(snapshots: u32, mtp: bool, page_tokens: usize, act
},
)
.unwrap();
s.measured_graph_durations(&super::tests::duration_graphs(4))
.unwrap();
super::tests::permissive_checkpoint_costs(&mut s, 4, None);
if mtp {
s.enable_speculation(&[1, 2, 4, 8]).unwrap();
}
Expand Down Expand Up @@ -425,6 +424,8 @@ fn exact_system_prompt_terminal_endpoints_and_partial_restore_pages() {
for system in [1, 2, 3, 10, 15, 63, 64, 65, 66, 67, 127, 255, 256, 257, 511] {
for mtp in [false, true] {
let mut s = scheduler_with_concurrency(8, mtp, page_tokens, 2);
s.prefill_graphs(super::tests::STANDARD_PREFILL_CAPACITIES)
.unwrap();
let prompt = system + 67;
let h = s.admit(spec(Some(system), prompt, 3)).unwrap();
stop_at_capture(&mut s, h, system as u64);
Expand Down Expand Up @@ -555,6 +556,8 @@ fn boundary_snapshots_are_optional_and_cancel_behind_fence() {
#[test]
fn duplicate_boundary_publication_does_not_remap_live_partial_pages() {
let mut s = scheduler_with_concurrency(6, false, 64, 2);
s.prefill_graphs(super::tests::STANDARD_PREFILL_CAPACITIES)
.unwrap();
let a = s.admit(spec(Some(10), 70, 2)).unwrap();
let b = s.admit(spec(Some(10), 70, 2)).unwrap();
stop_at_capture(&mut s, a, 10);
Expand Down
14 changes: 10 additions & 4 deletions helios/src/scheduler/checkpoint_lifecycle_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,12 @@ fn edge(before: [u64; 16], action: [u64; 3], after: [u64; 16]) {
fn checkpoint_reservations_match_lifecycle_model() {
for cancellation in 0..5 {
let mut scheduler = tests::scheduler(2, 64, 3);
scheduler
.configure_policy(PolicyConfig {
checkpoint_extra_work_fraction: 1.0,
..Default::default()
})
.unwrap();
let handles = [0, 1].map(|slot| {
let mut spec = tests::spec(64, 16);
spec.prompt[0] += slot;
Expand Down Expand Up @@ -300,7 +306,7 @@ fn unused_anchor_guards_revoke_oldest_first_without_cancelling_requests() {
}

#[test]
fn zero_budget_multi_chunk_fallback_reservations_match_lifecycle_model() {
fn budgeted_anchor_multi_chunk_fallback_reservations_match_lifecycle_model() {
for cancellation in 0..5 {
let mut scheduler = tests::scheduler(2, 64, 3);
let mut graphs = tests::duration_graphs(2);
Expand Down Expand Up @@ -360,7 +366,7 @@ fn zero_budget_multi_chunk_fallback_reservations_match_lifecycle_model() {
.request(handle)
.unwrap()
.checkpoint_capture
.expect("multi-chunk prefill must retain zero-budget prompt-end anchor fallback");
.expect("multi-chunk prefill must retain budgeted-anchor prompt-end fallback");
assert_eq!(capture.role, RetentionRole::Anchor);
assert_eq!(capture.endpoint, 1024);
let snapshot = capture.snapshot;
Expand Down Expand Up @@ -436,7 +442,7 @@ fn zero_budget_multi_chunk_fallback_reservations_match_lifecycle_model() {
}

#[test]
fn zero_budget_interior_anchor_drift_and_mixed_shift_match_lifecycle_model() {
fn budgeted_anchor_interior_drift_and_mixed_shift_match_lifecycle_model() {
// 1. Aligned interior boundary (512 in 1024) with upward GPU EWMA drift on chunk 1
// arms and publishes 512 once and leaves chunk 2 free of duplicate Anchor capture.
let mut scheduler = tests::scheduler(2, 64, 3);
Expand Down Expand Up @@ -485,7 +491,7 @@ fn zero_budget_interior_anchor_drift_and_mixed_shift_match_lifecycle_model() {
.request(handle)
.unwrap()
.checkpoint_capture
.expect("aligned zero-budget interior boundary must arm Anchor capture");
.expect("aligned budgeted-anchor interior boundary must arm Anchor capture");
assert_eq!(capture.role, RetentionRole::Anchor);
assert_eq!(capture.endpoint, 512);
let request = handle.slot as u64 + 1;
Expand Down
Loading
Loading