Skip to content

Conversation

jinyangyuan-nvidia
Copy link
Collaborator

@jinyangyuan-nvidia jinyangyuan-nvidia commented Jul 18, 2025

Different ranks may have different batch sizes. Using the same value on all ranks is needed to fix a bug caused by it.

@jinyangyuan-nvidia jinyangyuan-nvidia self-assigned this Jul 18, 2025
@jinyangyuan-nvidia jinyangyuan-nvidia requested a review from a team as a code owner July 18, 2025 06:35
Copy link
Contributor

coderabbitai bot commented Jul 18, 2025

Walkthrough

The can_use_alltoall method in the WideEPMoE class was refactored to accept all_rank_num_tokens and all_rank_max_num_tokens as arguments, removing its dependency on the input tensor's shape. The forward method was updated to match the new signature, ensuring token count checks use explicit parameters.

Changes

File(s) Change Summary
tensorrt_llm/_torch/modules/fused_moe/fused_moe_wide_ep.py Refactored can_use_alltoall method signature and logic to use token count parameters directly. Updated forward method to match.

Poem

A method once peered at tensor shape,
Now counts its tokens, wide awake.
With arguments clear, no input to see,
The code hops forward, dependency-free.
🐇✨


📜 Recent review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c0e4165 and c305ce6.

📒 Files selected for processing (1)
  • tensorrt_llm/_torch/modules/fused_moe/fused_moe_wide_ep.py (2 hunks)
🔇 Additional comments (4)
tensorrt_llm/_torch/modules/fused_moe/fused_moe_wide_ep.py (4)

286-286: Good refactoring to remove unnecessary input tensor dependency.

The method signature change improves the interface by making it explicit that only token count parameters are needed, not the entire input tensor.


293-293: Consistent logic update for the new method signature.

The use of all_rank_max_num_tokens parameter is consistent with the updated method signature and maintains the same logical behavior.


762-763: Correct method call update matching the new signature.

The method call properly passes the required token count parameters instead of the input tensor, which aligns with the refactored method signature.


286-286: Well-executed refactoring that improves method interface.

This refactoring successfully removes the unnecessary dependency on the input tensor while maintaining the same logical behavior. The changes are consistent across the method signature, implementation, and usage, resulting in a cleaner and more maintainable interface.

Also applies to: 293-293, 762-763

✨ Finishing Touches
  • 📝 Generate Docstrings

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@jinyangyuan-nvidia
Copy link
Collaborator Author

/bot run

@tensorrt-cicd
Copy link
Collaborator

PR_Github #12289 [ run ] triggered by Bot

@tensorrt-cicd
Copy link
Collaborator

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

@jinyangyuan-nvidia jinyangyuan-nvidia merged commit 88076ee into NVIDIA:main Jul 21, 2025
3 checks passed
@jinyangyuan-nvidia jinyangyuan-nvidia deleted the dev/fix_wide_ep branch July 21, 2025 02:53
reasonsolo pushed a commit to reasonsolo/TensorRT-LLM that referenced this pull request Jul 21, 2025
timlee0212 pushed a commit to timlee0212/TensorRT-LLM that referenced this pull request Jul 21, 2025
NVShreyas pushed a commit to NVShreyas/TensorRT-LLM that referenced this pull request Jul 28, 2025
Ransiki pushed a commit to Ransiki/TensorRT-LLM that referenced this pull request Jul 29, 2025
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.

3 participants