[LoRA] Fix gated MoE-LoRA under virtual experts; compressed-tensors runner detection and EP expert map - #32241
Open
yushengsu-thu wants to merge 2 commits into
Open
[LoRA] Fix gated MoE-LoRA under virtual experts; compressed-tensors runner detection and EP expert map#32241yushengsu-thu wants to merge 2 commits into
yushengsu-thu wants to merge 2 commits into
Conversation
…er/EP enablement Ports the still-missing pieces of Kimi 2.5/6 LoRA support from sglang-miles (#25141) to main; the rest of that work is superseded by the #31520-#31525 series or by main's own evolution. - virtual_experts: accept a length-2 lora_b for the gated gate_up case. A carries gate+up ranks concatenated (2*r) while each B has rank r; the previous single-B call fed the full stacked tensor to a kernel whose bookkeeping assumed matching rank, so gated (SwiGLU) MoE LoRA was numerically wrong whenever lora_use_virtual_experts was set. One shrink runs over the full 2*r rank, then one expand per B writes its own output slice. - FusedMoEWithLoRA runner detection: fall back to base_layer.scheme.runner — compressed-tensors attaches the MoeRunner to the scheme, not quant_method, so WNA16 models silently picked the Triton runner in auto mode. - Refresh quant_info.expert_map/global_num_experts per forward from the dispatcher's lazily-built local_expert_mapping, so EP deployments of quant schemes whose get_marlin_quant_info does not populate them (e.g. compressed-tensors WNA16) route expert indices correctly. Co-authored-by: Nan Jiang <59716405+nanjiangwill@users.noreply.github.com>
yushengsu-thu
requested review from
BBuf,
DarkSharpness,
Fridge003,
HydraQYH,
Ying1123,
celve,
jybsuper,
lifuhuang and
yuan-luo
as code owners
July 23, 2026 20:27
Contributor
|
Caution The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased. |
This was referenced Jul 23, 2026
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.
Ports the residual of Kimi 2.5/6 LoRA support (#25141, sglang-miles) that isn't already covered by the #31520–#31525 series or by main's own evolution — the rest of that commit is superseded and intentionally left out.
Three pieces:
merged_experts_fused_moe_lora_addwhile A carries gate+up ranks concatenated (2·r), so gated (SwiGLU) MoE LoRA is numerically wrong on main wheneverlora_use_virtual_expertsis set. The kernel now accepts a length-2 B: one shrink over the full 2·r rank, one expand per half into its own output slice.scheme, notquant_method, so WNA16 models silently fell back to the Triton runner in auto mode.quant_info.expert_map/global_num_expertsper forward from the dispatcher's lazily-builtlocal_expert_mapping, for quant schemes whoseget_marlin_quant_infodoesn't populate them.Supersedes the kernel half of #28564 (rebased to the moved kernel location under
sglang/kernels/ops/moe/); the remaining #28564/#28562 content is carried in better form by #31520/#31523/#31524/#31525.CI States
Latest PR Test (Base): ❌ Run #30043811407
Latest PR Test (Extra): ❌ Run #30043810693