intel / intel-extension-for-tensorflow

Intel® Extension for TensorFlow*
Other
317 stars 40 forks source link

Illegal instruction on import #58

Closed aplund closed 9 months ago

aplund commented 10 months ago

This may be an issue with another library (libitex_cpu.so), but when I install with the '[cpu]' variant, I obtain the following:

$ python -c "import intel_extension_for_tensorflow" 2024-01-19 18:02:04.976781: I tensorflow/core/util/port.cc:111] oneDNN custom operations are on. You may see slightly different numerical results due to floating-point round-off errors from different computation orders. To turn them off, set the environment variable TF_ENABLE_ONEDNN_OPTS=0. 2024-01-19 18:02:04.978020: I tensorflow/tsl/cuda/cudart_stub.cc:28] Could not find cuda drivers on your machine, GPU will not be used. 2024-01-19 18:02:04.996837: E tensorflow/compiler/xla/stream_executor/cuda/cuda_dnn.cc:9342] Unable to register cuDNN factory: Attempting to register factory for plugin cuDNN when one has already been registered 2024-01-19 18:02:04.996870: E tensorflow/compiler/xla/stream_executor/cuda/cuda_fft.cc:609] Unable to register cuFFT factory: Attempting to register factory for plugin cuFFT when one has already been registered 2024-01-19 18:02:04.996894: E tensorflow/compiler/xla/stream_executor/cuda/cuda_blas.cc:1518] Unable to register cuBLAS factory: Attempting to register factory for plugin cuBLAS when one has already been registered 2024-01-19 18:02:05.001374: I tensorflow/tsl/cuda/cudart_stub.cc:28] Could not find cuda drivers on your machine, GPU will not be used. 2024-01-19 18:02:05.001556: I tensorflow/core/platform/cpu_feature_guard.cc:182] This TensorFlow binary is optimized to use available CPU instructions in performance-critical operations. To enable the following instructions: AVX2 AVX_VNNI FMA, in other operations, rebuild TensorFlow with the appropriate compiler flags. 2024-01-19 18:02:05.508892: W tensorflow/compiler/tf2tensorrt/utils/py_utils.cc:38] TF-TRT Warning: Could not find TensorRT Illegal instruction (core dumped)

Some version info:

$ pip list | grep tensorflow intel-extension-for-tensorflow 2.14.0.1 intel-extension-for-tensorflow-lib 2.14.0.1.0 tensorflow 2.14.0 tensorflow-estimator 2.14.0 tensorflow-io-gcs-filesystem 0.35.0 tensorflow-probability 0.22.1

Backtrace from gdb:

bt.txt

vpirogov commented 10 months ago

@aplund, looks like the guilty instruction was generated by compiler somewhere in protobuf internals. What processor do you have?

aplund commented 10 months ago

@vpirogov Here's the first entry in my /proc/cpuinfo

$ cat /proc/cpuinfo processor : 0 vendor_id : GenuineIntel cpu family : 6 model : 186 model name : 13th Gen Intel(R) Core(TM) i7-1355U stepping : 3 microcode : 0x411c cpu MHz : 871.379 cache size : 12288 KB physical id : 0 siblings : 12 core id : 0 cpu cores : 10 apicid : 0 initial apicid : 0 fpu : yes fpu_exception : yes cpuid level : 32 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 tsc_known_freq pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 sdbg fma cx16 xtpr pdcm sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowprefetch cpuid_fault epb ssbd ibrs ibpb stibp ibrs_enhanced tpr_shadow flexpriority ept vpid ept_ad fsgsbase tsc_adjust bmi1 avx2 smep bmi2 erms invpcid rdseed adx smap clflushopt clwb intel_pt sha_ni xsaveopt xsavec xgetbv1 xsaves split_lock_detect user_shstk avx_vnni dtherm ida arat pln pts hwp hwp_notify hwp_act_window hwp_epp hwp_pkg_req hfi vnmi umip pku ospke waitpkg gfni vaes vpclmulqdq rdpid movdiri movdir64b fsrm md_clear serialize arch_lbr ibt flush_l1d arch_capabilities vmx flags : vnmi preemption_timer posted_intr invvpid ept_x_only ept_ad ept_1gb flexpriority apicv tsc_offset vtpr mtf vapic ept vpid unrestricted_guest vapic_reg vid ple shadow_vmcs ept_mode_based_exec tsc_scaling usr_wait_pause bugs : spectre_v1 spectre_v2 spec_store_bypass swapgs eibrs_pbrsb bogomips : 5224.00 clflush size : 64 cache_alignment : 64 address sizes : 39 bits physical, 48 bits virtual power management:

vpirogov commented 10 months ago

You CPU has Intel AVX2 and VNNI instructions. Looks like ITEX CPU package was built with Intel AVX512 specific optimizations via either -march=native or -mavx512f flags:

$ sde -rpl -- python -c "import intel_extension_for_tensorflow as itex; print(itex.__version__)"
2024-01-19 15:22:53.865984: I tensorflow/core/util/port.cc:111] oneDNN custom operations are on. You may see slightly different numerical results due to floating-point round-off errors from different computation orders. To turn them off, set the environment variable `TF_ENABLE_ONEDNN_OPTS=0`.
2024-01-19 15:22:54.155644: I tensorflow/tsl/cuda/cudart_stub.cc:28] Could not find cuda drivers on your machine, GPU will not be used.
2024-01-19 15:23:00.429215: E tensorflow/compiler/xla/stream_executor/cuda/cuda_dnn.cc:9342] Unable to register cuDNN factory: Attempting to register factory for plugin cuDNN when one has already been registered
2024-01-19 15:23:00.430991: E tensorflow/compiler/xla/stream_executor/cuda/cuda_fft.cc:609] Unable to register cuFFT factory: Attempting to register factory for plugin cuFFT when one has already been registered
2024-01-19 15:23:00.436793: E tensorflow/compiler/xla/stream_executor/cuda/cuda_blas.cc:1518] Unable to register cuBLAS factory: Attempting to register factory for plugin cuBLAS when one has already been registered
2024-01-19 15:23:04.091774: I tensorflow/tsl/cuda/cudart_stub.cc:28] Could not find cuda drivers on your machine, GPU will not be used.
2024-01-19 15:23:04.152631: I tensorflow/core/platform/cpu_feature_guard.cc:182] This TensorFlow binary is optimized to use available CPU instructions in performance-critical operations.
To enable the following instructions: AVX2 AVX_VNNI FMA, in other operations, rebuild TensorFlow with the appropriate compiler flags.
2024-01-19 15:23:13.424663: W tensorflow/compiler/tf2tensorrt/utils/py_utils.cc:38] TF-TRT Warning: Could not find TensorRT
TID 0 SDE-ERROR: Executed instruction not valid for specified chip (ALDER_LAKE): 0x7f37bbb3e22f: vmovdqa64 xmm1, xmmword ptr [rbp-0x10]
Image: /nfs/pdx/home/vpirogov/miniconda3/lib/python3.10/site-packages/tensorflow-plugins/libitex_cpu.so+0x2e222f
Function: _ZN6google8protobuf8internal16ReadSizeFallbackEPKcj
Instruction bytes are: 62 f1 fd 08 6f 4d ff

Let's see what maintainers have to say.

guizili0 commented 10 months ago

@vpirogov Thanks. @aplund This is issue from ITEX build, we will release a new binary with correct build setting soon.

aplund commented 9 months ago

Looks like this has been fixed for 2.14.0.2.

guizili0 commented 9 months ago

@aplund yes, you are right, we fixed this issue in ITEX 2.14.0.2.