@luma.gl/graph 10.0.0-beta.2 → 10.0.0-beta.4

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 (317) hide show
  1. package/dist/arrow/gpu/arrow-gpu-analytics-adapters.cjs +22 -9
  2. package/dist/arrow/gpu/arrow-gpu-analytics-adapters.d.ts +11 -2
  3. package/dist/arrow/gpu/arrow-gpu-analytics-adapters.d.ts.map +1 -1
  4. package/dist/arrow/gpu/arrow-gpu-analytics-adapters.js +27 -10
  5. package/dist/arrow/gpu/arrow-gpu-analytics-adapters.js.map +1 -1
  6. package/dist/arrow/gpu/arrow-gpu-analytics-readback.cjs +24 -13
  7. package/dist/arrow/gpu/arrow-gpu-analytics-readback.d.ts +9 -1
  8. package/dist/arrow/gpu/arrow-gpu-analytics-readback.d.ts.map +1 -1
  9. package/dist/arrow/gpu/arrow-gpu-analytics-readback.js +41 -14
  10. package/dist/arrow/gpu/arrow-gpu-analytics-readback.js.map +1 -1
  11. package/dist/arrow/gpu/arrow-gpu-table-conversion.cjs +82 -23
  12. package/dist/arrow/gpu/arrow-gpu-table-conversion.d.ts +16 -1
  13. package/dist/arrow/gpu/arrow-gpu-table-conversion.d.ts.map +1 -1
  14. package/dist/arrow/gpu/arrow-gpu-table-conversion.js +98 -24
  15. package/dist/arrow/gpu/arrow-gpu-table-conversion.js.map +1 -1
  16. package/dist/arrow/gpu/arrow-gpu-vector-conversion.cjs +7 -0
  17. package/dist/arrow/gpu/arrow-gpu-vector-conversion.d.ts +2 -0
  18. package/dist/arrow/gpu/arrow-gpu-vector-conversion.d.ts.map +1 -1
  19. package/dist/arrow/gpu/arrow-gpu-vector-conversion.js +14 -0
  20. package/dist/arrow/gpu/arrow-gpu-vector-conversion.js.map +1 -1
  21. package/dist/arrow/index.cjs +2 -0
  22. package/dist/arrow/index.cjs.map +3 -3
  23. package/dist/arrow/index.d.ts +1 -1
  24. package/dist/arrow/index.d.ts.map +1 -1
  25. package/dist/arrow/index.js +1 -1
  26. package/dist/arrow/index.js.map +1 -1
  27. package/dist/arrow/vectors/arrow-temporal-gpu-vector.cjs +1 -2
  28. package/dist/arrow/vectors/arrow-temporal-gpu-vector.js +2 -2
  29. package/dist/arrow/vectors/arrow-temporal-gpu-vector.js.map +1 -1
  30. package/dist/dist.dev.js +62 -27
  31. package/dist/dist.min.js +48 -47
  32. package/dist/gpu-core/gpu-bvh-bounds.cjs +63 -0
  33. package/dist/gpu-core/gpu-bvh-bounds.d.ts +32 -0
  34. package/dist/gpu-core/gpu-bvh-bounds.d.ts.map +1 -0
  35. package/dist/gpu-core/gpu-bvh-bounds.js +56 -0
  36. package/dist/gpu-core/gpu-bvh-bounds.js.map +1 -0
  37. package/dist/gpu-core/gpu-command-graph-budget-controller.cjs +10 -2
  38. package/dist/gpu-core/gpu-command-graph-budget-controller.d.ts +4 -0
  39. package/dist/gpu-core/gpu-command-graph-budget-controller.d.ts.map +1 -1
  40. package/dist/gpu-core/gpu-command-graph-budget-controller.js +10 -2
  41. package/dist/gpu-core/gpu-command-graph-budget-controller.js.map +1 -1
  42. package/dist/gpu-core/gpu-command-graph-submission-pacer.cjs +92 -0
  43. package/dist/gpu-core/gpu-command-graph-submission-pacer.d.ts +41 -0
  44. package/dist/gpu-core/gpu-command-graph-submission-pacer.d.ts.map +1 -0
  45. package/dist/gpu-core/gpu-command-graph-submission-pacer.js +85 -0
  46. package/dist/gpu-core/gpu-command-graph-submission-pacer.js.map +1 -0
  47. package/dist/gpu-core/gpu-group-aggregation.cjs +45 -21
  48. package/dist/gpu-core/gpu-group-aggregation.d.ts +4 -0
  49. package/dist/gpu-core/gpu-group-aggregation.d.ts.map +1 -1
  50. package/dist/gpu-core/gpu-group-aggregation.js +58 -24
  51. package/dist/gpu-core/gpu-group-aggregation.js.map +1 -1
  52. package/dist/gpu-core/index.cjs +6 -0
  53. package/dist/gpu-core/index.cjs.map +3 -3
  54. package/dist/gpu-core/index.d.ts +4 -0
  55. package/dist/gpu-core/index.d.ts.map +1 -1
  56. package/dist/gpu-core/index.js +2 -0
  57. package/dist/gpu-core/index.js.map +1 -1
  58. package/dist/gpu-dataframe/gpu-analytics-compiler-utils.cjs +6 -6
  59. package/dist/gpu-dataframe/gpu-analytics-compiler-utils.d.ts +1 -1
  60. package/dist/gpu-dataframe/gpu-analytics-compiler-utils.d.ts.map +1 -1
  61. package/dist/gpu-dataframe/gpu-analytics-compiler-utils.js +6 -6
  62. package/dist/gpu-dataframe/gpu-analytics-compiler-utils.js.map +1 -1
  63. package/dist/gpu-dataframe/gpu-data-frame-query.cjs +55 -14
  64. package/dist/gpu-dataframe/gpu-data-frame-query.d.ts +13 -2
  65. package/dist/gpu-dataframe/gpu-data-frame-query.d.ts.map +1 -1
  66. package/dist/gpu-dataframe/gpu-data-frame-query.js +58 -17
  67. package/dist/gpu-dataframe/gpu-data-frame-query.js.map +1 -1
  68. package/dist/gpu-dataframe/gpu-data-frame.cjs +1 -3
  69. package/dist/gpu-dataframe/gpu-data-frame.d.ts +10 -0
  70. package/dist/gpu-dataframe/gpu-data-frame.d.ts.map +1 -1
  71. package/dist/gpu-dataframe/gpu-data-frame.js +1 -3
  72. package/dist/gpu-dataframe/gpu-data-frame.js.map +1 -1
  73. package/dist/gpu-dataframe/gpu-expression-shader.cjs +94 -44
  74. package/dist/gpu-dataframe/gpu-expression-shader.d.ts +8 -5
  75. package/dist/gpu-dataframe/gpu-expression-shader.d.ts.map +1 -1
  76. package/dist/gpu-dataframe/gpu-expression-shader.js +110 -47
  77. package/dist/gpu-dataframe/gpu-expression-shader.js.map +1 -1
  78. package/dist/gpu-dataframe/gpu-expression.cjs +14 -8
  79. package/dist/gpu-dataframe/gpu-expression.d.ts +12 -1
  80. package/dist/gpu-dataframe/gpu-expression.d.ts.map +1 -1
  81. package/dist/gpu-dataframe/gpu-expression.js +11 -6
  82. package/dist/gpu-dataframe/gpu-expression.js.map +1 -1
  83. package/dist/gpu-dataframe/gpu-global-aggregation-compiler.cjs +8 -4
  84. package/dist/gpu-dataframe/gpu-global-aggregation-compiler.d.ts +2 -1
  85. package/dist/gpu-dataframe/gpu-global-aggregation-compiler.d.ts.map +1 -1
  86. package/dist/gpu-dataframe/gpu-global-aggregation-compiler.js +10 -4
  87. package/dist/gpu-dataframe/gpu-global-aggregation-compiler.js.map +1 -1
  88. package/dist/gpu-dataframe/gpu-global-aggregation-query.cjs +2 -2
  89. package/dist/gpu-dataframe/gpu-global-aggregation-query.d.ts +5 -1
  90. package/dist/gpu-dataframe/gpu-global-aggregation-query.d.ts.map +1 -1
  91. package/dist/gpu-dataframe/gpu-global-aggregation-query.js +6 -2
  92. package/dist/gpu-dataframe/gpu-global-aggregation-query.js.map +1 -1
  93. package/dist/gpu-dataframe/gpu-global-sort-compiler.cjs +156 -124
  94. package/dist/gpu-dataframe/gpu-global-sort-compiler.d.ts +12 -2
  95. package/dist/gpu-dataframe/gpu-global-sort-compiler.d.ts.map +1 -1
  96. package/dist/gpu-dataframe/gpu-global-sort-compiler.js +160 -128
  97. package/dist/gpu-dataframe/gpu-global-sort-compiler.js.map +1 -1
  98. package/dist/gpu-dataframe/gpu-group-aggregation-compiler.cjs +366 -53
  99. package/dist/gpu-dataframe/gpu-group-aggregation-compiler.d.ts +26 -4
  100. package/dist/gpu-dataframe/gpu-group-aggregation-compiler.d.ts.map +1 -1
  101. package/dist/gpu-dataframe/gpu-group-aggregation-compiler.js +378 -47
  102. package/dist/gpu-dataframe/gpu-group-aggregation-compiler.js.map +1 -1
  103. package/dist/gpu-dataframe/gpu-group-by-query.cjs +20 -9
  104. package/dist/gpu-dataframe/gpu-group-by-query.d.ts +15 -2
  105. package/dist/gpu-dataframe/gpu-group-by-query.d.ts.map +1 -1
  106. package/dist/gpu-dataframe/gpu-group-by-query.js +22 -8
  107. package/dist/gpu-dataframe/gpu-group-by-query.js.map +1 -1
  108. package/dist/gpu-dataframe/gpu-join-compiler.cjs +61 -8
  109. package/dist/gpu-dataframe/gpu-join-compiler.d.ts +10 -2
  110. package/dist/gpu-dataframe/gpu-join-compiler.d.ts.map +1 -1
  111. package/dist/gpu-dataframe/gpu-join-compiler.js +60 -7
  112. package/dist/gpu-dataframe/gpu-join-compiler.js.map +1 -1
  113. package/dist/gpu-dataframe/gpu-query-compiler.cjs +61 -11
  114. package/dist/gpu-dataframe/gpu-query-compiler.d.ts +5 -1
  115. package/dist/gpu-dataframe/gpu-query-compiler.d.ts.map +1 -1
  116. package/dist/gpu-dataframe/gpu-query-compiler.js +61 -10
  117. package/dist/gpu-dataframe/gpu-query-compiler.js.map +1 -1
  118. package/dist/gpu-dataframe/index.cjs +4 -2
  119. package/dist/gpu-dataframe/index.cjs.map +3 -3
  120. package/dist/gpu-dataframe/index.d.ts +1 -1
  121. package/dist/gpu-dataframe/index.d.ts.map +1 -1
  122. package/dist/gpu-dataframe/index.js +1 -1
  123. package/dist/gpu-dataframe/index.js.map +1 -1
  124. package/dist/gpu-graph/index.cjs.map +1 -1
  125. package/dist/gpu-graph-algorithms/benchmarks.cjs.map +2 -2
  126. package/dist/gpu-graph-algorithms/gpu-graph-single-source-shortest-path-internals.cjs +182 -62
  127. package/dist/gpu-graph-algorithms/gpu-graph-single-source-shortest-path-internals.d.ts +29 -2
  128. package/dist/gpu-graph-algorithms/gpu-graph-single-source-shortest-path-internals.d.ts.map +1 -1
  129. package/dist/gpu-graph-algorithms/gpu-graph-single-source-shortest-path-internals.js +200 -64
  130. package/dist/gpu-graph-algorithms/gpu-graph-single-source-shortest-path-internals.js.map +1 -1
  131. package/dist/gpu-graph-algorithms/gpu-graph-single-source-shortest-path.cjs +135 -9
  132. package/dist/gpu-graph-algorithms/gpu-graph-single-source-shortest-path.d.ts +55 -8
  133. package/dist/gpu-graph-algorithms/gpu-graph-single-source-shortest-path.d.ts.map +1 -1
  134. package/dist/gpu-graph-algorithms/gpu-graph-single-source-shortest-path.js +145 -14
  135. package/dist/gpu-graph-algorithms/gpu-graph-single-source-shortest-path.js.map +1 -1
  136. package/dist/gpu-graph-algorithms/index.cjs.map +3 -3
  137. package/dist/gpu-physics/articulation-tree-shader.cjs +177 -0
  138. package/dist/gpu-physics/articulation-tree-shader.d.ts +3 -0
  139. package/dist/gpu-physics/articulation-tree-shader.d.ts.map +1 -0
  140. package/dist/gpu-physics/articulation-tree-shader.js +159 -0
  141. package/dist/gpu-physics/articulation-tree-shader.js.map +1 -0
  142. package/dist/gpu-physics/gpu-articulation-tree.cjs +203 -0
  143. package/dist/gpu-physics/gpu-articulation-tree.d.ts +81 -0
  144. package/dist/gpu-physics/gpu-articulation-tree.d.ts.map +1 -0
  145. package/dist/gpu-physics/gpu-articulation-tree.js +205 -0
  146. package/dist/gpu-physics/gpu-articulation-tree.js.map +1 -0
  147. package/dist/gpu-physics/gpu-physics-batch.cjs +11 -10
  148. package/dist/gpu-physics/gpu-physics-batch.d.ts +1 -0
  149. package/dist/gpu-physics/gpu-physics-batch.d.ts.map +1 -1
  150. package/dist/gpu-physics/gpu-physics-batch.js +14 -10
  151. package/dist/gpu-physics/gpu-physics-batch.js.map +1 -1
  152. package/dist/gpu-physics/gpu-physics-ensemble.cjs +9 -4
  153. package/dist/gpu-physics/gpu-physics-ensemble.d.ts +10 -1
  154. package/dist/gpu-physics/gpu-physics-ensemble.d.ts.map +1 -1
  155. package/dist/gpu-physics/gpu-physics-ensemble.js +11 -4
  156. package/dist/gpu-physics/gpu-physics-ensemble.js.map +1 -1
  157. package/dist/gpu-physics/gpu-rigid-body-world.cjs +323 -68
  158. package/dist/gpu-physics/gpu-rigid-body-world.d.ts +59 -2
  159. package/dist/gpu-physics/gpu-rigid-body-world.d.ts.map +1 -1
  160. package/dist/gpu-physics/gpu-rigid-body-world.js +400 -75
  161. package/dist/gpu-physics/gpu-rigid-body-world.js.map +1 -1
  162. package/dist/gpu-physics/index.cjs +3 -0
  163. package/dist/gpu-physics/index.cjs.map +3 -3
  164. package/dist/gpu-physics/index.d.ts +3 -1
  165. package/dist/gpu-physics/index.d.ts.map +1 -1
  166. package/dist/gpu-physics/index.js +1 -0
  167. package/dist/gpu-physics/index.js.map +1 -1
  168. package/dist/gpu-physics/rigid-body-cache-shaders.cjs +10 -6
  169. package/dist/gpu-physics/rigid-body-cache-shaders.d.ts +2 -1
  170. package/dist/gpu-physics/rigid-body-cache-shaders.d.ts.map +1 -1
  171. package/dist/gpu-physics/rigid-body-cache-shaders.js +15 -6
  172. package/dist/gpu-physics/rigid-body-cache-shaders.js.map +1 -1
  173. package/dist/gpu-physics/rigid-body-capacity.cjs +15 -2
  174. package/dist/gpu-physics/rigid-body-capacity.d.ts +3 -1
  175. package/dist/gpu-physics/rigid-body-capacity.d.ts.map +1 -1
  176. package/dist/gpu-physics/rigid-body-capacity.js +21 -2
  177. package/dist/gpu-physics/rigid-body-capacity.js.map +1 -1
  178. package/dist/gpu-physics/rigid-body-cast-index.cjs +192 -0
  179. package/dist/gpu-physics/rigid-body-cast-index.d.ts +44 -0
  180. package/dist/gpu-physics/rigid-body-cast-index.d.ts.map +1 -0
  181. package/dist/gpu-physics/rigid-body-cast-index.js +194 -0
  182. package/dist/gpu-physics/rigid-body-cast-index.js.map +1 -0
  183. package/dist/gpu-physics/rigid-body-ensemble-layout.cjs +4 -2
  184. package/dist/gpu-physics/rigid-body-ensemble-layout.d.ts +2 -1
  185. package/dist/gpu-physics/rigid-body-ensemble-layout.d.ts.map +1 -1
  186. package/dist/gpu-physics/rigid-body-ensemble-layout.js +5 -2
  187. package/dist/gpu-physics/rigid-body-ensemble-layout.js.map +1 -1
  188. package/dist/gpu-physics/rigid-body-ensemble-reset.cjs +11 -9
  189. package/dist/gpu-physics/rigid-body-ensemble-reset.d.ts +1 -1
  190. package/dist/gpu-physics/rigid-body-ensemble-reset.d.ts.map +1 -1
  191. package/dist/gpu-physics/rigid-body-ensemble-reset.js +13 -9
  192. package/dist/gpu-physics/rigid-body-ensemble-reset.js.map +1 -1
  193. package/dist/gpu-physics/rigid-body-ensemble-shaders.cjs +14 -7
  194. package/dist/gpu-physics/rigid-body-ensemble-shaders.d.ts +5 -0
  195. package/dist/gpu-physics/rigid-body-ensemble-shaders.d.ts.map +1 -1
  196. package/dist/gpu-physics/rigid-body-ensemble-shaders.js +17 -7
  197. package/dist/gpu-physics/rigid-body-ensemble-shaders.js.map +1 -1
  198. package/dist/gpu-physics/rigid-body-ensemble-transaction.cjs +21 -11
  199. package/dist/gpu-physics/rigid-body-ensemble-transaction.d.ts +2 -2
  200. package/dist/gpu-physics/rigid-body-ensemble-transaction.d.ts.map +1 -1
  201. package/dist/gpu-physics/rigid-body-ensemble-transaction.js +28 -12
  202. package/dist/gpu-physics/rigid-body-ensemble-transaction.js.map +1 -1
  203. package/dist/gpu-physics/rigid-body-event-compaction.cjs +184 -0
  204. package/dist/gpu-physics/rigid-body-event-compaction.d.ts +35 -0
  205. package/dist/gpu-physics/rigid-body-event-compaction.d.ts.map +1 -0
  206. package/dist/gpu-physics/rigid-body-event-compaction.js +168 -0
  207. package/dist/gpu-physics/rigid-body-event-compaction.js.map +1 -0
  208. package/dist/gpu-physics/rigid-body-event-snapshot.cjs +51 -0
  209. package/dist/gpu-physics/rigid-body-event-snapshot.d.ts +33 -0
  210. package/dist/gpu-physics/rigid-body-event-snapshot.d.ts.map +1 -0
  211. package/dist/gpu-physics/rigid-body-event-snapshot.js +34 -0
  212. package/dist/gpu-physics/rigid-body-event-snapshot.js.map +1 -0
  213. package/dist/gpu-physics/rigid-body-events.cjs +57 -25
  214. package/dist/gpu-physics/rigid-body-events.d.ts +2 -1
  215. package/dist/gpu-physics/rigid-body-events.d.ts.map +1 -1
  216. package/dist/gpu-physics/rigid-body-events.js +60 -25
  217. package/dist/gpu-physics/rigid-body-events.js.map +1 -1
  218. package/dist/gpu-physics/rigid-body-joints.cjs +8 -3
  219. package/dist/gpu-physics/rigid-body-joints.d.ts +2 -0
  220. package/dist/gpu-physics/rigid-body-joints.d.ts.map +1 -1
  221. package/dist/gpu-physics/rigid-body-joints.js +10 -6
  222. package/dist/gpu-physics/rigid-body-joints.js.map +1 -1
  223. package/dist/gpu-physics/rigid-body-queries.cjs +159 -16
  224. package/dist/gpu-physics/rigid-body-queries.d.ts +24 -1
  225. package/dist/gpu-physics/rigid-body-queries.d.ts.map +1 -1
  226. package/dist/gpu-physics/rigid-body-queries.js +166 -14
  227. package/dist/gpu-physics/rigid-body-queries.js.map +1 -1
  228. package/dist/gpu-physics/rigid-body-shaders.cjs +3 -3
  229. package/dist/gpu-physics/rigid-body-shaders.d.ts +1 -1
  230. package/dist/gpu-physics/rigid-body-shaders.d.ts.map +1 -1
  231. package/dist/gpu-physics/rigid-body-shaders.js +3 -3
  232. package/dist/gpu-physics/rigid-body-shaders.js.map +1 -1
  233. package/dist/gpu-physics/rigid-body-triggers.cjs +53 -15
  234. package/dist/gpu-physics/rigid-body-triggers.d.ts +1 -0
  235. package/dist/gpu-physics/rigid-body-triggers.d.ts.map +1 -1
  236. package/dist/gpu-physics/rigid-body-triggers.js +55 -15
  237. package/dist/gpu-physics/rigid-body-triggers.js.map +1 -1
  238. package/dist/gpu-physics/sphere-world-shaders.cjs +48 -20
  239. package/dist/gpu-physics/sphere-world-shaders.d.ts.map +1 -1
  240. package/dist/gpu-physics/sphere-world-shaders.js +51 -21
  241. package/dist/gpu-physics/sphere-world-shaders.js.map +1 -1
  242. package/dist/gpu-project/benchmarks.cjs.map +2 -2
  243. package/dist/gpu-project/crs.cjs.map +2 -2
  244. package/dist/gpu-project/graph.cjs.map +2 -2
  245. package/dist/gpu-project/index.cjs.map +2 -2
  246. package/dist/gpu-project/projection-program.cjs +2 -9
  247. package/dist/gpu-project/projection-program.d.ts.map +1 -1
  248. package/dist/gpu-project/projection-program.js +1 -8
  249. package/dist/gpu-project/projection-program.js.map +1 -1
  250. package/dist/gpu-simple-graph/index.cjs.map +2 -2
  251. package/dist/gpu-sql/gpu-sql.cjs +345 -81
  252. package/dist/gpu-sql/gpu-sql.d.ts +42 -2
  253. package/dist/gpu-sql/gpu-sql.d.ts.map +1 -1
  254. package/dist/gpu-sql/gpu-sql.js +393 -90
  255. package/dist/gpu-sql/gpu-sql.js.map +1 -1
  256. package/dist/gpu-sql/index.cjs.map +3 -3
  257. package/dist/gpu-sql/index.d.ts +1 -1
  258. package/dist/gpu-sql/index.d.ts.map +1 -1
  259. package/dist/index.cjs.map +1 -1
  260. package/dist/utils/float32.cjs +35 -0
  261. package/dist/utils/float32.d.ts +3 -0
  262. package/dist/utils/float32.d.ts.map +1 -0
  263. package/dist/utils/float32.js +16 -0
  264. package/dist/utils/float32.js.map +1 -0
  265. package/package.json +8 -8
  266. package/src/arrow/gpu/arrow-gpu-analytics-adapters.ts +77 -25
  267. package/src/arrow/gpu/arrow-gpu-analytics-readback.ts +52 -16
  268. package/src/arrow/gpu/arrow-gpu-table-conversion.ts +130 -31
  269. package/src/arrow/gpu/arrow-gpu-vector-conversion.ts +19 -0
  270. package/src/arrow/index.ts +1 -0
  271. package/src/arrow/vectors/arrow-temporal-gpu-vector.ts +2 -2
  272. package/src/gpu-core/gpu-bvh-bounds.ts +84 -0
  273. package/src/gpu-core/gpu-command-graph-budget-controller.ts +22 -2
  274. package/src/gpu-core/gpu-command-graph-submission-pacer.ts +102 -0
  275. package/src/gpu-core/gpu-group-aggregation.ts +68 -30
  276. package/src/gpu-core/index.ts +5 -0
  277. package/src/gpu-dataframe/gpu-analytics-compiler-utils.ts +7 -10
  278. package/src/gpu-dataframe/gpu-data-frame-query.ts +106 -25
  279. package/src/gpu-dataframe/gpu-data-frame.ts +35 -2
  280. package/src/gpu-dataframe/gpu-expression-shader.ts +172 -58
  281. package/src/gpu-dataframe/gpu-expression.ts +62 -9
  282. package/src/gpu-dataframe/gpu-global-aggregation-compiler.ts +15 -4
  283. package/src/gpu-dataframe/gpu-global-aggregation-query.ts +12 -3
  284. package/src/gpu-dataframe/gpu-global-sort-compiler.ts +231 -156
  285. package/src/gpu-dataframe/gpu-group-aggregation-compiler.ts +645 -61
  286. package/src/gpu-dataframe/gpu-group-by-query.ts +51 -14
  287. package/src/gpu-dataframe/gpu-join-compiler.ts +87 -6
  288. package/src/gpu-dataframe/gpu-query-compiler.ts +100 -18
  289. package/src/gpu-dataframe/index.ts +1 -1
  290. package/src/gpu-graph-algorithms/README.md +4 -2
  291. package/src/gpu-graph-algorithms/gpu-graph-single-source-shortest-path-internals.ts +248 -66
  292. package/src/gpu-graph-algorithms/gpu-graph-single-source-shortest-path.ts +218 -20
  293. package/src/gpu-physics/articulation-tree-shader.ts +169 -0
  294. package/src/gpu-physics/gpu-articulation-tree.ts +279 -0
  295. package/src/gpu-physics/gpu-physics-batch.ts +19 -13
  296. package/src/gpu-physics/gpu-physics-ensemble.ts +20 -4
  297. package/src/gpu-physics/gpu-rigid-body-world.ts +510 -93
  298. package/src/gpu-physics/index.ts +16 -0
  299. package/src/gpu-physics/rigid-body-cache-shaders.ts +18 -6
  300. package/src/gpu-physics/rigid-body-capacity.ts +25 -4
  301. package/src/gpu-physics/rigid-body-cast-index.ts +277 -0
  302. package/src/gpu-physics/rigid-body-ensemble-layout.ts +6 -2
  303. package/src/gpu-physics/rigid-body-ensemble-reset.ts +21 -9
  304. package/src/gpu-physics/rigid-body-ensemble-shaders.ts +18 -7
  305. package/src/gpu-physics/rigid-body-ensemble-transaction.ts +31 -13
  306. package/src/gpu-physics/rigid-body-event-compaction.ts +252 -0
  307. package/src/gpu-physics/rigid-body-event-snapshot.ts +76 -0
  308. package/src/gpu-physics/rigid-body-events.ts +63 -25
  309. package/src/gpu-physics/rigid-body-joints.ts +11 -11
  310. package/src/gpu-physics/rigid-body-queries.ts +202 -14
  311. package/src/gpu-physics/rigid-body-shaders.ts +4 -3
  312. package/src/gpu-physics/rigid-body-triggers.ts +64 -20
  313. package/src/gpu-physics/sphere-world-shaders.ts +53 -21
  314. package/src/gpu-project/projection-program.ts +1 -9
  315. package/src/gpu-sql/gpu-sql.ts +629 -124
  316. package/src/gpu-sql/index.ts +1 -1
  317. package/src/utils/float32.ts +16 -0
@@ -30,6 +30,7 @@ import type {GPUDataFrameDerivedColumn} from './gpu-data-frame-query';
30
30
  import type {GPUExpression} from './gpu-expression';
31
31
  import {
32
32
  compileGPUDataFrameQuery,
33
+ projectGPUDataFrameQueryResult,
33
34
  type CompiledGPUDataFrameQueryProps,
34
35
  type GPUDataFrameQueryExtensionContext,
35
36
  type GPUDataFrameQueryExtensionResult,
@@ -73,6 +74,12 @@ export class CompiledGPUDataFrameGlobalSort<
73
74
  }
74
75
  }
75
76
 
77
+ /** One globally ordered column and its stable sort controls. @internal */
78
+ export type GPUGlobalSortKey<Column extends string = string> = Readonly<{
79
+ column: Column;
80
+ options: GPUDataFrameNormalizedSortOptions;
81
+ }>;
82
+
76
83
  /** Adds explicit globally stable ordering while leaving source buffers and batches untouched. */
77
84
  export function compileGPUDataFrameGlobalSort<
78
85
  Source extends GPUTypeMap,
@@ -84,9 +91,15 @@ export function compileGPUDataFrameGlobalSort<
84
91
  derivedColumns: readonly GPUDataFrameDerivedColumn[],
85
92
  column: keyof Selection & string,
86
93
  options: GPUDataFrameNormalizedSortOptions,
87
- graph: GPUCommandGraph<GPUDataFrameQueryParameters>
94
+ graph: GPUCommandGraph<GPUDataFrameQueryParameters>,
95
+ resultColumns?: readonly (keyof Selection & string)[],
96
+ additionalKeys: readonly GPUGlobalSortKey<keyof Selection & string>[] = []
88
97
  ): CompiledGPUDataFrameGlobalSort<Selection> {
89
- validateGPUAnalyticsSource(source, [column]);
98
+ const keys = [{column, options}, ...additionalKeys];
99
+ validateGPUAnalyticsSource(
100
+ source,
101
+ keys.map(key => key.column)
102
+ );
90
103
  validateGPUGlobalSortCapacity(source, graph);
91
104
  return compileGPUDataFrameQuery<
92
105
  Source,
@@ -94,7 +107,7 @@ export function compileGPUDataFrameGlobalSort<
94
107
  Selection,
95
108
  CompiledGPUDataFrameGlobalSort<Selection>
96
109
  >(source, predicates, selectedColumns, graph, derivedColumns, {
97
- prepare: context => addGPUGlobalSortToGraph(context, column, options)
110
+ prepare: context => addGPUGlobalSortToGraph(context, keys, resultColumns)
98
111
  });
99
112
  }
100
113
 
@@ -127,154 +140,208 @@ function validateGPUGlobalSortCapacity<Source extends GPUTypeMap>(
127
140
  /** Stages keys and identities explicitly, then stably orders numeric values and null/NaN classes. */
128
141
  function addGPUGlobalSortToGraph<Selection extends GPUTypeMap>(
129
142
  context: GPUDataFrameQueryExtensionContext<Selection>,
130
- column: keyof Selection & string,
131
- options: GPUDataFrameNormalizedSortOptions
143
+ keys: readonly GPUGlobalSortKey<keyof Selection & string>[],
144
+ resultColumns?: readonly (keyof Selection & string)[]
132
145
  ): GPUDataFrameQueryExtensionResult<Selection, CompiledGPUDataFrameGlobalSort<Selection>> {
133
- const graph = context.graph;
134
146
  const prefix = `${context.queryId}-global-sort`;
135
147
  const ownedVectors: GPUVector[] = [];
136
148
 
137
149
  try {
138
- const input = graph.importGPUVector(`${prefix}-input`, getGPUAnalyticsVector(context, column));
139
- const field = context.table.schema.fields.find(candidate => candidate.name === column);
140
- const validityVector = field?.nullable ? context.validity[column] : undefined;
141
- if (field?.nullable && !validityVector && input.length > 0) {
142
- throw new Error(`GPUDataFrame nullable global sort column "${column}" requires GPU validity`);
150
+ const {column, options} = keys[0];
151
+ const {globalRowIndices, globalSelectedCount} = addGPUGlobalOrdering(
152
+ context,
153
+ keys,
154
+ ownedVectors,
155
+ prefix
156
+ );
157
+
158
+ const projection = resultColumns && projectGPUDataFrameQueryResult(context, resultColumns);
159
+ return {
160
+ table: projection?.table ?? context.table,
161
+ validity: projection?.validity ?? context.validity,
162
+ dictionaries: projection?.dictionaries ?? context.dictionaries,
163
+ ownedTables: projection ? [projection] : [],
164
+ ownedVectors,
165
+ createCompiled: props =>
166
+ new CompiledGPUDataFrameGlobalSort(
167
+ props,
168
+ column,
169
+ options,
170
+ globalRowIndices,
171
+ globalSelectedCount
172
+ )
173
+ };
174
+ } catch (error) {
175
+ for (const vector of ownedVectors) {
176
+ vector.destroy();
143
177
  }
144
- const validity = validityVector
145
- ? graph.importGPUVector(`${prefix}-source-validity`, validityVector)
146
- : undefined;
178
+ throw error;
179
+ }
180
+ }
147
181
 
148
- const globalRowIndices = createGPUAnalyticsOutputVector(
149
- graph.device,
150
- `${prefix}-row-indices`,
151
- 'uint32',
152
- input.length
153
- );
154
- ownedVectors.push(globalRowIndices);
155
- const globalSelectedCount = createGPUAnalyticsOutputVector(
156
- graph.device,
157
- `${prefix}-selected-count`,
158
- 'uint32',
159
- 1
160
- );
161
- ownedVectors.push(globalSelectedCount);
162
- const globalRows = graph.importGPUVector(`${prefix}-row-vector`, globalRowIndices).data[0];
163
- const selectedCount = graph.importGPUVector(`${prefix}-count-vector`, globalSelectedCount)
164
- .data[0];
182
+ /** Orders a prepared table and its selection within the caller's open graph. @internal */
183
+ export function addGPUGlobalOrdering<Selection extends GPUTypeMap>(
184
+ context: GPUDataFrameQueryExtensionContext<Selection>,
185
+ keys: readonly GPUGlobalSortKey<keyof Selection & string>[],
186
+ ownedVectors: GPUVector[],
187
+ prefix: string
188
+ ): {globalRowIndices: GPUVector<'uint32'>; globalSelectedCount: GPUVector<'uint32'>} {
189
+ const {graph} = context;
190
+ const {options} = keys[0];
191
+ const length = context.table.numRows;
192
+ const globalRowIndices = createGPUAnalyticsOutputVector(
193
+ graph.device,
194
+ `${prefix}-row-indices`,
195
+ 'uint32',
196
+ length
197
+ );
198
+ ownedVectors.push(globalRowIndices);
199
+ const globalSelectedCount = createGPUAnalyticsOutputVector(
200
+ graph.device,
201
+ `${prefix}-selected-count`,
202
+ 'uint32',
203
+ 1
204
+ );
205
+ ownedVectors.push(globalSelectedCount);
206
+ const globalRows = graph.importGPUVector(`${prefix}-row-vector`, globalRowIndices).data[0];
207
+ const selectedCount = graph.importGPUVector(`${prefix}-count-vector`, globalSelectedCount)
208
+ .data[0];
165
209
 
166
- graph.add(
167
- new GPUReduction({
168
- id: `${prefix}-count-selected`,
169
- input: context.selectedCounts,
170
- output: selectedCount,
171
- operation: 'sum'
172
- })
173
- );
210
+ graph.add(
211
+ new GPUReduction({
212
+ id: `${prefix}-count-selected`,
213
+ input: context.selectedCounts,
214
+ output: selectedCount,
215
+ operation: 'sum'
216
+ })
217
+ );
174
218
 
175
- if (input.length > 0) {
176
- const scratch = createGPUGlobalSortScratch(graph, prefix, input.length);
219
+ if (length > 0) {
220
+ const scratch = createGPUGlobalSortScratch(graph, prefix, length);
221
+ // Stable sorts transfer the ordering of less significant keys through ties.
222
+ for (let index = keys.length - 1; index >= 0; index--) {
223
+ addGPUGlobalSortKeyPasses(
224
+ context,
225
+ `${prefix}-key-${index}`,
226
+ keys[index],
227
+ scratch,
228
+ index === keys.length - 1
229
+ );
230
+ }
231
+
232
+ addGPUGlobalSortPublishPass(graph, `${prefix}-publish`, {
233
+ scratch,
234
+ output: globalRows,
235
+ count: selectedCount,
236
+ offset: options.offset ?? 0,
237
+ limit: options.limit ?? MAXIMUM_UINT32
238
+ });
239
+
240
+ if (options.offset || options.limit !== undefined) {
177
241
  let globalOffset = 0;
178
242
  let fallbackOffset = 0;
179
243
  for (const [batchIndex, batch] of context.table.batches.entries()) {
180
244
  if (batch.numRows > 0) {
181
- addGPUGlobalSortStagePass(graph, `${prefix}-stage-batch-${batchIndex}`, {
182
- input: input.data[batchIndex],
183
- selection: context.selectionMask.data[batchIndex],
184
- validity: validity?.data[batchIndex],
185
- scratch,
245
+ const selection = context.selectionMask.data[batchIndex];
246
+ addGPUGlobalTopKSelectionPass(graph, `${prefix}-select-batch-${batchIndex}`, {
247
+ ranks: scratch.sourceClasses,
248
+ selection,
186
249
  globalOffset,
187
- sourceOffset: batch.sourceInfo?.sourceRowIndexOffset ?? fallbackOffset,
188
- options
250
+ offset: options.offset ?? 0,
251
+ limit: options.limit ?? MAXIMUM_UINT32
189
252
  });
253
+ graph.add(
254
+ new GPUVisibilityWorkflow({
255
+ id: `${prefix}-visibility-batch-${batchIndex}`,
256
+ predicates: [{kind: 'selection', mask: selection}],
257
+ outputMask: selection,
258
+ output: context.rowIndices.data[batchIndex],
259
+ count: context.selectedCounts.data[batchIndex],
260
+ firstSourceIndex: batch.sourceInfo?.sourceRowIndexOffset ?? fallbackOffset
261
+ })
262
+ );
190
263
  }
191
264
  globalOffset += batch.numRows;
192
265
  fallbackOffset += batch.numRows;
193
266
  }
267
+ }
268
+ }
269
+ return {globalRowIndices, globalSelectedCount};
270
+ }
194
271
 
195
- graph.add(
196
- new GPUSort({
197
- id: `${prefix}-numeric`,
198
- keys: scratch.encodedKeys,
199
- values: scratch.sourceOrdinals,
200
- outputKeys: scratch.sortedKeys,
201
- outputValues: scratch.sortedOrdinals,
202
- direction: options.direction,
203
- algorithm: options.algorithm
204
- })
205
- );
206
-
207
- addGPUGlobalSortGatherClassesPass(graph, `${prefix}-gather-classes`, scratch);
208
- graph.add(
209
- new GPUSort({
210
- id: `${prefix}-classes`,
211
- keys: scratch.sortedKeys,
212
- values: scratch.sortedOrdinals,
213
- outputKeys: scratch.encodedKeys,
214
- outputValues: scratch.sourceOrdinals,
215
- direction: 'ascending',
216
- algorithm: options.algorithm
217
- })
218
- );
272
+ /** Stages and stably sorts one key, starting from the permutation of less significant keys. */
273
+ function addGPUGlobalSortKeyPasses<Selection extends GPUTypeMap>(
274
+ context: GPUDataFrameQueryExtensionContext<Selection>,
275
+ prefix: string,
276
+ {column, options}: GPUGlobalSortKey<keyof Selection & string>,
277
+ scratch: GPUGlobalSortScratch,
278
+ initialize: boolean
279
+ ): void {
280
+ const graph = context.graph;
281
+ const input = graph.importGPUVector(`${prefix}-input`, getGPUAnalyticsVector(context, column));
282
+ const field = context.table.schema.fields.find(candidate => candidate.name === column);
283
+ const validityVector = field?.nullable ? context.validity[column] : undefined;
284
+ if (field?.nullable && !validityVector && input.length > 0) {
285
+ throw new Error(`GPUDataFrame nullable global sort column "${column}" requires GPU validity`);
286
+ }
287
+ const validity = validityVector
288
+ ? graph.importGPUVector(`${prefix}-source-validity`, validityVector)
289
+ : undefined;
219
290
 
220
- addGPUGlobalSortPublishPass(graph, `${prefix}-publish`, {
291
+ let globalOffset = 0;
292
+ let fallbackOffset = 0;
293
+ for (const [batchIndex, batch] of context.table.batches.entries()) {
294
+ if (batch.numRows > 0) {
295
+ addGPUGlobalSortStagePass(graph, `${prefix}-stage-batch-${batchIndex}`, {
296
+ input: input.data[batchIndex],
297
+ selection: context.selectionMask.data[batchIndex],
298
+ validity: validity?.data[batchIndex],
221
299
  scratch,
222
- output: globalRows,
223
- count: selectedCount,
224
- offset: options.offset ?? 0,
225
- limit: options.limit ?? MAXIMUM_UINT32
300
+ globalOffset,
301
+ sourceOffset: batch.sourceInfo?.sourceRowIndexOffset ?? fallbackOffset,
302
+ options,
303
+ initialize
226
304
  });
227
-
228
- if (options.offset || options.limit !== undefined) {
229
- let globalOffset = 0;
230
- let fallbackOffset = 0;
231
- for (const [batchIndex, batch] of context.table.batches.entries()) {
232
- if (batch.numRows > 0) {
233
- const selection = context.selectionMask.data[batchIndex];
234
- addGPUGlobalTopKSelectionPass(graph, `${prefix}-select-batch-${batchIndex}`, {
235
- ranks: scratch.sourceClasses,
236
- selection,
237
- globalOffset,
238
- offset: options.offset ?? 0,
239
- limit: options.limit ?? MAXIMUM_UINT32
240
- });
241
- graph.add(
242
- new GPUVisibilityWorkflow({
243
- id: `${prefix}-visibility-batch-${batchIndex}`,
244
- predicates: [{kind: 'selection', mask: selection}],
245
- outputMask: selection,
246
- output: context.rowIndices.data[batchIndex],
247
- count: context.selectedCounts.data[batchIndex],
248
- firstSourceIndex: batch.sourceInfo?.sourceRowIndexOffset ?? fallbackOffset
249
- })
250
- );
251
- }
252
- globalOffset += batch.numRows;
253
- fallbackOffset += batch.numRows;
254
- }
255
- }
256
305
  }
306
+ globalOffset += batch.numRows;
307
+ fallbackOffset += batch.numRows;
308
+ }
257
309
 
258
- return {
259
- table: context.table,
260
- validity: context.validity,
261
- dictionaries: context.dictionaries,
262
- ownedVectors,
263
- createCompiled: props =>
264
- new CompiledGPUDataFrameGlobalSort(
265
- props,
266
- column,
267
- options,
268
- globalRowIndices,
269
- globalSelectedCount
270
- )
271
- };
272
- } catch (error) {
273
- for (const vector of ownedVectors) {
274
- vector.destroy();
275
- }
276
- throw error;
310
+ if (!initialize) {
311
+ addGPUGlobalSortGatherPass(graph, `${prefix}-gather-keys`, {
312
+ ordinals: scratch.sourceOrdinals,
313
+ input: scratch.encodedKeys,
314
+ output: scratch.sortedKeys
315
+ });
277
316
  }
317
+ graph.add(
318
+ new GPUSort({
319
+ id: `${prefix}-numeric`,
320
+ keys: initialize ? scratch.encodedKeys : scratch.sortedKeys,
321
+ values: scratch.sourceOrdinals,
322
+ outputKeys: initialize ? scratch.sortedKeys : scratch.encodedKeys,
323
+ outputValues: scratch.sortedOrdinals,
324
+ direction: options.direction,
325
+ algorithm: options.algorithm
326
+ })
327
+ );
328
+
329
+ addGPUGlobalSortGatherPass(graph, `${prefix}-gather-classes`, {
330
+ ordinals: scratch.sortedOrdinals,
331
+ input: scratch.sourceClasses,
332
+ output: scratch.sortedKeys
333
+ });
334
+ graph.add(
335
+ new GPUSort({
336
+ id: `${prefix}-classes`,
337
+ keys: scratch.sortedKeys,
338
+ values: scratch.sortedOrdinals,
339
+ outputKeys: scratch.encodedKeys,
340
+ outputValues: scratch.sourceOrdinals,
341
+ direction: 'ascending',
342
+ algorithm: options.algorithm
343
+ })
344
+ );
278
345
  }
279
346
 
280
347
  /** Allocates only explicit global permutation scratch; original dataframe vectors remain intact. */
@@ -304,6 +371,7 @@ function addGPUGlobalSortStagePass(
304
371
  scratch: GPUGlobalSortScratch;
305
372
  globalOffset: number;
306
373
  sourceOffset: number;
374
+ initialize: boolean;
307
375
  options: GPUDataFrameNormalizedSortOptions;
308
376
  }
309
377
  ): void {
@@ -350,9 +418,9 @@ const ROW_OFFSET: u32 = ${getViewElementOffset(props.scratch.sourceRows)}u;
350
418
  @group(0) @binding(1) var<storage, read> selectionMask: array<u32>;
351
419
  ${validityBinding}
352
420
  @group(0) @binding(${outputBinding}) var<storage, read_write> encodedKeys: array<u32>;
353
- @group(0) @binding(${outputBinding + 1}) var<storage, read_write> sourceOrdinals: array<u32>;
354
- @group(0) @binding(${outputBinding + 2}) var<storage, read_write> sourceClasses: array<u32>;
355
- @group(0) @binding(${outputBinding + 3}) var<storage, read_write> sourceRows: array<u32>;
421
+ ${props.initialize ? `@group(0) @binding(${outputBinding + 1}) var<storage, read_write> sourceOrdinals: array<u32>;` : ''}
422
+ @group(0) @binding(${outputBinding + (props.initialize ? 2 : 1)}) var<storage, read_write> sourceClasses: array<u32>;
423
+ ${props.initialize ? `@group(0) @binding(${outputBinding + 3}) var<storage, read_write> sourceRows: array<u32>;` : ''}
356
424
 
357
425
  @compute @workgroup_size(${LU_ANALYTICS_WORKGROUP_SIZE})
358
426
  fn main(
@@ -370,9 +438,9 @@ fn main(
370
438
  if (isNull) { rank = ${nullRank}u; }
371
439
  if (selectionMask[SELECTION_OFFSET + index] == 0u) { rank = 3u; }
372
440
  encodedKeys[KEY_OFFSET + ordinal] = select(${keyExpression}, 0u, isNull || isNaN);
373
- sourceOrdinals[ORDINAL_OFFSET + ordinal] = ordinal;
441
+ ${props.initialize ? 'sourceOrdinals[ORDINAL_OFFSET + ordinal] = ordinal;' : ''}
374
442
  sourceClasses[CLASS_OFFSET + ordinal] = rank;
375
- sourceRows[ROW_OFFSET + ordinal] = SOURCE_OFFSET + index;
443
+ ${props.initialize ? 'sourceRows[ROW_OFFSET + ordinal] = SOURCE_OFFSET + index;' : ''}
376
444
  }`;
377
445
  const resources: GraphBufferUse[] = [
378
446
  {buffer: props.input, usage: 'storage-read'},
@@ -386,12 +454,11 @@ fn main(
386
454
  resources.push({buffer: props.validity, usage: 'storage-read'});
387
455
  bindings['validityValues'] = props.validity;
388
456
  }
389
- for (const [name, view] of [
390
- ['encodedKeys', props.scratch.encodedKeys],
391
- ['sourceOrdinals', props.scratch.sourceOrdinals],
392
- ['sourceClasses', props.scratch.sourceClasses],
393
- ['sourceRows', props.scratch.sourceRows]
394
- ] as const) {
457
+ const outputs: [string, GraphDataView][] = [['encodedKeys', props.scratch.encodedKeys]];
458
+ if (props.initialize) outputs.push(['sourceOrdinals', props.scratch.sourceOrdinals]);
459
+ outputs.push(['sourceClasses', props.scratch.sourceClasses]);
460
+ if (props.initialize) outputs.push(['sourceRows', props.scratch.sourceRows]);
461
+ for (const [name, view] of outputs) {
395
462
  resources.push({buffer: view, usage: 'storage-write'});
396
463
  bindings[name] = view;
397
464
  }
@@ -410,46 +477,54 @@ function getGPUGlobalSortNumericKeyExpression(format: GPUAnalyticsScalarFormat):
410
477
  }
411
478
  }
412
479
 
413
- /** Gathers source null/NaN/filter classes in stable numeric order before the second stable sort. */
414
- function addGPUGlobalSortGatherClassesPass(
480
+ /** Gathers keys or classes by their current source ordinal permutation. */
481
+ function addGPUGlobalSortGatherPass(
415
482
  graph: GPUCommandGraph<GPUDataFrameQueryParameters>,
416
483
  id: string,
417
- scratch: GPUGlobalSortScratch
484
+ {
485
+ ordinals,
486
+ input,
487
+ output
488
+ }: {
489
+ ordinals: GraphDataView<'uint32'>;
490
+ input: GraphDataView<'uint32'>;
491
+ output: GraphDataView<'uint32'>;
492
+ }
418
493
  ): void {
419
494
  const source = /* wgsl */ `
420
- const ELEMENT_COUNT: u32 = ${scratch.sortedOrdinals.length}u;
421
- const ORDINAL_OFFSET: u32 = ${getViewElementOffset(scratch.sortedOrdinals)}u;
422
- const CLASS_OFFSET: u32 = ${getViewElementOffset(scratch.sourceClasses)}u;
423
- const OUTPUT_OFFSET: u32 = ${getViewElementOffset(scratch.sortedKeys)}u;
424
- @group(0) @binding(0) var<storage, read> sortedOrdinals: array<u32>;
425
- @group(0) @binding(1) var<storage, read> sourceClasses: array<u32>;
426
- @group(0) @binding(2) var<storage, read_write> sortedClasses: array<u32>;
495
+ const ELEMENT_COUNT: u32 = ${ordinals.length}u;
496
+ const ORDINAL_OFFSET: u32 = ${getViewElementOffset(ordinals)}u;
497
+ const INPUT_OFFSET: u32 = ${getViewElementOffset(input)}u;
498
+ const OUTPUT_OFFSET: u32 = ${getViewElementOffset(output)}u;
499
+ @group(0) @binding(0) var<storage, read> sourceOrdinals: array<u32>;
500
+ @group(0) @binding(1) var<storage, read> sourceValues: array<u32>;
501
+ @group(0) @binding(2) var<storage, read_write> gatheredValues: array<u32>;
427
502
 
428
503
  @compute @workgroup_size(${LU_ANALYTICS_WORKGROUP_SIZE})
429
504
  fn main(
430
505
  @builtin(local_invocation_index) localInvocationIndex: u32,
431
506
  @builtin(workgroup_id) workgroupId: vec3<u32>
432
507
  ) {
433
- ${getGPUAnalyticsInvocationIndexSource(graph, scratch.sortedOrdinals.length)}
508
+ ${getGPUAnalyticsInvocationIndexSource(graph, ordinals.length)}
434
509
  if (index < ELEMENT_COUNT) {
435
- sortedClasses[OUTPUT_OFFSET + index] =
436
- sourceClasses[CLASS_OFFSET + sortedOrdinals[ORDINAL_OFFSET + index]];
510
+ gatheredValues[OUTPUT_OFFSET + index] =
511
+ sourceValues[INPUT_OFFSET + sourceOrdinals[ORDINAL_OFFSET + index]];
437
512
  }
438
513
  }`;
439
514
  addGPUAnalyticsComputePass(graph, {
440
515
  id,
441
516
  source,
442
517
  resources: [
443
- {buffer: scratch.sortedOrdinals, usage: 'storage-read'},
444
- {buffer: scratch.sourceClasses, usage: 'storage-read'},
445
- {buffer: scratch.sortedKeys, usage: 'storage-write'}
518
+ {buffer: ordinals, usage: 'storage-read'},
519
+ {buffer: input, usage: 'storage-read'},
520
+ {buffer: output, usage: 'storage-write'}
446
521
  ],
447
522
  bindings: {
448
- sortedOrdinals: scratch.sortedOrdinals,
449
- sourceClasses: scratch.sourceClasses,
450
- sortedClasses: scratch.sortedKeys
523
+ sourceOrdinals: ordinals,
524
+ sourceValues: input,
525
+ gatheredValues: output
451
526
  },
452
- length: scratch.sortedOrdinals.length
527
+ length: ordinals.length
453
528
  });
454
529
  }
455
530