A high-throughput and memory-efficient inference and serving engine for LLMs
Mirrored from https://github.com/tduncan-lum/Nvidia-Optimization-Stack---VLLM.git
Synced Nov 14, 05:30 UTC
[Bug] Fix modular_kernel: ZeroDivisionError: integer division or modulo by zero (#26528)
Signed-off-by: yewentao256 <zhyanwentao@126.com>
Wentao Ye committed
Oct 9, 2025 at 18:13 UTC
1ee35382cb3d87cc4438c2c291df78d51e5eb18f
1 file changed
+7
-4
vllm/model_executor/layers/fused_moe/modular_kernel.py
+7
-4
@@ -717,10 +717,13 @@ class FusedMoEModularKernel(torch.nn.Module):
717
get num_chunks == 1. Take max(M, 1) to avoid divide by zero.
718
If there are no tokens to process, the number of chunks will be zero.
719
"""
720
- CHUNK_SIZE = (
721
- max(M, 1)
722
- if not self.fused_experts.supports_chunking()
723
- else min(M, envs.VLLM_FUSED_MOE_CHUNK_SIZE)
720
+ CHUNK_SIZE = max(
721
+ 1,
722
+ (
723
+ M
724
+ if not self.fused_experts.supports_chunking()
725
+ else min(M, envs.VLLM_FUSED_MOE_CHUNK_SIZE)
726
+ ),
727
)
728
num_chunks = cdiv(M, CHUNK_SIZE)
729
# If there are no tokens, then there should be no loop iterations.