Repository navigation
[Perf] dsv41: Mega-mHC and the wo_a einsum write MXFP8 for wqkv_a and wo_b - #45632
Conversation
… wo_b With SGLANG_OPT_DSV41_FUSED_MXFP8_PRODUCERS=1, Mega-mHC also writes wqkv_a's E4M3 input with DeepGEMM-packed UE8M0 scales, and the Mega wo_a fp8_einsum writes wo_b's input through its FP8 epilogue; both linears then run DeepGEMM 1d1d on the pre-quantized input. Decode and verify only, up to 2048 rows. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
|
(codex)
Source review only; GPU numerics/performance were not run. |
…ative MXFP8 copy_or_rebind_param keeps weight_scale_inv_deepgemm_input's storage stable across weight reloads so captured CUDA graphs see refreshed scales. The native MXFP8 checkpoint path now prepares the packed scale too, so the fused producers activate there as well. Drop the manual numeric script.
|
/rerun-test test_deepseek_v41_flash_gb300_tp4ep4.py test_deepseek_v41_flash_gb300_dp4ep4.py test_deepseek_v41_flash_gb300_encoder_bcg.py test_fp8_utils.py test_fp8_blockwise_linear_backends.py test_deepgemm_ue8m0_requant.py test_mhc_kernels.py test_mega_attention.py |
|
🚀 🚀 🚀 🚀 🚀 |
|
/rerun-test test_deepseek_v41_flash_gb300_tp4ep4.py test_deepseek_v41_flash_gb300_dp4ep4.py test_deepseek_v41_flash_gb300_encoder_bcg.py test_fp8_utils.py test_fp8_blockwise_linear_backends.py test_deepgemm_ue8m0_requant.py test_mhc_kernels.py test_mega_attention.py |
Fp8LinearMethod.prepare_deepgemm_mxfp8_input(layer) packs the scale and says whether the layer takes an Mxfp8DeepGemmInput; MQALayer.setup_mega_attention calls it for wqkv_a and wo_b and stores the two booleans. That replaces the opt-in attribute on the layer, the hasattr probes on the derived scale and the duck-typed helper in the mHC module.
|
🚀 🚀 🚀 🚀 🚀 |
|
/rerun-test test_deepseek_v41_flash_gb300_tp4ep4.py test_deepseek_v41_flash_gb300_dp4ep4.py test_deepseek_v41_flash_gb300_encoder_bcg.py test_fp8_utils.py test_fp8_blockwise_linear_backends.py test_deepgemm_ue8m0_requant.py test_mhc_kernels.py test_mega_attention.py |
|
🚀 🚀 🚀 🚀 🚀 |
Drop Mxfp8DeepGemmInput: a DeepGEMM-packed activation pair is a plain (fp8, int32 scale) tuple, as swiglu_oai_mxfp8_deepgemm already produces, and Fp8LinearMethod.apply routes it to the existing deepgemm_w8a8_mxfp8_linear_with_fallback. The prepared layer stores the packed weight scale under the same weight_scale_inv_deepgemm name a DeepGEMM-backend layer uses, through one pack_mxfp8_weight_scale_for_deepgemm helper. mhc_mega_boundary takes the fp8 pair as out-buffers instead of changing its return arity; both producers allocate it through empty_deepgemm_mxfp8_pair and gate on fused_mxfp8_rows. combine hands rows back to any caller without a quantized list, and HcQuantized.pair is named for what it now holds.
|
/rerun-test test_deepseek_v41_flash_gb300_tp4ep4.py test_deepseek_v41_flash_gb300_dp4ep4.py test_deepseek_v41_flash_gb300_encoder_bcg.py test_fp8_utils.py test_fp8_blockwise_linear_backends.py test_deepgemm_ue8m0_requant.py test_mhc_kernels.py test_mega_attention.py test_minimax_fused_qkv_index_gemm.py |
|
🚀 🚀 🚀 🚀 🚀 |
Drop SGLANG_OPT_DSV41_FUSED_MXFP8_PRODUCERS. prepare_deepgemm_mxfp8_input is the condition, and the wqkv_a half already sits behind the Mega-mHC fused post.
|
/rerun-test test_deepseek_v41_flash_gb300_tp4ep4.py test_deepseek_v41_flash_gb300_dp4ep4.py test_deepseek_v41_flash_gb300_encoder_bcg.py test_fp8_utils.py test_fp8_blockwise_linear_backends.py test_deepgemm_ue8m0_requant.py test_mhc_kernels.py test_mega_attention.py test_minimax_fused_qkv_index_gemm.py |
|
🚀 🚀 🚀 🚀 🚀 |
post_load_weights runs inside load_weights, before the quant methods process their layers, so packing the scale from setup_mega_attention found no block_fp8_mxfp8_ready yet (GB300 job 3927). LinearBase.deepgemm_mxfp8_input is the request: MQALayer sets it in __init__ for wqkv_a and wo_b, Fp8LinearMethod.process_weights_after_loading keeps it True only once the packed scale exists, and the producers read it as the fact.
|
/rerun-test test_deepseek_v41_flash_gb300_tp4ep4.py test_deepseek_v41_flash_gb300_dp4ep4.py test_deepseek_v41_flash_gb300_encoder_bcg.py test_fp8_utils.py test_fp8_blockwise_linear_backends.py test_deepgemm_ue8m0_requant.py test_mhc_kernels.py test_mega_attention.py test_minimax_fused_qkv_index_gemm.py |
|
🚀 🚀 🚀 🚀 🚀 |
|
Ran the three registered GB300 accuracy tests on 4x GB300 at d463e21, as CI does (
All The previous head 57860e4 failed at weight load: |
Motivation
In DeepSeek-V4.1 Mega attention decode, wqkv_a and wo_b quantize their bf16 input in a separate kernel before the MXFP8 GEMM. The producers of those inputs (Mega-mHC and the wo_a
fp8_einsum) can write the MXFP8 input directly.Modifications
LinearBase.deepgemm_mxfp8_input:MQALayersets it on wqkv_a and wo_b before load;Fp8LinearMethod.process_weights_after_loadingpacks a DeepGEMM weight scale beside the FlashInfer one and keeps the flag only when it did. A DeepGEMM-packed activation pair is a plain(fp8, int32 scale)tuple, whichapplyroutes to the existingdeepgemm_w8a8_mxfp8_linear_with_fallback.mhc_mega_boundarytakesy_fp8/y_gemm_sfout-buffers; the Mega-mHC post fills them for the next layer's wqkv_a.fp8_einsumwrites its FP8 output pair for wo_b.🤖 Generated with Claude Code
CI States
Latest PR Test (Base): ❌ Run #39703628265
Latest PR Test (Extra): ❌ Run #39703628339
Latest PR Test (AMD ROCm 10): ❌ Run #39703628142