Skip to content

Conversation

@lianakoleva
Copy link
Contributor

@lianakoleva lianakoleva commented Oct 28, 2025

Motivation

Since the tuning_fused_moe_triton.py script may be used when working backwards from the following warning, and the tuning process can take some time, it would be helpful to preview the filename of the generated config to ensure that the desired one is being created:

[2025-10-28 09:42:18 TP0] Using default MoE kernel config. Performance might be sub-optimal! Config file not found at /sgl-workspace/sglang/python/sglang/srt/layers/moe/fused_moe_triton/configs/triton_3_4_0/E=60,N=704,device_name=NVIDIA_B200,dtype=fp8_w8a8.json, you can create them with https://github.com/sgl-project/sglang/tree/main/benchmark/kernels/fused_moe_triton

Modifications

The filename now displays before the tuning begins:

~/sglang/benchmark/kernels/fused_moe_triton python tuning_fused_moe_triton.py --model Qwen/Qwen1.5-MoE-A2.7B --dtype fp8_w8a8 --tune 
Namespace(model='Qwen/Qwen1.5-MoE-A2.7B', tp_size=2, dtype='fp8_w8a8', per_channel_quant=False, seed=0, batch_size=None, tune=True, disable_shared_experts_fusion=False)
- Start tuning over 1920 configurations...
+ Start tuning over 1920 configurations to create E=60,N=704,device_name=NVIDIA_B200,dtype=fp8_w8a8.json...

Accuracy Tests

Benchmarking and Profiling

Checklist

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @lianakoleva, 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 enhances the user experience of the tuning_fused_moe_triton.py script by providing an early preview of the output configuration filename. This allows users to confirm the target file before initiating a potentially time-consuming tuning process, addressing a common pain point where the tuning process might complete only to reveal an incorrectly named output file.

Highlights

  • User Experience Improvement: The tuning_fused_moe_triton.py script now previews the generated configuration filename before the tuning process begins, allowing users to confirm the output file early.
  • Code Refactoring: The logic for generating the configuration filename has been extracted into a new get_filename function, separating it from the save_configs function, which now accepts the pre-generated filename.
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.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

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
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 refactors the tuning_fused_moe_triton.py script to preview the output configuration filename before starting the potentially long-running tuning process. The change is a good improvement for user experience. The refactoring splits the filename generation logic from the file saving logic into a new get_filename function. My review includes suggestions to improve the signature and type hinting of the new function for better code clarity and correctness.

Comment on lines +551 to +562
filename = get_filename(
E,
shard_intermediate_size,
hidden_size,
topk,
dtype,
use_fp8_w8a8,
use_int8_w8a8,
use_int8_w8a16,
per_channel_quant,
block_shape,
)
Copy link
Contributor

Choose a reason for hiding this comment

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

medium

To align with the suggested changes to the get_filename function signature, the unused arguments hidden_size and topk should be removed from this call.

        filename = get_filename(
            E,
            shard_intermediate_size,
            dtype,
            use_fp8_w8a8,
            use_int8_w8a8,
            use_int8_w8a16,
            per_channel_quant,
            block_shape,
        )

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Happy to make this change if desired, I just kept it close to the original

@lianakoleva lianakoleva changed the title feat: preview filename from tuning_fused_mode_triton.py feat: preview filename from tuning_fused_moe_triton.py Oct 28, 2025
Copy link
Collaborator

@BBuf BBuf left a comment

Choose a reason for hiding this comment

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

LGTM.

@BBuf BBuf added the run-ci label Oct 29, 2025
@BBuf BBuf merged commit 1357397 into sgl-project:main Oct 29, 2025
43 of 45 checks passed
hnyls2002 pushed a commit that referenced this pull request Oct 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants