@graphty/webgpu-graph-algorithms 0.5.0 → 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +104 -52
- package/dist/browser.js +1 -1
- package/dist/chunks/{context-CRbw2Wyo.js → context-BXqgCifx.js} +225 -33
- package/dist/chunks/context-BXqgCifx.js.map +1 -0
- package/dist/node.js +1 -1
- package/dist/src/accelerator.d.ts +12 -10
- package/dist/src/accelerator.d.ts.map +1 -1
- package/dist/src/accelerator.js +32 -10
- package/dist/src/accelerator.js.map +1 -1
- package/dist/src/algorithms/components.d.ts.map +1 -1
- package/dist/src/algorithms/components.js +12 -13
- package/dist/src/algorithms/components.js.map +1 -1
- package/dist/src/algorithms/degree.d.ts +6 -8
- package/dist/src/algorithms/degree.d.ts.map +1 -1
- package/dist/src/algorithms/degree.js +58 -35
- package/dist/src/algorithms/degree.js.map +1 -1
- package/dist/src/algorithms/pagerank.d.ts.map +1 -1
- package/dist/src/algorithms/pagerank.js +16 -14
- package/dist/src/algorithms/pagerank.js.map +1 -1
- package/dist/src/algorithms/power-iteration.d.ts +2 -2
- package/dist/src/algorithms/power-iteration.d.ts.map +1 -1
- package/dist/src/algorithms/power-iteration.js +17 -14
- package/dist/src/algorithms/power-iteration.js.map +1 -1
- package/dist/src/constants.d.ts +85 -8
- package/dist/src/constants.d.ts.map +1 -1
- package/dist/src/constants.js +85 -8
- package/dist/src/constants.js.map +1 -1
- package/dist/src/errors.d.ts +3 -2
- package/dist/src/errors.d.ts.map +1 -1
- package/dist/src/errors.js +2 -1
- package/dist/src/errors.js.map +1 -1
- package/dist/src/index.d.ts +10 -5
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/index.js +14 -5
- package/dist/src/index.js.map +1 -1
- package/dist/src/kernel/dispatch.d.ts +8 -3
- package/dist/src/kernel/dispatch.d.ts.map +1 -1
- package/dist/src/kernel/dispatch.js +18 -7
- package/dist/src/kernel/dispatch.js.map +1 -1
- package/dist/src/kernel/kernel.d.ts +30 -1
- package/dist/src/kernel/kernel.d.ts.map +1 -1
- package/dist/src/kernel/kernel.js +49 -5
- package/dist/src/kernel/kernel.js.map +1 -1
- package/dist/src/kernel/prelude.d.ts.map +1 -1
- package/dist/src/kernel/prelude.js +9 -1
- package/dist/src/kernel/prelude.js.map +1 -1
- package/dist/src/kernel/profiler.d.ts +15 -3
- package/dist/src/kernel/profiler.d.ts.map +1 -1
- package/dist/src/kernel/profiler.js +27 -4
- package/dist/src/kernel/profiler.js.map +1 -1
- package/dist/src/kernels.d.ts +18 -8
- package/dist/src/kernels.d.ts.map +1 -1
- package/dist/src/kernels.js +345 -22
- package/dist/src/kernels.js.map +1 -1
- package/dist/src/layouts/calibrate.d.ts +51 -0
- package/dist/src/layouts/calibrate.d.ts.map +1 -0
- package/dist/src/layouts/calibrate.js +172 -0
- package/dist/src/layouts/calibrate.js.map +1 -0
- package/dist/src/layouts/force-simulation.d.ts +42 -5
- package/dist/src/layouts/force-simulation.d.ts.map +1 -1
- package/dist/src/layouts/force-simulation.js +84 -22
- package/dist/src/layouts/force-simulation.js.map +1 -1
- package/dist/src/layouts/forceatlas2.d.ts +107 -38
- package/dist/src/layouts/forceatlas2.d.ts.map +1 -1
- package/dist/src/layouts/forceatlas2.js +297 -290
- package/dist/src/layouts/forceatlas2.js.map +1 -1
- package/dist/src/layouts/fruchterman-reingold.d.ts +241 -0
- package/dist/src/layouts/fruchterman-reingold.d.ts.map +1 -0
- package/dist/src/layouts/fruchterman-reingold.js +739 -0
- package/dist/src/layouts/fruchterman-reingold.js.map +1 -0
- package/dist/src/layouts/model-common.d.ts +140 -0
- package/dist/src/layouts/model-common.d.ts.map +1 -0
- package/dist/src/layouts/model-common.js +269 -0
- package/dist/src/layouts/model-common.js.map +1 -0
- package/dist/src/layouts/repulsion-grid.d.ts +152 -0
- package/dist/src/layouts/repulsion-grid.d.ts.map +1 -0
- package/dist/src/layouts/repulsion-grid.js +318 -0
- package/dist/src/layouts/repulsion-grid.js.map +1 -0
- package/dist/src/layouts/spring-electrical.d.ts +224 -0
- package/dist/src/layouts/spring-electrical.d.ts.map +1 -0
- package/dist/src/layouts/spring-electrical.js +665 -0
- package/dist/src/layouts/spring-electrical.js.map +1 -0
- package/dist/src/memory/residency.d.ts +6 -2
- package/dist/src/memory/residency.d.ts.map +1 -1
- package/dist/src/memory/residency.js +84 -14
- package/dist/src/memory/residency.js.map +1 -1
- package/dist/src/primitives/core-shape.d.ts +38 -2
- package/dist/src/primitives/core-shape.d.ts.map +1 -1
- package/dist/src/primitives/core-shape.js +71 -3
- package/dist/src/primitives/core-shape.js.map +1 -1
- package/dist/src/primitives/grid-pyramid.d.ts +71 -0
- package/dist/src/primitives/grid-pyramid.d.ts.map +1 -0
- package/dist/src/primitives/grid-pyramid.js +143 -0
- package/dist/src/primitives/grid-pyramid.js.map +1 -0
- package/dist/src/primitives/grid.d.ts +118 -0
- package/dist/src/primitives/grid.d.ts.map +1 -0
- package/dist/src/primitives/grid.js +225 -0
- package/dist/src/primitives/grid.js.map +1 -0
- package/dist/src/primitives/histogram.d.ts +67 -0
- package/dist/src/primitives/histogram.d.ts.map +1 -0
- package/dist/src/primitives/histogram.js +190 -0
- package/dist/src/primitives/histogram.js.map +1 -0
- package/dist/src/primitives/radix-sort.d.ts +75 -0
- package/dist/src/primitives/radix-sort.d.ts.map +1 -0
- package/dist/src/primitives/radix-sort.js +168 -0
- package/dist/src/primitives/radix-sort.js.map +1 -0
- package/dist/src/primitives/scan.d.ts +44 -0
- package/dist/src/primitives/scan.d.ts.map +1 -0
- package/dist/src/primitives/scan.js +151 -0
- package/dist/src/primitives/scan.js.map +1 -0
- package/dist/src/primitives/segmented-reduce.d.ts +25 -17
- package/dist/src/primitives/segmented-reduce.d.ts.map +1 -1
- package/dist/src/primitives/segmented-reduce.js +166 -47
- package/dist/src/primitives/segmented-reduce.js.map +1 -1
- package/dist/src/primitives/spmv.d.ts +18 -14
- package/dist/src/primitives/spmv.d.ts.map +1 -1
- package/dist/src/primitives/spmv.js +94 -58
- package/dist/src/primitives/spmv.js.map +1 -1
- package/dist/src/primitives/verify.d.ts +49 -0
- package/dist/src/primitives/verify.d.ts.map +1 -0
- package/dist/src/primitives/verify.js +229 -0
- package/dist/src/primitives/verify.js.map +1 -0
- package/dist/src/types/accelerator.d.ts +7 -3
- package/dist/src/types/accelerator.d.ts.map +1 -1
- package/dist/src/types/context.d.ts +53 -0
- package/dist/src/types/context.d.ts.map +1 -1
- package/dist/src/types/layout.d.ts +52 -0
- package/dist/src/types/layout.d.ts.map +1 -1
- package/dist/src/types/options.d.ts +43 -1
- package/dist/src/types/options.d.ts.map +1 -1
- package/dist/src/wgsl/counting-scatter.wgsl.d.ts +8 -0
- package/dist/src/wgsl/counting-scatter.wgsl.d.ts.map +1 -0
- package/dist/src/wgsl/counting-scatter.wgsl.js +17 -0
- package/dist/src/wgsl/counting-scatter.wgsl.js.map +1 -0
- package/dist/src/wgsl/fa2-attraction.wgsl.d.ts +23 -8
- package/dist/src/wgsl/fa2-attraction.wgsl.d.ts.map +1 -1
- package/dist/src/wgsl/fa2-attraction.wgsl.js +100 -17
- package/dist/src/wgsl/fa2-attraction.wgsl.js.map +1 -1
- package/dist/src/wgsl/fa2-integrate.wgsl.d.ts +7 -2
- package/dist/src/wgsl/fa2-integrate.wgsl.d.ts.map +1 -1
- package/dist/src/wgsl/fa2-integrate.wgsl.js +28 -2
- package/dist/src/wgsl/fa2-integrate.wgsl.js.map +1 -1
- package/dist/src/wgsl/fa2-repulsion-exact.wgsl.d.ts +4 -2
- package/dist/src/wgsl/fa2-repulsion-exact.wgsl.d.ts.map +1 -1
- package/dist/src/wgsl/fa2-repulsion-exact.wgsl.js +14 -5
- package/dist/src/wgsl/fa2-repulsion-exact.wgsl.js.map +1 -1
- package/dist/src/wgsl/fa2-stats-finalize.wgsl.d.ts +12 -1
- package/dist/src/wgsl/fa2-stats-finalize.wgsl.d.ts.map +1 -1
- package/dist/src/wgsl/fa2-stats-finalize.wgsl.js +54 -0
- package/dist/src/wgsl/fa2-stats-finalize.wgsl.js.map +1 -1
- package/dist/src/wgsl/grid-cell-key.wgsl.d.ts +8 -0
- package/dist/src/wgsl/grid-cell-key.wgsl.d.ts.map +1 -0
- package/dist/src/wgsl/grid-cell-key.wgsl.js +30 -0
- package/dist/src/wgsl/grid-cell-key.wgsl.js.map +1 -0
- package/dist/src/wgsl/grid-centroid-hub.wgsl.d.ts +8 -0
- package/dist/src/wgsl/grid-centroid-hub.wgsl.d.ts.map +1 -0
- package/dist/src/wgsl/grid-centroid-hub.wgsl.js +29 -0
- package/dist/src/wgsl/grid-centroid-hub.wgsl.js.map +1 -0
- package/dist/src/wgsl/grid-centroid.wgsl.d.ts +8 -0
- package/dist/src/wgsl/grid-centroid.wgsl.d.ts.map +1 -0
- package/dist/src/wgsl/grid-centroid.wgsl.js +29 -0
- package/dist/src/wgsl/grid-centroid.wgsl.js.map +1 -0
- package/dist/src/wgsl/grid-downsample.wgsl.d.ts +7 -0
- package/dist/src/wgsl/grid-downsample.wgsl.d.ts.map +1 -0
- package/dist/src/wgsl/grid-downsample.wgsl.js +28 -0
- package/dist/src/wgsl/grid-downsample.wgsl.js.map +1 -0
- package/dist/src/wgsl/grid-far-field.wgsl.d.ts +13 -0
- package/dist/src/wgsl/grid-far-field.wgsl.d.ts.map +1 -0
- package/dist/src/wgsl/grid-far-field.wgsl.js +98 -0
- package/dist/src/wgsl/grid-far-field.wgsl.js.map +1 -0
- package/dist/src/wgsl/grid-near-field.wgsl.d.ts +19 -0
- package/dist/src/wgsl/grid-near-field.wgsl.d.ts.map +1 -0
- package/dist/src/wgsl/grid-near-field.wgsl.js +129 -0
- package/dist/src/wgsl/grid-near-field.wgsl.js.map +1 -0
- package/dist/src/wgsl/histogram.wgsl.d.ts +7 -0
- package/dist/src/wgsl/histogram.wgsl.d.ts.map +1 -0
- package/dist/src/wgsl/histogram.wgsl.js +15 -0
- package/dist/src/wgsl/histogram.wgsl.js.map +1 -0
- package/dist/src/wgsl/indirect-finalize.wgsl.d.ts +8 -0
- package/dist/src/wgsl/indirect-finalize.wgsl.d.ts.map +1 -0
- package/dist/src/wgsl/indirect-finalize.wgsl.js +26 -0
- package/dist/src/wgsl/indirect-finalize.wgsl.js.map +1 -0
- package/dist/src/wgsl/radix-hist.wgsl.d.ts +9 -0
- package/dist/src/wgsl/radix-hist.wgsl.d.ts.map +1 -0
- package/dist/src/wgsl/radix-hist.wgsl.js +31 -0
- package/dist/src/wgsl/radix-hist.wgsl.js.map +1 -0
- package/dist/src/wgsl/radix-scatter.wgsl.d.ts +9 -0
- package/dist/src/wgsl/radix-scatter.wgsl.d.ts.map +1 -0
- package/dist/src/wgsl/radix-scatter.wgsl.js +40 -0
- package/dist/src/wgsl/radix-scatter.wgsl.js.map +1 -0
- package/dist/src/wgsl/scan-add.wgsl.d.ts +6 -0
- package/dist/src/wgsl/scan-add.wgsl.d.ts.map +1 -0
- package/dist/src/wgsl/scan-add.wgsl.js +14 -0
- package/dist/src/wgsl/scan-add.wgsl.js.map +1 -0
- package/dist/src/wgsl/scan-block.wgsl.d.ts +8 -0
- package/dist/src/wgsl/scan-block.wgsl.d.ts.map +1 -0
- package/dist/src/wgsl/scan-block.wgsl.js +30 -0
- package/dist/src/wgsl/scan-block.wgsl.js.map +1 -0
- package/dist/src/wgsl/segmented-reduce.wgsl.d.ts +22 -8
- package/dist/src/wgsl/segmented-reduce.wgsl.d.ts.map +1 -1
- package/dist/src/wgsl/segmented-reduce.wgsl.js +84 -15
- package/dist/src/wgsl/segmented-reduce.wgsl.js.map +1 -1
- package/dist/src/wgsl/spmv-pull.wgsl.d.ts +22 -11
- package/dist/src/wgsl/spmv-pull.wgsl.d.ts.map +1 -1
- package/dist/src/wgsl/spmv-pull.wgsl.js +110 -36
- package/dist/src/wgsl/spmv-pull.wgsl.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/dist/webgpu-graph-algorithms.js +5016 -1130
- package/dist/webgpu-graph-algorithms.js.map +1 -1
- package/package.json +10 -7
- package/src/accelerator.ts +46 -12
- package/src/algorithms/components.ts +12 -16
- package/src/algorithms/degree.ts +58 -43
- package/src/algorithms/pagerank.ts +20 -18
- package/src/algorithms/power-iteration.ts +19 -18
- package/src/constants.ts +108 -8
- package/src/errors.ts +3 -1
- package/src/index.ts +25 -5
- package/src/kernel/dispatch.ts +18 -7
- package/src/kernel/kernel.ts +59 -5
- package/src/kernel/prelude.ts +15 -0
- package/src/kernel/profiler.ts +28 -4
- package/src/kernels.ts +378 -24
- package/src/layouts/calibrate.ts +187 -0
- package/src/layouts/force-simulation.ts +111 -26
- package/src/layouts/forceatlas2.ts +346 -324
- package/src/layouts/fruchterman-reingold.ts +918 -0
- package/src/layouts/model-common.ts +323 -0
- package/src/layouts/repulsion-grid.ts +451 -0
- package/src/layouts/spring-electrical.ts +845 -0
- package/src/memory/residency.ts +126 -20
- package/src/primitives/core-shape.ts +91 -4
- package/src/primitives/grid-pyramid.ts +221 -0
- package/src/primitives/grid.ts +349 -0
- package/src/primitives/histogram.ts +273 -0
- package/src/primitives/radix-sort.ts +246 -0
- package/src/primitives/scan.ts +197 -0
- package/src/primitives/segmented-reduce.ts +214 -56
- package/src/primitives/spmv.ts +125 -65
- package/src/primitives/verify.ts +249 -0
- package/src/types/accelerator.ts +15 -3
- package/src/types/context.ts +56 -0
- package/src/types/layout.ts +58 -0
- package/src/types/options.ts +45 -1
- package/src/wgsl/counting-scatter.wgsl.ts +16 -0
- package/src/wgsl/fa2-attraction.wgsl.ts +100 -17
- package/src/wgsl/fa2-integrate.wgsl.ts +28 -2
- package/src/wgsl/fa2-repulsion-exact.wgsl.ts +14 -5
- package/src/wgsl/fa2-stats-finalize.wgsl.ts +54 -0
- package/src/wgsl/grid-cell-key.wgsl.ts +29 -0
- package/src/wgsl/grid-centroid-hub.wgsl.ts +28 -0
- package/src/wgsl/grid-centroid.wgsl.ts +28 -0
- package/src/wgsl/grid-downsample.wgsl.ts +27 -0
- package/src/wgsl/grid-far-field.wgsl.ts +97 -0
- package/src/wgsl/grid-near-field.wgsl.ts +128 -0
- package/src/wgsl/histogram.wgsl.ts +14 -0
- package/src/wgsl/indirect-finalize.wgsl.ts +25 -0
- package/src/wgsl/radix-hist.wgsl.ts +30 -0
- package/src/wgsl/radix-scatter.wgsl.ts +39 -0
- package/src/wgsl/scan-add.wgsl.ts +13 -0
- package/src/wgsl/scan-block.wgsl.ts +29 -0
- package/src/wgsl/segmented-reduce.wgsl.ts +84 -15
- package/src/wgsl/spmv-pull.wgsl.ts +110 -36
- package/dist/chunks/context-CRbw2Wyo.js.map +0 -1
|
@@ -4,25 +4,30 @@
|
|
|
4
4
|
* record (spec 7.2 with the 4.6 NetworkX corrections), the per-iteration Fa2Params values, the controller resets of
|
|
5
5
|
* spec 7.17 and the stats decoder -- plus the two option resolvers and `createForceAtlas2`. Positions are vec4f
|
|
6
6
|
* (xyz + mass) in layout units on the device (D23, 7.18); the speed controller runs on the device (D15); no
|
|
7
|
-
* displacement clamp (D25); K2 runs the
|
|
7
|
+
* displacement clamp (D25); K2 runs the degree tiers over `degreeOrder()` (P4 PD-7).
|
|
8
8
|
*
|
|
9
9
|
* Model decisions this file fixes (the plan of P3-T2 lists the reasons): recordIteration with no `upTo` records every
|
|
10
|
-
* stage including toScene; the K1-K5 dispatches of every iteration of one batch share ONE compute
|
|
11
|
-
* batch's first recordIteration and remembered by batch id) and toScene runs in a second pass
|
|
12
|
-
* 4.4); the fill kernel takes its FillParams from a model-owned 256-byte uniform buffer
|
|
13
|
-
* iteration after every load() zeroes oldForce with a fill (paper mode)
|
|
14
|
-
*
|
|
10
|
+
* stage including toScene; on the exact tier the K1-K5 dispatches of every iteration of one batch share ONE compute
|
|
11
|
+
* pass (opened by the batch's first recordIteration and remembered by batch id) and toScene runs in a second pass
|
|
12
|
+
* that ends it (contract 4.4); the fill kernel takes its FillParams from a model-owned 256-byte uniform buffer
|
|
13
|
+
* ("fillParams"); the first iteration after every load() zeroes oldForce with a fill (paper mode). The grid tier
|
|
14
|
+
* (P4-T10) is reached through `RepulsionGrid` when `tierFor(tuning, n)` says so (PD-18): `buffers()` adds the grid
|
|
15
|
+
* buffers, K1 derives the frame under `gridMax > 0` (PD-14), the iteration is recorded as the three passes `fa2-k1`
|
|
16
|
+
* / `fa2-attraction` / `fa2-grid` before `fa2-to-scene` (PD-16), and `stages` is the union list of both tiers
|
|
17
|
+
* (PD-17: `upTo` stops after the last stage recorded at or before its position).
|
|
15
18
|
*/
|
|
16
19
|
import { type GraphSnapshot } from "@graphty/graph-format";
|
|
17
20
|
import { type GpuContext } from "../context.js";
|
|
18
21
|
import { type CommandBatch } from "../kernel/batch.js";
|
|
19
22
|
import { type UniformBlock, type UniformValues } from "../kernel/struct-block.js";
|
|
20
23
|
import { type WgslModuleSpec } from "../kernel/wgsl.js";
|
|
24
|
+
import { type GridSpec } from "../primitives/grid.js";
|
|
21
25
|
import { type ForceAtlas2Stats, type GpuLayoutSimulation, type GpuLayoutTuning, type ResolvedLayoutTuning } from "../types/layout.js";
|
|
22
26
|
import { type ForceAtlas2Options, type ResolvedForceAtlas2Options } from "../types/options.js";
|
|
23
27
|
import { type BufferSpec, type ForceModel, type ModelInputs, type ModelResources, type StateWriter } from "./force-simulation.js";
|
|
24
|
-
|
|
25
|
-
|
|
28
|
+
import { type Overrides } from "./model-common.js";
|
|
29
|
+
/** The stage names of both tiers in dispatch order plus the per-batch toScene (spec 7.4; contract 3.13; P4 PD-17): the exact tier records K1 K2 K3 K4 K5, the grid tier K1 K2 G1..G7 K4 K5. */
|
|
30
|
+
declare const FA2_STAGES: readonly ["K1", "K2", "K3", "G1", "G2", "G3", "G4", "G5", "G6", "G7", "K4", "K5", "toScene"];
|
|
26
31
|
/**
|
|
27
32
|
* Applies FA2_DEFAULTS to the option record; validates ranges (spec 7.14; contract 3.13). With `previous` the record
|
|
28
33
|
* is a PATCH over it (an absent or explicitly undefined field keeps the previous value) and `maxInFlight` may not
|
|
@@ -34,18 +39,18 @@ type Overrides = Readonly<Record<string, number | boolean>>;
|
|
|
34
39
|
*/
|
|
35
40
|
export declare function resolveForceAtlas2Options(options: ForceAtlas2Options | undefined, previous?: ResolvedForceAtlas2Options): ResolvedForceAtlas2Options;
|
|
36
41
|
/**
|
|
37
|
-
* Applies LAYOUT_TUNING_DEFAULTS (spec 7.14
|
|
38
|
-
*
|
|
42
|
+
* Applies LAYOUT_TUNING_DEFAULTS (spec 7.14; contract 3.3). `nearMax` is an integer >= 2 (P4 DEP-P4-M: the
|
|
43
|
+
* near-field estimator needs at least one sampled entry besides the node itself).
|
|
39
44
|
* @param tuning - the GPU-only knobs given (any object carrying them, e.g. the createForceAtlas2 options)
|
|
40
45
|
* @returns the frozen resolved tuning
|
|
41
46
|
*/
|
|
42
47
|
export declare function resolveLayoutTuning(tuning: GpuLayoutTuning | undefined): ResolvedLayoutTuning;
|
|
43
|
-
/** The ForceAtlas2 model (spec 7.4: K1 K2 K3 K4 K5 per iteration; toScene once per batch). Stages:
|
|
48
|
+
/** The ForceAtlas2 model (spec 7.4: K1 K2 K3 K4 K5 per iteration on the exact tier, K1 K2 G1..G7 K4 K5 on the grid tier; toScene once per batch). Stages: the union list of PD-17. */
|
|
44
49
|
export declare class ForceAtlas2Model implements ForceModel<ForceAtlas2Options, ForceAtlas2Stats> {
|
|
45
50
|
/** The model kind of spec 7.19. */
|
|
46
51
|
readonly kind = "forceatlas2";
|
|
47
52
|
/** The stage names in dispatch order (the `upTo` vocabulary of recordIteration and debugRunStages). */
|
|
48
|
-
readonly stages:
|
|
53
|
+
readonly stages: typeof FA2_STAGES;
|
|
49
54
|
/** Fa2Params: the per-iteration uniform block (the simulation writes the shared fields into it). */
|
|
50
55
|
readonly params: UniformBlock;
|
|
51
56
|
/** Fa2State: the state header block (the simulation allocates and initialises it through this layout). */
|
|
@@ -67,6 +72,8 @@ export declare class ForceAtlas2Model implements ForceModel<ForceAtlas2Options,
|
|
|
67
72
|
private bound;
|
|
68
73
|
/** Armed by onLoad(): the next recordIteration zeroes oldForce first (paper mode). */
|
|
69
74
|
private resetOldForce;
|
|
75
|
+
/** The grid of the load inputs() last resolved (null on the exact tier): onLoad() writes its frame, specs() lists its kernels. */
|
|
76
|
+
private nextGrid;
|
|
70
77
|
/**
|
|
71
78
|
* The K1-K5 compute pass of the batch being recorded, keyed by CommandBatch.id (unique per batch): every
|
|
72
79
|
* recordIteration of one batch dispatches into it (ONE pass per batch, contract 4.4); null between batches and
|
|
@@ -87,17 +94,19 @@ export declare class ForceAtlas2Model implements ForceModel<ForceAtlas2Options,
|
|
|
87
94
|
private get swingMode();
|
|
88
95
|
/**
|
|
89
96
|
* force 12n and oldForce 12n (zeroed) in BOTH swing modes (3.10.1: a writable slot is never aliased; mode 1 leaves
|
|
90
|
-
* oldForce unread and unwritten),
|
|
91
|
-
*
|
|
97
|
+
* oldForce unread and unwritten), the 256-byte FillParams uniform buffer the fill dispatches read, the 16-byte
|
|
98
|
+
* `hubCounters` K1 binds on every tier (P4 PD-14), and the grid buffers of `RepulsionGrid.buffers` exactly when
|
|
99
|
+
* `tierFor(tuning, n)` is the grid tier (PD-18). n = 0 reports one node's worth of bytes so no zero-length buffer
|
|
100
|
+
* is ever created (spec 3.6).
|
|
92
101
|
* @param n - the node count
|
|
93
|
-
* @param
|
|
94
|
-
* @returns the
|
|
102
|
+
* @param dim - the layout dimension (the force arrays are stride 3 in both; the grid's geometry differs)
|
|
103
|
+
* @returns the model-owned buffer specs
|
|
95
104
|
*/
|
|
96
|
-
buffers(n: number,
|
|
105
|
+
buffers(n: number, dim: 2 | 3): readonly BufferSpec[];
|
|
97
106
|
/**
|
|
98
|
-
* { mass: resolveNodeMass(s, resolved.nodeMass), weights: resolveWeights(s, resolved.weight) } (3.13 inputs.ts)
|
|
99
|
-
*
|
|
100
|
-
*
|
|
107
|
+
* { mass: resolveNodeMass(s, resolved.nodeMass), weights: resolveWeights(s, resolved.weight) } (3.13 inputs.ts).
|
|
108
|
+
* Also remembers the grid of this load (`tierFor(tuning, n)`, spec 7.8) for onLoad() and specs(): the simulation
|
|
109
|
+
* calls inputs() first, then onLoad() before bind().
|
|
101
110
|
* @param s - the snapshot being loaded
|
|
102
111
|
* @param options - the simulation's current option record
|
|
103
112
|
* @returns the per-load inputs
|
|
@@ -114,7 +123,9 @@ export declare class ForceAtlas2Model implements ForceModel<ForceAtlas2Options,
|
|
|
114
123
|
overrides(options: ForceAtlas2Options): Overrides;
|
|
115
124
|
/**
|
|
116
125
|
* The seven module specs of an override set in dispatch order -- K1, K2, K3, K4, K5, toScene, fill -- each with
|
|
117
|
-
* only the override names its entry declares (K2 also USE_PERM / HAS_WEIGHTS), for warm() and the compile matrix
|
|
126
|
+
* only the override names its entry declares (K2 also USE_PERM / HAS_WEIGHTS), for warm() and the compile matrix,
|
|
127
|
+
* followed by the grid tier's specs (`RepulsionGrid.specs`) when the load inputs() last resolved is a grid load
|
|
128
|
+
* (the pipeline key carries no geometry, so the spec's size is immaterial).
|
|
118
129
|
* @param overrides - the merged override set (the model's plus USE_PERM / HAS_WEIGHTS)
|
|
119
130
|
* @param _subgroups - accepted for the ForceModel interface and unused: every reducing FA2 body carries
|
|
120
131
|
* needs: ["subgroups"] in its registry entry and the composer picks the twin from caps.features (contract 4.3)
|
|
@@ -122,9 +133,11 @@ export declare class ForceAtlas2Model implements ForceModel<ForceAtlas2Options,
|
|
|
122
133
|
*/
|
|
123
134
|
specs(overrides: Overrides, _subgroups: boolean): readonly WgslModuleSpec[];
|
|
124
135
|
/**
|
|
125
|
-
* Compiles (through the cache) and binds every kernel against the buffers of this load(): K1, K2
|
|
126
|
-
* force when arcCount === 0), K3 + K4 through RepulsionExact, K5,
|
|
127
|
-
* FillParams { count: 3n, value: 0, mode: 0 } into the model's
|
|
136
|
+
* Compiles (through the cache) and binds every kernel against the buffers of this load(): K1, K2 over the degree
|
|
137
|
+
* tiers through bindAttraction (or the fill of force when arcCount === 0), K3 + K4 through RepulsionExact, K5,
|
|
138
|
+
* toScene, and the fill of oldForce; writes the FillParams { count: 3n, value: 0, mode: 0 } into the model's
|
|
139
|
+
* uniform buffer. With n === 0 nothing is bound. The K2 TIER 1 / 2 pipelines compile on the first load whose
|
|
140
|
+
* degrees need them (P4 PD-7), a one-time cost at that load.
|
|
128
141
|
* @param resources - the graph, the shared and model buffers, the ring and the cache
|
|
129
142
|
* @param overrides - the merged override set
|
|
130
143
|
*/
|
|
@@ -138,22 +151,59 @@ export declare class ForceAtlas2Model implements ForceModel<ForceAtlas2Options,
|
|
|
138
151
|
*/
|
|
139
152
|
paramsFor(iteration: number, options: ForceAtlas2Options): UniformValues;
|
|
140
153
|
/**
|
|
141
|
-
* Records one iteration into the batch
|
|
142
|
-
*
|
|
143
|
-
*
|
|
144
|
-
*
|
|
145
|
-
*
|
|
146
|
-
*
|
|
147
|
-
*
|
|
154
|
+
* Records one iteration into the batch, stopping after stage `upTo` when given (spec 7.4; debugRunStages /
|
|
155
|
+
* inspect, spec 11.9 item 2; PD-17: `upTo` names a position in the union list and the recording stops after the
|
|
156
|
+
* last stage recorded at or before it, so "K3" on the grid tier stops after K2 and "G5" on the exact tier after
|
|
157
|
+
* K3). The exact tier: K1, K2 (or the fill of force when arcCount === 0), K3, K4, K5 in the batch's ONE compute
|
|
158
|
+
* pass (opened by the first call of a batch and reused by every later call with the same batch.id, PLAN
|
|
159
|
+
* DECISION 2), then toScene in a second pass that ends it. The grid tier (PD-16): the passes `fa2-k1` (K1),
|
|
160
|
+
* `fa2-attraction` (K2's tiers) and `fa2-grid` (G1-G7, K4, K5) per iteration, then `fa2-to-scene`. The profiler
|
|
161
|
+
* budgets PROFILER_QUERY_SLOTS / 2 = 128 passes per batch, so a grid batch above 42 iterations is timed only in
|
|
162
|
+
* part (the exact tier's two passes per batch always fit): the simulation then reports msPerIteration from the
|
|
163
|
+
* wall time, never from the sum of the timed prefix (`ForceSimulation.batchMilliseconds`). The simulation
|
|
164
|
+
* passes "K5" for iterations 0..k-2 and undefined for the last, so toScene runs once per batch. The first call
|
|
165
|
+
* after load() zeroes oldForce before K1 (paper mode). With n === 0 nothing is recorded (PLAN DECISION 9); a
|
|
166
|
+
* call before bind() completed is E_NOT_LOADED (never a silent no-op).
|
|
148
167
|
* @param batch - the batch being recorded
|
|
149
168
|
* @param slot - the UniformRing slot holding this iteration's Fa2Params
|
|
150
|
-
* @param tier -
|
|
169
|
+
* @param tier - the tier the simulation resolved at load() (the same rule bind() applied, PD-18)
|
|
151
170
|
* @param upTo - a stage name to stop after; undefined records every stage including toScene
|
|
152
171
|
*/
|
|
153
172
|
recordIteration(batch: CommandBatch, slot: number, tier: "exact" | "grid", upTo?: string): void;
|
|
173
|
+
/**
|
|
174
|
+
* The grid tier's iteration (PD-16): three compute passes before toScene.
|
|
175
|
+
* @param batch - the batch being recorded
|
|
176
|
+
* @param bound - the bound model
|
|
177
|
+
* @param offset - the Fa2Params dynamic offset of the iteration
|
|
178
|
+
* @param stop - the FA2_STAGES index to stop after
|
|
179
|
+
*/
|
|
180
|
+
private recordGridIteration;
|
|
181
|
+
/**
|
|
182
|
+
* The oldForce reset of the first iteration after load() (paper mode), then K1 (one workgroup).
|
|
183
|
+
* @param pass - the open compute pass
|
|
184
|
+
* @param bound - the bound model
|
|
185
|
+
* @param offset - the Fa2Params dynamic offset
|
|
186
|
+
*/
|
|
187
|
+
private recordK1;
|
|
188
|
+
/**
|
|
189
|
+
* K2's tier dispatches, or the fill of force when the graph has no arcs (spec 7.5).
|
|
190
|
+
* @param pass - the open compute pass
|
|
191
|
+
* @param bound - the bound model
|
|
192
|
+
* @param offset - the Fa2Params dynamic offset
|
|
193
|
+
*/
|
|
194
|
+
private recordK2;
|
|
195
|
+
/**
|
|
196
|
+
* The toScene pass that ends the iteration's pass; the batch is complete after it, so nothing reuses the pass.
|
|
197
|
+
* @param batch - the batch
|
|
198
|
+
* @param bound - the bound model
|
|
199
|
+
* @param offset - the Fa2Params dynamic offset
|
|
200
|
+
*/
|
|
201
|
+
private recordToScene;
|
|
154
202
|
/**
|
|
155
203
|
* speed = 1, speedEfficiency = 1, swing = 1, traction = 1 (mode 1 accumulates from 1; mode 0 overwrites them each
|
|
156
|
-
* iteration, the initial value is irrelevant); arms the oldForce reset of the next recordIteration.
|
|
204
|
+
* iteration, the initial value is irrelevant); arms the oldForce reset of the next recordIteration. On a grid
|
|
205
|
+
* load the frame of the first build (K1 folds nothing on the first iteration): the same six values K1 derives,
|
|
206
|
+
* in f32 with the kernel's order of operations, from the host-written min / max / centroid / rmsRadius.
|
|
157
207
|
* @param state - the state writer of the simulation
|
|
158
208
|
*/
|
|
159
209
|
onLoad(state: StateWriter): void;
|
|
@@ -174,7 +224,9 @@ export declare class ForceAtlas2Model implements ForceModel<ForceAtlas2Options,
|
|
|
174
224
|
onSetParams(patch: Partial<ForceAtlas2Options>, state: StateWriter): void;
|
|
175
225
|
/**
|
|
176
226
|
* Decodes the state header and the k trace records of a completed batch (k = trace.byteLength / 32) into
|
|
177
|
-
* ForceAtlas2Stats: the
|
|
227
|
+
* ForceAtlas2Stats: `repulsionTier` is the bound tier, the grid fields are the header's on the grid tier
|
|
228
|
+
* (`maxCellOccupancy` / `outsideGrid`: the counts of the iteration before the last K1) and null on the exact
|
|
229
|
+
* tier; msPerIteration null (the simulation owns the clock).
|
|
178
230
|
* @param state - a DataView over the 256-byte state header
|
|
179
231
|
* @param trace - a DataView over the k Fa2Trace records of the batch
|
|
180
232
|
* @returns the stats
|
|
@@ -191,16 +243,33 @@ export declare class ForceAtlas2Model implements ForceModel<ForceAtlas2Options,
|
|
|
191
243
|
* @returns its index
|
|
192
244
|
*/
|
|
193
245
|
private stageIndex;
|
|
246
|
+
/**
|
|
247
|
+
* Releases the grid stage's lease and the bind groups (the simulation calls it from dispose() once every
|
|
248
|
+
* in-flight batch has settled).
|
|
249
|
+
*/
|
|
250
|
+
dispose(): void;
|
|
194
251
|
/**
|
|
195
252
|
* Drops the bind groups of the previous bind() (the buffers changed) so the cached kernels do not accumulate stale
|
|
196
|
-
* groups across reloads; K3 / K4 live inside RepulsionExact and keep the P1-T6 behaviour
|
|
197
|
-
* of a batch recorded before the rebind.
|
|
253
|
+
* groups across reloads; K3 / K4 live inside RepulsionExact and keep the P1-T6 behaviour; the grid stage
|
|
254
|
+
* releases its lease. Also forgets the pass of a batch recorded before the rebind.
|
|
198
255
|
*/
|
|
199
256
|
private dropBound;
|
|
200
257
|
}
|
|
201
258
|
/**
|
|
202
|
-
*
|
|
203
|
-
*
|
|
259
|
+
* The grid frame of the first build after load() (spec 7.7 geometry table; PD-10): K1's text in f32 with the same
|
|
260
|
+
* order of operations -- `box = (max - min) * GRID_BBOX_MARGIN`, `extent = max(min(max(box), extentFactor *
|
|
261
|
+
* rmsRadius), GRID_EXTENT_FLOOR)`, `cellSize = extent / G`, `gridMin = centroid - extent / 2` (cellSize in `.w`),
|
|
262
|
+
* `invCellSize = 1 / cellSize`, `eps = 0.25 cellSize` -- plus zero counts. Shared with the FR and spring-electrical
|
|
263
|
+
* models' onLoad (P4-T13).
|
|
264
|
+
* @param state - the state writer (min / max / centroid / rmsRadius already written by the simulation)
|
|
265
|
+
* @param spec - the grid of the load
|
|
266
|
+
* @param extentFactor - the tuning's extent factor
|
|
267
|
+
*/
|
|
268
|
+
export declare function writeGridFrame(state: StateWriter, spec: GridSpec, extentFactor: number): void;
|
|
269
|
+
/**
|
|
270
|
+
* Spec 3.3 createForceAtlas2, verbatim: a GpuLayoutSimulation running ForceAtlas2 on the exact or the grid repulsion
|
|
271
|
+
* tier (spec 7.8) with the option defaults of spec 7.14 and the GPU-only tuning of GpuLayoutTuning (contract 3.13
|
|
272
|
+
* "Contracts").
|
|
204
273
|
* @param ctx - the context (E_DISPOSED / E_DEVICE_LOST through assertReady)
|
|
205
274
|
* @param options - the ForceAtlas2 options and the GPU-only tuning knobs in one record
|
|
206
275
|
* @returns the simulation in state "created"; load() next
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"forceatlas2.d.ts","sourceRoot":"","sources":["../../../src/layouts/forceatlas2.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