Commit Graph

21 Commits

Author SHA1 Message Date
b9adbb5002 Fix/relax CMake linter rules (#35574)
Summary:
Ignore mixed upper-case/lower-case style for now
Fix space between function and its arguments violation
Pull Request resolved: https://github.com/pytorch/pytorch/pull/35574

Test Plan: CI

Differential Revision: D20712969

Pulled By: malfet

fbshipit-source-id: 0012d430aed916b4518599a0b535e82d15721f78
2020-03-27 16:52:33 -07:00
45c9ed825a Formatting cmake (to lowercase without space for if/elseif/else/endif) (#35521)
Summary:
Running commands:
```bash
shopt -s globstar

sed -e 's/IF (/if(/g' -e 's/IF(/if(/g' -e 's/if (/if(/g' -e 's/ELSE (/else(/g' -e 's/ELSE(/else(/g' -e 's/else (/else(/g' -e 's/ENDif(/endif(/g' -e 's/ELSEif(/elseif(/g' -i CMakeLists.txt
sed -e 's/IF (/if(/g' -e 's/IF(/if(/g' -e 's/if (/if(/g' -e 's/ELSE (/else(/g' -e 's/ELSE(/else(/g' -e 's/else (/else(/g' -e 's/ENDif(/endif(/g' -e 's/ELSEif(/elseif(/g' -i caffe2/**/CMakeLists.txt
sed -e 's/IF (/if(/g' -e 's/IF(/if(/g' -e 's/if (/if(/g' -e 's/ELSE (/else(/g' -e 's/ELSE(/else(/g' -e 's/else (/else(/g' -e 's/ENDif(/endif(/g' -e 's/ELSEif(/elseif(/g' -i torch/**/CMakeLists.txt
sed -e 's/IF (/if(/g' -e 's/IF(/if(/g' -e 's/if (/if(/g' -e 's/ELSE (/else(/g' -e 's/ELSE(/else(/g' -e 's/else (/else(/g' -e 's/ENDif(/endif(/g' -e 's/ELSEif(/elseif(/g' -i c10/**/CMakeLists.txt
sed -e 's/IF (/if(/g' -e 's/IF(/if(/g' -e 's/if (/if(/g' -e 's/ELSE (/else(/g' -e 's/ELSE(/else(/g' -e 's/else (/else(/g' -e 's/ENDif(/endif(/g' -e 's/ELSEif(/elseif(/g' -i cmake/**/*.cmake
sed -e 's/IF (/if(/g' -e 's/IF(/if(/g' -e 's/if (/if(/g' -e 's/ELSE (/else(/g' -e 's/ELSE(/else(/g' -e 's/else (/else(/g' -e 's/ENDif(/endif(/g' -e 's/ELSEif(/elseif(/g' -i cmake/**/*.cmake.in
```
We may further convert all the commands into lowercase according to the following issue: 77543bde41.
Pull Request resolved: https://github.com/pytorch/pytorch/pull/35521

Differential Revision: D20704382

Pulled By: malfet

fbshipit-source-id: 42186b9b1660c34428ab7ceb8d3f7a0ced5d2e80
2020-03-27 14:25:17 -07:00
b662a9b66a 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
2019-01-18 15:34:35 -08:00
63b5cc47eb [caffe2] Minor changes in NNPACK CMake scripts (#6532)
- Tell NNPACK to not link pthreadpool, but only its headers
- Remove FindNNPACK.cmake as it is no longer used
2018-04-11 20:56:38 -04:00
e45b51148a [caffe2] Always build NNPACK together with Caffe2 (#6365)
Caffe2 started with an option to use NNPACK pre-installed in the system.
Now this option is mostly legacy, as Caffe2 can include NNPACK in its own build on all platforms.
Due to problems when pre-installed NNPACK is built with different dependencies or compiler options, we decided to remove this option and alwyas build NNPACK with Caffe2.
This change makes Caffe2 always build NNPACK as part of its own build, and updates NNPACK and cpuinfo submodules.
2018-04-06 18:27:59 -04:00
09b6ad5785 Use cpuinfo instead of Android's libcpufeatures in Android build 2018-03-09 22:20:37 -05:00
08113f922b Vendor Python dependencies of NNPACK
Summary:
Include six, enum34, and PeachPy as Caffe2 submodules, and use the versions from submodules instead of downloading them during configuration time
Closes https://github.com/caffe2/caffe2/pull/1917

Reviewed By: orionr

Differential Revision: D6938735

Pulled By: Maratyszcza

fbshipit-source-id: 841a6c47a1cd003a19f48f6c256aa4d9eb2cc6e4
2018-02-08 15:48:56 -08:00
3108ce63ba Back out "[caffe2][PR] Vendor Python dependencies of NNPACK"
Summary:
Original commit changeset: d0c1c7681605

Reverting due to broken OSS build due to this commit

Reviewed By: bddppq

Differential Revision: D6935666

fbshipit-source-id: 955cfeb6d5a4ed265b2e099094cfb5bfe960ff95
2018-02-08 01:34:22 -08:00
9093eb1ba0 Vendor Python dependencies of NNPACK
Summary:
Include six, enum34, and PeachPy as Caffe2 submodules, and use the versions from submodules instead of downloading them during configuration time
Closes https://github.com/caffe2/caffe2/pull/1901

Differential Revision: D6930731

Pulled By: Maratyszcza

fbshipit-source-id: d0c1c7681605d957de6f51bd24fbb25afc0f282f
2018-02-07 17:48:06 -08:00
39b351ecb0 Fix build with NNPACK
Summary:
- Fix path to FXdiv and FP16 dependencies
- Link cpuinfo library
- Pull NNPACK fix for PYTHONPATH handling when launching PeachPy
- Pull cpuinfo fix for cross-compiling on Linux for Android
- Pull cpuinfo fix for CPUINFO_LIBRARY_TYPE support
- Pull cpuinfo fix for iOS builds
Closes https://github.com/caffe2/caffe2/pull/1869

Differential Revision: D6881428

Pulled By: Maratyszcza

fbshipit-source-id: 7b4115daa090096dbd97303503792e7b144fbb43
2018-02-01 20:47:10 -08:00
7ee286c80a Vendor NNPACK dependencies with Caffe2 2018-01-31 21:05:07 -08:00
224493d9ce NNPACK: Use new bindings and custom thread pool
Summary:
This change should dramatically (~10X) improve performance of convolution with NNPACK engine
Closes https://github.com/caffe2/caffe2/pull/1730

Reviewed By: sf-wind

Differential Revision: D6695895

Pulled By: Maratyszcza

fbshipit-source-id: 26291916811ef4cb819a59aec848c4e23668e568
2018-01-11 10:48:12 -08:00
febe45ebb4 Disable NNPACK build on unsupported CPU architectures
Summary:
Few people complained in NNPACK repo about broken build on PPC64, as it specifically whitelists supported architecture in its CMakeLists.txt, and refuses to build on unsupported platforms. This commit explicitly disables NNPACK build (as part of Caffe2 build) on unsupported architectures.
Closes https://github.com/caffe2/caffe2/pull/1439

Differential Revision: D6288999

Pulled By: Maratyszcza

fbshipit-source-id: 76c40e9ce882356944b63968df8fd853f21ecd35
2017-11-09 13:48:05 -08:00
1021402136 Compile nnpack and pthreadpool with -fPIC
Summary: Closes https://github.com/caffe2/caffe2/pull/1428

Reviewed By: Maratyszcza

Differential Revision: D6240390

Pulled By: pietern

fbshipit-source-id: 6d441bbfda81ce79e3c824ec28eec0b2cdd8c7cd
2017-11-03 20:19:26 -07:00
54972458e1 Build NNPACK and pthreadpool as static libraries
Summary: Closes https://github.com/caffe2/caffe2/pull/1427

Differential Revision: D6239272

Pulled By: Maratyszcza

fbshipit-source-id: 644b588838235b55086413e08bb7f144d924507f
2017-11-03 17:32:35 -07:00
817eaf6b1f Build NNPACK using its own CMake scripts
Summary:
NNPACK now supports building with CMake, and its build scripts have advantages over the ones in Caffe2:
- They automatically download all dependencies, no need to keep them in submodules anymore
- They automatically download and setup PeachPy for x86-64 build
- The same scripts are used for server/desktop (Linux, macOS) and mobile (Android/iOS)
- They unblock Caffe2 build with Ninja
Closes https://github.com/caffe2/caffe2/pull/1382

Reviewed By: Yangqing

Differential Revision: D6150723

Pulled By: Maratyszcza

fbshipit-source-id: 7c3e4e3406f60d4cc059e1c8112cb10aa3d75ece
2017-10-25 18:48:06 -07:00
5e0d434b4b Add build support for opengl and latest nnpack.
Summary:
(1) Changed android-cmake to use Yangqing/android-cmake, which supports NEON fp16.
(2) Added cmake scripts to build opengl.
(3) Updated nnpack to master, and changed the corresponding build files.
Closes https://github.com/caffe2/caffe2/pull/1061

Differential Revision: D5591387

Pulled By: Yangqing

fbshipit-source-id: 1d3f28511d33c09df6ecef5041448ac9a3246601
2017-08-09 00:31:53 -07:00
49c89d6664 Use add_dependencies() for ExternalProjects
Summary:
I closed https://github.com/caffe2/caffe2/pull/736 because one of these variables should be used after all.

Here's how C1 uses this variable: https://github.com/BVLC/caffe/blob/rc5/cmake/Targets.cmake#L116

Without this fix, there is a race condition in the parallel build leading to this error:
```
make[2]: *** No rule to make target `../third_party/NNPACK/lib/libnnpack.a', needed by `caffe2/libCaffe2_CPU.so'.
```
Closes https://github.com/caffe2/caffe2/pull/737

Differential Revision: D5211794

Pulled By: Yangqing

fbshipit-source-id: 9e368f09b01edaf86252727adc6f6cc40d244e29
2017-06-08 13:34:42 -07:00
22f3825d8f Cmake mobile build improvements
Summary:
(1) integrate gcc compatible nnpack
(2) speed up the ios travis ci.
Closes https://github.com/caffe2/caffe2/pull/268

Differential Revision: D4897576

Pulled By: Yangqing

fbshipit-source-id: 729fa2e4b5be6f1d0b8d55305f047116969ff61f
2017-04-16 16:46:58 -07:00
afe3df32f5 test existence of confu and ninja before installing nnpack.
Summary:
TSIA
Closes https://github.com/caffe2/caffe2/pull/229

Differential Revision: D4795563

Pulled By: aaronmarkham

fbshipit-source-id: 4df871760a1124bb7a2ef226d01b4ced12d21ab1
2017-03-29 10:18:07 -07:00
1aa5231fb3 make nnpack build on mac/linux, and also contbuild support
Summary:
* add custom ninja install

* minimal build for nnpack

* force -fPIC for nnpack
Closes https://github.com/caffe2/caffe2/pull/207

Differential Revision: D4729265

Pulled By: Yangqing

fbshipit-source-id: 2ed345a4fda6b4811af03cd1898e2402dda58701
2017-03-17 15:19:07 -07:00