Repository navigation
Conversation
…warmup Third of four layers split out of #35335: the runtime wiring that turns a plan into a placement. - GPUWorker.apply_auto_residency builds the rank report from the warmup records, plans jointly across ranks, applies the changes transactionally (apply_residency_changes / commit / rollback), validates with a re-warm and rolls the round back on a memory shortfall or a materially slower probe; rollback_auto_residency restores the last calibrated placement. - server_warmup.maybe_apply_auto_residency runs the apply -> re-warm -> validate -> (rollback) sequence between the synthetic warmup and the ready signal; the scheduler and client fan the AutoResidencyReq control request out to every replica and merge the outcomes. - Layerwise offload gains per-group resident layouts and pin frontiers, host-store repacking, disable/enable offload for promotions, and release of host stores once a resident placement is validated. - ServerArgs carries the auto residency modes next to the explicit ones (configured vs runtime residency, host pin budget); auto_tune excludes fixed loading paths (quantized, direct GPU, LTX-2 original) per component; quantized component offload capability is enforced at load. - The post-request residency hint reuses the planner's candidate ranking. The remaining layer carries the per-pipeline containment fixes and CI baselines that the calibrated placement surfaced. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
mickqian
requested review from
AgainstEntropy,
BBuf,
JustinTong0323,
sogalin,
wisclmy0611,
yichiche and
zijiexia
as code owners
September 4, 2026 03:40
This was referenced Sep 4, 2026
Merged
added 3 commits
September 5, 2026 07:52
…nto feat/residency-apply-validate
…y-validate # Conflicts: # python/sglang/multimodal_gen/test/unit/test_dp_routing.py
added 4 commits
September 5, 2026 10:09
…y-validate # Conflicts: # python/sglang/multimodal_gen/runtime/managers/gpu_worker.py
mickqian
requested review from
ByronHsu,
DarkSharpness,
Duyi-Wang,
HydraQYH,
Kangyan-Zhou,
bingxche,
celve,
iforgetmyname,
ishandhanani,
whybeyoung,
yeahdongcn and
yingluosanqian
as code owners
September 8, 2026 05:38
…nto feat/residency-apply-validate
3 tasks done
…nto feat/residency-apply-validate # Conflicts: # python/sglang/multimodal_gen/runtime/managers/memory_managers/layerwise_offload.py # python/sglang/multimodal_gen/runtime/server_args/auto_tune.py # python/sglang/multimodal_gen/test/unit/test_performance_metrics.py
This was referenced Sep 9, 2026
`offloaded_weight_bytes` read `meta["numel"]` for every entry that was not a strided copy. A weight left on its checkpoint mapping records a shape instead, so on any host where the copies do not fit -- the consumer case the planner exists for -- the residency probe died with KeyError: 'numel' and auto residency was skipped (RTX 5090 + 60 GB host, MiniMax-H3: 30 of 50 DiT layers mapped). Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
…y-validate # Conflicts: # python/sglang/multimodal_gen/runtime/managers/memory_managers/component_residency_strategies.py # python/sglang/multimodal_gen/runtime/managers/memory_managers/layerwise_offload.py # python/sglang/multimodal_gen/test/unit/test_component_residency.py # python/sglang/multimodal_gen/test/unit/test_layerwise_offload.py
…y-validate # Conflicts: # python/sglang/multimodal_gen/test/unit/test_layerwise_offload.py
Collaborator
Author
|
/tag-and-rerun-ci |
5 tasks done
This was referenced Sep 21, 2026
This was referenced Sep 26, 2026
This branch has not been deployed
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.
Third of four stacked PRs split out of #35335. Base: the planner library. This layer is the runtime wiring that turns a plan into a placement.
Flow
server_warmup.maybe_apply_auto_residencyruns between the synthetic warmup and the ready signal: apply → re-warm → validate → (rollback).GPUWorker.apply_auto_residencybuilds the rank report from the warmup records, plans jointly across ranks, applies the changes transactionally (apply_residency_changes/commit_residency_changes/rollback_residency_changes), and the validation re-warm rolls the round back on a memory shortfall or a materially slower probe.rollback_auto_residencyrestores the last calibrated placement. The scheduler and both scheduler clients fan theAutoResidencyReqcontrol request out to every replica and merge the outcomes (a failed rollback wins over an adjusted replica).Mechanisms it needs
configured_residency_modevs runtimeauto_residency_mode, the sharedhost_pin_budget);auto_tuneexcludes fixed loading paths (quantized, direct GPU, LTX-2 original) per component; quantized component offload capability is enforced at load (supports_quantized_component_offload).SGLANG_DIFFUSION_DISABLE_AUTO_RESIDENCYis the kill switch (defined in the measurement layer, honored by the gate).Tests
test_auto_residency_warmup(apply / validate / rollback rounds, replica merge),test_layerwise_offload,test_health_warmup_gate,test_server_args,test_dp_routing,test_transformer_quant, and the apply-side tests intest_auto_residency. 748 tests pass on this layer.Stack
Every layer's tree is a prefix of #35335's; the union is byte-identical to the original branch merged with main.
CI States
Latest PR Test (Base): ❌ Run #34829636346
Latest PR Test (Extra): ❌ Run #34829635803
Latest PR Test (AMD ROCm 10): ❌ Run #34829636099
Regression fixes (2026-09-07)
Comparing this head against main's run 34015151838 on the same H100 runners showed three default-command cases serving slower:
fast_hunyuan_video9.2 s → 10.2–12.9 s,lingbot_video_moe_t2v6.6 s → 8.0–8.4 s,hunyuanvideo_modelopt_fp8_t2v2.6 s → 6.9–10.1 s (the last two had no e2e baseline; #38335 adds them). Commit1e29438fixes the causes, each reproduced on an H200 devbox with 80 GiB of free VRAM emulated:ServerArgsAutoTunerno longer skips main's memory-threshold placement under server warmup. Calibration starts from that placement and refines it; it never serves below it when a promotion is declined.finalize_resident_layerwise_placementonly empties the host caching allocator when the freed pinned stores exceed 1 GiB. Dropping it after a 0.1 GiB VAE promotion discarded the pinned blocks component-offload text encoders recycle for their per-request D2H copy, so the next request re-pinned 8–14 GiB synchronously (3.5–4.8 s).TimestepPreparationStagelogs the timesteps' shape instead of the tensor, which forced a device sync behind the DiT prefetch (158 ms vs 0.6 ms).Follow-ups (2026-09-08).
5cb56bekeys the MiniMax-H3 VAE decode-dtype store by module layout: the runtimes on shared CI runners expose different parameter sets (144 vs 288 tensors) and were deleting each other's store, which left the decoder weights in anonymous host memory and made the 2-GPU ref2va decode 12.9 s instead of 2.3 s.5cb99dbrefreshes the allocated/reserved peak guards of the 29 H100 and 4 RTX 5090 cases whose text encoders or VAEs the planner now keeps resident, plus the warmup peak ofwan2_2_t2v_a14b_2gpuand the sampled steps of two cases; no e2e expectation changed.A full per-case comparison of this head against main's run 34015151838 (46 single-GPU, 28 two-GPU, 6 RTX 5090 and 5 B200 cases) shows every case equal or faster within main's own run-to-run noise (up to 1.08 on single samples). The B200 nvfp4 cases look 1.6-1.9x slower on some runs, but that tracks the runner node, not the branch:
b200-cirrascale1-*andb200-di01-*runqwen_image_2512_modelopt_nvfp4_t2iat 331-359 ms/step for every branch including unrelated PRs,b200-fin03-*at 187-213 ms/step for main and for #37811; a B200 devbox gives 177 ms/step for both main and this head.