Skip to content

[XPU] log clean up for XPU platform #20553

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 7, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion vllm/_custom_ops.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@

logger = init_logger(__name__)

if not current_platform.is_tpu() and not current_platform.is_hpu():
if not current_platform.is_tpu() and not current_platform.is_hpu()\
and not current_platform.is_xpu():
Comment on lines +16 to +17
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Consider using parentheses for line continuation instead of a backslash for better readability and adherence to Python's style guidelines (PEP 8).

if not (current_platform.is_tpu() or
        current_platform.is_hpu() or
        current_platform.is_xpu()):

try:
import vllm._C
except ImportError as e:
Expand Down
7 changes: 3 additions & 4 deletions vllm/platforms/xpu.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def get_attn_backend_cls(cls, selected_backend: _Backend, head_size: int,
dtype: torch.dtype, kv_cache_dtype: Optional[str],
block_size: int, use_v1: bool,
use_mla: bool) -> str:
if selected_backend != _Backend.IPEX:
if selected_backend is not None and selected_backend != _Backend.IPEX:
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

Consider checking if selected_backend is None before accessing it to avoid a potential AttributeError if it's unexpectedly None.

if selected_backend is not None and selected_backend != _Backend.IPEX:

logger.info("Cannot use %s backend on XPU.", selected_backend)
use_v1 = envs.VLLM_USE_V1
if not use_v1:
Expand Down Expand Up @@ -137,8 +137,7 @@ def check_and_update_config(cls, vllm_config: VllmConfig) -> None:

@classmethod
def is_pin_memory_available(cls):
logger.warning("Pin memory is not supported on XPU.")
return False
return True

Comment on lines +140 to 141
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

The warning message stating that pin memory is not supported on XPU is no longer accurate, as this change enables pin memory. Consider removing the warning to avoid confusion.

return True

@classmethod
def get_current_memory_usage(cls,
Expand Down Expand Up @@ -181,4 +180,4 @@ def supports_v1(cls, model_config: ModelConfig) -> bool:

@classmethod
def device_count(cls) -> int:
return torch.xpu.device_count()
return torch.xpu.device_count()