Skip to content

feat(multimodal): ThreadedMicroBatcher + batcher-backed AsyncVisionEncoder (cross-request batching) - #11037

Merged
furionw merged 1 commit into
mainfrom
qiwa/vision-encoder-batcher
Jul 15, 2026
Merged

feat(multimodal): ThreadedMicroBatcher + batcher-backed AsyncVisionEncoder (cross-request batching)#11037
furionw merged 1 commit into
mainfrom
qiwa/vision-encoder-batcher

Conversation

@furionw

@furionw furionw commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

Why

The merged custom encoder path runs each request's image forward independently, underfilling the encoder GPU under concurrent load. Cross-request batching must preserve one actor thread for CUDA-affine work, request ordering, and bounded variable-resolution sizing. Cancellation must retire unclaimed items so abandoned input cannot poison a live request sharing a later batch. Backend authors also need discoverable setup and sizing guidance.

What Change

  • Add supervised, thread-affine eager and cost-bounded micro-batching.
  • Tombstone canceled requests before dispatch while preserving in-flight best-effort semantics.
  • Document custom encoder setup, sizing, lifecycle, and limitations.

Test Plan

  • 114 multimodal-utils tests and pre-commit; semantic agg_custom e2e returned 42.
  • Stress: 1,000 cancellation races, 1,000 start races, and 12,800 concurrent submissions.

@furionw
furionw temporarily deployed to external_collaborator June 29, 2026 04:53 — with GitHub Actions Inactive
@github-actions github-actions Bot added feat backend::vllm Relates to the vllm backend multimodal labels Jun 29, 2026
@datadog-official

datadog-official Bot commented Jun 29, 2026

Copy link
Copy Markdown

🎯 Code Coverage (details)
Patch Coverage: 99.15%
Overall Coverage: 38.30% (-9.81%)

This comment will be updated automatically if new data arrives.
🔗 Commit SHA: 0392783 | Docs | Give us feedback!

@furionw
furionw force-pushed the qiwa/partial-embed-assembly branch from 768e5c8 to 90cc67e Compare June 29, 2026 19:42
@furionw
furionw force-pushed the qiwa/vision-encoder-batcher branch from fa42f16 to 4be49c4 Compare June 29, 2026 19:44
@furionw
furionw force-pushed the qiwa/partial-embed-assembly branch from 90cc67e to 1c5be47 Compare June 30, 2026 07:04
@furionw
furionw force-pushed the qiwa/vision-encoder-batcher branch from 4be49c4 to 3c1f269 Compare June 30, 2026 07:11
@furionw
furionw force-pushed the qiwa/partial-embed-assembly branch from 1c5be47 to ada3d9a Compare June 30, 2026 16:55
@furionw
furionw force-pushed the qiwa/vision-encoder-batcher branch from 3c1f269 to 729398f Compare June 30, 2026 16:58
@furionw
furionw force-pushed the qiwa/partial-embed-assembly branch from ada3d9a to b3a7c13 Compare June 30, 2026 17:08
@furionw
furionw force-pushed the qiwa/vision-encoder-batcher branch from 729398f to 4f361b7 Compare June 30, 2026 17:08
@furionw
furionw force-pushed the qiwa/vision-encoder-batcher branch from 4f361b7 to b86a07f Compare June 30, 2026 17:27
@furionw
furionw force-pushed the qiwa/partial-embed-assembly branch from b3a7c13 to 5677c09 Compare June 30, 2026 18:09
@furionw
furionw force-pushed the qiwa/vision-encoder-batcher branch from b86a07f to 7d148e3 Compare June 30, 2026 18:15
@furionw
furionw requested review from a team as code owners July 1, 2026 06:42

@devin-ai-integration devin-ai-integration Bot 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.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no bugs or issues to report.

Open in Devin Review

@furionw
furionw force-pushed the qiwa/partial-embed-assembly branch from 99e2a74 to 0509d8a Compare July 6, 2026 20:00
@furionw
furionw requested a review from a team July 6, 2026 20:00
@furionw
furionw requested a review from a team as a code owner July 6, 2026 20:00
@furionw
furionw force-pushed the qiwa/vision-encoder-batcher branch from d175b04 to 13a21ee Compare July 8, 2026 01:06
@copy-pr-bot

copy-pr-bot Bot commented Jul 8, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@furionw
furionw force-pushed the qiwa/vision-encoder-batcher branch from 13a21ee to d1bb143 Compare July 8, 2026 01:08
devin-ai-integration[bot]

This comment was marked as resolved.

@furionw
furionw force-pushed the qiwa/partial-embed-assembly branch 2 times, most recently from ef2cb58 to 1c33055 Compare July 8, 2026 04:12
@furionw
furionw force-pushed the qiwa/vision-encoder-batcher branch from d1bb143 to be57f96 Compare July 8, 2026 04:55
@furionw
furionw force-pushed the qiwa/partial-embed-assembly branch 2 times, most recently from 9f5069b to 7e089b8 Compare July 10, 2026 15:15
@furionw
furionw force-pushed the qiwa/vision-encoder-batcher branch from 0733a55 to 492569d Compare July 11, 2026 01:18
Base automatically changed from qiwa/partial-embed-assembly to main July 11, 2026 02:41
@furionw
furionw force-pushed the qiwa/vision-encoder-batcher branch from 492569d to 7286f09 Compare July 14, 2026 02:39
@coderabbitai

coderabbitai Bot commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Walkthrough

Changes

The PR adds a dedicated ThreadedMicroBatcher, integrates AsyncVisionEncoder with cost-aware batching and actor-thread lifecycle callbacks, and expands tests for batching, failures, shutdown, startup races, and encoder behavior.

Async vision batching

Layer / File(s) Summary
Batcher contract and lifecycle
components/src/dynamo/vllm/multimodal_utils/threaded_micro_batcher.py
Adds lifecycle states, request/work tracking, validated submission, startup, and idempotent shutdown.
Batch collection and failure handling
components/src/dynamo/vllm/multimodal_utils/threaded_micro_batcher.py
Adds eager queue draining, cost-bounded dispatch, result validation, request completion, and worker-crash handling.
AsyncVisionEncoder integration
components/src/dynamo/vllm/multimodal_utils/async_vision_encoder.py, components/src/dynamo/vllm/handlers.py
Routes preprocessing and backend execution through the batcher while running build and close on its worker thread.
Batcher and encoder validation
components/src/dynamo/vllm/tests/multimodal_utils/*
Adds batching and lifecycle tests and updates encoder tests for cost metadata, atomic preprocessing failures, and batcher teardown.

Estimated code review effort: 4 (Complex) | ~60 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The PR uses a custom Why/What/Test format and omits required Overview, Details, reviewer start, and Related Issues sections. Rewrite the description to match the template with Overview, Details, Where should reviewer start?, and a completed Related Issues section.
✅ Passed checks (4 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly names the new micro-batcher and AsyncVisionEncoder routing change, matching the main PR change.

Comment @coderabbitai help to get the list of available commands.

coderabbitai[bot]

This comment was marked as resolved.

@indrajit96 indrajit96 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.

LGTM!
Non Blocking :
IIUC this PR improves GPU utilization for custom multimodal vision encoders by batching images across concurrent requests.
Can we have a readme or any form of docs to explain how to enable this or use it effectively under what conditions?

Comment thread components/src/dynamo/vllm/multimodal_utils/threaded_micro_batcher.py Outdated
Add a supervised, thread-affine micro-batcher and route AsyncVisionEncoder forwards through it. Preserve preprocess atomicity while making lifecycle, failures, and teardown deterministic.

Signed-off-by: Qi Wang <qiwa@nvidia.com>

@devin-ai-integration devin-ai-integration Bot 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.

Devin Review found 1 new potential issue.

Open in Devin Review

Comment thread docs/features/multimodal/custom-vision-encoder.md
@furionw

furionw commented Jul 15, 2026

Copy link
Copy Markdown
Contributor Author

addressed comments by changing code and added docs

@furionw

furionw commented Jul 15, 2026

Copy link
Copy Markdown
Contributor Author

/ok to test 0392783

@github-actions

Copy link
Copy Markdown
Contributor

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

Labels

backend::vllm Relates to the vllm backend documentation Improvements or additions to documentation feat multimodal size/XXL

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants