-
Notifications
You must be signed in to change notification settings - Fork 842
feat: ec connector handler #5162
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
Merged
+933
−22
Merged
Changes from 1 commit
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
488136d
feat: ec connector handler
ayushag-nv 86e5a01
chore: fmt
ayushag-nv bc37577
chore: added ec processor v0
ayushag-nv 74ebf72
chore: ec processor handler
ayushag-nv e15ae2c
chore: tested agg flow
ayushag-nv 6257a14
feat: ec connector handler
ayushag-nv b83a9fc
chore: fmt
ayushag-nv 0b7b9c0
chore: added ec processor v0
ayushag-nv 8b60760
chore: ec processor handler
ayushag-nv 9f6c506
chore: tested agg flow
ayushag-nv 34de22f
Merge remote-tracking branch 'refs/remotes/origin/ayushag/ec-connecto…
ayushag-nv 622ef13
chore: merge files
ayushag-nv 2f8c4c8
chore: updated docs
ayushag-nv cc37e90
Merge branch 'main' into ayushag/ec-connector-example
ayushag-nv ddc5b26
fix: rebase issues
ayushag-nv 7723a39
Merge branch 'main' into ayushag/ec-connector-example
ayushag-nv File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,115 @@ | ||
| # SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. | ||
| # SPDX-License-Identifier: Apache-2.0 | ||
|
|
||
| """ | ||
| Utilities for configuring vLLM's ECTransferConfig for encoder disaggregation. | ||
|
|
||
| ECTransferConfig enables encoder/consumer separation where: | ||
| - Producer (encoder worker): Executes multimodal encoder and saves to storage | ||
| - Consumer (PD worker): Loads encoder outputs from storage | ||
|
|
||
| Supports multiple storage backends: disk (ECExampleConnector), Redis, S3, etc. | ||
| """ | ||
|
|
||
| import json | ||
| import logging | ||
| from typing import Any, Dict, Optional | ||
|
|
||
| from vllm.config import ECTransferConfig | ||
|
|
||
| logger = logging.getLogger(__name__) | ||
|
|
||
|
|
||
| def create_ec_transfer_config( | ||
| engine_id: str, | ||
| ec_role: str, | ||
| ec_connector_backend: str = "ECExampleConnector", | ||
| ec_storage_path: Optional[str] = None, | ||
| ec_extra_config: Optional[str] = None, | ||
| ) -> ECTransferConfig: | ||
| """ | ||
| Create ECTransferConfig for vLLM encoder disaggregation. | ||
|
|
||
| Args: | ||
| engine_id: Unique identifier for this engine instance | ||
| ec_role: Role of this instance - "ec_producer" (encoder) or "ec_consumer" (PD worker) | ||
| ec_connector_backend: ECConnector implementation class name | ||
| ec_storage_path: Storage path for disk-based connectors | ||
| ec_extra_config: Additional connector config as JSON string | ||
|
|
||
| Returns: | ||
| ECTransferConfig configured for the specified role | ||
|
|
||
| Raises: | ||
| ValueError: If required config is missing | ||
| """ | ||
| # Parse extra config if provided | ||
| extra_config: Dict[str, Any] = {} | ||
| if ec_extra_config: | ||
| try: | ||
| extra_config = json.loads(ec_extra_config) | ||
| logger.debug(f"Parsed ec_extra_config: {extra_config}") | ||
| except json.JSONDecodeError as e: | ||
| raise ValueError(f"Invalid JSON in --ec-extra-config: {e}") | ||
|
|
||
| # Add storage path to config if provided | ||
| if ec_storage_path: | ||
| extra_config["storage_path"] = ec_storage_path | ||
|
|
||
| # Validate required fields | ||
| if ec_connector_backend == "ECExampleConnector" and "storage_path" not in extra_config: | ||
| raise ValueError( | ||
| "ECExampleConnector requires 'storage_path' in config. " | ||
| "Provide via --ec-storage-path or --ec-extra-config" | ||
| ) | ||
|
|
||
| logger.info( | ||
| f"Creating ECTransferConfig: engine_id={engine_id}, role={ec_role}, " | ||
| f"backend={ec_connector_backend}, config={extra_config}" | ||
| ) | ||
|
|
||
| return ECTransferConfig( | ||
| engine_id=engine_id, | ||
| ec_role=ec_role, | ||
| ec_connector=ec_connector_backend, | ||
| ec_connector_extra_config=extra_config, | ||
| ) | ||
|
|
||
|
|
||
| def get_encoder_engine_id(namespace: str, component: str, instance_id: int) -> str: | ||
| """ | ||
| Generate unique engine_id for encoder worker instance. | ||
|
|
||
| Format: {namespace}.{component}.encoder.{instance_id} | ||
|
|
||
| Args: | ||
| namespace: Dynamo namespace | ||
| component: Component name (typically "encoder") | ||
| instance_id: Instance ID from runtime | ||
|
|
||
| Returns: | ||
| Unique engine ID string | ||
| """ | ||
| engine_id = f"{namespace}.{component}.encoder.{instance_id}" | ||
| logger.debug(f"Generated encoder engine_id: {engine_id}") | ||
| return engine_id | ||
|
|
||
|
|
||
| def get_pd_engine_id(namespace: str, component: str, instance_id: int) -> str: | ||
| """ | ||
| Generate unique engine_id for PD worker instance. | ||
|
|
||
| Format: {namespace}.{component}.pd.{instance_id} | ||
|
|
||
| Args: | ||
| namespace: Dynamo namespace | ||
| component: Component name (typically "backend" or "decoder") | ||
| instance_id: Instance ID from runtime | ||
|
|
||
| Returns: | ||
| Unique engine ID string | ||
| """ | ||
| engine_id = f"{namespace}.{component}.pd.{instance_id}" | ||
| logger.debug(f"Generated PD engine_id: {engine_id}") | ||
| return engine_id | ||
|
|
||
ayushag-nv marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.