Skip to content

[XPU] refactor moe ffn - #5501

Merged
zhupengyang merged 1 commit into
PaddlePaddle:developfrom
zhupengyang:moe_ffn
Dec 18, 2025
Merged

zhupengyang merged 1 commit into
PaddlePaddle:developfrom
zhupengyang:moe_ffn

Conversation

@zhupengyang

@zhupengyang zhupengyang commented Dec 11, 2025

Copy link
Copy Markdown
Collaborator

Motivation

💡 If this PR is a Cherry Pick, the PR title needs to follow the format by adding the [Cherry-Pick] label at the very beginning and appending the original PR ID at the end. For example, [Cherry-Pick][CI] Add check trigger and logic(#5191)

💡 如若此PR是Cherry Pick,PR标题需遵循格式,在最开始加上[Cherry-Pick]标签,以及最后面加上原PR ID,例如[Cherry-Pick][CI] Add check trigger and logic(#5191)

Modifications

  • remove BKCL_DISPATCH_ALL_GATHER
  • support sparse mode
  • support moe quant_method

Usage or Command

Accuracy Tests

Checklist

  • Add at least a tag in the PR title.
    • Tag list: [[FDConfig],[APIServer],[Engine], [Scheduler], [PD Disaggregation], [Executor], [Graph Optimization], [Speculative Decoding], [RL], [Models], [Quantization], [Loader], [OP], [KVCache], [DataProcessor], [BugFix], [Docs], [CI], [Optimization], [Feature], [Benchmark], [Others], [XPU], [HPU], [GCU], [DCU], [Iluvatar], [Metax]]
    • You can add new tags based on the PR content, but the semantics must be clear.
  • Format your code, run pre-commit before commit.
  • Add unit tests. Please write the reason in this PR if no unit tests.
  • Provide accuracy results.
  • If the current PR is submitting to the release branch, make sure the PR has been submitted to the develop branch, then cherry-pick it to the release branch with the [Cherry-Pick] PR tag.

@paddle-bot

paddle-bot Bot commented Dec 11, 2025

Copy link
Copy Markdown

Thanks for your contribution!

@codecov-commenter

codecov-commenter commented Dec 11, 2025

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 50.00000% with 3 lines in your changes missing coverage. Please review.
⚠️ Please upload report for BASE (develop@111955e). Learn more about missing BASE report.

Files with missing lines Patch % Lines
fastdeploy/model_executor/layers/moe/moe.py 66.66% 1 Missing ⚠️
...tdeploy/model_executor/layers/quantization/w4a8.py 0.00% 1 Missing ⚠️
.../model_executor/layers/quantization/weight_only.py 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             develop    #5501   +/-   ##
==========================================
  Coverage           ?   62.61%           
==========================================
  Files              ?      329           
  Lines              ?    41703           
  Branches           ?     6369           
==========================================
  Hits               ?    26114           
  Misses             ?    13615           
  Partials           ?     1974           
Flag Coverage Δ
GPU 62.61% <50.00%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

hong19860320
hong19860320 previously approved these changes Dec 12, 2025

@hong19860320 hong19860320 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM

heavengate
heavengate previously approved these changes Dec 17, 2025
yongqiangma
yongqiangma previously approved these changes Dec 17, 2025

@yongqiangma yongqiangma left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

LGTM

n_group=fd_config.model_config.n_group,
routed_scaling_factor=fd_config.model_config.routed_scaling_factor,
layer_idx=layer_id,
layer_id=layer_id,

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

不建议改这个,这里改了,内部仓库也需要适配

@zhupengyang zhupengyang Dec 17, 2025

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

done

"""
if self.layer_id < 0:
return
xpu_moe_ffn_quant_type_map = os.environ.get("XPU_MOE_FFN_QUANT_TYPE_MAP", "")

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

禁止私自添加环境变量,需要通过envs.py并以FD开头。。

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

done

DDDivano
DDDivano previously approved these changes Dec 17, 2025
- remove BKCL_DISPATCH_ALL_GATHER
- support sparse mode
- support moe quant_method
@zhupengyang
zhupengyang merged commit 8735cb5 into PaddlePaddle:develop Dec 18, 2025
23 of 28 checks passed
chang-wenbin pushed a commit to chang-wenbin/FastDeploy that referenced this pull request Mar 2, 2026
- remove BKCL_DISPATCH_ALL_GATHER
- support sparse mode
- support moe quant_method
xiaoguoguo626807 pushed a commit to xiaoguoguo626807/FastDeploy that referenced this pull request May 7, 2026
- remove BKCL_DISPATCH_ALL_GATHER
- support sparse mode
- support moe quant_method
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants