From 82ce7a69656a11fa4cd5c5bea447cd1a2797b903 Mon Sep 17 00:00:00 2001 From: Vladimir Mandic Date: Sun, 5 Sep 2021 16:42:02 -0400 Subject: [PATCH] add benchmark info --- Backends.md | 56 ++++++++++++++++++++++++++++++++++++++--------------- 1 file changed, 40 insertions(+), 16 deletions(-) diff --git a/Backends.md b/Backends.md index 7b06bc7..4742193 100644 --- a/Backends.md +++ b/Backends.md @@ -1,7 +1,7 @@ # Backends -For use in **Browsers**, `Human` library includes pre-bundled `CPU`, `WASM` and `WebGL` backends, -there is no need to load them externally +For use in **Browsers**, `Human` library includes pre-bundled `CPU`, `WASM` and `WebGL` backends +as well as optimized `HumanGL` backend, there is no need to load them externally For use in **NodeJS**, `Human` library supports `tfjs-node` and `tfjs-node-gpu` implementations of `tensorflow` backend which have to be loaded before `Human` library @@ -12,22 +12,44 @@ Experimental support is added for `WebGPU` backend in **Browsers** and `WASM` ba ## Backend Performance Compare -Performance compare using single model: +| Backend | Environment | Execution | Variation | Warmup | Average | Note | +| --- | --- | --- | --- | --- | --- | --- | +| CPU | NodeJS | CPU | - | 78,750 ms | 75,000 ms | Reference only | +| CPU | Browser | CPU | - | 92,250 ms | 91,000 ms | Reference only | +| Tensorflow | NodeJS | CPU | - | 2,635 ms | 2,110 ms | Recommended | +| Tensorflow | NodeJS | GPU | - | 4,650 ms | 1,810 ms | +| WASM | NodeJS | CPU | SIMD | 3,730 ms | 3,500 ms | Experimental | +| WASM | Browser | CPU | | 25,630 ms | 21,200 ms | +| WASM | Browser | CPU | SIMD | 4,325 ms| 3,670 ms | Recommended when running without GPU | +| WebGL | Browser | GPU | | 22,050 ms | 1,590 ms | +| HumanGL | Browser | GPU | | 6,170 ms | 1,600 ms | Recommended when running with GPU | +| WebGPU | Browser | GPU | GLSL | 21,350 ms | 1,150 ms | Experimental | +| WebGPU | Browser | GPU | WGSL | N/A | N/A | Not available | +| TFLite | Browser | CPU | | N/A | N/A | Not available | +| TFLite | Browser | CPU | SIMD | N/A | N/A | Not available | -| Backend | Variation | Warmup | Average | -| --- | --- | --- | --- | -| CPU || 1230 ms | 1230 ms | -| WASM | Default | 338 ms | 255 ms | -| WASM | SIMD | 125 ms | 62 ms | -| WebGL | Default | 6015 ms | 18 ms | -| WebGL | Pack Disable| 2698 ms | 22 ms | -| WebGL | Uniforms Enable | 2082 ms | 20 ms | -| WebGPU | GSLS | 3877 ms | 12 ms | -| WebGPU | WGSL | N/A | N/A | -| TFlite | | N/A | N/A | -| TFlite | SIMD | N/A | N/A | -
+### Notes + +- **`Human`** configuration: All models enabled +- **`Human`** configuration: Results caching, interpolation and frame change detection disabled +- **CPU** backend is running interpreted JS code and is included for reference only +- **HumanGL** backend is the optimized version of `WebGL` backend for faster warmup +- **WebAssembly SIMD** is enabled by default in *Chome 93* or higher, otherwise it has to be manually enabled +- **WebGPU GLSL** implementation is experimental and is only available in Chrome Canary +- **WebGPU WGSL** implementation will be added in future versions +- **TFLite** support will be added in future versions + +### Recommendations + +- For **Browser**, if you have a **GPU**, recommended backend is `HumanGL` + which reduces warmup time compared to `WebGL` while maintaining fast execution time +- For **Browser**, if you don't have a **GPU**, recommended backend is `WASM` + For optimal WASM performance, SIMD support should be enabled in browser +- For **NodeJS**, recommended backend is `tfjs-node` + Note that while `tfjs-node-gpu` achieves slightly higher performance than `tfjs-node`, it's usage is limited to specific nVidia CUDA enabled environments and does not achieve much higher performance since bottlneck is upload&download of textures from GPU, not execution itself + +


## Tensorflow Backend @@ -102,6 +124,8 @@ Note that version of WASM binaries **must** match version of TFJS used by `Human ### How to enable WASM SIMD support +**WebAssembly SIMD** is enabled by default in *Chome 93* or higher, otherwise it has to be manually enabled + Chrome: - Navigate to