Maratyszcza / NNPACK

Acceleration package for neural networks on multi-core CPUs
BSD 2-Clause "Simplified" License
1.68k stars 316 forks source link

Unsupported Hardware on VM with compatible CPU #207

Open RomainCendre opened 2 years ago

RomainCendre commented 2 years ago

Hi everyone, I'm having some issues with NNPack, but I didn't know where to start. I'm getting the famous message Could not initialize NNPACK! Reason: Unsupported hardware that seems related to CPU that doesn't have AVX2 and 3-level cache. I also forgot to say that this error start since we were switching a virtual machine from CentOS to Ubuntu. I start looking at CPU info inside the Ubuntu VM and it seems that AVX2 and cache are rightly detected.

So I'm wondering, can a library or something that can be missing that makes my CPU to be incorrectly driven? Best regards

RomainCendre commented 2 years ago

Also, the same code run perfectly on the host machine on Ubuntu 21 with NNPack... =/

RomainCendre commented 2 years ago

So basically, the problem seems to be from VvirtualBox (something with AVX through virtualbox). I didn't find the way to make it work from a Ubuntu host, but using VMWare player did the job instead. Have a nice day

spikeburton commented 1 year ago

I ran into a similar issue, and it was related to the L3 cache.

I am running an Ubuntu 22.04 VM using KVM/QEMU/libvirt, with an AMD Ryzen CPU. After adjusting the CPU settings for the VM, the cache size shown with lscpu looked correct and I no longer hit this issue:

<cpu mode='host-passthrough'>
    <topology sockets='1' dies='1' cores='4' threads='2'/>
    <cache mode='passthrough'/>
    <feature policy='require' name='topoext'/>
</cpu>

In particular it is the topoext feature that was required with QEMU for the VM to be correctly aware of the CPU topology. As far as I am aware this is only relevant for AMD CPUs. Sharing in case this may help you or someone else.