[TRTLLM-10858][feat] Multi-image support for EPD disagg#11264
[TRTLLM-10858][feat] Multi-image support for EPD disagg#112642ez4bz wants to merge 1 commit intoNVIDIA:mainfrom
Conversation
📝 WalkthroughWalkthroughThe 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
Estimated code review effort🎯 4 (Complex) | ⏱️ ~50 minutes Possibly related PRs
Suggested reviewers
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
Important Action Needed: IP Allowlist UpdateIf your organization protects your Git platform with IP whitelisting, please add the new CodeRabbit IP address to your allowlist:
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. Comment |
There was a problem hiding this comment.
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 | 🟠 MajorDon’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 | 🟡 MinorUpdate
mm_handlesdocstring 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 | 🟡 MinorUpdate
mm_handlesdocstring 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.
5f13d0c to
da3acd5
Compare
|
/bot run --disable-fail-fast |
|
PR_Github #34834 [ run ] triggered by Bot. Commit: |
|
PR_Github #34834 [ run ] completed with state
|
| # requests. | ||
| cache_transceiver_cfg = CacheTransceiverConfig( | ||
| backend="DEFAULT") if pd_disagg else None | ||
| backend="DEFAULT", max_tokens_in_buffer=10240) if pd_disagg else None |
There was a problem hiding this comment.
Do you think it’s in general necessary to set max_tokens_in_buffer for EPD applications? If so, could we improve the error handling when it’s not explicitly set (e.g., provide a clearer error or default behavior)?
There was a problem hiding this comment.
I was actually going to ask you about this as well. If configured incorrectly, it seems to be causing issues in the decode worker - so how is this usually handled in P/D disagg for LLMs? Do we also need to tune this wrt to the maximum input sequence length?
I can certainly look into improving the error message, but do you mind if this is done in a subsequent PR?
* 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. Signed-off-by: William Zhang <133824995+2ez4bz@users.noreply.github.com>
da3acd5 to
d66918f
Compare
|
/bot run --disable-fail-fast |
|
PR_Github #34938 [ run ] triggered by Bot. Commit: |
|
PR_Github #34938 [ run ] completed with state
|
Summary by CodeRabbit
New Features
Bug Fixes
Tests
Description
Prior to this commit, we only supported a single multimodal input for E/P/D disaggregated serving.
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 thestage-listparameter 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.mdand the
scripts/test_to_stage_mapping.pyhelper.kill
killKill all running builds associated with pull request.
skip
skip --comment COMMENTSkip 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-pipelineReuse 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.