Skip to content
Open
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
23 changes: 11 additions & 12 deletions backend/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,18 +163,17 @@ def _get_gpu_status() -> str:
elif backend_type == "mlx":
return "Metal (Apple Silicon via MLX)"

# Intel XPU (Arc / Data Center) via IPEX
try:
import intel_extension_for_pytorch # noqa: F401

if hasattr(torch, "xpu") and torch.xpu.is_available():
try:
xpu_name = torch.xpu.get_device_name(0)
except Exception:
xpu_name = "Intel GPU"
return f"XPU ({xpu_name})"
except ImportError:
pass
# Intel XPU (Arc / Data Center) — native PyTorch 2.4+ support; IPEX optional
if hasattr(torch, "xpu") and torch.xpu.is_available():
try:
import intel_extension_for_pytorch # noqa: F401 -- enhances XPU perf if available
except Exception:
pass
Comment thread
Dailaim marked this conversation as resolved.
try:
xpu_name = torch.xpu.get_device_name(0)
except Exception:
xpu_name = "Intel GPU"
return f"XPU ({xpu_name})"

return "None (CPU only)"

Expand Down
13 changes: 6 additions & 7 deletions backend/backends/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,13 +102,12 @@ def get_torch_device(
return "cuda"

if allow_xpu:
try:
import intel_extension_for_pytorch # noqa: F401

if hasattr(torch, "xpu") and torch.xpu.is_available():
return "xpu"
except ImportError:
pass
if hasattr(torch, "xpu") and torch.xpu.is_available():
try:
import intel_extension_for_pytorch # noqa: F401 -- enhances XPU perf if available
except Exception:
pass
return "xpu"
Comment thread
coderabbitai[bot] marked this conversation as resolved.

if allow_directml:
try:
Expand Down
22 changes: 11 additions & 11 deletions backend/routes/health.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,17 +67,17 @@ async def health():

has_xpu = False
xpu_name = None
try:
import intel_extension_for_pytorch as ipex # noqa: F401 -- side-effect import enables XPU

if hasattr(torch, "xpu") and torch.xpu.is_available():
has_xpu = True
try:
xpu_name = torch.xpu.get_device_name(0)
except Exception:
xpu_name = "Intel GPU"
except ImportError:
pass
# Native XPU support in PyTorch 2.4+; IPEX optional for enhanced performance
if hasattr(torch, "xpu") and torch.xpu.is_available():
has_xpu = True
try:
import intel_extension_for_pytorch # noqa: F401 -- enhances XPU perf if available
except Exception:
pass
Comment thread
coderabbitai[bot] marked this conversation as resolved.
try:
xpu_name = torch.xpu.get_device_name(0)
except Exception:
xpu_name = "Intel GPU"

has_directml = False
directml_name = None
Expand Down