Skip to content

perf(multimodal): optimize SHM input transport#610

Open
yechank-nvidia wants to merge 6 commits into
mainfrom
yechan/mm-shm-transport-opt
Open

perf(multimodal): optimize SHM input transport#610
yechank-nvidia wants to merge 6 commits into
mainfrom
yechan/mm-shm-transport-opt

Conversation

@yechank-nvidia

Copy link
Copy Markdown
Collaborator

Summary

  • Report the loaded vision encoder dtype so SMG can serialize multimodal tensors in the destination dtype.
  • Interleave large SHM-to-pinned copies with asynchronous H2D transfers.
  • Overlap SHM unlink cleanup with H2D for single large tensors.
  • For large tensor-parallel inputs, copy SHM on one vision TP rank and broadcast the GPU tensor instead of repeating the host copy on every rank.
  • Copy single TP source tensors directly from SHM into the destination GPU buffer.
  • Preserve the existing staged path for small, mixed-dtype, inline, and non-CUDA inputs.

Test Plan

  • Verified vision encoder dtype discovery for direct and nested vision towers.
  • Verified SHM copy, pinned-memory staging, direct destination copy, cleanup, and dtype validation.
  • Verified TP broadcast selection thresholds and fallback behavior for mixed dtype and inline tensors.
  • Verified CUDA value preservation for both small staged tensors and large interleaved tensors.
  • Benchmarked SHM/H2D paths on B200 with single-GPU and TP configurations.
  • pytest -q test/runtime/test_multimodal_encoder_dtype.py test/runtime/test_multimodal_shm_transport.py test/runtime/test_multimodal_tp_broadcast.py
  • pre-commit run --all-files

@yechank-nvidia yechank-nvidia requested a review from a team as a code owner July 8, 2026 01:28
@yechank-nvidia yechank-nvidia marked this pull request as draft July 8, 2026 01:33

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 1d749e519b

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread python/tokenspeed/runtime/multimodal/embedder.py
@yechank-nvidia yechank-nvidia marked this pull request as ready for review July 13, 2026 13:58
Signed-off-by: yechank-nvidia <161688079+yechank-nvidia@users.noreply.github.com>
Signed-off-by: yechank-nvidia <161688079+yechank-nvidia@users.noreply.github.com>
Signed-off-by: yechank-nvidia <161688079+yechank-nvidia@users.noreply.github.com>
Signed-off-by: yechank-nvidia <161688079+yechank-nvidia@users.noreply.github.com>
Signed-off-by: yechank-nvidia <161688079+yechank-nvidia@users.noreply.github.com>
Signed-off-by: yechank-nvidia <161688079+yechank-nvidia@users.noreply.github.com>
@yechank-nvidia yechank-nvidia force-pushed the yechan/mm-shm-transport-opt branch from 1d749e5 to 7afff11 Compare July 13, 2026 14:15

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7afff1105d

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

"max_num_seqs": server_args.max_num_seqs,
"chunked_prefill_size": server_args.chunked_prefill_size,
"max_model_len": event_loop.model_config.context_len,
"multimodal_encoder_dtype": event_loop.multimodal_encoder_dtype,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Report encoder dtype from encode workers

When server_args.disaggregation_mode == "encode", run_event_loop returns through run_encode_loop before this ready payload is sent, and the encode loop’s own ready dict still only includes the token/sequence fields. In that encode-worker deployment, get_server_info() therefore has no multimodal_encoder_dtype, so SMG cannot serialize multimodal tensors in the destination vision dtype for the path that actually loads only the vision tower; mirror this field in the encode-loop ready message as well.

Useful? React with 👍 / 👎.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant