Unverified Commit a210efa6 authored by ishandhanani's avatar ishandhanani Committed by GitHub
Browse files

fix: dp_rank always 0 in non-KV router mode (#7984)

parent 56f87797
...@@ -455,7 +455,7 @@ impl RouterHandles { ...@@ -455,7 +455,7 @@ impl RouterHandles {
lora_name: Option<String>, lora_name: Option<String>,
priority_jump: f64, priority_jump: f64,
allowed_worker_ids: Option<HashSet<WorkerId>>, allowed_worker_ids: Option<HashSet<WorkerId>>,
) -> Result<(u64, u32), QueryRouterResult> { ) -> Result<(u64, Option<u32>), QueryRouterResult> {
if let Some(ref ids) = allowed_worker_ids { if let Some(ref ids) = allowed_worker_ids {
self.prefill_router.register_workers(ids); self.prefill_router.register_workers(ids);
} }
...@@ -1214,6 +1214,8 @@ pub unsafe extern "C" fn route_prefill_request( ...@@ -1214,6 +1214,8 @@ pub unsafe extern "C" fn route_prefill_request(
.query_prefill_worker(&tokens, None, false, None, 0.0, allowed_worker_ids) .query_prefill_worker(&tokens, None, false, None, 0.0, allowed_worker_ids)
.await?; .await?;
let prefill_dp_rank = prefill_dp_rank.unwrap_or(u32::MAX);
tracing::info!( tracing::info!(
prefill_worker_id = prefill_worker_id, prefill_worker_id = prefill_worker_id,
prefill_dp_rank = prefill_dp_rank, prefill_dp_rank = prefill_dp_rank,
......
...@@ -43,11 +43,10 @@ impl PrefillRouter { ...@@ -43,11 +43,10 @@ impl PrefillRouter {
let dp_rank = req let dp_rank = req
.routing .routing
.as_ref() .as_ref()
.and_then(|r| r.prefill_dp_rank.or(r.dp_rank)) .and_then(|r| r.prefill_dp_rank.or(r.dp_rank));
.unwrap_or(0);
tracing::debug!( tracing::debug!(
worker_id = id, worker_id = id,
dp_rank = dp_rank, dp_rank = ?dp_rank,
"Using pre-selected prefill worker for bootstrap" "Using pre-selected prefill worker for bootstrap"
); );
(id, dp_rank) (id, dp_rank)
...@@ -99,7 +98,7 @@ impl PrefillRouter { ...@@ -99,7 +98,7 @@ impl PrefillRouter {
tracing::debug!( tracing::debug!(
worker_id = worker_id, worker_id = worker_id,
dp_rank = dp_rank, dp_rank = ?dp_rank,
bootstrap_host = %host, bootstrap_host = %host,
bootstrap_port = port, bootstrap_port = port,
bootstrap_room = bootstrap_room, bootstrap_room = bootstrap_room,
...@@ -266,7 +265,7 @@ impl PrefillRouter { ...@@ -266,7 +265,7 @@ impl PrefillRouter {
lora_name: Option<String>, lora_name: Option<String>,
priority_jump: f64, priority_jump: f64,
allowed_worker_ids: Option<HashSet<WorkerId>>, allowed_worker_ids: Option<HashSet<WorkerId>>,
) -> Result<(u64, u32)> { ) -> Result<(u64, Option<u32>)> {
let prefill_router = self let prefill_router = self
.prefill_router .prefill_router
.get() .get()
...@@ -288,7 +287,7 @@ impl PrefillRouter { ...@@ -288,7 +287,7 @@ impl PrefillRouter {
allowed_worker_ids, allowed_worker_ids,
) )
.await?; .await?;
Ok((worker.worker_id, worker.dp_rank)) Ok((worker.worker_id, Some(worker.dp_rank)))
} }
InnerPrefillRouter::SimpleRouter(r) => { InnerPrefillRouter::SimpleRouter(r) => {
let worker_id = if update_states { let worker_id = if update_states {
...@@ -297,7 +296,7 @@ impl PrefillRouter { ...@@ -297,7 +296,7 @@ impl PrefillRouter {
r.peek_next_worker() r.peek_next_worker()
} }
.ok_or_else(|| anyhow::anyhow!("No workers available for prefill"))?; .ok_or_else(|| anyhow::anyhow!("No workers available for prefill"))?;
Ok((worker_id, 0)) Ok((worker_id, None))
} }
} }
} }
......
...@@ -141,7 +141,7 @@ impl ...@@ -141,7 +141,7 @@ impl
let routing = prefill_req.routing_mut(); let routing = prefill_req.routing_mut();
routing.prefill_worker_id = Some(worker_id); routing.prefill_worker_id = Some(worker_id);
routing.dp_rank = Some(dp_rank); routing.dp_rank = dp_rank;
prefill_req.bootstrap_info = Some(bootstrap_info.clone()); prefill_req.bootstrap_info = Some(bootstrap_info.clone());
let prefill_context = let prefill_context =
......
...@@ -36,7 +36,7 @@ pub(super) enum PrefillOutcome { ...@@ -36,7 +36,7 @@ pub(super) enum PrefillOutcome {
pub(super) enum PrefillResolveDecision { pub(super) enum PrefillResolveDecision {
Resolved { Resolved {
worker_id: u64, worker_id: u64,
dp_rank: u32, dp_rank: Option<u32>,
bootstrap_info: BootstrapInfo, bootstrap_info: BootstrapInfo,
}, },
Unavailable, Unavailable,
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment