Closed t-vi closed 5 years ago
Hello Marat,
thanks for your work on NNPACK!
Here is some background info for the PR:
While investigating https://github.com/pytorch/pytorch/issues/17901, I found that NNPACK won't build on i386 systems due to CMake reporting x86_64 as the CMAKE_SYSTEM_PROCESSOR.
See here for a similar workaround: https://github.com/opencv/opencv/blob/master/cmake/OpenCVDetectCXXCompiler.cmake#L104
The proposed fix would misdetect x86-64 systems with x32 ABI. As a better work-around, you can explicitly specify -DCMAKE_SYSTEM_PROCESSOR=i386
or -DNNPACK_BACKEND=psimd
to avoid x86-64-specific parts of NNPACK.
Hi Marat,
right. I thought that x32 was much a more unlikely target, but as the developer you'd know better.
Would you take a patch using a compile check whether __386__
or _M_I386
is defined and switch on that?
Best regards
Thomas
Yes, doing preprocessing-time check sounds good with me
When building on 32bit linux ("i386" architecture) on a 64 bit machine, cmake will report CMAKE_SYSTEM_PROCESSOR as x86_64 - which is not intended. This currently causes NNPACK to detect x86-64 target when the psimd would be correct - the result is a mix of x86_64 and x86 object files and unhappy linkers.