Repository navigation
[RL] DeepSeek V4 weight-update fixes: UE8M0 packed-scale shards, attn_sink cache refresh, per-process DeepGEMM cache - #41043
yueming-yuan wants to merge 1 commit into
Conversation
…_sink cache refresh, per-process DeepGEMM cache Model-side fixes RL weight updates on DeepSeek V4 need on main: - RowParallelLinear: a DeepGEMM UE8M0 packed scale (int32, 4 scale columns per word) cannot be narrowed to the TP shard directly when the shard boundary sits inside a word; unpack to fp32, narrow in scale columns, repack. - DeepSeek V4 / DSpark: the per-rank attn_sink slice is cached on first use; a weight update rewrites attn_sink in place, so refresh the cache in post_load_weights or decode keeps serving the pre-update sink. - SGLANG_DG_CACHE_DIR_PER_PROCESS: colocated RL engines on one host get a per-process DeepGEMM JIT cache dir instead of racing on shared files. - Shorten the unloaded-weights warning, which fires on every partial RL update by design. Squash of sglang-miles #27131, #27603, #27604, #27728, #30421. Supersedes #29916. #30742 (FP8 tuple k-size) stays with the on-policy port and #33478 is obsolete on main, where the unified-loader mappings live in deepseek_weight_loader.
|
/tag-run-ci-label |
|
/rerun-test test/registered/unit/layers/quantization/test_fp8_blockwise_linear_backends.py test/registered/unit/layers/quantization/test_deepgemm_ue8m0_requant.py test/registered/quant/test_fp8_utils.py test/registered/unit/layers/test_fp8_bpreshuffle_scale.py test/registered/gemm/test_linear_bf16_fp32_hpc.py test/registered/unit/layers/moe/test_mega_moe_deepgemm_api.py test/registered/attention/unittests/dsv4/test_deepseek_v4.py test/registered/unit/models/test_deepseek_v4_rope_policy.py test/registered/unit/models/test_deepseek_v4_shared_expert_fusion.py test/registered/unit/models/test_deepseek_v4_unified_fp8_q_pair.py test/registered/e2e/dsv4/test_dsv4_fp8_cast.py test/registered/e2e/dsv4/test_dsv4_unified_fp8_decode.py test/registered/e2e/dsv4/test_dsv4_unified_fp8_prefill.py test/registered/e2e/dsv4/test_dsv4_unified_fp8_backend_prefill.py test/registered/e2e/dsv4/test_dsv4_unified_fp8_qk_norm_rope.py test/registered/e2e/dsv4/test_dsv4_unified_fp8_scatter.py test/registered/e2e/dsv4/test_dsv4_unified_fp8_compress_store.py test/registered/spec/dspark/test_dspark_draft_path_default.py test/registered/spec/dspark/test_dspark_kernel_parity.py test/registered/kernels/ops/attention/test_dsa_sink_pad_cache.py test/registered/unit/model_executor/test_derived_weight_cache.py test/registered/unit/model_executor/test_compensated_mhc_update_guard.py test/registered/rl/test_update_weights_from_distributed.py test/registered/rl/test_update_weights_from_tensor.py |
|
Results for 🚀 🚀 🚀 🚀 🚀 ⛔ ⛔ ⛔ ⛔ ⛔ ⛔ ⛔ |
Motivation
RL weight updates on DeepSeek V4 hit three model-side problems on main: a UE8M0 packed scale that cannot be TP-sharded when the shard boundary falls inside a packed word, an
attn_sinkper-rank cache that keeps serving pre-update values, and colocated engines racing on one DeepGEMM JIT cache dir.Modifications
layers/linear.py(RowParallelLinear): when aBlockQuantScaleParameterwithformat_ue8m0receives a full-size int32 packed scale, unpack to fp32, narrow in scale-column units to the TP shard, repack (_load_ue8m0_packed_scale).models/deepseek_v4*.py:refresh_attn_sink_cache()re-slices the cached per-rankattn_sink;post_load_weightscalls it for every attention module (target and nextn). DSpark pads the sink to the same width asq.SGLANG_DG_CACHE_DIR_PER_PROCESS(newEnvsentry, default off): appendpid_<pid>toSGLANG_DG_CACHE_DIRso colocated RL engines on a host do not share one JIT cache.deepseek_v4.py: the unloaded-weights warning now reports a count instead of the full list, since partial RL updates trigger it by design.Squash of sglang-miles #27131, #27603, #27604, #27728, #30421. Supersedes #29916. Not included: #30742 (FP8 tuple k-size belongs to the on-policy port) and #33478 (obsolete: main builds the unified-loader mappings inside
deepseek_weight_loader).Testing
pre-commit clean. File runs via
/rerun-test: the tests referencinglinear.pyblock-quant loading,deep_gemm_wrapper, and the DSv4 e2e set.CI States
Latest PR Test (Base): ❌ Run #35957646125
Latest PR Test (Extra): ❌ Run #35957646181
Latest PR Test (AMD ROCm 10): ❌ Run #35957646268