From 4cc725ac1ca43fde1959c7e5e6f869cc12c6f1a4 Mon Sep 17 00:00:00 2001 From: gaopengff Date: Fri, 7 Nov 2025 02:33:41 +0800 Subject: [PATCH] [Intel]Add 'intel_xpu' attention backend for llama4 (#11051) --- python/sglang/srt/server_args.py | 3 ++- python/sglang/srt/utils/common.py | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/python/sglang/srt/server_args.py b/python/sglang/srt/server_args.py index 681a929d7..6e3ec921b 100644 --- a/python/sglang/srt/server_args.py +++ b/python/sglang/srt/server_args.py @@ -1002,7 +1002,8 @@ class ServerArgs: "aiter", "triton", "trtllm_mha", - }, "fa3, aiter, triton, or trtllm_mha is required for Llama4 model" + "intel_xpu", + }, "fa3, aiter, triton, trtllm_mha or intel_xpu is required for Llama4 model" if is_sm100_supported() and self.attention_backend is None: self.attention_backend = "trtllm_mha" logger.warning( diff --git a/python/sglang/srt/utils/common.py b/python/sglang/srt/utils/common.py index 91e2e98cd..6b802c11b 100644 --- a/python/sglang/srt/utils/common.py +++ b/python/sglang/srt/utils/common.py @@ -1831,7 +1831,8 @@ def get_device_capability(device_id: int = 0) -> Tuple[int, int]: major, minor, *_ = torch.xpu.get_device_capability(device_id)["version"].split( "." ) - major, minor = int(major), int(minor) + # Currently XPU version does not contain capability information. + major, minor = None, None if hasattr(torch, "hpu") and torch.hpu.is_available(): try: