@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.
Files changed (264) hide show
  1. package/README.md +104 -52
  2. package/dist/browser.js +1 -1
  3. package/dist/chunks/{context-CRbw2Wyo.js → context-BXqgCifx.js} +225 -33
  4. package/dist/chunks/context-BXqgCifx.js.map +1 -0
  5. package/dist/node.js +1 -1
  6. package/dist/src/accelerator.d.ts +12 -10
  7. package/dist/src/accelerator.d.ts.map +1 -1
  8. package/dist/src/accelerator.js +32 -10
  9. package/dist/src/accelerator.js.map +1 -1
  10. package/dist/src/algorithms/components.d.ts.map +1 -1
  11. package/dist/src/algorithms/components.js +12 -13
  12. package/dist/src/algorithms/components.js.map +1 -1
  13. package/dist/src/algorithms/degree.d.ts +6 -8
  14. package/dist/src/algorithms/degree.d.ts.map +1 -1
  15. package/dist/src/algorithms/degree.js +58 -35
  16. package/dist/src/algorithms/degree.js.map +1 -1
  17. package/dist/src/algorithms/pagerank.d.ts.map +1 -1
  18. package/dist/src/algorithms/pagerank.js +16 -14
  19. package/dist/src/algorithms/pagerank.js.map +1 -1
  20. package/dist/src/algorithms/power-iteration.d.ts +2 -2
  21. package/dist/src/algorithms/power-iteration.d.ts.map +1 -1
  22. package/dist/src/algorithms/power-iteration.js +17 -14
  23. package/dist/src/algorithms/power-iteration.js.map +1 -1
  24. package/dist/src/constants.d.ts +85 -8
  25. package/dist/src/constants.d.ts.map +1 -1
  26. package/dist/src/constants.js +85 -8
  27. package/dist/src/constants.js.map +1 -1
  28. package/dist/src/errors.d.ts +3 -2
  29. package/dist/src/errors.d.ts.map +1 -1
  30. package/dist/src/errors.js +2 -1
  31. package/dist/src/errors.js.map +1 -1
  32. package/dist/src/index.d.ts +10 -5
  33. package/dist/src/index.d.ts.map +1 -1
  34. package/dist/src/index.js +14 -5
  35. package/dist/src/index.js.map +1 -1
  36. package/dist/src/kernel/dispatch.d.ts +8 -3
  37. package/dist/src/kernel/dispatch.d.ts.map +1 -1
  38. package/dist/src/kernel/dispatch.js +18 -7
  39. package/dist/src/kernel/dispatch.js.map +1 -1
  40. package/dist/src/kernel/kernel.d.ts +30 -1
  41. package/dist/src/kernel/kernel.d.ts.map +1 -1
  42. package/dist/src/kernel/kernel.js +49 -5
  43. package/dist/src/kernel/kernel.js.map +1 -1
  44. package/dist/src/kernel/prelude.d.ts.map +1 -1
  45. package/dist/src/kernel/prelude.js +9 -1
  46. package/dist/src/kernel/prelude.js.map +1 -1
  47. package/dist/src/kernel/profiler.d.ts +15 -3
  48. package/dist/src/kernel/profiler.d.ts.map +1 -1
  49. package/dist/src/kernel/profiler.js +27 -4
  50. package/dist/src/kernel/profiler.js.map +1 -1
  51. package/dist/src/kernels.d.ts +18 -8
  52. package/dist/src/kernels.d.ts.map +1 -1
  53. package/dist/src/kernels.js +345 -22
  54. package/dist/src/kernels.js.map +1 -1
  55. package/dist/src/layouts/calibrate.d.ts +51 -0
  56. package/dist/src/layouts/calibrate.d.ts.map +1 -0
  57. package/dist/src/layouts/calibrate.js +172 -0
  58. package/dist/src/layouts/calibrate.js.map +1 -0
  59. package/dist/src/layouts/force-simulation.d.ts +42 -5
  60. package/dist/src/layouts/force-simulation.d.ts.map +1 -1
  61. package/dist/src/layouts/force-simulation.js +84 -22
  62. package/dist/src/layouts/force-simulation.js.map +1 -1
  63. package/dist/src/layouts/forceatlas2.d.ts +107 -38
  64. package/dist/src/layouts/forceatlas2.d.ts.map +1 -1
  65. package/dist/src/layouts/forceatlas2.js +297 -290
  66. package/dist/src/layouts/forceatlas2.js.map +1 -1
  67. package/dist/src/layouts/fruchterman-reingold.d.ts +241 -0
  68. package/dist/src/layouts/fruchterman-reingold.d.ts.map +1 -0
  69. package/dist/src/layouts/fruchterman-reingold.js +739 -0
  70. package/dist/src/layouts/fruchterman-reingold.js.map +1 -0
  71. package/dist/src/layouts/model-common.d.ts +140 -0
  72. package/dist/src/layouts/model-common.d.ts.map +1 -0
  73. package/dist/src/layouts/model-common.js +269 -0
  74. package/dist/src/layouts/model-common.js.map +1 -0
  75. package/dist/src/layouts/repulsion-grid.d.ts +152 -0
  76. package/dist/src/layouts/repulsion-grid.d.ts.map +1 -0
  77. package/dist/src/layouts/repulsion-grid.js +318 -0
  78. package/dist/src/layouts/repulsion-grid.js.map +1 -0
  79. package/dist/src/layouts/spring-electrical.d.ts +224 -0
  80. package/dist/src/layouts/spring-electrical.d.ts.map +1 -0
  81. package/dist/src/layouts/spring-electrical.js +665 -0
  82. package/dist/src/layouts/spring-electrical.js.map +1 -0
  83. package/dist/src/memory/residency.d.ts +6 -2
  84. package/dist/src/memory/residency.d.ts.map +1 -1
  85. package/dist/src/memory/residency.js +84 -14
  86. package/dist/src/memory/residency.js.map +1 -1
  87. package/dist/src/primitives/core-shape.d.ts +38 -2
  88. package/dist/src/primitives/core-shape.d.ts.map +1 -1
  89. package/dist/src/primitives/core-shape.js +71 -3
  90. package/dist/src/primitives/core-shape.js.map +1 -1
  91. package/dist/src/primitives/grid-pyramid.d.ts +71 -0
  92. package/dist/src/primitives/grid-pyramid.d.ts.map +1 -0
  93. package/dist/src/primitives/grid-pyramid.js +143 -0
  94. package/dist/src/primitives/grid-pyramid.js.map +1 -0
  95. package/dist/src/primitives/grid.d.ts +118 -0
  96. package/dist/src/primitives/grid.d.ts.map +1 -0
  97. package/dist/src/primitives/grid.js +225 -0
  98. package/dist/src/primitives/grid.js.map +1 -0
  99. package/dist/src/primitives/histogram.d.ts +67 -0
  100. package/dist/src/primitives/histogram.d.ts.map +1 -0
  101. package/dist/src/primitives/histogram.js +190 -0
  102. package/dist/src/primitives/histogram.js.map +1 -0
  103. package/dist/src/primitives/radix-sort.d.ts +75 -0
  104. package/dist/src/primitives/radix-sort.d.ts.map +1 -0
  105. package/dist/src/primitives/radix-sort.js +168 -0
  106. package/dist/src/primitives/radix-sort.js.map +1 -0
  107. package/dist/src/primitives/scan.d.ts +44 -0
  108. package/dist/src/primitives/scan.d.ts.map +1 -0
  109. package/dist/src/primitives/scan.js +151 -0
  110. package/dist/src/primitives/scan.js.map +1 -0
  111. package/dist/src/primitives/segmented-reduce.d.ts +25 -17
  112. package/dist/src/primitives/segmented-reduce.d.ts.map +1 -1
  113. package/dist/src/primitives/segmented-reduce.js +166 -47
  114. package/dist/src/primitives/segmented-reduce.js.map +1 -1
  115. package/dist/src/primitives/spmv.d.ts +18 -14
  116. package/dist/src/primitives/spmv.d.ts.map +1 -1
  117. package/dist/src/primitives/spmv.js +94 -58
  118. package/dist/src/primitives/spmv.js.map +1 -1
  119. package/dist/src/primitives/verify.d.ts +49 -0
  120. package/dist/src/primitives/verify.d.ts.map +1 -0
  121. package/dist/src/primitives/verify.js +229 -0
  122. package/dist/src/primitives/verify.js.map +1 -0
  123. package/dist/src/types/accelerator.d.ts +7 -3
  124. package/dist/src/types/accelerator.d.ts.map +1 -1
  125. package/dist/src/types/context.d.ts +53 -0
  126. package/dist/src/types/context.d.ts.map +1 -1
  127. package/dist/src/types/layout.d.ts +52 -0
  128. package/dist/src/types/layout.d.ts.map +1 -1
  129. package/dist/src/types/options.d.ts +43 -1
  130. package/dist/src/types/options.d.ts.map +1 -1
  131. package/dist/src/wgsl/counting-scatter.wgsl.d.ts +8 -0
  132. package/dist/src/wgsl/counting-scatter.wgsl.d.ts.map +1 -0
  133. package/dist/src/wgsl/counting-scatter.wgsl.js +17 -0
  134. package/dist/src/wgsl/counting-scatter.wgsl.js.map +1 -0
  135. package/dist/src/wgsl/fa2-attraction.wgsl.d.ts +23 -8
  136. package/dist/src/wgsl/fa2-attraction.wgsl.d.ts.map +1 -1
  137. package/dist/src/wgsl/fa2-attraction.wgsl.js +100 -17
  138. package/dist/src/wgsl/fa2-attraction.wgsl.js.map +1 -1
  139. package/dist/src/wgsl/fa2-integrate.wgsl.d.ts +7 -2
  140. package/dist/src/wgsl/fa2-integrate.wgsl.d.ts.map +1 -1
  141. package/dist/src/wgsl/fa2-integrate.wgsl.js +28 -2
  142. package/dist/src/wgsl/fa2-integrate.wgsl.js.map +1 -1
  143. package/dist/src/wgsl/fa2-repulsion-exact.wgsl.d.ts +4 -2
  144. package/dist/src/wgsl/fa2-repulsion-exact.wgsl.d.ts.map +1 -1
  145. package/dist/src/wgsl/fa2-repulsion-exact.wgsl.js +14 -5
  146. package/dist/src/wgsl/fa2-repulsion-exact.wgsl.js.map +1 -1
  147. package/dist/src/wgsl/fa2-stats-finalize.wgsl.d.ts +12 -1
  148. package/dist/src/wgsl/fa2-stats-finalize.wgsl.d.ts.map +1 -1
  149. package/dist/src/wgsl/fa2-stats-finalize.wgsl.js +54 -0
  150. package/dist/src/wgsl/fa2-stats-finalize.wgsl.js.map +1 -1
  151. package/dist/src/wgsl/grid-cell-key.wgsl.d.ts +8 -0
  152. package/dist/src/wgsl/grid-cell-key.wgsl.d.ts.map +1 -0
  153. package/dist/src/wgsl/grid-cell-key.wgsl.js +30 -0
  154. package/dist/src/wgsl/grid-cell-key.wgsl.js.map +1 -0
  155. package/dist/src/wgsl/grid-centroid-hub.wgsl.d.ts +8 -0
  156. package/dist/src/wgsl/grid-centroid-hub.wgsl.d.ts.map +1 -0
  157. package/dist/src/wgsl/grid-centroid-hub.wgsl.js +29 -0
  158. package/dist/src/wgsl/grid-centroid-hub.wgsl.js.map +1 -0
  159. package/dist/src/wgsl/grid-centroid.wgsl.d.ts +8 -0
  160. package/dist/src/wgsl/grid-centroid.wgsl.d.ts.map +1 -0
  161. package/dist/src/wgsl/grid-centroid.wgsl.js +29 -0
  162. package/dist/src/wgsl/grid-centroid.wgsl.js.map +1 -0
  163. package/dist/src/wgsl/grid-downsample.wgsl.d.ts +7 -0
  164. package/dist/src/wgsl/grid-downsample.wgsl.d.ts.map +1 -0
  165. package/dist/src/wgsl/grid-downsample.wgsl.js +28 -0
  166. package/dist/src/wgsl/grid-downsample.wgsl.js.map +1 -0
  167. package/dist/src/wgsl/grid-far-field.wgsl.d.ts +13 -0
  168. package/dist/src/wgsl/grid-far-field.wgsl.d.ts.map +1 -0
  169. package/dist/src/wgsl/grid-far-field.wgsl.js +98 -0
  170. package/dist/src/wgsl/grid-far-field.wgsl.js.map +1 -0
  171. package/dist/src/wgsl/grid-near-field.wgsl.d.ts +19 -0
  172. package/dist/src/wgsl/grid-near-field.wgsl.d.ts.map +1 -0
  173. package/dist/src/wgsl/grid-near-field.wgsl.js +129 -0
  174. package/dist/src/wgsl/grid-near-field.wgsl.js.map +1 -0
  175. package/dist/src/wgsl/histogram.wgsl.d.ts +7 -0
  176. package/dist/src/wgsl/histogram.wgsl.d.ts.map +1 -0
  177. package/dist/src/wgsl/histogram.wgsl.js +15 -0
  178. package/dist/src/wgsl/histogram.wgsl.js.map +1 -0
  179. package/dist/src/wgsl/indirect-finalize.wgsl.d.ts +8 -0
  180. package/dist/src/wgsl/indirect-finalize.wgsl.d.ts.map +1 -0
  181. package/dist/src/wgsl/indirect-finalize.wgsl.js +26 -0
  182. package/dist/src/wgsl/indirect-finalize.wgsl.js.map +1 -0
  183. package/dist/src/wgsl/radix-hist.wgsl.d.ts +9 -0
  184. package/dist/src/wgsl/radix-hist.wgsl.d.ts.map +1 -0
  185. package/dist/src/wgsl/radix-hist.wgsl.js +31 -0
  186. package/dist/src/wgsl/radix-hist.wgsl.js.map +1 -0
  187. package/dist/src/wgsl/radix-scatter.wgsl.d.ts +9 -0
  188. package/dist/src/wgsl/radix-scatter.wgsl.d.ts.map +1 -0
  189. package/dist/src/wgsl/radix-scatter.wgsl.js +40 -0
  190. package/dist/src/wgsl/radix-scatter.wgsl.js.map +1 -0
  191. package/dist/src/wgsl/scan-add.wgsl.d.ts +6 -0
  192. package/dist/src/wgsl/scan-add.wgsl.d.ts.map +1 -0
  193. package/dist/src/wgsl/scan-add.wgsl.js +14 -0
  194. package/dist/src/wgsl/scan-add.wgsl.js.map +1 -0
  195. package/dist/src/wgsl/scan-block.wgsl.d.ts +8 -0
  196. package/dist/src/wgsl/scan-block.wgsl.d.ts.map +1 -0
  197. package/dist/src/wgsl/scan-block.wgsl.js +30 -0
  198. package/dist/src/wgsl/scan-block.wgsl.js.map +1 -0
  199. package/dist/src/wgsl/segmented-reduce.wgsl.d.ts +22 -8
  200. package/dist/src/wgsl/segmented-reduce.wgsl.d.ts.map +1 -1
  201. package/dist/src/wgsl/segmented-reduce.wgsl.js +84 -15
  202. package/dist/src/wgsl/segmented-reduce.wgsl.js.map +1 -1
  203. package/dist/src/wgsl/spmv-pull.wgsl.d.ts +22 -11
  204. package/dist/src/wgsl/spmv-pull.wgsl.d.ts.map +1 -1
  205. package/dist/src/wgsl/spmv-pull.wgsl.js +110 -36
  206. package/dist/src/wgsl/spmv-pull.wgsl.js.map +1 -1
  207. package/dist/tsconfig.build.tsbuildinfo +1 -1
  208. package/dist/webgpu-graph-algorithms.js +5016 -1130
  209. package/dist/webgpu-graph-algorithms.js.map +1 -1
  210. package/package.json +10 -7
  211. package/src/accelerator.ts +46 -12
  212. package/src/algorithms/components.ts +12 -16
  213. package/src/algorithms/degree.ts +58 -43
  214. package/src/algorithms/pagerank.ts +20 -18
  215. package/src/algorithms/power-iteration.ts +19 -18
  216. package/src/constants.ts +108 -8
  217. package/src/errors.ts +3 -1
  218. package/src/index.ts +25 -5
  219. package/src/kernel/dispatch.ts +18 -7
  220. package/src/kernel/kernel.ts +59 -5
  221. package/src/kernel/prelude.ts +15 -0
  222. package/src/kernel/profiler.ts +28 -4
  223. package/src/kernels.ts +378 -24
  224. package/src/layouts/calibrate.ts +187 -0
  225. package/src/layouts/force-simulation.ts +111 -26
  226. package/src/layouts/forceatlas2.ts +346 -324
  227. package/src/layouts/fruchterman-reingold.ts +918 -0
  228. package/src/layouts/model-common.ts +323 -0
  229. package/src/layouts/repulsion-grid.ts +451 -0
  230. package/src/layouts/spring-electrical.ts +845 -0
  231. package/src/memory/residency.ts +126 -20
  232. package/src/primitives/core-shape.ts +91 -4
  233. package/src/primitives/grid-pyramid.ts +221 -0
  234. package/src/primitives/grid.ts +349 -0
  235. package/src/primitives/histogram.ts +273 -0
  236. package/src/primitives/radix-sort.ts +246 -0
  237. package/src/primitives/scan.ts +197 -0
  238. package/src/primitives/segmented-reduce.ts +214 -56
  239. package/src/primitives/spmv.ts +125 -65
  240. package/src/primitives/verify.ts +249 -0
  241. package/src/types/accelerator.ts +15 -3
  242. package/src/types/context.ts +56 -0
  243. package/src/types/layout.ts +58 -0
  244. package/src/types/options.ts +45 -1
  245. package/src/wgsl/counting-scatter.wgsl.ts +16 -0
  246. package/src/wgsl/fa2-attraction.wgsl.ts +100 -17
  247. package/src/wgsl/fa2-integrate.wgsl.ts +28 -2
  248. package/src/wgsl/fa2-repulsion-exact.wgsl.ts +14 -5
  249. package/src/wgsl/fa2-stats-finalize.wgsl.ts +54 -0
  250. package/src/wgsl/grid-cell-key.wgsl.ts +29 -0
  251. package/src/wgsl/grid-centroid-hub.wgsl.ts +28 -0
  252. package/src/wgsl/grid-centroid.wgsl.ts +28 -0
  253. package/src/wgsl/grid-downsample.wgsl.ts +27 -0
  254. package/src/wgsl/grid-far-field.wgsl.ts +97 -0
  255. package/src/wgsl/grid-near-field.wgsl.ts +128 -0
  256. package/src/wgsl/histogram.wgsl.ts +14 -0
  257. package/src/wgsl/indirect-finalize.wgsl.ts +25 -0
  258. package/src/wgsl/radix-hist.wgsl.ts +30 -0
  259. package/src/wgsl/radix-scatter.wgsl.ts +39 -0
  260. package/src/wgsl/scan-add.wgsl.ts +13 -0
  261. package/src/wgsl/scan-block.wgsl.ts +29 -0
  262. package/src/wgsl/segmented-reduce.wgsl.ts +84 -15
  263. package/src/wgsl/spmv-pull.wgsl.ts +110 -36
  264. package/dist/chunks/context-CRbw2Wyo.js.map +0 -1
@@ -0,0 +1,51 @@
1
+ /**
2
+ * calibrateLayout (spec 2.2, 7.8, D26; contract 3.3): the layout-tier micro-benchmark a consumer runs ONCE, off the
3
+ * critical path, to measure the exact / grid crossover on the actual device. For every probed size it builds a seeded
4
+ * G(n, 10n) snapshot, runs ForceAtlas2 on the exact tier and on the grid tier -- one untimed `step(1)` after
5
+ * `load()` (which warms every pipeline through `PipelineCache.warm` of the model's specs, so the first timed step
6
+ * compiles nothing) and then TIMED_ITERATIONS timed `step(1)` calls whose `stats.msPerIteration` (the profiler's GPU
7
+ * time when "timestamp-query" was granted, else the batch wall time) are averaged -- and releases the probe.
8
+ *
9
+ * PLAN DECISION PD-23 (P4-T14): `src/` cannot import `test/helpers` or `benchmarks/`, so the probe graphs are built
10
+ * here from the package's own LCG (`Lcg`, seed.ts) with a fixed seed, and the spec 7.8 rule is re-implemented in
11
+ * `suggestedExactMaxNodes` below; its twin is `exactMaxNodesFromLadder` in benchmarks/layout-exact.bench.ts (the
12
+ * one copy the G3 / G4 records apply to the committed baselines), which test/layouts/calibrate.test.ts compares it
13
+ * with. The function reads `caps` for nothing: never `caps.software` (spec 7.8, Q-6), so on a software adapter it
14
+ * returns honest numbers a caller can compare in shape, never in value.
15
+ */
16
+ import { type GpuContext } from "../context.js";
17
+ import { type CalibrateOptions, type GpuCalibration } from "../types/layout.js";
18
+ /** The default probe sizes (spec 2.2): the 8k-65k subset of the exact ladder of spec 7.8 / 10.4 T-4. */
19
+ export declare const CALIBRATE_SIZES: readonly number[];
20
+ /**
21
+ * The spec 7.8 rule over the probed sizes (the twin of exactMaxNodesFromLadder(rows, budget, gridRows) in
22
+ * benchmarks/layout-exact.bench.ts, which test/layouts/calibrate.test.ts compares it with): the largest probed n with
23
+ * exactMs(n) <= BUDGET_MS and exactMs(n) <= gridMs(n), rounded down to a power of two.
24
+ *
25
+ * CONTRACT DECISION (the review of P4-T14; spec 2.2 is silent): when NO probed size satisfies the rule -- the grid
26
+ * tier faster than the exact tier at every probe (the RTX 4070 SUPER with the default sizes: the grid beats the exact
27
+ * tier from 4k up), or every probe over the budget -- the benchmark twin throws and hands the value to an owner
28
+ * decision (spec 10.4), which a library call cannot do. The answer here is then the largest power of two STRICTLY
29
+ * BELOW the smallest probe (1 when the smallest probe is 1): the exact tier runs at no probed size, the unprobed range
30
+ * below keeps the exact tier (whose cost falls with n^2 and is the oracle), and the value is distinguishable from a
31
+ * rule answer, which is never below floorPow2(min(sizes)). A caller that wants the crossover itself probes smaller
32
+ * sizes (the T-4 ladder from 1k); one that wants the exact tier nowhere passes `repulsion: "grid"`.
33
+ * @param sizes - the probed sizes (integers >= 1)
34
+ * @param exactMs - ms per iteration of the exact tier per size
35
+ * @param gridMs - ms per iteration of the grid tier per size
36
+ * @returns the suggested exactMaxNodes
37
+ */
38
+ export declare function suggestedExactMaxNodes(sizes: readonly number[], exactMs: Readonly<Record<number, number>>, gridMs: Readonly<Record<number, number>>): number;
39
+ /**
40
+ * Spec 2.2 calibrateLayout, verbatim: measures ms per iteration of the exact and the grid repulsion tier at every
41
+ * probed size on THIS device and suggests `exactMaxNodes` by the spec 7.8 rule (`suggestedExactMaxNodes` above, with
42
+ * its below-the-range answer when no probed size qualifies). Every probe graph is built here and released before the
43
+ * call returns; `firstCallMs` is the wall time of the whole call (pipeline compilation included the first time). The
44
+ * app passes `suggestedExactMaxNodes` through `createAccelerator(ctx, { layout: { exactMaxNodes } })`; the package
45
+ * never calls this implicitly and `"auto"` never depends on `caps.software`.
46
+ * @param ctx - the context (E_DISPOSED / E_DEVICE_LOST through assertReady)
47
+ * @param options - the probe sizes (positive integers; default CALIBRATE_SIZES)
48
+ * @returns the calibration record
49
+ */
50
+ export declare function calibrateLayout(ctx: GpuContext, options?: CalibrateOptions): Promise<GpuCalibration>;
51
+ //# sourceMappingURL=calibrate.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"calibrate.d.ts","sourceRoot":"","sources":["../../../src/layouts/calibrate.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAIH,OAAO,EAAE,KAAK,UAAU,EAAE,MAAM,eAAe,CAAC;AAGhD,OAAO,EAAE,KAAK,gBAAgB,EAAE,KAAK,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAIhF,wGAAwG;AACxG,eAAO,MAAM,eAAe,EAAE,SAAS,MAAM,EAAoC,CAAC;AAqFlF;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,sBAAsB,CAClC,KAAK,EAAE,SAAS,MAAM,EAAE,EACxB,OAAO,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,EACzC,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,GACzC,MAAM,CAQR;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,eAAe,CAAC,GAAG,EAAE,UAAU,EAAE,OAAO,CAAC,EAAE,gBAAgB,GAAG,OAAO,CAAC,cAAc,CAAC,CAgC1G"}
@@ -0,0 +1,172 @@
1
+ /**
2
+ * calibrateLayout (spec 2.2, 7.8, D26; contract 3.3): the layout-tier micro-benchmark a consumer runs ONCE, off the
3
+ * critical path, to measure the exact / grid crossover on the actual device. For every probed size it builds a seeded
4
+ * G(n, 10n) snapshot, runs ForceAtlas2 on the exact tier and on the grid tier -- one untimed `step(1)` after
5
+ * `load()` (which warms every pipeline through `PipelineCache.warm` of the model's specs, so the first timed step
6
+ * compiles nothing) and then TIMED_ITERATIONS timed `step(1)` calls whose `stats.msPerIteration` (the profiler's GPU
7
+ * time when "timestamp-query" was granted, else the batch wall time) are averaged -- and releases the probe.
8
+ *
9
+ * PLAN DECISION PD-23 (P4-T14): `src/` cannot import `test/helpers` or `benchmarks/`, so the probe graphs are built
10
+ * here from the package's own LCG (`Lcg`, seed.ts) with a fixed seed, and the spec 7.8 rule is re-implemented in
11
+ * `suggestedExactMaxNodes` below; its twin is `exactMaxNodesFromLadder` in benchmarks/layout-exact.bench.ts (the
12
+ * one copy the G3 / G4 records apply to the committed baselines), which test/layouts/calibrate.test.ts compares it
13
+ * with. The function reads `caps` for nothing: never `caps.software` (spec 7.8, Q-6), so on a software adapter it
14
+ * returns honest numbers a caller can compare in shape, never in value.
15
+ */
16
+ import { fromEdgeArrays } from "@graphty/graph-format";
17
+ import { WebGpuGraphError } from "../errors.js";
18
+ import { assertDeviceComputes } from "../primitives/verify.js";
19
+ import { createForceAtlas2 } from "./forceatlas2.js";
20
+ import { Lcg } from "./seed.js";
21
+ /** The default probe sizes (spec 2.2): the 8k-65k subset of the exact ladder of spec 7.8 / 10.4 T-4. */
22
+ export const CALIBRATE_SIZES = [8192, 16384, 32768, 65536];
23
+ /** The spec 7.8 per-iteration budget of the exact tier, milliseconds (the twin of EXACT_BUDGET_MS in benchmarks/layout-exact.bench.ts). */
24
+ const BUDGET_MS = 4;
25
+ /** Edges per node of every probe graph (E = 10n, the density of the exact ladder). */
26
+ const EDGES_PER_NODE = 10;
27
+ /** Timed iterations per size and tier (spec 2.2: "10 timed iterations"). */
28
+ const TIMED_ITERATIONS = 10;
29
+ /** The seed of every probe graph and of the simulation's own LCG. */
30
+ const SEED = 12345;
31
+ /**
32
+ * A seeded G(n, 10n) probe snapshot (self-loops and parallels allowed, unweighted, undirected).
33
+ * @param n - the node count
34
+ * @returns the snapshot
35
+ */
36
+ function probeSnapshot(n) {
37
+ const m = EDGES_PER_NODE * n;
38
+ const rng = new Lcg(SEED);
39
+ const src = new Uint32Array(m);
40
+ const dst = new Uint32Array(m);
41
+ for (let e = 0; e < m; e++) {
42
+ src[e] = Math.floor(rng.next() * n);
43
+ dst[e] = Math.floor(rng.next() * n);
44
+ }
45
+ return fromEdgeArrays({ directed: false, nodeCount: n, src, dst }, { label: `calibrate/${n}` });
46
+ }
47
+ /**
48
+ * The mean ms per iteration of one tier at one size: one untimed step after load(), then TIMED_ITERATIONS timed
49
+ * steps (reheat() before each so a settled simulation never short-circuits). With the profiler (a device that granted
50
+ * "timestamp-query") the sample is the GPU time of the iteration's passes, the quantity the spec 7.8 rule reads; without
51
+ * it the sample is the step's wall time, which also carries the JS submit and the 12n-byte readback -- a fixed cost of
52
+ * ~1-2 ms on a discrete card that is the same for either tier, so the wall ratio understates the grid tier's
53
+ * advantage at every size and the crossover it suggests is, if anything, too high.
54
+ * @param ctx - the context
55
+ * @param snapshot - the probe snapshot
56
+ * @param tier - the repulsion tier to force
57
+ * @returns milliseconds per iteration
58
+ */
59
+ async function probeTier(ctx, snapshot, tier) {
60
+ const n = snapshot.nodeCount;
61
+ const positions = new Float32Array(3 * n).fill(Number.NaN);
62
+ const sim = createForceAtlas2(ctx, {
63
+ dim: 2,
64
+ seed: SEED,
65
+ maxIter: 1000000,
66
+ iterationsPerStep: 1,
67
+ maxInFlight: 1,
68
+ repulsion: tier,
69
+ compat: "paper",
70
+ });
71
+ try {
72
+ sim.load(snapshot, positions);
73
+ await sim.step(1);
74
+ let total = 0;
75
+ for (let i = 0; i < TIMED_ITERATIONS; i++) {
76
+ sim.reheat();
77
+ const start = performance.now();
78
+ await sim.step(1);
79
+ const wall = performance.now() - start;
80
+ total += sim.stats.msPerIteration ?? wall;
81
+ }
82
+ return total / TIMED_ITERATIONS;
83
+ }
84
+ finally {
85
+ sim.dispose();
86
+ }
87
+ }
88
+ /**
89
+ * The largest power of two that is <= n (the twin of floorPow2 in benchmarks/layout-exact.bench.ts).
90
+ * @param n - a number >= 1
91
+ * @returns the largest power of two not above n
92
+ */
93
+ function floorPow2(n) {
94
+ let p = 1;
95
+ while (p * 2 <= n) {
96
+ p *= 2;
97
+ }
98
+ return p;
99
+ }
100
+ /**
101
+ * The spec 7.8 rule over the probed sizes (the twin of exactMaxNodesFromLadder(rows, budget, gridRows) in
102
+ * benchmarks/layout-exact.bench.ts, which test/layouts/calibrate.test.ts compares it with): the largest probed n with
103
+ * exactMs(n) <= BUDGET_MS and exactMs(n) <= gridMs(n), rounded down to a power of two.
104
+ *
105
+ * CONTRACT DECISION (the review of P4-T14; spec 2.2 is silent): when NO probed size satisfies the rule -- the grid
106
+ * tier faster than the exact tier at every probe (the RTX 4070 SUPER with the default sizes: the grid beats the exact
107
+ * tier from 4k up), or every probe over the budget -- the benchmark twin throws and hands the value to an owner
108
+ * decision (spec 10.4), which a library call cannot do. The answer here is then the largest power of two STRICTLY
109
+ * BELOW the smallest probe (1 when the smallest probe is 1): the exact tier runs at no probed size, the unprobed range
110
+ * below keeps the exact tier (whose cost falls with n^2 and is the oracle), and the value is distinguishable from a
111
+ * rule answer, which is never below floorPow2(min(sizes)). A caller that wants the crossover itself probes smaller
112
+ * sizes (the T-4 ladder from 1k); one that wants the exact tier nowhere passes `repulsion: "grid"`.
113
+ * @param sizes - the probed sizes (integers >= 1)
114
+ * @param exactMs - ms per iteration of the exact tier per size
115
+ * @param gridMs - ms per iteration of the grid tier per size
116
+ * @returns the suggested exactMaxNodes
117
+ */
118
+ export function suggestedExactMaxNodes(sizes, exactMs, gridMs) {
119
+ let best = 0;
120
+ for (const n of sizes) {
121
+ if (exactMs[n] <= BUDGET_MS && exactMs[n] <= gridMs[n] && n > best) {
122
+ best = n;
123
+ }
124
+ }
125
+ return floorPow2(best === 0 ? Math.max(1, Math.min(...sizes) - 1) : best);
126
+ }
127
+ /**
128
+ * Spec 2.2 calibrateLayout, verbatim: measures ms per iteration of the exact and the grid repulsion tier at every
129
+ * probed size on THIS device and suggests `exactMaxNodes` by the spec 7.8 rule (`suggestedExactMaxNodes` above, with
130
+ * its below-the-range answer when no probed size qualifies). Every probe graph is built here and released before the
131
+ * call returns; `firstCallMs` is the wall time of the whole call (pipeline compilation included the first time). The
132
+ * app passes `suggestedExactMaxNodes` through `createAccelerator(ctx, { layout: { exactMaxNodes } })`; the package
133
+ * never calls this implicitly and `"auto"` never depends on `caps.software`.
134
+ * @param ctx - the context (E_DISPOSED / E_DEVICE_LOST through assertReady)
135
+ * @param options - the probe sizes (positive integers; default CALIBRATE_SIZES)
136
+ * @returns the calibration record
137
+ */
138
+ export async function calibrateLayout(ctx, options) {
139
+ ctx.assertReady();
140
+ await assertDeviceComputes(ctx);
141
+ const sizes = options?.sizes ?? CALIBRATE_SIZES;
142
+ if (!Array.isArray(sizes) || sizes.length === 0 || !sizes.every((n) => Number.isInteger(n) && n >= 1)) {
143
+ throw new WebGpuGraphError("E_INVALID_ARGUMENT", "sizes must be a non-empty list of integers >= 1", {
144
+ argument: "sizes",
145
+ value: sizes,
146
+ expected: "a non-empty list of integers >= 1",
147
+ });
148
+ }
149
+ const start = performance.now();
150
+ const exactMsPerIter = {};
151
+ const gridMsPerIter = {};
152
+ for (const n of sizes) {
153
+ const snapshot = probeSnapshot(n);
154
+ try {
155
+ exactMsPerIter[n] = await probeTier(ctx, snapshot, "exact");
156
+ gridMsPerIter[n] = await probeTier(ctx, snapshot, "grid");
157
+ }
158
+ finally {
159
+ ctx.release(snapshot);
160
+ }
161
+ }
162
+ const largest = Math.max(...sizes);
163
+ const pairs = largest * (largest - 1);
164
+ return {
165
+ pairsPerSecond: (pairs / exactMsPerIter[largest]) * 1000,
166
+ exactMsPerIter,
167
+ gridMsPerIter,
168
+ suggestedExactMaxNodes: suggestedExactMaxNodes(sizes, exactMsPerIter, gridMsPerIter),
169
+ firstCallMs: performance.now() - start,
170
+ };
171
+ }
172
+ //# sourceMappingURL=calibrate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"calibrate.js","sourceRoot":"","sources":["../../../src/layouts/calibrate.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,cAAc,EAAsB,MAAM,uBAAuB,CAAC;AAG3E,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAE/D,OAAO,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACrD,OAAO,EAAE,GAAG,EAAE,MAAM,WAAW,CAAC;AAEhC,wGAAwG;AACxG,MAAM,CAAC,MAAM,eAAe,GAAsB,CAAC,IAAK,EAAE,KAAM,EAAE,KAAM,EAAE,KAAM,CAAC,CAAC;AAElF,2IAA2I;AAC3I,MAAM,SAAS,GAAG,CAAC,CAAC;AAEpB,sFAAsF;AACtF,MAAM,cAAc,GAAG,EAAE,CAAC;AAE1B,4EAA4E;AAC5E,MAAM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,GAAG,MAAM,SAAS,CAAC,GAAG,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC;YAC5D,aAAa,CAAC,CAAC,CAAC,GAAG,MAAM,SAAS,CAAC,GAAG,EAAE,QAAQ,EAAE,MAAM,CAAC,CAAC;QAC9D,CAAC;gBAAS,CAAC;YACP,GAAG,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;QAC1B,CAAC;IACL,CAAC;IACD,MAAM,OAAO,GAAG,IAAI,CAAC,GAAG,CAAC,GAAG,KAAK,CAAC,CAAC;IACnC,MAAM,KAAK,GAAG,OAAO,GAAG,CAAC,OAAO,GAAG,CAAC,CAAC,CAAC;IACtC,OAAO;QACH,cAAc,EAAE,CAAC,KAAK,GAAG,cAAc,CAAC,OAAO,CAAC,CAAC,GAAG,IAAI;QACxD,cAAc;QACd,aAAa;QACb,sBAAsB,EAAE,sBAAsB,CAAC,KAAK,EAAE,cAAc,EAAE,aAAa,CAAC;QACpF,WAAW,EAAE,WAAW,CAAC,GAAG,EAAE,GAAG,KAAK;KACzC,CAAC;AACN,CAAC"}
@@ -14,7 +14,9 @@ import { type PipelineCache } from "../kernel/pipeline-cache.js";
14
14
  import { type UniformBlock, type UniformValues } from "../kernel/struct-block.js";
15
15
  import { UniformRing } from "../kernel/uniform-ring.js";
16
16
  import { type WgslModuleSpec } from "../kernel/wgsl.js";
17
+ import { type BufferPool } from "../memory/buffer-pool.js";
17
18
  import { type CoreBinding } from "../memory/residency.js";
19
+ import { type DegreeTiers } from "../primitives/core-shape.js";
18
20
  import { type PlanCaps } from "../types/context.js";
19
21
  import { type GpuLayoutSimulation, type LayoutStatsBase, type ResolvedLayoutTuning, type RunOptions } from "../types/layout.js";
20
22
  import { type Binding } from "../types/memory.js";
@@ -40,7 +42,14 @@ export interface ModelResources {
40
42
  readonly caps: PlanCaps;
41
43
  readonly pipelines: PipelineCache;
42
44
  readonly core: CoreBinding;
45
+ /** `tiers.perm`, or null when no row has degree >= 32 (P4 PD-7: the rowPtr dummy is bound and USE_PERM is false). */
43
46
  readonly perm: Binding | null;
47
+ /**
48
+ * The degree tiers of the snapshot's degreeOrder view (the perm binding and the CPU-side segment offsets
49
+ * [0, hiEnd, midEnd, lowEnd, n]), or null when no row has degree >= 32 -- then every K2 dispatch is the
50
+ * thread-per-row TIER 0 over node indices, as before P4.
51
+ */
52
+ readonly tiers: DegreeTiers | null;
44
53
  /**
45
54
  * The RESOLVED weights binding (model.inputs(): source "arcs" -> core.weights (null on an unweighted snapshot),
46
55
  * "column" -> the registered ArrayBinding's binding, "none" -> null); group 0 is built as
@@ -51,6 +60,8 @@ export interface ModelResources {
51
60
  readonly dim: 2 | 3;
52
61
  readonly tier: "exact" | "grid";
53
62
  readonly ring: UniformRing;
63
+ /** The context's buffer pool (the grid stage's lease of sort scratch draws on it, P4 PD-11). */
64
+ readonly pool: BufferPool;
54
65
  /** A shared or model-owned buffer by name: "positions", "scenePositions", "fixed", "partials", "state", "trace", plus every BufferSpec name. */
55
66
  buffer(name: string): Binding;
56
67
  }
@@ -58,6 +69,8 @@ export interface ModelResources {
58
69
  export interface ModelInputs {
59
70
  readonly mass: F32;
60
71
  readonly weights: ResolvedWeights;
72
+ /** A mask to apply at load (the FR `fixed` option, PD-6); validated against `ceil(n / 32)` words; absent / null leaves the words as they are (kept on a same-size reload, cleared on a resize, spec 7.12). */
73
+ readonly fixed?: NodeMask | null | undefined;
61
74
  }
62
75
  /**
63
76
  * Spec 7.19 ForceModel (kind, buffers, overrides, paramsFor, recordIteration, onLoad, onReheat, onSetParams,
@@ -96,7 +109,17 @@ export interface ForceModel<Options, Stats extends LayoutStatsBase> {
96
109
  onReheat(state: StateWriter): void;
97
110
  onSetParams(patch: Partial<Options>, state: StateWriter): void;
98
111
  readStats(state: DataView, trace: DataView): Stats;
112
+ /** Releases what the model holds outside the simulation's buffers (the grid stage's lease, P4-T10); called by dispose() once every in-flight batch has settled. */
113
+ dispose?(): void;
99
114
  }
115
+ /**
116
+ * The repulsion tier of a node count under a tuning (PLAN DECISION 11; spec 7.8: `"auto"` by `n` alone). Exported
117
+ * so a model's `buffers(n, dim)` decides the tier by the same rule `load()` applies (P4 PD-18).
118
+ * @param tuning - the resolved tuning
119
+ * @param n - the node count
120
+ * @returns "exact" or "grid"
121
+ */
122
+ export declare function tierFor(tuning: ResolvedLayoutTuning, n: number): "exact" | "grid";
100
123
  /**
101
124
  * The shared layout state machine (spec 7.19): buffers, in-flight batches, readback, settle window, fixed mask,
102
125
  * setPosition overrides, trace, batch driver; consumes a ForceModel by composition.
@@ -144,6 +167,7 @@ export declare class ForceSimulation<Options extends CommonLayoutOptions & Simul
144
167
  private settledValue;
145
168
  private firstPending;
146
169
  private statsValue;
170
+ private lastPassTimingsValue;
147
171
  private lastSubmittedBatchIdValue;
148
172
  /** The id of the last batch submitted BEFORE the most recent reheat() (PLAN DECISION 21); 0 = none. */
149
173
  private reheatedAfterBatchId;
@@ -169,7 +193,7 @@ export declare class ForceSimulation<Options extends CommonLayoutOptions & Simul
169
193
  */
170
194
  get options(): Options;
171
195
  /**
172
- * The repulsion tier of the current load ("exact" until P4 lifts the grid tier).
196
+ * The repulsion tier of the current load (spec 7.8).
173
197
  * @returns the tier
174
198
  */
175
199
  get tier(): "exact" | "grid";
@@ -320,7 +344,10 @@ export declare class ForceSimulation<Options extends CommonLayoutOptions & Simul
320
344
  */
321
345
  private copyScene;
322
346
  /**
323
- * The batch's duration in milliseconds: the profiler's pass timings summed when present, else wall time.
347
+ * The batch's duration in milliseconds: the profiler's pass timings summed when present and complete, else wall
348
+ * time. The profiler budgets PROFILER_QUERY_SLOTS / 2 passes per batch; the grid tier records three passes per
349
+ * iteration (P4 PD-16), so a grid batch above (PROFILER_QUERY_SLOTS / 2 - 1) / 3 iterations is timed partially:
350
+ * its rows stay in `lastPassTimings` but the duration is the wall time, never the sum of a prefix.
324
351
  * @param record - the batch
325
352
  * @param bytes - its readback (the profiler's resolve lands in it)
326
353
  * @returns milliseconds
@@ -350,7 +377,7 @@ export declare class ForceSimulation<Options extends CommonLayoutOptions & Simul
350
377
  * The uniform values of one iteration slot: the model's values with the shared fields on top (PLAN DECISION 6).
351
378
  * @param global - the global iteration index (iterationsSubmitted + i)
352
379
  * @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
380
+ * @param flags - FA2_FLAG_FIRST for the first iteration after load(), else 0; the model's own flag bits are OR-ed in
354
381
  * @returns the values
355
382
  */
356
383
  private paramsForSlot;
@@ -448,6 +475,7 @@ export declare class ForceSimulation<Options extends CommonLayoutOptions & Simul
448
475
  /**
449
476
  * The ModelResources of a load.
450
477
  * @param core - the core
478
+ * @param tiers - the degree tiers, or null when no row has degree >= 32
451
479
  * @param weights - the resolved weights binding
452
480
  * @param buffers - the buffers
453
481
  * @returns the resources
@@ -465,14 +493,23 @@ export declare class ForceSimulation<Options extends CommonLayoutOptions & Simul
465
493
  */
466
494
  private startBind;
467
495
  /**
468
- * warm(model.specs()) then model.bind(); the await re-checks that the load is current before binding.
496
+ * assertDeviceComputes() then warm(model.specs()) then model.bind(); the await re-checks that the load is
497
+ * current before binding.
498
+ *
499
+ * The device self-check sits HERE rather than in submitBatch (its first home) because this promise is the one
500
+ * submitBatch already awaits before every batch: the check is therefore settled before the simulation can
501
+ * submit a single iteration, yet costs the frame loop nothing per batch. An extra await on the per-batch path
502
+ * moves the moment a submission becomes visible to a step() issued in the same tick, which is precisely what
503
+ * coalescing is measured on (test/layouts/frame-loop.test.ts, "a coalesced step() returns the same promise").
504
+ * A device that computes incorrectly rejects this promise, so the first step() rejects E_DEVICE_INCORRECT
505
+ * before any position is written; a check that could not RUN rejects with its own error, unchanged.
469
506
  * @param resources - the resources
470
507
  * @param overrides - the merged override set
471
508
  * @param generation - the generation the bind belongs to
472
509
  */
473
510
  private compileAndBind;
474
511
  /**
475
- * inspect(name): flush, read the named buffer back, Uint32Array for "fixed" and "trace", Float32Array otherwise.
512
+ * inspect(name): flush, read the named buffer back, Uint32Array for the u32 buffers (U32_BUFFER_NAMES), Float32Array otherwise.
476
513
  * @param name - a shared or BufferSpec name
477
514
  * @returns the words
478
515
  */
@@ -1 +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,MAAM,wBAAwB,CAAC;AAC7E,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AACpD,OAAO,EACH,KAAK,mBAAmB,EACxB,KAAK,eAAe,EACpB,KAAK,oBAAoB,EACzB,KAAK,UAAU,EAClB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,KAAK,mBAAmB,EAAE,KAAK,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACvF,OAAO,EAAE,KAAK,eAAe,EAAE,MAAM,aAAa,CAAC;AAKnD,mGAAmG;AACnG,MAAM,WAAW,UAAU;IACvB,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,KAAK,EAAE,MAAM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