From 546d6e23adc76bd4888f29d6e941dfbd82da131a Mon Sep 17 00:00:00 2001 From: Tai An Date: Tue, 30 Jun 2026 22:55:43 -0700 Subject: [PATCH] fix(mlx): default prefill_aware_swa=False on MlxModelRunnerStub (#29681) --- .../sglang/srt/hardware_backend/mlx/model_runner_stub.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/python/sglang/srt/hardware_backend/mlx/model_runner_stub.py b/python/sglang/srt/hardware_backend/mlx/model_runner_stub.py index 681adec25..44f103f79 100644 --- a/python/sglang/srt/hardware_backend/mlx/model_runner_stub.py +++ b/python/sglang/srt/hardware_backend/mlx/model_runner_stub.py @@ -85,6 +85,14 @@ class MlxModelRunnerStub(ModelRunner): # AttributeError. canary_manager = None + # No prefill-aware SWA on the MLX path. The base ModelRunner derives this in + # its full initialize() from `model.is_prefill_aware_swa()`, which this + # lightweight override skips (and `_DummyModel` does not implement). The + # scheduler reads `model_runner.prefill_aware_swa` unconditionally when + # admitting a prefill batch, so default to False as a class attribute to keep + # that path working instead of raising AttributeError. + prefill_aware_swa = False + def __init__(self, *args, mlx_pool_size: int | None = None, **kwargs): self._mlx_pool_size = mlx_pool_size super().__init__(*args, **kwargs)