Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
127 commits
Select commit Hold shift + click to select a range
66f2864
[diffusion] plan reversible residency before warmup
mickqian Aug 27, 2026
df6cfa2
[diffusion] resolve NVFP4 weights before residency planning
mickqian Aug 27, 2026
034b804
[diffusion] preserve load-safe residency admission
mickqian Aug 27, 2026
eff6b09
[diffusion] plan HostPin residency per node
mickqian Aug 27, 2026
7819648
[diffusion] preserve residency phase semantics
mickqian Aug 27, 2026
f25c7a0
[diffusion] preserve implicit prefetch deltas
mickqian Aug 27, 2026
c30aa9d
[diffusion] complete residency pipeline fixtures
mickqian Aug 27, 2026
4c067be
[diffusion] complete auto residency test pipelines
mickqian Aug 27, 2026
b55c0ea
[diffusion] distinguish runtime residency transitions
mickqian Aug 27, 2026
7ef8ea8
[diffusion] avoid FSDP fallback load collectives
mickqian Aug 27, 2026
d95f560
[diffusion] preserve LTX two-stage load placement
mickqian Aug 27, 2026
5ef01cf
[diffusion] preserve residency regression cost
mickqian Aug 27, 2026
541934c
Merge remote-tracking branch 'origin/mick/diffusion-auto-residency' i…
mickqian Aug 27, 2026
76b2ab1
[diffusion] keep low-memory preload placement conservative
mickqian Aug 27, 2026
dcc26ae
[diffusion] tune layerwise residency schedule
mickqian Aug 27, 2026
60f5f69
[diffusion] align residency performance guards
mickqian Aug 27, 2026
9fe11c2
fix(diffusion): validate automatic residency placement
mickqian Aug 27, 2026
8016510
fix(diffusion): stabilize residency calibration
mickqian Aug 27, 2026
e67255f
test(diffusion): align residency consistency guards
mickqian Aug 27, 2026
0a0d396
fix(diffusion): preload model-default layerwise DiTs
mickqian Aug 27, 2026
3ceeba3
test(diffusion): align LTX residency VRAM guard
mickqian Aug 28, 2026
31f8138
[diffusion] refine auto residency admission
mickqian Aug 28, 2026
4602a06
test(diffusion): complete auto residency worker fixtures
mickqian Aug 28, 2026
f8ac41c
test(diffusion): enforce rank-local layerwise DTensors
mickqian Aug 28, 2026
66f51ad
[diffusion] bound auto residency calibration
mickqian Aug 28, 2026
bc9eb0a
[diffusion] avoid speculative preload retuning
mickqian Aug 28, 2026
7baddfc
[diffusion] scope preload placement preference
mickqian Aug 28, 2026
6314c5e
[diffusion] defer automatic layerwise setup
mickqian Aug 28, 2026
ca5d564
[diffusion] keep load-safe layerwise fallback
mickqian Aug 28, 2026
ed0be88
[diffusion] preserve auxiliary load semantics
mickqian Aug 28, 2026
d4b2364
[diffusion] align warmup allocator fixtures
mickqian Aug 28, 2026
60e81a1
[diffusion] refresh preload VRAM baseline
mickqian Aug 28, 2026
8faf3ee
[diffusion] document serving placement scope
mickqian Aug 28, 2026
05efe7f
[diffusion] clarify joint placement invariants
mickqian Aug 28, 2026
e29d77a
[diffusion] calibrate residency with the CI workload
mickqian Aug 28, 2026
9ebe2fc
[diffusion] shorten resident-only residency validation
mickqian Aug 28, 2026
63b8b32
[docs] define auto residency optimization boundary
mickqian Aug 28, 2026
eeeb378
[diffusion] report residency validation timing
mickqian Aug 28, 2026
ad73c4d
[diffusion] avoid redundant residency host copies
mickqian Aug 28, 2026
3938412
[diffusion] validate residency commit barrier
mickqian Aug 28, 2026
d8fa09c
Merge branch 'mick/diffusion-auto-residency' into codex/diffusion-pre…
mickqian Aug 28, 2026
8517c76
Merge remote-tracking branch 'origin/mick/diffusion-auto-residency' i…
mickqian Aug 28, 2026
a631079
Merge remote-tracking branch 'origin/codex/diffusion-preload-residenc…
mickqian Aug 28, 2026
c2d6ed9
Merge remote-tracking branch 'origin/mick/diffusion-auto-residency' i…
mickqian Aug 28, 2026
298e359
Merge commit '0a12e0f9a557b' into codex/diffusion-preload-residency-p…
mickqian Aug 28, 2026
31a6bec
Merge commit 'f843683bb88af' into codex/diffusion-preload-residency-p…
mickqian Aug 28, 2026
1ad0951
Merge remote-tracking branch 'origin/mick/diffusion-auto-residency' i…
mickqian Aug 28, 2026
ee41dd0
Merge remote-tracking branch 'origin/mick/diffusion-auto-residency' i…
mickqian Aug 28, 2026
e4b2fd2
Merge remote-tracking branch 'origin/mick/diffusion-auto-residency' i…
mickqian Aug 28, 2026
46f7563
[diffusion] tune layerwise policies per group
mickqian Aug 28, 2026
8addcc8
[diffusion] tune repeated component layer policies
mickqian Aug 28, 2026
3996a9b
Merge remote-tracking branch 'origin/mick/diffusion-auto-residency' i…
mickqian Aug 28, 2026
5b94aa2
[diffusion] classify repeated residency components by stage
mickqian Aug 28, 2026
1ab90f5
[diffusion] clarify repeated component utility
mickqian Aug 28, 2026
c03dc3f
Merge branch 'mick/diffusion-auto-residency' of https://github.com/sg…
mickqian Aug 28, 2026
2203893
[diffusion] align residency calibration stage names
mickqian Aug 28, 2026
081ade8
Merge branch 'mick/diffusion-auto-residency' of https://github.com/sg…
mickqian Aug 28, 2026
d00b41b
Merge remote-tracking branch 'origin/mick/diffusion-auto-residency' i…
mickqian Aug 28, 2026
15051c5
[diffusion] account resident layerwise host stores
mickqian Aug 28, 2026
49b1f37
[diffusion] account residency transition VRAM
mickqian Aug 28, 2026
19f3261
[diffusion] align residency lifecycle footprints
mickqian Aug 28, 2026
3e3dc7e
Merge remote-tracking branch 'origin/mick/diffusion-auto-residency' i…
mickqian Aug 28, 2026
194e2a5
Merge remote-tracking branch 'origin/mick/diffusion-auto-residency' i…
mickqian Aug 28, 2026
5cd449a
test(diffusion): restore residency frontier coverage
mickqian Aug 28, 2026
5b03d30
Merge remote-tracking branch 'origin/mick/diffusion-auto-residency' i…
mickqian Aug 28, 2026
bc593b3
fix(diffusion): reconcile residency calibration tests
mickqian Aug 28, 2026
05dfa17
Merge branch 'codex/diffusion-auto-residency-fixes' into codex/diffus…
mickqian Aug 28, 2026
fecc309
[diffusion] align preload planner tests
mickqian Aug 28, 2026
0783d4f
Merge remote-tracking branch 'origin/codex/diffusion-preload-residenc…
mickqian Aug 28, 2026
678c16d
Merge branch 'codex/diffusion-auto-residency-fixes' into codex/diffus…
mickqian Aug 28, 2026
39ebb60
[diffusion] preserve preload preference cost
mickqian Aug 28, 2026
9a3db40
Merge auto residency frontier optimization
mickqian Aug 28, 2026
a7430f5
[diffusion] defer HostPin tuning until calibration
mickqian Aug 28, 2026
93f1464
Merge remote-tracking branch 'origin/mick/diffusion-auto-residency' i…
mickqian Aug 28, 2026
5e6db41
test(diffusion): align merged residency fixtures
mickqian Aug 28, 2026
f6c9c64
Merge branch 'mick/diffusion-auto-residency' into codex/diffusion-pre…
mickqian Aug 28, 2026
143f5f3
Merge branch 'mick/diffusion-auto-residency' into codex/diffusion-pre…
mickqian Aug 28, 2026
572a8b1
Merge remote-tracking branch 'origin/mick/diffusion-auto-residency' i…
mickqian Aug 28, 2026
bcd1d99
Merge branch 'mick/diffusion-auto-residency' into codex/diffusion-pre…
mickqian Aug 29, 2026
6613ad6
fix: use current transformer checkpoint resolver
mickqian Aug 29, 2026
db5f422
Merge mick/diffusion-auto-residency into codex/diffusion-preload-resi…
mickqian Aug 30, 2026
a82c0fa
Merge remote-tracking branch 'refs/remotes/origin/ci-base-36703' into…
mickqian Aug 30, 2026
c23f0dd
Merge mick/diffusion-auto-residency into codex/diffusion-preload-resi…
mickqian Aug 31, 2026
f53b0ee
fix(diffusion): align residency planner test scope
mickqian Aug 31, 2026
2be5d10
Merge branch mick/diffusion-auto-residency into codex/diffusion-prelo…
mickqian Aug 31, 2026
547d0c9
Merge branch mick/diffusion-auto-residency into codex/diffusion-prelo…
mickqian Aug 31, 2026
4045410
test(diffusion): complete loader metadata fixtures
mickqian Aug 31, 2026
9b5a052
test(diffusion): complete component loader fixtures
mickqian Aug 31, 2026
1abb574
Merge branch 'mick/diffusion-auto-residency' into codex/diffusion-pre…
mickqian Aug 31, 2026
1b0d0b3
Merge branch mick/diffusion-auto-residency into codex/diffusion-prelo…
mickqian Aug 31, 2026
8714e70
fix(diffusion): scope LTX warmup exclusions
mickqian Aug 31, 2026
0fa3496
test(diffusion): opt out loader fixture from residency planning
mickqian Aug 31, 2026
a4614c0
fix(diffusion): contain preload residency regressions
mickqian Sep 1, 2026
ae3982c
Merge commit 'a1b1e5d06dd2a1664b94b3b1377c5073cdff150e' into HEAD
mickqian Sep 1, 2026
a5ba54e
test(diffusion): align residency CI workloads
mickqian Sep 1, 2026
d6f9883
fix(diffusion): bound auto residency frontier search
mickqian Sep 1, 2026
80183ad
fix(diffusion): bound residency policy search
mickqian Sep 1, 2026
79250fe
Merge main into codex/diffusion-preload-residency-planner
mickqian Sep 2, 2026
3654903
Merge main to pick up CI infrastructure fixes
mickqian Sep 3, 2026
a6d8d3e
Fix Ruff formatting after main merge
mickqian Sep 3, 2026
7172051
Merge mick/diffusion-auto-residency (main merged) into codex/diffusio…
mickqian Sep 3, 2026
8c890f8
Merge remote-tracking branch 'origin/mick/diffusion-auto-residency' i…
mickqian Sep 4, 2026
4117ea6
Merge remote-tracking branch 'origin/mick/diffusion-auto-residency' i…
mickqian Sep 4, 2026
97b8661
Merge remote-tracking branch 'origin/mick/diffusion-auto-residency' i…
Sep 5, 2026
6b74f9a
Merge branch 'root-l4' into u1-planner
Sep 5, 2026
e21cd87
Merge branch 'root-l4' into u1-planner
Sep 5, 2026
b3be617
ci: 5090 turbo_wan load peak follows the load-time resident seed
Sep 5, 2026
021287d
Merge branch 'root-l4' into u1-planner
Sep 5, 2026
bc550ed
Merge branch 'root-l4' into u1-planner
Sep 5, 2026
46709aa
Merge branch 'root-l4' into u1-planner
Sep 6, 2026
ca01a91
Merge branch 'root-l4' into u1-planner
Sep 6, 2026
bd3015f
Merge branch 'root-l4' into u1-planner
Sep 6, 2026
8f51455
Merge direct base mick/diffusion-auto-residency
mickqian Sep 6, 2026
e45817e
Merge branch 'root-l4' into u1-planner
Sep 6, 2026
b2851fa
fix(diffusion): use the local checkpoint in plain-loader server args
mickqian Sep 6, 2026
6d8f927
Merge branch 'root-l4' into u1-planner
Sep 6, 2026
93f585e
tests: rebuild the residency test modules on the folded base
Sep 6, 2026
864e91a
Merge branch 'root-l4' into u1-planner
Sep 7, 2026
cf99a71
fix: keep the threshold residency defaults under the static planner
Sep 7, 2026
a330811
tests: restore the threshold placement tests after dropping the load-…
Sep 7, 2026
2ca4a18
Merge branch 'root-l4' into u1-planner
Sep 7, 2026
3fbc61f
ci: baseline the load peaks of the pre-warmup seed
Sep 7, 2026
e1baaa0
Merge branch 'root-l4' into u1-planner
Sep 8, 2026
eeeecbf
Merge branch 'root-l4' into u1-planner
Sep 8, 2026
f29a7b1
Merge remote-tracking branch 'origin/mick/diffusion-auto-residency' i…
Sep 8, 2026
ad6b1a6
Merge branch '' into codex/diffusion-preload-residency-planner
mickqian Sep 11, 2026
103faaa
Merge branch 'mick/diffusion-auto-residency' into codex/diffusion-pre…
Sep 12, 2026
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
2 changes: 1 addition & 1 deletion docs/docs/sglang-diffusion/api/cli.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ Use `sglang generate --help` and `sglang serve --help` for the full argument lis
- PEFT `adapter_config.json` semantics are applied automatically for named adapter slots, RSLoRA, and per-layer `alpha_pattern`. Adapters that require unsupported auxiliary parameters or runtime behavior, such as DoRA, fail before weight injection instead of silently using ordinary LoRA math.
- `--lora-merge-mode {auto|merge|dynamic}`: choose how LoRA is applied. `auto` statically merges regular weights and uses dynamic LoRA for FSDP-sharded weights to avoid full-gather peaks.
- `--num-gpus {N}`: number of GPUs to use
- `--performance-mode {manual|auto|speed|memory}` / `--mode`: preset for latency/throughput and memory defaults. `auto` is the default. With an eligible synthetic server warmup, it starts from a load-safe placement, measures the representative workload, and jointly selects component/layer residency against every rank and execution-phase VRAM constraint plus HostPin limits. These are simultaneous constraints on one placement decision, not independently spendable budgets. Warmup also observes each declared layer group's call count, so repeated groups can receive independent resident-layer allocations while one-shot or unused groups use HostPin or whole-component residency instead. Multi-process HostPin planning stays inside non-overlapping per-worker shares. Explicit/online quantization and direct GPU loading fix only their affected components; eligible encoders, VAEs, and other components in the same pipeline still participate. The selected placement targets the model-default (or `--warmup-sampling-params`) workload; use representative warmup parameters or explicit residency for larger production shapes, batches, or output counts. Candidate planning uses live allocated memory, while the single post-placement validation also checks allocator-reserved memory so the selected layout retains request headroom. Pipelines that cannot preserve their numerical path across a runtime residency change keep their static placement. Layerwise prefetch depth and residency policy remain explicit because their latency effect depends on runtime overlap rather than weight size alone. Offline, realtime, and no-warmup paths retain the model/card fallback policy. It uses FSDP only for validated DiT-offload replacement paths. `speed` keeps `torch.compile` disabled unless a model-specific deployment config opts in after validation; pass `--enable-torch-compile true` to enable it explicitly. Use `manual` to keep performance-related server args under explicit user control. Explicit offload, FSDP, and parallelism flags take precedence in all modes.
- `--performance-mode {manual|auto|speed|memory}` / `--mode`: preset for latency/throughput and memory defaults. `auto` is the default. With an eligible synthetic server warmup, it starts from a load-safe checkpoint-weight placement, measures the representative workload, and jointly selects component/layer residency against every rank and execution-phase VRAM constraint plus node-wide HostPin limits. These are simultaneous constraints on one placement decision, not independently spendable budgets. Warmup also observes each declared layer group's call count, so repeated groups can receive independent resident-layer allocations and implicit residency policies while one-shot or unused groups use HostPin or whole-component residency instead. Multi-process workers begin with non-overlapping HostPin shares; the joint solve may reassign them asymmetrically without exceeding the node allowance. Explicit/online quantization and direct GPU loading fix only their affected components; eligible encoders, VAEs, and other components in the same pipeline still participate. The selected placement targets the model-default (or `--warmup-sampling-params`) workload with one output per prompt; use explicit residency or representative warmup parameters for larger production shapes, batches, or output counts. Candidate planning uses live allocated memory, while the single post-placement validation also checks allocator-reserved memory so the selected layout retains request headroom. Pipelines that cannot preserve their numerical path across a runtime residency change keep their static placement. Layerwise prefetch depth remains explicit because its latency effect depends on runtime overlap rather than weight size alone. Explicit residency policies also remain authoritative; otherwise native policy candidates may be tuned. Offline, realtime, and no-warmup paths retain the static fallback policy. It uses FSDP only for validated DiT-offload replacement paths. `speed` keeps `torch.compile` disabled unless a model-specific deployment config opts in after validation; pass `--enable-torch-compile true` to enable it explicitly. Use `manual` to keep performance-related server args under explicit user control. Explicit offload, FSDP, and parallelism flags take precedence in all modes.
- `--direct-gpu-weight-loading {true|false}`: opt into direct GPU loading for an unquantized, GPU-resident, TP=1 DiT by materializing its complete checkpoint state dict on GPU. Compatible tensors become parameter storage without another GPU copy, while tensors requiring transforms can still need temporary allocations. It is disabled by default; startup time and peak GPU memory remain model-dependent, so benchmark the target model before deployment. It is incompatible with DiT CPU/layerwise offload and FSDP.
- `--tp-size {N}`: tensor parallelism size. Depending on the pipeline, it can shard the DiT, one or more encoders, or both.
- `--sp-degree {N}`: sequence parallelism size
Expand Down
8 changes: 5 additions & 3 deletions docs/docs/sglang-diffusion/deployment_cookbook.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -128,11 +128,11 @@ See [OpenAI API: Served model name](/docs/sglang-diffusion/api/openai_api#served
</tbody>
</table>

With an eligible `sglang serve` warmup, `auto` records allocated-memory peaks for the representative request, active component layouts, and temporary per-layer call counts for every declared layer group. One placement decision then satisfies every rank and execution-phase VRAM constraint together with HostPin and HostPin-transition limits. These are simultaneous constraints on one decision vector, not separate planners or independently spendable pools. The target frontier covers component offload, resident components, independent resident counts for repeatedly executed layer groups, and pinned layer-store reassignment; one-shot or unused groups do not consume stage-resident VRAM. Explicit/online quantization and direct GPU loading keep only their affected components fixed, so unrelated encoders and VAEs remain eligible. A post-adjustment warmup realizes the selected state and validates its memory peak before the server becomes ready. A round containing only moves to resident uses one full-shape denoising step; demotions and layerwise or HostPin rebalancing retain the longer timing sample. Validation may keep or roll back the one selected placement, but never starts another search round.
With an eligible `sglang serve` warmup, `auto` records allocated-memory peaks for the representative request, active component layouts, and temporary per-layer call counts for every declared layer group. One serving-placement decision then satisfies every rank and execution-phase VRAM constraint together with node-wide HostPin and HostPin-transition limits. These are simultaneous constraints on one decision vector, not separate planners or independently spendable pools. The earlier preload plan is only a replaceable load-feasibility seed: after exact modules exist, the serving planner rebuilds the complete frontier and may replace every seeded choice. This preserves the optimum of the supplied serving frontier, but does not claim to jointly minimize startup and serving latency over every possible lifecycle. The target frontier covers component offload, resident components, independent resident counts and implicit residency policies for repeatedly executed layer groups, and pinned layer-store reassignment; one-shot or unused groups do not consume stage-resident VRAM. Explicit/online quantization and direct GPU loading keep only their affected components fixed, so unrelated encoders and VAEs remain eligible. A post-adjustment warmup realizes the selected state and validates its memory peak before the server becomes ready. A round containing only moves to resident uses one full-shape denoising step; demotions and layerwise or HostPin rebalancing retain the longer timing sample. Validation may keep or roll back the one selected placement, but never starts another search round.

This optimization targets the model-default workload, batch size 1, unless `--warmup-sampling-params` supplies a representative request. Larger production shapes or batches should set that override or use explicit `--component-residency`. Layerwise prefetch depth and residency policy remain user-controlled because their latency effect depends on measured copy/compute overlap; the planner does not infer them from weight bytes. Multi-process runs use non-overlapping per-worker HostPin shares, which prevents node overcommit but can be more conservative than a node-global asymmetric allocation.
This optimization targets the model-default workload and one output per prompt unless `--warmup-sampling-params` supplies a representative request. Larger production shapes, batches, or output counts should set that override or use explicit `--component-residency`. Layerwise prefetch depth remains user-controlled because its latency effect depends on measured copy/compute overlap. An explicitly selected residency policy also remains authoritative; otherwise the planner may choose among the native policy candidates. Multi-process runs begin with non-overlapping per-worker HostPin shares. The joint placement solve may then assign asymmetric per-rank quotas while keeping their sum within the same node-wide allowance, so HostPin is optimized with VRAM rather than by a separate planner.

Before warmup, `auto` still uses load-safe model/card defaults. It checks selected GPU memory before applying FSDP, uses the least available memory across selected GPUs, and only enables FSDP automatically on validated paths where it can replace DiT offload. Offline, realtime, no-warmup, and unsupported serving paths retain those static defaults. When the model default uses CFG and the user did not set a parallelism policy, `auto` may also enable CFG parallelism. `memory` favors lower memory, while `speed` favors latency/throughput and accepts OOM risk. `speed` keeps `torch.compile` disabled by default because its effect varies by model and workload; `--enable-torch-compile true` always opts in explicitly.
Before warmup, `auto` inventories the selected checkpoint weights on every rank and may seed native DiTs as resident while keeping auxiliary components on their configured loading path. This seed reserves activation headroom and is not a second serving optimizer: weight size alone cannot safely promote encoders or VAEs before the target shape is measured. Each rank reads its checkpoint independently; neither this seed nor layerwise initialization introduces a load-time weight all-gather. Auto parallelism still uses the least available memory across selected GPUs and only enables FSDP on validated paths where it can replace DiT offload. Offline, realtime, no-warmup, and unsupported serving paths retain static defaults. When the model default uses CFG and the user did not set a parallelism policy, `auto` may also enable CFG parallelism. `memory` favors lower memory, while `speed` favors latency/throughput and accepts OOM risk. `speed` keeps `torch.compile` disabled by default because its effect varies by model and workload; `--enable-torch-compile true` always opts in explicitly.

The modes tune native pipeline components declared to the component residency manager. DiTs, text/image encoders, VAEs, vocoders, adapters, and upsamplers can use layerwise offload when their native module declares its executable layer structure. Explicitly selecting an unsupported component fails at startup instead of falling back to another residency mode.

Expand Down Expand Up @@ -213,6 +213,8 @@ A 1.3B video DiT moves about 2.6 GB a step, on the order of a tenth of a one-sec

**FSDP** shards DiT weights across multiple GPUs and all-gathers weights during forward. It can reduce DiT CPU offload cost on multi-GPU deployments, especially for validated Wan I2V workloads.

Checkpoint loading does not use that forward-time collective as a loading primitive. Each rank reads the checkpoint independently and constructs its final local DTensor storage directly; the fallback for a full checkpoint tensor slices locally instead of redistributing from another rank. Layerwise offload follows the same rule: its CPU layer stores contain that rank's local DTensor shards and wrap them back with `DTensor.from_local`, without a load-time all-gather. FSDP forward execution still performs the collectives required by its sharding policy.

FSDP sharding granularity matters. SGLang Diffusion prefers sharding direct repeated transformer block entries such as `transformer_blocks.0` or `blocks.0`. Coarser sharding lowers wrapper count but can increase all-gather peak memory; finer sharding can reduce transient memory but adds communication and scheduling overhead. If a model does not define an explicit sharding rule, the loader falls back to repeated block class names and common direct numbered block paths.

**CFG parallelism** splits positive and negative CFG branches across GPUs. For Qwen/Wan workloads with normal step counts, this is the most reliable multi-GPU speedup observed so far.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,10 @@ class GetDisaggStatsReq(msgspec.Struct):


class AutoResidencyReq(msgspec.Struct, frozen=True):
"""Apply or roll back the warmup-calibrated residency promotion.
"""Plan, apply, or roll back automatic component residency.

Sent by the server warmup orchestrator after the synthetic warmup
requests finish and before the server reports ready.
"""

action: str = "apply" # "apply" | "validate" | "rollback"
action: str = "apply" # "apply" | "apply_static" | "validate" | "rollback"
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,10 @@
from sglang.multimodal_gen.runtime.server_args import PortArgs, ServerArgs
from sglang.multimodal_gen.runtime.server_warmup import (
run_sync_client_warmup,
run_sync_startup_warmup,
should_apply_pre_warmup_auto_residency,
should_run_explicit_client_warmup,
should_run_synthetic_server_warmup,
)
from sglang.multimodal_gen.runtime.utils.logging_utils import (
GREEN,
Expand Down Expand Up @@ -191,6 +194,11 @@ def _start_local_server_if_needed(
return processes

def _run_client_warmup_if_needed(self) -> None:
if should_apply_pre_warmup_auto_residency(
self.server_args
) or should_run_synthetic_server_warmup(self.server_args):
run_sync_startup_warmup(self.server_args, sync_scheduler_client.forward)
return
if not should_run_explicit_client_warmup(self.server_args):
return

Expand Down
32 changes: 22 additions & 10 deletions python/sglang/multimodal_gen/runtime/entrypoints/http_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,9 @@
from sglang.multimodal_gen.runtime.server_args import ServerArgs, get_global_server_args
from sglang.multimodal_gen.runtime.server_warmup import (
maybe_apply_auto_residency,
maybe_apply_pre_warmup_auto_residency,
run_async_client_warmup,
should_apply_pre_warmup_auto_residency,
should_run_synthetic_server_warmup,
)
from sglang.multimodal_gen.runtime.utils.logging_utils import (
Expand Down Expand Up @@ -84,21 +86,31 @@ async def _run_server_warmup_after_http_live(
server_args: ServerArgs, warmup_done: asyncio.Event
) -> None:
try:
if not should_run_synthetic_server_warmup(server_args):
run_static_planner = should_apply_pre_warmup_auto_residency(server_args)
run_warmup = should_run_synthetic_server_warmup(server_args)
if not run_static_planner and not run_warmup:
warmup_done.set()
return

await _wait_until_http_live(server_args)

await run_async_client_warmup(
server_args,
async_scheduler_client.forward,
fail_open=server_args.warmup_resolutions is None,
)
# Freeze the auto residency decision before the server reports ready.
# Raises only when a rollback failed, which aborts startup below.
await maybe_apply_auto_residency(server_args, async_scheduler_client.forward)
logger.info("The server is fired up and ready to roll!")
if run_static_planner:
await maybe_apply_pre_warmup_auto_residency(
server_args, async_scheduler_client.forward
)

if run_warmup:
await run_async_client_warmup(
server_args,
async_scheduler_client.forward,
fail_open=server_args.warmup_resolutions is None,
)
# Freeze the auto residency decision before the server reports ready.
# Raises only when a rollback failed, which aborts startup below.
await maybe_apply_auto_residency(
server_args, async_scheduler_client.forward
)
logger.info("The server is fired up and ready to roll!")
warmup_done.set()
except asyncio.CancelledError:
raise
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,9 @@


class BridgeLoader(PlainStateDictComponentLoader):
"""Loader for MOVA dual tower bridge with FSDP support."""

supports_fsdp_loading = True

component_names = ["dual_tower_bridge"]
config_classes = {"dual_tower_bridge": MOVADualTowerConfig}
Original file line number Diff line number Diff line change
Expand Up @@ -149,6 +149,18 @@ class ComponentLoader(ABC):
# diffusers or transformers
expected_library: str = ""

# --attention-backend primarily selects the DiT backend. Auxiliary
# components may fall back when that global choice is incompatible; an
# explicit --component-attention-backends entry remains strict.
allow_global_attention_backend_fallback = True
# Gates only --component-quantizations.<name>. Quantization declared by a
# checkpoint is discovered and admitted by the component's normal loader.
supports_online_quantization_override = False
supports_fsdp_loading = False
# Gates only --component-direct-gpu-weight-loading.<name>. The checkpoint
# source stays component-specific because its streaming ABI is loader-owned.
supports_direct_gpu_weight_loading = False
supports_fsdp_inference = False
_loaders_registered = False

def __init_subclass__(cls, **kwargs):
Expand Down Expand Up @@ -1005,6 +1017,19 @@ class PipelineComponentLoader:
Utility class for loading the components in a pipeline.
"""

@staticmethod
def supports_fsdp_loading(
component_name: str,
transformers_or_diffusers: str,
component_architecture: str | None = None,
) -> bool:
loader = ComponentLoader.for_component_type(
component_name,
transformers_or_diffusers,
component_architecture,
)
return loader.supports_fsdp_loading

@staticmethod
def load_component(
component_name: str,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,10 @@ def _server_args_for_transformer_component(
class TransformerLoader(OnlineQuantizationComponentLoader):
"""Shared loader for (video/audio) DiT transformers."""

allow_global_attention_backend_fallback = False
supports_online_quantization_override = True
supports_fsdp_loading = True
supports_fsdp_inference = True
component_names = [
"transformer",
"unconditional_transformer",
Expand Down
Loading
Loading