[CPU] Add native support for Qwen3-next#12305
Closed
blzheng wants to merge 6 commits intosgl-project:mainfrom
Closed
[CPU] Add native support for Qwen3-next#12305blzheng wants to merge 6 commits intosgl-project:mainfrom
blzheng wants to merge 6 commits intosgl-project:mainfrom
Conversation
mingfeima
reviewed
Nov 12, 2025
| start_q = 0 | ||
| for i in range(batch_size): | ||
| end_q = query_start_loc[i + 1] | ||
| x_i, final_states = causal_conv1d_ref( |
Collaborator
There was a problem hiding this comment.
let's wait until sgl-kernel is merged and then replace all the ref with real kernels.
yizhang2077
reviewed
Jan 20, 2026
| self.variance_epsilon = eps | ||
|
|
||
| def forward(self, hidden_states, gate=None): | ||
| input_dtype = hidden_states.dtype |
Collaborator
There was a problem hiding this comment.
can we directly use forward_cpu in RMSNorm?
| @@ -525,6 +528,9 @@ topk_softmax_cpu(at::Tensor& hidden_states, at::Tensor& gating_output, int64_t t | |||
| case 256: | |||
| LAUNCH_TOPK_SOFTMAX_KERNEL(256); | |||
| break; | |||
| case 512: | |||
| LAUNCH_TOPK_SOFTMAX_KERNEL(512); | |||
Collaborator
There was a problem hiding this comment.
we need split it into another pr
Contributor
Author
|
@yizhang2077 Thanks for the review. This PR has been retired because the necessary changes are already included in #12525. Closing this PR. |
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
This pr adds native support for Qwen3-next on CPU.
Modifications
a.
causal_conv1d_fnb.
causal_conv1d_updatec.
chunk_gated_delta_ruled.
fused_sigmoid_gating_delta_rule_updatee.
fused_gdn_gatingf.
Qwen3NextRMSNormGateda. Weight packing dtype check: weight packing did not support torch.float. This pr adds dtype validation before packing weight
b. HybridLinearKVPool layer ID handling: Only full attention layers can access get_value_buffer, but layer_id = 0 is not always a full attention layer. This PR updates the logic to handle such cases correctly.
c. Top-k kernel support: Top-k related kernels lacked support for num_experts = 512. This PR adds support for this configuration.
Accuracy Tests
Accuracy on GSM8k:
command line:
SGLANG_USE_CPU_ENGINE=1 python -m sglang.launch_server --model Qwen/Qwen3-Next-80B-A3B-Instruct --trust-remote-code --device cpu --tp 4 --dtype bfloat16 --mem-fraction-static 0.8 --max-total-tokens 65536 --disable-overlap-scheduleAccuracy: 0.942
Invalid: 0.000
Latency: 3855.785 s
Output throughput: 42.622 token/s
Benchmarking and Profiling
Checklist