oidn-web 0.4.0 → 0.5.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 +45 -0
- package/README.md +83 -19
- package/dist/oidn.js +3239 -2642
- package/dist/oidn.umd.cjs +512 -296
- package/lib/UNet.d.ts +54 -20
- package/lib/UNet.js +194 -118
- package/lib/UNet.js.map +1 -1
- package/lib/backend.d.ts +1 -8
- package/lib/backend.js +1 -9
- package/lib/backend.js.map +1 -1
- package/lib/finalRgbShader.d.ts +13 -0
- package/lib/finalRgbShader.js +160 -0
- package/lib/finalRgbShader.js.map +1 -0
- package/lib/graphOptimizer.js +1 -2
- package/lib/graphOptimizer.js.map +1 -1
- package/lib/hdrTransfer.d.ts +14 -0
- package/lib/hdrTransfer.js +61 -0
- package/lib/hdrTransfer.js.map +1 -0
- package/lib/main.d.ts +16 -7
- package/lib/main.js +4 -5
- package/lib/main.js.map +1 -1
- package/lib/nativeUNet.d.ts +39 -3
- package/lib/nativeUNet.js +449 -120
- package/lib/nativeUNet.js.map +1 -1
- package/lib/process.d.ts +5 -11
- package/lib/process.js +35 -49
- package/lib/process.js.map +1 -1
- package/lib/tileScheduler.d.ts +32 -4
- package/lib/tileScheduler.js +133 -20
- package/lib/tileScheduler.js.map +1 -1
- package/package.json +9 -2
- package/src/UNet.ts +287 -158
- package/src/backend.ts +1 -14
- package/src/finalRgbShader.ts +186 -0
- package/src/graphOptimizer.ts +1 -2
- package/src/hdrTransfer.ts +88 -0
- package/src/main.ts +28 -13
- package/src/nativeUNet.ts +515 -116
- package/src/process.ts +43 -70
- package/src/tileScheduler.ts +216 -24
- package/benchmarks/compare.mjs +0 -651
- package/benchmarks/leak.mjs +0 -255
- package/benchmarks/results/before-spatial.json +0 -391
- package/benchmarks/results/before-spatial.md +0 -47
- package/benchmarks/results/int8-scan.json +0 -2007
- package/benchmarks/results/int8-scan.md +0 -160
- package/benchmarks/results/int8-w8a8-scan.json +0 -2007
- package/benchmarks/results/int8-w8a8-scan.md +0 -160
- package/benchmarks/results/int8-weight-channel.json +0 -1413
- package/benchmarks/results/int8-weight-channel.md +0 -118
- package/benchmarks/results/int8-weight-only.json +0 -1437
- package/benchmarks/results/int8-weight-only.md +0 -118
- package/benchmarks/results/kernel-webnn-final.json +0 -1115
- package/benchmarks/results/kernel-webnn-final.md +0 -104
- package/benchmarks/results/latest-optimized.json +0 -375
- package/benchmarks/results/latest-optimized.md +0 -47
- package/benchmarks/results/latest.json +0 -391
- package/benchmarks/results/latest.md +0 -47
- package/benchmarks/results/profile-baseline.json +0 -331
- package/benchmarks/results/profile-baseline.md +0 -12
- package/benchmarks/results/profile-conv2x.json +0 -331
- package/benchmarks/results/profile-conv2x.md +0 -12
- package/benchmarks/results/profile-fast-init.json +0 -385
- package/benchmarks/results/profile-fast-init.md +0 -47
- package/benchmarks/results/profile-fp16-fma.json +0 -369
- package/benchmarks/results/profile-fp16-fma.md +0 -47
- package/benchmarks/results/profile-fp16-tiled-decoder.json +0 -369
- package/benchmarks/results/profile-fp16-tiled-decoder.md +0 -47
- package/benchmarks/results/profile-fp16-tiled-encoder.json +0 -369
- package/benchmarks/results/profile-fp16-tiled-encoder.md +0 -47
- package/benchmarks/results/profile-fp16-unfused-pool.json +0 -385
- package/benchmarks/results/profile-fp16-unfused-pool.md +0 -47
- package/benchmarks/results/profile-input-major.json +0 -347
- package/benchmarks/results/profile-input-major.md +0 -12
- package/benchmarks/results/profile-k16.json +0 -347
- package/benchmarks/results/profile-k16.md +0 -12
- package/benchmarks/results/profile-k4.json +0 -347
- package/benchmarks/results/profile-k4.md +0 -12
- package/benchmarks/results/profile-pool-reuse.json +0 -331
- package/benchmarks/results/profile-pool-reuse.md +0 -12
- package/benchmarks/results/profile-precompiled.json +0 -385
- package/benchmarks/results/profile-precompiled.md +0 -47
- package/benchmarks/results/profile-static-channels.json +0 -385
- package/benchmarks/results/profile-static-channels.md +0 -47
- package/benchmarks/results/profile-static-io.json +0 -385
- package/benchmarks/results/profile-static-io.md +0 -47
- package/benchmarks/results/profile-tiled-conv.json +0 -331
- package/benchmarks/results/profile-tiled-conv.md +0 -12
- package/benchmarks/results/profile-tiled-decoder.json +0 -347
- package/benchmarks/results/profile-tiled-decoder.md +0 -12
- package/benchmarks/results/profile-tiled-matmul.json +0 -331
- package/benchmarks/results/profile-tiled-matmul.md +0 -12
- package/benchmarks/results/profile-unfused-decoder.json +0 -379
- package/benchmarks/results/profile-unfused-decoder.md +0 -12
- package/benchmarks/results/profile-unfused-pool.json +0 -347
- package/benchmarks/results/profile-unfused-pool.md +0 -12
- package/benchmarks/results/spatial-auto.json +0 -575
- package/benchmarks/results/spatial-auto.md +0 -61
- package/benchmarks/results/subgroup-smoke.json +0 -1094
- package/benchmarks/results/subgroup-smoke.md +0 -104
- package/benchmarks/results/webnn-smoke.json +0 -739
- package/benchmarks/results/webnn-smoke.md +0 -76
- package/scripts/inspect-model.mjs +0 -64
- package/tests/modelSpec.test.mjs +0 -128
- package/tests/resourceLifecycle.test.mjs +0 -383
- package/tests/tileScheduler.test.mjs +0 -90
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
import test from 'node:test';
|
|
2
|
-
import assert from 'node:assert/strict';
|
|
3
|
-
|
|
4
|
-
import {
|
|
5
|
-
DynamicTileController,
|
|
6
|
-
fitTileDimension,
|
|
7
|
-
waitForSubmittedGPUWork
|
|
8
|
-
} from '../lib/tileScheduler.js';
|
|
9
|
-
|
|
10
|
-
test('starts conservatively and respects the hard maximum', () => {
|
|
11
|
-
assert.equal(new DynamicTileController(512).tileSize, 384);
|
|
12
|
-
assert.equal(new DynamicTileController(320).tileSize, 320);
|
|
13
|
-
assert.equal(fitTileDimension(512, 384), 384);
|
|
14
|
-
assert.equal(fitTileDimension(300, 384), 304);
|
|
15
|
-
});
|
|
16
|
-
|
|
17
|
-
test('reduces slow tiles and grows fast tiles within configured bounds', () => {
|
|
18
|
-
const controller = new DynamicTileController(512);
|
|
19
|
-
|
|
20
|
-
assert.equal(controller.observe([30, 32, 34]), true);
|
|
21
|
-
assert.equal(controller.tileSize, 256);
|
|
22
|
-
assert.equal(controller.observe([40]), false);
|
|
23
|
-
assert.equal(controller.tileSize, 256);
|
|
24
|
-
|
|
25
|
-
assert.equal(controller.observe([4, 6, 8]), true);
|
|
26
|
-
assert.equal(controller.tileSize, 384);
|
|
27
|
-
assert.equal(controller.observe([5]), true);
|
|
28
|
-
assert.equal(controller.tileSize, 512);
|
|
29
|
-
assert.equal(controller.observe([5]), false);
|
|
30
|
-
});
|
|
31
|
-
|
|
32
|
-
test('uses the median and ignores invalid timings', () => {
|
|
33
|
-
const controller = new DynamicTileController(512);
|
|
34
|
-
|
|
35
|
-
assert.equal(controller.observe([1, 30, Number.NaN]), false);
|
|
36
|
-
assert.equal(controller.tileSize, 384);
|
|
37
|
-
assert.equal(controller.observe([Number.NaN, Number.POSITIVE_INFINITY]), false);
|
|
38
|
-
});
|
|
39
|
-
|
|
40
|
-
test('can restore fixed-size behavior', () => {
|
|
41
|
-
const controller = new DynamicTileController(500, false);
|
|
42
|
-
|
|
43
|
-
assert.equal(controller.tileSize, 496);
|
|
44
|
-
assert.equal(controller.observe([100]), false);
|
|
45
|
-
assert.equal(controller.tileSize, 496);
|
|
46
|
-
});
|
|
47
|
-
|
|
48
|
-
test('supports custom adaptive limits and timing targets', () => {
|
|
49
|
-
const controller = new DynamicTileController(768, {
|
|
50
|
-
minTileSize: 128,
|
|
51
|
-
initialTileSize: 512,
|
|
52
|
-
targetTileTimeMs: 24,
|
|
53
|
-
adjustmentStep: 64
|
|
54
|
-
});
|
|
55
|
-
|
|
56
|
-
assert.equal(controller.tileSize, 512);
|
|
57
|
-
controller.observe([40]);
|
|
58
|
-
assert.equal(controller.tileSize, 448);
|
|
59
|
-
controller.observe([8]);
|
|
60
|
-
assert.equal(controller.tileSize, 512);
|
|
61
|
-
});
|
|
62
|
-
|
|
63
|
-
test('waits for submitted GPU work before continuing', async () => {
|
|
64
|
-
let release;
|
|
65
|
-
let completed = false;
|
|
66
|
-
const pendingGPUWork = new Promise((resolve) => {
|
|
67
|
-
release = resolve;
|
|
68
|
-
});
|
|
69
|
-
const queue = {
|
|
70
|
-
onSubmittedWorkDone: () => pendingGPUWork
|
|
71
|
-
};
|
|
72
|
-
|
|
73
|
-
const wait = waitForSubmittedGPUWork(queue).then(() => {
|
|
74
|
-
completed = true;
|
|
75
|
-
});
|
|
76
|
-
await Promise.resolve();
|
|
77
|
-
assert.equal(completed, false);
|
|
78
|
-
|
|
79
|
-
release();
|
|
80
|
-
await wait;
|
|
81
|
-
assert.equal(completed, true);
|
|
82
|
-
});
|
|
83
|
-
|
|
84
|
-
test('does not strand scheduling when the GPU wait rejects', async () => {
|
|
85
|
-
await assert.doesNotReject(() =>
|
|
86
|
-
waitForSubmittedGPUWork({
|
|
87
|
-
onSubmittedWorkDone: () => Promise.reject(new Error('device lost'))
|
|
88
|
-
})
|
|
89
|
-
);
|
|
90
|
-
});
|