Skip to content
Merged
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
13 changes: 11 additions & 2 deletions bitsandbytes/backends/cpu_xpu_common.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import subprocess
from typing import Optional
import warnings

Expand All @@ -19,6 +20,14 @@
ipex_xpu = None


gxx_available = False
try:
subprocess.run(["g++", "--version"])
gxx_available = True
except BaseException:
warnings.warn("g++ not found, torch.compile disabled for CPU/XPU.")


Tensor = torch.Tensor


Expand All @@ -45,8 +54,8 @@ def _ipex_xpu_version_prereq(major, minor):


def _maybe_torch_compile(func):
# torch.compile requires pytorch >= 2.0
if _torch_version_prereq(2, 0):
# torch.compile requires g++ and pytorch >= 2.0
if gxx_available and _torch_version_prereq(2, 0):
options = {}
# fx_graph_cache requires pytorch >= 2.2
if _torch_version_prereq(2, 2):
Expand Down