add back NNPACK in PyTorch (#15924)
authorThomas Viehmann <tv@beamnet.de>
Fri, 18 Jan 2019 23:27:12 +0000 (15:27 -0800)
committerFacebook Github Bot <facebook-github-bot@users.noreply.github.com>
Fri, 18 Jan 2019 23:34:35 +0000 (15:34 -0800)
commitb662a9b66a0f1b7d79749ccd0fbf07245eee8f06
tree6be02658275315eb86a741fe085a63a73526db7b
parented57425b0a42165397d40783aaba15d7b495bb86
add back NNPACK in PyTorch (#15924)

Summary:
This tests the water for adding back NNPACK in PyTorch, it's a lot better than the fallback THNN versions.

In #6151, we (ezyang and soumith) removed NNPACK support from PyTorch. Of course Maratyszcza might have advice, too. (Or an opinion on the CMake changes.)

The only functional changes are to use NNPack more aggressively on mobile and a .contiguous() to match NNPack's assumption (I stumbled over that while using NNPack for style transfer.)
The CMake changes try to use the NNPack we already have in git.

In terms of lines of code this is a large part of the diff of https://lernapparat.de/pytorch-jit-android/ . As far as I can tell, we don't have MKLDNN on mobile and the native THNN implementation are prohibitively expensive in terms of both CPU and memory.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/15924

Differential Revision: D13709576

Pulled By: ezyang

fbshipit-source-id: f2e287739909451c173abf046588209a7450ca2c
aten/CMakeLists.txt
aten/src/ATen/CMakeLists.txt
aten/src/ATen/Config.h.in
aten/src/ATen/native/Convolution.cpp
aten/src/ATen/native/NNPACK.cpp [new file with mode: 0644]
aten/src/ATen/native/native_functions.yaml
aten/src/TH/THAllocator.cpp
caffe2/utils/threadpool/pthreadpool.cc
cmake/External/nnpack.cmake
test/test_nn.py
tools/autograd/derivatives.yaml