-
Notifications
You must be signed in to change notification settings - Fork 563
add ut of fused_moe.py #1930
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
add ut of fused_moe.py #1930
Conversation
7c72764 to
48bb07b
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #1930 +/- ##
==========================================
+ Coverage 60.24% 65.08% +4.83%
==========================================
Files 73 76 +3
Lines 8004 8274 +270
==========================================
+ Hits 4822 5385 +563
+ Misses 3182 2889 -293
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
da539f2 to
46fba39
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds comprehensive unit tests for the fused_moe.py module in the vLLM Ascend project. The tests cover the AscendFusedMoE class and AscendUnquantizedFusedMoEMethod with various configurations and execution paths.
- Adds test coverage for fused MoE operations including initialization, forward passes, and weight processing
- Implements extensive mocking infrastructure for distributed training and NPU-specific operations
- Provides parameterized tests for different MoE configurations including expert parallelism and routing methods
tests/ut/ops/test_fused_ops.py
Outdated
| def test_init_with_quant(self, mock_dist_env, default_moe_config): | ||
| mock_quant_config = MagicMock() | ||
| mock_quant_method = MagicMock() | ||
| mock_quant_config.get_quant_mothod.return_value = mock_quant_method |
Copilot
AI
Jul 23, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is a typo in the method name 'get_quant_mothod'. It should be 'get_quant_method'.
| mock_quant_config.get_quant_mothod.return_value = mock_quant_method | |
| mock_quant_config.get_quant_method.return_value = mock_quant_method |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
update
| """ | ||
| global_num_experts, ep_size, select_softmax = others_param | ||
| with patch( | ||
| "vllm_ascend.ops.fused_moe.SELECT_GATING_TOPK_SOTFMAX_EXPERTS", |
Copilot
AI
Jul 23, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is a typo in 'SOTFMAX_EXPERTS'. It should be 'SOFTMAX_EXPERTS'.
| "vllm_ascend.ops.fused_moe.SELECT_GATING_TOPK_SOTFMAX_EXPERTS", | |
| "vllm_ascend.ops.fused_moe.SELECT_GATING_TOPK_SOFTMAX_EXPERTS", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
origin param is wrong spelling
Signed-off-by: yangcheng <[email protected]>
|
lgtm |
|
@yiz-liu please consider update this file as well in the future once you refactor fused moe code. |
### What this PR does / why we need it? add unit test for fused_moe.py - vLLM version: v0.9.2 - vLLM main: vllm-project/vllm@2dec7c1 Signed-off-by: yangcheng <[email protected]> Co-authored-by: yangcheng <[email protected]>
### What this PR does / why we need it? add unit test for fused_moe.py - vLLM version: v0.9.2 - vLLM main: vllm-project/vllm@2dec7c1 Signed-off-by: yangcheng <[email protected]> Co-authored-by: yangcheng <[email protected]>
What this PR does / why we need it?
test for fused_moe.py
Does this PR introduce any user-facing change?
How was this patch tested?