@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.
- package/dist/arrow/gpu/arrow-gpu-analytics-adapters.cjs +22 -9
- package/dist/arrow/gpu/arrow-gpu-analytics-adapters.d.ts +11 -2
- package/dist/arrow/gpu/arrow-gpu-analytics-adapters.d.ts.map +1 -1
- package/dist/arrow/gpu/arrow-gpu-analytics-adapters.js +27 -10
- package/dist/arrow/gpu/arrow-gpu-analytics-adapters.js.map +1 -1
- package/dist/arrow/gpu/arrow-gpu-analytics-readback.cjs +24 -13
- package/dist/arrow/gpu/arrow-gpu-analytics-readback.d.ts +9 -1
- package/dist/arrow/gpu/arrow-gpu-analytics-readback.d.ts.map +1 -1
- package/dist/arrow/gpu/arrow-gpu-analytics-readback.js +41 -14
- package/dist/arrow/gpu/arrow-gpu-analytics-readback.js.map +1 -1
- package/dist/arrow/gpu/arrow-gpu-table-conversion.cjs +82 -23
- package/dist/arrow/gpu/arrow-gpu-table-conversion.d.ts +16 -1
- package/dist/arrow/gpu/arrow-gpu-table-conversion.d.ts.map +1 -1
- package/dist/arrow/gpu/arrow-gpu-table-conversion.js +98 -24
- package/dist/arrow/gpu/arrow-gpu-table-conversion.js.map +1 -1
- package/dist/arrow/gpu/arrow-gpu-vector-conversion.cjs +7 -0
- package/dist/arrow/gpu/arrow-gpu-vector-conversion.d.ts +2 -0
- package/dist/arrow/gpu/arrow-gpu-vector-conversion.d.ts.map +1 -1
- package/dist/arrow/gpu/arrow-gpu-vector-conversion.js +14 -0
- package/dist/arrow/gpu/arrow-gpu-vector-conversion.js.map +1 -1
- package/dist/arrow/index.cjs +2 -0
- package/dist/arrow/index.cjs.map +3 -3
- package/dist/arrow/index.d.ts +1 -1
- package/dist/arrow/index.d.ts.map +1 -1
- package/dist/arrow/index.js +1 -1
- package/dist/arrow/index.js.map +1 -1
- package/dist/arrow/vectors/arrow-temporal-gpu-vector.cjs +1 -2
- package/dist/arrow/vectors/arrow-temporal-gpu-vector.js +2 -2
- package/dist/arrow/vectors/arrow-temporal-gpu-vector.js.map +1 -1
- package/dist/dist.dev.js +62 -27
- package/dist/dist.min.js +48 -47
- package/dist/gpu-core/gpu-bvh-bounds.cjs +63 -0
- package/dist/gpu-core/gpu-bvh-bounds.d.ts +32 -0
- package/dist/gpu-core/gpu-bvh-bounds.d.ts.map +1 -0
- package/dist/gpu-core/gpu-bvh-bounds.js +56 -0
- package/dist/gpu-core/gpu-bvh-bounds.js.map +1 -0
- package/dist/gpu-core/gpu-command-graph-budget-controller.cjs +10 -2
- package/dist/gpu-core/gpu-command-graph-budget-controller.d.ts +4 -0
- package/dist/gpu-core/gpu-command-graph-budget-controller.d.ts.map +1 -1
- package/dist/gpu-core/gpu-command-graph-budget-controller.js +10 -2
- package/dist/gpu-core/gpu-command-graph-budget-controller.js.map +1 -1
- package/dist/gpu-core/gpu-command-graph-submission-pacer.cjs +92 -0
- package/dist/gpu-core/gpu-command-graph-submission-pacer.d.ts +41 -0
- package/dist/gpu-core/gpu-command-graph-submission-pacer.d.ts.map +1 -0
- package/dist/gpu-core/gpu-command-graph-submission-pacer.js +85 -0
- package/dist/gpu-core/gpu-command-graph-submission-pacer.js.map +1 -0
- package/dist/gpu-core/gpu-group-aggregation.cjs +45 -21
- package/dist/gpu-core/gpu-group-aggregation.d.ts +4 -0
- package/dist/gpu-core/gpu-group-aggregation.d.ts.map +1 -1
- package/dist/gpu-core/gpu-group-aggregation.js +58 -24
- package/dist/gpu-core/gpu-group-aggregation.js.map +1 -1
- package/dist/gpu-core/index.cjs +6 -0
- package/dist/gpu-core/index.cjs.map +3 -3
- package/dist/gpu-core/index.d.ts +4 -0
- package/dist/gpu-core/index.d.ts.map +1 -1
- package/dist/gpu-core/index.js +2 -0
- package/dist/gpu-core/index.js.map +1 -1
- package/dist/gpu-dataframe/gpu-analytics-compiler-utils.cjs +6 -6
- package/dist/gpu-dataframe/gpu-analytics-compiler-utils.d.ts +1 -1
- package/dist/gpu-dataframe/gpu-analytics-compiler-utils.d.ts.map +1 -1
- package/dist/gpu-dataframe/gpu-analytics-compiler-utils.js +6 -6
- package/dist/gpu-dataframe/gpu-analytics-compiler-utils.js.map +1 -1
- package/dist/gpu-dataframe/gpu-data-frame-query.cjs +55 -14
- package/dist/gpu-dataframe/gpu-data-frame-query.d.ts +13 -2
- package/dist/gpu-dataframe/gpu-data-frame-query.d.ts.map +1 -1
- package/dist/gpu-dataframe/gpu-data-frame-query.js +58 -17
- package/dist/gpu-dataframe/gpu-data-frame-query.js.map +1 -1
- package/dist/gpu-dataframe/gpu-data-frame.cjs +1 -3
- package/dist/gpu-dataframe/gpu-data-frame.d.ts +10 -0
- package/dist/gpu-dataframe/gpu-data-frame.d.ts.map +1 -1
- package/dist/gpu-dataframe/gpu-data-frame.js +1 -3
- package/dist/gpu-dataframe/gpu-data-frame.js.map +1 -1
- package/dist/gpu-dataframe/gpu-expression-shader.cjs +94 -44
- package/dist/gpu-dataframe/gpu-expression-shader.d.ts +8 -5
- package/dist/gpu-dataframe/gpu-expression-shader.d.ts.map +1 -1
- package/dist/gpu-dataframe/gpu-expression-shader.js +110 -47
- package/dist/gpu-dataframe/gpu-expression-shader.js.map +1 -1
- package/dist/gpu-dataframe/gpu-expression.cjs +14 -8
- package/dist/gpu-dataframe/gpu-expression.d.ts +12 -1
- package/dist/gpu-dataframe/gpu-expression.d.ts.map +1 -1
- package/dist/gpu-dataframe/gpu-expression.js +11 -6
- package/dist/gpu-dataframe/gpu-expression.js.map +1 -1
- package/dist/gpu-dataframe/gpu-global-aggregation-compiler.cjs +8 -4
- package/dist/gpu-dataframe/gpu-global-aggregation-compiler.d.ts +2 -1
- package/dist/gpu-dataframe/gpu-global-aggregation-compiler.d.ts.map +1 -1
- package/dist/gpu-dataframe/gpu-global-aggregation-compiler.js +10 -4
- package/dist/gpu-dataframe/gpu-global-aggregation-compiler.js.map +1 -1
- package/dist/gpu-dataframe/gpu-global-aggregation-query.cjs +2 -2
- package/dist/gpu-dataframe/gpu-global-aggregation-query.d.ts +5 -1
- package/dist/gpu-dataframe/gpu-global-aggregation-query.d.ts.map +1 -1
- package/dist/gpu-dataframe/gpu-global-aggregation-query.js +6 -2
- package/dist/gpu-dataframe/gpu-global-aggregation-query.js.map +1 -1
- package/dist/gpu-dataframe/gpu-global-sort-compiler.cjs +156 -124
- package/dist/gpu-dataframe/gpu-global-sort-compiler.d.ts +12 -2
- package/dist/gpu-dataframe/gpu-global-sort-compiler.d.ts.map +1 -1
- package/dist/gpu-dataframe/gpu-global-sort-compiler.js +160 -128
- package/dist/gpu-dataframe/gpu-global-sort-compiler.js.map +1 -1
- package/dist/gpu-dataframe/gpu-group-aggregation-compiler.cjs +366 -53
- package/dist/gpu-dataframe/gpu-group-aggregation-compiler.d.ts +26 -4
- package/dist/gpu-dataframe/gpu-group-aggregation-compiler.d.ts.map +1 -1
- package/dist/gpu-dataframe/gpu-group-aggregation-compiler.js +378 -47
- package/dist/gpu-dataframe/gpu-group-aggregation-compiler.js.map +1 -1
- package/dist/gpu-dataframe/gpu-group-by-query.cjs +20 -9
- package/dist/gpu-dataframe/gpu-group-by-query.d.ts +15 -2
- package/dist/gpu-dataframe/gpu-group-by-query.d.ts.map +1 -1
- package/dist/gpu-dataframe/gpu-group-by-query.js +22 -8
- package/dist/gpu-dataframe/gpu-group-by-query.js.map +1 -1
- package/dist/gpu-dataframe/gpu-join-compiler.cjs +61 -8
- package/dist/gpu-dataframe/gpu-join-compiler.d.ts +10 -2
- package/dist/gpu-dataframe/gpu-join-compiler.d.ts.map +1 -1
- package/dist/gpu-dataframe/gpu-join-compiler.js +60 -7
- package/dist/gpu-dataframe/gpu-join-compiler.js.map +1 -1
- package/dist/gpu-dataframe/gpu-query-compiler.cjs +61 -11
- package/dist/gpu-dataframe/gpu-query-compiler.d.ts +5 -1
- package/dist/gpu-dataframe/gpu-query-compiler.d.ts.map +1 -1
- package/dist/gpu-dataframe/gpu-query-compiler.js +61 -10
- package/dist/gpu-dataframe/gpu-query-compiler.js.map +1 -1
- package/dist/gpu-dataframe/index.cjs +4 -2
- package/dist/gpu-dataframe/index.cjs.map +3 -3
- package/dist/gpu-dataframe/index.d.ts +1 -1
- package/dist/gpu-dataframe/index.d.ts.map +1 -1
- package/dist/gpu-dataframe/index.js +1 -1
- package/dist/gpu-dataframe/index.js.map +1 -1
- package/dist/gpu-graph/index.cjs.map +1 -1
- package/dist/gpu-graph-algorithms/benchmarks.cjs.map +2 -2
- package/dist/gpu-graph-algorithms/gpu-graph-single-source-shortest-path-internals.cjs +182 -62
- package/dist/gpu-graph-algorithms/gpu-graph-single-source-shortest-path-internals.d.ts +29 -2
- package/dist/gpu-graph-algorithms/gpu-graph-single-source-shortest-path-internals.d.ts.map +1 -1
- package/dist/gpu-graph-algorithms/gpu-graph-single-source-shortest-path-internals.js +200 -64
- package/dist/gpu-graph-algorithms/gpu-graph-single-source-shortest-path-internals.js.map +1 -1
- package/dist/gpu-graph-algorithms/gpu-graph-single-source-shortest-path.cjs +135 -9
- package/dist/gpu-graph-algorithms/gpu-graph-single-source-shortest-path.d.ts +55 -8
- package/dist/gpu-graph-algorithms/gpu-graph-single-source-shortest-path.d.ts.map +1 -1
- package/dist/gpu-graph-algorithms/gpu-graph-single-source-shortest-path.js +145 -14
- package/dist/gpu-graph-algorithms/gpu-graph-single-source-shortest-path.js.map +1 -1
- package/dist/gpu-graph-algorithms/index.cjs.map +3 -3
- package/dist/gpu-physics/articulation-tree-shader.cjs +177 -0
- package/dist/gpu-physics/articulation-tree-shader.d.ts +3 -0
- package/dist/gpu-physics/articulation-tree-shader.d.ts.map +1 -0
- package/dist/gpu-physics/articulation-tree-shader.js +159 -0
- package/dist/gpu-physics/articulation-tree-shader.js.map +1 -0
- package/dist/gpu-physics/gpu-articulation-tree.cjs +203 -0
- package/dist/gpu-physics/gpu-articulation-tree.d.ts +81 -0
- package/dist/gpu-physics/gpu-articulation-tree.d.ts.map +1 -0
- package/dist/gpu-physics/gpu-articulation-tree.js +205 -0
- package/dist/gpu-physics/gpu-articulation-tree.js.map +1 -0
- package/dist/gpu-physics/gpu-physics-batch.cjs +11 -10
- package/dist/gpu-physics/gpu-physics-batch.d.ts +1 -0
- package/dist/gpu-physics/gpu-physics-batch.d.ts.map +1 -1
- package/dist/gpu-physics/gpu-physics-batch.js +14 -10
- package/dist/gpu-physics/gpu-physics-batch.js.map +1 -1
- package/dist/gpu-physics/gpu-physics-ensemble.cjs +9 -4
- package/dist/gpu-physics/gpu-physics-ensemble.d.ts +10 -1
- package/dist/gpu-physics/gpu-physics-ensemble.d.ts.map +1 -1
- package/dist/gpu-physics/gpu-physics-ensemble.js +11 -4
- package/dist/gpu-physics/gpu-physics-ensemble.js.map +1 -1
- package/dist/gpu-physics/gpu-rigid-body-world.cjs +323 -68
- package/dist/gpu-physics/gpu-rigid-body-world.d.ts +59 -2
- package/dist/gpu-physics/gpu-rigid-body-world.d.ts.map +1 -1
- package/dist/gpu-physics/gpu-rigid-body-world.js +400 -75
- package/dist/gpu-physics/gpu-rigid-body-world.js.map +1 -1
- package/dist/gpu-physics/index.cjs +3 -0
- package/dist/gpu-physics/index.cjs.map +3 -3
- package/dist/gpu-physics/index.d.ts +3 -1
- package/dist/gpu-physics/index.d.ts.map +1 -1
- package/dist/gpu-physics/index.js +1 -0
- package/dist/gpu-physics/index.js.map +1 -1
- package/dist/gpu-physics/rigid-body-cache-shaders.cjs +10 -6
- package/dist/gpu-physics/rigid-body-cache-shaders.d.ts +2 -1
- package/dist/gpu-physics/rigid-body-cache-shaders.d.ts.map +1 -1
- package/dist/gpu-physics/rigid-body-cache-shaders.js +15 -6
- package/dist/gpu-physics/rigid-body-cache-shaders.js.map +1 -1
- package/dist/gpu-physics/rigid-body-capacity.cjs +15 -2
- package/dist/gpu-physics/rigid-body-capacity.d.ts +3 -1
- package/dist/gpu-physics/rigid-body-capacity.d.ts.map +1 -1
- package/dist/gpu-physics/rigid-body-capacity.js +21 -2
- package/dist/gpu-physics/rigid-body-capacity.js.map +1 -1
- package/dist/gpu-physics/rigid-body-cast-index.cjs +192 -0
- package/dist/gpu-physics/rigid-body-cast-index.d.ts +44 -0
- package/dist/gpu-physics/rigid-body-cast-index.d.ts.map +1 -0
- package/dist/gpu-physics/rigid-body-cast-index.js +194 -0
- package/dist/gpu-physics/rigid-body-cast-index.js.map +1 -0
- package/dist/gpu-physics/rigid-body-ensemble-layout.cjs +4 -2
- package/dist/gpu-physics/rigid-body-ensemble-layout.d.ts +2 -1
- package/dist/gpu-physics/rigid-body-ensemble-layout.d.ts.map +1 -1
- package/dist/gpu-physics/rigid-body-ensemble-layout.js +5 -2
- package/dist/gpu-physics/rigid-body-ensemble-layout.js.map +1 -1
- package/dist/gpu-physics/rigid-body-ensemble-reset.cjs +11 -9
- package/dist/gpu-physics/rigid-body-ensemble-reset.d.ts +1 -1
- package/dist/gpu-physics/rigid-body-ensemble-reset.d.ts.map +1 -1
- package/dist/gpu-physics/rigid-body-ensemble-reset.js +13 -9
- package/dist/gpu-physics/rigid-body-ensemble-reset.js.map +1 -1
- package/dist/gpu-physics/rigid-body-ensemble-shaders.cjs +14 -7
- package/dist/gpu-physics/rigid-body-ensemble-shaders.d.ts +5 -0
- package/dist/gpu-physics/rigid-body-ensemble-shaders.d.ts.map +1 -1
- package/dist/gpu-physics/rigid-body-ensemble-shaders.js +17 -7
- package/dist/gpu-physics/rigid-body-ensemble-shaders.js.map +1 -1
- package/dist/gpu-physics/rigid-body-ensemble-transaction.cjs +21 -11
- package/dist/gpu-physics/rigid-body-ensemble-transaction.d.ts +2 -2
- package/dist/gpu-physics/rigid-body-ensemble-transaction.d.ts.map +1 -1
- package/dist/gpu-physics/rigid-body-ensemble-transaction.js +28 -12
- package/dist/gpu-physics/rigid-body-ensemble-transaction.js.map +1 -1
- package/dist/gpu-physics/rigid-body-event-compaction.cjs +184 -0
- package/dist/gpu-physics/rigid-body-event-compaction.d.ts +35 -0
- package/dist/gpu-physics/rigid-body-event-compaction.d.ts.map +1 -0
- package/dist/gpu-physics/rigid-body-event-compaction.js +168 -0
- package/dist/gpu-physics/rigid-body-event-compaction.js.map +1 -0
- package/dist/gpu-physics/rigid-body-event-snapshot.cjs +51 -0
- package/dist/gpu-physics/rigid-body-event-snapshot.d.ts +33 -0
- package/dist/gpu-physics/rigid-body-event-snapshot.d.ts.map +1 -0
- package/dist/gpu-physics/rigid-body-event-snapshot.js +34 -0
- package/dist/gpu-physics/rigid-body-event-snapshot.js.map +1 -0
- package/dist/gpu-physics/rigid-body-events.cjs +57 -25
- package/dist/gpu-physics/rigid-body-events.d.ts +2 -1
- package/dist/gpu-physics/rigid-body-events.d.ts.map +1 -1
- package/dist/gpu-physics/rigid-body-events.js +60 -25
- package/dist/gpu-physics/rigid-body-events.js.map +1 -1
- package/dist/gpu-physics/rigid-body-joints.cjs +8 -3
- package/dist/gpu-physics/rigid-body-joints.d.ts +2 -0
- package/dist/gpu-physics/rigid-body-joints.d.ts.map +1 -1
- package/dist/gpu-physics/rigid-body-joints.js +10 -6
- package/dist/gpu-physics/rigid-body-joints.js.map +1 -1
- package/dist/gpu-physics/rigid-body-queries.cjs +159 -16
- package/dist/gpu-physics/rigid-body-queries.d.ts +24 -1
- package/dist/gpu-physics/rigid-body-queries.d.ts.map +1 -1
- package/dist/gpu-physics/rigid-body-queries.js +166 -14
- package/dist/gpu-physics/rigid-body-queries.js.map +1 -1
- package/dist/gpu-physics/rigid-body-shaders.cjs +3 -3
- package/dist/gpu-physics/rigid-body-shaders.d.ts +1 -1
- package/dist/gpu-physics/rigid-body-shaders.d.ts.map +1 -1
- package/dist/gpu-physics/rigid-body-shaders.js +3 -3
- package/dist/gpu-physics/rigid-body-shaders.js.map +1 -1
- package/dist/gpu-physics/rigid-body-triggers.cjs +53 -15
- package/dist/gpu-physics/rigid-body-triggers.d.ts +1 -0
- package/dist/gpu-physics/rigid-body-triggers.d.ts.map +1 -1
- package/dist/gpu-physics/rigid-body-triggers.js +55 -15
- package/dist/gpu-physics/rigid-body-triggers.js.map +1 -1
- package/dist/gpu-physics/sphere-world-shaders.cjs +48 -20
- package/dist/gpu-physics/sphere-world-shaders.d.ts.map +1 -1
- package/dist/gpu-physics/sphere-world-shaders.js +51 -21
- package/dist/gpu-physics/sphere-world-shaders.js.map +1 -1
- package/dist/gpu-project/benchmarks.cjs.map +2 -2
- package/dist/gpu-project/crs.cjs.map +2 -2
- package/dist/gpu-project/graph.cjs.map +2 -2
- package/dist/gpu-project/index.cjs.map +2 -2
- package/dist/gpu-project/projection-program.cjs +2 -9
- package/dist/gpu-project/projection-program.d.ts.map +1 -1
- package/dist/gpu-project/projection-program.js +1 -8
- package/dist/gpu-project/projection-program.js.map +1 -1
- package/dist/gpu-simple-graph/index.cjs.map +2 -2
- package/dist/gpu-sql/gpu-sql.cjs +345 -81
- package/dist/gpu-sql/gpu-sql.d.ts +42 -2
- package/dist/gpu-sql/gpu-sql.d.ts.map +1 -1
- package/dist/gpu-sql/gpu-sql.js +393 -90
- package/dist/gpu-sql/gpu-sql.js.map +1 -1
- package/dist/gpu-sql/index.cjs.map +3 -3
- package/dist/gpu-sql/index.d.ts +1 -1
- package/dist/gpu-sql/index.d.ts.map +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/utils/float32.cjs +35 -0
- package/dist/utils/float32.d.ts +3 -0
- package/dist/utils/float32.d.ts.map +1 -0
- package/dist/utils/float32.js +16 -0
- package/dist/utils/float32.js.map +1 -0
- package/package.json +8 -8
- package/src/arrow/gpu/arrow-gpu-analytics-adapters.ts +77 -25
- package/src/arrow/gpu/arrow-gpu-analytics-readback.ts +52 -16
- package/src/arrow/gpu/arrow-gpu-table-conversion.ts +130 -31
- package/src/arrow/gpu/arrow-gpu-vector-conversion.ts +19 -0
- package/src/arrow/index.ts +1 -0
- package/src/arrow/vectors/arrow-temporal-gpu-vector.ts +2 -2
- package/src/gpu-core/gpu-bvh-bounds.ts +84 -0
- package/src/gpu-core/gpu-command-graph-budget-controller.ts +22 -2
- package/src/gpu-core/gpu-command-graph-submission-pacer.ts +102 -0
- package/src/gpu-core/gpu-group-aggregation.ts +68 -30
- package/src/gpu-core/index.ts +5 -0
- package/src/gpu-dataframe/gpu-analytics-compiler-utils.ts +7 -10
- package/src/gpu-dataframe/gpu-data-frame-query.ts +106 -25
- package/src/gpu-dataframe/gpu-data-frame.ts +35 -2
- package/src/gpu-dataframe/gpu-expression-shader.ts +172 -58
- package/src/gpu-dataframe/gpu-expression.ts +62 -9
- package/src/gpu-dataframe/gpu-global-aggregation-compiler.ts +15 -4
- package/src/gpu-dataframe/gpu-global-aggregation-query.ts +12 -3
- package/src/gpu-dataframe/gpu-global-sort-compiler.ts +231 -156
- package/src/gpu-dataframe/gpu-group-aggregation-compiler.ts +645 -61
- package/src/gpu-dataframe/gpu-group-by-query.ts +51 -14
- package/src/gpu-dataframe/gpu-join-compiler.ts +87 -6
- package/src/gpu-dataframe/gpu-query-compiler.ts +100 -18
- package/src/gpu-dataframe/index.ts +1 -1
- package/src/gpu-graph-algorithms/README.md +4 -2
- package/src/gpu-graph-algorithms/gpu-graph-single-source-shortest-path-internals.ts +248 -66
- package/src/gpu-graph-algorithms/gpu-graph-single-source-shortest-path.ts +218 -20
- package/src/gpu-physics/articulation-tree-shader.ts +169 -0
- package/src/gpu-physics/gpu-articulation-tree.ts +279 -0
- package/src/gpu-physics/gpu-physics-batch.ts +19 -13
- package/src/gpu-physics/gpu-physics-ensemble.ts +20 -4
- package/src/gpu-physics/gpu-rigid-body-world.ts +510 -93
- package/src/gpu-physics/index.ts +16 -0
- package/src/gpu-physics/rigid-body-cache-shaders.ts +18 -6
- package/src/gpu-physics/rigid-body-capacity.ts +25 -4
- package/src/gpu-physics/rigid-body-cast-index.ts +277 -0
- package/src/gpu-physics/rigid-body-ensemble-layout.ts +6 -2
- package/src/gpu-physics/rigid-body-ensemble-reset.ts +21 -9
- package/src/gpu-physics/rigid-body-ensemble-shaders.ts +18 -7
- package/src/gpu-physics/rigid-body-ensemble-transaction.ts +31 -13
- package/src/gpu-physics/rigid-body-event-compaction.ts +252 -0
- package/src/gpu-physics/rigid-body-event-snapshot.ts +76 -0
- package/src/gpu-physics/rigid-body-events.ts +63 -25
- package/src/gpu-physics/rigid-body-joints.ts +11 -11
- package/src/gpu-physics/rigid-body-queries.ts +202 -14
- package/src/gpu-physics/rigid-body-shaders.ts +4 -3
- package/src/gpu-physics/rigid-body-triggers.ts +64 -20
- package/src/gpu-physics/sphere-world-shaders.ts +53 -21
- package/src/gpu-project/projection-program.ts +1 -9
- package/src/gpu-sql/gpu-sql.ts +629 -124
- package/src/gpu-sql/index.ts +1 -1
- package/src/utils/float32.ts +16 -0
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
3
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
4
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
5
|
+
var __export = (target, all) => {
|
|
6
|
+
for (var name in all)
|
|
7
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
8
|
+
};
|
|
9
|
+
var __copyProps = (to, from, except, desc) => {
|
|
10
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
11
|
+
for (let key of __getOwnPropNames(from))
|
|
12
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
13
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
14
|
+
}
|
|
15
|
+
return to;
|
|
16
|
+
};
|
|
17
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
|
+
var float32_exports = {};
|
|
19
|
+
__export(float32_exports, {
|
|
20
|
+
nextFloat32: () => nextFloat32
|
|
21
|
+
});
|
|
22
|
+
module.exports = __toCommonJS(float32_exports);
|
|
23
|
+
const float = new Float32Array(1);
|
|
24
|
+
const bits = new Uint32Array(float.buffer);
|
|
25
|
+
function nextFloat32(value, increase) {
|
|
26
|
+
if (value === 0)
|
|
27
|
+
return increase ? 2 ** -149 : -(2 ** -149);
|
|
28
|
+
float[0] = value;
|
|
29
|
+
bits[0] += value > 0 === increase ? 1 : -1;
|
|
30
|
+
return float[0];
|
|
31
|
+
}
|
|
32
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
33
|
+
0 && (module.exports = {
|
|
34
|
+
nextFloat32
|
|
35
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"float32.d.ts","sourceRoot":"","sources":["../../src/utils/float32.ts"],"names":[],"mappings":"AASA,0FAA0F;AAC1F,wBAAgB,WAAW,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,GAAG,MAAM,CAKpE"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
// luma.gl
|
|
2
|
+
// SPDX-License-Identifier: MIT
|
|
3
|
+
// SPDX-FileCopyrightText: Copyright (c) vis.gl contributors
|
|
4
|
+
/** Storage shared by the float and bit views. */
|
|
5
|
+
const float = new Float32Array(1);
|
|
6
|
+
/** IEEE 754 encoding of the same scalar. */
|
|
7
|
+
const bits = new Uint32Array(float.buffer);
|
|
8
|
+
/** Step a finite binary32 value by one representable value in the requested direction. */
|
|
9
|
+
export function nextFloat32(value, increase) {
|
|
10
|
+
if (value === 0)
|
|
11
|
+
return increase ? 2 ** -149 : -(2 ** -149);
|
|
12
|
+
float[0] = value;
|
|
13
|
+
bits[0] += value > 0 === increase ? 1 : -1;
|
|
14
|
+
return float[0];
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=float32.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"float32.js","sourceRoot":"","sources":["../../src/utils/float32.ts"],"names":[],"mappings":"AAAA,UAAU;AACV,+BAA+B;AAC/B,4DAA4D;AAE5D,iDAAiD;AACjD,MAAM,KAAK,GAAG,IAAI,YAAY,CAAC,CAAC,CAAC,CAAC;AAClC,4CAA4C;AAC5C,MAAM,IAAI,GAAG,IAAI,WAAW,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;AAE3C,0FAA0F;AAC1F,MAAM,UAAU,WAAW,CAAC,KAAa,EAAE,QAAiB;IAC1D,IAAI,KAAK,KAAK,CAAC;QAAE,OAAO,QAAQ,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IAC5D,KAAK,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC;IACjB,IAAI,CAAC,CAAC,CAAC,IAAI,KAAK,GAAG,CAAC,KAAK,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;IAC3C,OAAO,KAAK,CAAC,CAAC,CAAC,CAAC;AAClB,CAAC"}
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"publishConfig": {
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
|
-
"version": "10.0.0-beta.
|
|
6
|
+
"version": "10.0.0-beta.4",
|
|
7
7
|
"type": "module",
|
|
8
8
|
"license": "MIT",
|
|
9
9
|
"repository": {
|
|
@@ -242,8 +242,8 @@
|
|
|
242
242
|
}
|
|
243
243
|
},
|
|
244
244
|
"peerDependencies": {
|
|
245
|
-
"@luma.gl/core": "~10.0.0-beta.
|
|
246
|
-
"@luma.gl/shaders": "~10.0.0-beta.
|
|
245
|
+
"@luma.gl/core": "~10.0.0-beta.4",
|
|
246
|
+
"@luma.gl/shaders": "~10.0.0-beta.4",
|
|
247
247
|
"apache-arrow": ">=17.0.0"
|
|
248
248
|
},
|
|
249
249
|
"peerDependenciesMeta": {
|
|
@@ -252,11 +252,11 @@
|
|
|
252
252
|
}
|
|
253
253
|
},
|
|
254
254
|
"dependencies": {
|
|
255
|
-
"@math.gl/core": "^5.0.
|
|
256
|
-
"@math.gl/geometry": "^5.0.
|
|
257
|
-
"@math.gl/geospatial": "^5.0.
|
|
258
|
-
"@math.gl/sql": "^5.0.
|
|
255
|
+
"@math.gl/core": "^5.0.3",
|
|
256
|
+
"@math.gl/geometry": "^5.0.3",
|
|
257
|
+
"@math.gl/geospatial": "^5.0.3",
|
|
258
|
+
"@math.gl/sql": "^5.0.3",
|
|
259
259
|
"probe.gl": "^5.0.0"
|
|
260
260
|
},
|
|
261
|
-
"gitHead": "
|
|
261
|
+
"gitHead": "1b38b0a1eff208ee761dd6b201274b726288f3a8"
|
|
262
262
|
}
|
|
@@ -3,7 +3,12 @@
|
|
|
3
3
|
// SPDX-FileCopyrightText: Copyright (c) vis.gl contributors
|
|
4
4
|
|
|
5
5
|
import {Buffer, type Device} from '@luma.gl/core';
|
|
6
|
-
import {
|
|
6
|
+
import {
|
|
7
|
+
GPUData,
|
|
8
|
+
GPUVector,
|
|
9
|
+
getGPUVectorFormatInfo,
|
|
10
|
+
type GPUVectorBufferProps
|
|
11
|
+
} from '@luma.gl/graph/gpu-data';
|
|
7
12
|
import {
|
|
8
13
|
GPURecordBatch,
|
|
9
14
|
GPUTable,
|
|
@@ -14,6 +19,7 @@ import {
|
|
|
14
19
|
import {
|
|
15
20
|
DataType,
|
|
16
21
|
Dictionary,
|
|
22
|
+
type FixedSizeList,
|
|
17
23
|
Precision,
|
|
18
24
|
type Data,
|
|
19
25
|
type Field,
|
|
@@ -24,26 +30,41 @@ import {
|
|
|
24
30
|
type Uint32,
|
|
25
31
|
type Utf8
|
|
26
32
|
} from 'apache-arrow';
|
|
33
|
+
import {getArrowFixedSizeListRowValidity} from './arrow-gpu-data';
|
|
27
34
|
import {makeGPUDataFromArrowData} from '@luma.gl/graph/arrow';
|
|
28
35
|
|
|
29
|
-
/** Supported
|
|
30
|
-
type
|
|
36
|
+
/** Supported scalar and categorical index formats. */
|
|
37
|
+
type GPUAnalyticsScalarFormat = 'float32' | 'sint32' | 'uint32';
|
|
38
|
+
/** Packed scalar and fixed-width numeric row formats accepted by the Arrow adapter. */
|
|
39
|
+
type GPUAnalyticsVectorFormat =
|
|
40
|
+
| GPUAnalyticsScalarFormat
|
|
41
|
+
| `${GPUAnalyticsScalarFormat}x${2 | 3 | 4}`;
|
|
42
|
+
/** Maps supported Arrow child types to the format of one packed component. */
|
|
43
|
+
type GPUAnalyticsListFormat<T> = T extends Float32
|
|
44
|
+
? 'float32'
|
|
45
|
+
: T extends Int32
|
|
46
|
+
? 'sint32'
|
|
47
|
+
: T extends Uint32
|
|
48
|
+
? 'uint32'
|
|
49
|
+
: never;
|
|
31
50
|
|
|
32
51
|
/** Maps a typed Arrow schema to its exact portable GPU analytics column formats. */
|
|
33
52
|
export type GPUAnalyticsTypeMapForArrow<T extends TypeMap> = {
|
|
34
|
-
[Name in keyof T & string]: T[Name] extends
|
|
35
|
-
?
|
|
36
|
-
: T[Name] extends
|
|
37
|
-
? '
|
|
38
|
-
: T[Name] extends
|
|
39
|
-
? '
|
|
40
|
-
: T[Name] extends
|
|
41
|
-
?
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
? '
|
|
45
|
-
:
|
|
46
|
-
|
|
53
|
+
[Name in keyof T & string]: T[Name] extends FixedSizeList<infer Child>
|
|
54
|
+
? `${GPUAnalyticsListFormat<Child>}x${2 | 3 | 4}`
|
|
55
|
+
: T[Name] extends Float32
|
|
56
|
+
? 'float32'
|
|
57
|
+
: T[Name] extends Int32
|
|
58
|
+
? 'sint32'
|
|
59
|
+
: T[Name] extends Uint32
|
|
60
|
+
? 'uint32'
|
|
61
|
+
: T[Name] extends Dictionary<Utf8, infer IndexType>
|
|
62
|
+
? IndexType extends Int32
|
|
63
|
+
? 'sint32'
|
|
64
|
+
: IndexType extends Uint32
|
|
65
|
+
? 'uint32'
|
|
66
|
+
: never
|
|
67
|
+
: never;
|
|
47
68
|
};
|
|
48
69
|
|
|
49
70
|
/** CPU-owned category labels associated with one GPU-resident dictionary-index column. */
|
|
@@ -77,6 +98,7 @@ export type GPUAnalyticsTableFromArrowTableResult<T extends GPUTypeMap = GPUType
|
|
|
77
98
|
/** Fully validated source metadata collected before allocating any GPU resources. */
|
|
78
99
|
type PreparedGPUAnalyticsColumn = {
|
|
79
100
|
field: Field;
|
|
101
|
+
nullable: boolean;
|
|
80
102
|
format: GPUAnalyticsVectorFormat;
|
|
81
103
|
chunks: Data[];
|
|
82
104
|
validity: Uint32Array[];
|
|
@@ -93,6 +115,12 @@ const GPU_ANALYTICS_BUFFER_USAGE =
|
|
|
93
115
|
* Numeric values and dictionary indices stay in existing `GPUData`, `GPURecordBatch`, `GPUVector`,
|
|
94
116
|
* and `GPUTable` objects. Nullable rows receive separate batch-aligned uint32 validity vectors,
|
|
95
117
|
* while dictionary labels and source null counts remain explicit adapter-owned metadata.
|
|
118
|
+
*
|
|
119
|
+
* @example
|
|
120
|
+
* ```ts
|
|
121
|
+
* const uploaded = makeGPUAnalyticsTableFromArrowTable(device, arrowTable);
|
|
122
|
+
* const frame = new GPUDataFrame({...uploaded, ownership: 'owned'});
|
|
123
|
+
* ```
|
|
96
124
|
*/
|
|
97
125
|
export function makeGPUAnalyticsTableFromArrowTable<T extends TypeMap>(
|
|
98
126
|
device: Device,
|
|
@@ -166,7 +194,7 @@ export function makeGPUAnalyticsTableFromArrowTable<T extends GPUTypeMap = GPUTy
|
|
|
166
194
|
bufferLayout: columns.map(column => ({
|
|
167
195
|
name: column.field.name,
|
|
168
196
|
format: column.format,
|
|
169
|
-
byteStride:
|
|
197
|
+
byteStride: getGPUVectorFormatInfo(column.format).byteLength
|
|
170
198
|
}))
|
|
171
199
|
});
|
|
172
200
|
|
|
@@ -180,7 +208,7 @@ export function makeGPUAnalyticsTableFromArrowTable<T extends GPUTypeMap = GPUTy
|
|
|
180
208
|
}
|
|
181
209
|
|
|
182
210
|
for (const column of columns) {
|
|
183
|
-
if (!column.
|
|
211
|
+
if (!column.nullable || batches.length === 0) {
|
|
184
212
|
continue;
|
|
185
213
|
}
|
|
186
214
|
|
|
@@ -258,6 +286,8 @@ function prepareGPUAnalyticsColumns(
|
|
|
258
286
|
|
|
259
287
|
const column: PreparedGPUAnalyticsColumn = {
|
|
260
288
|
field,
|
|
289
|
+
nullable:
|
|
290
|
+
field.nullable || (DataType.isFixedSizeList(field.type) && field.type.children[0].nullable),
|
|
261
291
|
format: getGPUAnalyticsVectorFormat(field.type, columnName),
|
|
262
292
|
chunks: [],
|
|
263
293
|
validity: [],
|
|
@@ -277,7 +307,18 @@ function prepareGPUAnalyticsColumns(
|
|
|
277
307
|
throw new Error(`GPU analytics column "${columnName}" changes type between batches`);
|
|
278
308
|
}
|
|
279
309
|
|
|
280
|
-
const
|
|
310
|
+
const parentValidity = getGPUAnalyticsValidity(data, field.nullable, columnName);
|
|
311
|
+
const validity = DataType.isFixedSizeList(field.type)
|
|
312
|
+
? (getArrowFixedSizeListRowValidity(
|
|
313
|
+
data as Data<FixedSizeList<Float32 | Int32 | Uint32>>
|
|
314
|
+
) ?? parentValidity)
|
|
315
|
+
: parentValidity;
|
|
316
|
+
const nullCount = validity.reduce((count, valid) => count + Number(!valid), 0);
|
|
317
|
+
if (nullCount && !column.nullable) {
|
|
318
|
+
throw new Error(
|
|
319
|
+
`GPU analytics non-nullable vector "${columnName}" contains null components`
|
|
320
|
+
);
|
|
321
|
+
}
|
|
281
322
|
if (DataType.isDictionary(field.type)) {
|
|
282
323
|
const dictionary = getGPUAnalyticsDictionary(data, columnName);
|
|
283
324
|
if (column.dictionary && !areGPUAnalyticsDictionariesEqual(column.dictionary, dictionary)) {
|
|
@@ -289,7 +330,7 @@ function prepareGPUAnalyticsColumns(
|
|
|
289
330
|
|
|
290
331
|
column.chunks.push(data);
|
|
291
332
|
column.validity.push(validity);
|
|
292
|
-
column.nullCounts.push(
|
|
333
|
+
column.nullCounts.push(nullCount);
|
|
293
334
|
}
|
|
294
335
|
|
|
295
336
|
return column;
|
|
@@ -298,6 +339,18 @@ function prepareGPUAnalyticsColumns(
|
|
|
298
339
|
|
|
299
340
|
/** Maps the intentionally limited portable Arrow analytics surface to canonical GPU formats. */
|
|
300
341
|
function getGPUAnalyticsVectorFormat(type: DataType, columnName: string): GPUAnalyticsVectorFormat {
|
|
342
|
+
if (DataType.isFixedSizeList(type)) {
|
|
343
|
+
const child = type.children[0].type;
|
|
344
|
+
const width = type.listSize;
|
|
345
|
+
if (
|
|
346
|
+
(width === 2 || width === 3 || width === 4) &&
|
|
347
|
+
((DataType.isFloat(child) && child.precision === Precision.SINGLE) ||
|
|
348
|
+
(DataType.isInt(child) && child.bitWidth === 32))
|
|
349
|
+
) {
|
|
350
|
+
const scalar = DataType.isFloat(child) ? 'float32' : child.isSigned ? 'sint32' : 'uint32';
|
|
351
|
+
return `${scalar}x${width}`;
|
|
352
|
+
}
|
|
353
|
+
}
|
|
301
354
|
if (DataType.isFloat(type) && type.precision === Precision.SINGLE) {
|
|
302
355
|
return 'float32';
|
|
303
356
|
}
|
|
@@ -424,15 +477,14 @@ function makeGPUAnalyticsData(
|
|
|
424
477
|
return makeGPUDataFromArrowData(device, source, {...bufferProps, format});
|
|
425
478
|
}
|
|
426
479
|
|
|
427
|
-
const
|
|
480
|
+
const layout = getGPUVectorFormatInfo(format);
|
|
481
|
+
const buffer = device.createBuffer({...bufferProps, byteLength: layout.byteLength});
|
|
428
482
|
try {
|
|
429
483
|
return new GPUData({
|
|
430
484
|
buffer,
|
|
431
485
|
format,
|
|
432
486
|
length: 0,
|
|
433
|
-
|
|
434
|
-
byteStride: 4,
|
|
435
|
-
rowByteLength: 4,
|
|
487
|
+
|
|
436
488
|
dataType: source.type,
|
|
437
489
|
ownsBuffer: true
|
|
438
490
|
});
|
|
@@ -468,7 +520,7 @@ function makeGPUAnalyticsField(column: PreparedGPUAnalyticsColumn): GPUField {
|
|
|
468
520
|
return {
|
|
469
521
|
name: column.field.name,
|
|
470
522
|
format: column.format,
|
|
471
|
-
nullable: column.
|
|
523
|
+
nullable: column.nullable,
|
|
472
524
|
metadata: new Map(column.field.metadata)
|
|
473
525
|
};
|
|
474
526
|
}
|
|
@@ -3,12 +3,13 @@
|
|
|
3
3
|
// SPDX-FileCopyrightText: Copyright (c) vis.gl contributors
|
|
4
4
|
|
|
5
5
|
import {Buffer} from '@luma.gl/core';
|
|
6
|
-
import type
|
|
6
|
+
import {type GPUData, type GPUVector} from '@luma.gl/graph/gpu-data';
|
|
7
7
|
import type {GPUTable, GPUTypeMap} from '@luma.gl/graph/gpu-tables';
|
|
8
8
|
import {
|
|
9
9
|
Dictionary,
|
|
10
10
|
Field,
|
|
11
11
|
Float32,
|
|
12
|
+
FixedSizeList,
|
|
12
13
|
Int32,
|
|
13
14
|
RecordBatch,
|
|
14
15
|
Schema,
|
|
@@ -51,6 +52,14 @@ type ArrowAnalyticsRow = {batchIndex: number; rowIndex: number};
|
|
|
51
52
|
* Ordinary materialization preserves every source batch, including empty chunks. Optional
|
|
52
53
|
* dataframe selection identities retain those batch boundaries, while explicitly requested global
|
|
53
54
|
* identities produce one intentionally reordered Arrow result batch.
|
|
55
|
+
*
|
|
56
|
+
* @example
|
|
57
|
+
* ```ts
|
|
58
|
+
* const arrowTable = await makeArrowTableFromGPUAnalyticsTable({
|
|
59
|
+
* table: compiled.table,
|
|
60
|
+
* validity: compiled.validity
|
|
61
|
+
* });
|
|
62
|
+
* ```
|
|
54
63
|
*/
|
|
55
64
|
export async function makeArrowTableFromGPUAnalyticsTable<T extends GPUTypeMap>(
|
|
56
65
|
props: ArrowTableFromGPUAnalyticsTableProps<T>
|
|
@@ -60,7 +69,7 @@ export async function makeArrowTableFromGPUAnalyticsTable<T extends GPUTypeMap>(
|
|
|
60
69
|
const dictionary = props.dictionaries?.[field.name];
|
|
61
70
|
const type = dictionary
|
|
62
71
|
? makeArrowAnalyticsDictionaryType(props.table, field.name, dictionary, fieldIndex)
|
|
63
|
-
:
|
|
72
|
+
: makeArrowAnalyticsType(field.format);
|
|
64
73
|
return new Field(field.name, type, field.nullable, new Map(field.metadata));
|
|
65
74
|
});
|
|
66
75
|
const schema = new Schema(fields, new Map(props.table.schema.metadata));
|
|
@@ -119,7 +128,7 @@ function validateArrowGPUAnalyticsReadback<T extends GPUTypeMap>(
|
|
|
119
128
|
) {
|
|
120
129
|
throw new Error(`Arrow analytics validity for "${field.name}" must match source batches`);
|
|
121
130
|
}
|
|
122
|
-
|
|
131
|
+
makeArrowAnalyticsType(field.format);
|
|
123
132
|
}
|
|
124
133
|
}
|
|
125
134
|
|
|
@@ -189,29 +198,36 @@ async function makeArrowAnalyticsColumn<T extends GPUTypeMap>(
|
|
|
189
198
|
rows: readonly ArrowAnalyticsRow[]
|
|
190
199
|
): Promise<Data> {
|
|
191
200
|
const format = props.table.schema.fields[fieldIndex].format;
|
|
201
|
+
const scalarType = field.type instanceof FixedSizeList ? field.type.valueType : field.type;
|
|
202
|
+
const width = field.type instanceof FixedSizeList ? field.type.listSize : 1;
|
|
203
|
+
const Constructor =
|
|
204
|
+
scalarType instanceof Float32
|
|
205
|
+
? Float32Array
|
|
206
|
+
: format === 'sint32' || scalarType instanceof Int32
|
|
207
|
+
? Int32Array
|
|
208
|
+
: Uint32Array;
|
|
192
209
|
const sourceValues = new Map<number, Float32Array | Int32Array | Uint32Array>();
|
|
193
210
|
const sourceValidity = new Map<number, Uint32Array>();
|
|
194
211
|
await Promise.all(
|
|
195
212
|
Array.from(new Set(rows.map(row => row.batchIndex))).map(async batchIndex => {
|
|
196
213
|
const data = props.table.batches[batchIndex].gpuData[field.name];
|
|
197
|
-
const bytes = await readArrowAnalyticsBytes(data);
|
|
198
|
-
const Constructor =
|
|
199
|
-
format === 'float32' ? Float32Array : format === 'sint32' ? Int32Array : Uint32Array;
|
|
214
|
+
const bytes = await readArrowAnalyticsBytes(data, data.length, width * 4);
|
|
200
215
|
sourceValues.set(
|
|
201
216
|
batchIndex,
|
|
202
|
-
new Constructor(bytes.buffer as ArrayBuffer, bytes.byteOffset, data.length)
|
|
217
|
+
new Constructor(bytes.buffer as ArrayBuffer, bytes.byteOffset, data.length * width)
|
|
203
218
|
);
|
|
204
219
|
const validity = props.validity?.[field.name]?.data[batchIndex];
|
|
205
220
|
if (validity) sourceValidity.set(batchIndex, await readArrowAnalyticsWords(validity));
|
|
206
221
|
})
|
|
207
222
|
);
|
|
208
|
-
const Constructor
|
|
209
|
-
format === 'float32' ? Float32Array : format === 'sint32' ? Int32Array : Uint32Array;
|
|
210
|
-
const values = new Constructor(rows.length);
|
|
223
|
+
const values = new Constructor(rows.length * width);
|
|
211
224
|
const nullBitmap = new Uint8Array(Math.ceil(rows.length / 8));
|
|
212
225
|
let nullCount = 0;
|
|
213
226
|
for (const [outputIndex, row] of rows.entries()) {
|
|
214
|
-
|
|
227
|
+
const source = sourceValues.get(row.batchIndex)!;
|
|
228
|
+
for (let component = 0; component < width; component++) {
|
|
229
|
+
values[outputIndex * width + component] = source[row.rowIndex * width + component];
|
|
230
|
+
}
|
|
215
231
|
const valid = sourceValidity.get(row.batchIndex)?.[row.rowIndex] !== 0;
|
|
216
232
|
if (valid) {
|
|
217
233
|
nullBitmap[outputIndex >> 3] |= 1 << (outputIndex & 7);
|
|
@@ -234,6 +250,10 @@ async function makeArrowAnalyticsColumn<T extends GPUTypeMap>(
|
|
|
234
250
|
nullCount
|
|
235
251
|
});
|
|
236
252
|
}
|
|
253
|
+
if (field.type instanceof FixedSizeList) {
|
|
254
|
+
const child = makeData({type: field.type.valueType, length: values.length, data: values});
|
|
255
|
+
return makeData({type: field.type, length: rows.length, child, nullBitmap, nullCount});
|
|
256
|
+
}
|
|
237
257
|
return makeData({type: field.type, length: rows.length, data: values, nullBitmap, nullCount});
|
|
238
258
|
}
|
|
239
259
|
|
|
@@ -263,7 +283,14 @@ function isArrowAnalyticsDictionary(
|
|
|
263
283
|
return !Array.isArray(value);
|
|
264
284
|
}
|
|
265
285
|
|
|
266
|
-
|
|
286
|
+
/** Maps a GPU analytics scalar or packed vector format to its Arrow type. */
|
|
287
|
+
function makeArrowAnalyticsType(format: string | undefined): DataType {
|
|
288
|
+
const match = /^(float32|sint32|uint32)x([234])$/.exec(format ?? '');
|
|
289
|
+
if (match)
|
|
290
|
+
return new FixedSizeList(
|
|
291
|
+
Number(match[2]),
|
|
292
|
+
new Field('item', makeArrowAnalyticsType(match[1]), false)
|
|
293
|
+
);
|
|
267
294
|
switch (format) {
|
|
268
295
|
case 'float32':
|
|
269
296
|
return new Float32();
|
|
@@ -284,11 +311,20 @@ async function readArrowAnalyticsWords(
|
|
|
284
311
|
return new Uint32Array(bytes.buffer, bytes.byteOffset, length);
|
|
285
312
|
}
|
|
286
313
|
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
314
|
+
/** Reads tightly packed rows from a GPU data view. */
|
|
315
|
+
async function readArrowAnalyticsBytes(
|
|
316
|
+
data: GPUData,
|
|
317
|
+
length = data.length,
|
|
318
|
+
byteLength = 4
|
|
319
|
+
): Promise<Uint8Array> {
|
|
320
|
+
if (
|
|
321
|
+
data.byteStride !== byteLength ||
|
|
322
|
+
data.rowByteLength !== byteLength ||
|
|
323
|
+
data.byteOffset % 4 !== 0
|
|
324
|
+
) {
|
|
325
|
+
throw new Error('Arrow analytics output requires packed 32-bit GPU numeric data');
|
|
290
326
|
}
|
|
291
327
|
if (length === 0) return new Uint8Array(0);
|
|
292
328
|
const buffer = data.buffer instanceof Buffer ? data.buffer : data.buffer.buffer;
|
|
293
|
-
return buffer.readAsync(data.byteOffset, length *
|
|
329
|
+
return buffer.readAsync(data.byteOffset, length * byteLength);
|
|
294
330
|
}
|
|
@@ -44,6 +44,8 @@ export type ArrowGPUTableConversionPlan = {
|
|
|
44
44
|
length: number;
|
|
45
45
|
/** Aggregate cost across selected columns. */
|
|
46
46
|
cost: ArrowGPUConversionCost;
|
|
47
|
+
/** Estimated peak retained and temporary GPU bytes while converting columns serially. */
|
|
48
|
+
estimatedPeakGPUBytes: number;
|
|
47
49
|
};
|
|
48
50
|
|
|
49
51
|
/** Prepared generic GPU table plus its inspectable conversion plan. */
|
|
@@ -68,6 +70,12 @@ export type ArrowRecordBatchConversionSource =
|
|
|
68
70
|
export type ArrowRecordBatchConversionOptions = {
|
|
69
71
|
/** Stops pending reads and further conversion. Already yielded batches remain caller-owned. */
|
|
70
72
|
signal?: AbortSignal;
|
|
73
|
+
/** Maximum estimated GPU payload bytes per batch. Checked before conversion. */
|
|
74
|
+
maxBatchPayloadBytes?: number;
|
|
75
|
+
/** Maximum estimated peak GPU bytes per batch, including conversion scratch. */
|
|
76
|
+
maxBatchGPUBytes?: number;
|
|
77
|
+
/** Split an oversized batch into contiguous rows before uploading. Defaults to false. */
|
|
78
|
+
splitOversizedBatches?: boolean;
|
|
71
79
|
};
|
|
72
80
|
|
|
73
81
|
/** One independently owned GPU record batch produced from an Arrow stream. */
|
|
@@ -106,7 +114,8 @@ export function planArrowTableGPUConversion(
|
|
|
106
114
|
return {
|
|
107
115
|
columns,
|
|
108
116
|
length: table.numRows,
|
|
109
|
-
cost: sumConversionCosts(columns.map(column => column.plan.cost))
|
|
117
|
+
cost: sumConversionCosts(columns.map(column => column.plan.cost)),
|
|
118
|
+
estimatedPeakGPUBytes: estimatePeakGPUBytes(columns)
|
|
110
119
|
};
|
|
111
120
|
}
|
|
112
121
|
|
|
@@ -229,47 +238,122 @@ export async function* convertArrowRecordBatchesToGPURecordBatches(
|
|
|
229
238
|
device: Device,
|
|
230
239
|
source: ArrowRecordBatchConversionSource,
|
|
231
240
|
schema: ArrowGPUTableConversionSchema,
|
|
232
|
-
{
|
|
241
|
+
{
|
|
242
|
+
signal,
|
|
243
|
+
maxBatchPayloadBytes,
|
|
244
|
+
maxBatchGPUBytes,
|
|
245
|
+
splitOversizedBatches
|
|
246
|
+
}: ArrowRecordBatchConversionOptions = {}
|
|
233
247
|
): AsyncGenerator<PreparedArrowGPURecordBatch> {
|
|
248
|
+
if (
|
|
249
|
+
maxBatchPayloadBytes !== undefined &&
|
|
250
|
+
(!Number.isSafeInteger(maxBatchPayloadBytes) || maxBatchPayloadBytes < 0)
|
|
251
|
+
) {
|
|
252
|
+
throw new Error('Arrow GPU stream payload budget must be a nonnegative safe integer');
|
|
253
|
+
}
|
|
254
|
+
if (
|
|
255
|
+
maxBatchGPUBytes !== undefined &&
|
|
256
|
+
(!Number.isSafeInteger(maxBatchGPUBytes) || maxBatchGPUBytes < 0)
|
|
257
|
+
) {
|
|
258
|
+
throw new Error('Arrow GPU stream peak budget must be a nonnegative safe integer');
|
|
259
|
+
}
|
|
234
260
|
const temporalOrigins = new Map<string, number | bigint>();
|
|
235
261
|
const formats = new Map<string, string | undefined>();
|
|
236
262
|
let sourceBatchIndex = 0;
|
|
237
263
|
let sourceRowIndexOffset = 0;
|
|
238
264
|
for await (const recordBatch of iterateRecordBatches(source, signal)) {
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
columns: schema.columns.map(column => {
|
|
242
|
-
const origin = temporalOrigins.get(column.name);
|
|
243
|
-
return origin === undefined || column.temporal?.origin !== undefined
|
|
244
|
-
? column
|
|
245
|
-
: {...column, temporal: {...column.temporal, origin}};
|
|
246
|
-
})
|
|
247
|
-
};
|
|
248
|
-
const prepared = await convertArrowRecordBatchToGPURecordBatch(
|
|
249
|
-
device,
|
|
250
|
-
recordBatch,
|
|
251
|
-
batchSchema,
|
|
252
|
-
{sourceBatchIndex, sourceRowIndexOffset}
|
|
253
|
-
);
|
|
254
|
-
try {
|
|
265
|
+
let rowOffset = 0;
|
|
266
|
+
do {
|
|
255
267
|
signal?.throwIfAborted();
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
268
|
+
const batchSchema: ArrowGPUTableConversionSchema = {
|
|
269
|
+
columns: schema.columns.map(column => {
|
|
270
|
+
const origin = temporalOrigins.get(column.name);
|
|
271
|
+
return origin === undefined || column.temporal?.origin !== undefined
|
|
272
|
+
? column
|
|
273
|
+
: {...column, temporal: {...column.temporal, origin}};
|
|
274
|
+
})
|
|
275
|
+
};
|
|
276
|
+
let slice = rowOffset === 0 ? recordBatch : recordBatch.slice(rowOffset);
|
|
277
|
+
if (maxBatchPayloadBytes !== undefined || maxBatchGPUBytes !== undefined) {
|
|
278
|
+
while (true) {
|
|
279
|
+
const plan = planArrowTableGPUConversion(device, new Table([slice]), batchSchema);
|
|
280
|
+
const payload = plan.cost.targetByteLength;
|
|
281
|
+
const peak = plan.estimatedPeakGPUBytes;
|
|
282
|
+
const exceedsPayload =
|
|
283
|
+
maxBatchPayloadBytes !== undefined && payload > maxBatchPayloadBytes;
|
|
284
|
+
const exceedsPeak = maxBatchGPUBytes !== undefined && peak > maxBatchGPUBytes;
|
|
285
|
+
if (!exceedsPayload && !exceedsPeak) break;
|
|
286
|
+
if (!splitOversizedBatches || slice.numRows <= 1) {
|
|
287
|
+
const location = splitOversizedBatches ? ' at row ' + sourceRowIndexOffset : '';
|
|
288
|
+
const requirement = exceedsPayload
|
|
289
|
+
? payload + ' payload bytes, exceeding the ' + maxBatchPayloadBytes
|
|
290
|
+
: 'an estimated ' + peak + ' peak GPU bytes, exceeding the ' + maxBatchGPUBytes;
|
|
291
|
+
throw new Error(
|
|
292
|
+
'Arrow GPU stream batch ' +
|
|
293
|
+
sourceBatchIndex +
|
|
294
|
+
location +
|
|
295
|
+
' needs ' +
|
|
296
|
+
requirement +
|
|
297
|
+
' byte budget'
|
|
298
|
+
);
|
|
299
|
+
}
|
|
300
|
+
slice = recordBatch.slice(rowOffset, rowOffset + Math.floor(slice.numRows / 2));
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
const prepared = await convertArrowRecordBatchToGPURecordBatch(device, slice, batchSchema, {
|
|
304
|
+
sourceBatchIndex,
|
|
305
|
+
sourceRowIndexOffset
|
|
306
|
+
});
|
|
307
|
+
try {
|
|
308
|
+
signal?.throwIfAborted();
|
|
309
|
+
for (const [name, vector] of Object.entries(prepared.vectors)) {
|
|
310
|
+
const expected = formats.get(name);
|
|
311
|
+
if (formats.has(name) && vector.format !== expected) {
|
|
312
|
+
throw new Error(
|
|
313
|
+
`Arrow stream column "${name}" format changed: ${expected} -> ${vector.format}`
|
|
314
|
+
);
|
|
315
|
+
}
|
|
316
|
+
formats.set(name, vector.format);
|
|
262
317
|
}
|
|
263
|
-
|
|
318
|
+
captureStreamingTemporalOrigins(slice, schema, prepared.batch, temporalOrigins);
|
|
319
|
+
} catch (error) {
|
|
320
|
+
prepared.destroy();
|
|
321
|
+
throw error;
|
|
264
322
|
}
|
|
265
|
-
|
|
266
|
-
|
|
323
|
+
yield prepared;
|
|
324
|
+
sourceRowIndexOffset += slice.numRows;
|
|
325
|
+
rowOffset += slice.numRows;
|
|
326
|
+
} while (rowOffset < recordBatch.numRows);
|
|
327
|
+
sourceBatchIndex++;
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
/**
|
|
332
|
+
* Consumes prepared GPU batches one at a time and releases them before reading the next batch.
|
|
333
|
+
* The callback borrows the batch until its returned promise settles. Await any GPU work that
|
|
334
|
+
* still uses the batch before returning. Cancellation is observed between callbacks and is
|
|
335
|
+
* available to an in-flight callback through the supplied signal.
|
|
336
|
+
*/
|
|
337
|
+
export async function consumeArrowGPURecordBatches(
|
|
338
|
+
device: Device,
|
|
339
|
+
source: ArrowRecordBatchConversionSource,
|
|
340
|
+
schema: ArrowGPUTableConversionSchema,
|
|
341
|
+
consume: (batch: PreparedArrowGPURecordBatch, signal?: AbortSignal) => void | Promise<void>,
|
|
342
|
+
options: ArrowRecordBatchConversionOptions = {}
|
|
343
|
+
): Promise<void> {
|
|
344
|
+
for await (const prepared of convertArrowRecordBatchesToGPURecordBatches(
|
|
345
|
+
device,
|
|
346
|
+
source,
|
|
347
|
+
schema,
|
|
348
|
+
options
|
|
349
|
+
)) {
|
|
350
|
+
try {
|
|
351
|
+
options.signal?.throwIfAborted();
|
|
352
|
+
await consume(prepared, options.signal);
|
|
353
|
+
options.signal?.throwIfAborted();
|
|
354
|
+
} finally {
|
|
267
355
|
prepared.destroy();
|
|
268
|
-
throw error;
|
|
269
356
|
}
|
|
270
|
-
yield prepared;
|
|
271
|
-
sourceRowIndexOffset += recordBatch.numRows;
|
|
272
|
-
sourceBatchIndex++;
|
|
273
357
|
}
|
|
274
358
|
}
|
|
275
359
|
|
|
@@ -331,11 +415,25 @@ function captureStreamingTemporalOrigins(
|
|
|
331
415
|
}
|
|
332
416
|
}
|
|
333
417
|
|
|
418
|
+
/** Estimates peak bytes from previously retained outputs and one active column conversion. */
|
|
419
|
+
function estimatePeakGPUBytes(columns: ArrowGPUTableConversionPlan['columns']): number {
|
|
420
|
+
let retained = 0;
|
|
421
|
+
let peak = 0;
|
|
422
|
+
for (const {plan} of columns) {
|
|
423
|
+
if (!plan.cost.allocatesGPUStorage) continue;
|
|
424
|
+
// Reserve padding and minimum-sized allocations for each destination chunk.
|
|
425
|
+
retained += plan.cost.targetByteLength + plan.chunkCount * 8;
|
|
426
|
+
peak = Math.max(peak, retained + plan.cost.temporaryGPUByteLength);
|
|
427
|
+
}
|
|
428
|
+
return peak;
|
|
429
|
+
}
|
|
430
|
+
|
|
334
431
|
function sumConversionCosts(costs: readonly ArrowGPUConversionCost[]): ArrowGPUConversionCost {
|
|
335
432
|
return costs.reduce<ArrowGPUConversionCost>(
|
|
336
433
|
(sum, cost) => ({
|
|
337
434
|
sourceByteLength: sum.sourceByteLength + cost.sourceByteLength,
|
|
338
435
|
targetByteLength: sum.targetByteLength + cost.targetByteLength,
|
|
436
|
+
temporaryGPUByteLength: sum.temporaryGPUByteLength + cost.temporaryGPUByteLength,
|
|
339
437
|
uploadCount: sum.uploadCount + cost.uploadCount,
|
|
340
438
|
cpuPassCount: sum.cpuPassCount + cost.cpuPassCount,
|
|
341
439
|
gpuPassCount: sum.gpuPassCount + cost.gpuPassCount,
|
|
@@ -344,6 +442,7 @@ function sumConversionCosts(costs: readonly ArrowGPUConversionCost[]): ArrowGPUC
|
|
|
344
442
|
{
|
|
345
443
|
sourceByteLength: 0,
|
|
346
444
|
targetByteLength: 0,
|
|
445
|
+
temporaryGPUByteLength: 0,
|
|
347
446
|
uploadCount: 0,
|
|
348
447
|
cpuPassCount: 0,
|
|
349
448
|
gpuPassCount: 0,
|