diff --git a/python/sglang/kernels/ops/layernorm/mhc.py b/python/sglang/kernels/ops/layernorm/mhc.py index d65725f165..d7f69f4068 100644 --- a/python/sglang/kernels/ops/layernorm/mhc.py +++ b/python/sglang/kernels/ops/layernorm/mhc.py @@ -858,7 +858,11 @@ def prewarm_mhc_pre( from sglang.srt.runtime_context import get_schedule hc_mult, hidden_size = residual.shape[-2], residual.shape[-1] - max_num_tokens = get_schedule().chunked_prefill_size + schedule = get_schedule() + max_num_tokens = schedule.chunked_prefill_size + if max_num_tokens is None or max_num_tokens <= 0: + # Chunked prefill disabled: bound by the prefill token budget. + max_num_tokens = schedule.max_prefill_tokens buckets = get_mhc_pre_token_count_representatives( max_num_tokens, hc_mult * hidden_size )