Skip to content

Commit 35c22a2

Browse files
committed
first nixl version
1 parent 251d173 commit 35c22a2

File tree

5 files changed

+246
-38
lines changed

5 files changed

+246
-38
lines changed
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# SPDX-License-Identifier: Apache-2.0
22
# SPDX-FileCopyrightText: Copyright contributors to the vLLM project
33
from vllm.distributed.kv_transfer.kv_connector.v1.base import (
4-
KVConnectorBase_V1, KVConnectorRole)
4+
KVConnectorBase_V1, KVConnectorRole, KVTransferParams)
55

6-
__all__ = ["KVConnectorRole", "KVConnectorBase_V1"]
6+
__all__ = ["KVConnectorRole", "KVConnectorBase_V1", "KVTransferParams"]

vllm/distributed/kv_transfer/kv_connector/v1/base.py

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,21 @@ class KVConnectorRole(enum.Enum):
5656
# Connector running in the worker process
5757
WORKER = 1
5858

59+
class KVTransferParams:
60+
"""
61+
Abstract KVTransferParams used to send KVTransfer
62+
parameters between instances of vLLM.
63+
64+
Specific instances of KVConnector customize this
65+
method for serializing / deserializing msgs sent
66+
via the HTTP protocol.
67+
"""
68+
69+
@staticmethod
70+
def from_raw_dict(
71+
raw_dict: Optional[dict[str,
72+
Any]]) -> Optional["KVTransferParams"]:
73+
return None
5974

6075
class KVConnectorMetadata:
6176
"""
@@ -66,6 +81,7 @@ class KVConnectorMetadata:
6681

6782

6883
class KVConnectorBase_V1(ABC):
84+
_KVTransferParams = KVTransferParams
6985

7086
def __init__(self, vllm_config: "VllmConfig", role: KVConnectorRole):
7187
logger.warning(
@@ -204,7 +220,13 @@ def get_finished(
204220
# ==============================
205221
# Scheduler-side methods
206222
# ==============================
207-
223+
def set_kv_transfer_params(self, request: "Request"):
224+
"""Parse raw KV Transfer params."""
225+
assert request.kv_transfer_params is None
226+
kv_transfer_params = self._KVTransferParams.from_raw_dict(
227+
request.raw_kv_transfer_params)
228+
request.kv_transfer_params = kv_transfer_params
229+
208230
@abstractmethod
209231
def get_num_new_matched_tokens(
210232
self,

0 commit comments

Comments
 (0)