Skip to content

add fused_deep_moe test for dispatch_ffn_combine#400

Open
zuje123 wants to merge 2 commits intosgl-project:mainfrom
zuje123:br_deep_fused_moe_test
Open

add fused_deep_moe test for dispatch_ffn_combine#400
zuje123 wants to merge 2 commits intosgl-project:mainfrom
zuje123:br_deep_fused_moe_test

Conversation

@zuje123
Copy link
Copy Markdown
Collaborator

@zuje123 zuje123 commented Mar 18, 2026

Add precision and performance tests for the dispatch_ffn_combine kernel.

Config:
num_ranks=16, num_tokens=256, hidden=7168, moe_intermediate_size=4096, num_topk=8, num_experts=256
Performance:
[Rank 0] baseline_time= 1397.98 us, fused2_moe_time= 1018.74 us
[Rank 14] baseline_time= 1396.71 us, fused2_moe_time= 1018.92 us
[Rank 2] baseline_time= 1397.98 us, fused2_moe_time= 1018.96 us
[Rank 1] baseline_time= 1397.91 us, fused2_moe_time= 1018.72 us
[Rank 12] baseline_time= 1397.32 us, fused2_moe_time= 1018.70 us
[Rank 4] baseline_time= 1397.52 us, fused2_moe_time= 1018.96 us
[Rank 9] baseline_time= 1396.74 us, fused2_moe_time= 1018.61 us
[Rank 10] baseline_time= 1396.40 us, fused2_moe_time= 1018.79 us
[Rank 5] baseline_time= 1396.78 us, fused2_moe_time= 1018.89 us
[Rank 7] baseline_time= 1397.38 us, fused2_moe_time= 1018.79 us
[Rank 3] baseline_time= 1397.37 us, fused2_moe_time= 1018.70 us
[Rank 13] baseline_time= 1397.14 us, fused2_moe_time= 1018.64 us
[Rank 11] baseline_time= 1397.46 us, fused2_moe_time= 1019.02 us
[Rank 6] baseline_time= 1396.93 us, fused2_moe_time= 1018.82 us

@gemini-code-assist
Copy link
Copy Markdown
Contributor

Summary of Changes

Hello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request introduces a dedicated test for the dispatch_ffn_combine kernel, which is a component of the fused_deep_moe operation. The primary goal is to ensure the kernel's numerical precision and to benchmark its performance against a step-by-step baseline implementation. The changes include new utility functions for test setup, a detailed comparison logic, and performance measurements, ultimately showing a substantial speedup for the fused operation.

Highlights

  • New Test for dispatch_ffn_combine: A new test suite has been added to validate the dispatch_ffn_combine kernel, focusing on both precision and performance.
  • Precision and Performance Benchmarking: The new test includes a comprehensive comparison between a baseline implementation and the fused_deep_moe kernel in dispatch_ffn_combine mode, demonstrating significant performance improvements (e.g., from ~1400 us to ~1000 us).
  • Weight Initialization and Utility Functions: Several helper functions (init_base_weights, init_baseline_weights, init_fused2_weights_int8, scale_from_float_to_int64, make_uniform_topk_idx, from_inclusive_prefix_sum) were introduced to streamline weight setup and data manipulation for the tests.
  • Configurable Active Ranks and Debugging: New command-line arguments --active-ranks and --debug were added to allow for more flexible testing configurations and detailed logging.

🧠 New Feature in Public Preview: You can now enable Memory to help Gemini Code Assist learn from your team's feedback. This makes future code reviews more consistent and personalized to your project's style. Click here to enable Memory in your admin console.

Ignored Files
  • Ignored by pattern: .github/workflows/** (1)
    • .github/workflows/pr-test-npu.yml
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Copy Markdown
Contributor

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request introduces a comprehensive test for the dispatch_ffn_combine kernel, including both precision and performance evaluations against a baseline. It also includes refactoring of the existing test_fused_deep_moe.py to align with the new test structure and apply some correctness fixes. The changes add valuable test coverage. My review includes suggestions to improve code quality and maintainability by addressing a local import, the use of magic numbers, and a redundant process group creation.

Comment thread tests/python/deepep/test_dispatch_ffn_combine.py
Comment thread tests/python/deepep/test_dispatch_ffn_combine.py
Comment thread tests/python/deepep/test_dispatch_ffn_combine.py
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.

1 participant