[rust-server] fix p/d bootstrap across dp listeners (#36234)
This commit is contained in:
@@ -74,6 +74,8 @@ class KVArgs:
|
||||
page_size: int
|
||||
# for system dp
|
||||
system_dp_rank: int
|
||||
# Local Rust /route registry port; None on scheduler ranks without a listener.
|
||||
rust_http_port: Optional[int]
|
||||
# for pp prefill
|
||||
pp_rank: int
|
||||
prefill_start_layer: int
|
||||
|
||||
@@ -828,6 +828,28 @@ class CommonKVManager(BaseKVManager):
|
||||
"prefill_http_port": get_serving().port,
|
||||
}
|
||||
|
||||
if envs.SGLANG_RUST_SERVER.get() and self.attn_dp_size > 1:
|
||||
topology_rows = get_world_group().all_gather_object(payload)
|
||||
# Every scheduler contributes a topology row. Only the scheduler
|
||||
# ranks that own a Rust listener populate their local registry.
|
||||
if self.kv_args.rust_http_port is None:
|
||||
return
|
||||
registry_host = {"0.0.0.0": "127.0.0.1", "::": "::1"}.get(
|
||||
self.bootstrap_host, self.bootstrap_host
|
||||
)
|
||||
registry = NetworkAddress(registry_host, self.kv_args.rust_http_port)
|
||||
url = f"{registry.to_url()}/route"
|
||||
for topology_row in topology_rows:
|
||||
registry_row = {
|
||||
**topology_row,
|
||||
"prefill_http_port": self.kv_args.rust_http_port,
|
||||
}
|
||||
self._register_topology_row(url, registry_row)
|
||||
return
|
||||
|
||||
self._register_topology_row(url, payload)
|
||||
|
||||
def _register_topology_row(self, url: str, payload: Dict) -> None:
|
||||
max_retries, initial_delay, max_delay = 5, 1.0, 30.0
|
||||
for attempt in range(max_retries):
|
||||
try:
|
||||
|
||||
@@ -208,6 +208,11 @@ class PrefillBootstrapQueue:
|
||||
kv_args.engine_rank = self.tp_rank
|
||||
kv_args.pp_rank = self.pp_rank
|
||||
kv_args.system_dp_rank = self.scheduler.ps.dp_rank
|
||||
kv_args.rust_http_port = (
|
||||
self.scheduler.rust_server.http_port
|
||||
if self.scheduler.rust_server is not None
|
||||
else None
|
||||
)
|
||||
kv_args.kv_cache_dtype_str = (
|
||||
self.scheduler.tp_worker.model_runner.kv_cache_dtype_str
|
||||
)
|
||||
|
||||
@@ -55,10 +55,12 @@ class RustServer:
|
||||
def __init__(
|
||||
self,
|
||||
server: Server,
|
||||
http_port: int,
|
||||
mm_spec: Optional[RustMmSpec] = None,
|
||||
max_per_poll: int = 256,
|
||||
):
|
||||
self.server = server
|
||||
self.http_port = http_port
|
||||
self.mm_spec = mm_spec
|
||||
self._max_per_poll = max_per_poll
|
||||
|
||||
@@ -151,7 +153,7 @@ class RustServer:
|
||||
dp_note,
|
||||
)
|
||||
|
||||
return cls(server, mm_spec=mm_spec)
|
||||
return cls(server, http_port=listen_port, mm_spec=mm_spec)
|
||||
|
||||
def wait_request(self, timeout_ms: int) -> None:
|
||||
"""Block until a request is pushed into the in-process ring or the timeout
|
||||
|
||||
Reference in New Issue
Block a user