Repository navigation
helios/scheduler: multi-chunk heavy prefill entitlement share exchange - #67
Draft
FujitsuPolycom wants to merge 1 commit into
Draft
FujitsuPolycom wants to merge 1 commit into
FujitsuPolycom wants to merge 1 commit into
Conversation
Why
Under concurrent decode and multi-chunk prefill load with positive decode-age
pricing (`--scheduler-policy balanced`), `ServicePrice::observe` credits each
intermediate prefill chunk, dropping the executing prompt's normalized token
price below untouched peers. Competing multi-chunk prompts therefore advance in
lockstep instead of finishing sequentially and freeing KV pages earlier.
Recording planned entitlement share swaps at submission without mutating stored
prices, projecting them across queued submissions, and applying the exchange
only at validated completion serializes multi-chunk prompts by aged remaining
time while conserving aggregate normalized prefill entitlement relative to
active decoders and leaving stored prices unchanged on rejected commits, error
completions, or zero-duration completions.
What
- Native scheduler (`helios/src/scheduler.rs`, `policy.rs`, `service.rs`,
`utility.rs`; `+230` net Rust prod LOC, `+258/-28`; zero CLI, config, ABI,
`unsafe`, or lock changes; `coalescing_prefill_log_bonus` untouched):
- Added `ServicePrice::log_normalized_share` and
`ServicePrice::swap_normalized_share` in `utility.rs`.
- Added `best_prefill_chunk` and stack-allocated `heavy_prefill_donors` in
`policy.rs`, active only when non-terminal active decoders exist (excluding
retiring `Snapshot` requests), `token_fairness > 0`, `decode_age_price > 0`
(inactive under `--scheduler-policy throughput`), and at least two
non-terminal, non-`prompt_logprobs` prefills exceed single-step pure-prefill
capacity (`remaining > prefill_chunk_size`, including deferred intermediate
chunks on `TerminalPrefill` cores; single-chunk prefills excluded even when
the peak-throughput chunk `c_max < prefill_chunk_size`).
- Wired `projected_services` in `service.rs` and `lane_values` in `policy.rs`
so planning prices paired recipients at their donor's normalized share
rebased to the recipient's feasible token rate and projects queued swaps
before queued frame observations.
- Added `Submission::prefill_share_swap: Option<(RequestHandle, RequestHandle)>`
in `scheduler.rs`; `service_participants` records non-self pairs read-only
at commit, and `observe_service` applies `swap_normalized_share` only after
positive observed GPU duration, non-error status, positive committed
recipient tokens, and matching live handles.
- Simulator, tests, and documentation:
- Mirrored multi-chunk share exchange in `scripts/scheduling_sim/utility.py`
(`+101` net Python prod LOC, `+102/-1`) with log-space aged urgency,
weighted `log_price` conservation, pure-prefill `pref_best` filtering,
`reference is not None` / `age_price > 0` / `rate_history == "service"`
guards, and validated `observe()`.
- Added 7 Rust scheduler unit tests in `helios/src/scheduler/policy_tests.rs`
and 3 Python simulator/parity tests in `tests/test_scheduling_utility.py`;
updated `test_gb10_prefill_storm_decode_age_pricing_avoids_one_second_stalls`
to verify non-terminal contended chunks stay `<= 4096` and terminal
finishing chunks stay `<= 8192` now that serialized heavy prompts complete
prefill before the first interactive request finishes.
- Updated present-state specifications in `docs/scheduling-runtime-design.md`,
`docs/scheduling-theory.md`, `docs/scheduling-utility.md`, and
`helios/README.md`.
Result
Measured in `scripts/scheduling_sim` (`Value(64)`, `UtilityConfig(16, 4, 100,
0.1, "service")` vs `9cd0cfad` baseline):
- 21 standard workloads (`std` and `mixed`, `balanced` and `throughput`):
`0/21` diffs (`0` regressions; `throughput` unchanged).
- `2 dec + 2x16k` (`std`): heavy TTFT `[593.1, 678.4]` -> `[383.9, 857.2]` ms
(first `-35.3%`, mean `-2.4%`, max output gap `217.3 -> 217.3` ms, output
`-0.9%`, decode age `+5.4%`).
- `2 dec + 2x16k` (`mixed`): heavy TTFT `[703.1, 726.7]` -> `[443.5, 743.1]` ms
(first `-36.9%`, mean `-17.0%`, max output gap `145.0 -> 145.0` ms, output
`-1.8%`, decode age `+8.8%`).
- `4 dec + 4x16k` (`std`): heavy TTFT `[1436.0..1637.3]` -> `[788.0..2200.6]` ms
(first `-45.1%`, mean `-3.7%`, max output gap `213.0 -> 226.6` ms, output
`-2.4%`, decode age `+7.9%`).
- `4 dec + 4x16k` (`mixed`): heavy TTFT `[1155.0..1418.4]` -> `[491.5..1587.8]`
ms (first `-57.4%`, mean `-21.2%`, max output gap `114.7 -> 114.7` ms, output
`-1.5%`, decode age `+7.7%`).
- `prefill_storm_gb10` (`gb10_catalog`, 12 interactive + 4x24k..30k heavy):
heavy TTFT `[20733..24518]` (mean `23566`) -> `[13758..25214]` ms (first
`-33.6%`, mean `-11.9%`), max output gap `642.0 -> 795.0` ms (`< 800` ms vs
`> 1000` ms throughput), all non-terminal contended prefill chunks `<= 4096`.
Evidence
- `RUSTFLAGS="-D warnings" cargo +1.97.1 check --locked --release --manifest-path helios/Cargo.toml --features runtime-core,server --tests`: passed with `0` warnings.
- `cargo test --locked --release --manifest-path helios/Cargo.toml --features runtime-core,server --lib scheduler::`: `456 passed, 0 failed, 4 ignored`.
- `python3 -m pytest tests/test_scheduling_utility.py tests/test_scheduling_sim.py tests/test_scheduling_learning_policy.py tests/test_scheduling_learning_experiments.py tests/preparation/test_core_boundary.py -q`: `515 passed`.
- `python3 verification/helios-lifecycle/check.py --tlc-jar /home/cody/tools/tlaplus-1.7.4/tla2tools.jar --jobs 4 --mutations`: passed all TLC models, `8/8` observed Rust trace conformance models (`621,389` edges), `26/26` Rust mutations, and `13/13` TLA+ mutations.
- Limitations: target-hardware `flare run` GPU A/B serving measurements on SM120/SM121 have not yet been run on this commit; `cargo-kani` and `learning.py --preset validate` were not run (`cost.rs` and `learning_policy.py` unchanged).
Discord: Dooner
Design-Signed-Off-By: Antigravity (Gemini 4 Neon); design-review=2e5b
Signed-off-by: FujitsuPolycom <87842395+FujitsuPolycom@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
Under concurrent decode and multi-chunk prefill load with positive decode-age pricing (
--scheduler-policy balanced),ServicePrice::observecredits each intermediate prefill chunk, dropping the executing prompt's normalized token price below untouched peers. Competing multi-chunk prompts therefore advance in lockstep instead of finishing sequentially and freeing KV pages earlier.Recording planned entitlement share swaps at submission without mutating stored prices, projecting them across queued submissions, and applying the exchange only at validated completion serializes multi-chunk prompts by aged remaining time while conserving aggregate normalized prefill entitlement relative to active decoders and leaving stored prices unchanged on rejected commits, error completions, or zero-duration completions.
What
helios/src/scheduler.rs,policy.rs,service.rs,utility.rs; +230 net Rust prod LOC,+258/-28; zero CLI, config, ABI,unsafe, or lock changes;coalescing_prefill_log_bonusuntouched from9cd0cfad):ServicePrice::{log_normalized_share, swap_normalized_share}inutility.rs.best_prefill_chunkand stack-allocatedheavy_prefill_donorsinpolicy.rs, active only when non-terminal active decoders exist (excluding retiringSnapshotrequests),token_fairness > 0,decode_age_price > 0(inactive under--scheduler-policy throughput), and>= 2non-terminal, non-prompt_logprobsprefills exceed single-step pure-prefill capacity (remaining > prefill_chunk_size, including deferred intermediate chunks onTerminalPrefillcores; single-chunk prefills excluded even whenc_max < prefill_chunk_size).projected_servicesinservice.rsandlane_valuesinpolicy.rsso planning prices paired recipients at their donor's normalized share rebased to the recipient's feasible token rate and projects queued swaps before queued observations.Submission::prefill_share_swap: Option<(RequestHandle, RequestHandle)>inscheduler.rs;service_participantsrecords non-self pairs read-only at commit, andobserve_serviceappliesswap_normalized_shareonly after positive observed GPU duration, non-error status, positive committed recipient tokens, and matching live handles.scripts/scheduling_sim/utility.py(+101 net Python prod LOC,+102/-1) with log-space aged urgency, weightedlog_priceconservation, pure-prefillpref_bestfiltering,reference is not None/age_price > 0/rate_history == "service"guards, and validatedobserve().helios/src/scheduler/policy_tests.rs(+663LOC) and 3 Python tests intests/test_scheduling_utility.py(+228/-3LOC; updatedtest_gb10_prefill_storm_decode_age_pricing_avoids_one_second_stallsso non-terminal contended chunks assert<= 4096and serialized finishing chunks assert<= 8192).docs/scheduling-runtime-design.md,docs/scheduling-theory.md,docs/scheduling-utility.md, andhelios/README.md(+109/-25LOC).Result
Measured in
scripts/scheduling_sim(Value(64),UtilityConfig(16, 4, 100, 0.1, "service")) incrementally atop9cd0cfad:balanced∥throughput)9cd0cfad)4fd94213)std∥mixed)0/21changed0regressions;throughputunchanged2 dec + 2x16k(std)[593.1, 678.4]ms[383.9, 857.2]ms-35.3%; mean-2.4%; gap217.3ms; out-0.9%; age+5.4%2 dec + 2x16k(mixed)[703.1, 726.7]ms[443.5, 743.1]ms-36.9%; mean-17.0%; gap145.0ms; out-1.8%; age+8.8%4 dec + 4x16k(std)[1436.0..1637.3]ms[788.0..2200.6]ms-45.1%; mean-3.7%; gap213.0->226.6ms; out-2.4%; age+7.9%4 dec + 4x16k(mixed)[1155.0..1418.4]ms[491.5..1587.8]ms-57.4%; mean-21.2%; gap114.7ms; out-1.5%; age+7.7%prefill_storm_gb10(gb10_catalog)[20733..24518]ms[13758..25214]ms-33.6%; mean-11.9%; gap642.0->795.0ms (< 800ms); non-terminal<= 4096SM120/SM121
flare runGPU A/B serving measurements are pending before marking Ready or opening upstream.Evidence
Verified on clean
git archiveof4fd94213facffa123911ee69702cc8b95548dfce(tree1b61240da3ce714d089a245764b06cbc7b14c9de) atop9cd0cfadd167da2474db809bb49081df054583e0:git merge-tree --write-tree 9cd0cfad 4fd94213passed with0conflicts.RUSTFLAGS="-D warnings" cargo +1.97.1 check --locked --release --manifest-path helios/Cargo.toml --features runtime-core,server --testspassed with0warnings;cargo test --locked --release --manifest-path helios/Cargo.toml --features runtime-core,server --lib scheduler::passed (456 passed, 0 failed, 4 ignored).python3 -m pytest tests/test_scheduling_utility.py tests/test_scheduling_sim.py tests/test_scheduling_learning_policy.py tests/test_scheduling_learning_experiments.py tests/preparation/test_core_boundary.py -qpassed (515 passed).python3 verification/helios-lifecycle/check.py --tlc-jar /home/cody/tools/tlaplus-1.7.4/tla2tools.jar --jobs 4 --mutationspassed all TLC models,8/8observed Rust trace conformance models (621,389edges),26/26Rust mutations, and13/13TLA+ mutations.flare runGPU A/B pending;cargo-kaniandlearning.py --preset validateunrun (cost.rsandlearning_policy.pyunchanged).Discord: Dooner