Skip to content

[TRTLLM-10858][feat] Multi-image support for EPD disagg - #11264

Merged
2ez4bz merged 1 commit into
NVIDIA:mainfrom
2ez4bz:dev-epd-multi-images
Feb 12, 2026
Merged

[TRTLLM-10858][feat] Multi-image support for EPD disagg#11264
2ez4bz merged 1 commit into
NVIDIA:mainfrom
2ez4bz:dev-epd-multi-images

Conversation

@2ez4bz

@2ez4bz 2ez4bz commented Feb 4, 2026

Copy link
Copy Markdown
Collaborator

Summary by CodeRabbit

  • New Features

    • Added support for multiple multimodal items (e.g., multiple images) in a single request, replacing the previous single-item limitation.
  • Bug Fixes

    • Enhanced validation for multimodal embeddings with per-item error reporting to identify specific mismatches.
  • Tests

    • Updated multimodal embedding tests to verify multi-item scenarios and parametrization improvements.

Description

  • Why?

Prior to this commit, we only supported a single multimodal input for E/P/D disaggregated serving.

  • What?

This commit does a minor refactor of the multimodal embedding handles that cross process boundaries to enable this.
Existing unit tests are updated accordingly to test this.

Test Coverage

Adjusted existing unit tests to use multiple images in a single request.

PR Checklist

Please review the following before submitting your PR:

  • PR description clearly explains what and why. If using CodeRabbit's summary, please make sure it makes sense.

  • PR Follows TRT-LLM CODING GUIDELINES to the best of your knowledge.

  • Test cases are provided for new code paths (see test instructions)

  • Any new dependencies have been scanned for license and vulnerabilities

  • CODEOWNERS updated if ownership changes

  • Documentation updated as needed

  • Update tava architecture diagram if there is a significant design change in PR.

  • The reviewers assigned automatically/manually are appropriate for the PR.

  • Please check this after reviewing the above items as appropriate for this PR.

GitHub Bot Help

/bot [-h] ['run', 'kill', 'skip', 'reuse-pipeline'] ...

Provide a user friendly way for developers to interact with a Jenkins server.

Run /bot [-h|--help] to print this help message.

See details below for each supported subcommand.

Details

run [--reuse-test (optional)pipeline-id --disable-fail-fast --skip-test --stage-list "A10-PyTorch-1, xxx" --gpu-type "A30, H100_PCIe" --test-backend "pytorch, cpp" --add-multi-gpu-test --only-multi-gpu-test --disable-multi-gpu-test --post-merge --extra-stage "H100_PCIe-TensorRT-Post-Merge-1, xxx" --detailed-log --debug(experimental)]

Launch build/test pipelines. All previously running jobs will be killed.

--reuse-test (optional)pipeline-id (OPTIONAL) : Allow the new pipeline to reuse build artifacts and skip successful test stages from a specified pipeline or the last pipeline if no pipeline-id is indicated. If the Git commit ID has changed, this option will be always ignored. The DEFAULT behavior of the bot is to reuse build artifacts and successful test results from the last pipeline.

--disable-reuse-test (OPTIONAL) : Explicitly prevent the pipeline from reusing build artifacts and skipping successful test stages from a previous pipeline. Ensure that all builds and tests are run regardless of previous successes.

--disable-fail-fast (OPTIONAL) : Disable fail fast on build/tests/infra failures.

--skip-test (OPTIONAL) : Skip all test stages, but still run build stages, package stages and sanity check stages. Note: Does NOT update GitHub check status.

--stage-list "A10-PyTorch-1, xxx" (OPTIONAL) : Only run the specified test stages. Examples: "A10-PyTorch-1, xxx". Note: Does NOT update GitHub check status.

--gpu-type "A30, H100_PCIe" (OPTIONAL) : Only run the test stages on the specified GPU types. Examples: "A30, H100_PCIe". Note: Does NOT update GitHub check status.

--test-backend "pytorch, cpp" (OPTIONAL) : Skip test stages which don't match the specified backends. Only support [pytorch, cpp, tensorrt, triton]. Examples: "pytorch, cpp" (does not run test stages with tensorrt or triton backend). Note: Does NOT update GitHub pipeline status.

--only-multi-gpu-test (OPTIONAL) : Only run the multi-GPU tests. Note: Does NOT update GitHub check status.

--disable-multi-gpu-test (OPTIONAL) : Disable the multi-GPU tests. Note: Does NOT update GitHub check status.

--add-multi-gpu-test (OPTIONAL) : Force run the multi-GPU tests in addition to running L0 pre-merge pipeline.

--post-merge (OPTIONAL) : Run the L0 post-merge pipeline instead of the ordinary L0 pre-merge pipeline.

--extra-stage "H100_PCIe-TensorRT-Post-Merge-1, xxx" (OPTIONAL) : Run the ordinary L0 pre-merge pipeline and specified test stages. Examples: --extra-stage "H100_PCIe-TensorRT-Post-Merge-1, xxx".

--detailed-log (OPTIONAL) : Enable flushing out all logs to the Jenkins console. This will significantly increase the log volume and may slow down the job.

--debug (OPTIONAL) : Experimental feature. Enable access to the CI container for debugging purpose. Note: Specify exactly one stage in the stage-list parameter to access the appropriate container environment. Note: Does NOT update GitHub check status.

For guidance on mapping tests to stage names, see docs/source/reference/ci-overview.md
and the scripts/test_to_stage_mapping.py helper.

kill

kill

Kill all running builds associated with pull request.

skip

skip --comment COMMENT

Skip testing for latest commit on pull request. --comment "Reason for skipping build/test" is required. IMPORTANT NOTE: This is dangerous since lack of user care and validation can cause top of tree to break.

reuse-pipeline

reuse-pipeline

Reuse a previous pipeline to validate current commit. This action will also kill all currently running builds associated with the pull request. IMPORTANT NOTE: This is dangerous since lack of user care and validation can cause top of tree to break.

@2ez4bz
2ez4bz requested review from a team as code owners February 4, 2026 07:28
@coderabbitai

coderabbitai Bot commented Feb 4, 2026

Copy link
Copy Markdown
Contributor
📝 Walkthrough

Walkthrough

The PR refactors multimodal embedding handling to support multiple multimodal items per request instead of a single item. Changes include updating model input processors to validate multiple handles, converting embedding storage from single dict to list-based structures, updating result handling to use disaggregated parameters, and adjusting tests and API surfaces accordingly.

Changes

Cohort / File(s) Summary
Model Input Processors
tensorrt_llm/_torch/models/modeling_llava_next.py, modeling_qwen2vl.py, modeling_qwen3vl.py
Updated get_prompt_token_ids to validate multiple multimodal handles instead of enforcing exactly one. Each handle's hidden size is checked against model expectations with per-handle error reporting. Removed NotImplementedError constraints.
Embedding Request Handling
tensorrt_llm/_torch/pyexecutor/llm_request.py
Refactored mm_embeddings attribute to hold Optional[List[Dict[str, Any]]] instead of single dict. append_mm_embeddings now accepts multimodal_lengths parameter and splits concatenated embeddings into per-item chunks, storing as a list via SharedTensorContainer. Updated mm_embedding_handle property return type accordingly.
Sampler Integration
tensorrt_llm/_torch/pyexecutor/sampler.py
Updated call to append_mm_embeddings to pass multimodal_lengths parameter, enabling per-modality length handling during batching.
Result Handling
tensorrt_llm/executor/result.py
Changed mm_embedding_handle property to return Optional[List[Dict[str, Any]]] and retrieve from disaggregated_params.multimodal_embedding_handles instead of private attribute. Removed _mm_embedding_handle storage, updated _handle_response to use disaggregated parameters structure.
Public API Updates
tensorrt_llm/llmapi/llm.py
Replaced mm_embedding_handle attribute with disaggregated_params of type DisaggregatedParams in RequestOutput class. Updated documentation and representation fields.
Server Integration
tensorrt_llm/serve/openai_server.py
Updated openai_mm_encoder to read embedding handle from promise.disaggregated_params.multimodal_embedding_handles[0] when available, replacing direct mm_embedding_handle access.
Tests and API Reference
tests/unittest/_torch/multimodal/test_mm_encoder_standalone.py, tests/unittest/api_stability/references_committed/request_output.yaml
Updated test parametrization to handle multiple images and list-based embedding handles. Restructured test logic to reconstruct and concatenate embeddings from handle lists. Updated API stability reference to reflect disaggregated_params property change.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~50 minutes

Possibly related PRs

Suggested reviewers

  • chuangz0
  • hchings
  • dongjiyingdjy
  • yechank-nvidia
  • pcastonguay
  • symphonylyh
🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 41.67% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and specifically describes the main change: adding multi-image support for E/P/D disaggregation, which aligns with the refactoring of multimodal embedding handles across the changeset.
Description check ✅ Passed The description provides a clear problem statement (single multimodal input limitation), explains the solution (refactoring multimodal embedding handles), and lists test coverage (multiple images in single request), but lacks some expected template sections.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Important

Action Needed: IP Allowlist Update

If your organization protects your Git platform with IP whitelisting, please add the new CodeRabbit IP address to your allowlist:

  • 136.113.208.247/32 (new)
  • 34.170.211.100/32
  • 35.222.179.152/32

Reviews will stop working after February 8, 2026 if the new IP is not added to your allowlist.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

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

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

Actionable comments posted: 0

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (3)
tensorrt_llm/serve/openai_server.py (1)

624-635: ⚠️ Potential issue | 🟠 Major

Don’t drop additional multimodal handles in the MM‑encoder response.
Selecting index 0 silently loses embeddings for multi‑image requests and undercounts tokens. Please return all handles (and update the response schema accordingly) or explicitly reject multi‑image inputs. Also sum tokens across handles.

🔧 Possible fix (return all handles and sum tokens)
-            mm_embedding_handle = (
-                promise.disaggregated_params.multimodal_embedding_handles[0]
-                if promise.disaggregated_params
-                and promise.disaggregated_params.multimodal_embedding_handles
-                else None
-            )
-            if not mm_embedding_handle or "tensor_size" not in mm_embedding_handle:
+            mm_embedding_handles = (
+                promise.disaggregated_params.multimodal_embedding_handles
+                if promise.disaggregated_params
+                else None
+            )
+            if not mm_embedding_handles:
                 return self.create_error_response(
                     message="Multimodal embedding handle missing in response",
                     err_type="InternalServerError",
                     status_code=HTTPStatus.INTERNAL_SERVER_ERROR)
-            num_tokens = int(mm_embedding_handle["tensor_size"][0])
+            if any("tensor_size" not in h for h in mm_embedding_handles):
+                return self.create_error_response(
+                    message="Multimodal embedding handle missing tensor_size",
+                    err_type="InternalServerError",
+                    status_code=HTTPStatus.INTERNAL_SERVER_ERROR)
+            mm_embedding_handle = (
+                mm_embedding_handles[0]
+                if len(mm_embedding_handles) == 1
+                else mm_embedding_handles
+            )
+            num_tokens = sum(int(h["tensor_size"][0]) for h in mm_embedding_handles)
tensorrt_llm/_torch/models/modeling_qwen3vl.py (1)

355-388: ⚠️ Potential issue | 🟡 Minor

Update mm_handles docstring for multi-handle support.

The docstring still claims only a single handle is supported, but the loop now validates multiple handles. This is misleading for API users.

📝 Suggested docstring tweak
-            mm_handles: List of multimodal embedding handles. Currently only a single handle is supported.
+            mm_handles: List of multimodal embedding handles, one per multimodal item.
tensorrt_llm/_torch/models/modeling_llava_next.py (1)

170-201: ⚠️ Potential issue | 🟡 Minor

Update mm_handles docstring for multi-handle support.

The docstring still states that only a single handle is supported, but the code now validates all handles. Please update the description to match behavior.

📝 Suggested docstring tweak
-            mm_handles: List of multimodal embedding handles. Currently only a single handle is supported.
+            mm_handles: List of multimodal embedding handles, one per multimodal item.
🧹 Nitpick comments (1)
tensorrt_llm/_torch/models/modeling_qwen2vl.py (1)

1055-1086: Update the docstring to reflect multi‑handle support.
The argument description still states a single handle, but the code now accepts multiple.

✏️ Docstring update
-            mm_handles: List of multimodal embedding handles. Currently only a single handle is supported.
+            mm_handles: List of multimodal embedding handles, one per multimodal item.

@2ez4bz
2ez4bz force-pushed the dev-epd-multi-images branch 2 times, most recently from 5f13d0c to da3acd5 Compare February 4, 2026 18:34
@2ez4bz

2ez4bz commented Feb 4, 2026

Copy link
Copy Markdown
Collaborator Author

/bot run --disable-fail-fast

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #34834 [ run ] triggered by Bot. Commit: da3acd5

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #34834 [ run ] completed with state SUCCESS. Commit: da3acd5
/LLM/main/L0_MergeRequest_PR pipeline #26873 completed with status: 'FAILURE'

⚠️ Action Required:

  • Please check the failed tests and fix your PR
  • If you cannot view the failures, ask the CI triggerer to share details
  • Once fixed, request an NVIDIA team member to trigger CI again

@yechank-nvidia yechank-nvidia 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.

LGTM

Comment thread tests/unittest/_torch/multimodal/test_mm_encoder_standalone.py Outdated

@chang-l chang-l 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.

Thanks for the effort!

Comment thread tests/unittest/_torch/multimodal/test_mm_encoder_standalone.py
Comment thread tensorrt_llm/executor/result.py Outdated
@2ez4bz
2ez4bz force-pushed the dev-epd-multi-images branch from da3acd5 to d66918f Compare February 5, 2026 07:27
@2ez4bz
2ez4bz requested a review from a team as a code owner February 5, 2026 07:27
@2ez4bz

2ez4bz commented Feb 5, 2026

Copy link
Copy Markdown
Collaborator Author

/bot run --disable-fail-fast

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #34938 [ run ] triggered by Bot. Commit: d66918f

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #34938 [ run ] completed with state SUCCESS. Commit: d66918f
/LLM/main/L0_MergeRequest_PR pipeline #26954 completed with status: 'FAILURE'

⚠️ Action Required:

  • Please check the failed tests and fix your PR
  • If you cannot view the failures, ask the CI triggerer to share details
  • Once fixed, request an NVIDIA team member to trigger CI again

Comment thread tensorrt_llm/executor/result.py
@2ez4bz
2ez4bz force-pushed the dev-epd-multi-images branch from ba352b1 to addfc3d Compare February 5, 2026 20:27
@2ez4bz

2ez4bz commented Feb 5, 2026

Copy link
Copy Markdown
Collaborator Author

/bot run --disable-fail-fast

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #35006 [ run ] triggered by Bot. Commit: addfc3d

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #35006 [ run ] completed with state FAILURE. Commit: addfc3d
/LLM/main/L0_MergeRequest_PR pipeline #27010 completed with status: 'FAILURE'

⚠️ Action Required:

  • Please check the failed tests and fix your PR
  • If you cannot view the failures, ask the CI triggerer to share details
  • Once fixed, request an NVIDIA team member to trigger CI again

@2ez4bz

2ez4bz commented Feb 6, 2026

Copy link
Copy Markdown
Collaborator Author

/bot run --disable-fail-fast

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

LGTM

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #35072 [ run ] completed with state SUCCESS. Commit: addfc3d
/LLM/main/L0_MergeRequest_PR pipeline #27068 completed with status: 'SUCCESS'
Pipeline passed with automatic retried tests. Check the rerun report for details.

@2ez4bz
2ez4bz force-pushed the dev-epd-multi-images branch from addfc3d to 322a258 Compare February 7, 2026 06:53
@2ez4bz

2ez4bz commented Feb 7, 2026

Copy link
Copy Markdown
Collaborator Author

/bot run --disable-fail-fast

@2ez4bz
2ez4bz enabled auto-merge (squash) February 7, 2026 06:55
@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #35177 [ run ] triggered by Bot. Commit: 322a258

@2ez4bz
2ez4bz requested a review from a team February 7, 2026 07:02
@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #35177 [ run ] completed with state SUCCESS. Commit: 322a258
/LLM/main/L0_MergeRequest_PR pipeline #27166 completed with status: 'FAILURE'

⚠️ Action Required:

  • Please check the failed tests and fix your PR
  • If you cannot view the failures, ask the CI triggerer to share details
  • Once fixed, request an NVIDIA team member to trigger CI again

@2ez4bz

2ez4bz commented Feb 8, 2026

Copy link
Copy Markdown
Collaborator Author

/bot run --disable-fail-fast

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #35223 [ run ] triggered by Bot. Commit: 322a258

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #35223 [ run ] completed with state SUCCESS. Commit: 322a258
/LLM/main/L0_MergeRequest_PR pipeline #27210 completed with status: 'FAILURE'

⚠️ Action Required:

  • Please check the failed tests and fix your PR
  • If you cannot view the failures, ask the CI triggerer to share details
  • Once fixed, request an NVIDIA team member to trigger CI again

@2ez4bz

2ez4bz commented Feb 8, 2026

Copy link
Copy Markdown
Collaborator Author

/bot run --disable-fail-fast

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #35249 [ run ] triggered by Bot. Commit: 322a258

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #35249 [ run ] completed with state DISABLED
CI server is currently disabled for scheduled maintenance. Estimated completion time: 6 PM PST on 2/8.

@2ez4bz

2ez4bz commented Feb 9, 2026

Copy link
Copy Markdown
Collaborator Author

/bot run --disable-fail-fast

1 similar comment
@2ez4bz

2ez4bz commented Feb 10, 2026

Copy link
Copy Markdown
Collaborator Author

/bot run --disable-fail-fast

* Why?

Prior to this commit, we only supported a single multimodal input for
E/P/D disaggregated serving.

* What?

This commit does a minor refactor of the multimodal embedding handles
that cross process boundaries to enable this.
Existing unit tests are updated accordingly to test this.

The `RequestOutput` has its `mm_embedding_handle` replaced in favor of
`disaggregated_params`, addressing a previous TODO.

Signed-off-by: William Zhang <133824995+2ez4bz@users.noreply.github.com>
@2ez4bz
2ez4bz force-pushed the dev-epd-multi-images branch from 322a258 to e3a6b07 Compare February 10, 2026 18:04
@2ez4bz

2ez4bz commented Feb 10, 2026

Copy link
Copy Markdown
Collaborator Author

/bot run --disable-fail-fast

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #35531 [ run ] triggered by Bot. Commit: e3a6b07

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #35531 [ run ] completed with state SUCCESS. Commit: e3a6b07
/LLM/main/L0_MergeRequest_PR pipeline #27437 completed with status: 'FAILURE'

⚠️ Action Required:

  • Please check the failed tests and fix your PR
  • If you cannot view the failures, ask the CI triggerer to share details
  • Once fixed, request an NVIDIA team member to trigger CI again

@2ez4bz

2ez4bz commented Feb 11, 2026

Copy link
Copy Markdown
Collaborator Author

/bot run --disable-fail-fast

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #35582 [ run ] triggered by Bot. Commit: e3a6b07

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #35582 [ run ] completed with state SUCCESS. Commit: e3a6b07
/LLM/main/L0_MergeRequest_PR pipeline #27483 completed with status: 'FAILURE'

⚠️ Action Required:

  • Please check the failed tests and fix your PR
  • If you cannot view the failures, ask the CI triggerer to share details
  • Once fixed, request an NVIDIA team member to trigger CI again

@2ez4bz

2ez4bz commented Feb 11, 2026

Copy link
Copy Markdown
Collaborator Author

/bot run --disable-fail-fast

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #35665 [ run ] triggered by Bot. Commit: e3a6b07

@tensorrt-cicd

Copy link
Copy Markdown
Collaborator

PR_Github #35665 [ run ] completed with state SUCCESS. Commit: e3a6b07
/LLM/main/L0_MergeRequest_PR pipeline #27544 completed with status: 'SUCCESS'

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

LGTM

@2ez4bz
2ez4bz merged commit ca9537e into NVIDIA:main Feb 12, 2026
5 checks passed
ekou24 pushed a commit to ekou24/TensorRT-LLM that referenced this pull request Feb 16, 2026
* Why?

Prior to this commit, we only supported a single multimodal input for
E/P/D disaggregated serving.

* What?

This commit does a minor refactor of the multimodal embedding handles
that cross process boundaries to enable this.
Existing unit tests are updated accordingly to test this.

The `RequestOutput` has its `mm_embedding_handle` replaced in favor of
`disaggregated_params`, addressing a previous TODO.

Signed-off-by: William Zhang <133824995+2ez4bz@users.noreply.github.com>
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.

9 participants