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
package/src/helper.ts
DELETED
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
import * as tfjs from '@tensorflow/tfjs-core';
|
|
2
|
-
export function profileAndLogKernelCode(execute: () => void, disabled = true) {
|
|
3
|
-
if (disabled) {
|
|
4
|
-
execute();
|
|
5
|
-
return;
|
|
6
|
-
}
|
|
7
|
-
tfjs
|
|
8
|
-
.profile(() => {
|
|
9
|
-
execute();
|
|
10
|
-
})
|
|
11
|
-
.then((res) => {
|
|
12
|
-
const kernelNames = Array.from(
|
|
13
|
-
new Set(
|
|
14
|
-
res.kernels.map((k) => k.name).filter((name) => !name.endsWith('_op'))
|
|
15
|
-
)
|
|
16
|
-
);
|
|
17
|
-
function nameToConfig(name: string) {
|
|
18
|
-
return `${name[0].toLowerCase()}${name.slice(1)}Config`;
|
|
19
|
-
}
|
|
20
|
-
const importCode = kernelNames.map(
|
|
21
|
-
(name) =>
|
|
22
|
-
`import { ${nameToConfig(
|
|
23
|
-
name
|
|
24
|
-
)} } from '@tensorflow/tfjs-backend-webgpu/dist/kernels/${name}';`
|
|
25
|
-
);
|
|
26
|
-
const configCode = kernelNames.map((name) => `${nameToConfig(name)},`);
|
|
27
|
-
const code = `
|
|
28
|
-
${importCode.join('\n')}
|
|
29
|
-
const kernelConfigs: KernelConfig[] = [
|
|
30
|
-
${configCode.join('\n')}
|
|
31
|
-
]
|
|
32
|
-
`;
|
|
33
|
-
console.log(code);
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
export function memory() {
|
|
38
|
-
return tfjs.memory();
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
export function tidy(f: () => void) {
|
|
42
|
-
return tfjs.tidy(f);
|
|
43
|
-
}
|
package/src/kernels.ts
DELETED
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
KernelConfig,
|
|
3
|
-
registerKernel
|
|
4
|
-
} from '@tensorflow/tfjs-core/dist/kernel_registry';
|
|
5
|
-
|
|
6
|
-
import { mirrorPadConfig } from '@tensorflow/tfjs-backend-webgpu/dist/kernels/MirrorPad';
|
|
7
|
-
import { padV2Config } from '@tensorflow/tfjs-backend-webgpu/dist/kernels/PadV2';
|
|
8
|
-
import { sliceConfig } from '@tensorflow/tfjs-backend-webgpu/dist/kernels/Slice';
|
|
9
|
-
import { fusedConv2DConfig } from '@tensorflow/tfjs-backend-webgpu/dist/kernels/FusedConv2D';
|
|
10
|
-
import { maxPoolConfig } from '@tensorflow/tfjs-backend-webgpu/dist/kernels/MaxPool';
|
|
11
|
-
import { resizeNearestNeighborConfig } from '@tensorflow/tfjs-backend-webgpu/dist/kernels/ResizeNearestNeighbor';
|
|
12
|
-
import { concatConfig } from '@tensorflow/tfjs-backend-webgpu/dist/kernels/Concat';
|
|
13
|
-
import { identityConfig } from '@tensorflow/tfjs-backend-webgpu/dist/kernels/Identity';
|
|
14
|
-
|
|
15
|
-
const kernelConfigs: KernelConfig[] = [
|
|
16
|
-
mirrorPadConfig,
|
|
17
|
-
padV2Config,
|
|
18
|
-
sliceConfig,
|
|
19
|
-
fusedConv2DConfig,
|
|
20
|
-
maxPoolConfig,
|
|
21
|
-
resizeNearestNeighborConfig,
|
|
22
|
-
concatConfig,
|
|
23
|
-
identityConfig
|
|
24
|
-
];
|
|
25
|
-
|
|
26
|
-
for (const kernelConfig of kernelConfigs) {
|
|
27
|
-
registerKernel({
|
|
28
|
-
...kernelConfig,
|
|
29
|
-
backendName: 'webgpu-oidn'
|
|
30
|
-
});
|
|
31
|
-
}
|