intel / intel-extension-for-pytorch

A Python package for extending the official PyTorch that can easily obtain performance on Intel platform
Apache License 2.0
1.59k stars 244 forks source link

Does IPEX 1.12.0 work on machine without AVX512? #235

Open yangw1234 opened 2 years ago

yangw1234 commented 2 years ago

We got an "Illegal instruction (core dumped)" error when using IPEX 1.12.0 in machines without AVX-512.

It used to work on 1.11.0.

jingxu10 commented 2 years ago

Could you share more detailed info with us, please? which hardware platform, OS, python version did you run with?

jgong5 commented 2 years ago

Also, may I know if it happened when you ran a specific pytorch code or just from ipex import?

yangw1234 commented 2 years ago

CPU: Intel(R) Core(TM) i7-6700 CPU @ 3.40GHz OS: Ubuntu 20.04.1 LTS python: 3.7.10 code copied from ipex readme:

import torch
import torchvision.models as models

model = models.resnet50(pretrained=True)
model.eval()
data = torch.rand(1, 3, 224, 224)

import intel_extension_for_pytorch as ipex
model = model.to(memory_format=torch.channels_last)
model = ipex.optimize(model)
data = data.to(memory_format=torch.channels_last)

with torch.no_grad():
  model(data)

Here is the lscpu output:

Architecture:                    x86_64
CPU op-mode(s):                  32-bit, 64-bit
Byte Order:                      Little Endian
Address sizes:                   39 bits physical, 48 bits virtual
CPU(s):                          8
On-line CPU(s) list:             0-7
Thread(s) per core:              2
Core(s) per socket:              4
Socket(s):                       1
NUMA node(s):                    1
Vendor ID:                       GenuineIntel
CPU family:                      6
Model:                           94
Model name:                      Intel(R) Core(TM) i7-6700 CPU @ 3.40GHz
Stepping:                        3
CPU MHz:                         3717.295
CPU max MHz:                     4000.0000
CPU min MHz:                     800.0000
BogoMIPS:                        6799.81
Virtualization:                  VT-x
L1d cache:                       128 KiB
L1i cache:                       128 KiB
L2 cache:                        1 MiB
L3 cache:                        8 MiB
NUMA node0 CPU(s):               0-7
Vulnerability Itlb multihit:     KVM: Mitigation: Split huge pages
Vulnerability L1tf:              Mitigation; PTE Inversion; VMX conditional cache flushes, SMT vulnerable
Vulnerability Mds:               Mitigation; Clear CPU buffers; SMT vulnerable
Vulnerability Meltdown:          Mitigation; PTI
Vulnerability Spec store bypass: Mitigation; Speculative Store Bypass disabled via prctl and seccomp
Vulnerability Spectre v1:        Mitigation; usercopy/swapgs barriers and __user pointer sanitization
Vulnerability Spectre v2:        Mitigation; Full generic retpoline, IBPB conditional, IBRS_FW, STIBP conditional, RSB filling
Vulnerability Srbds:             Mitigation; Microcode
Vulnerability Tsx async abort:   Mitigation; Clear CPU buffers; SMT vulnerable
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 no
                                 nstop_tsc cpuid aperfmperf pni pclmulqdq dtes64 monitor ds_cpl vmx smx est tm2 ssse3 sdbg fma cx16 xtpr pdc
                                 m pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand lahf_lm abm 3dnowpref
                                 etch cpuid_fault invpcid_single pti ssbd ibrs ibpb stibp tpr_shadow vnmi flexpriority ept vpid ept_ad fsgsb
                                 ase tsc_adjust bmi1 hle avx2 smep bmi2 erms invpcid rtm mpx rdseed adx smap clflushopt intel_pt xsaveopt xs
                                 avec xgetbv1 xsaves dtherm ida arat pln pts hwp hwp_notify hwp_act_window hwp_epp md_clear flush_l1d
yangw1234 commented 2 years ago

Also, may I know if it happened when you ran a specific pytorch code or just from ipex import?

It seems the error happens at ipex.optimize

jingxu10 commented 2 years ago

Is it a native Ubuntu or Windows SubLinux (WSL) Ubuntu?

yangw1234 commented 2 years ago

Is it a native Ubuntu or Windows SubLinux (WSL) Ubuntu?

native ubuntu

xuhancn commented 2 years ago

@yangw1234 Could you please check current working isa level?

python Python 3.9.7 (default, Sep 16 2021, 13:09:58) [GCC 7.5.0] :: Anaconda, Inc. on linux Type "help", "copyright", "credits" or "license" for more information.

import intel_extension_for_pytorch._C as core core._get_current_isa_level() 'AMX' core._get_highest_cpu_support_isa_level() 'AMX' core._get_highest_binary_support_isa_level() 'AMX' quit() Origin link: https://github.com/intel/intel-extension-for-pytorch/blob/master/docs/design_doc/isa_dyndisp.md

yangw1234 commented 2 years ago

image

jgong5 commented 2 years ago

@yangw1234 We are working on a hot fix. Meanwhile, please note that IPEX is not optimized for AVX2 CPUs. We recommend to use CPUs with AVX512 and above to get a good performance boost.

EikanWang commented 2 years ago

@yangw1234 , we released the latest IPEX to fix the issue. Could you please try the latest IPEX and check whether the issue has been fixed?

EikanWang commented 2 years ago

https://pypi.org/project/intel-extension-for-pytorch/1.12.100/

yangw1234 commented 2 years ago

https://pypi.org/project/intel-extension-for-pytorch/1.12.100/

thanks @EikanWang we will try