Skip to content
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
35 changes: 22 additions & 13 deletions bitsandbytes/cextension.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,14 @@ def get_native_library() -> BNBNativeLibrary:

ROCM_GPU_ARCH = get_rocm_gpu_arch()

try:
import intel_extension_for_pytorch as ipex

assert ipex._C._has_cpu() or ipex._C._has_xpu()
is_ipex_available = True
except Exception:
is_ipex_available = False

try:
if torch.version.hip:
hip_major, hip_minor = map(int, torch.version.hip.split(".")[0:2])
Expand All @@ -107,16 +115,17 @@ def get_native_library() -> BNBNativeLibrary:
lib = get_native_library()
except Exception as e:
lib = None
logger.error(f"Could not load bitsandbytes native library: {e}", exc_info=True)
if torch.cuda.is_available():
logger.warning(
f"""
{BNB_BACKEND} Setup failed despite {BNB_BACKEND} being available. Please run the following command to get more information:

python -m bitsandbytes

Inspect the output of the command and see if you can locate {BNB_BACKEND} libraries. You might need to add them
to your LD_LIBRARY_PATH. If you suspect a bug, please take the information from python -m bitsandbytes
and open an issue at: https://github.com/bitsandbytes-foundation/bitsandbytes/issues
""",
)
if not is_ipex_available:
logger.error(f"Could not load bitsandbytes native library: {e}", exc_info=True)
if torch.cuda.is_available():
logger.warning(
f"""
{BNB_BACKEND} Setup failed despite {BNB_BACKEND} being available. Please run the following command to get more information:

python -m bitsandbytes

Inspect the output of the command and see if you can locate {BNB_BACKEND} libraries. You might need to add them
to your LD_LIBRARY_PATH. If you suspect a bug, please take the information from python -m bitsandbytes
and open an issue at: https://github.com/bitsandbytes-foundation/bitsandbytes/issues
""",
)
4 changes: 2 additions & 2 deletions docs/source/installation.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -341,10 +341,10 @@ pip install -e . # `-e` for "editable" install, when developing BNB (otherwise
</hfoption>
<hfoption id="Intel CPU + GPU">

#### Intel CPU
#### Intel CPU / XPU

> [!TIP]
> Intel CPU backend only supports building from source; for now, please follow the instructions below.
> Intel CPU / XPU backend only supports building from source; for now, please follow the instructions below.

Similar to the CUDA case, you can compile bitsandbytes from source for Linux and Windows systems.

Expand Down