@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
|
@@ -17,32 +17,83 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
17
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
18
18
|
var gpu_graph_single_source_shortest_path_internals_exports = {};
|
|
19
19
|
__export(gpu_graph_single_source_shortest_path_internals_exports, {
|
|
20
|
+
SHORTEST_PATH_CONTROL_BYTE_LENGTH: () => SHORTEST_PATH_CONTROL_BYTE_LENGTH,
|
|
21
|
+
SHORTEST_PATH_CONTROL_CONVERGED: () => SHORTEST_PATH_CONTROL_CONVERGED,
|
|
22
|
+
SHORTEST_PATH_CONTROL_DISPATCH_X: () => SHORTEST_PATH_CONTROL_DISPATCH_X,
|
|
23
|
+
SHORTEST_PATH_CONTROL_FAILED: () => SHORTEST_PATH_CONTROL_FAILED,
|
|
24
|
+
SHORTEST_PATH_CONTROL_ITERATIONS: () => SHORTEST_PATH_CONTROL_ITERATIONS,
|
|
25
|
+
addGPUGraphAlgorithmsShortestPathInitializationToGraph: () => addGPUGraphAlgorithmsShortestPathInitializationToGraph,
|
|
26
|
+
addGPUGraphAlgorithmsShortestPathRoundsToGraph: () => addGPUGraphAlgorithmsShortestPathRoundsToGraph,
|
|
20
27
|
addGPUGraphAlgorithmsSingleSourceShortestPathToGraphWithDispatchLimit: () => addGPUGraphAlgorithmsSingleSourceShortestPathToGraphWithDispatchLimit,
|
|
21
28
|
getGPUGraphAlgorithmsSingleSourceShortestPathDispatchLayout: () => getGPUGraphAlgorithmsSingleSourceShortestPathDispatchLayout
|
|
22
29
|
});
|
|
23
30
|
module.exports = __toCommonJS(gpu_graph_single_source_shortest_path_internals_exports);
|
|
31
|
+
var import_core = require("@luma.gl/core");
|
|
24
32
|
var import_kernel = require("../execution/compute/kernel.cjs");
|
|
25
33
|
var import_gpu_dispatch_utils = require("../gpu-core/gpu-dispatch-utils.cjs");
|
|
26
34
|
var import_graph_data_view_utils = require("../gpu-core/graph-data-view-utils.cjs");
|
|
27
35
|
const SHORTEST_PATH_WORKGROUP_SIZE = 256;
|
|
28
36
|
const POSITIVE_INFINITY_BITS = 2139095040;
|
|
29
37
|
const UNREACHABLE_PREDECESSOR = 4294967295;
|
|
30
|
-
|
|
31
|
-
|
|
38
|
+
const SHORTEST_PATH_CONTROL_DISPATCH_X = 0;
|
|
39
|
+
const SHORTEST_PATH_CONTROL_ITERATIONS = 3;
|
|
40
|
+
const SHORTEST_PATH_CONTROL_FAILED = 4;
|
|
41
|
+
const SHORTEST_PATH_CONTROL_CONVERGED = 5;
|
|
42
|
+
const SHORTEST_PATH_CONTROL_BYTE_LENGTH = 32;
|
|
43
|
+
function addGPUGraphAlgorithmsSingleSourceShortestPathToGraphWithDispatchLimit(search, commandGraph, maxComputeWorkgroupsPerDimension, roundCount = Math.min(search.maxIterations, 1024)) {
|
|
44
|
+
const state = importShortestPathState(search, commandGraph, maxComputeWorkgroupsPerDimension, {
|
|
45
|
+
rounds: roundCount > 0
|
|
46
|
+
});
|
|
47
|
+
addInitialization(commandGraph, state, search);
|
|
48
|
+
addRounds(commandGraph, state, roundCount, 0);
|
|
49
|
+
}
|
|
50
|
+
function addGPUGraphAlgorithmsShortestPathInitializationToGraph(search, commandGraph, maxComputeWorkgroupsPerDimension, persistent) {
|
|
51
|
+
const state = importShortestPathState(search, commandGraph, maxComputeWorkgroupsPerDimension, {
|
|
52
|
+
rounds: false,
|
|
53
|
+
persistent
|
|
54
|
+
});
|
|
55
|
+
addInitialization(commandGraph, state, search);
|
|
56
|
+
}
|
|
57
|
+
function addGPUGraphAlgorithmsShortestPathRoundsToGraph(search, commandGraph, maxComputeWorkgroupsPerDimension, roundCount, persistent) {
|
|
58
|
+
const state = importShortestPathState(search, commandGraph, maxComputeWorkgroupsPerDimension, {
|
|
59
|
+
rounds: true,
|
|
60
|
+
persistent
|
|
61
|
+
});
|
|
62
|
+
addRounds(commandGraph, state, roundCount, 0);
|
|
63
|
+
}
|
|
64
|
+
function importShortestPathState(search, commandGraph, maxComputeWorkgroupsPerDimension, options) {
|
|
32
65
|
const directed = search.topology.graph.directed;
|
|
33
66
|
const useIncoming = directed && search.direction === "incoming";
|
|
34
67
|
const primaryAdjacency = importShortestPathAdjacency(commandGraph, `${search.id}-${useIncoming ? "incoming" : "outgoing"}`, useIncoming ? search.topology.reverse : search.topology.forward);
|
|
68
|
+
const controlDescriptor = {
|
|
69
|
+
id: `${search.id}-control`,
|
|
70
|
+
byteLength: SHORTEST_PATH_CONTROL_BYTE_LENGTH,
|
|
71
|
+
usage: import_core.Buffer.STORAGE | import_core.Buffer.INDIRECT | import_core.Buffer.COPY_SRC
|
|
72
|
+
};
|
|
73
|
+
const controlBuffer = options.persistent ? commandGraph.importBuffer(controlDescriptor, options.persistent.control) : commandGraph.createTransientBuffer(controlDescriptor);
|
|
35
74
|
const state = {
|
|
36
75
|
id: search.id,
|
|
37
76
|
vertexCount: search.topology.graph.vertexCount,
|
|
38
77
|
edgeCount: search.topology.graph.edgeCount,
|
|
39
|
-
sourceVertex: search.sourceVertex,
|
|
40
78
|
maxIterations: search.maxIterations,
|
|
79
|
+
useIncoming,
|
|
80
|
+
...search.seeds ? { seeds: commandGraph.importGPUVector(`${search.id}-seeds`, search.seeds).data[0] } : {},
|
|
81
|
+
control: commandGraph.createDataView(controlBuffer, {
|
|
82
|
+
format: "uint32",
|
|
83
|
+
length: SHORTEST_PATH_CONTROL_BYTE_LENGTH / Uint32Array.BYTES_PER_ELEMENT
|
|
84
|
+
}),
|
|
85
|
+
roundCondition: {
|
|
86
|
+
id: `${search.id}-round-active`,
|
|
87
|
+
source: "gpu",
|
|
88
|
+
mode: "indirect",
|
|
89
|
+
buffer: controlBuffer,
|
|
90
|
+
byteOffset: SHORTEST_PATH_CONTROL_DISPATCH_X * Uint32Array.BYTES_PER_ELEMENT
|
|
91
|
+
},
|
|
41
92
|
distances: commandGraph.importGPUVector(`${search.id}-distances`, search.distances).data[0],
|
|
42
93
|
predecessors: commandGraph.importGPUVector(`${search.id}-predecessors`, search.predecessors).data[0],
|
|
43
94
|
converged: search.converged ? commandGraph.importGPUVector(`${search.id}-converged`, search.converged).data[0] : (0, import_graph_data_view_utils.createTransientView)(commandGraph, `${search.id}-converged-scratch`, "uint32", 1),
|
|
44
95
|
invalidWeightCount: search.invalidWeightCount ? commandGraph.importGPUVector(`${search.id}-invalid-weight-count`, search.invalidWeightCount).data[0] : (0, import_graph_data_view_utils.createTransientView)(commandGraph, `${search.id}-invalid-weight-scratch`, "uint32", 1),
|
|
45
|
-
...
|
|
96
|
+
...options.rounds ? {
|
|
46
97
|
previousDistances: (0, import_graph_data_view_utils.createTransientView)(commandGraph, `${search.id}-previous-distances`, "float32", search.topology.graph.vertexCount),
|
|
47
98
|
changed: (0, import_graph_data_view_utils.createTransientView)(commandGraph, `${search.id}-changed`, "uint32", 1)
|
|
48
99
|
} : {},
|
|
@@ -57,6 +108,10 @@ function addGPUGraphAlgorithmsSingleSourceShortestPathToGraphWithDispatchLimit(s
|
|
|
57
108
|
} : {},
|
|
58
109
|
maxComputeWorkgroupsPerDimension
|
|
59
110
|
};
|
|
111
|
+
return state;
|
|
112
|
+
}
|
|
113
|
+
function addInitialization(commandGraph, state, search) {
|
|
114
|
+
var _a;
|
|
60
115
|
addInitializationPass(commandGraph, state);
|
|
61
116
|
for (const [chunkIndex, weights] of ((_a = state.sourceWeights) == null ? void 0 : _a.data.entries()) ?? []) {
|
|
62
117
|
if (weights.length > 0) {
|
|
@@ -69,8 +124,12 @@ function addGPUGraphAlgorithmsSingleSourceShortestPathToGraphWithDispatchLimit(s
|
|
|
69
124
|
});
|
|
70
125
|
}
|
|
71
126
|
}
|
|
72
|
-
|
|
73
|
-
|
|
127
|
+
addStatusPass(commandGraph, state);
|
|
128
|
+
addSeedPass(commandGraph, state, search);
|
|
129
|
+
}
|
|
130
|
+
function addRounds(commandGraph, state, roundCount, firstIteration) {
|
|
131
|
+
const useIncoming = state.useIncoming;
|
|
132
|
+
for (let iteration = firstIteration; iteration < firstIteration + roundCount; iteration++) {
|
|
74
133
|
addSnapshotPass(commandGraph, state, iteration);
|
|
75
134
|
addRelaxationPass(commandGraph, {
|
|
76
135
|
state,
|
|
@@ -118,7 +177,6 @@ function addInitializationPass(commandGraph, state) {
|
|
|
118
177
|
const bindings = {
|
|
119
178
|
distances: { view: state.distances, usage: "storage-write", atomic: true },
|
|
120
179
|
predecessors: { view: state.predecessors, usage: "storage-write", atomic: true },
|
|
121
|
-
converged: { view: state.converged, usage: "storage-write", atomic: true },
|
|
122
180
|
invalidWeightCount: { view: state.invalidWeightCount, usage: "storage-write", atomic: true }
|
|
123
181
|
};
|
|
124
182
|
const source = (
|
|
@@ -127,7 +185,6 @@ function addInitializationPass(commandGraph, state) {
|
|
|
127
185
|
const VERTEX_COUNT: u32 = ${state.vertexCount}u;
|
|
128
186
|
const DISTANCES_OFFSET: u32 = ${(0, import_graph_data_view_utils.getViewElementOffset)(state.distances)}u;
|
|
129
187
|
const PREDECESSORS_OFFSET: u32 = ${(0, import_graph_data_view_utils.getViewElementOffset)(state.predecessors)}u;
|
|
130
|
-
const CONVERGED_OFFSET: u32 = ${(0, import_graph_data_view_utils.getViewElementOffset)(state.converged)}u;
|
|
131
188
|
const INVALID_WEIGHT_COUNT_OFFSET: u32 = ${(0, import_graph_data_view_utils.getViewElementOffset)(state.invalidWeightCount)}u;
|
|
132
189
|
${getBindingDeclarations(bindings)}
|
|
133
190
|
|
|
@@ -138,7 +195,6 @@ fn main(
|
|
|
138
195
|
) {
|
|
139
196
|
${getInvocationIndexSource(state, Math.max(state.vertexCount, 1))}
|
|
140
197
|
if (index == 0u) {
|
|
141
|
-
atomicStore(&converged[CONVERGED_OFFSET], 0u);
|
|
142
198
|
atomicStore(&invalidWeightCount[INVALID_WEIGHT_COUNT_OFFSET], 0u);
|
|
143
199
|
}
|
|
144
200
|
if (index >= VERTEX_COUNT) { return; }
|
|
@@ -196,41 +252,88 @@ fn main(
|
|
|
196
252
|
dispatchLayout: getDispatchLayout(state, props.weights.length)
|
|
197
253
|
});
|
|
198
254
|
}
|
|
199
|
-
function
|
|
255
|
+
function addStatusPass(commandGraph, state) {
|
|
200
256
|
const bindings = {
|
|
201
|
-
|
|
202
|
-
|
|
257
|
+
converged: { view: state.converged, usage: "storage-write" },
|
|
258
|
+
control: { view: state.control, usage: "storage-write" },
|
|
203
259
|
invalidWeightCount: { view: state.invalidWeightCount, usage: "storage-read" },
|
|
204
260
|
...getOverflowBindings(state)
|
|
205
261
|
};
|
|
206
262
|
const triviallyConverged = state.vertexCount <= 1 || state.edgeCount === 0;
|
|
263
|
+
const stopsBeforeRounds = triviallyConverged || state.maxIterations === 0;
|
|
264
|
+
const roundLayout = getDispatchLayout(state, Math.max(state.vertexCount, 1));
|
|
207
265
|
const source = (
|
|
208
266
|
/* wgsl */
|
|
209
267
|
`
|
|
210
|
-
const VERTEX_COUNT: u32 = ${state.vertexCount}u;
|
|
211
|
-
const SOURCE_VERTEX: u32 = ${state.sourceVertex}u;
|
|
212
|
-
const DISTANCES_OFFSET: u32 = ${(0, import_graph_data_view_utils.getViewElementOffset)(state.distances)}u;
|
|
213
268
|
const CONVERGED_OFFSET: u32 = ${(0, import_graph_data_view_utils.getViewElementOffset)(state.converged)}u;
|
|
269
|
+
const CONTROL_OFFSET: u32 = ${(0, import_graph_data_view_utils.getViewElementOffset)(state.control)}u;
|
|
214
270
|
const INVALID_WEIGHT_COUNT_OFFSET: u32 = ${(0, import_graph_data_view_utils.getViewElementOffset)(state.invalidWeightCount)}u;
|
|
215
271
|
${getOverflowConstants(state)}
|
|
216
272
|
${getBindingDeclarations(bindings)}
|
|
217
273
|
|
|
218
274
|
@compute @workgroup_size(1)
|
|
219
275
|
fn main() {
|
|
220
|
-
|
|
276
|
+
let failed = invalidWeightCount[INVALID_WEIGHT_COUNT_OFFSET] != 0u || ${getOverflowGuard(state)};
|
|
277
|
+
let converges = !failed && ${triviallyConverged};
|
|
278
|
+
let stopped = failed || ${stopsBeforeRounds};
|
|
279
|
+
control[CONTROL_OFFSET + ${SHORTEST_PATH_CONTROL_DISPATCH_X}u] = select(${roundLayout.x}u, 0u, stopped);
|
|
280
|
+
control[CONTROL_OFFSET + 1u] = ${roundLayout.y}u;
|
|
281
|
+
control[CONTROL_OFFSET + 2u] = ${roundLayout.z}u;
|
|
282
|
+
control[CONTROL_OFFSET + ${SHORTEST_PATH_CONTROL_ITERATIONS}u] = 0u;
|
|
283
|
+
control[CONTROL_OFFSET + ${SHORTEST_PATH_CONTROL_FAILED}u] = select(0u, 1u, failed);
|
|
284
|
+
control[CONTROL_OFFSET + ${SHORTEST_PATH_CONTROL_CONVERGED}u] = select(0u, 1u, converges);
|
|
285
|
+
converged[CONVERGED_OFFSET] = select(0u, 1u, converges);
|
|
286
|
+
}`
|
|
287
|
+
);
|
|
288
|
+
addShortestPathPass(commandGraph, {
|
|
289
|
+
id: `${state.id}-status`,
|
|
290
|
+
source,
|
|
291
|
+
bindings,
|
|
292
|
+
dispatchLayout: { x: 1, y: 1, z: 1 }
|
|
293
|
+
});
|
|
294
|
+
}
|
|
295
|
+
function addSeedPass(commandGraph, state, search) {
|
|
296
|
+
var _a;
|
|
297
|
+
const seedCount = ((_a = state.seeds) == null ? void 0 : _a.length) ?? 1;
|
|
298
|
+
const bindings = {
|
|
299
|
+
control: { view: state.control, usage: "storage-read" },
|
|
300
|
+
distances: { view: state.distances, usage: "storage-read-write", atomic: true },
|
|
301
|
+
...state.seeds ? { seeds: { view: state.seeds, usage: "storage-read" } } : {}
|
|
302
|
+
};
|
|
303
|
+
const declarations = getBindingDeclarations(bindings);
|
|
304
|
+
const ownedSeedLocation = Object.keys(bindings).length;
|
|
305
|
+
const source = (
|
|
306
|
+
/* wgsl */
|
|
307
|
+
`
|
|
308
|
+
const VERTEX_COUNT: u32 = ${state.vertexCount}u;
|
|
309
|
+
const SEED_COUNT: u32 = ${seedCount}u;
|
|
310
|
+
const SEEDS_OFFSET: u32 = ${state.seeds ? (0, import_graph_data_view_utils.getViewElementOffset)(state.seeds) : 0}u;
|
|
311
|
+
const CONTROL_OFFSET: u32 = ${(0, import_graph_data_view_utils.getViewElementOffset)(state.control)}u;
|
|
312
|
+
const DISTANCES_OFFSET: u32 = ${(0, import_graph_data_view_utils.getViewElementOffset)(state.distances)}u;
|
|
313
|
+
${declarations}
|
|
314
|
+
${state.seeds ? "" : `@group(0) @binding(${ownedSeedLocation}) var<storage, read> seeds: array<u32>;`}
|
|
315
|
+
|
|
316
|
+
@compute @workgroup_size(${SHORTEST_PATH_WORKGROUP_SIZE})
|
|
317
|
+
fn main(
|
|
318
|
+
@builtin(workgroup_id) workgroupId: vec3<u32>,
|
|
319
|
+
@builtin(local_invocation_index) localInvocationIndex: u32
|
|
320
|
+
) {
|
|
321
|
+
${getInvocationIndexSource(state, seedCount)}
|
|
322
|
+
if (index >= SEED_COUNT || control[CONTROL_OFFSET + ${SHORTEST_PATH_CONTROL_FAILED}u] != 0u) {
|
|
221
323
|
return;
|
|
222
324
|
}
|
|
223
|
-
|
|
224
|
-
|
|
325
|
+
let vertex = seeds[SEEDS_OFFSET + index];
|
|
326
|
+
if (vertex < VERTEX_COUNT) {
|
|
327
|
+
atomicStore(&distances[DISTANCES_OFFSET + vertex], 0u);
|
|
225
328
|
}
|
|
226
|
-
atomicStore(&converged[CONVERGED_OFFSET], ${triviallyConverged ? "1u" : "0u"});
|
|
227
329
|
}`
|
|
228
330
|
);
|
|
229
331
|
addShortestPathPass(commandGraph, {
|
|
230
|
-
id: `${state.id}-
|
|
332
|
+
id: `${state.id}-seeds`,
|
|
231
333
|
source,
|
|
232
334
|
bindings,
|
|
233
|
-
dispatchLayout:
|
|
335
|
+
dispatchLayout: getDispatchLayout(state, seedCount),
|
|
336
|
+
...state.seeds ? {} : { ownedSeed: search.sourceVertex }
|
|
234
337
|
});
|
|
235
338
|
}
|
|
236
339
|
function addSnapshotPass(commandGraph, state, iteration) {
|
|
@@ -239,8 +342,7 @@ function addSnapshotPass(commandGraph, state, iteration) {
|
|
|
239
342
|
const bindings = {
|
|
240
343
|
distances: { view: state.distances, usage: "storage-read-write", atomic: true },
|
|
241
344
|
previousDistances: { view: previousDistances, usage: "storage-write" },
|
|
242
|
-
changed: { view: changed, usage: "storage-write", atomic: true }
|
|
243
|
-
converged: { view: state.converged, usage: "storage-read" }
|
|
345
|
+
changed: { view: changed, usage: "storage-write", atomic: true }
|
|
244
346
|
};
|
|
245
347
|
const source = (
|
|
246
348
|
/* wgsl */
|
|
@@ -249,7 +351,6 @@ const VERTEX_COUNT: u32 = ${state.vertexCount}u;
|
|
|
249
351
|
const DISTANCES_OFFSET: u32 = ${(0, import_graph_data_view_utils.getViewElementOffset)(state.distances)}u;
|
|
250
352
|
const PREVIOUS_DISTANCES_OFFSET: u32 = ${(0, import_graph_data_view_utils.getViewElementOffset)(previousDistances)}u;
|
|
251
353
|
const CHANGED_OFFSET: u32 = ${(0, import_graph_data_view_utils.getViewElementOffset)(changed)}u;
|
|
252
|
-
const CONVERGED_OFFSET: u32 = ${(0, import_graph_data_view_utils.getViewElementOffset)(state.converged)}u;
|
|
253
354
|
${getBindingDeclarations(bindings)}
|
|
254
355
|
|
|
255
356
|
@compute @workgroup_size(${SHORTEST_PATH_WORKGROUP_SIZE})
|
|
@@ -259,7 +360,7 @@ fn main(
|
|
|
259
360
|
) {
|
|
260
361
|
${getInvocationIndexSource(state, Math.max(state.vertexCount, 1))}
|
|
261
362
|
if (index == 0u) { atomicStore(&changed[CHANGED_OFFSET], 0u); }
|
|
262
|
-
if (index >= VERTEX_COUNT
|
|
363
|
+
if (index >= VERTEX_COUNT) { return; }
|
|
263
364
|
previousDistances[PREVIOUS_DISTANCES_OFFSET + index] =
|
|
264
365
|
bitcast<f32>(atomicLoad(&distances[DISTANCES_OFFSET + index]));
|
|
265
366
|
}`
|
|
@@ -268,7 +369,8 @@ fn main(
|
|
|
268
369
|
id: `${state.id}-iteration-${iteration}-snapshot`,
|
|
269
370
|
source,
|
|
270
371
|
bindings,
|
|
271
|
-
dispatchLayout: getDispatchLayout(state, Math.max(state.vertexCount, 1))
|
|
372
|
+
dispatchLayout: getDispatchLayout(state, Math.max(state.vertexCount, 1)),
|
|
373
|
+
condition: state.roundCondition
|
|
272
374
|
});
|
|
273
375
|
}
|
|
274
376
|
function addRelaxationPass(commandGraph, props) {
|
|
@@ -281,8 +383,7 @@ function addRelaxationPass(commandGraph, props) {
|
|
|
281
383
|
...adjacency.edgeWeights ? { edgeWeights: { view: adjacency.edgeWeights, usage: "storage-read" } } : {},
|
|
282
384
|
previousDistances: { view: previousDistances, usage: "storage-read" },
|
|
283
385
|
distances: { view: state.distances, usage: "storage-read-write", atomic: true },
|
|
284
|
-
changed: { view: changed, usage: "storage-read-write", atomic: true }
|
|
285
|
-
converged: { view: state.converged, usage: "storage-read" }
|
|
386
|
+
changed: { view: changed, usage: "storage-read-write", atomic: true }
|
|
286
387
|
};
|
|
287
388
|
const weightOffset = adjacency.edgeWeights ? `const WEIGHTS_OFFSET: u32 = ${(0, import_graph_data_view_utils.getViewElementOffset)(adjacency.edgeWeights)}u;` : "";
|
|
288
389
|
const weight = adjacency.edgeWeights ? "edgeWeights[WEIGHTS_OFFSET + slot]" : "1.0";
|
|
@@ -296,7 +397,6 @@ const NEIGHBORS_OFFSET: u32 = ${(0, import_graph_data_view_utils.getViewElementO
|
|
|
296
397
|
const PREVIOUS_DISTANCES_OFFSET: u32 = ${(0, import_graph_data_view_utils.getViewElementOffset)(previousDistances)}u;
|
|
297
398
|
const DISTANCES_OFFSET: u32 = ${(0, import_graph_data_view_utils.getViewElementOffset)(state.distances)}u;
|
|
298
399
|
const CHANGED_OFFSET: u32 = ${(0, import_graph_data_view_utils.getViewElementOffset)(changed)}u;
|
|
299
|
-
const CONVERGED_OFFSET: u32 = ${(0, import_graph_data_view_utils.getViewElementOffset)(state.converged)}u;
|
|
300
400
|
${weightOffset}
|
|
301
401
|
${getBindingDeclarations(bindings)}
|
|
302
402
|
|
|
@@ -306,7 +406,7 @@ fn main(
|
|
|
306
406
|
@builtin(local_invocation_index) localInvocationIndex: u32
|
|
307
407
|
) {
|
|
308
408
|
${getInvocationIndexSource(state, state.vertexCount)}
|
|
309
|
-
if (index >= VERTEX_COUNT
|
|
409
|
+
if (index >= VERTEX_COUNT) { return; }
|
|
310
410
|
let distance = previousDistances[PREVIOUS_DISTANCES_OFFSET + index];
|
|
311
411
|
if (bitcast<u32>(distance) >= 0x7f800000u) { return; }
|
|
312
412
|
let first = min(offsets[OFFSETS_OFFSET + index], CAPACITY);
|
|
@@ -326,7 +426,8 @@ fn main(
|
|
|
326
426
|
id: `${state.id}-iteration-${props.iteration}-relax-${props.direction}`,
|
|
327
427
|
source,
|
|
328
428
|
bindings,
|
|
329
|
-
dispatchLayout: getDispatchLayout(state, state.vertexCount)
|
|
429
|
+
dispatchLayout: getDispatchLayout(state, state.vertexCount),
|
|
430
|
+
condition: state.roundCondition
|
|
330
431
|
});
|
|
331
432
|
}
|
|
332
433
|
function addPredecessorResetPass(commandGraph, state, iteration) {
|
|
@@ -334,18 +435,15 @@ function addPredecessorResetPass(commandGraph, state, iteration) {
|
|
|
334
435
|
const bindings = {
|
|
335
436
|
previousDistances: { view: previousDistances, usage: "storage-read" },
|
|
336
437
|
distances: { view: state.distances, usage: "storage-read-write", atomic: true },
|
|
337
|
-
predecessors: { view: state.predecessors, usage: "storage-read-write", atomic: true }
|
|
338
|
-
converged: { view: state.converged, usage: "storage-read" }
|
|
438
|
+
predecessors: { view: state.predecessors, usage: "storage-read-write", atomic: true }
|
|
339
439
|
};
|
|
340
440
|
const source = (
|
|
341
441
|
/* wgsl */
|
|
342
442
|
`
|
|
343
443
|
const VERTEX_COUNT: u32 = ${state.vertexCount}u;
|
|
344
|
-
const SOURCE_VERTEX: u32 = ${state.sourceVertex}u;
|
|
345
444
|
const PREVIOUS_DISTANCES_OFFSET: u32 = ${(0, import_graph_data_view_utils.getViewElementOffset)(previousDistances)}u;
|
|
346
445
|
const DISTANCES_OFFSET: u32 = ${(0, import_graph_data_view_utils.getViewElementOffset)(state.distances)}u;
|
|
347
446
|
const PREDECESSORS_OFFSET: u32 = ${(0, import_graph_data_view_utils.getViewElementOffset)(state.predecessors)}u;
|
|
348
|
-
const CONVERGED_OFFSET: u32 = ${(0, import_graph_data_view_utils.getViewElementOffset)(state.converged)}u;
|
|
349
447
|
${getBindingDeclarations(bindings)}
|
|
350
448
|
|
|
351
449
|
@compute @workgroup_size(${SHORTEST_PATH_WORKGROUP_SIZE})
|
|
@@ -354,9 +452,8 @@ fn main(
|
|
|
354
452
|
@builtin(local_invocation_index) localInvocationIndex: u32
|
|
355
453
|
) {
|
|
356
454
|
${getInvocationIndexSource(state, state.vertexCount)}
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
}
|
|
455
|
+
// A seed keeps distance zero, so it never takes this branch and keeps the sentinel parent.
|
|
456
|
+
if (index >= VERTEX_COUNT) { return; }
|
|
360
457
|
let previous = bitcast<u32>(previousDistances[PREVIOUS_DISTANCES_OFFSET + index]);
|
|
361
458
|
let current = atomicLoad(&distances[DISTANCES_OFFSET + index]);
|
|
362
459
|
if (current < previous) {
|
|
@@ -368,7 +465,8 @@ fn main(
|
|
|
368
465
|
id: `${state.id}-iteration-${iteration}-reset-predecessors`,
|
|
369
466
|
source,
|
|
370
467
|
bindings,
|
|
371
|
-
dispatchLayout: getDispatchLayout(state, state.vertexCount)
|
|
468
|
+
dispatchLayout: getDispatchLayout(state, state.vertexCount),
|
|
469
|
+
condition: state.roundCondition
|
|
372
470
|
});
|
|
373
471
|
}
|
|
374
472
|
function addPredecessorPass(commandGraph, props) {
|
|
@@ -380,8 +478,7 @@ function addPredecessorPass(commandGraph, props) {
|
|
|
380
478
|
...adjacency.edgeWeights ? { edgeWeights: { view: adjacency.edgeWeights, usage: "storage-read" } } : {},
|
|
381
479
|
previousDistances: { view: previousDistances, usage: "storage-read" },
|
|
382
480
|
distances: { view: state.distances, usage: "storage-read-write", atomic: true },
|
|
383
|
-
predecessors: { view: state.predecessors, usage: "storage-read-write", atomic: true }
|
|
384
|
-
converged: { view: state.converged, usage: "storage-read" }
|
|
481
|
+
predecessors: { view: state.predecessors, usage: "storage-read-write", atomic: true }
|
|
385
482
|
};
|
|
386
483
|
const weightOffset = adjacency.edgeWeights ? `const WEIGHTS_OFFSET: u32 = ${(0, import_graph_data_view_utils.getViewElementOffset)(adjacency.edgeWeights)}u;` : "";
|
|
387
484
|
const weight = adjacency.edgeWeights ? "edgeWeights[WEIGHTS_OFFSET + slot]" : "1.0";
|
|
@@ -389,14 +486,12 @@ function addPredecessorPass(commandGraph, props) {
|
|
|
389
486
|
/* wgsl */
|
|
390
487
|
`
|
|
391
488
|
const VERTEX_COUNT: u32 = ${state.vertexCount}u;
|
|
392
|
-
const SOURCE_VERTEX: u32 = ${state.sourceVertex}u;
|
|
393
489
|
const CAPACITY: u32 = ${adjacency.neighbors.length}u;
|
|
394
490
|
const OFFSETS_OFFSET: u32 = ${(0, import_graph_data_view_utils.getViewElementOffset)(adjacency.offsets)}u;
|
|
395
491
|
const NEIGHBORS_OFFSET: u32 = ${(0, import_graph_data_view_utils.getViewElementOffset)(adjacency.neighbors)}u;
|
|
396
492
|
const PREVIOUS_DISTANCES_OFFSET: u32 = ${(0, import_graph_data_view_utils.getViewElementOffset)(previousDistances)}u;
|
|
397
493
|
const DISTANCES_OFFSET: u32 = ${(0, import_graph_data_view_utils.getViewElementOffset)(state.distances)}u;
|
|
398
494
|
const PREDECESSORS_OFFSET: u32 = ${(0, import_graph_data_view_utils.getViewElementOffset)(state.predecessors)}u;
|
|
399
|
-
const CONVERGED_OFFSET: u32 = ${(0, import_graph_data_view_utils.getViewElementOffset)(state.converged)}u;
|
|
400
495
|
${weightOffset}
|
|
401
496
|
${getBindingDeclarations(bindings)}
|
|
402
497
|
|
|
@@ -406,14 +501,15 @@ fn main(
|
|
|
406
501
|
@builtin(local_invocation_index) localInvocationIndex: u32
|
|
407
502
|
) {
|
|
408
503
|
${getInvocationIndexSource(state, state.vertexCount)}
|
|
409
|
-
if (index >= VERTEX_COUNT
|
|
504
|
+
if (index >= VERTEX_COUNT) { return; }
|
|
410
505
|
let sourceDistance = previousDistances[PREVIOUS_DISTANCES_OFFSET + index];
|
|
411
506
|
if (bitcast<u32>(sourceDistance) >= 0x7f800000u) { return; }
|
|
412
507
|
let first = min(offsets[OFFSETS_OFFSET + index], CAPACITY);
|
|
413
508
|
let last = min(offsets[OFFSETS_OFFSET + index + 1u], CAPACITY);
|
|
414
509
|
for (var slot = first; slot < last; slot++) {
|
|
415
510
|
let neighbor = neighbors[NEIGHBORS_OFFSET + slot];
|
|
416
|
-
|
|
511
|
+
// A seed never improves, so the first condition below also keeps its sentinel parent.
|
|
512
|
+
if (neighbor >= VERTEX_COUNT) { continue; }
|
|
417
513
|
let previousDistance = bitcast<u32>(previousDistances[PREVIOUS_DISTANCES_OFFSET + neighbor]);
|
|
418
514
|
let currentDistance = atomicLoad(&distances[DISTANCES_OFFSET + neighbor]);
|
|
419
515
|
let candidate = bitcast<u32>(sourceDistance + ${weight});
|
|
@@ -427,35 +523,39 @@ fn main(
|
|
|
427
523
|
id: `${state.id}-iteration-${props.iteration}-predecessors-${props.direction}`,
|
|
428
524
|
source,
|
|
429
525
|
bindings,
|
|
430
|
-
dispatchLayout: getDispatchLayout(state, state.vertexCount)
|
|
526
|
+
dispatchLayout: getDispatchLayout(state, state.vertexCount),
|
|
527
|
+
condition: state.roundCondition
|
|
431
528
|
});
|
|
432
529
|
}
|
|
433
530
|
function addConvergencePass(commandGraph, state, iteration) {
|
|
434
531
|
const changed = state.changed;
|
|
435
532
|
const bindings = {
|
|
436
533
|
changed: { view: changed, usage: "storage-read" },
|
|
437
|
-
converged: { view: state.converged, usage: "storage-
|
|
438
|
-
|
|
439
|
-
...getOverflowBindings(state)
|
|
534
|
+
converged: { view: state.converged, usage: "storage-write" },
|
|
535
|
+
control: { view: state.control, usage: "storage-read-write" }
|
|
440
536
|
};
|
|
441
|
-
const reachesSimplePathBound = iteration + 1 >= state.vertexCount - 1;
|
|
442
537
|
const source = (
|
|
443
538
|
/* wgsl */
|
|
444
539
|
`
|
|
540
|
+
const VERTEX_COUNT: u32 = ${state.vertexCount}u;
|
|
541
|
+
const MAX_ITERATIONS: u32 = ${state.maxIterations}u;
|
|
445
542
|
const CHANGED_OFFSET: u32 = ${(0, import_graph_data_view_utils.getViewElementOffset)(changed)}u;
|
|
446
543
|
const CONVERGED_OFFSET: u32 = ${(0, import_graph_data_view_utils.getViewElementOffset)(state.converged)}u;
|
|
447
|
-
const
|
|
448
|
-
${getOverflowConstants(state)}
|
|
544
|
+
const CONTROL_OFFSET: u32 = ${(0, import_graph_data_view_utils.getViewElementOffset)(state.control)}u;
|
|
449
545
|
${getBindingDeclarations(bindings)}
|
|
450
546
|
|
|
451
547
|
@compute @workgroup_size(1)
|
|
452
548
|
fn main() {
|
|
453
|
-
if (
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
if (changed[CHANGED_OFFSET] == 0u
|
|
458
|
-
|
|
549
|
+
if (control[CONTROL_OFFSET + ${SHORTEST_PATH_CONTROL_DISPATCH_X}u] == 0u) { return; }
|
|
550
|
+
let iterations = control[CONTROL_OFFSET + ${SHORTEST_PATH_CONTROL_ITERATIONS}u] + 1u;
|
|
551
|
+
control[CONTROL_OFFSET + ${SHORTEST_PATH_CONTROL_ITERATIONS}u] = iterations;
|
|
552
|
+
// No change, or V - 1 rounds, which bound every simple path, mean every distance is final.
|
|
553
|
+
if (changed[CHANGED_OFFSET] == 0u || iterations + 1u >= VERTEX_COUNT) {
|
|
554
|
+
converged[CONVERGED_OFFSET] = 1u;
|
|
555
|
+
control[CONTROL_OFFSET + ${SHORTEST_PATH_CONTROL_CONVERGED}u] = 1u;
|
|
556
|
+
control[CONTROL_OFFSET + ${SHORTEST_PATH_CONTROL_DISPATCH_X}u] = 0u;
|
|
557
|
+
} else if (iterations >= MAX_ITERATIONS) {
|
|
558
|
+
control[CONTROL_OFFSET + ${SHORTEST_PATH_CONTROL_DISPATCH_X}u] = 0u;
|
|
459
559
|
}
|
|
460
560
|
}`
|
|
461
561
|
);
|
|
@@ -491,15 +591,19 @@ function getBindingDeclarations(bindings) {
|
|
|
491
591
|
}).join("\n");
|
|
492
592
|
}
|
|
493
593
|
function addShortestPathPass(commandGraph, props) {
|
|
594
|
+
const names = Object.keys(props.bindings);
|
|
595
|
+
if (props.ownedSeed !== void 0)
|
|
596
|
+
names.push("seeds");
|
|
494
597
|
commandGraph.addComputePass({
|
|
495
598
|
id: props.id,
|
|
496
599
|
resources: Object.values(props.bindings).map(({ view, usage }) => ({ buffer: view, usage })),
|
|
600
|
+
...props.condition ? { condition: props.condition } : {},
|
|
497
601
|
compile: ({ device }) => {
|
|
498
602
|
const kernel = new import_kernel.Kernel(device, {
|
|
499
603
|
id: props.id,
|
|
500
604
|
source: props.source,
|
|
501
605
|
shaderLayout: {
|
|
502
|
-
bindings:
|
|
606
|
+
bindings: names.map((name, location) => ({
|
|
503
607
|
name,
|
|
504
608
|
type: "storage",
|
|
505
609
|
group: 0,
|
|
@@ -507,21 +611,30 @@ function addShortestPathPass(commandGraph, props) {
|
|
|
507
611
|
}))
|
|
508
612
|
}
|
|
509
613
|
});
|
|
614
|
+
const ownedSeed = props.ownedSeed === void 0 ? void 0 : device.createBuffer({
|
|
615
|
+
id: `${props.id}-source-vertex`,
|
|
616
|
+
data: Uint32Array.of(props.ownedSeed),
|
|
617
|
+
usage: import_core.Buffer.STORAGE
|
|
618
|
+
});
|
|
510
619
|
return {
|
|
511
620
|
encode: ({ computePass, getBuffer }) => {
|
|
512
621
|
const bindings = {};
|
|
513
622
|
for (const [name, binding] of Object.entries(props.bindings)) {
|
|
514
623
|
bindings[name] = (0, import_graph_data_view_utils.getViewBinding)(binding.view, getBuffer);
|
|
515
624
|
}
|
|
516
|
-
|
|
625
|
+
if (ownedSeed)
|
|
626
|
+
bindings["seeds"] = ownedSeed;
|
|
517
627
|
kernel.dispatch(computePass, {
|
|
518
|
-
bindings
|
|
628
|
+
bindings,
|
|
519
629
|
x: props.dispatchLayout.x,
|
|
520
630
|
y: props.dispatchLayout.y,
|
|
521
631
|
z: props.dispatchLayout.z
|
|
522
632
|
});
|
|
523
633
|
},
|
|
524
|
-
destroy: () =>
|
|
634
|
+
destroy: () => {
|
|
635
|
+
kernel.destroy();
|
|
636
|
+
ownedSeed == null ? void 0 : ownedSeed.destroy();
|
|
637
|
+
}
|
|
525
638
|
};
|
|
526
639
|
}
|
|
527
640
|
});
|
|
@@ -537,6 +650,13 @@ function getGPUGraphAlgorithmsSingleSourceShortestPathDispatchLayout(elementCoun
|
|
|
537
650
|
}
|
|
538
651
|
// Annotate the CommonJS export names for ESM import in node:
|
|
539
652
|
0 && (module.exports = {
|
|
653
|
+
SHORTEST_PATH_CONTROL_BYTE_LENGTH,
|
|
654
|
+
SHORTEST_PATH_CONTROL_CONVERGED,
|
|
655
|
+
SHORTEST_PATH_CONTROL_DISPATCH_X,
|
|
656
|
+
SHORTEST_PATH_CONTROL_FAILED,
|
|
657
|
+
SHORTEST_PATH_CONTROL_ITERATIONS,
|
|
658
|
+
addGPUGraphAlgorithmsShortestPathInitializationToGraph,
|
|
659
|
+
addGPUGraphAlgorithmsShortestPathRoundsToGraph,
|
|
540
660
|
addGPUGraphAlgorithmsSingleSourceShortestPathToGraphWithDispatchLimit,
|
|
541
661
|
getGPUGraphAlgorithmsSingleSourceShortestPathDispatchLayout
|
|
542
662
|
});
|
|
@@ -1,8 +1,35 @@
|
|
|
1
|
+
import { Buffer } from '@luma.gl/core';
|
|
1
2
|
import type { GPUCommandGraph } from "../gpu-core/gpu-command-graph.js";
|
|
2
3
|
import { type GPUBoundedDispatchLayout } from "../gpu-core/gpu-dispatch-utils.js";
|
|
3
4
|
import type { GPUGraphAlgorithmsSingleSourceShortestPath } from "./gpu-graph-single-source-shortest-path.js";
|
|
4
|
-
/**
|
|
5
|
-
|
|
5
|
+
/**
|
|
6
|
+
* Layout of the uint32 control record shared by every round. Elements 0-2 are the indirect
|
|
7
|
+
* dispatch command of each round pass; x is zero once the search stops. @internal
|
|
8
|
+
*/
|
|
9
|
+
export declare const SHORTEST_PATH_CONTROL_DISPATCH_X = 0;
|
|
10
|
+
/** Control element counting the relaxation rounds that ran. @internal */
|
|
11
|
+
export declare const SHORTEST_PATH_CONTROL_ITERATIONS = 3;
|
|
12
|
+
/** Control element that is nonzero when invalid weights or adjacency overflow stop the search. @internal */
|
|
13
|
+
export declare const SHORTEST_PATH_CONTROL_FAILED = 4;
|
|
14
|
+
/** Control element mirroring the convergence status. @internal */
|
|
15
|
+
export declare const SHORTEST_PATH_CONTROL_CONVERGED = 5;
|
|
16
|
+
/** Byte length of the control record. @internal */
|
|
17
|
+
export declare const SHORTEST_PATH_CONTROL_BYTE_LENGTH = 32;
|
|
18
|
+
/** Buffers that must survive between the separately compiled graphs of a batched run. @internal */
|
|
19
|
+
export type GPUGraphAlgorithmsShortestPathPersistentState = {
|
|
20
|
+
/** Control record with `STORAGE | INDIRECT` usage. */
|
|
21
|
+
control: Buffer;
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* Adds initialization and `roundCount` GPU-gated weighted Bellman-Ford rounds to one graph,
|
|
25
|
+
* using an explicit bounded dispatch limit. `roundCount` defaults to `min(maxIterations, 1024)`.
|
|
26
|
+
* @internal
|
|
27
|
+
*/
|
|
28
|
+
export declare function addGPUGraphAlgorithmsSingleSourceShortestPathToGraphWithDispatchLimit<Parameters>(search: GPUGraphAlgorithmsSingleSourceShortestPath, commandGraph: GPUCommandGraph<Parameters>, maxComputeWorkgroupsPerDimension: number, roundCount?: number): void;
|
|
29
|
+
/** Adds only the reset, weight validation, status, and seed passes of a batched run. @internal */
|
|
30
|
+
export declare function addGPUGraphAlgorithmsShortestPathInitializationToGraph<Parameters>(search: GPUGraphAlgorithmsSingleSourceShortestPath, commandGraph: GPUCommandGraph<Parameters>, maxComputeWorkgroupsPerDimension: number, persistent: GPUGraphAlgorithmsShortestPathPersistentState): void;
|
|
31
|
+
/** Adds `roundCount` GPU-gated rounds that continue from the current distances. @internal */
|
|
32
|
+
export declare function addGPUGraphAlgorithmsShortestPathRoundsToGraph<Parameters>(search: GPUGraphAlgorithmsSingleSourceShortestPath, commandGraph: GPUCommandGraph<Parameters>, maxComputeWorkgroupsPerDimension: number, roundCount: number, persistent: GPUGraphAlgorithmsShortestPathPersistentState): void;
|
|
6
33
|
/** Plans one bounded three-dimensional weighted shortest-path dispatch. @internal */
|
|
7
34
|
export declare function getGPUGraphAlgorithmsSingleSourceShortestPathDispatchLayout(elementCount: number, maxComputeWorkgroupsPerDimension: number): GPUBoundedDispatchLayout;
|
|
8
35
|
//# sourceMappingURL=gpu-graph-single-source-shortest-path-internals.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gpu-graph-single-source-shortest-path-internals.d.ts","sourceRoot":"","sources":["../../src/gpu-graph-algorithms/gpu-graph-single-source-shortest-path-internals.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"gpu-graph-single-source-shortest-path-internals.d.ts","sourceRoot":"","sources":["../../src/gpu-graph-algorithms/gpu-graph-single-source-shortest-path-internals.ts"],"names":[],"mappings":"AAKA,OAAO,EAAC,MAAM,EAAe,MAAM,eAAe,CAAC;AAEnD,OAAO,KAAK,EACV,eAAe,EAKhB,yCAAsC;AACvC,OAAO,EACL,KAAK,wBAAwB,EAG9B,0CAAuC;AAMxC,OAAO,KAAK,EAAC,0CAA0C,EAAC,mDAAgD;AAOxG;;;GAGG;AACH,eAAO,MAAM,gCAAgC,IAAI,CAAC;AAClD,yEAAyE;AACzE,eAAO,MAAM,gCAAgC,IAAI,CAAC;AAClD,4GAA4G;AAC5G,eAAO,MAAM,4BAA4B,IAAI,CAAC;AAC9C,kEAAkE;AAClE,eAAO,MAAM,+BAA+B,IAAI,CAAC;AACjD,mDAAmD;AACnD,eAAO,MAAM,iCAAiC,KAAK,CAAC;AAEpD,mGAAmG;AACnG,MAAM,MAAM,6CAA6C,GAAG;IAC1D,sDAAsD;IACtD,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAkDF;;;;GAIG;AACH,wBAAgB,qEAAqE,CAAC,UAAU,EAC9F,MAAM,EAAE,0CAA0C,EAClD,YAAY,EAAE,eAAe,CAAC,UAAU,CAAC,EACzC,gCAAgC,EAAE,MAAM,EACxC,UAAU,SAAuC,GAChD,IAAI,CAMN;AAED,kGAAkG;AAClG,wBAAgB,sDAAsD,CAAC,UAAU,EAC/E,MAAM,EAAE,0CAA0C,EAClD,YAAY,EAAE,eAAe,CAAC,UAAU,CAAC,EACzC,gCAAgC,EAAE,MAAM,EACxC,UAAU,EAAE,6CAA6C,GACxD,IAAI,CAMN;AAED,6FAA6F;AAC7F,wBAAgB,8CAA8C,CAAC,UAAU,EACvE,MAAM,EAAE,0CAA0C,EAClD,YAAY,EAAE,eAAe,CAAC,UAAU,CAAC,EACzC,gCAAgC,EAAE,MAAM,EACxC,UAAU,EAAE,MAAM,EAClB,UAAU,EAAE,6CAA6C,GACxD,IAAI,CAMN;AA6uBD,qFAAqF;AACrF,wBAAgB,2DAA2D,CACzE,YAAY,EAAE,MAAM,EACpB,gCAAgC,EAAE,MAAM,GACvC,wBAAwB,CAO1B"}
|