File tree Expand file tree Collapse file tree 1 file changed +18
-2
lines changed
Expand file tree Collapse file tree 1 file changed +18
-2
lines changed Original file line number Diff line number Diff line change 11// SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
22// SPDX-License-Identifier: Apache-2.0
33
4- use std:: sync:: { Arc , OnceLock } ;
4+ use std:: sync:: {
5+ Arc , OnceLock ,
6+ atomic:: { AtomicU64 , Ordering } ,
7+ } ;
58
69use anyhow:: Result ;
710use futures:: StreamExt ;
@@ -293,11 +296,24 @@ impl PrefillRouter {
293296 let host = endpoint. bootstrap_host ?;
294297 let port = endpoint. bootstrap_port ?;
295298
296- let bootstrap_room: u64 = rand:: rng ( ) . random ( ) ;
299+ let prefill_dp_size = match prefill_router {
300+ InnerPrefillRouter :: KvRouter ( router) => {
301+ router. chooser . client ( ) . instances ( ) . len ( ) as u64
302+ }
303+ InnerPrefillRouter :: SimpleRouter ( router) => {
304+ router. client ( ) . instances ( ) . len ( ) as u64
305+ }
306+ } ;
307+
308+ // Encode the chosen DP rank into bootstrap_room
309+ static BOOTSTRAP_ROOM_COUNTER : AtomicU64 = AtomicU64 :: new ( 0 ) ;
310+ let base = BOOTSTRAP_ROOM_COUNTER . fetch_add ( prefill_dp_size, Ordering :: Relaxed ) ;
311+ let bootstrap_room = base + ( dp_rank as u64 ) ;
297312
298313 tracing:: info!(
299314 worker_id = worker_id,
300315 dp_rank = dp_rank,
316+ prefill_dp_size = prefill_dp_size,
301317 bootstrap_host = %host,
302318 bootstrap_port = port,
303319 bootstrap_room = bootstrap_room,
You can’t perform that action at this time.
0 commit comments