[Core] Add NIXL omni connector (#6093)
Signed-off-by: yuanwu <yuan.wu@intel.com> Signed-off-by: Yuan Wu <yuan.wu@intel.com>
This commit is contained in:
1 parent
01a2f93256
commit
6753bbd18c
33 files changed
+3032
-66
No files matched your search
+21
-2
@@ -182,14 +182,19 @@ class _OmniConnectorPayloadTransportMixin(_OmniConnectorRuntimeMixin):
|
||||
from_stage: str,
|
||||
to_stage: str,
|
||||
connector_get_key: str,
|
||||
metadata: dict[str, Any] | None = None,
|
||||
) -> Any:
|
||||
"""Receive one ordinary non-KV stage payload on the local leader rank only."""
|
||||
tp_group = self._get_local_tp_group()
|
||||
if tp_group is None or getattr(tp_group, "world_size", 1) <= 1:
|
||||
return connector.get(from_stage, to_stage, connector_get_key)
|
||||
if metadata is None:
|
||||
return connector.get(from_stage, to_stage, connector_get_key)
|
||||
return connector.get(from_stage, to_stage, connector_get_key, metadata)
|
||||
if not self.is_data_transfer_rank():
|
||||
return None
|
||||
return connector.get(from_stage, to_stage, connector_get_key)
|
||||
if metadata is None:
|
||||
return connector.get(from_stage, to_stage, connector_get_key)
|
||||
return connector.get(from_stage, to_stage, connector_get_key, metadata)
|
||||
|
||||
def _recv_full_payload_result(
|
||||
self,
|
||||
@@ -197,6 +202,7 @@ class _OmniConnectorPayloadTransportMixin(_OmniConnectorRuntimeMixin):
|
||||
from_stage: str,
|
||||
to_stage: str,
|
||||
connector_get_key: str,
|
||||
metadata: dict[str, Any] | None = None,
|
||||
) -> Any:
|
||||
"""Receive one full-payload transfer on the local leader rank only."""
|
||||
return self._recv_ordinary_stage_result(
|
||||
@@ -204,6 +210,7 @@ class _OmniConnectorPayloadTransportMixin(_OmniConnectorRuntimeMixin):
|
||||
from_stage,
|
||||
to_stage,
|
||||
connector_get_key,
|
||||
metadata,
|
||||
)
|
||||
|
||||
def _recv_async_chunk_result(
|
||||
@@ -212,6 +219,7 @@ class _OmniConnectorPayloadTransportMixin(_OmniConnectorRuntimeMixin):
|
||||
from_stage: str,
|
||||
to_stage: str,
|
||||
connector_get_key: str,
|
||||
metadata: dict[str, Any] | None = None,
|
||||
) -> Any:
|
||||
"""Receive one ordinary async chunk on the local leader rank only."""
|
||||
return self._recv_ordinary_stage_result(
|
||||
@@ -219,6 +227,7 @@ class _OmniConnectorPayloadTransportMixin(_OmniConnectorRuntimeMixin):
|
||||
from_stage,
|
||||
to_stage,
|
||||
connector_get_key,
|
||||
metadata,
|
||||
)
|
||||
|
||||
@staticmethod
|
||||
@@ -1027,6 +1036,14 @@ class _OmniConnectorPayloadTransportMixin(_OmniConnectorRuntimeMixin):
|
||||
chunk_id = self._get_req_chunk[req_id]
|
||||
external_req_id = self._request_ids_mapping.get(req_id, req_id)
|
||||
connector_get_key = f"{external_req_id}_{target_stage_id}_{chunk_id}"
|
||||
request = self._pending_load_reqs.get(req_id)
|
||||
sender_info = getattr(request, "payload_sender_info", None)
|
||||
metadata = None
|
||||
if isinstance(sender_info, dict):
|
||||
host = sender_info.get("host")
|
||||
port = sender_info.get("zmq_port")
|
||||
if host and port:
|
||||
metadata = {"source_host": str(host), "source_port": int(port)}
|
||||
|
||||
if self._async_chunk:
|
||||
result = self._recv_async_chunk_result(
|
||||
@@ -1034,6 +1051,7 @@ class _OmniConnectorPayloadTransportMixin(_OmniConnectorRuntimeMixin):
|
||||
str(target_stage_id),
|
||||
str(self._stage_id),
|
||||
connector_get_key,
|
||||
metadata,
|
||||
)
|
||||
else:
|
||||
result = self._recv_full_payload_result(
|
||||
@@ -1041,6 +1059,7 @@ class _OmniConnectorPayloadTransportMixin(_OmniConnectorRuntimeMixin):
|
||||
str(target_stage_id),
|
||||
str(self._stage_id),
|
||||
connector_get_key,
|
||||
metadata,
|
||||
)
|
||||
|
||||
if result is None:
|
||||
|
||||
@@ -19,6 +19,8 @@ from vllm_omni.distributed.omni_connectors.utils.config import (
|
||||
ConnectorSpec,
|
||||
get_stage_connector_role,
|
||||
)
|
||||
from vllm_omni.distributed.omni_connectors.utils.initialization import resolve_connector_spec
|
||||
from vllm_omni.distributed.omni_connectors.utils.kv_utils import get_local_tp_rank, get_omni_replica_id
|
||||
|
||||
logger = init_logger("vllm_omni.worker.omni_connector_model_runner_mixin")
|
||||
|
||||
@@ -186,7 +188,11 @@ class _OmniConnectorRuntimeMixin:
|
||||
getattr(topology, "target_tp_size", None),
|
||||
getattr(topology, "local_rank", None),
|
||||
)
|
||||
if all(isinstance(value, int) for value in effective_mapping):
|
||||
if (
|
||||
isinstance(effective_mapping[0], int)
|
||||
and isinstance(effective_mapping[1], int)
|
||||
and isinstance(effective_mapping[2], int)
|
||||
):
|
||||
rank_cfg = {
|
||||
"from_tp": effective_mapping[0],
|
||||
"to_tp": effective_mapping[1],
|
||||
@@ -521,7 +527,15 @@ class _OmniConnectorRuntimeMixin:
|
||||
elif not isinstance(extra, dict):
|
||||
raise RuntimeError(f"Invalid extra config for connector {name}: expected dict, got {type(extra).__name__}")
|
||||
|
||||
spec = ConnectorSpec(name=name, extra=extra)
|
||||
stage_id = int(getattr(model_config, "stage_id", extra.get("stage_id", 0)))
|
||||
role = extra.get("role")
|
||||
spec = resolve_connector_spec(
|
||||
ConnectorSpec(name=name, extra=extra),
|
||||
stage_id=stage_id,
|
||||
role=str(role) if role is not None else None,
|
||||
local_rank=get_local_tp_rank(),
|
||||
replica_id=get_omni_replica_id(),
|
||||
)
|
||||
try:
|
||||
return OmniConnectorFactory.create_connector(spec)
|
||||
except Exception as exc:
|
||||
|
||||
Reference in new issue
Block a user