[None][fix] AutoDeploy: handle torch dist all_gather in multi_stream MLA transform#15456
[None][fix] AutoDeploy: handle torch dist all_gather in multi_stream MLA transform#15456MrGeva wants to merge 2 commits into
Conversation
Pattern 0 was rebuilding KV all_gather with the trtllm argument layout for every backend. Branch on the op type so torch_dist_all_gather keeps its (tensor, dim, sizes) signature while trtllm_dist_all_gather still gets workspace_id on the aux stream. Signed-off-by: Eran Geva <19514940+MrGeva@users.noreply.github.com> Co-authored-by: Cursor <cursoragent@cursor.com>
📝 WalkthroughWalkthroughA new private helper ChangesAux-stream all_gather argument builder
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
tensorrt_llm/_torch/auto_deploy/transform/library/multi_stream_attn.py (1)
188-189: 💤 Low valuePrefer tuple unpacking over concatenation.
The static analysis tool suggests a cleaner form. Since
kv_ag.argsis already a tuple, unpacking is more idiomatic and avoids the redundanttuple()call.♻️ Suggested simplification
# torch_dist_all_gather — preserve dim/sizes, no strategy or workspace_id. - return (new_input,) + tuple(kv_ag.args[1:]) + return (new_input, *kv_ag.args[1:])🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@tensorrt_llm/_torch/auto_deploy/transform/library/multi_stream_attn.py` around lines 188 - 189, In the return statement, the code uses tuple concatenation with `(new_input,) + tuple(kv_ag.args[1:])` where the tuple() call is redundant since slicing kv_ag.args already returns a tuple. Replace this with tuple unpacking syntax using `(new_input, *kv_ag.args[1:])` which is more idiomatic and avoids the unnecessary tuple() conversion.Source: Linters/SAST tools
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@tensorrt_llm/_torch/auto_deploy/transform/library/multi_stream_attn.py`:
- Around line 188-189: In the return statement, the code uses tuple
concatenation with `(new_input,) + tuple(kv_ag.args[1:])` where the tuple() call
is redundant since slicing kv_ag.args already returns a tuple. Replace this with
tuple unpacking syntax using `(new_input, *kv_ag.args[1:])` which is more
idiomatic and avoids the unnecessary tuple() conversion.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Enterprise
Run ID: 1889c173-26d0-479c-a2aa-616179282cb9
📒 Files selected for processing (1)
tensorrt_llm/_torch/auto_deploy/transform/library/multi_stream_attn.py
Cover trtllm and torch dist all_gather arg rewriting for multi_stream MLA pattern 0 via hand-built FX graphs. Signed-off-by: Eran Geva <19514940+MrGeva@users.noreply.github.com> Co-authored-by: Cursor <cursoragent@cursor.com>
Pattern 0 was rebuilding KV all_gather with the trtllm argument layout for every backend. Branch on the op type so torch_dist_all_gather keeps its (tensor, dim, sizes) signature while trtllm_dist_all_gather still gets workspace_id on the aux stream.
Summary by CodeRabbit
Description
Test Coverage
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)
If PR introduces API changes, an appropriate PR label is added - either
api-compatibleorapi-breaking. Forapi-breaking, includeBREAKINGin the PR title.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
To see a list of available CI bot commands, please comment
/bot help.