[RL] fix deepseek v4 MXFP8 flashinfer_trtllm_routed MoE weight update (#28676)
Signed-off-by: zhihaow6 <zhihaow6@illinois.edu>
This commit is contained in:
@@ -803,6 +803,16 @@ class FusedMoE(torch.nn.Module):
|
||||
param=param,
|
||||
weight_name=weight_name,
|
||||
)
|
||||
elif isinstance(method, Fp8MoEMethod) and (
|
||||
get_moe_runner_backend().is_flashinfer_trtllm_routed()
|
||||
or get_moe_runner_backend().is_flashinfer_trtllm()
|
||||
):
|
||||
# Drop the GPU mxfp8 shuffle-index cache on every reload for mxfp8 trtllm, trtllm_routed
|
||||
from sglang.srt.layers.moe.moe_runner.flashinfer_trtllm import (
|
||||
clear_mxfp8_shuffle_index_cache,
|
||||
)
|
||||
|
||||
clear_mxfp8_shuffle_index_cache()
|
||||
|
||||
loaded_weight = (
|
||||
loaded_weight.t().contiguous()
|
||||
@@ -1025,6 +1035,16 @@ class FusedMoE(torch.nn.Module):
|
||||
method = self.quant_method
|
||||
if hasattr(self, "scheme"):
|
||||
method = self.scheme
|
||||
if isinstance(method, Fp8MoEMethod) and (
|
||||
get_moe_runner_backend().is_flashinfer_trtllm_routed()
|
||||
or get_moe_runner_backend().is_flashinfer_trtllm()
|
||||
):
|
||||
# Drop the GPU mxfp8 shuffle-index cache on every reload for mxfp8 trtllm, trtllm_routed
|
||||
from sglang.srt.layers.moe.moe_runner.flashinfer_trtllm import (
|
||||
clear_mxfp8_shuffle_index_cache,
|
||||
)
|
||||
|
||||
clear_mxfp8_shuffle_index_cache()
|
||||
loaded_weight = (
|
||||
loaded_weight.t().contiguous()
|
||||
if (
|
||||
|
||||
@@ -113,6 +113,14 @@ _flashinfer_trtllm_shuffle_row_indices_cache_mxfp8: dict[
|
||||
] = {}
|
||||
|
||||
|
||||
def clear_mxfp8_shuffle_index_cache() -> None:
|
||||
"""Drop the cached MXFP8 MoE row-index permutations.
|
||||
The cached index tensors are GPU-resident; sglang reuses the weights-region
|
||||
memory across weight-update cycles
|
||||
"""
|
||||
_flashinfer_trtllm_shuffle_row_indices_cache_mxfp8.clear()
|
||||
|
||||
|
||||
def _is_gated(layer: Module) -> bool:
|
||||
"""Return whether the MoE layer uses a gated activation (default True)."""
|
||||
is_gated = (
|
||||
|
||||
Reference in New Issue
Block a user