@graphty/webgpu-graph-algorithms 0.6.4 → 0.6.6

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 (147) hide show
  1. package/README.md +38 -17
  2. package/dist/browser.js +1 -1
  3. package/dist/chunks/{context-Dvq-Cc6v.js → context-DiSr6eiz.js} +45 -33
  4. package/dist/chunks/context-DiSr6eiz.js.map +1 -0
  5. package/dist/node.js +1 -1
  6. package/dist/src/algorithms/bfs.d.ts +11 -7
  7. package/dist/src/algorithms/bfs.d.ts.map +1 -1
  8. package/dist/src/algorithms/bfs.js +33 -10
  9. package/dist/src/algorithms/bfs.js.map +1 -1
  10. package/dist/src/algorithms/scope.d.ts +3 -3
  11. package/dist/src/algorithms/scope.d.ts.map +1 -1
  12. package/dist/src/algorithms/scope.js +0 -2
  13. package/dist/src/algorithms/scope.js.map +1 -1
  14. package/dist/src/algorithms/sssp.d.ts +4 -3
  15. package/dist/src/algorithms/sssp.d.ts.map +1 -1
  16. package/dist/src/algorithms/sssp.js +4 -3
  17. package/dist/src/algorithms/sssp.js.map +1 -1
  18. package/dist/src/constants.d.ts +33 -2
  19. package/dist/src/constants.d.ts.map +1 -1
  20. package/dist/src/constants.js +33 -2
  21. package/dist/src/constants.js.map +1 -1
  22. package/dist/src/kernel/dispatch.d.ts +2 -2
  23. package/dist/src/kernel/dispatch.d.ts.map +1 -1
  24. package/dist/src/kernel/kernel.d.ts +1 -1
  25. package/dist/src/kernel/kernel.js +2 -2
  26. package/dist/src/kernel/kernel.js.map +1 -1
  27. package/dist/src/kernel/prelude.d.ts.map +1 -1
  28. package/dist/src/kernel/prelude.js +2 -1
  29. package/dist/src/kernel/prelude.js.map +1 -1
  30. package/dist/src/kernels.d.ts +15 -11
  31. package/dist/src/kernels.d.ts.map +1 -1
  32. package/dist/src/kernels.js +42 -21
  33. package/dist/src/kernels.js.map +1 -1
  34. package/dist/src/layouts/forceatlas2.d.ts.map +1 -1
  35. package/dist/src/layouts/forceatlas2.js +2 -1
  36. package/dist/src/layouts/forceatlas2.js.map +1 -1
  37. package/dist/src/layouts/fruchterman-reingold.d.ts.map +1 -1
  38. package/dist/src/layouts/fruchterman-reingold.js +4 -2
  39. package/dist/src/layouts/fruchterman-reingold.js.map +1 -1
  40. package/dist/src/layouts/repulsion-exact.d.ts +16 -0
  41. package/dist/src/layouts/repulsion-exact.d.ts.map +1 -1
  42. package/dist/src/layouts/repulsion-exact.js +21 -1
  43. package/dist/src/layouts/repulsion-exact.js.map +1 -1
  44. package/dist/src/layouts/repulsion-grid.d.ts +1 -1
  45. package/dist/src/layouts/repulsion-grid.js +1 -1
  46. package/dist/src/layouts/spring-electrical.d.ts.map +1 -1
  47. package/dist/src/layouts/spring-electrical.js +6 -2
  48. package/dist/src/layouts/spring-electrical.js.map +1 -1
  49. package/dist/src/primitives/advance.d.ts +3 -2
  50. package/dist/src/primitives/advance.d.ts.map +1 -1
  51. package/dist/src/primitives/advance.js.map +1 -1
  52. package/dist/src/primitives/frontier.d.ts +34 -38
  53. package/dist/src/primitives/frontier.d.ts.map +1 -1
  54. package/dist/src/primitives/frontier.js +24 -32
  55. package/dist/src/primitives/frontier.js.map +1 -1
  56. package/dist/src/primitives/grid-pyramid.d.ts +4 -4
  57. package/dist/src/primitives/grid-pyramid.d.ts.map +1 -1
  58. package/dist/src/primitives/grid-pyramid.js +4 -3
  59. package/dist/src/primitives/grid-pyramid.js.map +1 -1
  60. package/dist/src/primitives/grid.d.ts +13 -10
  61. package/dist/src/primitives/grid.d.ts.map +1 -1
  62. package/dist/src/primitives/grid.js +10 -7
  63. package/dist/src/primitives/grid.js.map +1 -1
  64. package/dist/src/wgsl/advance-expand.wgsl.d.ts +4 -3
  65. package/dist/src/wgsl/advance-expand.wgsl.d.ts.map +1 -1
  66. package/dist/src/wgsl/advance-expand.wgsl.js +4 -3
  67. package/dist/src/wgsl/advance-expand.wgsl.js.map +1 -1
  68. package/dist/src/wgsl/bfs-bottom-up.wgsl.d.ts +4 -3
  69. package/dist/src/wgsl/bfs-bottom-up.wgsl.d.ts.map +1 -1
  70. package/dist/src/wgsl/bfs-bottom-up.wgsl.js +4 -3
  71. package/dist/src/wgsl/bfs-bottom-up.wgsl.js.map +1 -1
  72. package/dist/src/wgsl/bfs-fused.wgsl.d.ts +6 -6
  73. package/dist/src/wgsl/bfs-fused.wgsl.d.ts.map +1 -1
  74. package/dist/src/wgsl/bfs-fused.wgsl.js +6 -6
  75. package/dist/src/wgsl/bfs-next-degree.wgsl.d.ts +23 -0
  76. package/dist/src/wgsl/bfs-next-degree.wgsl.d.ts.map +1 -0
  77. package/dist/src/wgsl/bfs-next-degree.wgsl.js +34 -0
  78. package/dist/src/wgsl/bfs-next-degree.wgsl.js.map +1 -0
  79. package/dist/src/wgsl/fa2-repulsion-exact.wgsl.d.ts +4 -1
  80. package/dist/src/wgsl/fa2-repulsion-exact.wgsl.d.ts.map +1 -1
  81. package/dist/src/wgsl/fa2-repulsion-exact.wgsl.js +18 -2
  82. package/dist/src/wgsl/fa2-repulsion-exact.wgsl.js.map +1 -1
  83. package/dist/src/wgsl/fa2-stats-finalize.wgsl.d.ts +1 -1
  84. package/dist/src/wgsl/fa2-stats-finalize.wgsl.d.ts.map +1 -1
  85. package/dist/src/wgsl/fa2-stats-finalize.wgsl.js +4 -2
  86. package/dist/src/wgsl/fa2-stats-finalize.wgsl.js.map +1 -1
  87. package/dist/src/wgsl/frontier-finalize.wgsl.d.ts +44 -49
  88. package/dist/src/wgsl/frontier-finalize.wgsl.d.ts.map +1 -1
  89. package/dist/src/wgsl/frontier-finalize.wgsl.js +62 -107
  90. package/dist/src/wgsl/frontier-finalize.wgsl.js.map +1 -1
  91. package/dist/src/wgsl/grid-cell-key.wgsl.d.ts +3 -2
  92. package/dist/src/wgsl/grid-cell-key.wgsl.d.ts.map +1 -1
  93. package/dist/src/wgsl/grid-cell-key.wgsl.js +4 -2
  94. package/dist/src/wgsl/grid-cell-key.wgsl.js.map +1 -1
  95. package/dist/src/wgsl/grid-centroid.wgsl.d.ts +3 -2
  96. package/dist/src/wgsl/grid-centroid.wgsl.d.ts.map +1 -1
  97. package/dist/src/wgsl/grid-centroid.wgsl.js +3 -2
  98. package/dist/src/wgsl/grid-centroid.wgsl.js.map +1 -1
  99. package/dist/src/wgsl/grid-downsample.wgsl.d.ts +1 -1
  100. package/dist/src/wgsl/grid-downsample.wgsl.js +1 -1
  101. package/dist/src/wgsl/grid-far-field.wgsl.d.ts +6 -4
  102. package/dist/src/wgsl/grid-far-field.wgsl.d.ts.map +1 -1
  103. package/dist/src/wgsl/grid-far-field.wgsl.js +15 -8
  104. package/dist/src/wgsl/grid-far-field.wgsl.js.map +1 -1
  105. package/dist/src/wgsl/grid-near-field.wgsl.d.ts +2 -2
  106. package/dist/src/wgsl/grid-near-field.wgsl.d.ts.map +1 -1
  107. package/dist/src/wgsl/grid-near-field.wgsl.js +6 -2
  108. package/dist/src/wgsl/grid-near-field.wgsl.js.map +1 -1
  109. package/dist/src/wgsl/histogram.wgsl.d.ts +1 -1
  110. package/dist/src/wgsl/histogram.wgsl.js +1 -1
  111. package/dist/webgpu-graph-algorithms.js +144 -119
  112. package/dist/webgpu-graph-algorithms.js.map +1 -1
  113. package/package.json +3 -3
  114. package/src/algorithms/bfs.ts +34 -10
  115. package/src/algorithms/pagerank.ts +19 -5
  116. package/src/algorithms/power-iteration.ts +8 -2
  117. package/src/algorithms/scope.ts +3 -10
  118. package/src/algorithms/sssp.ts +4 -3
  119. package/src/constants.ts +35 -2
  120. package/src/kernel/dispatch.ts +2 -2
  121. package/src/kernel/kernel.ts +2 -2
  122. package/src/kernel/prelude.ts +2 -0
  123. package/src/kernels.ts +44 -21
  124. package/src/layouts/forceatlas2.ts +2 -0
  125. package/src/layouts/fruchterman-reingold.ts +4 -1
  126. package/src/layouts/repulsion-exact.ts +29 -1
  127. package/src/layouts/repulsion-grid.ts +1 -1
  128. package/src/layouts/spring-electrical.ts +8 -1
  129. package/src/memory/residency.ts +14 -4
  130. package/src/primitives/advance.ts +5 -4
  131. package/src/primitives/frontier.ts +42 -56
  132. package/src/primitives/grid-pyramid.ts +6 -5
  133. package/src/primitives/grid.ts +17 -12
  134. package/src/wgsl/advance-expand.wgsl.ts +4 -3
  135. package/src/wgsl/bfs-bottom-up.wgsl.ts +4 -3
  136. package/src/wgsl/bfs-fused.wgsl.ts +6 -6
  137. package/src/wgsl/bfs-next-degree.wgsl.ts +33 -0
  138. package/src/wgsl/fa2-repulsion-exact.wgsl.ts +18 -2
  139. package/src/wgsl/fa2-stats-finalize.wgsl.ts +4 -2
  140. package/src/wgsl/frontier-finalize.wgsl.ts +62 -107
  141. package/src/wgsl/grid-cell-key.wgsl.ts +4 -2
  142. package/src/wgsl/grid-centroid.wgsl.ts +3 -2
  143. package/src/wgsl/grid-downsample.wgsl.ts +1 -1
  144. package/src/wgsl/grid-far-field.wgsl.ts +15 -8
  145. package/src/wgsl/grid-near-field.wgsl.ts +6 -2
  146. package/src/wgsl/histogram.wgsl.ts +1 -1
  147. package/dist/chunks/context-Dvq-Cc6v.js.map +0 -1
@@ -30,7 +30,8 @@
30
30
  import { type Kernel } from "../kernel/kernel.js";
31
31
  import { type CoreBinding } from "../memory/residency.js";
32
32
  import { type CoreWindow } from "./core-shape.js";
33
- import { type Frontier, type FrontierScope } from "./frontier.js";
33
+ import { type Frontier } from "./frontier.js";
34
+ import { type ReduceScope } from "./reduce.js";
34
35
  /** A prepared advance (design 6 row 8): records one expansion of a frontier per level. */
35
36
  export interface AdvancePlanner {
36
37
  /** The compiled `advance-expand` kernel (so `bfs-fused` can share its bind groups' shape). */
@@ -58,5 +59,5 @@ export interface AdvancePlanner {
58
59
  * @param core - the resident core arrays of the snapshot the frontier walks (windowed or not)
59
60
  * @returns the planner
60
61
  */
61
- export declare function prepareAdvance(scope: FrontierScope, core: CoreBinding): Promise<AdvancePlanner>;
62
+ export declare function prepareAdvance(scope: ReduceScope, core: CoreBinding): Promise<AdvancePlanner>;
62
63
  //# sourceMappingURL=advance.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"advance.d.ts","sourceRoot":"","sources":["../../../src/primitives/advance.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAIH,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAElD,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAAE,KAAK,UAAU,EAA2B,MAAM,iBAAiB,CAAC;AAC3E,OAAO,EAAE,KAAK,QAAQ,EAAE,KAAK,aAAa,EAAE,MAAM,eAAe,CAAC;AAElE,0FAA0F;AAC1F,MAAM,WAAW,cAAc;IAC3B,8FAA8F;IAC9F,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,6GAA6G;IAC7G,QAAQ,CAAC,OAAO,EAAE,SAAS,UAAU,EAAE,CAAC;IACxC;;;;;;;;;;OAUG;IACH,MAAM,CAAC,IAAI,EAAE,qBAAqB,EAAE,QAAQ,EAAE,QAAQ,GAAG,IAAI,CAAC;CACjE;AAED;;;;;;;GAOG;AACH,wBAAsB,cAAc,CAAC,KAAK,EAAE,aAAa,EAAE,IAAI,EAAE,WAAW,GAAG,OAAO,CAAC,cAAc,CAAC,CAGrG"}
1
+ {"version":3,"file":"advance.d.ts","sourceRoot":"","sources":["../../../src/primitives/advance.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AAIH,OAAO,EAAE,KAAK,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAElD,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAC1D,OAAO,EAAE,KAAK,UAAU,EAA2B,MAAM,iBAAiB,CAAC;AAC3E,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,eAAe,CAAC;AAC9C,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,aAAa,CAAC;AAE/C,0FAA0F;AAC1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C,QAAQ;gBAC3B,SAAS,EAAE,QAAQ,CAAC,SAAS;gBAC7B,CAAC,EAAE,MAAM,CAAC,OAAO;aACpB,CAAC,CAAC;YACH,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC;QAC7D,CAAC;IACL,CAAC;CACJ"}
@@ -1,38 +1,40 @@
1
1
  /**
2
2
  * The `Frontier` of design 6 row 7 and the device-side dispatch selector of design 5.4 (P8-T4; the P8 plan's PD-1,
3
- * PD-3, PD-8, PD-23, DEP-P8-A, DEP-P8-C). A traversal's per-level state is two n-slot vertex queues, ONE 24-word
3
+ * PD-3, PD-8, PD-23, DEP-P8-A, DEP-P8-C). A traversal's per-level state is two n-slot vertex queues, ONE 25-word
4
4
  * counters block (every counter of the phase is a word of it: a four-byte word is never a legal storage-binding
5
- * offset, and the selector must reach every count it acts on through one binding), the indirect args buffer of
6
- * `MAX_LEVELS_PER_SUBMIT x FRONTIER_CANDIDATES` 16-byte slots, and the edge queue. The host never reads a counter
7
- * inside a submit: `frontier-finalize`, one lane, runs at the START of every level (role 0: rotates
8
- * `nextFrontierCount` into `frontierCount`, advances `level`, decides `done`, writes this level's slots) and again once
9
- * the edge queue is filled (role 1: clamps `edgeCount`, sizes the contract slot, or on an overflow --
10
- * `edgeCountUnclamped > edgeCapacity` -- sizes the fused-retry slot instead, PD-23), and the kernels that follow
11
- * dispatch indirectly from those slots. The host records up to `MAX_LEVELS_PER_SUBMIT` levels per submit and reads
12
- * `done` (four bytes) once per submit; a boundary that finds `done` set zeroes its slots and moves no counter, so the
13
- * recorded levels past the end are no-ops and the counters freeze at the finishing boundary's values.
5
+ * offset, and the selector must reach every count it acts on through one binding) and the edge queue. The host
6
+ * never reads a counter inside a submit: `frontier-finalize`, one lane, runs at the START of every level (role 0:
7
+ * rotates `nextFrontierCount` into `frontierCount`, advances `level`, decides `done`, chooses the level's path) and
8
+ * again once the edge queue is filled (role 1: clamps `edgeCount`, or on an overflow -- `edgeCountUnclamped >
9
+ * edgeCapacity` -- switches the path to the fused retry, PD-23). The choice is the block's `path` word (`W.path`,
10
+ * word 24); every level kernel is a direct grid-stride dispatch that reads it first and does nothing unless the
11
+ * word names it (design/decisions/2026-09-25-frontier-kernels-dispatch-directly.md: the seven indirect slots the
12
+ * selector once wrote per level cost about 0.4 ms of Dawn validation each and were 97 % of a traversal's wall
13
+ * time; they and their args buffer are gone). The host records up to `MAX_LEVELS_PER_SUBMIT` levels per submit and
14
+ * reads `done` (four bytes) once per submit; a boundary that finds `done` set writes path 0 and moves no counter,
15
+ * so the recorded levels past the end are no-ops and the counters freeze at the finishing boundary's values.
14
16
  *
15
17
  * The seed: `frontierCount` is NEVER seeded, because the first boundary rotates it out unread. A BFS driver calls
16
18
  * `reset(queue, source, { nextFrontierCount: 1, level: U32_MAX })`: the first boundary rotates the 1 in, adds it into
17
19
  * `visitedCount`, and wraps `level` to 0, so the level-0 expansion claims the source's neighbours at `level + 1 == 1`.
18
20
  * `reset` is a queue write, ordered before the submit that follows, and it puts the source on side 0.
19
21
  *
20
- * Every buffer comes from the caller's ONE lease (`scope.scratch`, `scope.indirect`) so the algorithm's dispose()
22
+ * Every buffer comes from the caller's ONE lease (`scope.scratch`) so the algorithm's dispose()
21
23
  * releases them together (design 4.4). The two vertex queues are two BUFFERS, never two ranges of one: `Kernel.bind`
22
24
  * rejects one buffer bound read-only and read-write in one dispatch even for disjoint ranges. `src/primitives/**`
23
25
  * never imports `src/context.ts`.
24
26
  */
25
27
  import { type Binding } from "../types/memory.js";
26
28
  import { type ReduceScope } from "./reduce.js";
27
- /** The seven indirect slots of one level (`FRONTIER_CANDIDATES`), by the kernel that dispatches from each. */
28
- export declare const SLOT: Readonly<{
29
- expand: 0;
30
- contract: 1;
29
+ /** The values of the `path` word (`W.path`): what a level's kernels run; every level kernel reads it first. */
30
+ export declare const PATH: Readonly<{
31
+ none: 0;
32
+ twoPhase: 1;
31
33
  fused: 2;
32
- fillBits: 3;
33
- bitset: 4;
34
- bottomUp: 5;
35
- fusedRetry: 6;
34
+ bottomUp: 3;
35
+ fusedRetry: 4;
36
+ near: 5;
37
+ far: 6;
36
38
  }>;
37
39
  /** The words of the counters block (`FRONTIER_COUNTERS`), by index: byte offset 4 x word; no driver types a number. */
38
40
  export declare const W: Readonly<{
@@ -61,24 +63,18 @@ export declare const W: Readonly<{
61
63
  thresholdBits: 22;
62
64
  deltaBits: 23;
63
65
  path: 24;
66
+ nextDegreeSum: 25;
64
67
  }>;
65
68
  /** The words a `reset` seeds (every other word is zeroed). */
66
69
  export type FrontierSeed = Readonly<Partial<Record<keyof typeof W, number>>>;
67
- /** A ReduceScope that can also lease an INDIRECT buffer (the args of the frontier); `algorithmScope` is one. */
68
- export interface FrontierScope extends ReduceScope {
69
- /** A STORAGE | INDIRECT | COPY_DST | COPY_SRC buffer of the scope's lease. */
70
- indirect(byteLength: number, label: string): GPUBuffer;
71
- }
72
- /** The `FrontierParams` fields a caller passes to `recordFinalize`; the planner fills `role`, `slotBase`, `wg`, `edgeCapacity` and `n` itself. A missing field is written as 0. */
70
+ /** The `FrontierParams` fields a caller passes to `recordFinalize`; the planner fills `role`, `wg`, `edgeCapacity` and `n` itself. A missing field is written as 0. */
73
71
  export type FrontierFinalizeFields = Readonly<Partial<Record<"alpha" | "beta" | "fusedMax" | "maxDepth" | "mode" | "cutoffBits" | "arcBase" | "arcEnd" | "predKind" | "bitsBase" | "source" | "stride" | "firstOfSubmit" | "iteration", number>>>;
74
- /** The frontier queue of design 6 row 7: two vertex queues, the counters block, the args buffer and the edge queue, all leased by the caller's scope. */
72
+ /** The frontier queue of design 6 row 7: two vertex queues, the counters block and the edge queue, all leased by the caller's scope. */
75
73
  export declare class Frontier {
76
74
  /** The two n-slot u32 vertex queues (`vertices[side]` is the input of the current level). */
77
75
  readonly vertices: readonly [Binding, Binding];
78
- /** The `FrontierCounters` block, 96 B, bound by every kernel as `array<atomic<u32>>`. */
76
+ /** The `FrontierCounters` block, 112 B, bound by every kernel as `array<atomic<u32>>`. */
79
77
  readonly counters: Binding;
80
- /** The indirect args, `MAX_LEVELS_PER_SUBMIT x FRONTIER_CANDIDATES` 16-byte slots (usage INDIRECT | STORAGE | COPY_DST | COPY_SRC). */
81
- readonly args: Binding;
82
78
  /** The edge queue: `edgeCapacity` entries of u32 (the target vertex of an arc). */
83
79
  readonly edgeQueue: Binding;
84
80
  /** How many entries the edge queue holds; role 1 clamps `edgeCount` to it and detects an overflow above it. */
@@ -90,12 +86,11 @@ export declare class Frontier {
90
86
  * Wraps the leased buffers; use prepareFrontier().
91
87
  * @param vertices - the two vertex queues
92
88
  * @param counters - the counters block
93
- * @param args - the args buffer
94
89
  * @param edgeQueue - the edge queue
95
90
  * @param edgeCapacity - the edge queue's entry count
96
91
  * @param n - the vertex count
97
92
  */
98
- constructor(vertices: readonly [Binding, Binding], counters: Binding, args: Binding, edgeQueue: Binding, edgeCapacity: number, n: number);
93
+ constructor(vertices: readonly [Binding, Binding], counters: Binding, edgeQueue: Binding, edgeCapacity: number, n: number);
99
94
  /**
100
95
  * Which vertex queue is the input of the current level (a host-side index between two cached bind-group sets).
101
96
  * @returns 0 or 1
@@ -114,7 +109,7 @@ export declare class Frontier {
114
109
  /** Flips the two vertex queues; the counts rotate inside the block, so nothing else moves. */
115
110
  swap(): void;
116
111
  /**
117
- * Seeds a traversal: one `queue.writeBuffer` of the whole 96-byte block (zero except the caller's words) and one of
112
+ * Seeds a traversal: one `queue.writeBuffer` of the whole 112-byte block (zero except the caller's words) and one of
118
113
  * `vertices[0][0] = source`, both ordered before the submit that follows; the source is on side 0 afterwards.
119
114
  * `frontierCount` is not a word to seed: the first boundary rotates word 1 into it (the BFS seed is
120
115
  * `{ nextFrontierCount: 1, level: U32_MAX }`). A source outside `[0, n)`, an unknown word or a value that is not a
@@ -127,13 +122,14 @@ export declare class Frontier {
127
122
  }
128
123
  /** A prepared frontier (design 6 row 7): the leased queue and the recorded selector dispatches. */
129
124
  export interface FrontierPlanner {
130
- /** The queue the planner sizes the slots of. */
125
+ /** The queue the planner's selector rotates and chooses the path of. */
131
126
  readonly frontier: Frontier;
132
127
  /**
133
128
  * Records one `frontier-finalize` dispatch (one workgroup) in `role` for `level` of the current submit: one
134
- * `FrontierParams` record with `slotBase = level x FRONTIER_CANDIDATES`, `wg`, `edgeCapacity` and `n` filled by the
135
- * planner and every other field from `fields`. A level outside `[0, MAX_LEVELS_PER_SUBMIT)` or a role outside
136
- * `[0, 3]` is E_INVALID_ARGUMENT before anything is recorded.
129
+ * `FrontierParams` record with `wg`, `edgeCapacity` and `n` filled by the planner and every other field from
130
+ * `fields`. A level outside `[0, MAX_LEVELS_PER_SUBMIT)` (the selector addresses nothing by level any more, but
131
+ * the host's submit cadence still is the bound) or a role outside `[0, 3]` is E_INVALID_ARGUMENT before
132
+ * anything is recorded.
137
133
  * @param pass - the compute pass
138
134
  * @param role - 0 the level boundary, 1 the edge-queue role (2 and 3 are P8-T9's)
139
135
  * @param level - the level inside the submit
@@ -146,11 +142,11 @@ export interface FrontierPlanner {
146
142
  * edge capacity defaults to `max(1, min(arcCount, floor(maxStorageBufferBindingSize / 4)))` (never a zero-length
147
143
  * buffer: the one-node graph has no arcs); a test passes a small one to force the overflow path. The planner lives
148
144
  * exactly as long as the scope: never use it after the scope's dispose().
149
- * @param scope - the caller's scope (device, caps, cache, scratch, indirect, params)
145
+ * @param scope - the caller's scope (device, caps, cache, scratch, params)
150
146
  * @param n - the vertex count
151
147
  * @param arcCount - the arc count (the natural edge-queue size)
152
148
  * @param edgeCapacity - the edge queue's entry count, when the caller chooses it (an integer >= 1)
153
149
  * @returns the planner
154
150
  */
155
- export declare function prepareFrontier(scope: FrontierScope, n: number, arcCount: number, edgeCapacity?: number): Promise<FrontierPlanner>;
151
+ export declare function prepareFrontier(scope: ReduceScope, n: number, arcCount: number, edgeCapacity?: number): Promise<FrontierPlanner>;
156
152
  //# sourceMappingURL=frontier.d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IACH,cAAc,CAAC,IAAI,EAAE,qBAAqB,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,MAAM,EAAE,sBAAsB,GAAG,IAAI,CAAC;CAClH;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,eAAe,CACjC,KAAK,EAAE,WAAW,EAClB,CAAC,EAAE,MAAM,EACT,QAAQ,EAAE,MAAM,EAChB,YAAY,CAAC,EAAE,MAAM,GACtB,OAAO,CAAC,eAAe,CAAC,CAgC1B"}
@@ -1,34 +1,35 @@
1
1
  /**
2
2
  * The `Frontier` of design 6 row 7 and the device-side dispatch selector of design 5.4 (P8-T4; the P8 plan's PD-1,
3
- * PD-3, PD-8, PD-23, DEP-P8-A, DEP-P8-C). A traversal's per-level state is two n-slot vertex queues, ONE 24-word
3
+ * PD-3, PD-8, PD-23, DEP-P8-A, DEP-P8-C). A traversal's per-level state is two n-slot vertex queues, ONE 25-word
4
4
  * counters block (every counter of the phase is a word of it: a four-byte word is never a legal storage-binding
5
- * offset, and the selector must reach every count it acts on through one binding), the indirect args buffer of
6
- * `MAX_LEVELS_PER_SUBMIT x FRONTIER_CANDIDATES` 16-byte slots, and the edge queue. The host never reads a counter
7
- * inside a submit: `frontier-finalize`, one lane, runs at the START of every level (role 0: rotates
8
- * `nextFrontierCount` into `frontierCount`, advances `level`, decides `done`, writes this level's slots) and again once
9
- * the edge queue is filled (role 1: clamps `edgeCount`, sizes the contract slot, or on an overflow --
10
- * `edgeCountUnclamped > edgeCapacity` -- sizes the fused-retry slot instead, PD-23), and the kernels that follow
11
- * dispatch indirectly from those slots. The host records up to `MAX_LEVELS_PER_SUBMIT` levels per submit and reads
12
- * `done` (four bytes) once per submit; a boundary that finds `done` set zeroes its slots and moves no counter, so the
13
- * recorded levels past the end are no-ops and the counters freeze at the finishing boundary's values.
5
+ * offset, and the selector must reach every count it acts on through one binding) and the edge queue. The host
6
+ * never reads a counter inside a submit: `frontier-finalize`, one lane, runs at the START of every level (role 0:
7
+ * rotates `nextFrontierCount` into `frontierCount`, advances `level`, decides `done`, chooses the level's path) and
8
+ * again once the edge queue is filled (role 1: clamps `edgeCount`, or on an overflow -- `edgeCountUnclamped >
9
+ * edgeCapacity` -- switches the path to the fused retry, PD-23). The choice is the block's `path` word (`W.path`,
10
+ * word 24); every level kernel is a direct grid-stride dispatch that reads it first and does nothing unless the
11
+ * word names it (design/decisions/2026-09-25-frontier-kernels-dispatch-directly.md: the seven indirect slots the
12
+ * selector once wrote per level cost about 0.4 ms of Dawn validation each and were 97 % of a traversal's wall
13
+ * time; they and their args buffer are gone). The host records up to `MAX_LEVELS_PER_SUBMIT` levels per submit and
14
+ * reads `done` (four bytes) once per submit; a boundary that finds `done` set writes path 0 and moves no counter,
15
+ * so the recorded levels past the end are no-ops and the counters freeze at the finishing boundary's values.
14
16
  *
15
17
  * The seed: `frontierCount` is NEVER seeded, because the first boundary rotates it out unread. A BFS driver calls
16
18
  * `reset(queue, source, { nextFrontierCount: 1, level: U32_MAX })`: the first boundary rotates the 1 in, adds it into
17
19
  * `visitedCount`, and wraps `level` to 0, so the level-0 expansion claims the source's neighbours at `level + 1 == 1`.
18
20
  * `reset` is a queue write, ordered before the submit that follows, and it puts the source on side 0.
19
21
  *
20
- * Every buffer comes from the caller's ONE lease (`scope.scratch`, `scope.indirect`) so the algorithm's dispose()
22
+ * Every buffer comes from the caller's ONE lease (`scope.scratch`) so the algorithm's dispose()
21
23
  * releases them together (design 4.4). The two vertex queues are two BUFFERS, never two ranges of one: `Kernel.bind`
22
24
  * rejects one buffer bound read-only and read-write in one dispatch even for disjoint ranges. `src/primitives/**`
23
25
  * never imports `src/context.ts`.
24
26
  */
25
- import { FRONTIER_CANDIDATES, MAX_LEVELS_PER_SUBMIT, U32_MAX } from "../constants.js";
27
+ import { MAX_LEVELS_PER_SUBMIT, U32_MAX } from "../constants.js";
26
28
  import { WebGpuGraphError } from "../errors.js";
27
29
  import { plan1d } from "../kernel/dispatch.js";
28
- import { INDIRECT_ARGS_STRIDE } from "../kernel/kernel.js";
29
30
  import { FRONTIER_COUNTERS, FRONTIER_PARAMS, kernelSpec } from "../kernels.js";
30
- /** The seven indirect slots of one level (`FRONTIER_CANDIDATES`), by the kernel that dispatches from each. */
31
- export const SLOT = Object.freeze({ expand: 0, contract: 1, fused: 2, fillBits: 3, bitset: 4, bottomUp: 5, fusedRetry: 6 });
31
+ /** The values of the `path` word (`W.path`): what a level's kernels run; every level kernel reads it first. */
32
+ export const PATH = Object.freeze({ none: 0, twoPhase: 1, fused: 2, bottomUp: 3, fusedRetry: 4, near: 5, far: 6 });
32
33
  /** The words of the counters block (`FRONTIER_COUNTERS`), by index: byte offset 4 x word; no driver types a number. */
33
34
  export const W = Object.freeze({
34
35
  frontierCount: 0,
@@ -56,6 +57,7 @@ export const W = Object.freeze({
56
57
  thresholdBits: 22,
57
58
  deltaBits: 23,
58
59
  path: 24,
60
+ nextDegreeSum: 25,
59
61
  });
60
62
  /**
61
63
  * The given words of a partial record (a key spelled with an undefined value is dropped, so the block writer sees
@@ -88,22 +90,20 @@ function assertCount(argument, value) {
88
90
  });
89
91
  }
90
92
  }
91
- /** The frontier queue of design 6 row 7: two vertex queues, the counters block, the args buffer and the edge queue, all leased by the caller's scope. */
93
+ /** The frontier queue of design 6 row 7: two vertex queues, the counters block and the edge queue, all leased by the caller's scope. */
92
94
  export class Frontier {
93
95
  /**
94
96
  * Wraps the leased buffers; use prepareFrontier().
95
97
  * @param vertices - the two vertex queues
96
98
  * @param counters - the counters block
97
- * @param args - the args buffer
98
99
  * @param edgeQueue - the edge queue
99
100
  * @param edgeCapacity - the edge queue's entry count
100
101
  * @param n - the vertex count
101
102
  */
102
- constructor(vertices, counters, args, edgeQueue, edgeCapacity, n) {
103
+ constructor(vertices, counters, edgeQueue, edgeCapacity, n) {
103
104
  this.sideIndex = 0;
104
105
  this.vertices = vertices;
105
106
  this.counters = counters;
106
- this.args = args;
107
107
  this.edgeQueue = edgeQueue;
108
108
  this.edgeCapacity = edgeCapacity;
109
109
  this.n = n;
@@ -134,7 +134,7 @@ export class Frontier {
134
134
  this.sideIndex = this.sideIndex === 0 ? 1 : 0;
135
135
  }
136
136
  /**
137
- * Seeds a traversal: one `queue.writeBuffer` of the whole 96-byte block (zero except the caller's words) and one of
137
+ * Seeds a traversal: one `queue.writeBuffer` of the whole 112-byte block (zero except the caller's words) and one of
138
138
  * `vertices[0][0] = source`, both ordered before the submit that follows; the source is on side 0 afterwards.
139
139
  * `frontierCount` is not a word to seed: the first boundary rotates word 1 into it (the BFS seed is
140
140
  * `{ nextFrontierCount: 1, level: U32_MAX }`). A source outside `[0, n)`, an unknown word or a value that is not a
@@ -163,7 +163,7 @@ export class Frontier {
163
163
  * edge capacity defaults to `max(1, min(arcCount, floor(maxStorageBufferBindingSize / 4)))` (never a zero-length
164
164
  * buffer: the one-node graph has no arcs); a test passes a small one to force the overflow path. The planner lives
165
165
  * exactly as long as the scope: never use it after the scope's dispose().
166
- * @param scope - the caller's scope (device, caps, cache, scratch, indirect, params)
166
+ * @param scope - the caller's scope (device, caps, cache, scratch, params)
167
167
  * @param n - the vertex count
168
168
  * @param arcCount - the arc count (the natural edge-queue size)
169
169
  * @param edgeCapacity - the edge queue's entry count, when the caller chooses it (an integer >= 1)
@@ -182,7 +182,6 @@ export async function prepareFrontier(scope, n, arcCount, edgeCapacity) {
182
182
  }
183
183
  const kernel = await scope.pipelines.kernel(kernelSpec("frontier-finalize"));
184
184
  const queueBytes = 4 * Math.max(1, n);
185
- const argsBytes = MAX_LEVELS_PER_SUBMIT * FRONTIER_CANDIDATES * INDIRECT_ARGS_STRIDE;
186
185
  const vertices = [
187
186
  { buffer: scope.scratch(queueBytes, "frontier/vertices-0"), offset: 0, size: queueBytes, window: null },
188
187
  { buffer: scope.scratch(queueBytes, "frontier/vertices-1"), offset: 0, size: queueBytes, window: null },
@@ -193,22 +192,16 @@ export async function prepareFrontier(scope, n, arcCount, edgeCapacity) {
193
192
  size: FRONTIER_COUNTERS.byteLength,
194
193
  window: null,
195
194
  };
196
- const args = {
197
- buffer: scope.indirect(argsBytes, "frontier/args"),
198
- offset: 0,
199
- size: argsBytes,
200
- window: null,
201
- };
202
195
  const edgeQueue = {
203
196
  buffer: scope.scratch(4 * capacity, "frontier/edge-queue"),
204
197
  offset: 0,
205
198
  size: 4 * capacity,
206
199
  window: null,
207
200
  };
208
- const frontier = new Frontier(vertices, counters, args, edgeQueue, capacity, n);
201
+ const frontier = new Frontier(vertices, counters, edgeQueue, capacity, n);
209
202
  return new FrontierPlannerImpl(scope, kernel, frontier);
210
203
  }
211
- /** The planner: the selector kernel bound once to the frontier's block and args. */
204
+ /** The planner: the selector kernel bound once to the frontier's block. */
212
205
  class FrontierPlannerImpl {
213
206
  /**
214
207
  * Wraps the resolved kernel; use prepareFrontier().
@@ -247,12 +240,11 @@ class FrontierPlannerImpl {
247
240
  const params = scope.params(FRONTIER_PARAMS, {
248
241
  ...definedWords(fields),
249
242
  role,
250
- slotBase: level * FRONTIER_CANDIDATES,
251
243
  wg: scope.workgroupSize,
252
244
  edgeCapacity: frontier.edgeCapacity,
253
245
  n: frontier.n,
254
246
  });
255
- const bound = this.kernel.bind({ counters: frontier.counters, args: frontier.args, P: params.binding });
247
+ const bound = this.kernel.bind({ counters: frontier.counters, P: params.binding });
256
248
  this.kernel.dispatch(pass, bound, plan1d(1, scope.workgroupSize, scope.caps), [params.offset]);
257
249
  }
258
250
  }
@@ -1 +1 @@
1
- {"version":3,"file":"frontier.js","sourceRoot":"","sources":["../../../src/primitives/frontier.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAO,EAAE,mBAAmB,EAAE,qBAAqB,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AACtF,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,EAAE,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAC/C,OAAO,EAAE,oBAAoB,EAAe,MAAM,qBAA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AI,CAAC,MAAM,CAAC,IAAI,CAAC,EAAE,QAAQ,EAAE,QAAQ,CAAC,QAAQ,EAAE,CAAC,EAAE,MAAM,CAAC,OAAO,EAAE,CAAC,CAAC;QACnF,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,IAAI,EAAE,KAAK,EAAE,MAAM,CAAC,CAAC,EAAE,KAAK,CAAC,aAAa,EAAE,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC;IACnG,CAAC;CACJ"}
@@ -1,11 +1,11 @@
1
1
  /**
2
2
  * The grid pyramid (spec 6 row 12, 7.7 G4-G5; P4-T9): the planner that records, into the caller's pass, the finest
3
- * centroids (G4, `grid-centroid`: thread per cell over `cells + 1`, the pseudo-cell included), the hub-cell
3
+ * centroids (G4, `grid-centroid`: thread per cell over `cells + outsideCells`, the pseudo-cells included), the hub-cell
4
4
  * completion (G4a: the T1 `indirect-finalize` over `hubCounters[0]` into `hubArgs` with `wg = 1`, so the finalize's
5
5
  * `ceil(count / wg)` is ONE workgroup per hub cell; G4b: `grid-centroid-hub`, one workgroup per hub cell, dispatched
6
6
  * indirectly; PD-13, DEP-P4-I) and one `grid-downsample` dispatch per coarser
7
7
  * level (G5). Level 0 holds `[sum m x, sum m y, sum m z, sum m]` per cell; every parent is the sum of its 2^dim
8
- * children; the pseudo-cell (index `cells` of level 0) is never a child. No atomics touch the sums (design 6 row 12:
8
+ * children; the pseudo-cells (indices `cells ..` of level 0) are never children. No atomics touch the sums (design 6 row 12:
9
9
  * bitwise reproducible); the only atomics are the hub append and the occupancy max.
10
10
  *
11
11
  * The named grid buffers (`pyramid`, `hubList`, `hubCounters`, `hubArgs`) are the caller's (the model's
@@ -28,9 +28,9 @@ export interface GridPyramidBindings {
28
28
  readonly params: Binding;
29
29
  /** `n` words: the sorted node indices (the T8 build). */
30
30
  readonly sortedIdx: Binding;
31
- /** `cells + 2` words: the exclusive scan of the cell histogram (the T8 build). */
31
+ /** `histWords` (`cells + 2^dim + 1`) words: the exclusive scan of the cell histogram (the T8 build). */
32
32
  readonly cellStart: Binding;
33
- /** `pyramidCells` vec4f: every level, level 0 first with the pseudo-cell at index `cells`. */
33
+ /** `pyramidCells` vec4f: every level, level 0 first with the 2^dim orthant pseudo-cells from index `cells`. */
34
34
  readonly pyramid: Binding;
35
35
  /** The hub cells' indices, appended by G4 (at least one word; at most `floor(n / (GRID_HUB_CELL + 1))` are ever written, so `ceil(n / GRID_HUB_CELL)` words always suffice). */
36
36
  readonly hubList: Binding;
@@ -1 +1 @@
1
- {"version":3,"file":"grid-pyramid.d.ts","sourceRoot":"","sources":["../../../src/primitives/grid-pyramid.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAMH,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,KAAK,QAAQ,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,aAAa,CAAC;AAE/C;;;;GAIG;AACH,MAAM,WAAW,mBAAmB;IAChC,4CAA4C;IAC5C,QAAQ,CAAC,GAAG,EAAE,OAAO,CAAC;IACtB,wGAAwG;IACxG,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAC;IACzB,yDAAyD;IACzD,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC;IAC5B,kFAAkF;IAClF,QAAQ,CAAC,SAAS,EAAE,OAAO,CAAC;IAC5B,8FAA8F;IAC9F,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,gLAAgL;IAChL,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,2JAA2J;IAC3J,QAAQ,CAAC,WAAW,EAAE,OAAO,CAAC;IAC9B,qGAAqG;IACrG,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;CAC7B;AAED,uHAAuH;AACvH,MAAM,MAAM,gBAAgB,GAAG,IAAI,GAAG,IAAI,CAAC;AAE3C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B;AAED,uHAAuH;AACvH,MAAM,MAAM,gBAAgB,GAAG,IAAI,GAAG,IAAI,CAAC;AAE3C,uHAAuH;AACvH,MAAM,WAAW,kBAAkB;IAC/B;;;;OAIG;IACH,IAAI,CAAC,QAAQ,EAAE,mBAAmB,GAAG,IAAI,CAAC;IAC1C;;;;;;OAMG;IACH,MAAM,CAAC,IAAI,EAAE,qBAAqB,EAAE,YAAY,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,gBAAgB,GAAG,IAAI,CAAC;IACzF,uGAAuG;IACvG,QAAQ,CAAC,cAAc,EAAE,MAAM,CAAC;CACnC;AAED;;;;;;GAMG;AACH,wBAAsB,cAAc,CAAC,KAAK,EAAE,WAAW,EAAE,IAAI,EAAE,QAAQ,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAMpG"}
@@ -1,11 +1,11 @@
1
1
  /**
2
2
  * The grid pyramid (spec 6 row 12, 7.7 G4-G5; P4-T9): the planner that records, into the caller's pass, the finest
3
- * centroids (G4, `grid-centroid`: thread per cell over `cells + 1`, the pseudo-cell included), the hub-cell
3
+ * centroids (G4, `grid-centroid`: thread per cell over `cells + outsideCells`, the pseudo-cells included), the hub-cell
4
4
  * completion (G4a: the T1 `indirect-finalize` over `hubCounters[0]` into `hubArgs` with `wg = 1`, so the finalize's
5
5
  * `ceil(count / wg)` is ONE workgroup per hub cell; G4b: `grid-centroid-hub`, one workgroup per hub cell, dispatched
6
6
  * indirectly; PD-13, DEP-P4-I) and one `grid-downsample` dispatch per coarser
7
7
  * level (G5). Level 0 holds `[sum m x, sum m y, sum m z, sum m]` per cell; every parent is the sum of its 2^dim
8
- * children; the pseudo-cell (index `cells` of level 0) is never a child. No atomics touch the sums (design 6 row 12:
8
+ * children; the pseudo-cells (indices `cells ..` of level 0) are never children. No atomics touch the sums (design 6 row 12:
9
9
  * bitwise reproducible); the only atomics are the hub append and the occupancy max.
10
10
  *
11
11
  * The named grid buffers (`pyramid`, `hubList`, `hubCounters`, `hubArgs`) are the caller's (the model's
@@ -125,7 +125,8 @@ class GridPyramidPlannerImpl {
125
125
  }
126
126
  const { centroid, finalize, hub, downsample } = this.kernels;
127
127
  const one = { x: 1, y: 1, z: 1, items: 1, stride: null };
128
- centroid.dispatch(pass, bound.centroid, plan1d(spec.cells + 1, scope.workgroupSize, scope.caps), [paramsOffset]);
128
+ const level0 = spec.cells + spec.outsideCells;
129
+ centroid.dispatch(pass, bound.centroid, plan1d(level0, scope.workgroupSize, scope.caps), [paramsOffset]);
129
130
  finalize.dispatch(pass, bound.finalize, one, [bound.finalizeOffset]);
130
131
  hub.dispatchIndirect(pass, bound.hub, bound.hubArgs, 0, [paramsOffset]);
131
132
  this.dispatches = 3;
@@ -1 +1 @@
1
- {"version":3,"file":"grid-pyramid.js","sourceRoot":"","sources":["../../../src/primitives/grid-pyramid.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAChD,OAAO,EAAqB,MAAM,EAAE,MAAM,uBAAuB,CAAC;AAElE,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAoD/E;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,cAAc,CAAC,KAAkB,EAAE,IAAc;IACnE,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,SAAS,CAAC,MAAM,CAAC,UAAU,CAAC,eAAe,CAAC,CAAC,CAAC;IAC3E,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,SAAS,CAAC,MAAM,CAAC,UAAU,CAAC,mBAAmB,CAAC,CAAC,CAAC;IAC/E,MAAM,GAAG,GAAG,MAAM,KAAK,CAAC,SAAS,CAAC,MAAM,CAAC,UAAU,CAAC,mBAAmB,CAAC,CAAC,CAAC;IAC1E,MAAM,UAAU,GAAG,MAAM,KAAK,CAAC,SAAS,CAAC,MAAM,CAAC,UAAU,CAAC,iBAAiB,CAAC,CAAC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C,EAAE,CAAC,YAAY,CAAC,CAAC,CAAC;QACzG,QAAQ,CAAC,QAAQ,CAAC,IAAI,EAAE,KAAK,CAAC,QAAQ,EAAE,GAAG,EAAE,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC,CAAC;QACrE,GAAG,CAAC,gBAAgB,CAAC,IAAI,EAAE,KAAK,CAAC,GAAG,EAAE,KAAK,CAAC,OAAO,EAAE,CAAC,EAAE,CAAC,YAAY,CAAC,CAAC,CAAC;QACxE,IAAI,CAAC,UAAU,GAAG,CAAC,CAAC;QACpB,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,KAAK,IAAI,EAAE,CAAC;YAC1B,OAAO;QACX,CAAC;QACD,KAAK,MAAM,KAAK,IAAI,KAAK,CAAC,MAAM,EAAE,CAAC;YAC/B,UAAU,CAAC,QAAQ,CAAC,IAAI,EAAE,KAAK,CAAC,KAAK,EAAE,MAAM,CAAC,KAAK,CAAC,WAAW,EAAE,KAAK,CAAC,aAAa,EAAE,KAAK,CAAC,IAAI,CAAC,EAAE;gBAC/F,KAAK,CAAC,MAAM;aACf,CAAC,CAAC;YACH,IAAI,CAAC,UAAU,IAAI,CAAC,CAAC;QACzB,CAAC;IACL,CAAC;CACJ"}
@@ -3,8 +3,9 @@
3
3
  * the caller's pass, the cell keys (G1, `grid-cell-key`), the stable sort by key (G2: `radixSort` at GRID_SORT_BITS,
4
4
  * or `countingSortByKey` when the caller asks for the set-deterministic path) and the per-cell histogram with its
5
5
  * exclusive scan (G3: the `histogram` kernel over `cellKey` and the `scan` of it; DEP-P4-I names no grid-specific
6
- * id). `cellHist` and `cellStart` hold `cells + 2` words: every real cell, the outside pseudo-cell at index `cells`
7
- * and one more so `cellStart[cells + 1] === n` closes the last range. Every zeroing is a `fill` dispatch inside the
6
+ * id). `cellHist` and `cellStart` hold `histWords = cells + 2^dim + 1` words: every real cell, the 2^dim outside
7
+ * pseudo-cells (one per orthant about the grid centre, issue #90) from index `cells`, and one more so
8
+ * `cellStart[histWords - 1] === n` closes the last range. Every zeroing is a `fill` dispatch inside the
8
9
  * pass (PD-12), never an encoder clear.
9
10
  *
10
11
  * The named grid buffers (`cellKey`, `cellVal`, `sortedKey`, `sortedIdx`, `cellHist`, `cellStart`) are the caller's
@@ -24,11 +25,13 @@ export interface GridSpec {
24
25
  readonly g: number;
25
26
  /** `log2(G / GRID_COARSEST_SIDE) + 1`. */
26
27
  readonly levels: number;
27
- /** `G^dim` finest cells; the outside pseudo-cell is index `cells`. */
28
+ /** `G^dim` finest cells; the outside pseudo-cells are indices `cells .. cells + outsideCells - 1`. */
28
29
  readonly cells: number;
29
- /** `cells + 2`: the length of `cellHist` / `cellStart`. */
30
+ /** `2^dim`: one outside pseudo-cell per orthant about the grid centre (issue #90). */
31
+ readonly outsideCells: number;
32
+ /** `cells + outsideCells + 1`: the length of `cellHist` / `cellStart`. */
30
33
  readonly histWords: number;
31
- /** The first cell of every level inside the pyramid: `levelOffsets[0] = 0`, level 0 holds `cells + 1` (the pseudo-cell), level L `(G / 2^L)^dim`. */
34
+ /** The first cell of every level inside the pyramid: `levelOffsets[0] = 0`, level 0 holds `cells + outsideCells` (the pseudo-cells last), level L `(G / 2^L)^dim`. */
32
35
  readonly levelOffsets: readonly number[];
33
36
  /** Every level's cells together: `levelOffsets[levels - 1] + GRID_COARSEST_SIDE^dim`. */
34
37
  readonly pyramidCells: number;
@@ -39,8 +42,8 @@ export interface GridSpec {
39
42
  * The grid of `n` nodes in `dim` dimensions under the tuning (spec 7.7 geometry table; PD-9): `G = clamp(nextPow2(2 *
40
43
  * ceil(n^(1 / dim))), GRID_MIN_SIDE, floorPow2(gridMax))` where `gridMax` is `gridMax2D` or `gridMax3D`, rounded DOWN
41
44
  * to a power of two so every level's side is an integer (512 and 128 stay; 100 becomes 64); `levels = log2(G /
42
- * GRID_COARSEST_SIDE) + 1`. At the caps: 349,521 pyramid cells in 2D, 2,396,737 in 3D (the design's counts plus the
43
- * pseudo-cell).
45
+ * GRID_COARSEST_SIDE) + 1`. At the caps: 349,524 pyramid cells in 2D, 2,396,744 in 3D (the design's counts plus the
46
+ * 2^dim pseudo-cells).
44
47
  * @param n - the node count (>= 0)
45
48
  * @param dim - 2 or 3
46
49
  * @param tuning - the resolved layout tuning (`gridMax2D`, `gridMax3D`, `deterministic`)
@@ -48,7 +51,7 @@ export interface GridSpec {
48
51
  */
49
52
  export declare function gridSpecFor(n: number, dim: 2 | 3, tuning: Pick<ResolvedLayoutTuning, "gridMax2D" | "gridMax3D" | "deterministic">): GridSpec;
50
53
  /**
51
- * The bytes of the pyramid (spec 7.7: 16 B per cell, every level, the pseudo-cell included): 38,347,792 at the 3D cap.
54
+ * The bytes of the pyramid (spec 7.7: 16 B per cell, every level, the pseudo-cells included): 38,347,904 at the 3D cap.
52
55
  * @param spec - the grid
53
56
  * @returns the byte length
54
57
  */
@@ -79,9 +82,9 @@ export interface GridBuildBindings {
79
82
  readonly sortedKey: Binding;
80
83
  /** `n` words: the sorted node indices. */
81
84
  readonly sortedIdx: Binding;
82
- /** `cells + 2` words: the per-cell counts. */
85
+ /** `histWords` (`cells + 2^dim + 1`) words: the per-cell counts. */
83
86
  readonly cellHist: Binding;
84
- /** `cells + 2` words: the exclusive scan of `cellHist`. */
87
+ /** `histWords` (`cells + 2^dim + 1`) words: the exclusive scan of `cellHist`. */
85
88
  readonly cellStart: Binding;
86
89
  }
87
90
  /** Where `record()` stops: after the keys (G1), after the sort (G2) or after the histogram and its scan (G3, the default). */
@@ -1 +1 @@
1
- {"version":3,"file":"grid.d.ts","sourceRoot":"","sources":["../../../src/primitives/grid.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAOH,OAAO,EAAE,KAAK,oBAAoB,EAAE,MAAM,oBAAoB,CAAC;AAC/D,OAAO,EAAE,KAAK,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAQlD,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,aAAa,CAAC;AAG/C,+FAA+F;AAC/F,MAAM,WAAW,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