Does PyTorch fall back to non-accelerated code when NNPACK shows "Unsupported hardware"?

Context: I inherited a project using Python3 and PyTorch 1.11.0, and I was running this on Ubuntu 20.04 on an (old) desktop machine.

When I run the code, I’m seeing this message (it’s not clear actually if this is an error or a warning):

[W NNPACK.cpp:51] Could not initialize NNPACK! Reason: Unsupported hardware.

I checked /proc/cpuinfo and the machine doesn’t support AVX2 (it’s an Intel(R) Core™2 Quad CPU Q8200 @ 2.33GHz), so that could be the reason for this message.

The code does appear to continue to run though, and I also get a nice confusion matrix of the classification task it’s running at the end, which appears reasonable compared to previously reported results with that code.

So, my question is:
What happens when NNPACK detects there is no AVX2 support (I presume) on the machine it’s running on?
Does PyTorch fall back to non-accelerated code in that case (so, still running correctly, but slower)?

I asked on the NNPACK GitHub issues board, and there the answer was: “NNPACK doesn’t have a fall-back for unsupported machines. Higher-level frameworks integrating NNPACK may have one.”
So, it depends on how PyTorch handles this then.

Thanks for your feedback!


PyTorch should use a fallback if NNPACK cannot be initialized.
The warning is raised from init_nnpack, which is called by _nnpack_available() and used in use_nnpack to select the backend here as ConvBackend::NnpackSpatial or ConvBackend::Slow2d.

Thank you for looking this up in the source and confirming the fallback mechanism.
This also confirms that the code indeed continues to run (and doesn’t crash) and that this is merely a warning message.