[Intel HPU] fix memory fragmentation issue and fix moe all_reduce issue#5357
Merged
EmmonsCurse merged 1 commit intoPaddlePaddle:developfrom Dec 4, 2025
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR addresses memory fragmentation and MoE (Mixture of Experts) all_reduce issues for Intel HPU by modifying warmup sequence ordering and consolidating MoE all_reduce logic.
Key Changes:
- Reversed warmup sequence iteration order (batch sizes and sequence lengths) to improve memory allocation patterns
- Moved HPU-specific MoE all_reduce logic from backend-specific files to common MoE layer for better maintainability
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
fastdeploy/worker/hpu_model_runner.py |
Reversed iteration order for prefill batches, prefill lengths, decode batches, and decode block numbers during warmup to reduce memory fragmentation |
fastdeploy/model_executor/layers/moe/moe.py |
Added platform-specific all_reduce handling for Intel HPU by importing tensor_model_parallel_all_reduce_custom and conditionally using it in the forward method |
fastdeploy/model_executor/layers/backends/intel_hpu/moe/fused_moe_hpu_backend.py |
Removed duplicate all_reduce calls and unused import, moving the logic to the common MoE layer |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## develop #5357 +/- ##
==========================================
Coverage ? 59.44%
==========================================
Files ? 325
Lines ? 40261
Branches ? 6093
==========================================
Hits ? 23934
Misses ? 14428
Partials ? 1899
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:
|
…fix moe all_reduce issue
5bc4f12 to
e707784
Compare
EmmonsCurse
approved these changes
Dec 4, 2025
liyonghua0910
pushed a commit
to liyonghua0910/FastDeploy
that referenced
this pull request
Dec 5, 2025
…fix moe all_reduce issue (PaddlePaddle#5357)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Motivation
Fix memory fragmentation issue and moe all_reduce issue
Modifications
update warmup sequence and moe all_reduce for HPU according to PR #5247
Usage or Command
no command usage change
Accuracy Tests
ERNIE-4.5-21B-A3B-Paddle
100%|██████████| 1319/1319 [09:16<00:00, 2.37it/s]
Accuracy: 0.917
Invalid: 0.001
Latency: 556.834 s
Checklist
[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]]pre-commitbefore commit.conducted by local tests
releasebranch, make sure the PR has been submitted to thedevelopbranch, then cherry-pick it to thereleasebranch with the[Cherry-Pick]PR tag.