Skip to content

[Core] Cleanup Omni connector runtime and transfer backends - #5096

Merged
hsliuustc0106 merged 4 commits into
vllm-project:mainfrom
spencerr221:cleanup/connector_mixin
Jul 22, 2026
Merged

hsliuustc0106 merged 4 commits into
vllm-project:mainfrom
spencerr221:cleanup/connector_mixin

Conversation

@spencerr221

Copy link
Copy Markdown
Contributor

Purpose

  • Simplify SharedMemoryConnector by removing unused device, threshold, inline-payload paths, and related metrics.
  • Refactor MooncakeTransferEngineConnector initialization and receive flow into focused helpers.
  • Make Mooncake buffer TTL configurable and prevent cleanup of in-flight buffers.
  • Remove unused helpers, legacy wrappers, and the redundant vllm_config argument from OmniConnectorModelRunnerMixin.
  • Update affected callers and connector tests.

Test Plan

python3 -m pytest tests/distributed/omni_connectors/test_basic_connectors.py tests/distributed/omni_connectors/test_adapter_and_flow.py -q

vLLM Version: 0.25.0

vLLM-Omni Commit: 88d4c96

Test Result

17 passed.

BEFORE SUBMITTING: read CONTRIBUTING.md and run the precheck-pr skill with the code agent for a self-check against project conventions.
(anything written below this line will be removed by GitHub Actions)

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits.
Credits must be used to enable repository wide code reviews.

@lishunyang12 lishunyang12 left a comment •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clean refactor overall — the mooncake except also wrapping the CUDA sync (miscounted as a timeout) is the only one i'd actually look at.

vllm_config: Any,
model_config: Any,
kv_transfer_manager: OmniKVTransferManager | None = None,
**_ignored_kwargs: Any,

@lishunyang12 lishunyang12 Jul 14, 2026 •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Both callers dropped vllm_config, so **_ignored_kwargs now silently swallows typo'd kwargs. Drop it so bad calls fail loudly.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do not use 'any' type


sync_ms = self._sync_receive_buffer_if_needed()
except Exception as e:
self._metrics["timeouts"] += 1

@lishunyang12 lishunyang12 Jul 14, 2026 •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This except also wraps _sync_receive_buffer_if_needed(), so a CUDA sync failure gets miscounted as a timeout and logged as RDMA Get error. Bump errors for the non-transfer path instead.

return self._get_by_key(get_key)
result = self._get_by_key(get_key)
if result is not None:
self._metrics["gets"] += 1

@lishunyang12 lishunyang12 Jul 14, 2026 •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

gets is bumped in 4 separate branches, easy to drift. Increment it once at a single exit instead.

@hsliuustc0106 hsliuustc0106 added the refactor refactoring for better code scalability and quality label Jul 14, 2026

@hsliuustc0106 hsliuustc0106 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

avoid using any type hint for input args

vllm_config: Any,
model_config: Any,
kv_transfer_manager: OmniKVTransferManager | None = None,
**_ignored_kwargs: Any,

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do not use 'any' type


_t2 = _time_mod.perf_counter()
_alloc_ms = (_t2 - _t1) * 1000
alloc_ms = (_t2 - _t1) * 1000

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shall we add a logger level for time profiling? cc @ZacheryAU

zmq_addr = f"tcp://{src_host}:{src_port}"
req_socket = self._get_req_socket(zmq_addr, timeout_ms=_total_timeout_ms)

base_timeout_ms = 30000

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

avoid magic number inside funtions

@hsliuustc0106 hsliuustc0106 added the core related to core module: cache, scheduler, engine, worker, modelrunner label Jul 14, 2026
@hsliuustc0106
hsliuustc0106 requested a review from Copilot July 14, 2026 23:06

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR cleans up the Omni connector runtime APIs and connector backends by removing legacy/unused compatibility paths, refactoring the Mooncake transfer connector into smaller helpers, and simplifying the SHM connector to a single key-addressed SHM mechanism. It also updates the affected GPU model runners and connector tests to match the new behavior.

Changes:

  • Simplify OmniConnectorModelRunnerMixin initialization/signatures and remove legacy wrapper helpers.
  • Simplify SharedMemoryConnector by removing inline-payload/threshold logic and related metrics.
  • Refactor MooncakeTransferEngineConnector.get() into helper methods, add configurable buffer TTL, and prevent TTL cleanup of in-flight buffers.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
vllm_omni/worker/omni_connector_model_runner_mixin.py Removes deprecated wrappers/helpers and updates connector initialization API.
vllm_omni/worker/gpu_generation_model_runner.py Updates connector initialization callsite to match new mixin signature.
vllm_omni/worker/gpu_ar_model_runner.py Updates connector initialization callsite to match new mixin signature (incl. KV manager passing).
vllm_omni/distributed/omni_connectors/connectors/shm_connector.py Retires inline/threshold paths; always uses key-addressed SHM metadata.
vllm_omni/distributed/omni_connectors/connectors/mooncake_transfer_engine_connector.py Refactors init + get/recv flow; adds in-flight tracking and configurable TTL cleanup.
tests/distributed/omni_connectors/test_basic_connectors.py Updates SHM connector tests to reflect key-addressed SHM-only behavior and ensures cleanup via close().
tests/distributed/omni_connectors/test_adapter_and_flow.py Updates flow test configuration/comments to reflect SHM metadata behavior change.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 87 to 92
def init_omni_connectors(
self,
vllm_config: Any,
model_config: Any,
kv_transfer_manager: OmniKVTransferManager | None = None,
**_ignored_kwargs: Any,
) -> None:
self._metrics["gets"] += 1
return result

if "shm" in metadata:

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please fix _get_data_with_lock before routing every payload through this path. Its finally block uses if obj, so deserializing a multi-element tensor raises RuntimeError: Boolean value of Tensor with more than one value is ambiguous before get() returns; falsey payloads also leave the lock file behind. I reproduced this with torch.ones(2, 2). Track successful deserialization explicitly and clean up independently of payload truthiness.

fcntl.flock(lockf, fcntl.LOCK_UN)

# meta contains {'name': ..., 'size': ...}
metadata = {"shm": meta, "size": size}

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This now makes every payload use SHM, but shm_threshold_bytes is still exposed in the CLI/config and forwarded by connector initialization. Those existing settings are now silently ignored. Please remove/deprecate the stale plumbing or preserve the documented threshold behavior.

@hsliuustc0106 hsliuustc0106 added the omni code related to omni models label Jul 17, 2026 — with ChatGPT Codex Connector
@Gaohan123 Gaohan123 added this to the v0.26.0 milestone Jul 18, 2026
@spencerr221
spencerr221 force-pushed the cleanup/connector_mixin branch from 88d4c96 to 1b47e9f Compare July 20, 2026 03:06
Comment thread vllm_omni/engine/arg_utils.py Outdated
# === Cross-stage Communication ===
shm_threshold_bytes: int = 65536
# Deprecated compatibility flag; SharedMemoryConnector always uses SHM.
shm_threshold_bytes: int | None = None

@gcanlin gcanlin Jul 20, 2026 •

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's fine to remove it (and other deprecated warning) directly instead of keeping compatible. Sometimes we forget to remove it in next version, then it will be the new dead code. And this field doesn't seem to be used frequently by users.

Signed-off-by: spencerr221 <liubingyu62@gmail.com>
Signed-off-by: spencerr221 <liubingyu62@gmail.com>
Signed-off-by: spencerr221 <liubingyu62@gmail.com>
Signed-off-by: spencerr221 <liubingyu62@gmail.com>
@spencerr221
spencerr221 force-pushed the cleanup/connector_mixin branch from fe66ff7 to 96c1354 Compare July 21, 2026 09:15
@hsliuustc0106 hsliuustc0106 added ready label to trigger buildkite CI and removed ready label to trigger buildkite CI labels Jul 22, 2026
@hsliuustc0106
hsliuustc0106 merged commit dcf8b07 into vllm-project:main Jul 22, 2026
7 of 9 checks passed
bowieshi pushed a commit to bowieshi/vllm-omni that referenced this pull request Jul 22, 2026
nagisa-kunhah pushed a commit to nagisa-kunhah/vllm-omni that referenced this pull request Jul 30, 2026
NickCao added a commit to NickCao/vllm-omni that referenced this pull request Sep 17, 2026
Since vllm-project#5096, SharedMemoryConnector no longer reads shm_threshold_bytes,
all payloads use shared memory.

Co-authored-by: Codex <noreply@openai.com>
Signed-off-by: Nick Cao <ncao@redhat.com>
NickCao added a commit to NickCao/vllm-omni that referenced this pull request Sep 17, 2026
Since vllm-project#5096, SharedMemoryConnector no longer reads shm_threshold_bytes,
all payloads use shared memory.

Co-authored-by: Codex <noreply@openai.com>
Signed-off-by: Nick Cao <ncao@redhat.com>
khairulkabir1661 pushed a commit to khairulkabir1661/vllm-omni that referenced this pull request Sep 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core related to core module: cache, scheduler, engine, worker, modelrunner omni code related to omni models ready label to trigger buildkite CI refactor refactoring for better code scalability and quality

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants