[PD] Tiny code cleanup for prefill info registering (#19414)
Signed-off-by: Shangming Cai <csmthu@gmail.com>
This commit is contained in:
@@ -64,7 +64,7 @@ class BaseKVManager(ABC):
|
|||||||
|
|
||||||
@abstractmethod
|
@abstractmethod
|
||||||
def register_to_bootstrap(self):
|
def register_to_bootstrap(self):
|
||||||
"""Register to the bootstrap server."""
|
"""Register prefill server info to the bootstrap server."""
|
||||||
...
|
...
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -226,7 +226,7 @@ class CommonKVManager(BaseKVManager):
|
|||||||
return None
|
return None
|
||||||
|
|
||||||
def register_to_bootstrap(self):
|
def register_to_bootstrap(self):
|
||||||
"""Register KVSender to bootstrap server via HTTP POST."""
|
"""Register prefill server info to bootstrap server via HTTP POST."""
|
||||||
if self.dist_init_addr:
|
if self.dist_init_addr:
|
||||||
# Multi-node case: bootstrap server's host is dist_init_addr
|
# Multi-node case: bootstrap server's host is dist_init_addr
|
||||||
if self.dist_init_addr.startswith("["): # [ipv6]:port or [ipv6]
|
if self.dist_init_addr.startswith("["): # [ipv6]:port or [ipv6]
|
||||||
@@ -244,7 +244,6 @@ class CommonKVManager(BaseKVManager):
|
|||||||
bootstrap_server_url = f"{host}:{self.bootstrap_port}"
|
bootstrap_server_url = f"{host}:{self.bootstrap_port}"
|
||||||
url = f"http://{bootstrap_server_url}/route"
|
url = f"http://{bootstrap_server_url}/route"
|
||||||
payload = {
|
payload = {
|
||||||
"role": "Prefill",
|
|
||||||
"attn_tp_size": self.attn_tp_size,
|
"attn_tp_size": self.attn_tp_size,
|
||||||
"attn_tp_rank": self.attn_tp_rank,
|
"attn_tp_rank": self.attn_tp_rank,
|
||||||
"attn_dp_size": self.attn_dp_size,
|
"attn_dp_size": self.attn_dp_size,
|
||||||
@@ -666,7 +665,6 @@ class CommonKVBootstrapServer(BaseKVBootstrapServer):
|
|||||||
|
|
||||||
async def _handle_route_put(self, request: web.Request):
|
async def _handle_route_put(self, request: web.Request):
|
||||||
data = await request.json()
|
data = await request.json()
|
||||||
role = data["role"]
|
|
||||||
attn_tp_size = data["attn_tp_size"]
|
attn_tp_size = data["attn_tp_size"]
|
||||||
attn_tp_rank = data["attn_tp_rank"]
|
attn_tp_rank = data["attn_tp_rank"]
|
||||||
attn_dp_size = data["attn_dp_size"]
|
attn_dp_size = data["attn_dp_size"]
|
||||||
@@ -701,7 +699,6 @@ class CommonKVBootstrapServer(BaseKVBootstrapServer):
|
|||||||
)
|
)
|
||||||
self.follow_bootstrap_room = load_balance_method == "follow_bootstrap_room"
|
self.follow_bootstrap_room = load_balance_method == "follow_bootstrap_room"
|
||||||
|
|
||||||
if role == "Prefill":
|
|
||||||
if system_dp_size == 1:
|
if system_dp_size == 1:
|
||||||
dp_group = attn_dp_rank
|
dp_group = attn_dp_rank
|
||||||
else:
|
else:
|
||||||
@@ -719,6 +716,7 @@ class CommonKVBootstrapServer(BaseKVBootstrapServer):
|
|||||||
"rank_port": rank_port,
|
"rank_port": rank_port,
|
||||||
}
|
}
|
||||||
self._registered_count += 1
|
self._registered_count += 1
|
||||||
|
|
||||||
expected = self.dp_size * self.attn_tp_size * self.pp_size
|
expected = self.dp_size * self.attn_tp_size * self.pp_size
|
||||||
logger.debug(
|
logger.debug(
|
||||||
f"Register prefill bootstrap: DP{dp_group} TP{attn_tp_rank} PP{pp_rank} with rank_ip: {rank_ip} and rank_port: {rank_port}"
|
f"Register prefill bootstrap: DP{dp_group} TP{attn_tp_rank} PP{pp_rank} with rank_ip: {rank_ip} and rank_port: {rank_port}"
|
||||||
|
|||||||
Reference in New Issue
Block a user