From 937c77cf5003fb32ab5f871c2f582b9c96f70269 Mon Sep 17 00:00:00 2001 From: Ziang Li Date: Fri, 31 Jul 2026 00:35:15 -0700 Subject: [PATCH] [Fix] Clear stale FlashInfer BF16 MoE index cache (#33016) --- python/sglang/srt/layers/quantization/unquant.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/python/sglang/srt/layers/quantization/unquant.py b/python/sglang/srt/layers/quantization/unquant.py index f32d68f17..15b9ee52d 100644 --- a/python/sglang/srt/layers/quantization/unquant.py +++ b/python/sglang/srt/layers/quantization/unquant.py @@ -374,6 +374,11 @@ class UnquantizedFusedMoEMethod(FusedMoEMethodBase, MultiPlatformOp): # Reorder rows of W1 for fused gated activation if self.use_flashinfer_trtllm_moe: + # The cached indices are GPU tensors. Colocated weight offloading + # can release their backing memory between reloads, so rebuild them + # once per post-processing cycle. + self._cache_permute_indices.clear() + from flashinfer.fused_moe.core import ( _maybe_get_cached_w3_w1_permute_indices, convert_to_block_layout,