oidn-web 0.3.4 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +49 -0
- package/README.md +140 -4
- package/benchmarks/compare.mjs +651 -0
- package/benchmarks/leak.mjs +255 -0
- package/benchmarks/results/before-spatial.json +391 -0
- package/benchmarks/results/before-spatial.md +47 -0
- package/benchmarks/results/int8-scan.json +2007 -0
- package/benchmarks/results/int8-scan.md +160 -0
- package/benchmarks/results/int8-w8a8-scan.json +2007 -0
- package/benchmarks/results/int8-w8a8-scan.md +160 -0
- package/benchmarks/results/int8-weight-channel.json +1413 -0
- package/benchmarks/results/int8-weight-channel.md +118 -0
- package/benchmarks/results/int8-weight-only.json +1437 -0
- package/benchmarks/results/int8-weight-only.md +118 -0
- package/benchmarks/results/kernel-webnn-final.json +1115 -0
- package/benchmarks/results/kernel-webnn-final.md +104 -0
- package/benchmarks/results/latest-optimized.json +375 -0
- package/benchmarks/results/latest-optimized.md +47 -0
- package/benchmarks/results/latest.json +391 -0
- package/benchmarks/results/latest.md +47 -0
- package/benchmarks/results/profile-baseline.json +331 -0
- package/benchmarks/results/profile-baseline.md +12 -0
- package/benchmarks/results/profile-conv2x.json +331 -0
- package/benchmarks/results/profile-conv2x.md +12 -0
- package/benchmarks/results/profile-fast-init.json +385 -0
- package/benchmarks/results/profile-fast-init.md +47 -0
- package/benchmarks/results/profile-fp16-fma.json +369 -0
- package/benchmarks/results/profile-fp16-fma.md +47 -0
- package/benchmarks/results/profile-fp16-tiled-decoder.json +369 -0
- package/benchmarks/results/profile-fp16-tiled-decoder.md +47 -0
- package/benchmarks/results/profile-fp16-tiled-encoder.json +369 -0
- package/benchmarks/results/profile-fp16-tiled-encoder.md +47 -0
- package/benchmarks/results/profile-fp16-unfused-pool.json +385 -0
- package/benchmarks/results/profile-fp16-unfused-pool.md +47 -0
- package/benchmarks/results/profile-input-major.json +347 -0
- package/benchmarks/results/profile-input-major.md +12 -0
- package/benchmarks/results/profile-k16.json +347 -0
- package/benchmarks/results/profile-k16.md +12 -0
- package/benchmarks/results/profile-k4.json +347 -0
- package/benchmarks/results/profile-k4.md +12 -0
- package/benchmarks/results/profile-pool-reuse.json +331 -0
- package/benchmarks/results/profile-pool-reuse.md +12 -0
- package/benchmarks/results/profile-precompiled.json +385 -0
- package/benchmarks/results/profile-precompiled.md +47 -0
- package/benchmarks/results/profile-static-channels.json +385 -0
- package/benchmarks/results/profile-static-channels.md +47 -0
- package/benchmarks/results/profile-static-io.json +385 -0
- package/benchmarks/results/profile-static-io.md +47 -0
- package/benchmarks/results/profile-tiled-conv.json +331 -0
- package/benchmarks/results/profile-tiled-conv.md +12 -0
- package/benchmarks/results/profile-tiled-decoder.json +347 -0
- package/benchmarks/results/profile-tiled-decoder.md +12 -0
- package/benchmarks/results/profile-tiled-matmul.json +331 -0
- package/benchmarks/results/profile-tiled-matmul.md +12 -0
- package/benchmarks/results/profile-unfused-decoder.json +379 -0
- package/benchmarks/results/profile-unfused-decoder.md +12 -0
- package/benchmarks/results/profile-unfused-pool.json +347 -0
- package/benchmarks/results/profile-unfused-pool.md +12 -0
- package/benchmarks/results/spatial-auto.json +575 -0
- package/benchmarks/results/spatial-auto.md +61 -0
- package/benchmarks/results/subgroup-smoke.json +1094 -0
- package/benchmarks/results/subgroup-smoke.md +104 -0
- package/benchmarks/results/webnn-smoke.json +739 -0
- package/benchmarks/results/webnn-smoke.md +76 -0
- package/dist/oidn.js +4189 -22603
- package/dist/oidn.umd.cjs +784 -5807
- package/lib/UNet.d.ts +66 -15
- package/lib/UNet.js +162 -257
- package/lib/UNet.js.map +1 -1
- package/lib/WGPUComputePass.d.ts +1 -1
- package/lib/WGPUComputePass.js +6 -4
- package/lib/WGPUComputePass.js.map +1 -1
- package/lib/backend.d.ts +8 -4
- package/lib/backend.js +36 -44
- package/lib/backend.js.map +1 -1
- package/lib/graphOptimizer.d.ts +54 -0
- package/lib/graphOptimizer.js +216 -0
- package/lib/graphOptimizer.js.map +1 -0
- package/lib/main.d.ts +33 -10
- package/lib/main.js +5 -0
- package/lib/main.js.map +1 -1
- package/lib/modelSpec.d.ts +80 -0
- package/lib/modelSpec.js +270 -0
- package/lib/modelSpec.js.map +1 -0
- package/lib/nativeUNet.d.ts +67 -0
- package/lib/nativeUNet.js +1735 -0
- package/lib/nativeUNet.js.map +1 -0
- package/lib/process.js +38 -35
- package/lib/process.js.map +1 -1
- package/lib/resourceTracker.d.ts +26 -0
- package/lib/resourceTracker.js +65 -0
- package/lib/resourceTracker.js.map +1 -0
- package/lib/tileScheduler.d.ts +33 -0
- package/lib/tileScheduler.js +86 -0
- package/lib/tileScheduler.js.map +1 -0
- package/lib/webnnUNet.d.ts +52 -0
- package/lib/webnnUNet.js +535 -0
- package/lib/webnnUNet.js.map +1 -0
- package/package.json +9 -5
- package/scripts/inspect-model.mjs +64 -0
- package/src/UNet.ts +236 -339
- package/src/WGPUComputePass.ts +6 -4
- package/src/backend.ts +42 -55
- package/src/graphOptimizer.ts +301 -0
- package/src/main.ts +71 -11
- package/src/modelSpec.ts +414 -0
- package/src/nativeUNet.ts +2256 -0
- package/src/process.ts +38 -36
- package/src/resourceTracker.ts +94 -0
- package/src/tileScheduler.ts +138 -0
- package/src/webnnUNet.ts +812 -0
- package/tests/modelSpec.test.mjs +128 -0
- package/tests/resourceLifecycle.test.mjs +383 -0
- package/tests/tileScheduler.test.mjs +90 -0
- package/lib/helper.d.ts +0 -4
- package/lib/helper.js +0 -33
- package/lib/helper.js.map +0 -1
- package/lib/kernels.d.ts +0 -1
- package/lib/kernels.js +0 -26
- package/lib/kernels.js.map +0 -1
- package/src/helper.ts +0 -43
- package/src/kernels.ts +0 -31
|
@@ -0,0 +1,160 @@
|
|
|
1
|
+
# oidn-web benchmark
|
|
2
|
+
|
|
3
|
+
- Current: `4dc1797b24c64aa0d647eada0cb3389fb0d24705`
|
|
4
|
+
- TFJS baseline: `136c00c34aa5cf4561b4137034dbd643177f0a5f`
|
|
5
|
+
- Input: 512x512, fixed tile 512, 3 runs after 1 warmup(s)
|
|
6
|
+
- Adapter: apple
|
|
7
|
+
|
|
8
|
+
| Runtime | Init ms | Median ms | P95 ms | Speedup | Precision |
|
|
9
|
+
| --- | ---: | ---: | ---: | ---: | --- |
|
|
10
|
+
| TFJS (136c00c) | 9.30 | 35.00 | 35.10 | 1.00x | fp32 |
|
|
11
|
+
| WGSL FP32 Auto | 39.50 | 35.90 | 36.00 | 0.97x | fp32 |
|
|
12
|
+
| WGSL FP32 Direct | 38.70 | 63.40 | 63.50 | 0.55x | fp32 |
|
|
13
|
+
| WGSL FP16 Direct | 29.30 | 27.90 | 28.00 | 1.25x | fp16 |
|
|
14
|
+
| WGSL FP16 Implicit GEMM | 31.30 | 29.30 | 29.30 | 1.19x | fp16 |
|
|
15
|
+
| WGSL FP16 Spatial (experimental) | 31.00 | 61.60 | 61.70 | 0.57x | fp16 |
|
|
16
|
+
| WGSL FP16 Subgroup (experimental) | 27.70 | 29.20 | 29.40 | 1.20x | fp16 |
|
|
17
|
+
| WGSL INT8 DP4A r1 (experimental) | 174.50 | 81.00 | 81.00 | 0.43x | int8 |
|
|
18
|
+
| WGSL INT8 DP4A r2 (experimental) | 120.40 | 80.70 | 81.00 | 0.43x | int8 |
|
|
19
|
+
| WGSL INT8 DP4A r4 (experimental) | 117.50 | 80.80 | 80.80 | 0.43x | int8 |
|
|
20
|
+
| WGSL INT8 DP4A r8 (experimental) | 116.30 | 81.00 | 81.10 | 0.43x | int8 |
|
|
21
|
+
| WebNN FP16 (experimental) | skipped | - | - | - | Error: WebNN FP16 WebGPU interop failed: NotSupportedError: Failed to execute 'createExportableTensor' on 'MLContext': WebGPU Interop is not supported. |
|
|
22
|
+
|
|
23
|
+
## Output validation
|
|
24
|
+
|
|
25
|
+
Compared against sampled TFJS FP32 output.
|
|
26
|
+
|
|
27
|
+
| Runtime | Status | MAE | RMSE | Max error | Samples |
|
|
28
|
+
| --- | --- | ---: | ---: | ---: | ---: |
|
|
29
|
+
| WGSL FP32 Auto | pass | 1.11e-6 | 1.81e-6 | 1.36e-5 | 6144 |
|
|
30
|
+
| WGSL FP32 Direct | pass | 1.11e-6 | 1.81e-6 | 1.36e-5 | 6144 |
|
|
31
|
+
| WGSL FP16 Direct | pass | 1.02e-3 | 1.61e-3 | 1.24e-2 | 6144 |
|
|
32
|
+
| WGSL FP16 Implicit GEMM | pass | 1.56e-3 | 2.55e-3 | 4.48e-2 | 6144 |
|
|
33
|
+
| WGSL FP16 Spatial (experimental) | pass | 1.02e-3 | 1.61e-3 | 1.24e-2 | 6144 |
|
|
34
|
+
| WGSL FP16 Subgroup (experimental) | pass | 1.02e-3 | 1.61e-3 | 1.24e-2 | 6144 |
|
|
35
|
+
| WGSL INT8 DP4A r1 (experimental) | FAIL | 8.84e-1 | 1.14e+0 | 2.80e+0 | 6144 |
|
|
36
|
+
| WGSL INT8 DP4A r2 (experimental) | FAIL | 2.71e-1 | 3.83e-1 | 1.40e+0 | 6144 |
|
|
37
|
+
| WGSL INT8 DP4A r4 (experimental) | FAIL | 1.89e-1 | 2.66e-1 | 1.37e+0 | 6144 |
|
|
38
|
+
| WGSL INT8 DP4A r8 (experimental) | FAIL | 2.50e-1 | 3.63e-1 | 1.82e+0 | 6144 |
|
|
39
|
+
|
|
40
|
+
## GPU hot layers
|
|
41
|
+
|
|
42
|
+
### WGSL FP32 Auto
|
|
43
|
+
|
|
44
|
+
Profiled GPU total: 35.29 ms
|
|
45
|
+
|
|
46
|
+
| Node | GPU ms |
|
|
47
|
+
| --- | ---: |
|
|
48
|
+
| dec_conv1a | 7.02 |
|
|
49
|
+
| dec_conv2a | 4.46 |
|
|
50
|
+
| enc_conv1b | 3.85 |
|
|
51
|
+
| dec_conv1b | 3.75 |
|
|
52
|
+
| dec_conv3a | 2.32 |
|
|
53
|
+
|
|
54
|
+
### WGSL FP32 Direct
|
|
55
|
+
|
|
56
|
+
Profiled GPU total: 62.44 ms
|
|
57
|
+
|
|
58
|
+
| Node | GPU ms |
|
|
59
|
+
| --- | ---: |
|
|
60
|
+
| dec_conv1a | 9.73 |
|
|
61
|
+
| dec_conv1b | 8.93 |
|
|
62
|
+
| enc_conv1b | 8.63 |
|
|
63
|
+
| dec_conv2a | 6.60 |
|
|
64
|
+
| dec_conv2b | 5.52 |
|
|
65
|
+
|
|
66
|
+
### WGSL FP16 Direct
|
|
67
|
+
|
|
68
|
+
Profiled GPU total: 27.30 ms
|
|
69
|
+
|
|
70
|
+
| Node | GPU ms |
|
|
71
|
+
| --- | ---: |
|
|
72
|
+
| dec_conv1a | 4.49 |
|
|
73
|
+
| dec_conv1b | 3.16 |
|
|
74
|
+
| enc_conv1b | 3.12 |
|
|
75
|
+
| dec_conv2a | 2.98 |
|
|
76
|
+
| enc_conv2b | 2.19 |
|
|
77
|
+
|
|
78
|
+
### WGSL FP16 Implicit GEMM
|
|
79
|
+
|
|
80
|
+
Profiled GPU total: 28.69 ms
|
|
81
|
+
|
|
82
|
+
| Node | GPU ms |
|
|
83
|
+
| --- | ---: |
|
|
84
|
+
| dec_conv1a | 5.80 |
|
|
85
|
+
| dec_conv2a | 3.70 |
|
|
86
|
+
| enc_conv1b | 3.06 |
|
|
87
|
+
| dec_conv1b | 3.05 |
|
|
88
|
+
| dec_conv3a | 1.90 |
|
|
89
|
+
|
|
90
|
+
### WGSL FP16 Spatial (experimental)
|
|
91
|
+
|
|
92
|
+
Profiled GPU total: 61.29 ms
|
|
93
|
+
|
|
94
|
+
| Node | GPU ms |
|
|
95
|
+
| --- | ---: |
|
|
96
|
+
| dec_conv1a | 22.38 |
|
|
97
|
+
| enc_conv1b | 5.46 |
|
|
98
|
+
| dec_conv1b | 5.36 |
|
|
99
|
+
| enc_conv2b | 4.39 |
|
|
100
|
+
| dec_conv2b | 4.35 |
|
|
101
|
+
|
|
102
|
+
### WGSL FP16 Subgroup (experimental)
|
|
103
|
+
|
|
104
|
+
Profiled GPU total: 28.68 ms
|
|
105
|
+
|
|
106
|
+
| Node | GPU ms |
|
|
107
|
+
| --- | ---: |
|
|
108
|
+
| dec_conv1a | 4.52 |
|
|
109
|
+
| dec_conv1b | 3.38 |
|
|
110
|
+
| enc_conv1b | 3.37 |
|
|
111
|
+
| dec_conv2a | 3.14 |
|
|
112
|
+
| dec_conv2b | 2.03 |
|
|
113
|
+
|
|
114
|
+
### WGSL INT8 DP4A r1 (experimental)
|
|
115
|
+
|
|
116
|
+
Profiled GPU total: 80.22 ms
|
|
117
|
+
|
|
118
|
+
| Node | GPU ms |
|
|
119
|
+
| --- | ---: |
|
|
120
|
+
| dec_conv1a | 15.55 |
|
|
121
|
+
| dec_conv2a | 10.40 |
|
|
122
|
+
| enc_conv1b | 9.26 |
|
|
123
|
+
| dec_conv1b | 9.17 |
|
|
124
|
+
| enc_conv2b | 5.27 |
|
|
125
|
+
|
|
126
|
+
### WGSL INT8 DP4A r2 (experimental)
|
|
127
|
+
|
|
128
|
+
Profiled GPU total: 80.33 ms
|
|
129
|
+
|
|
130
|
+
| Node | GPU ms |
|
|
131
|
+
| --- | ---: |
|
|
132
|
+
| dec_conv1a | 15.45 |
|
|
133
|
+
| dec_conv2a | 10.35 |
|
|
134
|
+
| enc_conv1b | 9.42 |
|
|
135
|
+
| dec_conv1b | 9.16 |
|
|
136
|
+
| dec_conv3a | 5.35 |
|
|
137
|
+
|
|
138
|
+
### WGSL INT8 DP4A r4 (experimental)
|
|
139
|
+
|
|
140
|
+
Profiled GPU total: 80.15 ms
|
|
141
|
+
|
|
142
|
+
| Node | GPU ms |
|
|
143
|
+
| --- | ---: |
|
|
144
|
+
| dec_conv1a | 15.56 |
|
|
145
|
+
| dec_conv2a | 10.44 |
|
|
146
|
+
| dec_conv1b | 9.29 |
|
|
147
|
+
| enc_conv1b | 9.27 |
|
|
148
|
+
| dec_conv3a | 5.27 |
|
|
149
|
+
|
|
150
|
+
### WGSL INT8 DP4A r8 (experimental)
|
|
151
|
+
|
|
152
|
+
Profiled GPU total: 80.30 ms
|
|
153
|
+
|
|
154
|
+
| Node | GPU ms |
|
|
155
|
+
| --- | ---: |
|
|
156
|
+
| dec_conv1a | 15.43 |
|
|
157
|
+
| dec_conv2a | 10.28 |
|
|
158
|
+
| enc_conv1b | 9.33 |
|
|
159
|
+
| dec_conv1b | 9.28 |
|
|
160
|
+
| dec_conv2b | 5.27 |
|