From 9597ec775adc0c67ef4eeac9a64c12cfee849002 Mon Sep 17 00:00:00 2001 From: Juan Muneton Date: Tue, 6 Oct 2026 14:54:19 +0000 Subject: [PATCH] [XPU] Let Inkling use the Mamba extra_buffer strategy on XPU supports_mamba_cache_extra_buffer returned False for every architecture on XPU, ahead of the _MAMBA_EXTRA_BUFFER_ARCHS check that lists Inkling as an arch the validator must accept. Inkling has no no_buffer path: its model override pins mamba_radix_cache_strategy=extra_buffer and inkling.py asserts enable_mamba_extra_buffer. So on XPU the server died in arg resolution with "extra_buffer is not supported for InklingForConditionalGeneration; use no_buffer." before any worker started, and no flag avoided it. Exempt only the two Inkling architectures from the XPU early-return; every other architecture is still rejected on XPU as before. CUDA and ROCm are unaffected. --- python/sglang/srt/arg_groups/overrides.py | 7 ++++- .../test_mamba_extra_buffer_platform.py | 28 +++++++++++++++++++ 2 files changed, 34 insertions(+), 1 deletion(-) diff --git a/python/sglang/srt/arg_groups/overrides.py b/python/sglang/srt/arg_groups/overrides.py index 597c19f098a1..dbd13b313431 100644 --- a/python/sglang/srt/arg_groups/overrides.py +++ b/python/sglang/srt/arg_groups/overrides.py @@ -416,7 +416,12 @@ def supports_mamba_cache_extra_buffer(view: Any, hf_config: Any) -> bool: the configured linear-attention backend (pure read).""" from sglang.srt.configs.linear_attn_model_registry import get_linear_attn_spec - if get_platform().is_xpu: + # Inkling has no no_buffer path (inkling.py asserts enable_mamba_extra_buffer), + # so rejecting it on XPU makes the model unlaunchable there. + if get_platform().is_xpu and hf_config.architectures[0] not in ( + "InklingForConditionalGeneration", + "InklingForConditionalGenerationMTP", + ): return False spec = get_linear_attn_spec(hf_config) if hf_config.architectures[0] in _MAMBA_EXTRA_BUFFER_ARCHS or ( diff --git a/test/registered/unit/server_args/test_mamba_extra_buffer_platform.py b/test/registered/unit/server_args/test_mamba_extra_buffer_platform.py index 18bf5ce26017..6634cc347d23 100644 --- a/test/registered/unit/server_args/test_mamba_extra_buffer_platform.py +++ b/test/registered/unit/server_args/test_mamba_extra_buffer_platform.py @@ -3,6 +3,7 @@ from unittest.mock import patch from sglang.srt.arg_groups.mamba_hook import validate_mamba_extra_buffer +from sglang.srt.arg_groups.overrides import supports_mamba_cache_extra_buffer from sglang.srt.runtime_context import override_platform from sglang.test.ci.ci_register import register_cpu_ci from sglang.test.test_utils import CustomTestCase @@ -63,5 +64,32 @@ def test_out_of_tree_validation_uses_platform_capability( _validate() +def _supports(arch: str) -> bool: + return supports_mamba_cache_extra_buffer( + SimpleNamespace(linear_attn_backend="triton"), + SimpleNamespace(architectures=[arch]), + ) + + +class TestMambaExtraBufferXpuArchs(CustomTestCase): + def test_inkling_is_admitted_on_xpu(self): + """Inkling has no no_buffer path, so rejecting it on XPU fails every launch.""" + with override_platform(is_xpu=True): + for arch in ( + "InklingForConditionalGeneration", + "InklingForConditionalGenerationMTP", + ): + with self.subTest(arch=arch): + self.assertTrue(_supports(arch)) + + def test_other_archs_stay_rejected_on_xpu(self): + for arch in ("KimiK3ForConditionalGeneration", "NemotronHForCausalLM"): + with self.subTest(arch=arch): + with override_platform(is_xpu=False): + self.assertTrue(_supports(arch)) + with override_platform(is_xpu=True): + self.assertFalse(_supports(arch)) + + if __name__ == "__main__": unittest.main()