Repository navigation
[AMD] Fix Quark Shared Experts Fusion Gate after load-time-override Removal - #35200
Conversation
| if isinstance(self.dequantization_config, Fp8Config): | ||
| self.weight_block_size = self.dequantization_config.weight_block_size | ||
|
|
||
| self._maybe_disable_shared_experts_fusion() |
There was a problem hiding this comment.
so this is no longer needed now?
There was a problem hiding this comment.
Yes, Quark's can_fuse_shared_expert() decision is still used, but PR #33889 inverted the decision flow (model family specific gates now pull the answer from Quark once per runner instead of Quark pushing it into a global flag with the removed declare_load_time_override).
BowenBao
left a comment
There was a problem hiding this comment.
Thanks for quick fix. Left a question there for my understanding.
| ) | ||
| if is_wint4afp8_or_wint4a16_config(quant_config): | ||
| return "Deepseek V3/R1 W4AFP8/W4A16 model uses different quant method for routed experts and shared experts." | ||
| can_fuse_fn = getattr(quant_config, "can_fuse_shared_expert", None) |
There was a problem hiding this comment.
nit: not for this regression fix PR, but should can_fuse_shared_expert be added into base QuantConfig class?
There was a problem hiding this comment.
Makes sense, after this PR is merged, I can open another PR to refactor this.
|
@ColinZ22 Thanks for fixing this, the default Qwen3.5 and DeepSeek paths look good now. One edge case may still be missing: in the DeepSeek V2/V3 gate, enforce_shared_experts_fusion is checked before quant_config.can_fuse_shared_expert(). So if the shared expert stays in FP8/BF16 while the routed experts are MXFP4, --enforce-shared-experts-fusion can still force an incompatible fusion. DeepSeek V4 has the same gap because its gate does not call can_fuse_shared_expert() at all. Can we move the can_fuse_shared_expert() check before the enforce_shared_experts_fusion early return for DeepSeek V2/V3, and add the same check to the DeepSeek V4 gate? Please also add a small unit test covering mixed-precision Quark with forced fusion. |
Good point! I updated the handling to address potential incorrect |
|
Narrow scope to Quark specific |
…n-transport1 * 'main' of https://github.com/sgl-project/sglang: (255 commits) [Perf] Hoist DSv4 draft-extend SWA write locs; unify SWA graph buffer naming (sgl-project#34890) [Chore] Move version tag helper to release scripts (sgl-project#35196) [DSV4] Turn on mhc post pre fusion by default (sgl-project#35214) [diffusion] Per-section LoRA adapters on fused linear layers (sgl-project#34933) [XPU] Fix decode graph runner is_current_stream_capturing on non-CUDA devices (sgl-project#35050) [AMD] Update amd k3 cookbook for PR#34580 (sgl-project#35263) [Diffusion][Refactor] Refactor and extract complex RoPE implementation to layers/rotary_embedding for MOVA DiT (sgl-project#31453) refactor: rename chat response token IDs (sgl-project#35225) [mem_cache][8/N] refactor: move MambaPoolHost to pool_host.mamba (sgl-project#31180) [AMD] Fix Quark Shared Experts Fusion Gate after load-time-override Removal (sgl-project#35200) [AMD] Scope the EAGLE greedy-verify TP broadcast to ROCm only (sgl-project#35195) [AMD] Add the Kimi-K3 MI35x perf benchmarks in nightly (sgl-project#34985) Skip inkling sheared bias under batch invariance (sgl-project#35161) [AMD] Optimize KIMI-K3 with Triton MLA decode kernel by tuning the stage-1 geometry for gfx950 (sgl-project#34580) [Docs] Enable PD disaggregation for DSV4 low-latency recipes (sgl-project#35224) [DCP] Drop the prefill index-selection syncs by taking each rank's rows by stride (sgl-project#35084) [Feature] Optimize TP LMHead with All-to-All (sgl-project#32313) [XPU] Enable fused GDN QKV split Triton kernel on XPU (sgl-project#30144) [CPU] Explicitly import sgl_kernel in CPU kernel tests (sgl-project#35119) [diffusion] feat: load quantized H3 text encoder checkpoints (sgl-project#34986) ... # Conflicts: # python/sglang/srt/multimodal/processors/base_processor.py
Motivation
PR #33889 replaced process-global load-time config overrides with per-runner model-class gates and deleted
declare_load_time_override. PR #29328 landed afterward still calling that deleted function fromQuarkConfig.__init__, so any Quark checkpoint or online quantized checkpoint that cannot fuse shared expert(s) due to precision mismatch now raisesImportErrorat load. This PR restores the mixed-precision shared-experts decision path through the new gate architecture instead of the deleted global-override path.Modifications
quark/quark.py: remove_maybe_disable_shared_experts_fusionand its__init__call. Quark no longer imperatively pushes a decision;its can_fuse_shared_expert()reader stays as the source of truth.models/deepseek_v2.py: DeepseekV3ForCausalLM.shared_experts_fusion_disable_reason now checksquant_config.can_fuse_shared_expert(), matchingqwen2_moe.can_fuse_shared_expert's implementation. The decision flows through the per-runner gate the loader calls (install_shared_experts_fusion_decision) instead of the deleted global override. This covers the whole DeepSeek family (V2/V3, Kimi-K2.5, Kimi-VL, DeepSeek-VL2/OCR, dots_vlm).Tests
Verified on AMD MI355X with both native AMD Quark MXFP4 checkpoint and online NVFP4 to MXFP4 requantization
(
--quantization quark_mxfp4introduced in PR #29328) with both quantized and excluded shared expert.nvidia/Kimi-K2.6-NVFP4nvidia/DeepSeek-R1-NVFP4nvidia/Qwen3.5-397B-A17B-NVFP4amd/Qwen3.5-35B-A3B-MXFP4CI States
Latest PR Test (Base): ❌ Run #32088497917
Latest PR Test (Extra): ❌ Run #32088497735