-
Notifications
You must be signed in to change notification settings - Fork 3.4k
[CPU] [BF16] Call fused_experts_cpu, weight_packed_linear and bmm_cpu kernel in DeepSeek model #6641
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
Merged
zhyncs
merged 36 commits into
sgl-project:main
from
chunyuan-w:chunyuan/pr_frontend_moe
Jun 25, 2025
Merged
[CPU] [BF16] Call fused_experts_cpu, weight_packed_linear and bmm_cpu kernel in DeepSeek model #6641
Changes from all commits
Commits
Show all changes
36 commits
Select commit
Hold shift + click to select a range
dd54bcf
Use fused_experts_cpu and add weight packing (#8)
chunyuan-w c1781be
switch to weight_packed_linear if cpu_has_amx_support (#11)
chunyuan-w 1e4e60b
Switch to weight_packed_linear for MoEGate and lm_head (#16)
chunyuan-w 238d29f
Replace torch.bmm in forward_absorb with sgl_kernel.cpu.bmm (#21)
chunyuan-w 1f77ae6
don't use c++ kernel if apply_router_weight_on_input is True
chunyuan-w 27e6501
Integrate qkv_proj_with_rope (#34)
chunyuan-w 16157b3
update API for fused_qkv_a_proj_with_mqa
chunyuan-w 146470f
revert changes to bmm
chunyuan-w a6253a9
update qkv_proj OP name
chunyuan-w 6c98ba8
refine comment
chunyuan-w f687f62
only pack weight is using the fused_qkv_proj_with_rope kernel
chunyuan-w 21b04a6
remove dead code
chunyuan-w d170e11
Merge branch 'main' into chunyuan/pr_frontend_moe
zhyncs 7e43b73
update qkv_proj OP name
chunyuan-w 19078ee
fix if the obj does not have the use_intel_amx_backend attr
chunyuan-w db7fcc9
cast bias to FP32 in process weight after load
gau-nernst cea74fd
fix when module.bias is None
chunyuan-w 7411cf1
Merge branch 'main' into chunyuan/pr_frontend_moe
chunyuan-w 6b1500b
Merge branch 'main' into chunyuan/pr_frontend_moe
chunyuan-w fb15b38
copy __dict__ from original weight param to packed weight param
chunyuan-w 88426bb
only pack LMHead weight if it's not quantized
chunyuan-w e5aa0ca
Only pack w_kc and w_vc for CPU
chunyuan-w 9542064
Merge branch 'main' into chunyuan/pr_frontend_moe
chunyuan-w 08d3140
revert the debug change
chunyuan-w 726289d
Merge branch 'main' into chunyuan/pr_frontend_moe
zhyncs 410aa32
use _is_cpu and _is_cpu_amx_available to check device
chunyuan-w 056b7ef
Merge branch 'main' into chunyuan/pr_frontend_moe
zhyncs ea8fd2c
cast tok_weights to fp32 for llama4
chunyuan-w 39c684c
add comment for topk_weights
chunyuan-w c3990ec
fix gemm kernel when N is small
chunyuan-w 0c4c6b5
Merge branch 'main' into chunyuan/pr_frontend_moe
zhyncs 14908f1
move import to the top
chunyuan-w 04d5e39
only set self.quant_method or call _process_weight_after_loading if _…
chunyuan-w 4526d13
Merge branch 'main' into chunyuan/pr_frontend_moe
zhyncs f5ef0f2
don't pack weight or use intel amx backend if any weight of this modu…
chunyuan-w 71c48a4
Merge branch 'main' into chunyuan/pr_frontend_moe
zhyncs File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
Oops, something went wrong.
Oops, something went wrong.
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.
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.
Lets make
getattr(sth, "use_intel_amx_backend", False)as a method in utils.pyThere 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.
Fixed in #7647