@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
@@ -18,7 +18,8 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
18
18
  var gpu_group_by_query_exports = {};
19
19
  __export(gpu_group_by_query_exports, {
20
20
  GPUDataFrameGroupByQuery: () => GPUDataFrameGroupByQuery,
21
- GPUDataFrameGroupedAggregationQuery: () => GPUDataFrameGroupedAggregationQuery
21
+ GPUDataFrameGroupedAggregationQuery: () => GPUDataFrameGroupedAggregationQuery,
22
+ normalizeGPUDataFrameAggregations: () => normalizeGPUDataFrameAggregations
22
23
  });
23
24
  module.exports = __toCommonJS(gpu_group_by_query_exports);
24
25
  var import_gpu_expression = require("./gpu-expression.cjs");
@@ -30,6 +31,8 @@ class GPUDataFrameGroupByQuery {
30
31
  key;
31
32
  /** Number of output groups inferred from labels or supplied explicitly by the caller. */
32
33
  groupCount;
34
+ /** Optional temporary AVG count budget. */
35
+ maxMeanScratchBytes;
33
36
  /** Validates grouping metadata entirely on the CPU. @internal */
34
37
  constructor(query, key, options = {}) {
35
38
  if (!query.selectedColumns.includes(key)) {
@@ -49,6 +52,10 @@ class GPUDataFrameGroupByQuery {
49
52
  if (!Number.isSafeInteger(groupCount) || !groupCount || groupCount < 1 || groupCount > 4294967295) {
50
53
  throw new Error("GPUDataFrame grouping requires a positive uint32 group count");
51
54
  }
55
+ if (options.maxMeanScratchBytes !== void 0 && (!Number.isSafeInteger(options.maxMeanScratchBytes) || options.maxMeanScratchBytes < 4)) {
56
+ throw new Error("GPUDataFrame mean scratch budget requires at least four bytes");
57
+ }
58
+ this.maxMeanScratchBytes = options.maxMeanScratchBytes;
52
59
  this.query = query;
53
60
  this.key = key;
54
61
  this.groupCount = groupCount;
@@ -56,7 +63,7 @@ class GPUDataFrameGroupByQuery {
56
63
  }
57
64
  /** Plans named dense count/sum/min/max/mean outputs without touching GPU resources. */
58
65
  aggregate(definitions) {
59
- return new GPUDataFrameGroupedAggregationQuery(this.query, this.key, this.groupCount, definitions);
66
+ return new GPUDataFrameGroupedAggregationQuery(this.query, this.key, this.groupCount, definitions, this.maxMeanScratchBytes);
60
67
  }
61
68
  }
62
69
  class GPUDataFrameGroupedAggregationQuery {
@@ -66,10 +73,13 @@ class GPUDataFrameGroupedAggregationQuery {
66
73
  key;
67
74
  /** Complete category domain and grouped output row count. */
68
75
  groupCount;
76
+ /** Optional temporary AVG count budget. */
77
+ maxMeanScratchBytes;
69
78
  /** Named operations normalized in the caller's original object insertion order. */
70
79
  definitions;
71
80
  /** Validates all supported operations, names, and selected float32 metric inputs. @internal */
72
- constructor(query, key, groupCount, definitions) {
81
+ constructor(query, key, groupCount, definitions, maxMeanScratchBytes) {
82
+ this.maxMeanScratchBytes = maxMeanScratchBytes;
73
83
  this.query = query;
74
84
  this.key = key;
75
85
  this.groupCount = groupCount;
@@ -78,10 +88,10 @@ class GPUDataFrameGroupedAggregationQuery {
78
88
  }
79
89
  /** Encodes reusable grouping, filtering, and derived work into one caller-owned command graph. */
80
90
  compile(graph) {
81
- return (0, import_gpu_group_aggregation_compiler.compileGPUDataFrameGroupedAggregation)(this.query.source, this.query.predicates, this.query.selectedColumns, this.query.derivedColumns, this.key, this.groupCount, this.definitions, graph);
91
+ return (0, import_gpu_group_aggregation_compiler.compileGPUDataFrameGroupedAggregation)(this.query.source, this.query.predicates, this.query.selectedColumns, this.query.derivedColumns, this.key, this.groupCount, this.definitions, graph, void 0, void 0, void 0, void 0, this.maxMeanScratchBytes);
82
92
  }
83
93
  }
84
- function normalizeGPUDataFrameAggregations(query, key, definitions) {
94
+ function normalizeGPUDataFrameAggregations(query, outputKey, definitions) {
85
95
  const entries = Object.entries(definitions);
86
96
  if (entries.length === 0) {
87
97
  throw new Error("GPUDataFrame grouping requires at least one aggregation");
@@ -89,7 +99,7 @@ function normalizeGPUDataFrameAggregations(query, key, definitions) {
89
99
  const formats = getGPUDataFrameQueryColumnFormats(query);
90
100
  const normalized = [];
91
101
  for (const [name, value] of entries) {
92
- if (name.length === 0 || name === key) {
102
+ if (name.length === 0 || name === outputKey) {
93
103
  throw new Error("GPUDataFrame aggregation names must be distinct from the group key");
94
104
  }
95
105
  if (value === "count") {
@@ -104,13 +114,13 @@ function normalizeGPUDataFrameAggregations(query, key, definitions) {
104
114
  throw new Error(`GPUDataFrame aggregation "${name}" requires exactly one operation`);
105
115
  }
106
116
  const [operation, column] = operations[0];
107
- if (operation !== "sum" && operation !== "min" && operation !== "max" && operation !== "mean") {
117
+ if (operation !== "count" && operation !== "sum" && operation !== "min" && operation !== "max" && operation !== "mean") {
108
118
  throw new Error(`GPUDataFrame aggregation "${name}" has an unsupported operation`);
109
119
  }
110
120
  if (typeof column !== "string" || !query.selectedColumns.includes(column)) {
111
121
  throw new Error(`GPUDataFrame aggregation "${name}" requires a selected input column`);
112
122
  }
113
- if (formats.get(column) !== "float32") {
123
+ if (operation !== "count" && formats.get(column) !== "float32") {
114
124
  throw new Error(`GPUDataFrame aggregation "${name}" requires a float32 input column`);
115
125
  }
116
126
  normalized.push(Object.freeze({ name, operation, column }));
@@ -137,5 +147,6 @@ function getGPUDataFrameDictionaryLength(dictionary) {
137
147
  // Annotate the CommonJS export names for ESM import in node:
138
148
  0 && (module.exports = {
139
149
  GPUDataFrameGroupByQuery,
140
- GPUDataFrameGroupedAggregationQuery
150
+ GPUDataFrameGroupedAggregationQuery,
151
+ normalizeGPUDataFrameAggregations
141
152
  });
@@ -20,10 +20,15 @@ export type GPUDataFrameColumnNamesOfFormat<T extends GPUTypeMap, SelectedColumn
20
20
  }[SelectedColumns];
21
21
  /** Optional dense key-domain size when source categorical labels cannot establish it. */
22
22
  export type GPUDataFrameGroupByOptions = Readonly<{
23
+ /** Dense category count when no dictionary supplies it. */
23
24
  groupCount?: number;
25
+ /** Maximum temporary bytes for a partition of AVG accumulators. */
26
+ maxMeanScratchBytes?: number;
24
27
  }>;
25
28
  /** One named count or a float32 statistic referencing a selected numerical column. */
26
29
  export type GPUDataFrameAggregationValue<T extends GPUTypeMap, SelectedColumns extends keyof T & string> = 'count' | Readonly<{
30
+ count: SelectedColumns;
31
+ }> | Readonly<{
27
32
  sum: GPUDataFrameColumnNamesOfFormat<T, SelectedColumns, 'float32'>;
28
33
  }> | Readonly<{
29
34
  min: GPUDataFrameColumnNamesOfFormat<T, SelectedColumns, 'float32'>;
@@ -36,7 +41,9 @@ export type GPUDataFrameAggregationValue<T extends GPUTypeMap, SelectedColumns e
36
41
  export type GPUDataFrameAggregationDefinitions<T extends GPUTypeMap, SelectedColumns extends keyof T & string = keyof T & string> = Readonly<Record<string, GPUDataFrameAggregationValue<T, SelectedColumns>>>;
37
42
  /** Exact GPU result formats for the group-key column and every requested statistic. */
38
43
  export type GPUDataFrameGroupedAggregationResult<Key extends string, Definitions extends Readonly<Record<string, unknown>>> = Record<Key, 'uint32'> & {
39
- [Name in keyof Definitions & string]: Definitions[Name] extends 'count' ? 'uint32' : 'float32';
44
+ [Name in keyof Definitions & string]: Definitions[Name] extends 'count' | {
45
+ count: string;
46
+ } ? 'uint32' : 'float32';
40
47
  };
41
48
  /**
42
49
  * Immutable dense-key grouping plan that never allocates GPU resources.
@@ -51,6 +58,8 @@ export declare class GPUDataFrameGroupByQuery<Logical extends GPUTypeMap, Select
51
58
  readonly key: Key;
52
59
  /** Number of output groups inferred from labels or supplied explicitly by the caller. */
53
60
  readonly groupCount: number;
61
+ /** Optional temporary AVG count budget. */
62
+ readonly maxMeanScratchBytes?: number;
54
63
  /** Validates grouping metadata entirely on the CPU. @internal */
55
64
  constructor(query: GPUDataFrameQuery<Logical, SelectedColumns, Source>, key: Key, options?: GPUDataFrameGroupByOptions);
56
65
  /** Plans named dense count/sum/min/max/mean outputs without touching GPU resources. */
@@ -64,11 +73,15 @@ export declare class GPUDataFrameGroupedAggregationQuery<Logical extends GPUType
64
73
  readonly key: Key;
65
74
  /** Complete category domain and grouped output row count. */
66
75
  readonly groupCount: number;
76
+ /** Optional temporary AVG count budget. */
77
+ readonly maxMeanScratchBytes?: number;
67
78
  /** Named operations normalized in the caller's original object insertion order. */
68
79
  readonly definitions: readonly GPUDataFrameAggregationDefinition[];
69
80
  /** Validates all supported operations, names, and selected float32 metric inputs. @internal */
70
- constructor(query: GPUDataFrameQuery<Logical, SelectedColumns, Source>, key: Key, groupCount: number, definitions: Definitions);
81
+ constructor(query: GPUDataFrameQuery<Logical, SelectedColumns, Source>, key: Key, groupCount: number, definitions: Definitions, maxMeanScratchBytes?: number);
71
82
  /** Encodes reusable grouping, filtering, and derived work into one caller-owned command graph. */
72
83
  compile(graph: GPUCommandGraph<GPUDataFrameQueryParameters>): CompiledGPUDataFrameGroupedAggregation<GPUDataFrameGroupedAggregationResult<Key, Definitions>>;
73
84
  }
85
+ /** Normalizes a closed set of operation shapes without accepting arbitrary shader expressions. @internal */
86
+ export declare function normalizeGPUDataFrameAggregations<Logical extends GPUTypeMap, SelectedColumns extends keyof Logical & string, Source extends GPUTypeMap>(query: Pick<GPUDataFrameQuery<Logical, SelectedColumns, Source>, 'source' | 'selectedColumns' | 'derivedColumns'>, outputKey: string | undefined, definitions: Readonly<Record<string, unknown>>): GPUDataFrameAggregationDefinition[];
74
87
  //# sourceMappingURL=gpu-group-by-query.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"gpu-group-by-query.d.ts","sourceRoot":"","sources":["../../src/gpu-dataframe/gpu-group-by-query.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,2BAA2B,CAAC;AAC1D,OAAO,KAAK,EAAC,eAAe,EAAC,MAAM,yBAAyB,CAAC;AAE7D,OAAO,KAAK,EAAC,iBAAiB,EAAC,kCAA+B;AAE9D,OAAO,EAEL,KAAK,sCAAsC,EAC5C,4CAAyC;AAC1C,OAAO,KAAK,EAAC,2BAA2B,EAAC,gCAA6B;AAEtE,8EAA8E;AAC9E,MAAM,MAAM,gCAAgC,GAAG,OAAO,GAAG,KAAK,GAAG,KAAK,GAAG,KAAK,GAAG,MAAM,CAAC;AAExF,oFAAoF;AACpF,MAAM,MAAM,iCAAiC,GAAG,QAAQ,CAAC;IACvD,mCAAmC;IACnC,IAAI,EAAE,M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AqBF;AAED,4GAA4G;AAC5G,wBAAgB,iCAAiC,CAC/C,OAAO,SAAS,UAAU,EAC1B,eAAe,SAAS,MAAM,OAAO,GAAG,MAAM,EAC9C,MAAM,SAAS,UAAU,EAEzB,KAAK,EAAE,IAAI,CACT,iBAAiB,CAAC,OAAO,EAAE,eAAe,EAAE,MAAM,CAAC,EACnD,QAAQ,GAAG,iBAAiB,GAAG,gBAAgB,CAChD,EACD,SAAS,EAAE,MAAM,GAAG,SAAS,EAC7B,WAAW,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,GAC7C,iCAAiC,EAAE,CA4CrC"}
@@ -17,6 +17,8 @@ export class GPUDataFrameGroupByQuery {
17
17
  key;
18
18
  /** Number of output groups inferred from labels or supplied explicitly by the caller. */
19
19
  groupCount;
20
+ /** Optional temporary AVG count budget. */
21
+ maxMeanScratchBytes;
20
22
  /** Validates grouping metadata entirely on the CPU. @internal */
21
23
  constructor(query, key, options = {}) {
22
24
  if (!query.selectedColumns.includes(key)) {
@@ -39,6 +41,11 @@ export class GPUDataFrameGroupByQuery {
39
41
  groupCount > 0xffffffff) {
40
42
  throw new Error('GPUDataFrame grouping requires a positive uint32 group count');
41
43
  }
44
+ if (options.maxMeanScratchBytes !== undefined &&
45
+ (!Number.isSafeInteger(options.maxMeanScratchBytes) || options.maxMeanScratchBytes < 4)) {
46
+ throw new Error('GPUDataFrame mean scratch budget requires at least four bytes');
47
+ }
48
+ this.maxMeanScratchBytes = options.maxMeanScratchBytes;
42
49
  this.query = query;
43
50
  this.key = key;
44
51
  this.groupCount = groupCount;
@@ -46,7 +53,7 @@ export class GPUDataFrameGroupByQuery {
46
53
  }
47
54
  /** Plans named dense count/sum/min/max/mean outputs without touching GPU resources. */
48
55
  aggregate(definitions) {
49
- return new GPUDataFrameGroupedAggregationQuery(this.query, this.key, this.groupCount, definitions);
56
+ return new GPUDataFrameGroupedAggregationQuery(this.query, this.key, this.groupCount, definitions, this.maxMeanScratchBytes);
50
57
  }
51
58
  }
52
59
  /** Immutable dense aggregation query lowered to existing graph-native GPU group primitives. */
@@ -57,10 +64,13 @@ export class GPUDataFrameGroupedAggregationQuery {
57
64
  key;
58
65
  /** Complete category domain and grouped output row count. */
59
66
  groupCount;
67
+ /** Optional temporary AVG count budget. */
68
+ maxMeanScratchBytes;
60
69
  /** Named operations normalized in the caller's original object insertion order. */
61
70
  definitions;
62
71
  /** Validates all supported operations, names, and selected float32 metric inputs. @internal */
63
- constructor(query, key, groupCount, definitions) {
72
+ constructor(query, key, groupCount, definitions, maxMeanScratchBytes) {
73
+ this.maxMeanScratchBytes = maxMeanScratchBytes;
64
74
  this.query = query;
65
75
  this.key = key;
66
76
  this.groupCount = groupCount;
@@ -69,11 +79,11 @@ export class GPUDataFrameGroupedAggregationQuery {
69
79
  }
70
80
  /** Encodes reusable grouping, filtering, and derived work into one caller-owned command graph. */
71
81
  compile(graph) {
72
- return compileGPUDataFrameGroupedAggregation(this.query.source, this.query.predicates, this.query.selectedColumns, this.query.derivedColumns, this.key, this.groupCount, this.definitions, graph);
82
+ return compileGPUDataFrameGroupedAggregation(this.query.source, this.query.predicates, this.query.selectedColumns, this.query.derivedColumns, this.key, this.groupCount, this.definitions, graph, undefined, undefined, undefined, undefined, this.maxMeanScratchBytes);
73
83
  }
74
84
  }
75
- /** Normalizes a closed set of operation shapes without accepting arbitrary shader expressions. */
76
- function normalizeGPUDataFrameAggregations(query, key, definitions) {
85
+ /** Normalizes a closed set of operation shapes without accepting arbitrary shader expressions. @internal */
86
+ export function normalizeGPUDataFrameAggregations(query, outputKey, definitions) {
77
87
  const entries = Object.entries(definitions);
78
88
  if (entries.length === 0) {
79
89
  throw new Error('GPUDataFrame grouping requires at least one aggregation');
@@ -81,7 +91,7 @@ function normalizeGPUDataFrameAggregations(query, key, definitions) {
81
91
  const formats = getGPUDataFrameQueryColumnFormats(query);
82
92
  const normalized = [];
83
93
  for (const [name, value] of entries) {
84
- if (name.length === 0 || name === key) {
94
+ if (name.length === 0 || name === outputKey) {
85
95
  throw new Error('GPUDataFrame aggregation names must be distinct from the group key');
86
96
  }
87
97
  if (value === 'count') {
@@ -96,13 +106,17 @@ function normalizeGPUDataFrameAggregations(query, key, definitions) {
96
106
  throw new Error(`GPUDataFrame aggregation "${name}" requires exactly one operation`);
97
107
  }
98
108
  const [operation, column] = operations[0];
99
- if (operation !== 'sum' && operation !== 'min' && operation !== 'max' && operation !== 'mean') {
109
+ if (operation !== 'count' &&
110
+ operation !== 'sum' &&
111
+ operation !== 'min' &&
112
+ operation !== 'max' &&
113
+ operation !== 'mean') {
100
114
  throw new Error(`GPUDataFrame aggregation "${name}" has an unsupported operation`);
101
115
  }
102
116
  if (typeof column !== 'string' || !query.selectedColumns.includes(column)) {
103
117
  throw new Error(`GPUDataFrame aggregation "${name}" requires a selected input column`);
104
118
  }
105
- if (formats.get(column) !== 'float32') {
119
+ if (operation !== 'count' && formats.get(column) !== 'float32') {
106
120
  throw new Error(`GPUDataFrame aggregation "${name}" requires a float32 input column`);
107
121
  }
108
122
  normalized.push(Object.freeze({ name, operation, column }));
@@ -1 +1 @@
1
- {"version":3,"file":"gpu-group-by-query.js","sourceRoot":"","sources":["../../src/gpu-dataframe/gpu-group-by-query.ts"],"names":[],"mappings":"AAAA,UAAU;AACV,+BAA+B;AAC/B,4DAA4D;AAC5D,0FAA0F;AAM1F,OAAO,EAAC,6BAA6B,EAAC,4BAAyB;AAC/D,OAAO,EACL,qCAAqC,EAEtC,4CAAyC;AAqD1C;;;;;GAKG;AACH,MAAM,OAAO,wBAAwB;IAMnC,kGAAkG;IACzF,KAAK,CAAsD;IACpE,6EAA6E;IACpE,GAAG,CAAM;IAClB,yFAAyF;IAChF,UAAU,CAAS;IAE5B,iEAAiE;IACjE,YACE,KAA0D,EAC1D,GAAQ,EACR,UAAsC,EAAE;QAExC,IAAI,CAAC,KAAK,CAAC,eAAe,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;YACzC,MA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,CAAC,CAAC;IAC5D,CAAC;IAED,OAAO,UAAU,CAAC;AACpB,CAAC;AAED,gGAAgG;AAChG,SAAS,iCAAiC,CAIxC,KAA0F;IAE1F,MAAM,OAAO,GAAG,IAAI,GAAG,CACrB,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,GAAG,CAC5B,KAAK,CAAC,EAAE,CACN,CAAC,KAAK,CAAC,IAAI,EAAE,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,UAAU,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,MAAM,IAAI,KAAK,CAAC,MAAM,CAAU,CAC3F,CACF,CAAC;IAEF,KAAK,MAAM,UAAU,IAAI,KAAK,CAAC,cAAc,EAAE,CAAC;QAC9C,MAAM,QAAQ,GAAG,6BAA6B,CAAC,UAAU,CAAC,UAAU,CAAC,IAAI,EAAE,OAAO,CAAC;aAChF,MAAM,EAAE;aACR,IAAI,EAAE,CAAC,KAAK,CAAC;QAChB,OAAO,CAAC,GAAG,CAAC,UAAU,CAAC,IAAI,EAAE,UAAU,CAAC,MAAM,IAAI,QAAQ,IAAI,SAAS,CAAC,CAAC;IAC3E,CAAC;IAED,OAAO,OAAO,CAAC;AACjB,CAAC;AAED,oGAAoG;AACpG,SAAS,+BAA+B,CAAC,UAAmC;IAC1E,IAAI,CAAC,UAAU,EAAE,CAAC;QAChB,OAAO,SAAS,CAAC;IACnB,CAAC;IACD,OAAO,KAAK,CAAC,OAAO,CAAC,UAAU,CAAC;QAC9B,CAAC,CAAC,UAAU,CAAC,MAAM;QACnB,CAAC,CAAE,UAA2C,CAAC,MAAM,CAAC,MAAM,CAAC;AACjE,CAAC"}
@@ -20,7 +20,8 @@ __export(gpu_join_compiler_exports, {
20
20
  CompiledGPUDataFrameJoin: () => CompiledGPUDataFrameJoin,
21
21
  CompiledGPUDataFrameLookup: () => CompiledGPUDataFrameLookup,
22
22
  compileGPUDataFrameJoin: () => compileGPUDataFrameJoin,
23
- compileGPUDataFrameLookup: () => compileGPUDataFrameLookup
23
+ compileGPUDataFrameLookup: () => compileGPUDataFrameLookup,
24
+ prepareGPUJoinAggregation: () => prepareGPUJoinAggregation
24
25
  });
25
26
  module.exports = __toCommonJS(gpu_join_compiler_exports);
26
27
  var import_core = require("@luma.gl/core");
@@ -91,12 +92,12 @@ class CompiledGPUDataFrameLookup extends CompiledGPUDataFrameHashQuery {
91
92
  this.probeCounts = resources.probeCounts;
92
93
  }
93
94
  }
94
- function compileGPUDataFrameJoin(source, predicates, selectedColumns, derivedColumns, right, options, joinType, graph) {
95
+ function compileGPUDataFrameJoin(source, predicates, selectedColumns, derivedColumns, right, options, joinType, graph, resultColumns) {
95
96
  validateGPUJoinSources(source, right, options, graph);
96
97
  const retainedRight = right.select(right.columnNames);
97
98
  try {
98
99
  return (0, import_gpu_query_compiler.compileGPUDataFrameQuery)(source, predicates, selectedColumns, graph, derivedColumns, {
99
- prepare: (context) => addGPUJoinToGraph(context, retainedRight, options, joinType)
100
+ prepare: (context) => addGPUJoinToGraph(context, retainedRight, options, joinType, resultColumns)
100
101
  });
101
102
  } catch (error) {
102
103
  retainedRight.destroy();
@@ -137,7 +138,7 @@ function validateGPUJoinSources(source, right, options, graph) {
137
138
  }
138
139
  }
139
140
  }
140
- function addGPUJoinToGraph(context, right, options, joinType) {
141
+ function addGPUJoinToGraph(context, right, options, joinType, resultColumns) {
141
142
  var _a;
142
143
  const ownedVectors = [];
143
144
  const id = `${context.queryId}-${joinType}-join`;
@@ -226,10 +227,12 @@ function addGPUJoinToGraph(context, right, options, joinType) {
226
227
  indexStatistics: indexState.indexStatistics,
227
228
  contractViolation: indexState.contractViolation
228
229
  };
230
+ const projection = resultColumns && (0, import_gpu_query_compiler.projectGPUDataFrameQueryResult)(context, resultColumns);
229
231
  return {
230
- table: context.table,
231
- validity: context.validity,
232
- dictionaries: context.dictionaries,
232
+ table: (projection == null ? void 0 : projection.table) ?? context.table,
233
+ validity: (projection == null ? void 0 : projection.validity) ?? context.validity,
234
+ dictionaries: (projection == null ? void 0 : projection.dictionaries) ?? context.dictionaries,
235
+ ownedTables: projection ? [projection] : [],
233
236
  ownedVectors,
234
237
  createCompiled: (props) => new CompiledGPUDataFrameJoin(props, resources)
235
238
  };
@@ -293,6 +296,55 @@ function addGPULookupToGraph(context, right, options) {
293
296
  throw error;
294
297
  }
295
298
  }
299
+ function prepareGPUJoinAggregation(source, context, join, prepare) {
300
+ const { graph } = context;
301
+ validateGPUJoinSources(source, join.right, join.options, graph);
302
+ const right = join.right.select(join.right.columnNames);
303
+ const ownedVectors = [];
304
+ const id = context.queryId + "-aggregate-join";
305
+ try {
306
+ const state = buildGPUJoinIndex(context, right, join.options, ownedVectors, id);
307
+ const violation = graph.importGPUVector(id + "-violation", state.contractViolation).data[0];
308
+ const matches = (0, import_gpu_core4.createTransientVectorView)(graph, id + "-matches", context.selectionMask);
309
+ const values = (0, import_gpu_core4.createTransientVectorView)(graph, id + "-values", context.selectionMask);
310
+ const probes = (0, import_gpu_core4.createTransientVectorView)(graph, id + "-probes", context.selectionMask);
311
+ const included = (0, import_gpu_core4.createTransientVectorView)(graph, id + "-included", context.selectionMask);
312
+ const statistics = (0, import_gpu_core4.createTransientView)(graph, id + "-statistics", "uint32", import_gpu_core2.GPU_HASH_QUERY_STATISTICS_LENGTH);
313
+ for (const [batchIndex, keys] of state.maskedLeftKeys.data.entries()) {
314
+ if (!keys.length)
315
+ continue;
316
+ const batchId = id + "-" + batchIndex;
317
+ graph.add(new import_gpu_core2.GPUHashIndexQuery({
318
+ id: batchId,
319
+ index: state.index,
320
+ keys,
321
+ values: values.data[batchIndex],
322
+ found: matches.data[batchIndex],
323
+ probes: probes.data[batchIndex],
324
+ statistics,
325
+ maxProbeCount: join.options.maxProbeCount
326
+ }));
327
+ addGPUJoinClassifyPass(graph, batchId + "-classify", {
328
+ matches: matches.data[batchIndex],
329
+ selection: context.selectionMask.data[batchIndex],
330
+ violation,
331
+ included: included.data[batchIndex],
332
+ joinType: join.type
333
+ });
334
+ }
335
+ const result = prepare({ ...context, selectionMask: included });
336
+ return {
337
+ ...result,
338
+ ownedVectors: [...ownedVectors, ...result.ownedVectors ?? []],
339
+ ownedTables: [...result.ownedTables ?? [], right]
340
+ };
341
+ } catch (error) {
342
+ for (const vector of ownedVectors)
343
+ vector.destroy();
344
+ right.destroy();
345
+ throw error;
346
+ }
347
+ }
296
348
  function buildGPUJoinIndex(context, right, options, ownedVectors, id) {
297
349
  const graph = context.graph;
298
350
  const leftVector = (0, import_gpu_analytics_compiler_utils.getGPUAnalyticsVector)(context, options.leftOn);
@@ -676,5 +728,6 @@ fn main(
676
728
  CompiledGPUDataFrameJoin,
677
729
  CompiledGPUDataFrameLookup,
678
730
  compileGPUDataFrameJoin,
679
- compileGPUDataFrameLookup
731
+ compileGPUDataFrameLookup,
732
+ prepareGPUJoinAggregation
680
733
  });
@@ -5,7 +5,7 @@ import type { GPUDataFrame } from "./gpu-data-frame.js";
5
5
  import type { GPUDataFrameDerivedColumn } from "./gpu-data-frame-query.js";
6
6
  import type { GPUExpression } from "./gpu-expression.js";
7
7
  import type { GPUDataFrameJoinType, GPUDataFrameNormalizedJoinOptions } from "./gpu-join-query.js";
8
- import { CompiledGPUDataFrameQuery, type CompiledGPUDataFrameQueryProps, type GPUDataFrameQueryParameters } from "./gpu-query-compiler.js";
8
+ import { CompiledGPUDataFrameQuery, type CompiledGPUDataFrameQueryProps, type GPUDataFrameQueryExtensionContext, type GPUDataFrameQueryExtensionResult, type GPUDataFrameQueryParameters } from "./gpu-query-compiler.js";
9
9
  type GPUJoinCommonResources<Right extends GPUTypeMap> = {
10
10
  right: GPUDataFrame<Right>;
11
11
  rightRowIndices: GPUVector<'uint32'>;
@@ -64,8 +64,16 @@ export declare class CompiledGPUDataFrameLookup<Left extends GPUTypeMap = GPUTyp
64
64
  constructor(props: CompiledGPUDataFrameQueryProps<Left>, resources: GPULookupResources<Right>);
65
65
  }
66
66
  /** Compiles a nullable, filtered, bounded join against an independently batched right side. */
67
- export declare function compileGPUDataFrameJoin<Source extends GPUTypeMap, Selection extends GPUTypeMap, Right extends GPUTypeMap>(source: GPUDataFrame<Source>, predicates: readonly GPUExpression<boolean, string>[], selectedColumns: readonly (keyof Selection & string)[], derivedColumns: readonly GPUDataFrameDerivedColumn[], right: GPUDataFrame<Right>, options: GPUDataFrameNormalizedJoinOptions, joinType: GPUDataFrameJoinType, graph: GPUCommandGraph<GPUDataFrameQueryParameters>): CompiledGPUDataFrameJoin<Selection, Right>;
67
+ export declare function compileGPUDataFrameJoin<Source extends GPUTypeMap, Selection extends GPUTypeMap, Right extends GPUTypeMap>(source: GPUDataFrame<Source>, predicates: readonly GPUExpression<boolean, string>[], selectedColumns: readonly (keyof Selection & string)[], derivedColumns: readonly GPUDataFrameDerivedColumn[], right: GPUDataFrame<Right>, options: GPUDataFrameNormalizedJoinOptions, joinType: GPUDataFrameJoinType, graph: GPUCommandGraph<GPUDataFrameQueryParameters>, resultColumns?: readonly (keyof Selection & string)[]): CompiledGPUDataFrameJoin<Selection, Right>;
68
68
  /** Compiles a nullable, filtered, source-aligned lookup without changing source batch boundaries. */
69
69
  export declare function compileGPUDataFrameLookup<Source extends GPUTypeMap, Selection extends GPUTypeMap, Right extends GPUTypeMap>(source: GPUDataFrame<Source>, predicates: readonly GPUExpression<boolean, string>[], selectedColumns: readonly (keyof Selection & string)[], derivedColumns: readonly GPUDataFrameDerivedColumn[], right: GPUDataFrame<Right>, options: GPUDataFrameNormalizedJoinOptions, graph: GPUCommandGraph<GPUDataFrameQueryParameters>): CompiledGPUDataFrameLookup<Selection, Right>;
70
+ /** Bound unique-right join consumed as a source-aligned mask by aggregation. @internal */
71
+ export type GPUAggregateJoin = Readonly<{
72
+ right: GPUDataFrame;
73
+ options: GPUDataFrameNormalizedJoinOptions;
74
+ type: GPUDataFrameJoinType;
75
+ }>;
76
+ /** Inserts join matching before an aggregate contribution without compacting the left columns. */
77
+ export declare function prepareGPUJoinAggregation<Source extends GPUTypeMap, Selection extends GPUTypeMap, Result extends GPUTypeMap, Compiled extends CompiledGPUDataFrameQuery<Result>>(source: GPUDataFrame<Source>, context: GPUDataFrameQueryExtensionContext<Selection>, join: GPUAggregateJoin, prepare: (context: GPUDataFrameQueryExtensionContext<Selection>) => GPUDataFrameQueryExtensionResult<Result, Compiled>): GPUDataFrameQueryExtensionResult<Result, Compiled>;
70
78
  export {};
71
79
  //# sourceMappingURL=gpu-join-compiler.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"gpu-join-compiler.d.ts","sourceRoot":"","sources":["../../src/gpu-dataframe/gpu-join-compiler.ts"],"names":[],"mappings":"AAMA,OAAO,EAAU,SAAS,EAAC,MAAM,yBAAyB,CAAC;AAC3D,OAAO,EAAC,KAAK,QAAQ,EAAE,KAAK,UAAU,EAAC,MAAM,2BAA2B,CAAC;AAEzE,OAAO,EACL,KAAK,eAAe,EAIrB,MAAM,yBAAyB,CAAC;AAoBjC,OAAO,KAAK,EAAC,YAAY,EAAC,4BAAyB;AACnD,OAAO,KAAK,EAAC,yBAAyB,EAAC,kCAA+B;AACtE,OAAO,KAAK,EAAC,aAAa,EAAC,4BAAyB;AACpD,OAAO,KAAK,EAAC,oBAAoB,EAAE,iCAAiC,EAAC,4BAAyB;AAC9F,OAAO,EACL,yBAAyB,EAEzB,KAAK,8BAA8B,EAGnC,KAAK,2BAA2B,EACjC,gCAA6B;AAa9B,KAAK,sBAAsB,CAAC,KAAK,SAAS,UAAU,IAAI;IACtD,KAAK,EAAE,YAAY,CAAC,KAAK,CAAC,CAAC;IAC3B,eAAe,EAAE,SAAS,CAAC,QAAQ,CAAC,CAAC;IACrC,eAAe,EAAE,SAAS,CAAC,QAAQ,CAAC,CAAC;IACrC,gBAAgB,EAAE,SAAS,CAAC,QAAQ,CAAC,CAAC;IACtC,iBAAiB,EAAE,SAAS,CAAC,QAAQ,CAAC,CAAC;CACxC,CAAC;AAEF,KAAK,gBAAgB,CAAC,KAAK,SAAS,UAAU,IAAI,sBAAsB,CAAC,KA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QAAQ,CAAC;IACtC,KAAK,EAAE,YAAY,CAAC;IACpB,OAAO,EAAE,iCAAiC,CAAC;IAC3C,IAAI,EAAE,oBAAoB,CAAC;CAC5B,CAAC,CAAC;AAEH,kGAAkG;AAClG,wBAAgB,yBAAyB,CACvC,MAAM,SAAS,UAAU,EACzB,SAAS,SAAS,UAAU,EAC5B,MAAM,SAAS,UAAU,EACzB,QAAQ,SAAS,yBAAyB,CAAC,MAAM,CAAC,EAElD,MAAM,EAAE,YAAY,CAAC,MAAM,CAAC,EAC5B,OAAO,EAAE,iCAAiC,CAAC,SAAS,CAAC,EACrD,IAAI,EAAE,gBAAgB,EACtB,OAAO,EAAE,CACP,OAAO,EAAE,iCAAiC,CAAC,SAAS,CAAC,KAClD,gCAAgC,CAAC,MAAM,EAAE,QAAQ,CAAC,GACtD,gCAAgC,CAAC,MAAM,EAAE,QAAQ,CAAC,CAqDpD"}
@@ -9,7 +9,7 @@ import { GPUHashIndexQuery, GPU_HASH_INDEX_EMPTY_KEY, GPU_HASH_INDEX_STATISTICS_
9
9
  import { GPUScan } from '@luma.gl/graph/gpu-core';
10
10
  import { createTransientVectorView, createTransientView, getViewElementOffset } from '@luma.gl/graph/gpu-core';
11
11
  import { LU_ANALYTICS_WORKGROUP_SIZE, addGPUAnalyticsComputePass, getGPUAnalyticsInvocationIndexSource, getGPUAnalyticsVector, validateGPUAnalyticsSource } from "./gpu-analytics-compiler-utils.js";
12
- import { CompiledGPUDataFrameQuery, compileGPUDataFrameQuery } from "./gpu-query-compiler.js";
12
+ import { CompiledGPUDataFrameQuery, compileGPUDataFrameQuery, projectGPUDataFrameQueryResult } from "./gpu-query-compiler.js";
13
13
  const UINT32_BYTE_LENGTH = Uint32Array.BYTES_PER_ELEMENT;
14
14
  const MAXIMUM_UINT32 = 0xffffffff;
15
15
  /** Shared right-source lease and explicit GPU diagnostics retained by bounded hash consumers. */
@@ -74,12 +74,12 @@ export class CompiledGPUDataFrameLookup extends CompiledGPUDataFrameHashQuery {
74
74
  }
75
75
  }
76
76
  /** Compiles a nullable, filtered, bounded join against an independently batched right side. */
77
- export function compileGPUDataFrameJoin(source, predicates, selectedColumns, derivedColumns, right, options, joinType, graph) {
77
+ export function compileGPUDataFrameJoin(source, predicates, selectedColumns, derivedColumns, right, options, joinType, graph, resultColumns) {
78
78
  validateGPUJoinSources(source, right, options, graph);
79
79
  const retainedRight = right.select(right.columnNames);
80
80
  try {
81
81
  return compileGPUDataFrameQuery(source, predicates, selectedColumns, graph, derivedColumns, {
82
- prepare: context => addGPUJoinToGraph(context, retainedRight, options, joinType)
82
+ prepare: context => addGPUJoinToGraph(context, retainedRight, options, joinType, resultColumns)
83
83
  });
84
84
  }
85
85
  catch (error) {
@@ -128,7 +128,7 @@ function validateGPUJoinSources(source, right, options, graph) {
128
128
  }
129
129
  }
130
130
  /** Materializes owned pair diagnostics while sharing one chunk-preserving right index. */
131
- function addGPUJoinToGraph(context, right, options, joinType) {
131
+ function addGPUJoinToGraph(context, right, options, joinType, resultColumns) {
132
132
  const ownedVectors = [];
133
133
  const id = `${context.queryId}-${joinType}-join`;
134
134
  try {
@@ -216,10 +216,12 @@ function addGPUJoinToGraph(context, right, options, joinType) {
216
216
  indexStatistics: indexState.indexStatistics,
217
217
  contractViolation: indexState.contractViolation
218
218
  };
219
+ const projection = resultColumns && projectGPUDataFrameQueryResult(context, resultColumns);
219
220
  return {
220
- table: context.table,
221
- validity: context.validity,
222
- dictionaries: context.dictionaries,
221
+ table: projection?.table ?? context.table,
222
+ validity: projection?.validity ?? context.validity,
223
+ dictionaries: projection?.dictionaries ?? context.dictionaries,
224
+ ownedTables: projection ? [projection] : [],
223
225
  ownedVectors,
224
226
  createCompiled: props => new CompiledGPUDataFrameJoin(props, resources)
225
227
  };
@@ -286,6 +288,57 @@ function addGPULookupToGraph(context, right, options) {
286
288
  throw error;
287
289
  }
288
290
  }
291
+ /** Inserts join matching before an aggregate contribution without compacting the left columns. */
292
+ export function prepareGPUJoinAggregation(source, context, join, prepare) {
293
+ const { graph } = context;
294
+ validateGPUJoinSources(source, join.right, join.options, graph);
295
+ const right = join.right.select(join.right.columnNames);
296
+ const ownedVectors = [];
297
+ const id = context.queryId + '-aggregate-join';
298
+ try {
299
+ const state = buildGPUJoinIndex(context, right, join.options, ownedVectors, id);
300
+ const violation = graph.importGPUVector(id + '-violation', state.contractViolation).data[0];
301
+ const matches = createTransientVectorView(graph, id + '-matches', context.selectionMask);
302
+ const values = createTransientVectorView(graph, id + '-values', context.selectionMask);
303
+ const probes = createTransientVectorView(graph, id + '-probes', context.selectionMask);
304
+ const included = createTransientVectorView(graph, id + '-included', context.selectionMask);
305
+ const statistics = createTransientView(graph, id + '-statistics', 'uint32', GPU_HASH_QUERY_STATISTICS_LENGTH);
306
+ for (const [batchIndex, keys] of state.maskedLeftKeys.data.entries()) {
307
+ if (!keys.length)
308
+ continue;
309
+ const batchId = id + '-' + batchIndex;
310
+ graph.add(new GPUHashIndexQuery({
311
+ id: batchId,
312
+ index: state.index,
313
+ keys,
314
+ values: values.data[batchIndex],
315
+ found: matches.data[batchIndex],
316
+ probes: probes.data[batchIndex],
317
+ statistics,
318
+ maxProbeCount: join.options.maxProbeCount
319
+ }));
320
+ addGPUJoinClassifyPass(graph, batchId + '-classify', {
321
+ matches: matches.data[batchIndex],
322
+ selection: context.selectionMask.data[batchIndex],
323
+ violation,
324
+ included: included.data[batchIndex],
325
+ joinType: join.type
326
+ });
327
+ }
328
+ const result = prepare({ ...context, selectionMask: included });
329
+ return {
330
+ ...result,
331
+ ownedVectors: [...ownedVectors, ...(result.ownedVectors ?? [])],
332
+ ownedTables: [...(result.ownedTables ?? []), right]
333
+ };
334
+ }
335
+ catch (error) {
336
+ for (const vector of ownedVectors)
337
+ vector.destroy();
338
+ right.destroy();
339
+ throw error;
340
+ }
341
+ }
289
342
  /** Builds one right index without concatenation and sanitizes filtered/nullable left source keys. */
290
343
  function buildGPUJoinIndex(context, right, options, ownedVectors, id) {
291
344
  const graph = context.graph;