[EC Connector] Added Build Connector Worker Meta for EC Connector (#49585)
Signed-off-by: yewentao256 <zhyanwentao@126.com> Signed-off-by: omerpaz95 <omerpaz95@gmail.com> Signed-off-by: omerpaz95 <73347585+omerpaz95@users.noreply.github.com> Co-authored-by: yewentao256 <zhyanwentao@126.com> Co-authored-by: Wentao Ye <44945378+yewentao256@users.noreply.github.com>
This commit is contained in:
co-authored by
yewentao256
Wentao Ye
parent
c94cdd0ae0
commit
fa9d67f782
@@ -14,6 +14,7 @@ from vllm.compilation.cuda_graph import CUDAGraphStat
|
||||
from vllm.v1.core.sched.output import SchedulerOutput
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from vllm.distributed.ec_transfer.ec_connector.base import ECConnectorWorkerMetadata
|
||||
from vllm.distributed.kv_events import KVConnectorKVEvents
|
||||
from vllm.distributed.kv_transfer.kv_connector.v1.base import (
|
||||
KVConnectorWorkerMetadata,
|
||||
@@ -23,6 +24,7 @@ else:
|
||||
KVConnectorStats = object
|
||||
KVConnectorWorkerMetadata = object
|
||||
KVConnectorKVEvents = object
|
||||
ECConnectorWorkerMetadata = object
|
||||
|
||||
|
||||
class LogprobsLists(NamedTuple):
|
||||
@@ -292,6 +294,14 @@ class ECConnectorOutput:
|
||||
# [mm_hash]
|
||||
finished_sending: set[str] | None = None
|
||||
finished_recving: set[str] | None = None
|
||||
ec_connector_worker_meta: ECConnectorWorkerMetadata | None = None
|
||||
|
||||
def is_empty(self):
|
||||
return (
|
||||
not self.finished_sending
|
||||
and not self.finished_recving
|
||||
and not self.ec_connector_worker_meta
|
||||
)
|
||||
|
||||
|
||||
# ModelRunnerOutput is serialized and sent to the scheduler process.
|
||||
@@ -362,6 +372,32 @@ class ModelRunnerOutput:
|
||||
output.kv_connector_output = kv_connector_output
|
||||
return output
|
||||
|
||||
@staticmethod
|
||||
def with_ec_conn_output_only(
|
||||
ec_connector_output: ECConnectorOutput | None,
|
||||
) -> "ModelRunnerOutput":
|
||||
"""Return an otherwise-empty output carrying `ec_connector_output`."""
|
||||
return ModelRunnerOutput.with_ec_conn_output(
|
||||
EMPTY_MODEL_RUNNER_OUTPUT, ec_connector_output
|
||||
)
|
||||
|
||||
@staticmethod
|
||||
def with_ec_conn_output(
|
||||
output: "ModelRunnerOutput",
|
||||
ec_connector_output: ECConnectorOutput | None,
|
||||
) -> "ModelRunnerOutput":
|
||||
"""Return `output` carrying `ec_connector_output`.
|
||||
|
||||
The shared empty output is copied rather than written to, so callers
|
||||
must use the return value.
|
||||
"""
|
||||
if ec_connector_output is None or ec_connector_output.is_empty():
|
||||
return output
|
||||
if output is EMPTY_MODEL_RUNNER_OUTPUT:
|
||||
output = copy(EMPTY_MODEL_RUNNER_OUTPUT)
|
||||
output.ec_connector_output = ec_connector_output
|
||||
return output
|
||||
|
||||
|
||||
# ModelRunnerOutput wrapper for async scheduling.
|
||||
class AsyncModelRunnerOutput(ABC):
|
||||
|
||||
Reference in New Issue
Block a user