-
-
Notifications
You must be signed in to change notification settings - Fork 8.7k
Draft: WIP NixlConnector allow configurable handshake backend +HTTP #19447
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 4 commits
efbd791
9dd2c1c
a0c03cd
cf616b5
505f586
a1a0918
518a59f
6426e3f
29885af
504bba7
dd49c96
f65c1b3
efd655b
dba3835
85855d1
1fc1af4
9d8c15c
fbf0630
69af91c
91af1cd
83ec83a
9a86b37
cc887f5
b960355
e0e88b2
34e3e55
2325470
430ad03
4f30966
54e088e
ead79d6
1a6ac2c
f940b6d
7768f21
3568422
332723a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -202,3 +202,4 @@ shellcheck*/ | |
|
||
# Ingore moe/marlin_moe gen code | ||
csrc/moe/marlin_moe_wna16/kernel_* | ||
uv.lock | ||
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -32,9 +32,11 @@ | |
|
||
import enum | ||
from abc import ABC, abstractmethod | ||
from typing import TYPE_CHECKING, Any, Optional | ||
from typing import TYPE_CHECKING, Any, Callable, Optional | ||
|
||
import torch | ||
import msgspec | ||
from pydantic_core import core_schema | ||
|
||
from vllm.logger import init_logger | ||
from vllm.v1.core.sched.output import SchedulerOutput | ||
|
@@ -62,18 +64,58 @@ | |
Abstract Metadata used to communicate between the | ||
Scheduler KVConnector and Worker KVConnector. | ||
""" | ||
pass | ||
|
||
def __init__(self): | ||
pass | ||
wseaton marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
|
||
class KVConnectorHandshakeMetadata( | ||
msgspec.Struct, | ||
omit_defaults=True, # type: ignore[call-arg] | ||
# required for @cached_property. | ||
dict=True): | ||
""" | ||
Metadata optionally used for out of band connector handshake between P/D workers. | ||
""" | ||
connector_type: str = "base" | ||
|
||
@classmethod | ||
def __get_pydantic_core_schema__( | ||
cls, | ||
_source_type: Any, | ||
_handler: Callable[[Any], core_schema.CoreSchema] | ||
) -> core_schema.CoreSchema: | ||
"""bridge msgspec.Struct with pydantic for schema generation""" | ||
return core_schema.no_info_after_validator_function( | ||
cls, | ||
core_schema.dict_schema() | ||
) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The |
||
|
||
class KVConnectorTransferMetadata( | ||
msgspec.Struct, | ||
omit_defaults=True, # type: ignore[call-arg] | ||
dict=True): | ||
""" | ||
Wrapper for transfer handshake metadata sent between engine and utils. | ||
""" | ||
tensor_parallel_rank: int | ||
data_parallel_rank: int | ||
content: Optional[dict] | ||
|
||
|
||
class KVConnectorBase_V1(ABC): | ||
|
||
def __init__(self, vllm_config: "VllmConfig", role: KVConnectorRole): | ||
def __init__(self, | ||
vllm_config: "VllmConfig", | ||
role: KVConnectorRole): | ||
logger.warning( | ||
"Initializing KVConnectorBase_V1. This API is experimental and " | ||
"subject to change in the future as we iterate the design.") | ||
self._connector_metadata = KVConnectorMetadata() | ||
self._vllm_config = vllm_config | ||
self._role = role | ||
self._handshake_metadata: Optional[KVConnectorHandshakeMetadata] = None | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
|
||
|
||
@property | ||
def role(self) -> KVConnectorRole: | ||
|
@@ -104,7 +146,7 @@ | |
""" | ||
self._connector_metadata = KVConnectorMetadata() | ||
|
||
def _get_connector_metadata(self) -> KVConnectorMetadata: | ||
def get_connector_metadata(self) -> KVConnectorMetadata: | ||
"""Get the connector metadata. | ||
|
||
This function should only be called inside the connector. | ||
|
@@ -201,6 +243,31 @@ | |
""" | ||
return None, None | ||
|
||
def set_handshake_metadata( | ||
self, handshake_metadata: KVConnectorHandshakeMetadata) -> None: | ||
""" | ||
Set the handshake metadata for the connector. | ||
|
||
This metadata is used for out-of-band connector handshake | ||
between P/D workers. | ||
|
||
Args: | ||
handshake_metadata (KVConnectorHandshakeMetadata): the handshake | ||
metadata. | ||
""" | ||
self._handshake_metadata = handshake_metadata | ||
|
||
|
||
def get_handshake_metadata( | ||
self) -> Optional[KVConnectorHandshakeMetadata]: | ||
""" | ||
Get the handshake metadata for the connector. | ||
|
||
Returns: | ||
KVConnectorHandshakeMetadata: the handshake metadata. | ||
""" | ||
return self._handshake_metadata | ||
|
||
# ============================== | ||
# Scheduler-side methods | ||
# ============================== | ||
|
Uh oh!
There was an error while loading. Please reload this page.