Commit
·
fc51cf7
1
Parent(s):
6ba3b8d
Update README.md
Browse files
README.md
CHANGED
|
@@ -1,130 +0,0 @@
|
|
| 1 |
-
# XNNPACK
|
| 2 |
-
|
| 3 |
-
XNNPACK is a highly optimized solution for neural network inference on ARM, x86, WebAssembly, and RISC-V platforms. XNNPACK is not intended for direct use by deep learning practitioners and researchers; instead it provides low-level performance primitives for accelerating high-level machine learning frameworks, such as [TensorFlow Lite](https://www.tensorflow.org/lite), [TensorFlow.js](https://www.tensorflow.org/js), [PyTorch](https://pytorch.org/), [ONNX Runtime](https://onnxruntime.ai), and [MediaPipe](https://mediapipe.dev).
|
| 4 |
-
|
| 5 |
-
## Supported Architectures
|
| 6 |
-
|
| 7 |
-
- ARM64 on Android, iOS, macOS, Linux, and Windows
|
| 8 |
-
- ARMv7 (with NEON) on Android
|
| 9 |
-
- ARMv6 (with VFPv2) on Linux
|
| 10 |
-
- x86 and x86-64 (up to AVX512) on Windows, Linux, macOS, Android, and iOS simulator
|
| 11 |
-
- WebAssembly MVP
|
| 12 |
-
- WebAssembly SIMD
|
| 13 |
-
- [WebAssembly Relaxed SIMD](https://github.com/WebAssembly/relaxed-simd) (experimental)
|
| 14 |
-
- RISC-V (RV32GC and RV64GC)
|
| 15 |
-
|
| 16 |
-
## Operator Coverage
|
| 17 |
-
|
| 18 |
-
XNNPACK implements the following neural network operators:
|
| 19 |
-
|
| 20 |
-
- 2D Convolution (including grouped and depthwise)
|
| 21 |
-
- 2D Deconvolution (AKA Transposed Convolution)
|
| 22 |
-
- 2D Average Pooling
|
| 23 |
-
- 2D Max Pooling
|
| 24 |
-
- 2D ArgMax Pooling (Max Pooling + indices)
|
| 25 |
-
- 2D Unpooling
|
| 26 |
-
- 2D Bilinear Resize
|
| 27 |
-
- 2D Depth-to-Space (AKA Pixel Shuffle)
|
| 28 |
-
- Add (including broadcasting, two inputs only)
|
| 29 |
-
- Subtract (including broadcasting)
|
| 30 |
-
- Divide (including broadcasting)
|
| 31 |
-
- Maximum (including broadcasting)
|
| 32 |
-
- Minimum (including broadcasting)
|
| 33 |
-
- Multiply (including broadcasting)
|
| 34 |
-
- Squared Difference (including broadcasting)
|
| 35 |
-
- Global Average Pooling
|
| 36 |
-
- Channel Shuffle
|
| 37 |
-
- Fully Connected
|
| 38 |
-
- Abs (absolute value)
|
| 39 |
-
- Bankers' Rounding (rounding to nearest, ties to even)
|
| 40 |
-
- Ceiling (rounding to integer above)
|
| 41 |
-
- Clamp (includes ReLU and ReLU6)
|
| 42 |
-
- Convert (includes fixed-point and half-precision quantization and
|
| 43 |
-
dequantization)
|
| 44 |
-
- Copy
|
| 45 |
-
- ELU
|
| 46 |
-
- Floor (rounding to integer below)
|
| 47 |
-
- HardSwish
|
| 48 |
-
- Leaky ReLU
|
| 49 |
-
- Negate
|
| 50 |
-
- Sigmoid
|
| 51 |
-
- Softmax
|
| 52 |
-
- Square
|
| 53 |
-
- Tanh
|
| 54 |
-
- Transpose
|
| 55 |
-
- Truncation (rounding to integer towards zero)
|
| 56 |
-
- PReLU
|
| 57 |
-
|
| 58 |
-
All operators in XNNPACK support NHWC layout, but additionally allow custom stride along the **C**hannel dimension. Thus, operators can consume a subset of channels in the input tensor, and produce a subset of channels in the output tensor, providing a zero-cost Channel Split and Channel Concatenation operations.
|
| 59 |
-
|
| 60 |
-
## Performance
|
| 61 |
-
|
| 62 |
-
### Mobile phones
|
| 63 |
-
|
| 64 |
-
The table below presents **single-threaded** performance of XNNPACK library on three generations of MobileNet models and three generations of Pixel phones.
|
| 65 |
-
|
| 66 |
-
| Model | Pixel, ms | Pixel 2, ms | Pixel 3a, ms |
|
| 67 |
-
| ----------------------- | :-------: | :---------: | :----------: |
|
| 68 |
-
| FP32 MobileNet v1 1.0X | 82 | 86 | 88 |
|
| 69 |
-
| FP32 MobileNet v2 1.0X | 49 | 53 | 55 |
|
| 70 |
-
| FP32 MobileNet v3 Large | 39 | 42 | 44 |
|
| 71 |
-
| FP32 MobileNet v3 Small | 12 | 14 | 14 |
|
| 72 |
-
|
| 73 |
-
The following table presents **multi-threaded** (using as many threads as there are big cores) performance of XNNPACK library on three generations of MobileNet models and three generations of Pixel phones.
|
| 74 |
-
|
| 75 |
-
| Model | Pixel, ms | Pixel 2, ms | Pixel 3a, ms |
|
| 76 |
-
| ----------------------- | :-------: | :---------: | :----------: |
|
| 77 |
-
| FP32 MobileNet v1 1.0X | 43 | 27 | 46 |
|
| 78 |
-
| FP32 MobileNet v2 1.0X | 26 | 18 | 28 |
|
| 79 |
-
| FP32 MobileNet v3 Large | 22 | 16 | 24 |
|
| 80 |
-
| FP32 MobileNet v3 Small | 7 | 6 | 8 |
|
| 81 |
-
|
| 82 |
-
Benchmarked on March 27, 2020 with `end2end_bench --benchmark_min_time=5` on an Android/ARM64 build with Android NDK r21 (`bazel build -c opt --config android_arm64 :end2end_bench`) and neural network models with randomized weights and inputs.
|
| 83 |
-
|
| 84 |
-
### Raspberry Pi
|
| 85 |
-
|
| 86 |
-
The table below presents **multi-threaded** performance of XNNPACK library on three generations of MobileNet models and three generations of Raspberry Pi boards.
|
| 87 |
-
|
| 88 |
-
| Model | RPi Zero W (BCM2835), ms | RPi 2 (BCM2836), ms | RPi 3+ (BCM2837B0), ms | RPi 4 (BCM2711), ms | RPi 4 (BCM2711, ARM64), ms |
|
| 89 |
-
| ----------------------- | :----------------------: | :-----------------: | :--------------------: | :-----------------: | :------------------------: |
|
| 90 |
-
| FP32 MobileNet v1 1.0X | 3919 | 302 | 114 | 72 | 77 |
|
| 91 |
-
| FP32 MobileNet v2 1.0X | 1987 | 191 | 79 | 41 | 46 |
|
| 92 |
-
| FP32 MobileNet v3 Large | 1658 | 161 | 67 | 38 | 40 |
|
| 93 |
-
| FP32 MobileNet v3 Small | 474 | 50 | 22 | 13 | 15 |
|
| 94 |
-
| INT8 MobileNet v1 1.0X | 2589 | 128 | 46 | 29 | 24 |
|
| 95 |
-
| INT8 MobileNet v2 1.0X | 1495 | 82 | 30 | 20 | 17 |
|
| 96 |
-
|
| 97 |
-
Benchmarked on Feb 8, 2022 with `end2end-bench --benchmark_min_time=5` on a Raspbian Buster build with CMake (`./scripts/build-local.sh`) and neural network models with randomized weights and inputs. INT8 inference was evaluated on per-channel quantization schema.
|
| 98 |
-
|
| 99 |
-
## Minimum build requirements
|
| 100 |
-
|
| 101 |
-
- C11
|
| 102 |
-
- C++14
|
| 103 |
-
- Python 3
|
| 104 |
-
|
| 105 |
-
## Publications
|
| 106 |
-
|
| 107 |
-
- Marat Dukhan "The Indirect Convolution Algorithm". Presented on [Efficient Deep Learning for Compute Vision (ECV) 2019](https://sites.google.com/corp/view/ecv2019/) workshop ([slides](https://drive.google.com/file/d/1ZayB3By5ZxxQIRtN7UDq_JvPg1IYd3Ac/view), [paper on ArXiv](https://arxiv.org/abs/1907.02129)).
|
| 108 |
-
- Erich Elsen, Marat Dukhan, Trevor Gale, Karen Simonyan "Fast Sparse ConvNets".
|
| 109 |
-
[Paper on ArXiv](https://arxiv.org/abs/1911.09723), [pre-trained sparse
|
| 110 |
-
models](https://github.com/google-research/google-research/tree/master/fastconvnets).
|
| 111 |
-
- Marat Dukhan, Artsiom Ablavatski "The Two-Pass Softmax Algorithm".
|
| 112 |
-
[Paper on ArXiv](https://arxiv.org/abs/2001.04438).
|
| 113 |
-
- Yury Pisarchyk, Juhyun Lee "Efficient Memory Management for Deep Neural Net Inference".
|
| 114 |
-
[Paper on ArXiv](https://arxiv.org/abs/2001.03288).
|
| 115 |
-
|
| 116 |
-
## Ecosystem
|
| 117 |
-
|
| 118 |
-
### Machine Learning Frameworks
|
| 119 |
-
|
| 120 |
-
- [TensorFlow Lite](https://blog.tensorflow.org/2020/07/accelerating-tensorflow-lite-xnnpack-integration.html).
|
| 121 |
-
- [TensorFlow.js WebAssembly backend](https://blog.tensorflow.org/2020/03/introducing-webassembly-backend-for-tensorflow-js.html).
|
| 122 |
-
- [PyTorch Mobile](https://pytorch.org/mobile).
|
| 123 |
-
- [ONNX Runtime Mobile](https://onnxruntime.ai/docs/execution-providers/Xnnpack-ExecutionProvider.html)
|
| 124 |
-
- [MediaPipe for the Web](https://developers.googleblog.com/2020/01/mediapipe-on-web.html).
|
| 125 |
-
- [Alibaba HALO (Heterogeneity-Aware Lowering and Optimization)](https://github.com/alibaba/heterogeneity-aware-lowering-and-optimization)
|
| 126 |
-
- [Samsung ONE (On-device Neural Engine)](https://github.com/Samsung/ONE)
|
| 127 |
-
|
| 128 |
-
## Acknowledgements
|
| 129 |
-
|
| 130 |
-
XNNPACK is a based on [QNNPACK](https://github.com/pytorch/QNNPACK) library. Over time its codebase diverged a lot, and XNNPACK API is no longer compatible with QNNPACK.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|