@graphty/webgpu-graph-algorithms 0.0.0 → 0.2.1
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 +378 -23
- package/dist/browser.d.ts +1 -0
- package/dist/browser.js +32 -0
- package/dist/browser.js.map +1 -0
- package/dist/chunks/context-E6iKaeuJ.js +3136 -0
- package/dist/chunks/context-E6iKaeuJ.js.map +1 -0
- package/dist/node.d.ts +1 -0
- package/dist/node.js +131 -0
- package/dist/node.js.map +1 -0
- package/dist/src/accelerator.d.ts +26 -0
- package/dist/src/accelerator.d.ts.map +1 -0
- package/dist/src/accelerator.js +101 -0
- package/dist/src/accelerator.js.map +1 -0
- package/dist/src/algorithms/degree.d.ts +35 -0
- package/dist/src/algorithms/degree.d.ts.map +1 -0
- package/dist/src/algorithms/degree.js +119 -0
- package/dist/src/algorithms/degree.js.map +1 -0
- package/dist/src/browser/index.d.ts +23 -0
- package/dist/src/browser/index.d.ts.map +1 -0
- package/dist/src/browser/index.js +48 -0
- package/dist/src/browser/index.js.map +1 -0
- package/dist/src/constants.d.ts +92 -0
- package/dist/src/constants.d.ts.map +1 -0
- package/dist/src/constants.js +92 -0
- package/dist/src/constants.js.map +1 -0
- package/dist/src/context.d.ts +84 -0
- package/dist/src/context.d.ts.map +1 -0
- package/dist/src/context.js +304 -0
- package/dist/src/context.js.map +1 -0
- package/dist/src/device/acquire.d.ts +57 -0
- package/dist/src/device/acquire.d.ts.map +1 -0
- package/dist/src/device/acquire.js +232 -0
- package/dist/src/device/acquire.js.map +1 -0
- package/dist/src/device/caps.d.ts +43 -0
- package/dist/src/device/caps.d.ts.map +1 -0
- package/dist/src/device/caps.js +104 -0
- package/dist/src/device/caps.js.map +1 -0
- package/dist/src/device/error-scope.d.ts +75 -0
- package/dist/src/device/error-scope.d.ts.map +1 -0
- package/dist/src/device/error-scope.js +152 -0
- package/dist/src/device/error-scope.js.map +1 -0
- package/dist/src/device/lost.d.ts +51 -0
- package/dist/src/device/lost.d.ts.map +1 -0
- package/dist/src/device/lost.js +130 -0
- package/dist/src/device/lost.js.map +1 -0
- package/dist/src/device/webgpu-constants.d.ts +31 -0
- package/dist/src/device/webgpu-constants.d.ts.map +1 -0
- package/dist/src/device/webgpu-constants.js +31 -0
- package/dist/src/device/webgpu-constants.js.map +1 -0
- package/dist/src/errors.d.ts +56 -0
- package/dist/src/errors.d.ts.map +1 -0
- package/dist/src/errors.js +57 -0
- package/dist/src/errors.js.map +1 -0
- package/dist/src/index.d.ts +29 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/index.js +27 -0
- package/dist/src/index.js.map +1 -0
- package/dist/src/kernel/batch.d.ts +116 -0
- package/dist/src/kernel/batch.d.ts.map +1 -0
- package/dist/src/kernel/batch.js +335 -0
- package/dist/src/kernel/batch.js.map +1 -0
- package/dist/src/kernel/dispatch.d.ts +59 -0
- package/dist/src/kernel/dispatch.d.ts.map +1 -0
- package/dist/src/kernel/dispatch.js +139 -0
- package/dist/src/kernel/dispatch.js.map +1 -0
- package/dist/src/kernel/kernel.d.ts +84 -0
- package/dist/src/kernel/kernel.d.ts.map +1 -0
- package/dist/src/kernel/kernel.js +239 -0
- package/dist/src/kernel/kernel.js.map +1 -0
- package/dist/src/kernel/pipeline-cache.d.ts +90 -0
- package/dist/src/kernel/pipeline-cache.d.ts.map +1 -0
- package/dist/src/kernel/pipeline-cache.js +251 -0
- package/dist/src/kernel/pipeline-cache.js.map +1 -0
- package/dist/src/kernel/prelude.d.ts +35 -0
- package/dist/src/kernel/prelude.d.ts.map +1 -0
- package/dist/src/kernel/prelude.js +211 -0
- package/dist/src/kernel/prelude.js.map +1 -0
- package/dist/src/kernel/profiler.d.ts +64 -0
- package/dist/src/kernel/profiler.d.ts.map +1 -0
- package/dist/src/kernel/profiler.js +120 -0
- package/dist/src/kernel/profiler.js.map +1 -0
- package/dist/src/kernel/struct-block.d.ts +122 -0
- package/dist/src/kernel/struct-block.d.ts.map +1 -0
- package/dist/src/kernel/struct-block.js +353 -0
- package/dist/src/kernel/struct-block.js.map +1 -0
- package/dist/src/kernel/uniform-ring.d.ts +70 -0
- package/dist/src/kernel/uniform-ring.d.ts.map +1 -0
- package/dist/src/kernel/uniform-ring.js +146 -0
- package/dist/src/kernel/uniform-ring.js.map +1 -0
- package/dist/src/kernel/wgsl.d.ts +88 -0
- package/dist/src/kernel/wgsl.d.ts.map +1 -0
- package/dist/src/kernel/wgsl.js +390 -0
- package/dist/src/kernel/wgsl.js.map +1 -0
- package/dist/src/kernels.d.ts +81 -0
- package/dist/src/kernels.d.ts.map +1 -0
- package/dist/src/kernels.js +417 -0
- package/dist/src/kernels.js.map +1 -0
- package/dist/src/layouts/force-simulation.d.ts +498 -0
- package/dist/src/layouts/force-simulation.d.ts.map +1 -0
- package/dist/src/layouts/force-simulation.js +1650 -0
- package/dist/src/layouts/force-simulation.js.map +1 -0
- package/dist/src/layouts/forceatlas2.d.ts +210 -0
- package/dist/src/layouts/forceatlas2.d.ts.map +1 -0
- package/dist/src/layouts/forceatlas2.js +759 -0
- package/dist/src/layouts/forceatlas2.js.map +1 -0
- package/dist/src/layouts/inputs.d.ts +40 -0
- package/dist/src/layouts/inputs.d.ts.map +1 -0
- package/dist/src/layouts/inputs.js +185 -0
- package/dist/src/layouts/inputs.js.map +1 -0
- package/dist/src/layouts/repulsion-exact.d.ts +85 -0
- package/dist/src/layouts/repulsion-exact.d.ts.map +1 -0
- package/dist/src/layouts/repulsion-exact.js +134 -0
- package/dist/src/layouts/repulsion-exact.js.map +1 -0
- package/dist/src/layouts/seed.d.ts +56 -0
- package/dist/src/layouts/seed.d.ts.map +1 -0
- package/dist/src/layouts/seed.js +173 -0
- package/dist/src/layouts/seed.js.map +1 -0
- package/dist/src/memory/buffer-pool.d.ts +73 -0
- package/dist/src/memory/buffer-pool.d.ts.map +1 -0
- package/dist/src/memory/buffer-pool.js +170 -0
- package/dist/src/memory/buffer-pool.js.map +1 -0
- package/dist/src/memory/lease.d.ts +53 -0
- package/dist/src/memory/lease.d.ts.map +1 -0
- package/dist/src/memory/lease.js +85 -0
- package/dist/src/memory/lease.js.map +1 -0
- package/dist/src/memory/readback.d.ts +143 -0
- package/dist/src/memory/readback.d.ts.map +1 -0
- package/dist/src/memory/readback.js +375 -0
- package/dist/src/memory/readback.js.map +1 -0
- package/dist/src/memory/residency.d.ts +83 -0
- package/dist/src/memory/residency.d.ts.map +1 -0
- package/dist/src/memory/residency.js +573 -0
- package/dist/src/memory/residency.js.map +1 -0
- package/dist/src/memory/upload-plan.d.ts +101 -0
- package/dist/src/memory/upload-plan.d.ts.map +1 -0
- package/dist/src/memory/upload-plan.js +265 -0
- package/dist/src/memory/upload-plan.js.map +1 -0
- package/dist/src/node/index.d.ts +64 -0
- package/dist/src/node/index.d.ts.map +1 -0
- package/dist/src/node/index.js +183 -0
- package/dist/src/node/index.js.map +1 -0
- package/dist/src/primitives/reduce.d.ts +57 -0
- package/dist/src/primitives/reduce.d.ts.map +1 -0
- package/dist/src/primitives/reduce.js +161 -0
- package/dist/src/primitives/reduce.js.map +1 -0
- package/dist/src/primitives/segmented-reduce.d.ts +38 -0
- package/dist/src/primitives/segmented-reduce.d.ts.map +1 -0
- package/dist/src/primitives/segmented-reduce.js +211 -0
- package/dist/src/primitives/segmented-reduce.js.map +1 -0
- package/dist/src/types/accelerator.d.ts +209 -0
- package/dist/src/types/accelerator.d.ts.map +1 -0
- package/dist/src/types/accelerator.js +8 -0
- package/dist/src/types/accelerator.js.map +1 -0
- package/dist/src/types/context.d.ts +114 -0
- package/dist/src/types/context.d.ts.map +1 -0
- package/dist/src/types/context.js +7 -0
- package/dist/src/types/context.js.map +1 -0
- package/dist/src/types/layout.d.ts +95 -0
- package/dist/src/types/layout.d.ts.map +1 -0
- package/dist/src/types/layout.js +6 -0
- package/dist/src/types/layout.js.map +1 -0
- package/dist/src/types/memory.d.ts +22 -0
- package/dist/src/types/memory.d.ts.map +1 -0
- package/dist/src/types/memory.js +7 -0
- package/dist/src/types/memory.js.map +1 -0
- package/dist/src/types/options.d.ts +78 -0
- package/dist/src/types/options.d.ts.map +1 -0
- package/dist/src/types/options.js +7 -0
- package/dist/src/types/options.js.map +1 -0
- package/dist/src/types/run.d.ts +13 -0
- package/dist/src/types/run.d.ts.map +1 -0
- package/dist/src/types/run.js +6 -0
- package/dist/src/types/run.js.map +1 -0
- package/dist/src/wgsl/degree.wgsl.d.ts +10 -0
- package/dist/src/wgsl/degree.wgsl.d.ts.map +1 -0
- package/dist/src/wgsl/degree.wgsl.js +25 -0
- package/dist/src/wgsl/degree.wgsl.js.map +1 -0
- package/dist/src/wgsl/fa2-attraction.wgsl.d.ts +12 -0
- package/dist/src/wgsl/fa2-attraction.wgsl.d.ts.map +1 -0
- package/dist/src/wgsl/fa2-attraction.wgsl.js +37 -0
- package/dist/src/wgsl/fa2-attraction.wgsl.js.map +1 -0
- package/dist/src/wgsl/fa2-integrate.wgsl.d.ts +13 -0
- package/dist/src/wgsl/fa2-integrate.wgsl.d.ts.map +1 -0
- package/dist/src/wgsl/fa2-integrate.wgsl.js +69 -0
- package/dist/src/wgsl/fa2-integrate.wgsl.js.map +1 -0
- package/dist/src/wgsl/fa2-repulsion-exact.wgsl.d.ts +12 -0
- package/dist/src/wgsl/fa2-repulsion-exact.wgsl.d.ts.map +1 -0
- package/dist/src/wgsl/fa2-repulsion-exact.wgsl.js +79 -0
- package/dist/src/wgsl/fa2-repulsion-exact.wgsl.js.map +1 -0
- package/dist/src/wgsl/fa2-speed-finalize.wgsl.d.ts +15 -0
- package/dist/src/wgsl/fa2-speed-finalize.wgsl.d.ts.map +1 -0
- package/dist/src/wgsl/fa2-speed-finalize.wgsl.js +54 -0
- package/dist/src/wgsl/fa2-speed-finalize.wgsl.js.map +1 -0
- package/dist/src/wgsl/fa2-stats-finalize.wgsl.d.ts +14 -0
- package/dist/src/wgsl/fa2-stats-finalize.wgsl.d.ts.map +1 -0
- package/dist/src/wgsl/fa2-stats-finalize.wgsl.js +57 -0
- package/dist/src/wgsl/fa2-stats-finalize.wgsl.js.map +1 -0
- package/dist/src/wgsl/fa2-to-scene.wgsl.d.ts +11 -0
- package/dist/src/wgsl/fa2-to-scene.wgsl.d.ts.map +1 -0
- package/dist/src/wgsl/fa2-to-scene.wgsl.js +19 -0
- package/dist/src/wgsl/fa2-to-scene.wgsl.js.map +1 -0
- package/dist/src/wgsl/fill.wgsl.d.ts +7 -0
- package/dist/src/wgsl/fill.wgsl.d.ts.map +1 -0
- package/dist/src/wgsl/fill.wgsl.js +14 -0
- package/dist/src/wgsl/fill.wgsl.js.map +1 -0
- package/dist/src/wgsl/reduce.wgsl.d.ts +10 -0
- package/dist/src/wgsl/reduce.wgsl.d.ts.map +1 -0
- package/dist/src/wgsl/reduce.wgsl.js +63 -0
- package/dist/src/wgsl/reduce.wgsl.js.map +1 -0
- package/dist/src/wgsl/segmented-reduce.wgsl.d.ts +13 -0
- package/dist/src/wgsl/segmented-reduce.wgsl.d.ts.map +1 -0
- package/dist/src/wgsl/segmented-reduce.wgsl.js +35 -0
- package/dist/src/wgsl/segmented-reduce.wgsl.js.map +1 -0
- package/dist/tsconfig.build.tsbuildinfo +1 -0
- package/dist/webgpu-graph-algorithms.d.ts +1 -0
- package/dist/webgpu-graph-algorithms.js +4454 -0
- package/dist/webgpu-graph-algorithms.js.map +1 -0
- package/package.json +108 -17
- package/src/accelerator.ts +117 -0
- package/src/algorithms/degree.ts +142 -0
- package/src/browser/index.ts +57 -0
- package/src/constants.ts +116 -0
- package/src/context.ts +399 -0
- package/src/device/acquire.ts +256 -0
- package/src/device/caps.ts +122 -0
- package/src/device/error-scope.ts +171 -0
- package/src/device/lost.ts +142 -0
- package/src/device/webgpu-constants.ts +44 -0
- package/src/errors.ts +94 -0
- package/src/index.ts +102 -0
- package/src/kernel/batch.ts +427 -0
- package/src/kernel/dispatch.ts +162 -0
- package/src/kernel/kernel.ts +311 -0
- package/src/kernel/pipeline-cache.ts +288 -0
- package/src/kernel/prelude.ts +229 -0
- package/src/kernel/profiler.ts +148 -0
- package/src/kernel/struct-block.ts +439 -0
- package/src/kernel/uniform-ring.ts +184 -0
- package/src/kernel/wgsl.ts +490 -0
- package/src/kernels.ts +511 -0
- package/src/layouts/force-simulation.ts +2111 -0
- package/src/layouts/forceatlas2.ts +942 -0
- package/src/layouts/inputs.ts +252 -0
- package/src/layouts/repulsion-exact.ts +183 -0
- package/src/layouts/seed.ts +198 -0
- package/src/memory/buffer-pool.ts +204 -0
- package/src/memory/lease.ts +93 -0
- package/src/memory/readback.ts +429 -0
- package/src/memory/residency.ts +753 -0
- package/src/memory/upload-plan.ts +350 -0
- package/src/node/index.ts +230 -0
- package/src/primitives/reduce.ts +233 -0
- package/src/primitives/segmented-reduce.ts +270 -0
- package/src/types/accelerator.ts +236 -0
- package/src/types/context.ts +135 -0
- package/src/types/layout.ts +103 -0
- package/src/types/memory.ts +23 -0
- package/src/types/options.ts +84 -0
- package/src/types/run.ts +13 -0
- package/src/wgsl/degree.wgsl.ts +24 -0
- package/src/wgsl/fa2-attraction.wgsl.ts +37 -0
- package/src/wgsl/fa2-integrate.wgsl.ts +69 -0
- package/src/wgsl/fa2-repulsion-exact.wgsl.ts +78 -0
- package/src/wgsl/fa2-speed-finalize.wgsl.ts +53 -0
- package/src/wgsl/fa2-stats-finalize.wgsl.ts +57 -0
- package/src/wgsl/fa2-to-scene.wgsl.ts +19 -0
- package/src/wgsl/fill.wgsl.ts +13 -0
- package/src/wgsl/reduce.wgsl.ts +62 -0
- package/src/wgsl/segmented-reduce.wgsl.ts +35 -0
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Every numeric constant the package and the WGSL prelude share (spec 3.1, 3.5, 5.2, 7.8, 7.14, 7.17;
|
|
3
|
+
* contract 3.2). The prelude (src/kernel/prelude.ts, P1-T3) interpolates these values and never retypes them
|
|
4
|
+
* as literals (the literal grep of spec 3.5 enforces it); the planners read them; test/device/constants.test.ts
|
|
5
|
+
* pins them. graph-format's INVALID_INDEX is imported by the prelude directly and is deliberately not copied.
|
|
6
|
+
*/
|
|
7
|
+
/** Workgroup size of every 1D kernel; `WG = min(WORKGROUP_SIZE, caps.limits.maxComputeInvocationsPerWorkgroup)` at runtime (spec 5.1). */
|
|
8
|
+
export declare const WORKGROUP_SIZE = 256;
|
|
9
|
+
/** The spec minimum of maxComputeWorkgroupsPerDimension; asserted equal to the device limit at create() (spec 2.2, 5.2). */
|
|
10
|
+
export declare const MAX_WORKGROUPS_PER_DIM = 65535;
|
|
11
|
+
/** Items a 1D dispatch of WORKGROUP_SIZE covers: 65535 x 256 = 16,776,960, NOT 2^24 (design 10.6). */
|
|
12
|
+
export declare const MAX_1D_ITEMS: number;
|
|
13
|
+
/** The largest u32 (the `min` identity of the u32 reduce); interpolated into the prelude as `U32_MAX` so no body types the literal (contract 4.1). */
|
|
14
|
+
export declare const U32_MAX = 4294967295;
|
|
15
|
+
/** Arc-window boundaries are multiples of 64 arcs = 256 bytes (design 10.6). */
|
|
16
|
+
export declare const ARC_WINDOW_ALIGN = 64;
|
|
17
|
+
/** Storage-binding offset alignment the package always honours (spec 2.6): the graph-format arena is 256-aligned. */
|
|
18
|
+
export declare const STORAGE_ALIGN = 256;
|
|
19
|
+
/** Stride of one UniformRing slot: minUniformBufferOffsetAlignment is 256 on every runtime the package targets (spec 5.3). */
|
|
20
|
+
export declare const UNIFORM_SLOT_BYTES = 256;
|
|
21
|
+
/**
|
|
22
|
+
* Exact-tier crossover default, re-fixed at G3 by the spec 7.8 rule (spec Q-6; docs/decisions/G3.md section 3): the
|
|
23
|
+
* largest rung of the T-4 ladder (1k / 4k / 8k / 16k / 32k / 65k, E = 10n, 2D) with <= 4 ms per iteration, rounded down
|
|
24
|
+
* to a power of two. Measured on the RTX 4070 SUPER under Dawn-node: benchmarks/results/nvidia-lovelace-driver580.json,
|
|
25
|
+
* session 2026-09-16T02:07:45.933Z, the "ms/iteration (profiler)" rows (the GPU time of the iteration's passes at the
|
|
26
|
+
* card's working clock; the step(1) wall rows beside them include the 12n readback): 2.560 ms at 32k, 8.405 ms at 65k.
|
|
27
|
+
* The rule's second clause -- not slower than the grid tier at the same n -- has no grid tier to compare with in P3 and
|
|
28
|
+
* is re-checked at G4 (spec 7.8). A consumer whose GPU differs (integrated, Apple, T4) passes its own value through
|
|
29
|
+
* createAccelerator(ctx, { layout: { exactMaxNodes } }); P4's calibrateLayout(ctx) measures it.
|
|
30
|
+
*/
|
|
31
|
+
export declare const EXACT_MAX_NODES = 32768;
|
|
32
|
+
/** Default number of MAP_READ staging buffers in the Readback ring (spec 4.4). */
|
|
33
|
+
export declare const DEFAULT_STAGING_SLOTS = 3;
|
|
34
|
+
/** Timestamp query-set size of the Profiler (spec 5.5: "a query set of 256 slots"; 2 slots per pass). */
|
|
35
|
+
export declare const PROFILER_QUERY_SLOTS = 256;
|
|
36
|
+
/** Byte size above which createBuffer runs inside an "out-of-memory" error scope (spec 5.7). */
|
|
37
|
+
export declare const OOM_SCOPE_THRESHOLD_BYTES: number;
|
|
38
|
+
/** Idle buffers kept per (size class, usage) by the BufferPool (spec 4.4). */
|
|
39
|
+
export declare const POOL_MAX_IDLE_PER_CLASS = 4;
|
|
40
|
+
/** Smallest power-of-two pool class (spec 4.4). */
|
|
41
|
+
export declare const POOL_MIN_CLASS_BYTES: number;
|
|
42
|
+
/** Largest power-of-two pool class; above it the classes grow linearly (spec 4.4). */
|
|
43
|
+
export declare const POOL_MAX_POW2_CLASS_BYTES: number;
|
|
44
|
+
/** The linear step of the pool classes above the largest power of two (spec 4.4). */
|
|
45
|
+
export declare const POOL_LINEAR_STEP_BYTES: number;
|
|
46
|
+
/** Default `warnUnreleasedSnapshots` (spec 2.2, 4.1). */
|
|
47
|
+
export declare const DEFAULT_WARN_UNRELEASED_SNAPSHOTS = 2;
|
|
48
|
+
/** CONTRACT DECISION: the largest `iterations` a single step() records (the trace region and the uniform ring are sized by it); larger values are E_INVALID_ARGUMENT. */
|
|
49
|
+
export declare const MAX_ITERATIONS_PER_STEP = 256;
|
|
50
|
+
/** Bytes of one Fa2Trace record (spec 7.3: 32-byte records). */
|
|
51
|
+
export declare const TRACE_RECORD_BYTES = 32;
|
|
52
|
+
/** CONTRACT DECISION: the state header is padded to 256 bytes so the trace region that follows it in the same buffer starts at a legal 256-aligned binding offset (spec 7.3 says "128 + k x 32"; 128 is not a legal storage offset). */
|
|
53
|
+
export declare const STATE_HEADER_BYTES = 256;
|
|
54
|
+
/** Bytes of one per-workgroup partials record (spec 7.3: exactly 64 B). */
|
|
55
|
+
export declare const PARTIAL_BYTES = 64;
|
|
56
|
+
/** ForceAtlas2 defaults (spec 7.14, 7.17, 7.19). */
|
|
57
|
+
export declare const FA2_DEFAULTS: Readonly<{
|
|
58
|
+
maxIter: 100;
|
|
59
|
+
jitterTolerance: 1;
|
|
60
|
+
scalingRatio: 2;
|
|
61
|
+
gravity: 1;
|
|
62
|
+
strongGravity: false;
|
|
63
|
+
distributedAction: false;
|
|
64
|
+
linlog: false;
|
|
65
|
+
dissuadeHubs: false;
|
|
66
|
+
dim: 2;
|
|
67
|
+
scale: 1;
|
|
68
|
+
settleThreshold: 0.001;
|
|
69
|
+
settleWindow: 10;
|
|
70
|
+
iterationsPerStep: 1;
|
|
71
|
+
maxInFlight: 2;
|
|
72
|
+
}>;
|
|
73
|
+
/** GPU-only layout tuning defaults (spec 7.14): repulsion "auto", exactMaxNodes EXACT_MAX_NODES, nearMax 64, deterministic true, gridMax2D 512, gridMax3D 128, extentFactor 6, compat "paper". */
|
|
74
|
+
export declare const LAYOUT_TUNING_DEFAULTS: Readonly<{
|
|
75
|
+
repulsion: "auto";
|
|
76
|
+
exactMaxNodes: number;
|
|
77
|
+
nearMax: 64;
|
|
78
|
+
deterministic: true;
|
|
79
|
+
gridMax2D: 512;
|
|
80
|
+
gridMax3D: 128;
|
|
81
|
+
extentFactor: 6;
|
|
82
|
+
compat: "paper";
|
|
83
|
+
}>;
|
|
84
|
+
/** The distance floor `max(d, 0.01)` of spec 7.2; interpolated into the prelude (contract 4.1). */
|
|
85
|
+
export declare const FA2_DISTANCE_FLOOR = 0.01;
|
|
86
|
+
/** The square of FA2_DISTANCE_FLOOR. */
|
|
87
|
+
export declare const FA2_DISTANCE_FLOOR_SQ = 0.0001;
|
|
88
|
+
/** The coincident threshold `d^2 < 1e-8` of spec 7.2. */
|
|
89
|
+
export declare const FA2_COINCIDENT_SQ = 1e-8;
|
|
90
|
+
/** Bits of Fa2Params.flags (contract 4.4). */
|
|
91
|
+
export declare const FA2_FLAG_FIRST = 1;
|
|
92
|
+
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,0IAA0I;AAC1I,eAAO,MAAM,cAAc,MAAM,CAAC;AAClC,4HAA4H;AAC5H,eAAO,MAAM,sBAAsB,QAAQ,CAAC;AAC5C,sGAAsG;AACtG,eAAO,MAAM,YAAY,QAA0C,CAAC;AACpE,sJAAsJ;AACtJ,eAAO,MAAM,OAAO,aAAa,CAAC;AAClC,gFAAgF;AAChF,eAAO,MAAM,gBAAgB,KAAK,CAAC;AACnC,qHAAqH;AACrH,eAAO,MAAM,aAAa,MAAM,CAAC;AACjC,8HAA8H;AAC9H,eAAO,MAAM,kBAAkB,MAAM,CAAC;AACtC;;;;;;;;;GASG;AACH,eAAO,MAAM,eAAe,QAAQ,CAAC;AACrC,kFAAkF;AAClF,eAAO,MAAM,qBAAqB,IAAI,CAAC;AACvC,yGAAyG;AACzG,eAAO,MAAM,oBAAoB,MAAM,CAAC;AACxC,gGAAgG;AAChG,eAAO,MAAM,yBAAyB,QAAmB,CAAC;AAC1D,8EAA8E;AAC9E,eAAO,MAAM,uBAAuB,IAAI,CAAC;AACzC,mDAAmD;AACnD,eAAO,MAAM,oBAAoB,QAAW,CAAC;AAC7C,sFAAsF;AACtF,eAAO,MAAM,yBAAyB,QAAmB,CAAC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AAC;AAC5C,yDAAyD;AACzD,eAAO,MAAM,iBAAiB,OAAO,CAAC;AACtC,8CAA8C;AAC9C,eAAO,MAAM,cAAc,IAAI,CAAC"}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Every numeric constant the package and the WGSL prelude share (spec 3.1, 3.5, 5.2, 7.8, 7.14, 7.17;
|
|
3
|
+
* contract 3.2). The prelude (src/kernel/prelude.ts, P1-T3) interpolates these values and never retypes them
|
|
4
|
+
* as literals (the literal grep of spec 3.5 enforces it); the planners read them; test/device/constants.test.ts
|
|
5
|
+
* pins them. graph-format's INVALID_INDEX is imported by the prelude directly and is deliberately not copied.
|
|
6
|
+
*/
|
|
7
|
+
/** Workgroup size of every 1D kernel; `WG = min(WORKGROUP_SIZE, caps.limits.maxComputeInvocationsPerWorkgroup)` at runtime (spec 5.1). */
|
|
8
|
+
export const WORKGROUP_SIZE = 256;
|
|
9
|
+
/** The spec minimum of maxComputeWorkgroupsPerDimension; asserted equal to the device limit at create() (spec 2.2, 5.2). */
|
|
10
|
+
export const MAX_WORKGROUPS_PER_DIM = 65535;
|
|
11
|
+
/** Items a 1D dispatch of WORKGROUP_SIZE covers: 65535 x 256 = 16,776,960, NOT 2^24 (design 10.6). */
|
|
12
|
+
export const MAX_1D_ITEMS = MAX_WORKGROUPS_PER_DIM * WORKGROUP_SIZE;
|
|
13
|
+
/** The largest u32 (the `min` identity of the u32 reduce); interpolated into the prelude as `U32_MAX` so no body types the literal (contract 4.1). */
|
|
14
|
+
export const U32_MAX = 0xffffffff;
|
|
15
|
+
/** Arc-window boundaries are multiples of 64 arcs = 256 bytes (design 10.6). */
|
|
16
|
+
export const ARC_WINDOW_ALIGN = 64;
|
|
17
|
+
/** Storage-binding offset alignment the package always honours (spec 2.6): the graph-format arena is 256-aligned. */
|
|
18
|
+
export const STORAGE_ALIGN = 256;
|
|
19
|
+
/** Stride of one UniformRing slot: minUniformBufferOffsetAlignment is 256 on every runtime the package targets (spec 5.3). */
|
|
20
|
+
export const UNIFORM_SLOT_BYTES = 256;
|
|
21
|
+
/**
|
|
22
|
+
* Exact-tier crossover default, re-fixed at G3 by the spec 7.8 rule (spec Q-6; docs/decisions/G3.md section 3): the
|
|
23
|
+
* largest rung of the T-4 ladder (1k / 4k / 8k / 16k / 32k / 65k, E = 10n, 2D) with <= 4 ms per iteration, rounded down
|
|
24
|
+
* to a power of two. Measured on the RTX 4070 SUPER under Dawn-node: benchmarks/results/nvidia-lovelace-driver580.json,
|
|
25
|
+
* session 2026-09-16T02:07:45.933Z, the "ms/iteration (profiler)" rows (the GPU time of the iteration's passes at the
|
|
26
|
+
* card's working clock; the step(1) wall rows beside them include the 12n readback): 2.560 ms at 32k, 8.405 ms at 65k.
|
|
27
|
+
* The rule's second clause -- not slower than the grid tier at the same n -- has no grid tier to compare with in P3 and
|
|
28
|
+
* is re-checked at G4 (spec 7.8). A consumer whose GPU differs (integrated, Apple, T4) passes its own value through
|
|
29
|
+
* createAccelerator(ctx, { layout: { exactMaxNodes } }); P4's calibrateLayout(ctx) measures it.
|
|
30
|
+
*/
|
|
31
|
+
export const EXACT_MAX_NODES = 32768;
|
|
32
|
+
/** Default number of MAP_READ staging buffers in the Readback ring (spec 4.4). */
|
|
33
|
+
export const DEFAULT_STAGING_SLOTS = 3;
|
|
34
|
+
/** Timestamp query-set size of the Profiler (spec 5.5: "a query set of 256 slots"; 2 slots per pass). */
|
|
35
|
+
export const PROFILER_QUERY_SLOTS = 256;
|
|
36
|
+
/** Byte size above which createBuffer runs inside an "out-of-memory" error scope (spec 5.7). */
|
|
37
|
+
export const OOM_SCOPE_THRESHOLD_BYTES = 16 * 1024 * 1024;
|
|
38
|
+
/** Idle buffers kept per (size class, usage) by the BufferPool (spec 4.4). */
|
|
39
|
+
export const POOL_MAX_IDLE_PER_CLASS = 4;
|
|
40
|
+
/** Smallest power-of-two pool class (spec 4.4). */
|
|
41
|
+
export const POOL_MIN_CLASS_BYTES = 4 * 1024;
|
|
42
|
+
/** Largest power-of-two pool class; above it the classes grow linearly (spec 4.4). */
|
|
43
|
+
export const POOL_MAX_POW2_CLASS_BYTES = 64 * 1024 * 1024;
|
|
44
|
+
/** The linear step of the pool classes above the largest power of two (spec 4.4). */
|
|
45
|
+
export const POOL_LINEAR_STEP_BYTES = 16 * 1024 * 1024;
|
|
46
|
+
/** Default `warnUnreleasedSnapshots` (spec 2.2, 4.1). */
|
|
47
|
+
export const DEFAULT_WARN_UNRELEASED_SNAPSHOTS = 2;
|
|
48
|
+
/** CONTRACT DECISION: the largest `iterations` a single step() records (the trace region and the uniform ring are sized by it); larger values are E_INVALID_ARGUMENT. */
|
|
49
|
+
export const MAX_ITERATIONS_PER_STEP = 256;
|
|
50
|
+
/** Bytes of one Fa2Trace record (spec 7.3: 32-byte records). */
|
|
51
|
+
export const TRACE_RECORD_BYTES = 32;
|
|
52
|
+
/** CONTRACT DECISION: the state header is padded to 256 bytes so the trace region that follows it in the same buffer starts at a legal 256-aligned binding offset (spec 7.3 says "128 + k x 32"; 128 is not a legal storage offset). */
|
|
53
|
+
export const STATE_HEADER_BYTES = 256;
|
|
54
|
+
/** Bytes of one per-workgroup partials record (spec 7.3: exactly 64 B). */
|
|
55
|
+
export const PARTIAL_BYTES = 64;
|
|
56
|
+
/** ForceAtlas2 defaults (spec 7.14, 7.17, 7.19). */
|
|
57
|
+
export const FA2_DEFAULTS = Object.freeze({
|
|
58
|
+
maxIter: 100,
|
|
59
|
+
jitterTolerance: 1,
|
|
60
|
+
scalingRatio: 2,
|
|
61
|
+
gravity: 1,
|
|
62
|
+
strongGravity: false,
|
|
63
|
+
distributedAction: false,
|
|
64
|
+
linlog: false,
|
|
65
|
+
dissuadeHubs: false,
|
|
66
|
+
dim: 2,
|
|
67
|
+
scale: 1,
|
|
68
|
+
settleThreshold: 0.001,
|
|
69
|
+
settleWindow: 10,
|
|
70
|
+
iterationsPerStep: 1,
|
|
71
|
+
maxInFlight: 2,
|
|
72
|
+
});
|
|
73
|
+
/** GPU-only layout tuning defaults (spec 7.14): repulsion "auto", exactMaxNodes EXACT_MAX_NODES, nearMax 64, deterministic true, gridMax2D 512, gridMax3D 128, extentFactor 6, compat "paper". */
|
|
74
|
+
export const LAYOUT_TUNING_DEFAULTS = Object.freeze({
|
|
75
|
+
repulsion: "auto",
|
|
76
|
+
exactMaxNodes: EXACT_MAX_NODES,
|
|
77
|
+
nearMax: 64,
|
|
78
|
+
deterministic: true,
|
|
79
|
+
gridMax2D: 512,
|
|
80
|
+
gridMax3D: 128,
|
|
81
|
+
extentFactor: 6,
|
|
82
|
+
compat: "paper",
|
|
83
|
+
});
|
|
84
|
+
/** The distance floor `max(d, 0.01)` of spec 7.2; interpolated into the prelude (contract 4.1). */
|
|
85
|
+
export const FA2_DISTANCE_FLOOR = 0.01;
|
|
86
|
+
/** The square of FA2_DISTANCE_FLOOR. */
|
|
87
|
+
export const FA2_DISTANCE_FLOOR_SQ = 0.0001;
|
|
88
|
+
/** The coincident threshold `d^2 < 1e-8` of spec 7.2. */
|
|
89
|
+
export const FA2_COINCIDENT_SQ = 1e-8;
|
|
90
|
+
/** Bits of Fa2Params.flags (contract 4.4). */
|
|
91
|
+
export const FA2_FLAG_FIRST = 1;
|
|
92
|
+
//# sourceMappingURL=constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,0IAA0I;AAC1I,MAAM,CAAC,MAAM,cAAc,GAAG,GAAG,CAAC;AAClC,4HAA4H;AAC5H,MAAM,CAAC,MAAM,sBAAsB,GAAG,KAAK,CAAC;AAC5C,sGAAsG;AACtG,MAAM,CAAC,MAAM,YAAY,GAAG,sBAAsB,GAAG,cAAc,CAAC;AACpE,sJAAsJ;AACtJ,MAAM,CAAC,MAAM,OAAO,GAAG,UAAU,CAAC;AAClC,gFAAgF;AAChF,MAAM,CAAC,MAAM,gBAAgB,GAAG,EAAE,C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CAAC;IACV,aAAa,EAAE,KAAK;IACpB,iBAAiB,EAAE,KAAK;IACxB,MAAM,EAAE,KAAK;IACb,YAAY,EAAE,KAAK;IACnB,GAAG,EAAE,CAAC;IACN,KAAK,EAAE,CAAC;IACR,eAAe,EAAE,KAAK;IACtB,YAAY,EAAE,EAAE;IAChB,iBAAiB,EAAE,CAAC;IACpB,WAAW,EAAE,CAAC;CACjB,CAAC,CAAC;AACH,kMAAkM;AAClM,MAAM,CAAC,MAAM,sBAAsB,GAS9B,MAAM,CAAC,MAAM,CAAC;IACf,SAAS,EAAE,MAAM;IACjB,aAAa,EAAE,eAAe;IAC9B,OAAO,EAAE,EAAE;IACX,aAAa,EAAE,IAAI;IACnB,SAAS,EAAE,GAAG;IACd,SAAS,EAAE,GAAG;IACd,YAAY,EAAE,CAAC;IACf,MAAM,EAAE,OAAO;CAClB,CAAC,CAAC;AACH,mGAAmG;AACnG,MAAM,CAAC,MAAM,kBAAkB,GAAG,IAAI,CAAC;AACvC,wCAAwC;AACxC,MAAM,CAAC,MAAM,qBAAqB,GAAG,MAAM,CAAC;AAC5C,yDAAyD;AACzD,MAAM,CAAC,MAAM,iBAAiB,GAAG,IAAI,CAAC;AACtC,8CAA8C;AAC9C,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,CAAC"}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GpuContext (spec 2.2, 2.8, 3.3, 5.7; contract 3.5): one device, its caps and the singletons built on it --
|
|
3
|
+
* the composition root of D26. probe() never creates a device; create() runs the six steps of spec 2.2 in
|
|
4
|
+
* order; from() adopts a device the caller owns. Step 5 (the uncapturederror sink and the device.lost
|
|
5
|
+
* watcher) and step 6 (the AllocationTracker, GraphResidency, BufferPool, Readback and PipelineCache) run
|
|
6
|
+
* in the private constructor. The Profiler is constructed when "timestamp-query" is on the device (contract
|
|
7
|
+
* 3.5; P2-T1) with `quantised` = runtime !== "node" (Dawn-node is the only runtime whose ticks are known
|
|
8
|
+
* unquantised, spec 2.6). This file never imports ./kernels.js or ./wgsl/**.
|
|
9
|
+
*/
|
|
10
|
+
import type { GraphSnapshot } from "@graphty/graph-format";
|
|
11
|
+
import { Profiler } from "./kernel/profiler.js";
|
|
12
|
+
import type { GpuCaps, GpuContextOptions, ProbeOptions, ProbeResult } from "./types/context.js";
|
|
13
|
+
/** One device, its caps and the singletons built on it (spec 3.3; the composition root of D26). */
|
|
14
|
+
export declare class GpuContext {
|
|
15
|
+
/** The device (owned when create() made it, adopted otherwise). */
|
|
16
|
+
readonly device: GPUDevice;
|
|
17
|
+
/** The capability record captured from device.limits / device.features (spec 3.3). */
|
|
18
|
+
readonly caps: GpuCaps;
|
|
19
|
+
/** Resolves with the lost info once the device is lost or destroyed (spec 2.8). */
|
|
20
|
+
readonly lost: Promise<GPUDeviceLostInfo>;
|
|
21
|
+
/** Non-null when "timestamp-query" was granted (P2-T1 makes it functional; P1 always null). */
|
|
22
|
+
readonly profiler: Profiler | null;
|
|
23
|
+
private currentState;
|
|
24
|
+
private lostError;
|
|
25
|
+
private readonly slot;
|
|
26
|
+
private readonly uninstallSink;
|
|
27
|
+
private readonly lostListeners;
|
|
28
|
+
private readonly disposers;
|
|
29
|
+
private batchCounter;
|
|
30
|
+
/**
|
|
31
|
+
* Steps 5 and 6 of create() (spec 2.2): the sink, the loss watcher and the singletons.
|
|
32
|
+
* @param init - the device, its caps and the create-time choices
|
|
33
|
+
*/
|
|
34
|
+
private constructor();
|
|
35
|
+
/**
|
|
36
|
+
* Probe without creating a device (spec 2.2); never throws. `gpu === undefined` -> E_NO_WEBGPU;
|
|
37
|
+
* requestAdapter() null or a throw -> E_NO_ADAPTER; `rejectSoftware && software` -> E_SOFTWARE_ONLY (the
|
|
38
|
+
* adapter and its summary are still reported); else OK with the UNUSED adapter and its summary.
|
|
39
|
+
* @param options - the GPU object, the power preference and the software policy
|
|
40
|
+
* @returns the probe result
|
|
41
|
+
*/
|
|
42
|
+
static probe(options: ProbeOptions): Promise<ProbeResult>;
|
|
43
|
+
/**
|
|
44
|
+
* The six-step acquisition of spec 2.2: adopt `device`, else take `adapter`, else request one from `gpu`
|
|
45
|
+
* (step 1); the software test (step 2); the limits / features and requestDevice (step 3); the caps from
|
|
46
|
+
* device.limits plus assertPlanLimits (step 4); the sink, the loss watcher and the singletons (steps 5-6,
|
|
47
|
+
* in the constructor).
|
|
48
|
+
* @param options - see GpuContextOptions
|
|
49
|
+
* @returns the context
|
|
50
|
+
*/
|
|
51
|
+
static create(options: GpuContextOptions): Promise<GpuContext>;
|
|
52
|
+
/**
|
|
53
|
+
* Zero-cost adoption of a device the caller owns (ownsDevice false, runtime "unknown" unless info says
|
|
54
|
+
* otherwise). The context is labelled with the device's label, or "GpuContext.from" when it has none.
|
|
55
|
+
* @param device - the device to adopt
|
|
56
|
+
* @param info - what the caller knows about the adapter, if anything
|
|
57
|
+
* @returns the context
|
|
58
|
+
*/
|
|
59
|
+
static from(device: GPUDevice, info?: Partial<GpuCaps>): GpuContext;
|
|
60
|
+
/**
|
|
61
|
+
* "ready" | "lost" | "disposed".
|
|
62
|
+
* @returns the lifecycle state
|
|
63
|
+
*/
|
|
64
|
+
get state(): "ready" | "lost" | "disposed";
|
|
65
|
+
/**
|
|
66
|
+
* Destroys every buffer recorded for the snapshot (spec 4.5), then `pool.trim()` (spec 4.4: idle scratch
|
|
67
|
+
* goes with the graph); idempotent; safe on a snapshot never uploaded; a no-op after dispose().
|
|
68
|
+
* @param snapshot - the snapshot whose buffers are released
|
|
69
|
+
*/
|
|
70
|
+
release(snapshot: GraphSnapshot): void;
|
|
71
|
+
/**
|
|
72
|
+
* Rejects pending work with E_DISPOSED (every later public call), destroys residency, pool and staging
|
|
73
|
+
* ring, destroys the device when owned, runs attached disposers; idempotent (spec 2.8).
|
|
74
|
+
*/
|
|
75
|
+
dispose(): void;
|
|
76
|
+
/**
|
|
77
|
+
* Step 5 of spec 2.2 on loss: state "lost", the residency cleared without destroying (the buffers are
|
|
78
|
+
* gone with the device), every registered listener run once; a loss reported after dispose() (the owned
|
|
79
|
+
* device was destroyed by dispose) changes nothing.
|
|
80
|
+
* @param info - the device.lost result
|
|
81
|
+
*/
|
|
82
|
+
private handleLost;
|
|
83
|
+
}
|
|
84
|
+
//# sourceMappingURL=context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../src/context.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AAe3D,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAIhD,OAAO,KAAK,EAAE,OAAO,EAAE,iBAAiB,EAAiB,YAAY,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AAqC/G,mGAAmG;AACnG,qBAAa,UAAU;IACnB,mEAAmE;IACnE,QAAQ,CAAC,MAAM,EAAE,SAAS,CAAC;IAC3B,sFAAsF;IACtF,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC;IACvB,mFAAmF;IACnF,QAAQ,CAAC,IAAI,EAAE,OAAO,CAAC,iBAAiB,CAAC,CAAC;IAM1C,+FAA+F;IAC/F,QAAQ,CAAC,QAAQ,EAAE,QAAQ,GAAG,IAAI,CAAC;IA0CnC,OAAO,CAAC,YAAY,CAA0C;IAC9D,OAAO,CAAC,SAAS,CAAiC;IAClD,OAAO,CAAC,QAAQ,CAAC,IAAI,CAA0B;IAC/C,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAa;IAC3C,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAgD;IAC9E,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAsB;IAChD,OAAO,CAAC,YAAY,CAAK;IAEzB;;;OAGG;IACH,OAAO;IAuBP;;;;;;OAMG;WACU,KAAK,CAAC,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,WAAW,CAAC;IA+B/D;;;;;;;OAOG;WACU,MAAM,CAAC,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,UAAU,CAAC;IA2CpE;;;;;;OAMG;IACH,MAAM,CAAC,IAAI,CAAC,MAAM,EAAE,SAAS,EAAE,IAAI,CAAC,EAAE,OAAO,CAAC,OAAO,CAAC,GAAG,UAAU;IAcnE;;;OAGG;IACH,IAAI,KAAK,IAAI,OAAO,GAAG,MAAM,GAAG,UAAU,CAEzC;IAkED;;;;OAIG;IACH,OAAO,CAAC,QAAQ,EAAE,aAAa,GAAG,IAAI;IAQtC;;;OAGG;IACH,OAAO,IAAI,IAAI;IAqBf;;;;;OAKG;IACH,OAAO,CAAC,UAAU;CAerB"}
|
|
@@ -0,0 +1,304 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GpuContext (spec 2.2, 2.8, 3.3, 5.7; contract 3.5): one device, its caps and the singletons built on it --
|
|
3
|
+
* the composition root of D26. probe() never creates a device; create() runs the six steps of spec 2.2 in
|
|
4
|
+
* order; from() adopts a device the caller owns. Step 5 (the uncapturederror sink and the device.lost
|
|
5
|
+
* watcher) and step 6 (the AllocationTracker, GraphResidency, BufferPool, Readback and PipelineCache) run
|
|
6
|
+
* in the private constructor. The Profiler is constructed when "timestamp-query" is on the device (contract
|
|
7
|
+
* 3.5; P2-T1) with `quantised` = runtime !== "node" (Dawn-node is the only runtime whose ticks are known
|
|
8
|
+
* unquantised, spec 2.6). This file never imports ./kernels.js or ./wgsl/**.
|
|
9
|
+
*/
|
|
10
|
+
import { DEFAULT_WARN_UNRELEASED_SNAPSHOTS } from "./constants.js";
|
|
11
|
+
import { buildRequiredFeatures, buildRequiredLimits, requestAdapter, requestDevice, summarizeAdapter, } from "./device/acquire.js";
|
|
12
|
+
import { assertPlanLimits, capsFromDevice, captureCaps, workgroupSizeFor } from "./device/caps.js";
|
|
13
|
+
import { AllocationTracker } from "./device/error-scope.js";
|
|
14
|
+
import { deviceLostError, installUncapturedErrorSink, PendingErrorSlot, watchDeviceLost } from "./device/lost.js";
|
|
15
|
+
import { isWebGpuGraphError, WebGpuGraphError } from "./errors.js";
|
|
16
|
+
import { PipelineCache } from "./kernel/pipeline-cache.js";
|
|
17
|
+
import { Profiler } from "./kernel/profiler.js";
|
|
18
|
+
import { BufferPool } from "./memory/buffer-pool.js";
|
|
19
|
+
import { Readback } from "./memory/readback.js";
|
|
20
|
+
import { GraphResidency } from "./memory/residency.js";
|
|
21
|
+
/** The label a context and its device carry when create() is given none. */
|
|
22
|
+
const DEFAULT_LABEL = "webgpu-graph-algorithms";
|
|
23
|
+
/** The optionalFeatures default of spec 2.2. */
|
|
24
|
+
const DEFAULT_OPTIONAL_FEATURES = Object.freeze(["subgroups", "timestamp-query"]);
|
|
25
|
+
/** The powerPreference default of spec 2.2 (Chrome 145 needs it; Dawn-node ignores it). */
|
|
26
|
+
const DEFAULT_POWER_PREFERENCE = "high-performance";
|
|
27
|
+
/**
|
|
28
|
+
* Step 1 of create(): the caller's UNUSED adapter, else one requested from `gpu`; neither -> E_NO_WEBGPU.
|
|
29
|
+
* @param options - the create options
|
|
30
|
+
* @returns an adapter no device was requested from
|
|
31
|
+
*/
|
|
32
|
+
async function adapterOf(options) {
|
|
33
|
+
if (options.adapter !== undefined) {
|
|
34
|
+
return options.adapter;
|
|
35
|
+
}
|
|
36
|
+
if (options.gpu !== undefined) {
|
|
37
|
+
return requestAdapter(options.gpu, options.powerPreference ?? DEFAULT_POWER_PREFERENCE);
|
|
38
|
+
}
|
|
39
|
+
throw new WebGpuGraphError("E_NO_WEBGPU", "GpuContext.create needs one of gpu, adapter or device", {
|
|
40
|
+
reason: "no gpu, adapter or device given",
|
|
41
|
+
hint: "pass navigator.gpu (browser) or the gpu of createNodeGpu() (Node), or use the ./browser and ./node entries",
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
/** One device, its caps and the singletons built on it (spec 3.3; the composition root of D26). */
|
|
45
|
+
export class GpuContext {
|
|
46
|
+
/**
|
|
47
|
+
* Steps 5 and 6 of create() (spec 2.2): the sink, the loss watcher and the singletons.
|
|
48
|
+
* @param init - the device, its caps and the create-time choices
|
|
49
|
+
*/
|
|
50
|
+
constructor(init) {
|
|
51
|
+
this.currentState = "ready";
|
|
52
|
+
this.lostError = null;
|
|
53
|
+
this.slot = new PendingErrorSlot();
|
|
54
|
+
this.lostListeners = new Set();
|
|
55
|
+
this.disposers = [];
|
|
56
|
+
this.batchCounter = 0;
|
|
57
|
+
this.device = init.device;
|
|
58
|
+
this.caps = init.caps;
|
|
59
|
+
this.ownsDevice = init.ownsDevice;
|
|
60
|
+
this.label = init.label;
|
|
61
|
+
this.debug = { inspect: false };
|
|
62
|
+
this.workgroupSize = workgroupSizeFor(init.caps);
|
|
63
|
+
this.allocator = new AllocationTracker(init.device);
|
|
64
|
+
this.residency = new GraphResidency(init.device, init.caps, this.allocator, {
|
|
65
|
+
warnUnreleasedSnapshots: init.warnUnreleasedSnapshots,
|
|
66
|
+
});
|
|
67
|
+
this.pool = new BufferPool(init.device, this.allocator, init.caps.limits.maxBufferSize);
|
|
68
|
+
this.readback = new Readback(init.device, this.allocator);
|
|
69
|
+
this.pipelines = new PipelineCache(init.device, init.caps);
|
|
70
|
+
this.profiler = init.device.features.has("timestamp-query")
|
|
71
|
+
? new Profiler(init.device, true, init.caps.runtime !== "node")
|
|
72
|
+
: null;
|
|
73
|
+
this.uninstallSink = installUncapturedErrorSink(init.device, this.slot, init.onError);
|
|
74
|
+
this.lost = watchDeviceLost(init.device, (info) => {
|
|
75
|
+
this.handleLost(info);
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Probe without creating a device (spec 2.2); never throws. `gpu === undefined` -> E_NO_WEBGPU;
|
|
80
|
+
* requestAdapter() null or a throw -> E_NO_ADAPTER; `rejectSoftware && software` -> E_SOFTWARE_ONLY (the
|
|
81
|
+
* adapter and its summary are still reported); else OK with the UNUSED adapter and its summary.
|
|
82
|
+
* @param options - the GPU object, the power preference and the software policy
|
|
83
|
+
* @returns the probe result
|
|
84
|
+
*/
|
|
85
|
+
static async probe(options) {
|
|
86
|
+
const { gpu } = options;
|
|
87
|
+
if (gpu === undefined) {
|
|
88
|
+
return {
|
|
89
|
+
ok: false,
|
|
90
|
+
code: "E_NO_WEBGPU",
|
|
91
|
+
reason: "no GPU object: navigator.gpu is undefined (no WebGPU in this runtime)",
|
|
92
|
+
adapter: null,
|
|
93
|
+
summary: null,
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
let adapter;
|
|
97
|
+
try {
|
|
98
|
+
adapter = await requestAdapter(gpu, options.powerPreference ?? DEFAULT_POWER_PREFERENCE);
|
|
99
|
+
}
|
|
100
|
+
catch (err) {
|
|
101
|
+
const reason = isWebGpuGraphError(err) ? err.message : String(err);
|
|
102
|
+
return { ok: false, code: "E_NO_ADAPTER", reason, adapter: null, summary: null };
|
|
103
|
+
}
|
|
104
|
+
const summary = summarizeAdapter(adapter);
|
|
105
|
+
if (options.rejectSoftware === true && summary.software) {
|
|
106
|
+
return {
|
|
107
|
+
ok: false,
|
|
108
|
+
code: "E_SOFTWARE_ONLY",
|
|
109
|
+
reason: `software adapter rejected: ${summary.vendor}/${summary.architecture}`,
|
|
110
|
+
adapter,
|
|
111
|
+
summary,
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
return { ok: true, code: "OK", reason: null, adapter, summary };
|
|
115
|
+
}
|
|
116
|
+
/**
|
|
117
|
+
* The six-step acquisition of spec 2.2: adopt `device`, else take `adapter`, else request one from `gpu`
|
|
118
|
+
* (step 1); the software test (step 2); the limits / features and requestDevice (step 3); the caps from
|
|
119
|
+
* device.limits plus assertPlanLimits (step 4); the sink, the loss watcher and the singletons (steps 5-6,
|
|
120
|
+
* in the constructor).
|
|
121
|
+
* @param options - see GpuContextOptions
|
|
122
|
+
* @returns the context
|
|
123
|
+
*/
|
|
124
|
+
static async create(options) {
|
|
125
|
+
const runtime = options.runtime ?? "unknown";
|
|
126
|
+
const label = options.label ?? DEFAULT_LABEL;
|
|
127
|
+
const onError = options.onError ?? null;
|
|
128
|
+
const warnUnreleasedSnapshots = options.warnUnreleasedSnapshots ?? DEFAULT_WARN_UNRELEASED_SNAPSHOTS;
|
|
129
|
+
if (options.device !== undefined) {
|
|
130
|
+
const adopted = capsFromDevice(options.device, { runtime });
|
|
131
|
+
assertPlanLimits(adopted);
|
|
132
|
+
return new GpuContext({
|
|
133
|
+
device: options.device,
|
|
134
|
+
caps: adopted,
|
|
135
|
+
ownsDevice: false,
|
|
136
|
+
label,
|
|
137
|
+
onError,
|
|
138
|
+
warnUnreleasedSnapshots,
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
const adapter = await adapterOf(options);
|
|
142
|
+
const summary = summarizeAdapter(adapter);
|
|
143
|
+
if (options.rejectSoftware === true && summary.software) {
|
|
144
|
+
throw new WebGpuGraphError("E_SOFTWARE_ONLY", `software adapter rejected by rejectSoftware: ${summary.vendor}/${summary.architecture}`, { adapter: summary });
|
|
145
|
+
}
|
|
146
|
+
const requiredLimits = buildRequiredLimits(adapter, options.limits ?? "raise");
|
|
147
|
+
const requiredFeatures = buildRequiredFeatures(adapter, options.requiredFeatures ?? [], options.optionalFeatures ?? DEFAULT_OPTIONAL_FEATURES);
|
|
148
|
+
const device = await requestDevice(adapter, { label, requiredLimits, requiredFeatures });
|
|
149
|
+
const caps = captureCaps(device, adapter.info, runtime, options.gpu?.wgslLanguageFeatures ?? []);
|
|
150
|
+
try {
|
|
151
|
+
assertPlanLimits(caps);
|
|
152
|
+
}
|
|
153
|
+
catch (err) {
|
|
154
|
+
device.destroy();
|
|
155
|
+
throw err;
|
|
156
|
+
}
|
|
157
|
+
return new GpuContext({ device, caps, ownsDevice: true, label, onError, warnUnreleasedSnapshots });
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* Zero-cost adoption of a device the caller owns (ownsDevice false, runtime "unknown" unless info says
|
|
161
|
+
* otherwise). The context is labelled with the device's label, or "GpuContext.from" when it has none.
|
|
162
|
+
* @param device - the device to adopt
|
|
163
|
+
* @param info - what the caller knows about the adapter, if anything
|
|
164
|
+
* @returns the context
|
|
165
|
+
*/
|
|
166
|
+
static from(device, info) {
|
|
167
|
+
const caps = capsFromDevice(device, info);
|
|
168
|
+
assertPlanLimits(caps);
|
|
169
|
+
const deviceLabel = device.label ?? "";
|
|
170
|
+
return new GpuContext({
|
|
171
|
+
device,
|
|
172
|
+
caps,
|
|
173
|
+
ownsDevice: false,
|
|
174
|
+
label: deviceLabel === "" ? "GpuContext.from" : deviceLabel,
|
|
175
|
+
onError: null,
|
|
176
|
+
warnUnreleasedSnapshots: DEFAULT_WARN_UNRELEASED_SNAPSHOTS,
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
/**
|
|
180
|
+
* "ready" | "lost" | "disposed".
|
|
181
|
+
* @returns the lifecycle state
|
|
182
|
+
*/
|
|
183
|
+
get state() {
|
|
184
|
+
return this.currentState;
|
|
185
|
+
}
|
|
186
|
+
/**
|
|
187
|
+
* Throws E_DEVICE_LOST / E_DISPOSED by state and rethrows a pending uncaptured error (spec 5.7: "thrown
|
|
188
|
+
* from the next public call").
|
|
189
|
+
* @internal
|
|
190
|
+
*/
|
|
191
|
+
assertReady() {
|
|
192
|
+
if (this.currentState === "disposed") {
|
|
193
|
+
throw new WebGpuGraphError("E_DISPOSED", `GpuContext "${this.label}" is disposed`, { label: this.label });
|
|
194
|
+
}
|
|
195
|
+
if (this.lostError !== null) {
|
|
196
|
+
throw this.lostError;
|
|
197
|
+
}
|
|
198
|
+
const pending = this.slot.take();
|
|
199
|
+
if (pending !== null) {
|
|
200
|
+
throw pending;
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
/**
|
|
204
|
+
* Takes the pending uncaptured error (used by CommandBatch right after submit).
|
|
205
|
+
* @internal
|
|
206
|
+
* @returns the error, or null
|
|
207
|
+
*/
|
|
208
|
+
takePendingError() {
|
|
209
|
+
return this.slot.take();
|
|
210
|
+
}
|
|
211
|
+
/**
|
|
212
|
+
* Monotonically increasing batch ids, starting at 1.
|
|
213
|
+
* @internal
|
|
214
|
+
* @returns the next id
|
|
215
|
+
*/
|
|
216
|
+
nextBatchId() {
|
|
217
|
+
this.batchCounter += 1;
|
|
218
|
+
return this.batchCounter;
|
|
219
|
+
}
|
|
220
|
+
/**
|
|
221
|
+
* Registers a device-loss listener (simulations enter "disposed"); returns the unregister function.
|
|
222
|
+
* @internal
|
|
223
|
+
* @param listener - called once with the lost info
|
|
224
|
+
* @returns removes the listener
|
|
225
|
+
*/
|
|
226
|
+
onLost(listener) {
|
|
227
|
+
this.lostListeners.add(listener);
|
|
228
|
+
return () => {
|
|
229
|
+
this.lostListeners.delete(listener);
|
|
230
|
+
};
|
|
231
|
+
}
|
|
232
|
+
/**
|
|
233
|
+
* A disposer run by dispose() (the Node entry attaches the GPU handle's dispose); attached after
|
|
234
|
+
* dispose() it runs immediately.
|
|
235
|
+
* @internal
|
|
236
|
+
* @param dispose - the disposer
|
|
237
|
+
*/
|
|
238
|
+
attachDisposer(dispose) {
|
|
239
|
+
if (this.currentState === "disposed") {
|
|
240
|
+
dispose();
|
|
241
|
+
return;
|
|
242
|
+
}
|
|
243
|
+
this.disposers.push(dispose);
|
|
244
|
+
}
|
|
245
|
+
/**
|
|
246
|
+
* Destroys every buffer recorded for the snapshot (spec 4.5), then `pool.trim()` (spec 4.4: idle scratch
|
|
247
|
+
* goes with the graph); idempotent; safe on a snapshot never uploaded; a no-op after dispose().
|
|
248
|
+
* @param snapshot - the snapshot whose buffers are released
|
|
249
|
+
*/
|
|
250
|
+
release(snapshot) {
|
|
251
|
+
if (this.currentState === "disposed") {
|
|
252
|
+
return;
|
|
253
|
+
}
|
|
254
|
+
this.residency.release(snapshot);
|
|
255
|
+
this.pool.trim();
|
|
256
|
+
}
|
|
257
|
+
/**
|
|
258
|
+
* Rejects pending work with E_DISPOSED (every later public call), destroys residency, pool and staging
|
|
259
|
+
* ring, destroys the device when owned, runs attached disposers; idempotent (spec 2.8).
|
|
260
|
+
*/
|
|
261
|
+
dispose() {
|
|
262
|
+
if (this.currentState === "disposed") {
|
|
263
|
+
return;
|
|
264
|
+
}
|
|
265
|
+
this.currentState = "disposed";
|
|
266
|
+
this.uninstallSink();
|
|
267
|
+
this.residency.destroyAll();
|
|
268
|
+
this.pool.destroyAll();
|
|
269
|
+
this.readback.destroyAll();
|
|
270
|
+
if (this.profiler !== null) {
|
|
271
|
+
this.profiler.destroy();
|
|
272
|
+
}
|
|
273
|
+
if (this.ownsDevice) {
|
|
274
|
+
this.device.destroy();
|
|
275
|
+
}
|
|
276
|
+
const disposers = this.disposers.splice(0);
|
|
277
|
+
for (const dispose of disposers) {
|
|
278
|
+
dispose();
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
/**
|
|
282
|
+
* Step 5 of spec 2.2 on loss: state "lost", the residency cleared without destroying (the buffers are
|
|
283
|
+
* gone with the device), every registered listener run once; a loss reported after dispose() (the owned
|
|
284
|
+
* device was destroyed by dispose) changes nothing.
|
|
285
|
+
* @param info - the device.lost result
|
|
286
|
+
*/
|
|
287
|
+
handleLost(info) {
|
|
288
|
+
if (this.currentState === "disposed") {
|
|
289
|
+
return;
|
|
290
|
+
}
|
|
291
|
+
this.currentState = "lost";
|
|
292
|
+
this.lostError = deviceLostError(info);
|
|
293
|
+
this.residency.clearOnLoss();
|
|
294
|
+
for (const listener of Array.from(this.lostListeners)) {
|
|
295
|
+
try {
|
|
296
|
+
listener(info);
|
|
297
|
+
}
|
|
298
|
+
catch {
|
|
299
|
+
// a throwing listener must not stop the fan-out; the others still learn of the loss
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
//# sourceMappingURL=context.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"context.js","sourceRoot":"","sources":["../../src/context.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH,OAAO,EAAE,iCAAiC,EAAE,MAAM,gBAAgB,CAAC;AAC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