NNPACK
NNPACK copied to clipboard
Windows
Can NNPACK support windows?
Here is a list of obstacles to Windows support:
- NNPACK is written in C99, and Microsoft compilers still do not support this 17 years old standard.
- It is possible to compile NNPACK with Clang with Microsoft codegen from the recent Visual Studio version, and the current
configure.py
has incomplete initial support for this configuration. However, linking would fail because the runtime library does not support_Complex float
functions from C99 standard library. These functions are widely used in the reference implementation of FFT functions in NNPACK, and thus it is impossible to link the unit tests without them. - NNPACK uses
pthreadpool
library for multi-threading, andpthreadpool
is implemented on top ofpthreads
and GCC-specific intrinsic functions for atomic operations.pthreads
interface is not natively supported on Windows. Probably github.com/GerHobbelt/pthread-win32 can be leveraged topthreads
on Windows, but I didn't try.
Other options to try:
- Compilation of NNPACK with Cygwin might work, but would be incompatible with most of Windows ecosystem.
- Compilation of NNPACK with mingw would solve problems 1 and 2, probably problem 3 as well.
- Compilation to NNPACK with Intel compiler for Windows should fix problems 1 and 2.
pthreadpool
dependency onpthreads
would need to be resolved manually.
That said, I don't have plans (and time) for Windows port, but such contribution would be welcome!
It's very helpful.
Is it possible that I can easily compile NNPACK with Intel compiler for Windows if I just use
enum nnp_status nnp_convolution_inference(
enum nnp_convolution_algorithm algorithm,
enum nnp_convolution_transform_strategy transform_strategy,
size_t input_channels,
size_t output_channels,
struct nnp_size input_size,
struct nnp_padding input_padding,
struct nnp_size kernel_size,
struct nnp_size output_subsampling,
const float input[],
const float kernel[],
const float bias[],
float output[],
pthreadpool_t threadpool,
struct nnp_profile* profile)
for deployment and don't use the multi-thread feature within it(simply assign threadpool = null
)?
@knsong I think it will work. You'll have to remove nearly all implementation code from the thread pool.
I converted the c99 AVX2 convolution part to a native windows c++ static library. I used the microsoft ppl functionality as a solution for the threadpool. Many thanks for your great library! Filip
@zeno40 could you please create a PR?
Well I created a public repository
https://github.com/zeno40/nnpack-windows