feat: add --sglang-config YAML for engine group configuration #1614
Merged
feat: add --sglang-config YAML for engine group configuration #1614
Conversation
Add --sglang-config argument that accepts a YAML file to configure
engine groups with explicit roles and GPU counts, including support
for placeholder groups that reserve GPU slots without creating
engines (useful for NUMA alignment or GPU gaps between model parts).
Configuration priority:
1. --sglang-config YAML with explicit engine_groups
2. --prefill-num-servers (legacy PD disaggregation)
3. Default single "regular" group
New dataclasses:
- EngineGroupConfig: per-group role + num_gpus + overrides
- SglangConfig: list of groups with factory methods + from_yaml
Key changes:
- start_rollout_server() uses config-driven loop with cumulative
GPU offset for rank calculation, all groups start concurrently
- RolloutServer.active_engine_groups filters out placeholders
- Health monitors, engine aggregation, offload/onload skip placeholders
- _start_router() accepts has_pd_disaggregation kwarg
- Per-engine-group sglang ServerArgs overrides via YAML "overrides" dict
threaded through EngineGroup -> SGLangEngine -> _compute_server_args
- Mutual exclusion: --sglang-config vs --rollout-external and
--sglang-config vs --prefill-num-servers
Example YAML:
engine_groups:
- role: prefill
num_gpus: 4
overrides:
mem_fraction_static: 0.9
- role: decode
num_gpus: 10
overrides:
mem_fraction_static: 0.7
bac171c to
2d18f92
Compare
16e2c44 to
51e18dc
Compare
…s_per_engine Support serving multiple models via --sglang-config YAML, each with its own router and engine groups. Engine groups within a model may have different num_gpus_per_engine (e.g. PD disaggregation with prefill TP=2 and decode TP=4). Key changes: - rollout.py: New ModelConfig/SglangConfig with models list. EngineGroup now carries per-group num_gpus_per_engine, gpu_offset, router_ip/port. RolloutManager.servers is now a dict[str, RolloutServer]. Each model gets its own router via _start_router(force_new=True). - sglang_engine.py: SGLangEngine accepts per-engine num_gpus_per_engine and per-engine router_ip/port, forwarded to _compute_server_args. - Weight updates (Megatron and FSDP): engine_gpu_counts flows through actor -> weight_updater -> connect_rollout_engines_from_distributed, supporting heterogeneous NCCL world_size and rank offsets. - Backward compatible: legacy engine_groups-only YAML still works as a single default model. Single-model callers use the .server property.
- Megatron UpdateWeightFromTensor: move Gloo group creation from __init__ to connect_rollout_engines where engine_gpu_counts is available; compute colocate_engine_nums via cumulative GPU budget; use cumulative offsets for engine mapping instead of uniform stride. - FSDP UpdateWeightFromTensor: same cumulative offset fix for IPC groups. - Remove stale 'assume gpu id same' comments.
|
Hello, is this PR for PD disaggregation? |
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.
No description provided.