Description
Describe the bug
Short story: One of the latest intel-oneapi-compiler-shared-opencl-cpu.icd
versions causes every call to clGetPlatformIDs
to hang indefinitely. This is probably not your issue, but I hope that you can suggest a work around.
Long story:
Running the code below just hangs forever on my system. The problem seems to be widespread (1, 2, 3, 4 and I have observed the issue on two different PCs) and can be "resolved" by just deleting the broken intel-oneapi-compiler-shared-opencl-cpu.icd
.
Problem is that this does not seem to be a solution for ipex
. When I delete intel-oneapi-compiler-shared-opencl-cpu.icd
and keep the intel.icd
, I get the error message below. The interesting bit is that ipex.optimize
succeeds (with some warnings), but then there is a runtime error stating that the kernel has been compiled for a different device and has to be recompiled (followed by many "bf conversion" errors).
My testcode, slightly adapted from the StableLM base code:
from transformers import AutoModelForCausalLM, AutoTokenizer
tokenizer = AutoTokenizer.from_pretrained("StabilityAI/stablelm-base-alpha-3b")
model = AutoModelForCausalLM.from_pretrained("StabilityAI/stablelm-base-alpha-3b")
import intel_extension_for_pytorch as ipex
model = model.to('xpu')
model = ipex.optimize(model)
inputs = tokenizer("What's your mood today?", return_tensors="pt").to('xpu')
tokens = model.generate(
**inputs,
max_new_tokens=64,
temperature=0.7,
do_sample=True,
)
print(tokenizer.decode(tokens[0], skip_special_tokens=True))
The error trace: https://gist.github.com/fhaust/b1e7dbb7cd506ec1dbf67b0026e03e84
Most noteable the lines:
RuntimeError: The program was built for 1 devices
Build program log for 'Intel(R) UHD Graphics [0x9b41]':
warning: module got recompiled from IR because provided native binary is incompatible with underlying device and/or driver [-Wrecompiled-from-ir]
Versions
(that collect_env.py does not seem to work for me ... somehow it tries to screen capture?
# python -m torch.utils.collect_env
Collecting environment information...
PyTorch version: 1.13.0a0+gitb1dde16
Is debug build: False
CUDA used to build PyTorch: None
ROCM used to build PyTorch: N/A
OS: Arch Linux (x86_64)
GCC version: (GCC) 12.2.1 20230201
Clang version: 15.0.7
CMake version: version 3.26.3
Libc version: glibc-2.37
Python version: 3.10.10 (main, Mar 5 2023, 22:26:53) [GCC 12.2.1 20230201] (64-bit runtime)
Python platform: Linux-6.2.12-arch1-1-x86_64-with-glibc2.37
Is CUDA available: False
CUDA runtime version: No CUDA
CUDA_MODULE_LOADING set to: N/A
GPU models and configuration: No CUDA
Nvidia driver version: No CUDA
cuDNN version: No CUDA
HIP runtime version: N/A
MIOpen runtime version: N/A
Is XNNPACK available: True
Versions of relevant libraries:
[pip3] intel-extension-for-pytorch==1.13.10+xpu
[pip3] numpy==1.23.4
[pip3] torch==1.13.0a0+gitb1dde16
[pip3] torchaudio==0.13.1+b90d798
[conda] No relevant packages
# cat /proc/cpuinfo
processor : 0
vendor_id : GenuineIntel
cpu family : 6
model : 142
model name : Intel(R) Core(TM) i7-10510U CPU @ 1.80GHz
stepping : 12
microcode : 0xf4
cpu MHz : 800.273
cache size : 8192 KB
physical id : 0
siblings : 8
core id : 0
cpu cores : 4
apicid : 0
initial apicid : 0
fpu : yes
fpu_exception : yes
cpuid level : 22
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm pbe syscall nx pdpe1gb rdtscp lm constant_tsc art arch_perfmon pebs bts rep_good nopl xtopology nonstop_tsc cpuid aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx est tm2 ssse3 sdbg fma cx16 xtpr pdcm pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch cpuid_fault epb invpcid_single ssbd ibrs ibpb stibp ibrs_enhanced tpr_shadow vnmi flexpriority ept vpid ept_ad fsgsbase tsc_adjust sgx bmi1 avx2 smep bmi2 erms invpcid mpx rdseed adx smap clflushopt intel_pt xsaveopt xsavec xgetbv1 xsaves dtherm ida arat pln pts hwp hwp_notify hwp_act_window hwp_epp md_clear flush_l1d arch_capabilities
vmx flags : vnmi preemption_timer invvpid ept_x_only ept_ad ept_1gb flexpriority tsc_offset vtpr mtf vapic ept vpid unrestricted_guest ple pml ept_mode_based_exec
bugs : spectre_v1 spectre_v2 spec_store_bypass swapgs itlb_multihit srbds mmio_stale_data retbleed eibrs_pbrsb
bogomips : 4601.60
clflush size : 64
cache_alignment : 64
address sizes : 39 bits physical, 48 bits virtual
power management:
# lspci | grep VGA
00:02.0 VGA compatible controller: Intel Corporation CometLake-U GT2 [UHD Graphics] (rev 02)