@graphty/webgpu-graph-algorithms 0.6.27 → 0.6.28
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/README.md +56 -6
- package/dist/acquire.d.ts +2 -0
- package/dist/browser.js +18 -1
- package/dist/browser.js.map +1 -1
- package/dist/chunks/accelerator-B-FjQwaA.js +19173 -0
- package/dist/chunks/accelerator-B-FjQwaA.js.map +1 -0
- package/dist/chunks/managed-D_GdQtnu.js +98 -0
- package/dist/chunks/managed-D_GdQtnu.js.map +1 -0
- package/dist/node.js +18 -1
- package/dist/node.js.map +1 -1
- package/dist/src/accelerator.d.ts.map +1 -1
- package/dist/src/accelerator.js +5 -3
- package/dist/src/accelerator.js.map +1 -1
- package/dist/src/algorithms/all-pairs.d.ts.map +1 -1
- package/dist/src/algorithms/all-pairs.js +72 -47
- package/dist/src/algorithms/all-pairs.js.map +1 -1
- package/dist/src/algorithms/betweenness.d.ts +1 -1
- package/dist/src/algorithms/betweenness.js +2 -2
- package/dist/src/algorithms/closeness.d.ts +45 -42
- package/dist/src/algorithms/closeness.d.ts.map +1 -1
- package/dist/src/algorithms/closeness.js +295 -226
- package/dist/src/algorithms/closeness.js.map +1 -1
- package/dist/src/browser/index.d.ts +10 -0
- package/dist/src/browser/index.d.ts.map +1 -1
- package/dist/src/browser/index.js +22 -0
- package/dist/src/browser/index.js.map +1 -1
- package/dist/src/constants.d.ts +13 -3
- package/dist/src/constants.d.ts.map +1 -1
- package/dist/src/constants.js +13 -3
- package/dist/src/constants.js.map +1 -1
- package/dist/src/kernels.d.ts +14 -4
- package/dist/src/kernels.d.ts.map +1 -1
- package/dist/src/kernels.js +62 -28
- package/dist/src/kernels.js.map +1 -1
- package/dist/src/layouts/force-simulation.d.ts.map +1 -1
- package/dist/src/layouts/force-simulation.js +0 -1
- package/dist/src/layouts/force-simulation.js.map +1 -1
- package/dist/src/layouts/forceatlas2.d.ts.map +1 -1
- package/dist/src/layouts/forceatlas2.js +0 -1
- package/dist/src/layouts/forceatlas2.js.map +1 -1
- package/dist/src/layouts/fruchterman-reingold.d.ts.map +1 -1
- package/dist/src/layouts/fruchterman-reingold.js +0 -1
- package/dist/src/layouts/fruchterman-reingold.js.map +1 -1
- package/dist/src/layouts/repulsion-grid.d.ts +1 -3
- package/dist/src/layouts/repulsion-grid.d.ts.map +1 -1
- package/dist/src/layouts/repulsion-grid.js +1 -6
- package/dist/src/layouts/repulsion-grid.js.map +1 -1
- package/dist/src/layouts/spring-electrical.d.ts.map +1 -1
- package/dist/src/layouts/spring-electrical.js +0 -1
- package/dist/src/layouts/spring-electrical.js.map +1 -1
- package/dist/src/managed.d.ts +11 -0
- package/dist/src/managed.d.ts.map +1 -0
- package/dist/src/managed.js +129 -0
- package/dist/src/managed.js.map +1 -0
- package/dist/src/node/index.d.ts +11 -0
- package/dist/src/node/index.d.ts.map +1 -1
- package/dist/src/node/index.js +21 -0
- package/dist/src/node/index.js.map +1 -1
- package/dist/src/primitives/grid-pyramid.d.ts +16 -15
- package/dist/src/primitives/grid-pyramid.d.ts.map +1 -1
- package/dist/src/primitives/grid-pyramid.js +20 -28
- package/dist/src/primitives/grid-pyramid.js.map +1 -1
- package/dist/src/types/accelerator.d.ts +2 -0
- package/dist/src/types/accelerator.d.ts.map +1 -1
- package/dist/src/types/managed.d.ts +81 -0
- package/dist/src/types/managed.d.ts.map +1 -0
- package/dist/src/types/managed.js +7 -0
- package/dist/src/types/managed.js.map +1 -0
- package/dist/src/wgsl/bc-forward.wgsl.d.ts +1 -1
- package/dist/src/wgsl/bc-forward.wgsl.js +1 -1
- package/dist/src/wgsl/closeness-level.wgsl.d.ts +37 -0
- package/dist/src/wgsl/closeness-level.wgsl.d.ts.map +1 -0
- package/dist/src/wgsl/closeness-level.wgsl.js +204 -0
- package/dist/src/wgsl/closeness-level.wgsl.js.map +1 -0
- package/dist/src/wgsl/closeness-rowsum.wgsl.d.ts +11 -0
- package/dist/src/wgsl/closeness-rowsum.wgsl.d.ts.map +1 -0
- package/dist/src/wgsl/closeness-rowsum.wgsl.js +42 -0
- package/dist/src/wgsl/closeness-rowsum.wgsl.js.map +1 -0
- package/dist/src/wgsl/grid-centroid-hub.wgsl.d.ts +2 -2
- package/dist/src/wgsl/grid-centroid-hub.wgsl.js +2 -2
- package/dist/webgpu-graph-algorithms.js +142 -15586
- package/dist/webgpu-graph-algorithms.js.map +1 -1
- package/package.json +10 -4
- package/src/accelerator.ts +5 -3
- package/src/algorithms/all-pairs.ts +86 -56
- package/src/algorithms/betweenness.ts +2 -2
- package/src/algorithms/closeness.ts +353 -256
- package/src/browser/index.ts +37 -0
- package/src/constants.ts +13 -3
- package/src/kernels.ts +65 -36
- package/src/layouts/force-simulation.ts +0 -1
- package/src/layouts/forceatlas2.ts +0 -1
- package/src/layouts/fruchterman-reingold.ts +0 -1
- package/src/layouts/repulsion-grid.ts +2 -7
- package/src/layouts/spring-electrical.ts +0 -1
- package/src/managed.ts +172 -0
- package/src/node/index.ts +36 -0
- package/src/primitives/grid-pyramid.ts +29 -41
- package/src/types/accelerator.ts +2 -0
- package/src/types/managed.ts +86 -0
- package/src/wgsl/bc-forward.wgsl.ts +1 -1
- package/src/wgsl/closeness-level.wgsl.ts +203 -0
- package/src/wgsl/closeness-rowsum.wgsl.ts +41 -0
- package/src/wgsl/grid-centroid-hub.wgsl.ts +2 -2
- package/dist/chunks/context-BZY6SMsM.js +0 -3615
- package/dist/chunks/context-BZY6SMsM.js.map +0 -1
- package/dist/src/wgsl/closeness-reduce.wgsl.d.ts +0 -20
- package/dist/src/wgsl/closeness-reduce.wgsl.d.ts.map +0 -1
- package/dist/src/wgsl/closeness-reduce.wgsl.js +0 -69
- package/dist/src/wgsl/closeness-reduce.wgsl.js.map +0 -1
- package/dist/src/wgsl/closeness-sweep.wgsl.d.ts +0 -22
- package/dist/src/wgsl/closeness-sweep.wgsl.d.ts.map +0 -1
- package/dist/src/wgsl/closeness-sweep.wgsl.js +0 -106
- package/dist/src/wgsl/closeness-sweep.wgsl.js.map +0 -1
- package/src/wgsl/closeness-reduce.wgsl.ts +0 -68
- package/src/wgsl/closeness-sweep.wgsl.ts +0 -105
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The managed accelerator behind `acquireAccelerator` (the `./acquire` subpath, and the same function on `./browser`
|
|
3
|
+
* and `./node`): probe, context, device self-check, accelerator, re-acquisition after device loss, disposal. The
|
|
4
|
+
* runtime-specific half (how to probe and how to open a context) comes from the entry that calls `manageAccelerator`;
|
|
5
|
+
* everything else is here once, so no consumer writes it.
|
|
6
|
+
*
|
|
7
|
+
* Every decline is decided before any work runs: a caller with a CPU implementation runs it and reports the reason.
|
|
8
|
+
* A failure of work that already started on the device is never caught here; it reaches the caller of that work.
|
|
9
|
+
*/
|
|
10
|
+
import { createAccelerator } from "./accelerator.js";
|
|
11
|
+
import { isWebGpuGraphError, WebGpuGraphError } from "./errors.js";
|
|
12
|
+
import { verifyDevice } from "./primitives/verify.js";
|
|
13
|
+
/** The fix of a declined software adapter, on every runtime. */
|
|
14
|
+
const SOFTWARE_FIX = "pass acceptSoftware: true to use the software adapter (usually slower than the CPU)";
|
|
15
|
+
const DECLINE_CODES = new Set(["E_NO_WEBGPU", "E_NO_ADAPTER", "E_SOFTWARE_ONLY"]);
|
|
16
|
+
/**
|
|
17
|
+
* A decline record.
|
|
18
|
+
* @param platform - the runtime, for the E_NO_WEBGPU fix
|
|
19
|
+
* @param code - the decline code
|
|
20
|
+
* @param reason - the reason in words
|
|
21
|
+
* @param rest - the adapter and the check, when known
|
|
22
|
+
* @returns the record
|
|
23
|
+
*/
|
|
24
|
+
function declined(platform, code, reason, rest = {}) {
|
|
25
|
+
let fix = null;
|
|
26
|
+
if (code === "E_SOFTWARE_ONLY") {
|
|
27
|
+
fix = SOFTWARE_FIX;
|
|
28
|
+
}
|
|
29
|
+
else if (code === "E_NO_WEBGPU") {
|
|
30
|
+
fix = platform.noWebGpuFix();
|
|
31
|
+
}
|
|
32
|
+
return { ok: false, code, reason, fix, adapter: rest.adapter ?? null, check: rest.check ?? null };
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* One acquisition: probe, open, self-check, accelerator. The context is disposed on every path that does not hand
|
|
36
|
+
* it over.
|
|
37
|
+
* @param platform - the runtime
|
|
38
|
+
* @param options - the caller's options
|
|
39
|
+
* @returns the accelerator, or why there is none
|
|
40
|
+
*/
|
|
41
|
+
async function acquireOnce(platform, options) {
|
|
42
|
+
const rejectSoftware = options.acceptSoftware !== true;
|
|
43
|
+
const probe = await platform.probe(options, rejectSoftware);
|
|
44
|
+
if (!probe.ok || probe.code !== "OK") {
|
|
45
|
+
const code = probe.code === "OK" ? "E_NO_ADAPTER" : probe.code;
|
|
46
|
+
return declined(platform, code, probe.reason ?? code, { adapter: probe.summary });
|
|
47
|
+
}
|
|
48
|
+
let ctx;
|
|
49
|
+
try {
|
|
50
|
+
ctx = await platform.open(options, probe, rejectSoftware);
|
|
51
|
+
}
|
|
52
|
+
catch (err) {
|
|
53
|
+
// the adapter can change between the probe and the device request (a GPU process restart)
|
|
54
|
+
if (isWebGpuGraphError(err) && DECLINE_CODES.has(err.code)) {
|
|
55
|
+
return declined(platform, err.code, err.message, { adapter: probe.summary });
|
|
56
|
+
}
|
|
57
|
+
throw err;
|
|
58
|
+
}
|
|
59
|
+
let accelerator;
|
|
60
|
+
try {
|
|
61
|
+
const check = await (platform.verify ?? verifyDevice)(ctx);
|
|
62
|
+
if (check.mismatch !== null) {
|
|
63
|
+
ctx.dispose();
|
|
64
|
+
const where = check.mismatch.poison
|
|
65
|
+
? `${check.mismatch.where} was never written`
|
|
66
|
+
: `${check.mismatch.where} came back as ${String(check.mismatch.actual)} where ${String(check.mismatch.expected)} was required`;
|
|
67
|
+
return declined(platform, "E_DEVICE_INCORRECT", `the ${check.vendor} device computed a known prefix sum incorrectly: ${where}`, { adapter: probe.summary, check });
|
|
68
|
+
}
|
|
69
|
+
accelerator = createAccelerator(ctx, options.accelerator);
|
|
70
|
+
}
|
|
71
|
+
catch (err) {
|
|
72
|
+
ctx.dispose();
|
|
73
|
+
throw err;
|
|
74
|
+
}
|
|
75
|
+
return { ok: true, code: "OK", accelerator };
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* The managed accelerator over one runtime.
|
|
79
|
+
* @param platform - how this runtime probes and opens a context
|
|
80
|
+
* @param options - the caller's options
|
|
81
|
+
* @returns the handle
|
|
82
|
+
* @internal
|
|
83
|
+
*/
|
|
84
|
+
export function manageAccelerator(platform, options = {}) {
|
|
85
|
+
let pending = null;
|
|
86
|
+
let ready = null;
|
|
87
|
+
let disposed = false;
|
|
88
|
+
const disposedError = () => new WebGpuGraphError("E_DISPOSED", "the managed accelerator was disposed", { label: "acquireAccelerator" });
|
|
89
|
+
return {
|
|
90
|
+
current() {
|
|
91
|
+
if (disposed) {
|
|
92
|
+
return Promise.reject(disposedError());
|
|
93
|
+
}
|
|
94
|
+
if (ready !== null && ready.ctx.state !== "ready") {
|
|
95
|
+
// lost, or disposed by its holder: the next answer is a new device
|
|
96
|
+
ready = null;
|
|
97
|
+
pending = null;
|
|
98
|
+
}
|
|
99
|
+
if (pending === null) {
|
|
100
|
+
const attempt = acquireOnce(platform, options).then((result) => {
|
|
101
|
+
if (!result.ok) {
|
|
102
|
+
return result;
|
|
103
|
+
}
|
|
104
|
+
if (disposed) {
|
|
105
|
+
result.accelerator.dispose();
|
|
106
|
+
throw disposedError();
|
|
107
|
+
}
|
|
108
|
+
ready = result.accelerator;
|
|
109
|
+
return result;
|
|
110
|
+
}, (err) => {
|
|
111
|
+
// not a decline: the next call tries again rather than remembering a transient failure
|
|
112
|
+
if (pending === attempt) {
|
|
113
|
+
pending = null;
|
|
114
|
+
}
|
|
115
|
+
throw err;
|
|
116
|
+
});
|
|
117
|
+
pending = attempt;
|
|
118
|
+
}
|
|
119
|
+
return pending;
|
|
120
|
+
},
|
|
121
|
+
dispose() {
|
|
122
|
+
disposed = true;
|
|
123
|
+
ready?.dispose();
|
|
124
|
+
ready = null;
|
|
125
|
+
pending = null;
|
|
126
|
+
},
|
|
127
|
+
};
|
|
128
|
+
}
|
|
129
|
+
//# sourceMappingURL=managed.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"managed.js","sourceRoot":"","sources":["../../src/managed.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AAErD,OAAO,EAAE,kBAAkB,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AACnE,OAAO,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAyBtD,gEAAgE;AAChE,MAAM,YAAY,GAAG,qFAAqF,CAAC;AAE3G,MAAM,aAAa,GAAwB,IAAI,GAAG,CAAC,CAAC,aAAa,EAAE,cAAc,EAAE,iBAAiB,CAAC,CAAC,CAAC;AAEvG;;;;;;;GAOG;AACH,SAAS,QAAQ,CACb,QAA6B,EAC7B,IAAiC,EACjC,MAAc,EACd,OAAgE,EAAE;IAElE,IAAI,GAAG,GAAkB,IAAI,CAAC;IAC9B,IAAI,IAAI,KAAK,iBAAiB,EAAE,CAAC;QAC7B,GAAG,GAAG,YAAY,CAAC;IACvB,CAAC;SAAM,IAAI,IAAI,KAAK,aAAa,EAAE,CAAC;QAChC,GAAG,GAAG,QAAQ,CAAC,WAAW,EAAE,CAAC;IACjC,CAAC;IACD,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,EAAE,OAAO,EAAE,IAAI,CAAC,OAAO,IAAI,IAAI,EAAE,KAAK,EAAE,IAAI,CAAC,KAAK,IAAI,IAAI,EAAE,CAAC;AACtG,CAAC;AAED;;;;;;GAMG;AACH,KAAK,UAAU,WAAW,CAAC,QAA6B,EAAE,OAAkC;IACxF,MAAM,cAAc,GAAG,OAAO,CAAC,cAAc,KAAK,IAAI,CAAC;IACvD,MAAM,KAAK,GAAG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AAK,GAAG,IAAI,CAAC;gBACb,OAAO,GAAG,IAAI,CAAC;YACnB,CAAC;YACD,IAAI,OAAO,KAAK,IAAI,EAAE,CAAC;gBACnB,MAAM,OAAO,GAAG,WAAW,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC,IAAI,CAC/C,CAAC,MAAM,EAAE,EAAE;oBACP,IAAI,CAAC,MAAM,CAAC,EAAE,EAAE,CAAC;wBACb,OAAO,MAAM,CAAC;oBAClB,CAAC;oBACD,IAAI,QAAQ,EAAE,CAAC;wBACX,MAAM,CAAC,WAAW,CAAC,OAAO,EAAE,CAAC;wBAC7B,MAAM,aAAa,EAAE,CAAC;oBAC1B,CAAC;oBACD,KAAK,GAAG,MAAM,CAAC,WAAW,CAAC;oBAC3B,OAAO,MAAM,CAAC;gBAClB,CAAC,EACD,CAAC,GAAY,EAAE,EAAE;oBACb,uFAAuF;oBACvF,IAAI,OAAO,KAAK,OAAO,EAAE,CAAC;wBACtB,OAAO,GAAG,IAAI,CAAC;oBACnB,CAAC;oBACD,MAAM,GAAG,CAAC;gBACd,CAAC,CACJ,CAAC;gBACF,OAAO,GAAG,OAAO,CAAC;YACtB,CAAC;YACD,OAAO,OAAO,CAAC;QACnB,CAAC;QACD,OAAO;YACH,QAAQ,GAAG,IAAI,CAAC;YAChB,KAAK,EAAE,OAAO,EAAE,CAAC;YACjB,KAAK,GAAG,IAAI,CAAC;YACb,OAAO,GAAG,IAAI,CAAC;QACnB,CAAC;KACJ,CAAC;AACN,CAAC"}
|
package/dist/src/node/index.d.ts
CHANGED
|
@@ -10,6 +10,8 @@
|
|
|
10
10
|
/// <reference types="@webgpu/types" preserve="true" />
|
|
11
11
|
import { GpuContext } from "../context.js";
|
|
12
12
|
import type { GpuContextOptions, ProbeResult } from "../types/context.js";
|
|
13
|
+
import type { AcquireAcceleratorOptions, ManagedAccelerator } from "../types/managed.js";
|
|
14
|
+
export type { AcceleratorDeclined, AcceleratorReady, AcquireAcceleratorOptions, AcquireResult, ManagedAccelerator, } from "../types/managed.js";
|
|
13
15
|
/** Options of the Node helpers (spec 3.4). */
|
|
14
16
|
export interface NodeGpuOptions extends Omit<GpuContextOptions, "gpu" | "adapter" | "device" | "runtime"> {
|
|
15
17
|
/** Dawn `adapter=<substring>`: a substring of the adapter name (`llvmpipe`, `4070`); an empty string is ignored; wins over `software`. */
|
|
@@ -66,4 +68,13 @@ export declare function createNodeGpuContext(options?: NodeGpuOptions): Promise<
|
|
|
66
68
|
* @returns the probe result
|
|
67
69
|
*/
|
|
68
70
|
export declare function probeNodeWebGpu(options?: NodeGpuOptions): Promise<ProbeResult>;
|
|
71
|
+
/**
|
|
72
|
+
* The managed accelerator on Dawn: probe, context, device self-check and accelerator on the first `current()`, a
|
|
73
|
+
* new device after a loss, disposal by `dispose()`. Without the optional `webgpu` package `current()` declines with
|
|
74
|
+
* E_NO_WEBGPU and the install command as its fix; a software adapter is declined unless `acceptSoftware` is set.
|
|
75
|
+
* The same function as the `./acquire` subpath resolves to under Node.
|
|
76
|
+
* @param options - see AcquireAcceleratorOptions; `adapter` picks the Dawn adapter by name
|
|
77
|
+
* @returns the handle; nothing is loaded or probed until `current()` is called
|
|
78
|
+
*/
|
|
79
|
+
export declare function acquireAccelerator(options?: AcquireAcceleratorOptions): ManagedAccelerator;
|
|
69
80
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/node/index.ts"],"names":[],"mappings":"AACA;;;;;;;;GAQG;;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/node/index.ts"],"names":[],"mappings":"AACA;;;;;;;;GAQG;;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAG3C,OAAO,KAAK,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAC1E,OAAO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F;AAED;;;;GAIG;AACH,wBAAsB,eAAe,CAAC,OAAO,CAAC,EAAE,cAAc,GAAG,OAAO,CAAC,WAAW,CAAC,CAgBpF;AAED;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,CAAC,EAAE,yBAAyB,GAAG,kBAAkB,CAgB1F"}
|
package/dist/src/node/index.js
CHANGED
|
@@ -10,6 +10,7 @@
|
|
|
10
10
|
*/
|
|
11
11
|
import { GpuContext } from "../context.js";
|
|
12
12
|
import { WebGpuGraphError } from "../errors.js";
|
|
13
|
+
import { manageAccelerator } from "../managed.js";
|
|
13
14
|
/** The install hint of E_NO_WEBGPU (spec 2.5 item 4); P-ENV re-pins the version together with the devDependency. */
|
|
14
15
|
const INSTALL_HINT = "install the optional peer dependency webgpu@0.4.0";
|
|
15
16
|
/**
|
|
@@ -199,4 +200,24 @@ export async function probeNodeWebGpu(options) {
|
|
|
199
200
|
handle.dispose();
|
|
200
201
|
}
|
|
201
202
|
}
|
|
203
|
+
/**
|
|
204
|
+
* The managed accelerator on Dawn: probe, context, device self-check and accelerator on the first `current()`, a
|
|
205
|
+
* new device after a loss, disposal by `dispose()`. Without the optional `webgpu` package `current()` declines with
|
|
206
|
+
* E_NO_WEBGPU and the install command as its fix; a software adapter is declined unless `acceptSoftware` is set.
|
|
207
|
+
* The same function as the `./acquire` subpath resolves to under Node.
|
|
208
|
+
* @param options - see AcquireAcceleratorOptions; `adapter` picks the Dawn adapter by name
|
|
209
|
+
* @returns the handle; nothing is loaded or probed until `current()` is called
|
|
210
|
+
*/
|
|
211
|
+
export function acquireAccelerator(options) {
|
|
212
|
+
return manageAccelerator({
|
|
213
|
+
probe: (o, rejectSoftware) => probeNodeWebGpu({ adapter: o.adapter, powerPreference: o.powerPreference, rejectSoftware }),
|
|
214
|
+
open: (o, _probe, rejectSoftware) => createNodeGpuContext({
|
|
215
|
+
adapter: o.adapter,
|
|
216
|
+
powerPreference: o.powerPreference,
|
|
217
|
+
rejectSoftware,
|
|
218
|
+
warnUnreleasedSnapshots: o.warnUnreleasedSnapshots,
|
|
219
|
+
}),
|
|
220
|
+
noWebGpuFix: () => INSTALL_HINT,
|
|
221
|
+
}, options);
|
|
222
|
+
}
|
|
202
223
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/node/index.ts"],"names":[],"mappings":"AAAA,uDAAuD;AACvD;;;;;;;;GAQG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/node/index.ts"],"names":[],"mappings":"AAAA,uDAAuD;AACvD;;;;;;;;GAQG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC3C,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AA2ClD,oHAAoH;AACpH,MAAM,YAAY,GAAG,mDAAmD,CAAC;AAQzE;;;;;;;;;GASG;AACH,MAAM,SAAS,GAAG,IAAI,GAAG,EAAgC,CAAC;AAE1D;;;;GAIG;AACH,SAAS,YAAY,CAAC,MAAe;IACjC,OAAO,CACH,OAAO,MAAM,KAAK,QAAQ,IAAI,MAAM,KAAK,IAAI,IAAI,OAAQ,MAA+B,CAAC,MAAM,KAAK,UAAU,CACjH,CAAC;AACN,CAAC;AAED;;;;GAIG;AACH,SAAS,SAAS,CAAC,GAAY;IAC3B,OAAO,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;AAC5D,CAAC;AAED,qGAAqG;AACrG,MAAM,UAAU;IAGZ;;;OAGG;IACH,YAAY,GAAQ;QAChB,IAAI,CAAC,GAAG,GAAG,GAAG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Ae,EAAE,CAAC,CAAC,eAAe,EAAE,cAAc,EAAE,CAAC;QAC/F,IAAI,EAAE,CAAC,CAAC,EAAE,MAAM,EAAE,cAAc,EAAE,EAAE,CAChC,oBAAoB,CAAC;YACjB,OAAO,EAAE,CAAC,CAAC,OAAO;YAClB,eAAe,EAAE,CAAC,CAAC,eAAe;YAClC,cAAc;YACd,uBAAuB,EAAE,CAAC,CAAC,uBAAuB;SACrD,CAAC;QACN,WAAW,EAAE,GAAG,EAAE,CAAC,YAAY;KAClC,EACD,OAAO,CACV,CAAC;AACN,CAAC"}
|
|
@@ -1,15 +1,18 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* The grid pyramid (spec 6 row 12, 7.7 G4-G5; P4-T9): the planner that records, into the caller's pass, the finest
|
|
3
3
|
* centroids (G4, `grid-centroid`: thread per cell over `cells + outsideCells`, the pseudo-cells included), the hub-cell
|
|
4
|
-
* completion (
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
4
|
+
* completion (G4b: `grid-centroid-hub`, one workgroup per hub cell; PD-13) and one `grid-downsample` dispatch per
|
|
5
|
+
* coarser level (G5). G4b is a DIRECT dispatch of one workgroup per word of `hubList` -- the most hub cells the graph
|
|
6
|
+
* can hold -- and the kernel's `h < hubCount[0]` guard idles the workgroups past the count. It was an indirect
|
|
7
|
+
* dispatch from a finalize-written args slot until issue #732: Dawn validates every indirect dispatch with a hidden
|
|
8
|
+
* pass that cost 0.3 to 0.9 ms of device time per iteration, several times the whole grid tier's own work at 10k
|
|
9
|
+
* nodes (the frontier kernels' lesson, docs/decisions/G8.md G8-F5). The idle workgroups cost far less: `hubList` holds
|
|
10
|
+
* `ceil(n / GRID_HUB_CELL)` words, so 977 workgroups at 1M nodes, each reading one word. Level 0 holds `[sum m x, sum m y, sum m z, sum m]` per cell; every parent is the sum of its 2^dim
|
|
8
11
|
* children; the pseudo-cells (indices `cells ..` of level 0) are never children. No atomics touch the sums (design 6 row 12:
|
|
9
12
|
* bitwise reproducible); the only atomics are the hub append and the occupancy max.
|
|
10
13
|
*
|
|
11
|
-
* The named grid buffers (`pyramid`, `hubList`, `hubCounters
|
|
12
|
-
* `BufferSpec`s, so `inspect(name)` reaches them); the static params of
|
|
14
|
+
* The named grid buffers (`pyramid`, `hubList`, `hubCounters`) are the caller's (the model's
|
|
15
|
+
* `BufferSpec`s, so `inspect(name)` reaches them); the static params of every level are written
|
|
13
16
|
* ONCE at bind() through the scope's params writer (PD-11), so record() writes no uniform. `src/primitives/**` never
|
|
14
17
|
* imports `src/context.ts`.
|
|
15
18
|
*/
|
|
@@ -32,36 +35,34 @@ export interface GridPyramidBindings {
|
|
|
32
35
|
readonly cellStart: Binding;
|
|
33
36
|
/** `pyramidCells` vec4f: every level, level 0 first with the 2^dim orthant pseudo-cells from index `cells`. */
|
|
34
37
|
readonly pyramid: Binding;
|
|
35
|
-
/** The hub cells' indices, appended by G4 (at least one word; at most `floor(n / (GRID_HUB_CELL + 1))` are ever written, so `ceil(n / GRID_HUB_CELL)` words always suffice). */
|
|
38
|
+
/** The hub cells' indices, appended by G4 (at least one word; at most `floor(n / (GRID_HUB_CELL + 1))` are ever written, so `ceil(n / GRID_HUB_CELL)` words always suffice). Its word count is G4b's workgroup count. */
|
|
36
39
|
readonly hubList: Binding;
|
|
37
40
|
/** Two u32 (bound whole, at least 8 bytes): `[0]` the hub count, `[1]` the largest cell occupancy; the caller zeroes both before every build (K1, T10). */
|
|
38
41
|
readonly hubCounters: Binding;
|
|
39
|
-
/** One 16-byte indirect args slot with the INDIRECT usage: G4a writes it, G4b dispatches from it. */
|
|
40
|
-
readonly hubArgs: Binding;
|
|
41
42
|
}
|
|
42
|
-
/** Where `record()` stops: after level 0 is whole (G4
|
|
43
|
+
/** Where `record()` stops: after level 0 is whole (G4 and G4b) or after every coarser level (G5, the default). */
|
|
43
44
|
export type GridPyramidStage = "G4" | "G5";
|
|
44
45
|
/** A prepared pyramid build (spec 7.7 G4-G5): binds once per load, records the stages of one iteration into a pass. */
|
|
45
46
|
export interface GridPyramidPlanner {
|
|
46
47
|
/**
|
|
47
|
-
* Binds the named buffers and writes the static params of
|
|
48
|
+
* Binds the named buffers and writes the static params of every level (PD-11); called once
|
|
48
49
|
* per load (a second call rebinds and writes fresh params, so it belongs to a reload, never to an iteration).
|
|
49
50
|
* @param bindings - the buffers
|
|
50
51
|
*/
|
|
51
52
|
bind(bindings: GridPyramidBindings): void;
|
|
52
53
|
/**
|
|
53
|
-
* Records G4,
|
|
54
|
-
* stops after G4b (level 0 is whole:
|
|
54
|
+
* Records G4, G4b and then G5 for every coarser level at the `Fa2Params` slot `paramsOffset`; `upTo: "G4"`
|
|
55
|
+
* stops after G4b (level 0 is whole: G4b is G4's completion).
|
|
55
56
|
* @param pass - the compute pass
|
|
56
57
|
* @param paramsOffset - the dynamic offset of this iteration's `Fa2Params`
|
|
57
58
|
* @param upTo - the last stage to record (default "G5")
|
|
58
59
|
*/
|
|
59
60
|
record(pass: GPUComputePassEncoder, paramsOffset: number, upTo?: GridPyramidStage): void;
|
|
60
|
-
/** Dispatches the last record() issued:
|
|
61
|
+
/** Dispatches the last record() issued: 2 after `upTo: "G4"`, `2 + (levels - 1)` for a full record. */
|
|
61
62
|
readonly lastDispatches: number;
|
|
62
63
|
}
|
|
63
64
|
/**
|
|
64
|
-
* Prepares the pyramid's pipelines over a scope (G4,
|
|
65
|
+
* Prepares the pyramid's pipelines over a scope (G4, G4b and G5; compiles once) so bind() and record()
|
|
65
66
|
* are synchronous. The planner lives exactly as long as the scope.
|
|
66
67
|
* @param scope - the caller's scope (device, caps, cache, scratch, params)
|
|
67
68
|
* @param spec - the grid
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"grid-pyramid.d.ts","sourceRoot":"","sources":["../../../src/primitives/grid-pyramid.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"grid-pyramid.d.ts","sourceRoot":"","sources":["../../../src/primitives/grid-pyramid.ts"],"names":[],"mappings":"A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spec 6 row 12, 7.7 G4-G5; P4-T9): the planner that records, into the caller's pass, the finest
|
|
3
3
|
* centroids (G4, `grid-centroid`: thread per cell over `cells + outsideCells`, the pseudo-cells included), the hub-cell
|
|
4
|
-
* completion (
|
|
5
|
-
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
4
|
+
* completion (G4b: `grid-centroid-hub`, one workgroup per hub cell; PD-13) and one `grid-downsample` dispatch per
|
|
5
|
+
* coarser level (G5). G4b is a DIRECT dispatch of one workgroup per word of `hubList` -- the most hub cells the graph
|
|
6
|
+
* can hold -- and the kernel's `h < hubCount[0]` guard idles the workgroups past the count. It was an indirect
|
|
7
|
+
* dispatch from a finalize-written args slot until issue #732: Dawn validates every indirect dispatch with a hidden
|
|
8
|
+
* pass that cost 0.3 to 0.9 ms of device time per iteration, several times the whole grid tier's own work at 10k
|
|
9
|
+
* nodes (the frontier kernels' lesson, docs/decisions/G8.md G8-F5). The idle workgroups cost far less: `hubList` holds
|
|
10
|
+
* `ceil(n / GRID_HUB_CELL)` words, so 977 workgroups at 1M nodes, each reading one word. Level 0 holds `[sum m x, sum m y, sum m z, sum m]` per cell; every parent is the sum of its 2^dim
|
|
8
11
|
* children; the pseudo-cells (indices `cells ..` of level 0) are never children. No atomics touch the sums (design 6 row 12:
|
|
9
12
|
* bitwise reproducible); the only atomics are the hub append and the occupancy max.
|
|
10
13
|
*
|
|
11
|
-
* The named grid buffers (`pyramid`, `hubList`, `hubCounters
|
|
12
|
-
* `BufferSpec`s, so `inspect(name)` reaches them); the static params of
|
|
14
|
+
* The named grid buffers (`pyramid`, `hubList`, `hubCounters`) are the caller's (the model's
|
|
15
|
+
* `BufferSpec`s, so `inspect(name)` reaches them); the static params of every level are written
|
|
13
16
|
* ONCE at bind() through the scope's params writer (PD-11), so record() writes no uniform. `src/primitives/**` never
|
|
14
17
|
* imports `src/context.ts`.
|
|
15
18
|
*/
|
|
16
19
|
import { WebGpuGraphError } from "../errors.js";
|
|
17
|
-
import { plan1d } from "../kernel/dispatch.js";
|
|
18
|
-
import { GRID_LEVEL_PARAMS,
|
|
20
|
+
import { plan1d, plan2d } from "../kernel/dispatch.js";
|
|
21
|
+
import { GRID_LEVEL_PARAMS, kernelSpec } from "../kernels.js";
|
|
19
22
|
/**
|
|
20
|
-
* Prepares the pyramid's pipelines over a scope (G4,
|
|
23
|
+
* Prepares the pyramid's pipelines over a scope (G4, G4b and G5; compiles once) so bind() and record()
|
|
21
24
|
* are synchronous. The planner lives exactly as long as the scope.
|
|
22
25
|
* @param scope - the caller's scope (device, caps, cache, scratch, params)
|
|
23
26
|
* @param spec - the grid
|
|
@@ -25,18 +28,17 @@ import { GRID_LEVEL_PARAMS, INDIRECT_PARAMS, kernelSpec } from "../kernels.js";
|
|
|
25
28
|
*/
|
|
26
29
|
export async function preparePyramid(scope, spec) {
|
|
27
30
|
const centroid = await scope.pipelines.kernel(kernelSpec("grid-centroid"));
|
|
28
|
-
const finalize = await scope.pipelines.kernel(kernelSpec("indirect-finalize"));
|
|
29
31
|
const hub = await scope.pipelines.kernel(kernelSpec("grid-centroid-hub"));
|
|
30
32
|
const downsample = await scope.pipelines.kernel(kernelSpec("grid-downsample"));
|
|
31
|
-
return new GridPyramidPlannerImpl(scope, spec, { centroid,
|
|
33
|
+
return new GridPyramidPlannerImpl(scope, spec, { centroid, hub, downsample });
|
|
32
34
|
}
|
|
33
|
-
/** The planner: G4,
|
|
35
|
+
/** The planner: G4, G4b and G5 over one scope. */
|
|
34
36
|
class GridPyramidPlannerImpl {
|
|
35
37
|
/**
|
|
36
38
|
* Wraps the resolved kernels; use preparePyramid().
|
|
37
39
|
* @param scope - the caller's scope
|
|
38
40
|
* @param spec - the grid
|
|
39
|
-
* @param kernels - the
|
|
41
|
+
* @param kernels - the three kernels
|
|
40
42
|
*/
|
|
41
43
|
constructor(scope, spec, kernels) {
|
|
42
44
|
this.bound = null;
|
|
@@ -57,15 +59,9 @@ class GridPyramidPlannerImpl {
|
|
|
57
59
|
* @param bindings - the buffers
|
|
58
60
|
*/
|
|
59
61
|
bind(bindings) {
|
|
60
|
-
const { centroid,
|
|
62
|
+
const { centroid, hub, downsample } = this.kernels;
|
|
61
63
|
const { spec, scope } = this;
|
|
62
64
|
const b = bindings;
|
|
63
|
-
const finalizeParams = scope.params(INDIRECT_PARAMS, {
|
|
64
|
-
countIndex: 0,
|
|
65
|
-
wg: 1, // the finalize plans ceil(count / wg) workgroups over ITEMS; G4b's item is a hub cell, one workgroup each
|
|
66
|
-
slot: 0,
|
|
67
|
-
pad0: 0,
|
|
68
|
-
});
|
|
69
65
|
const levels = [];
|
|
70
66
|
let parentSide = spec.g;
|
|
71
67
|
for (let level = 0; level + 1 < spec.levels; level++) {
|
|
@@ -88,7 +84,6 @@ class GridPyramidPlannerImpl {
|
|
|
88
84
|
});
|
|
89
85
|
}
|
|
90
86
|
this.bound = {
|
|
91
|
-
hubArgs: b.hubArgs,
|
|
92
87
|
centroid: centroid.bind({
|
|
93
88
|
sortedIdx: b.sortedIdx,
|
|
94
89
|
cellStart: b.cellStart,
|
|
@@ -98,8 +93,6 @@ class GridPyramidPlannerImpl {
|
|
|
98
93
|
hubCounters: b.hubCounters,
|
|
99
94
|
P: b.params,
|
|
100
95
|
}),
|
|
101
|
-
finalize: finalize.bind({ counters: b.hubCounters, args: b.hubArgs, P: finalizeParams.binding }),
|
|
102
|
-
finalizeOffset: finalizeParams.offset,
|
|
103
96
|
hub: hub.bind({
|
|
104
97
|
sortedIdx: b.sortedIdx,
|
|
105
98
|
cellStart: b.cellStart,
|
|
@@ -109,6 +102,7 @@ class GridPyramidPlannerImpl {
|
|
|
109
102
|
hubCount: b.hubCounters,
|
|
110
103
|
P: b.params,
|
|
111
104
|
}),
|
|
105
|
+
hubSlots: Math.floor(b.hubList.size / 4),
|
|
112
106
|
levels,
|
|
113
107
|
};
|
|
114
108
|
}
|
|
@@ -123,13 +117,11 @@ class GridPyramidPlannerImpl {
|
|
|
123
117
|
if (bound === null) {
|
|
124
118
|
throw new WebGpuGraphError("E_NOT_LOADED", "gridPyramid: record() before bind()", { argument: "bind" });
|
|
125
119
|
}
|
|
126
|
-
const { centroid,
|
|
127
|
-
const one = { x: 1, y: 1, z: 1, items: 1, stride: null };
|
|
120
|
+
const { centroid, hub, downsample } = this.kernels;
|
|
128
121
|
const level0 = spec.cells + spec.outsideCells;
|
|
129
122
|
centroid.dispatch(pass, bound.centroid, plan1d(level0, scope.workgroupSize, scope.caps), [paramsOffset]);
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
this.dispatches = 3;
|
|
123
|
+
hub.dispatch(pass, bound.hub, plan2d(bound.hubSlots, scope.caps), [paramsOffset]);
|
|
124
|
+
this.dispatches = 2;
|
|
133
125
|
if ((upTo ?? "G5") === "G4") {
|
|
134
126
|
return;
|
|
135
127
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"grid-pyramid.js","sourceRoot":"","sources":["../../../src/primitives/grid-pyramid.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"grid-pyramid.js","sourceRoot":"","sources":["../../../src/primitives/grid-pyramid.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAEvD,OAAO,EAAE,iBAAiB,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAkD9D;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,cAAc,CAAC,KAAkB,EAAE,IAAc;IACnE,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,SAAS,CAAC,MAAM,CAAC,UAAU,CAAC,eAAe,CAAC,CAAC,CAAC;IAC3E,MAAM,GAAG,GAAG,MAAM,KAAK,CAAC,SAAS,CAAC,MAAM,CAAC,UAAU,CAAC,mBAAmB,CAAC,CAAC,CAAC;IAC1E,MAAM,UAAU,GAAG,MAAM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;YACH,IAAI,CAAC,UAAU,IAAI,CAAC,CAAC;QACzB,CAAC;IACL,CAAC;CACJ"}
|
|
@@ -54,6 +54,8 @@ export interface AcceleratorOptions {
|
|
|
54
54
|
*/
|
|
55
55
|
export interface GpuAccelerator extends AlgorithmAccelerator, LayoutAccelerator {
|
|
56
56
|
readonly kind: "webgpu";
|
|
57
|
+
/** `closenessCentrality` honours `harmonic` on an exact run, so the CPU dispatcher sends harmonic closeness here. */
|
|
58
|
+
readonly harmonicCloseness: true;
|
|
57
59
|
readonly ctx: GpuContext;
|
|
58
60
|
readonly options: Readonly<AcceleratorOptions>;
|
|
59
61
|
forceAtlas2(options?: ForceAtlas2Options): GpuLayoutSimulation<ForceAtlas2Options, ForceAtlas2Stats>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"accelerator.d.ts","sourceRoot":"","sources":["../../../src/types/accelerator.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EACR,oBAAoB,EACpB,cAAc,EACd,qBAAqB,EACrB,6BAA6B,EAC7B,UAAU,EACV,aAAa,EACb,2BAA2B,EAC3B,mBAAmB,EACnB,mBAAmB,EACnB,kBAAkB,EAClB,oBAAoB,EACpB,eAAe,EACf,cAAc,EACd,eAAe,EACf,UAAU,EACV,aAAa,EACb,kBAAkB,EAClB,gBAAgB,EAChB,WAAW,EACX,cAAc,EACjB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EAAE,GAAG,EAAE,GAAG,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACrE,OAAO,KAAK,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAE3E,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,KAAK,EACR,iBAAiB,EACjB,kBAAkB,EAClB,kBAAkB,EAClB,aAAa,EACb,cAAc,EACd,iBAAiB,EACjB,eAAe,EACf,WAAW,EACX,WAAW,EACX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IAChC,OAAO,IAAI,IAAI,CAAC;CACnB"}
|
|
1
|
+
{"version":3,"file":"accelerator.d.ts","sourceRoot":"","sources":["../../../src/types/accelerator.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EACR,oBAAoB,EACpB,cAAc,EACd,qBAAqB,EACrB,6BAA6B,EAC7B,UAAU,EACV,aAAa,EACb,2BAA2B,EAC3B,mBAAmB,EACnB,mBAAmB,EACnB,kBAAkB,EAClB,oBAAoB,EACpB,eAAe,EACf,cAAc,EACd,eAAe,EACf,UAAU,EACV,aAAa,EACb,kBAAkB,EAClB,gBAAgB,EAChB,WAAW,EACX,cAAc,EACjB,MAAM,qBAAqB,CAAC;AAC7B,OAAO,KAAK,EAAE,GAAG,EAAE,GAAG,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACrE,OAAO,KAAK,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,MAAM,iBAAiB,CAAC;AAE3E,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,KAAK,EACR,iBAAiB,EACjB,kBAAkB,EAClB,kBAAkB,EAClB,aAAa,EACb,cAAc,EACd,iBAAiB,EACjB,eAAe,EACf,WAAW,EACX,WAAW,EACX,eAAe,EAClB,MAAM,iBAAiB,CAAC;AACzB,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AACpD,OAAO,KAAK,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAClF,OAAO,KAAK,EACR,gBAAgB,EAChB,wBAAwB,EACxB,mBAAmB,EACnB,eAAe,EACf,qBAAqB,EACxB,MAAM,aAAa,CAAC;AACrB,OAAO,KAAK,EAAE,kBAAkB,EAAE,0BAA0B,EAAE,uBAAuB,EAAE,MAAM,cAAc,CAAC;AAC5G,OAAO,KAAK,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACtE,OAAO,KAAK,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,EAAE,OAAO,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAAC;IACpG,mBAAmB,CAAC,CAAC,EAAE,aAAa,EAAE,OAAO,CAAC,EAAE,2BAA2B,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAAC;IAC1G,qBAAqB,CAAC,CAAC,EAAE,aAAa,EAAE,OAAO,CAAC,EAAE,6BAA6B,GAAG,OAAO,CAAC,oBAAoB,CAAC,CAAC;IAChH,yBAAyB,CAAC,CAAC,EAAE,aAAa,EAAE,OAAO,CAAC,EAAE,6BAA6B,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAAC;IACnH,oBAAoB,CAAC,CAAC,EAAE,aAAa,EAAE,OAAO,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,aAAa,CAAC,CAAC;IACtF,aAAa,CAAC,CAAC,EAAE,aAAa,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC;IAC5D,gBAAgB,CAAC,CAAC,EAAE,aAAa,EAAE,OAAO,CAAC,EAAE,eAAe,GAAG,OAAO,CAAC,cAAc,CAAC,CAAC;IACvF,mBAAmB,CAAC,CAAC,EAAE,aAAa,EAAE,OAAO,CAAC,EAAE,UAAU,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC;IACnF,OAAO,CAAC,CAAC,EAAE,aAAa,GAAG,IAAI,CAAC;IAChC,OAAO,IAAI,IAAI,CAAC;CACnB"}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The types of `acquireAccelerator` (the `./acquire` subpath, and the same function on `./browser` and `./node`):
|
|
3
|
+
* one call that finds a device, checks that it computes correctly and hands back an accelerator, or says why it
|
|
4
|
+
* did not. Types only.
|
|
5
|
+
*/
|
|
6
|
+
import type { AcceleratorOptions, GpuAccelerator } from "./accelerator.js";
|
|
7
|
+
import type { AdapterSummary, DeviceCheck } from "./context.js";
|
|
8
|
+
/**
|
|
9
|
+
* Options of `acquireAccelerator`.
|
|
10
|
+
* @public
|
|
11
|
+
*/
|
|
12
|
+
export interface AcquireAcceleratorOptions {
|
|
13
|
+
/**
|
|
14
|
+
* Accept a software adapter (llvmpipe, SwiftShader, WARP). Default false: a software adapter is usually slower
|
|
15
|
+
* than a CPU implementation, so it is declined with `E_SOFTWARE_ONLY`.
|
|
16
|
+
*/
|
|
17
|
+
readonly acceptSoftware?: boolean | undefined;
|
|
18
|
+
/** The adapter power preference; default "high-performance". */
|
|
19
|
+
readonly powerPreference?: GPUPowerPreference | undefined;
|
|
20
|
+
/** Passed to `createAccelerator` (layout tuning, betweenness defaults). */
|
|
21
|
+
readonly accelerator?: AcceleratorOptions | undefined;
|
|
22
|
+
/** Warn once when more than this many snapshots stay resident on the device (the context's default when absent). */
|
|
23
|
+
readonly warnUnreleasedSnapshots?: number | undefined;
|
|
24
|
+
/** Node only: a substring of the Dawn adapter name to pick (`"llvmpipe"`, `"4070"`). Ignored in a browser. */
|
|
25
|
+
readonly adapter?: string | undefined;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* A verified accelerator.
|
|
29
|
+
* @public
|
|
30
|
+
*/
|
|
31
|
+
export interface AcceleratorReady {
|
|
32
|
+
readonly ok: true;
|
|
33
|
+
readonly code: "OK";
|
|
34
|
+
/** The accelerator. Its `ctx.lost` resolves when the device is lost; the handle then acquires a new one. */
|
|
35
|
+
readonly accelerator: GpuAccelerator;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Why no accelerator was handed over. Every code here is decided before any work runs, so a caller that has a CPU
|
|
39
|
+
* implementation runs it and reports the reason; that is detection, not a fallback.
|
|
40
|
+
* @public
|
|
41
|
+
*/
|
|
42
|
+
export interface AcceleratorDeclined {
|
|
43
|
+
readonly ok: false;
|
|
44
|
+
/**
|
|
45
|
+
* E_NO_WEBGPU: this runtime has no WebGPU (in Node: the optional `webgpu` package is missing);
|
|
46
|
+
* E_NO_ADAPTER: WebGPU exists but no adapter answered; E_SOFTWARE_ONLY: the adapter is a software renderer and
|
|
47
|
+
* `acceptSoftware` was not set; E_DEVICE_INCORRECT: the device got a known answer wrong in the self-check.
|
|
48
|
+
*/
|
|
49
|
+
readonly code: "E_NO_WEBGPU" | "E_NO_ADAPTER" | "E_SOFTWARE_ONLY" | "E_DEVICE_INCORRECT";
|
|
50
|
+
/** The reason in words. */
|
|
51
|
+
readonly reason: string;
|
|
52
|
+
/** What the user can change to get the GPU, or null when nothing they can do would help. */
|
|
53
|
+
readonly fix: string | null;
|
|
54
|
+
/** The adapter that was found and declined, when one was. */
|
|
55
|
+
readonly adapter: AdapterSummary | null;
|
|
56
|
+
/** The self-check record of an E_DEVICE_INCORRECT decline (what disagreed); null otherwise. */
|
|
57
|
+
readonly check: DeviceCheck | null;
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* What `ManagedAccelerator.current()` resolves to.
|
|
61
|
+
* @public
|
|
62
|
+
*/
|
|
63
|
+
export type AcquireResult = AcceleratorReady | AcceleratorDeclined;
|
|
64
|
+
/**
|
|
65
|
+
* The handle `acquireAccelerator` returns. It owns the device: probing, the device self-check, re-acquiring after
|
|
66
|
+
* device loss, and disposal.
|
|
67
|
+
* @public
|
|
68
|
+
*/
|
|
69
|
+
export interface ManagedAccelerator {
|
|
70
|
+
/**
|
|
71
|
+
* The accelerator, or why there is none. The first call acquires (probe, context, self-check); later calls
|
|
72
|
+
* return the same answer until the device is lost or the accelerator is disposed, after which the next call
|
|
73
|
+
* acquires a new device. Concurrent calls share one acquisition. A decline is remembered for the life of the
|
|
74
|
+
* handle. Rejects only for a failure that is not a decline (a device request that failed, a check that could not
|
|
75
|
+
* run), and with E_DISPOSED after `dispose()`.
|
|
76
|
+
*/
|
|
77
|
+
current(): Promise<AcquireResult>;
|
|
78
|
+
/** Disposes the current accelerator and its device; idempotent. */
|
|
79
|
+
dispose(): void;
|
|
80
|
+
}
|
|
81
|
+
//# sourceMappingURL=managed.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,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+FAA+F;IAC/F,QAAQ,CAAC,KAAK,EAAE,WAAW,GAAG,IAAI,CAAC;CACtC;AAED;;;GAGG;AACH,MAAM,MAAM,aAAa,GAAG,gBAAgB,GAAG,mBAAmB,CAAC;AAEnE;;;;GAIG;AACH,MAAM,WAAW,kBAAkB;IAC/B;;;;;;OAMG;IACH,OAAO,IAAI,OAAO,CAAC,aAAa,CAAC,CAAC;IAClC,mEAAmE;IACnE,OAAO,IAAI,IAAI,CAAC;CACnB"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The types of `acquireAccelerator` (the `./acquire` subpath, and the same function on `./browser` and `./node`):
|
|
3
|
+
* one call that finds a device, checks that it computes correctly and hands back an accelerator, or says why it
|
|
4
|
+
* did not. Types only.
|
|
5
|
+
*/
|
|
6
|
+
export {};
|
|
7
|
+
//# sourceMappingURL=managed.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"managed.js","sourceRoot":"","sources":["../../../src/types/managed.ts"],"names":[],"mappings":"AAAA;;;;GAIG"}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* The `bc-forward` kernel body (design 8.4 "forward pass = BFS with sigma as array<atomic<u32>>", 8.10 "BC forward
|
|
3
3
|
* (tagged)", 16.1): one level of the tagged multi-source breadth-first search of a betweenness batch. The level's
|
|
4
4
|
* frontier is the range `S[ends[level] .. ends[level + 1])` of the claim log, every entry a packed `s * n + u`; the
|
|
5
|
-
* expansion is `
|
|
5
|
+
* expansion is `advance-expand`'s block-mapped strip (each workgroup loads up to `WG` entries, scans their degrees
|
|
6
6
|
* in workgroup memory, and every lane strips the aggregate by an upper-bound binary search), fused with the claim, so
|
|
7
7
|
* no edge queue exists.
|
|
8
8
|
*
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* The `bc-forward` kernel body (design 8.4 "forward pass = BFS with sigma as array<atomic<u32>>", 8.10 "BC forward
|
|
3
3
|
* (tagged)", 16.1): one level of the tagged multi-source breadth-first search of a betweenness batch. The level's
|
|
4
4
|
* frontier is the range `S[ends[level] .. ends[level + 1])` of the claim log, every entry a packed `s * n + u`; the
|
|
5
|
-
* expansion is `
|
|
5
|
+
* expansion is `advance-expand`'s block-mapped strip (each workgroup loads up to `WG` entries, scans their degrees
|
|
6
6
|
* in workgroup memory, and every lane strips the aggregate by an upper-bound binary search), fused with the claim, so
|
|
7
7
|
* no edge queue exists.
|
|
8
8
|
*
|