@graphty/webgpu-graph-algorithms 0.0.0 → 0.2.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.
Files changed (269) hide show
  1. package/README.md +344 -23
  2. package/dist/browser.d.ts +1 -0
  3. package/dist/browser.js +32 -0
  4. package/dist/browser.js.map +1 -0
  5. package/dist/chunks/context-E6iKaeuJ.js +3136 -0
  6. package/dist/chunks/context-E6iKaeuJ.js.map +1 -0
  7. package/dist/node.d.ts +1 -0
  8. package/dist/node.js +131 -0
  9. package/dist/node.js.map +1 -0
  10. package/dist/src/accelerator.d.ts +26 -0
  11. package/dist/src/accelerator.d.ts.map +1 -0
  12. package/dist/src/accelerator.js +101 -0
  13. package/dist/src/accelerator.js.map +1 -0
  14. package/dist/src/algorithms/degree.d.ts +35 -0
  15. package/dist/src/algorithms/degree.d.ts.map +1 -0
  16. package/dist/src/algorithms/degree.js +119 -0
  17. package/dist/src/algorithms/degree.js.map +1 -0
  18. package/dist/src/browser/index.d.ts +23 -0
  19. package/dist/src/browser/index.d.ts.map +1 -0
  20. package/dist/src/browser/index.js +48 -0
  21. package/dist/src/browser/index.js.map +1 -0
  22. package/dist/src/constants.d.ts +92 -0
  23. package/dist/src/constants.d.ts.map +1 -0
  24. package/dist/src/constants.js +92 -0
  25. package/dist/src/constants.js.map +1 -0
  26. package/dist/src/context.d.ts +84 -0
  27. package/dist/src/context.d.ts.map +1 -0
  28. package/dist/src/context.js +304 -0
  29. package/dist/src/context.js.map +1 -0
  30. package/dist/src/device/acquire.d.ts +57 -0
  31. package/dist/src/device/acquire.d.ts.map +1 -0
  32. package/dist/src/device/acquire.js +232 -0
  33. package/dist/src/device/acquire.js.map +1 -0
  34. package/dist/src/device/caps.d.ts +43 -0
  35. package/dist/src/device/caps.d.ts.map +1 -0
  36. package/dist/src/device/caps.js +104 -0
  37. package/dist/src/device/caps.js.map +1 -0
  38. package/dist/src/device/error-scope.d.ts +75 -0
  39. package/dist/src/device/error-scope.d.ts.map +1 -0
  40. package/dist/src/device/error-scope.js +152 -0
  41. package/dist/src/device/error-scope.js.map +1 -0
  42. package/dist/src/device/lost.d.ts +51 -0
  43. package/dist/src/device/lost.d.ts.map +1 -0
  44. package/dist/src/device/lost.js +130 -0
  45. package/dist/src/device/lost.js.map +1 -0
  46. package/dist/src/device/webgpu-constants.d.ts +31 -0
  47. package/dist/src/device/webgpu-constants.d.ts.map +1 -0
  48. package/dist/src/device/webgpu-constants.js +31 -0
  49. package/dist/src/device/webgpu-constants.js.map +1 -0
  50. package/dist/src/errors.d.ts +56 -0
  51. package/dist/src/errors.d.ts.map +1 -0
  52. package/dist/src/errors.js +57 -0
  53. package/dist/src/errors.js.map +1 -0
  54. package/dist/src/index.d.ts +29 -0
  55. package/dist/src/index.d.ts.map +1 -0
  56. package/dist/src/index.js +27 -0
  57. package/dist/src/index.js.map +1 -0
  58. package/dist/src/kernel/batch.d.ts +116 -0
  59. package/dist/src/kernel/batch.d.ts.map +1 -0
  60. package/dist/src/kernel/batch.js +335 -0
  61. package/dist/src/kernel/batch.js.map +1 -0
  62. package/dist/src/kernel/dispatch.d.ts +59 -0
  63. package/dist/src/kernel/dispatch.d.ts.map +1 -0
  64. package/dist/src/kernel/dispatch.js +139 -0
  65. package/dist/src/kernel/dispatch.js.map +1 -0
  66. package/dist/src/kernel/kernel.d.ts +84 -0
  67. package/dist/src/kernel/kernel.d.ts.map +1 -0
  68. package/dist/src/kernel/kernel.js +239 -0
  69. package/dist/src/kernel/kernel.js.map +1 -0
  70. package/dist/src/kernel/pipeline-cache.d.ts +90 -0
  71. package/dist/src/kernel/pipeline-cache.d.ts.map +1 -0
  72. package/dist/src/kernel/pipeline-cache.js +251 -0
  73. package/dist/src/kernel/pipeline-cache.js.map +1 -0
  74. package/dist/src/kernel/prelude.d.ts +35 -0
  75. package/dist/src/kernel/prelude.d.ts.map +1 -0
  76. package/dist/src/kernel/prelude.js +211 -0
  77. package/dist/src/kernel/prelude.js.map +1 -0
  78. package/dist/src/kernel/profiler.d.ts +64 -0
  79. package/dist/src/kernel/profiler.d.ts.map +1 -0
  80. package/dist/src/kernel/profiler.js +120 -0
  81. package/dist/src/kernel/profiler.js.map +1 -0
  82. package/dist/src/kernel/struct-block.d.ts +122 -0
  83. package/dist/src/kernel/struct-block.d.ts.map +1 -0
  84. package/dist/src/kernel/struct-block.js +353 -0
  85. package/dist/src/kernel/struct-block.js.map +1 -0
  86. package/dist/src/kernel/uniform-ring.d.ts +70 -0
  87. package/dist/src/kernel/uniform-ring.d.ts.map +1 -0
  88. package/dist/src/kernel/uniform-ring.js +146 -0
  89. package/dist/src/kernel/uniform-ring.js.map +1 -0
  90. package/dist/src/kernel/wgsl.d.ts +88 -0
  91. package/dist/src/kernel/wgsl.d.ts.map +1 -0
  92. package/dist/src/kernel/wgsl.js +390 -0
  93. package/dist/src/kernel/wgsl.js.map +1 -0
  94. package/dist/src/kernels.d.ts +81 -0
  95. package/dist/src/kernels.d.ts.map +1 -0
  96. package/dist/src/kernels.js +417 -0
  97. package/dist/src/kernels.js.map +1 -0
  98. package/dist/src/layouts/force-simulation.d.ts +498 -0
  99. package/dist/src/layouts/force-simulation.d.ts.map +1 -0
  100. package/dist/src/layouts/force-simulation.js +1650 -0
  101. package/dist/src/layouts/force-simulation.js.map +1 -0
  102. package/dist/src/layouts/forceatlas2.d.ts +210 -0
  103. package/dist/src/layouts/forceatlas2.d.ts.map +1 -0
  104. package/dist/src/layouts/forceatlas2.js +759 -0
  105. package/dist/src/layouts/forceatlas2.js.map +1 -0
  106. package/dist/src/layouts/inputs.d.ts +40 -0
  107. package/dist/src/layouts/inputs.d.ts.map +1 -0
  108. package/dist/src/layouts/inputs.js +185 -0
  109. package/dist/src/layouts/inputs.js.map +1 -0
  110. package/dist/src/layouts/repulsion-exact.d.ts +85 -0
  111. package/dist/src/layouts/repulsion-exact.d.ts.map +1 -0
  112. package/dist/src/layouts/repulsion-exact.js +134 -0
  113. package/dist/src/layouts/repulsion-exact.js.map +1 -0
  114. package/dist/src/layouts/seed.d.ts +56 -0
  115. package/dist/src/layouts/seed.d.ts.map +1 -0
  116. package/dist/src/layouts/seed.js +173 -0
  117. package/dist/src/layouts/seed.js.map +1 -0
  118. package/dist/src/memory/buffer-pool.d.ts +73 -0
  119. package/dist/src/memory/buffer-pool.d.ts.map +1 -0
  120. package/dist/src/memory/buffer-pool.js +170 -0
  121. package/dist/src/memory/buffer-pool.js.map +1 -0
  122. package/dist/src/memory/lease.d.ts +53 -0
  123. package/dist/src/memory/lease.d.ts.map +1 -0
  124. package/dist/src/memory/lease.js +85 -0
  125. package/dist/src/memory/lease.js.map +1 -0
  126. package/dist/src/memory/readback.d.ts +143 -0
  127. package/dist/src/memory/readback.d.ts.map +1 -0
  128. package/dist/src/memory/readback.js +375 -0
  129. package/dist/src/memory/readback.js.map +1 -0
  130. package/dist/src/memory/residency.d.ts +83 -0
  131. package/dist/src/memory/residency.d.ts.map +1 -0
  132. package/dist/src/memory/residency.js +573 -0
  133. package/dist/src/memory/residency.js.map +1 -0
  134. package/dist/src/memory/upload-plan.d.ts +101 -0
  135. package/dist/src/memory/upload-plan.d.ts.map +1 -0
  136. package/dist/src/memory/upload-plan.js +265 -0
  137. package/dist/src/memory/upload-plan.js.map +1 -0
  138. package/dist/src/node/index.d.ts +64 -0
  139. package/dist/src/node/index.d.ts.map +1 -0
  140. package/dist/src/node/index.js +183 -0
  141. package/dist/src/node/index.js.map +1 -0
  142. package/dist/src/primitives/reduce.d.ts +57 -0
  143. package/dist/src/primitives/reduce.d.ts.map +1 -0
  144. package/dist/src/primitives/reduce.js +161 -0
  145. package/dist/src/primitives/reduce.js.map +1 -0
  146. package/dist/src/primitives/segmented-reduce.d.ts +38 -0
  147. package/dist/src/primitives/segmented-reduce.d.ts.map +1 -0
  148. package/dist/src/primitives/segmented-reduce.js +211 -0
  149. package/dist/src/primitives/segmented-reduce.js.map +1 -0
  150. package/dist/src/types/accelerator.d.ts +209 -0
  151. package/dist/src/types/accelerator.d.ts.map +1 -0
  152. package/dist/src/types/accelerator.js +8 -0
  153. package/dist/src/types/accelerator.js.map +1 -0
  154. package/dist/src/types/context.d.ts +114 -0
  155. package/dist/src/types/context.d.ts.map +1 -0
  156. package/dist/src/types/context.js +7 -0
  157. package/dist/src/types/context.js.map +1 -0
  158. package/dist/src/types/layout.d.ts +95 -0
  159. package/dist/src/types/layout.d.ts.map +1 -0
  160. package/dist/src/types/layout.js +6 -0
  161. package/dist/src/types/layout.js.map +1 -0
  162. package/dist/src/types/memory.d.ts +22 -0
  163. package/dist/src/types/memory.d.ts.map +1 -0
  164. package/dist/src/types/memory.js +7 -0
  165. package/dist/src/types/memory.js.map +1 -0
  166. package/dist/src/types/options.d.ts +78 -0
  167. package/dist/src/types/options.d.ts.map +1 -0
  168. package/dist/src/types/options.js +7 -0
  169. package/dist/src/types/options.js.map +1 -0
  170. package/dist/src/types/run.d.ts +13 -0
  171. package/dist/src/types/run.d.ts.map +1 -0
  172. package/dist/src/types/run.js +6 -0
  173. package/dist/src/types/run.js.map +1 -0
  174. package/dist/src/wgsl/degree.wgsl.d.ts +10 -0
  175. package/dist/src/wgsl/degree.wgsl.d.ts.map +1 -0
  176. package/dist/src/wgsl/degree.wgsl.js +25 -0
  177. package/dist/src/wgsl/degree.wgsl.js.map +1 -0
  178. package/dist/src/wgsl/fa2-attraction.wgsl.d.ts +12 -0
  179. package/dist/src/wgsl/fa2-attraction.wgsl.d.ts.map +1 -0
  180. package/dist/src/wgsl/fa2-attraction.wgsl.js +37 -0
  181. package/dist/src/wgsl/fa2-attraction.wgsl.js.map +1 -0
  182. package/dist/src/wgsl/fa2-integrate.wgsl.d.ts +13 -0
  183. package/dist/src/wgsl/fa2-integrate.wgsl.d.ts.map +1 -0
  184. package/dist/src/wgsl/fa2-integrate.wgsl.js +69 -0
  185. package/dist/src/wgsl/fa2-integrate.wgsl.js.map +1 -0
  186. package/dist/src/wgsl/fa2-repulsion-exact.wgsl.d.ts +12 -0
  187. package/dist/src/wgsl/fa2-repulsion-exact.wgsl.d.ts.map +1 -0
  188. package/dist/src/wgsl/fa2-repulsion-exact.wgsl.js +79 -0
  189. package/dist/src/wgsl/fa2-repulsion-exact.wgsl.js.map +1 -0
  190. package/dist/src/wgsl/fa2-speed-finalize.wgsl.d.ts +15 -0
  191. package/dist/src/wgsl/fa2-speed-finalize.wgsl.d.ts.map +1 -0
  192. package/dist/src/wgsl/fa2-speed-finalize.wgsl.js +54 -0
  193. package/dist/src/wgsl/fa2-speed-finalize.wgsl.js.map +1 -0
  194. package/dist/src/wgsl/fa2-stats-finalize.wgsl.d.ts +14 -0
  195. package/dist/src/wgsl/fa2-stats-finalize.wgsl.d.ts.map +1 -0
  196. package/dist/src/wgsl/fa2-stats-finalize.wgsl.js +57 -0
  197. package/dist/src/wgsl/fa2-stats-finalize.wgsl.js.map +1 -0
  198. package/dist/src/wgsl/fa2-to-scene.wgsl.d.ts +11 -0
  199. package/dist/src/wgsl/fa2-to-scene.wgsl.d.ts.map +1 -0
  200. package/dist/src/wgsl/fa2-to-scene.wgsl.js +19 -0
  201. package/dist/src/wgsl/fa2-to-scene.wgsl.js.map +1 -0
  202. package/dist/src/wgsl/fill.wgsl.d.ts +7 -0
  203. package/dist/src/wgsl/fill.wgsl.d.ts.map +1 -0
  204. package/dist/src/wgsl/fill.wgsl.js +14 -0
  205. package/dist/src/wgsl/fill.wgsl.js.map +1 -0
  206. package/dist/src/wgsl/reduce.wgsl.d.ts +10 -0
  207. package/dist/src/wgsl/reduce.wgsl.d.ts.map +1 -0
  208. package/dist/src/wgsl/reduce.wgsl.js +63 -0
  209. package/dist/src/wgsl/reduce.wgsl.js.map +1 -0
  210. package/dist/src/wgsl/segmented-reduce.wgsl.d.ts +13 -0
  211. package/dist/src/wgsl/segmented-reduce.wgsl.d.ts.map +1 -0
  212. package/dist/src/wgsl/segmented-reduce.wgsl.js +35 -0
  213. package/dist/src/wgsl/segmented-reduce.wgsl.js.map +1 -0
  214. package/dist/tsconfig.build.tsbuildinfo +1 -0
  215. package/dist/webgpu-graph-algorithms.d.ts +1 -0
  216. package/dist/webgpu-graph-algorithms.js +4454 -0
  217. package/dist/webgpu-graph-algorithms.js.map +1 -0
  218. package/package.json +108 -17
  219. package/src/accelerator.ts +117 -0
  220. package/src/algorithms/degree.ts +142 -0
  221. package/src/browser/index.ts +57 -0
  222. package/src/constants.ts +116 -0
  223. package/src/context.ts +399 -0
  224. package/src/device/acquire.ts +256 -0
  225. package/src/device/caps.ts +122 -0
  226. package/src/device/error-scope.ts +171 -0
  227. package/src/device/lost.ts +142 -0
  228. package/src/device/webgpu-constants.ts +44 -0
  229. package/src/errors.ts +94 -0
  230. package/src/index.ts +102 -0
  231. package/src/kernel/batch.ts +427 -0
  232. package/src/kernel/dispatch.ts +162 -0
  233. package/src/kernel/kernel.ts +311 -0
  234. package/src/kernel/pipeline-cache.ts +288 -0
  235. package/src/kernel/prelude.ts +229 -0
  236. package/src/kernel/profiler.ts +148 -0
  237. package/src/kernel/struct-block.ts +439 -0
  238. package/src/kernel/uniform-ring.ts +184 -0
  239. package/src/kernel/wgsl.ts +490 -0
  240. package/src/kernels.ts +511 -0
  241. package/src/layouts/force-simulation.ts +2111 -0
  242. package/src/layouts/forceatlas2.ts +942 -0
  243. package/src/layouts/inputs.ts +252 -0
  244. package/src/layouts/repulsion-exact.ts +183 -0
  245. package/src/layouts/seed.ts +198 -0
  246. package/src/memory/buffer-pool.ts +204 -0
  247. package/src/memory/lease.ts +93 -0
  248. package/src/memory/readback.ts +429 -0
  249. package/src/memory/residency.ts +753 -0
  250. package/src/memory/upload-plan.ts +350 -0
  251. package/src/node/index.ts +230 -0
  252. package/src/primitives/reduce.ts +233 -0
  253. package/src/primitives/segmented-reduce.ts +270 -0
  254. package/src/types/accelerator.ts +236 -0
  255. package/src/types/context.ts +135 -0
  256. package/src/types/layout.ts +103 -0
  257. package/src/types/memory.ts +23 -0
  258. package/src/types/options.ts +84 -0
  259. package/src/types/run.ts +13 -0
  260. package/src/wgsl/degree.wgsl.ts +24 -0
  261. package/src/wgsl/fa2-attraction.wgsl.ts +37 -0
  262. package/src/wgsl/fa2-integrate.wgsl.ts +69 -0
  263. package/src/wgsl/fa2-repulsion-exact.wgsl.ts +78 -0
  264. package/src/wgsl/fa2-speed-finalize.wgsl.ts +53 -0
  265. package/src/wgsl/fa2-stats-finalize.wgsl.ts +57 -0
  266. package/src/wgsl/fa2-to-scene.wgsl.ts +19 -0
  267. package/src/wgsl/fill.wgsl.ts +13 -0
  268. package/src/wgsl/reduce.wgsl.ts +62 -0
  269. package/src/wgsl/segmented-reduce.wgsl.ts +35 -0
@@ -0,0 +1,498 @@
1
+ /**
2
+ * The shared layout state machine (spec 7.19): the buffers every model shares (positions, scenePositions, fixed,
3
+ * partials, state + trace), the in-flight batches and their readbacks, the settle window, the fixed mask and the
4
+ * setPosition override list (spec 7.12), the trace and the batch driver; consumes a ForceModel by composition (the
5
+ * per-model kernel sequence, buffers, overrides, per-iteration params, controller hooks and stats decoding).
6
+ * Positions are layout units on the device and scene units in the owner's array (spec 7.18): load() repacks
7
+ * (scene - center) / scale into vec4f with the mass in .w (D23); the model's toScene stage, recorded once per batch
8
+ * on the last iteration (PLAN DECISION 2), writes p * scale + center back into scenePositions.
9
+ */
10
+ import { type F32, type GraphSnapshot, type NodeMask } from "@graphty/graph-format";
11
+ import { type GpuContext } from "../context.js";
12
+ import { CommandBatch } from "../kernel/batch.js";
13
+ import { type PipelineCache } from "../kernel/pipeline-cache.js";
14
+ import { type UniformBlock, type UniformValues } from "../kernel/struct-block.js";
15
+ import { UniformRing } from "../kernel/uniform-ring.js";
16
+ import { type WgslModuleSpec } from "../kernel/wgsl.js";
17
+ import { type CoreBinding } from "../memory/residency.js";
18
+ import { type PlanCaps } from "../types/context.js";
19
+ import { type GpuLayoutSimulation, type LayoutStatsBase, type ResolvedLayoutTuning, type RunOptions } from "../types/layout.js";
20
+ import { type Binding } from "../types/memory.js";
21
+ import { type CommonLayoutOptions, type SimulationOptions } from "../types/options.js";
22
+ import { type ResolvedWeights } from "./inputs.js";
23
+ /** A model-owned buffer beyond the shared set (spec 7.19: oldForce, velocity, the grid tier's). */
24
+ export interface BufferSpec {
25
+ readonly name: string;
26
+ readonly byteLength: number;
27
+ readonly usage: number;
28
+ readonly zero: boolean;
29
+ }
30
+ /** Host writes into the state header collected between submits (spec 7.19 onLoad / onReheat / onSetParams). */
31
+ export interface StateWriter {
32
+ /** Queues a field write (flushed by one writeBuffer before the next submit; also applied to the host shadow immediately). */
33
+ set(field: string, value: number | readonly number[]): void;
34
+ /** The host shadow of a field (last known value). */
35
+ get(field: string): number | readonly number[];
36
+ }
37
+ /** What a model gets at bind time (after load() / a resize): the graph, the shared and model buffers, the ring, the cache. */
38
+ export interface ModelResources {
39
+ readonly device: GPUDevice;
40
+ readonly caps: PlanCaps;
41
+ readonly pipelines: PipelineCache;
42
+ readonly core: CoreBinding;
43
+ readonly perm: Binding | null;
44
+ /**
45
+ * The RESOLVED weights binding (model.inputs(): source "arcs" -> core.weights (null on an unweighted snapshot),
46
+ * "column" -> the registered ArrayBinding's binding, "none" -> null); group 0 is built as
47
+ * graphBindings(core, perm, weights) (3.10).
48
+ */
49
+ readonly weights: Binding | null;
50
+ readonly n: number;
51
+ readonly dim: 2 | 3;
52
+ readonly tier: "exact" | "grid";
53
+ readonly ring: UniformRing;
54
+ /** A shared or model-owned buffer by name: "positions", "scenePositions", "fixed", "partials", "state", "trace", plus every BufferSpec name. */
55
+ buffer(name: string): Binding;
56
+ }
57
+ /** The per-load inputs a model resolves from the snapshot and its options (mass into the `.w` lane; weights into the group-0 slot). */
58
+ export interface ModelInputs {
59
+ readonly mass: F32;
60
+ readonly weights: ResolvedWeights;
61
+ }
62
+ /**
63
+ * Spec 7.19 ForceModel (kind, buffers, overrides, paramsFor, recordIteration, onLoad, onReheat, onSetParams,
64
+ * readStats) with SEVEN additions (CONTRACT DECISION, each with its reason): `stages` (the kernel stage names for
65
+ * debugRunStages / inspect, spec 11.9 item 2); `params` (the model's uniform block, which must declare the shared
66
+ * field names n, dim, flags, iterationIndex, seed, scale, center, settleThreshold, so the simulation can write
67
+ * them); `state` and `trace` (the model's generated Fa2State / Fa2Trace blocks, so the simulation allocates,
68
+ * initialises and decodes the state buffer through the model's own layouts, D20); `specs` (the module specs of an
69
+ * override set, for warm() and the compile matrix); `bind` (the model compiles and binds after load(), when the
70
+ * buffers exist); `inputs` (mass and weight resolution need the model's option names -- nodeMass / weight are
71
+ * ForceAtlas2Options, not CommonLayoutOptions -- so the simulation calls it at load() and derives USE_PERM /
72
+ * HAS_WEIGHTS from ModelResources, 3.10); and the optional `upTo` argument of `recordIteration` (truncates the
73
+ * sequence after a stage, for debugRunStages / inspect). PLAN DECISION 4: the state block must declare centroid,
74
+ * min, max (vec4f), rmsRadius, radius, meanDisplacement (f32), iteration, settledCount (u32) and fit in
75
+ * STATE_HEADER_BYTES; the params block must declare the eight shared names with center a vec4f and fit in
76
+ * UNIFORM_SLOT_BYTES. PLAN DECISION 6: paramsFor receives the GLOBAL iteration index; the shared fields win.
77
+ * PLAN DECISION 2: recordIteration with `upTo` undefined records EVERY stage (toScene included); `upTo = <stage>`
78
+ * stops after that stage.
79
+ */
80
+ export interface ForceModel<Options, Stats extends LayoutStatsBase> {
81
+ readonly kind: "forceatlas2" | "fruchtermanReingold" | "springElectrical";
82
+ readonly stages: readonly string[];
83
+ readonly params: UniformBlock;
84
+ readonly state: UniformBlock;
85
+ readonly trace: UniformBlock;
86
+ buffers(n: number, dim: 2 | 3): readonly BufferSpec[];
87
+ /** Called at load() before the upload: FA2 = { mass: resolveNodeMass(s, nodeMass), weights: resolveWeights(s, weight) }. */
88
+ inputs(s: GraphSnapshot, options: Options): ModelInputs;
89
+ /** The model's OWN override set; the simulation merges USE_PERM / HAS_WEIGHTS from graphOverrides(core, perm, resources.weights) before specs() / bind(). */
90
+ overrides(options: Options): Readonly<Record<string, number | boolean>>;
91
+ specs(overrides: Readonly<Record<string, number | boolean>>, subgroups: boolean): readonly WgslModuleSpec[];
92
+ bind(resources: ModelResources, overrides: Readonly<Record<string, number | boolean>>): Promise<void>;
93
+ paramsFor(iteration: number, options: Options): UniformValues;
94
+ recordIteration(batch: CommandBatch, slot: number, tier: "exact" | "grid", upTo?: string): void;
95
+ onLoad(state: StateWriter): void;
96
+ onReheat(state: StateWriter): void;
97
+ onSetParams(patch: Partial<Options>, state: StateWriter): void;
98
+ readStats(state: DataView, trace: DataView): Stats;
99
+ }
100
+ /**
101
+ * The shared layout state machine (spec 7.19): buffers, in-flight batches, readback, settle window, fixed mask,
102
+ * setPosition overrides, trace, batch driver; consumes a ForceModel by composition.
103
+ */
104
+ export declare class ForceSimulation<Options extends CommonLayoutOptions & SimulationOptions, Stats extends LayoutStatsBase> implements GpuLayoutSimulation<Options, Stats> {
105
+ readonly ctx: GpuContext;
106
+ readonly model: ForceModel<Options, Stats>;
107
+ readonly tuning: ResolvedLayoutTuning;
108
+ /**
109
+ * Present when ctx.debug.inspect is true: reads back any named buffer (a shared name, a BufferSpec name,
110
+ * "force", "state", "trace") after the last submitted kernel; resolves a Float32Array except for "fixed",
111
+ * "trace" (raw words) which resolve Uint32Array.
112
+ */
113
+ inspect?: (name: string) => Promise<Float32Array | Uint32Array>;
114
+ private readonly resolveOptions;
115
+ private readonly maxInFlight;
116
+ private readonly label;
117
+ private readonly traceBytes;
118
+ private readonly writer;
119
+ private readonly overrideList;
120
+ private readonly pending;
121
+ private readonly unregisterLost;
122
+ private optionsValue;
123
+ private stateValue;
124
+ private generationValue;
125
+ private tierValue;
126
+ private dimValue;
127
+ private snapshot;
128
+ private serial;
129
+ private owner;
130
+ private n;
131
+ private scale;
132
+ private center;
133
+ private buffers;
134
+ private core;
135
+ private resources;
136
+ private weightsUpload;
137
+ private ready;
138
+ private submitChain;
139
+ private fixedWords;
140
+ private fixedDirty;
141
+ private iterationsSubmitted;
142
+ private iterationsDoneValue;
143
+ private settledCountValue;
144
+ private settledValue;
145
+ private firstPending;
146
+ private statsValue;
147
+ private lastSubmittedBatchIdValue;
148
+ /** The id of the last batch submitted BEFORE the most recent reheat() (PLAN DECISION 21); 0 = none. */
149
+ private reheatedAfterBatchId;
150
+ private coalescedValue;
151
+ private torndown;
152
+ /**
153
+ * Creates a simulation over a context and a model (state "created"; load() makes it "loaded").
154
+ * @param ctx - the context (ready)
155
+ * @param model - the force model
156
+ * @param options - the option record (defaults applied by the caller's factory)
157
+ * @param tuning - the resolved GPU tuning
158
+ * @param resolve - how setParams merges a patch into the current record
159
+ */
160
+ constructor(ctx: GpuContext, model: ForceModel<Options, Stats>, options: Options, tuning: ResolvedLayoutTuning, resolve: (patch: Partial<Options>, current: Options) => Options);
161
+ /**
162
+ * "created" | "loaded" | "disposed".
163
+ * @returns the state
164
+ */
165
+ get state(): "created" | "loaded" | "disposed";
166
+ /**
167
+ * The current options record (defaults applied).
168
+ * @returns the record
169
+ */
170
+ get options(): Options;
171
+ /**
172
+ * The repulsion tier of the current load ("exact" until P4 lifts the grid tier).
173
+ * @returns the tier
174
+ */
175
+ get tier(): "exact" | "grid";
176
+ /**
177
+ * Nodes of the current load (0 before load()).
178
+ * @returns the node count
179
+ */
180
+ get nodeCount(): number;
181
+ /**
182
+ * 2 or 3, fixed at construction (setParams({ dim }) is rejected, spec 7.13).
183
+ * @returns the dimension
184
+ */
185
+ get dim(): 2 | 3;
186
+ /**
187
+ * iterationsDone >= the budget OR settledCount >= settleWindow of the last completed batch (spec 7.17); true for an empty graph.
188
+ * @returns whether the layout is settled
189
+ */
190
+ get settled(): boolean;
191
+ /**
192
+ * Batches created by step() and not yet landed (PLAN DECISION 7: counted from the step() call).
193
+ * @returns the count
194
+ */
195
+ get inFlight(): number;
196
+ /**
197
+ * Iterations landed since load() or the last reheat().
198
+ * @returns the count
199
+ */
200
+ get iterationsDone(): number;
201
+ /**
202
+ * The stats of the last completed batch; before one lands, the host-written header decoded through the model
203
+ * with an empty trace and msPerIteration null.
204
+ * @returns the stats
205
+ */
206
+ get stats(): Stats;
207
+ /**
208
+ * Uploads the snapshot's core, seeds the NaN rows of `positions`, repacks it into layout-unit vec4f with the
209
+ * mass in .w, writes the initial state, starts the model's compile + bind and enters "loaded" (spec 7.19; a
210
+ * load() during flight bumps the generation and discards the in-flight batches). Order of the checks (PLAN
211
+ * DECISION 16): E_DISPOSED, the context's assertReady, E_SNAPSHOT (directed), E_TOO_LARGE (nodeCount), the
212
+ * positions array, the tuning, then the core upload and model.inputs() BEFORE any state is touched.
213
+ * PLAN DECISION 10: nodeCount 0 loads with no GPU work at all. PLAN DECISION 11: the tier is resolved here
214
+ * and "grid" is E_UNSUPPORTED until P4. PLAN DECISION 17: a same-size load() keeps the buffers and re-zeroes
215
+ * partials, the trace region and every `zero: true` model buffer.
216
+ * @param snapshot - an undirected snapshot
217
+ * @param positions - the owner's stride-3 scene-unit array (NaN rows are seeded in place)
218
+ */
219
+ load(snapshot: GraphSnapshot, positions: F32): void;
220
+ /**
221
+ * Submits k iterations (spec 7.19 items 1-6): "created" -> E_NOT_LOADED; "disposed" -> E_DISPOSED; a released
222
+ * snapshot -> E_RELEASED; k outside [1, MAX_ITERATIONS_PER_STEP] -> E_INVALID_ARGUMENT; settled -> resolves at
223
+ * once; inFlight >= maxInFlight -> the OLDEST pending batch's promise (coalesced); else the batch is queued on
224
+ * the submit chain (after the bind promise and allocator.check()) and its promise resolves when its readback
225
+ * landed in the owner's array. The same promise object is returned for every coalesced call. PLAN DECISION 7:
226
+ * the batch counts in `inFlight` from this call, not from its submission.
227
+ * @param iterations - k (default options.iterationsPerStep, default 1)
228
+ * @returns resolves when the batch landed (or was discarded); rejects E_VALIDATION / E_DEVICE_LOST / E_OUT_OF_MEMORY / E_SHADER_COMPILE
229
+ */
230
+ step(iterations?: number): Promise<void>;
231
+ /**
232
+ * Resolves when nothing is in flight (every pending batch landed or was discarded).
233
+ * @returns the promise
234
+ */
235
+ flush(): Promise<void>;
236
+ /**
237
+ * Node batch driver: loops step(batch) until settled, the budget (`maxIter ?? options.maxIter`, PLAN DECISION
238
+ * 1) is reached or the signal aborts (E_ABORTED; the batch in flight at the abort is discarded, spec 5.7 / Q-15).
239
+ * @param options - maxIter, batch (default 8), signal
240
+ * @returns the stats of the last completed batch
241
+ */
242
+ run(options?: RunOptions): Promise<Stats>;
243
+ /**
244
+ * Copies the mask words (spec 7.12): E_INVALID_ARGUMENT when shorter than ceil(n / 32); the buffer is marked
245
+ * dirty and re-uploaded before the next submit; reheat() iff some bit went 1 -> 0 (an unpin). PLAN DECISION
246
+ * 18: the comparison is bit by bit below n (bits at or above n never count as an unpin).
247
+ * @param mask - the NodeMask (LSB-first words)
248
+ */
249
+ setFixed(mask: NodeMask): void;
250
+ /**
251
+ * Writes a scene-unit position (spec 7.12): into the owner's array at once, into the device (layout units, z 0
252
+ * in 2D, 12 bytes at 16 i, queue-ordered before the next submit), into the override list keyed by the last
253
+ * submitted batch id, then reheat(). PLAN DECISION 18: non-finite coordinates are E_INVALID_ARGUMENT.
254
+ * @param index - the node index (< n)
255
+ * @param x - scene x
256
+ * @param y - scene y
257
+ * @param z - scene z (ignored on the device in 2D)
258
+ */
259
+ setPosition(index: number, x: number, y: number, z: number): void;
260
+ /**
261
+ * iterationsDone = 0, settledCount = 0 (a queued state write), model.onReheat(writer); nothing else (D8: the
262
+ * speed controller keeps its state). `settled` is recomputed at once (PLAN DECISION 8). Allowed before load().
263
+ * PLAN DECISION 21: the id of the last batch submitted so far is remembered; a batch with that id or an older
264
+ * one was computed from the pre-reheat counter, so its landed settledCount is taken as 0 (see onLanded) and a
265
+ * drag or unpin can never leave the simulation settled through a batch that was already in flight.
266
+ */
267
+ reheat(): void;
268
+ /**
269
+ * Live tuning (spec 3.3, 7.17): `dim` differing from the current -> E_INVALID_ARGUMENT; `maxInFlight` differing
270
+ * -> E_INVALID_ARGUMENT (the ring is sized by it); a non-null `nodeSize` -> E_UNSUPPORTED; the record is
271
+ * replaced through `resolve(patch, current)`; a change of the model's override set (a force LAW) recompiles
272
+ * and re-binds; scale / center changes reach the next batch through the shared params of every slot (the
273
+ * model's toScene reads them); then model.onSetParams(patch, writer) and reheat().
274
+ * @param patch - the fields to change
275
+ */
276
+ setParams(patch: Partial<Options>): void;
277
+ /**
278
+ * Discards in-flight batches (their promises resolve), destroys every simulation buffer and the ring, trims
279
+ * the pool, unregisters the loss listener; state "disposed"; idempotent.
280
+ */
281
+ dispose(): void;
282
+ /**
283
+ * The serialised submission of one pending batch: awaits the bind / warm promise and allocator.check(), then
284
+ * records and submits unless the record went stale meanwhile; wires the readback handlers. A record that went
285
+ * stale while waiting (a load() or dispose() superseded it) RESOLVES even when the wait rejected (PLAN
286
+ * DECISION 8: the rejection belongs to the superseded generation -- a bind that failed E_SHADER_COMPILE, or
287
+ * the ring's E_DISPOSED after dispose() tore it down under a running bind).
288
+ * @param record - the pending batch
289
+ */
290
+ private submitBatch;
291
+ /**
292
+ * Flushes the host writes, fills k ring slots, records k iterations (only the last one runs the model's toScene
293
+ * epilogue, PLAN DECISION 2) + the two readbacks into one CommandBatch and submits it (spec 7.19 items 4-5).
294
+ * @param record - the pending batch
295
+ * @returns the submitted batch
296
+ */
297
+ private recordAndSubmit;
298
+ /**
299
+ * A landed readback (spec 7.19 item 6): stale -> discard; else the scene bytes go into the owner's array row by
300
+ * row (skipping overridden rows, clearing overrides older than this batch), the header refreshes the shadow,
301
+ * the stats are decoded through the model (msPerIteration from the profiler or the wall time, PLAN DECISION 3),
302
+ * iterationsDone += k and settled is recomputed -- with the landed settledCount taken as 0 when the batch was
303
+ * submitted before the last reheat() (PLAN DECISION 21; the header is still absorbed and the stats decoded).
304
+ * @param record - the pending batch
305
+ * @param bytes - the batch's readback bytes
306
+ */
307
+ private onLanded;
308
+ /**
309
+ * A failed readback: a discarded batch's E_ABORTED resolves (PLAN DECISION 8); a lost device rejects
310
+ * E_DEVICE_LOST; everything else (E_VALIDATION, E_DISPOSED) rejects as is.
311
+ * @param record - the pending batch
312
+ * @param err - the rejection
313
+ */
314
+ private onFailed;
315
+ /**
316
+ * Copies the scene bytes of a landed batch into the owner's array, honouring the override list (spec 7.12).
317
+ * @param owner - the owner's array
318
+ * @param bytes - the readback
319
+ * @param record - the batch
320
+ */
321
+ private copyScene;
322
+ /**
323
+ * The batch's duration in milliseconds: the profiler's pass timings summed when present, else wall time.
324
+ * @param record - the batch
325
+ * @param bytes - its readback (the profiler's resolve lands in it)
326
+ * @returns milliseconds
327
+ */
328
+ private batchMilliseconds;
329
+ /**
330
+ * Whether a record belongs to an earlier generation, was discarded, or the simulation left "loaded".
331
+ * @param record - the batch
332
+ * @returns true when its readback must be ignored
333
+ */
334
+ private isStale;
335
+ /**
336
+ * Removes a record from the pending list (idempotent).
337
+ * @param record - the batch
338
+ */
339
+ private finish;
340
+ /** Marks every pending batch stale and discards the submitted ones (their readbacks resolve empty or E_ABORTED). */
341
+ private discardPending;
342
+ /** An OOM surfaced by allocator.check(): every simulation buffer is destroyed and the state returns to "created". */
343
+ private outOfMemory;
344
+ /**
345
+ * The E_ABORTED of run().
346
+ * @returns the error
347
+ */
348
+ private abortedError;
349
+ /**
350
+ * The uniform values of one iteration slot: the model's values with the shared fields on top (PLAN DECISION 6).
351
+ * @param global - the global iteration index (iterationsSubmitted + i)
352
+ * @param index - the slot index within the batch (the trace slot)
353
+ * @param flags - FA2_FLAG_FIRST for the first iteration after load(), else 0
354
+ * @returns the values
355
+ */
356
+ private paramsForSlot;
357
+ /**
358
+ * The option seed as a u32 (0 when unseeded), the near-field hash seed of P4.
359
+ * @returns the seed
360
+ */
361
+ private seedU32;
362
+ /**
363
+ * Writes the queued state fields, each as one writeBuffer of its own byte range (PLAN DECISION 5).
364
+ * @param state - the state buffer
365
+ */
366
+ private flushStateWrites;
367
+ /**
368
+ * The stage that precedes the toScene epilogue in model.stages (the `upTo` of every iteration but the last), or
369
+ * undefined when the model has no epilogue or lists it first (every iteration then records every stage).
370
+ * @returns the stage name or undefined
371
+ */
372
+ private lastIterationStage;
373
+ /**
374
+ * The settle threshold of the current options (FA2_DEFAULTS when absent).
375
+ * @returns the threshold
376
+ */
377
+ private settleThreshold;
378
+ /**
379
+ * The settle window of the current options (FA2_DEFAULTS when absent).
380
+ * @returns the window
381
+ */
382
+ private settleWindow;
383
+ /**
384
+ * The iteration budget (PLAN DECISION 1): options.maxIter, else options.iterations, else no budget.
385
+ * @returns the budget
386
+ */
387
+ private iterationBudget;
388
+ /**
389
+ * The settle rule of spec 7.17 over the counters of the last completed batch.
390
+ * @returns whether the layout is settled
391
+ */
392
+ private computeSettled;
393
+ /**
394
+ * Allocates the shared buffers (spec 7.3 sizes) and the model's BufferSpecs through the allocator (every buffer
395
+ * labelled); a `zero: true` spec must carry COPY_DST so it can be re-zeroed when kept across loads (PLAN
396
+ * DECISION 17). The state buffer is STATE_HEADER_BYTES + MAX_ITERATIONS_PER_STEP x model.trace.byteLength:
397
+ * contract 3.13 writes TRACE_RECORD_BYTES (32, the FA2 record) for the last factor; the model's block is the
398
+ * same number for FA2 and is what the simulation decodes the trace with, so it is the general rule (PLAN
399
+ * DECISION 4) and the constant is not imported here.
400
+ * @param n - the node count (> 0)
401
+ * @returns the buffers and the name -> Binding map
402
+ */
403
+ private allocate;
404
+ /**
405
+ * Re-zeroes the buffers a same-size load() keeps: partials, the trace region and every `zero: true` model buffer.
406
+ * @param buffers - the kept buffers
407
+ */
408
+ private clearKept;
409
+ /**
410
+ * Destroys every simulation buffer through the allocator (the ring lives on until dispose()). While batches are
411
+ * still in flight the destruction is DEFERRED until their readbacks have settled: the GPU may still be copying
412
+ * out of `scene` / `state` and Dawn's Metal backend (dawn-node 0.4.0 on macOS) has taken the worker process
413
+ * down when a buffer with pending work was destroyed (the Vulkan backends defer internally). The simulation
414
+ * drops its references at once either way, so nothing here is reachable afterwards.
415
+ */
416
+ private destroyBuffers;
417
+ /**
418
+ * Runs `action` now when no submitted batch is in flight, otherwise once every in-flight readback has settled
419
+ * (resolved, discarded or rejected -- the staging slot is returned and the GPU work is done either way).
420
+ * @param action - the destruction to run
421
+ */
422
+ private afterInFlight;
423
+ /**
424
+ * The buffers of the current load.
425
+ * @returns the buffers; E_NOT_LOADED when there are none
426
+ */
427
+ private requireBuffers;
428
+ /**
429
+ * Repacks the seeded scene array into layout-unit vec4f (mass in .w, z = 0 in 2D), uploads it, and writes the
430
+ * initial centroid / bbox / rmsRadius / radius (f64 over the f32 values uploaded) with iteration 0,
431
+ * settledCount 0, meanDisplacement 0 into the state header, then model.onLoad(writer) and one whole-header
432
+ * writeBuffer (spec 7.4, 7.17, 7.18).
433
+ * @param buffers - the buffers
434
+ * @param positions - the seeded owner array
435
+ * @param mass - the resolved masses
436
+ */
437
+ private uploadPositions;
438
+ /**
439
+ * The weights binding of a load (3.10): "arcs" -> core.weights, "none" -> null, "column" -> the expanded array
440
+ * registered with residency.array(expanded, "weights", snapshot), the previous array object reused when the
441
+ * column and its version are unchanged (so the upload cache finds it).
442
+ * @param snapshot - the snapshot
443
+ * @param core - its core
444
+ * @param resolved - model.inputs().weights
445
+ * @returns the binding for the group-0 weights slot, or null
446
+ */
447
+ private resolveWeightsBinding;
448
+ /**
449
+ * The ModelResources of a load.
450
+ * @param core - the core
451
+ * @param weights - the resolved weights binding
452
+ * @param buffers - the buffers
453
+ * @returns the resources
454
+ */
455
+ private makeResources;
456
+ /**
457
+ * Chains the compile + bind promise the next step() awaits on the PREVIOUS one (PLAN DECISION 20: binds are
458
+ * serialised on `ready` for load() and setParams() alike, so a superseded load()'s bind either fails its
459
+ * generation check before model.bind() or completes before its successor's bind starts -- it can never bind
460
+ * the model to destroyed buffers AFTER the new bind finished). The previous promise's rejection is swallowed by
461
+ * the chain (it belonged to the superseded generation); this promise's rejection is kept for the next step()
462
+ * (the derived catch only silences the unhandled-rejection warning).
463
+ * @param resources - the resources
464
+ * @param overrides - the merged override set
465
+ */
466
+ private startBind;
467
+ /**
468
+ * warm(model.specs()) then model.bind(); the await re-checks that the load is current before binding.
469
+ * @param resources - the resources
470
+ * @param overrides - the merged override set
471
+ * @param generation - the generation the bind belongs to
472
+ */
473
+ private compileAndBind;
474
+ /**
475
+ * inspect(name): flush, read the named buffer back, Uint32Array for "fixed" and "trace", Float32Array otherwise.
476
+ * @param name - a shared or BufferSpec name
477
+ * @returns the words
478
+ */
479
+ private inspectBuffer;
480
+ /**
481
+ * debugRunStages(upTo): one iteration truncated after a stage, submitted alone after flush(), awaited through
482
+ * a header readback; never advances the counters or the FA2_FLAG_FIRST flag (PLAN DECISION 9).
483
+ * @param upTo - a model stage name
484
+ */
485
+ private runStages;
486
+ /**
487
+ * Device loss (spec 5.7): every pending promise rejects E_DEVICE_LOST, the simulation is disposed.
488
+ * @param info - the loss info
489
+ */
490
+ private onDeviceLost;
491
+ /** Releases everything once: pending batches discarded, buffers and ring destroyed, pool trimmed, listener unregistered. */
492
+ private teardown;
493
+ /** E_DISPOSED after dispose() or device loss. */
494
+ private assertNotDisposed;
495
+ /** E_NOT_LOADED before load(), E_DISPOSED after dispose(). */
496
+ private assertLoaded;
497
+ }
498
+ //# sourceMappingURL=force-simulation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"force-simulation.d.ts","sourceRoot":"","sources":["../../../src/layouts/force-simulation.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,KAAK,GAAG,EAAE,KAAK,aAAa,EAAsB,KAAK,QAAQ,EAAY,MAAM,uBAAuB,CAAC;AAWlH,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,eAAe,CAAC;AAGhD,OAAO,EAAE,YAAY,EAA6C,MAAM,oBAAoB,CAAC;AAC7F,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,6BAA6B,CAAC;AACjE,OAAO,EAAE,KAAK,YAAY,EAAyB,KAAK,aAAa,EAAE,MAAM,2BAA2B,CAAC;AACzG,OAAO,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACxD,OAAO,EAAE,KAAK,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAExD,OAAO,EAAqB,KAAK,WAAW,EAAE,MA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