Skip to content

[BUG fix] solve the CI bug of router fusion #1944

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

Autumn1998
Copy link
Contributor

Description

Fixes for Router Fusion:

  1. Corrected kernel dispatching issue on SM90 architecture.
  2. Resolved CI bug by using properly constructed input data in unit tests.
  3. Fixed bug occurring when MBS > 1.

Fixes # (issue)

Type of change

  • Documentation change (change only to the documentation, either a fix or a new content)
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Infra/Build change
  • Code refactoring

Changes

Please list the changes introduced in this PR:

  • Change A
  • Change B

Checklist:

  • I have read and followed the contributing guidelines
  • The functionality is complete
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

tongliu and others added 5 commits July 10, 2025 22:41
Signed-off-by: tongliu <tongliu@nvidia.com>
Signed-off-by: tongliu <tongliu@nvidia.com>
Signed-off-by: tongliu <tongliu@nvidia.com>
@timmoon10
Copy link
Collaborator

/te-ci pytorch

@timmoon10 timmoon10 added the bug Something isn't working label Jul 11, 2025
Copy link
Collaborator

@timmoon10 timmoon10 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Overall LGTM, thanks for the fix!

Comment on lines +151 to +156
# Construct the special logits to avoid inf in the sigmoid function
logits = 1 + torch.arange(num_experts, device="cuda", dtype=dtype) * 0.01
logits = logits.unsqueeze(0).repeat(num_tokens, 1)
random_values = torch.rand(num_tokens, num_experts, device="cuda")
_, indices = torch.sort(random_values, dim=1)
logits = torch.gather(logits, 1, indices)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you explain how this helps avoid infs? Was the problem that logits became too large, causing sigmoid to output 1.0 in multiple entries? Also, I don't understand the benefit from forcing logits >= 1. Previously we had logits >= 0 and sigmoid(0) = 0.5, so I wouldn't expect us to have had divide-by-zero problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants