@luma.gl/graph 10.0.0-beta.2 → 10.0.0-beta.3
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 +24 -1
- package/dist/arrow/gpu/arrow-gpu-table-conversion.d.ts +10 -1
- package/dist/arrow/gpu/arrow-gpu-table-conversion.d.ts.map +1 -1
- package/dist/arrow/gpu/arrow-gpu-table-conversion.js +29 -1
- package/dist/arrow/gpu/arrow-gpu-table-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/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-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/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 +2 -2
- package/dist/gpu-dataframe/gpu-global-aggregation-compiler.d.ts.map +1 -1
- package/dist/gpu-dataframe/gpu-global-aggregation-compiler.js +4 -2
- 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 +113 -88
- package/dist/gpu-dataframe/gpu-global-sort-compiler.d.ts +6 -1
- package/dist/gpu-dataframe/gpu-global-sort-compiler.d.ts.map +1 -1
- package/dist/gpu-dataframe/gpu-global-sort-compiler.js +111 -85
- package/dist/gpu-dataframe/gpu-global-sort-compiler.js.map +1 -1
- package/dist/gpu-dataframe/gpu-group-aggregation-compiler.cjs +286 -48
- package/dist/gpu-dataframe/gpu-group-aggregation-compiler.d.ts +17 -2
- package/dist/gpu-dataframe/gpu-group-aggregation-compiler.d.ts.map +1 -1
- package/dist/gpu-dataframe/gpu-group-aggregation-compiler.js +290 -39
- package/dist/gpu-dataframe/gpu-group-aggregation-compiler.js.map +1 -1
- package/dist/gpu-dataframe/gpu-group-by-query.cjs +8 -6
- package/dist/gpu-dataframe/gpu-group-by-query.d.ts +7 -1
- package/dist/gpu-dataframe/gpu-group-by-query.d.ts.map +1 -1
- package/dist/gpu-dataframe/gpu-group-by-query.js +9 -5
- package/dist/gpu-dataframe/gpu-group-by-query.js.map +1 -1
- package/dist/gpu-dataframe/gpu-join-compiler.cjs +8 -6
- package/dist/gpu-dataframe/gpu-join-compiler.d.ts +1 -1
- package/dist/gpu-dataframe/gpu-join-compiler.d.ts.map +1 -1
- package/dist/gpu-dataframe/gpu-join-compiler.js +9 -7
- package/dist/gpu-dataframe/gpu-join-compiler.js.map +1 -1
- package/dist/gpu-dataframe/gpu-query-compiler.cjs +37 -11
- package/dist/gpu-dataframe/gpu-query-compiler.d.ts +3 -1
- package/dist/gpu-dataframe/gpu-query-compiler.d.ts.map +1 -1
- package/dist/gpu-dataframe/gpu-query-compiler.js +36 -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-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 +261 -68
- package/dist/gpu-physics/gpu-rigid-body-world.d.ts +47 -2
- package/dist/gpu-physics/gpu-rigid-body-world.d.ts.map +1 -1
- package/dist/gpu-physics/gpu-rigid-body-world.js +324 -75
- package/dist/gpu-physics/gpu-rigid-body-world.js.map +1 -1
- package/dist/gpu-physics/index.cjs.map +3 -3
- package/dist/gpu-physics/index.d.ts +2 -1
- package/dist/gpu-physics/index.d.ts.map +1 -1
- 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.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/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-sql/gpu-sql.cjs +203 -59
- package/dist/gpu-sql/gpu-sql.d.ts +36 -1
- package/dist/gpu-sql/gpu-sql.d.ts.map +1 -1
- package/dist/gpu-sql/gpu-sql.js +225 -62
- 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/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 +4 -4
- 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 +46 -1
- package/src/arrow/index.ts +1 -0
- package/src/gpu-core/gpu-bvh-bounds.ts +84 -0
- package/src/gpu-core/gpu-command-graph-submission-pacer.ts +102 -0
- 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 +6 -2
- package/src/gpu-dataframe/gpu-global-aggregation-query.ts +12 -3
- package/src/gpu-dataframe/gpu-global-sort-compiler.ts +151 -93
- package/src/gpu-dataframe/gpu-group-aggregation-compiler.ts +469 -52
- package/src/gpu-dataframe/gpu-group-by-query.ts +24 -10
- package/src/gpu-dataframe/gpu-join-compiler.ts +12 -6
- package/src/gpu-dataframe/gpu-query-compiler.ts +60 -18
- package/src/gpu-dataframe/index.ts +1 -1
- 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 +421 -93
- package/src/gpu-physics/index.ts +9 -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 +9 -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 +405 -91
- package/src/gpu-sql/index.ts +1 -1
- package/src/utils/float32.ts +16 -0
|
@@ -45,6 +45,7 @@ export type GPUDataFrameAggregationValue<
|
|
|
45
45
|
SelectedColumns extends keyof T & string
|
|
46
46
|
> =
|
|
47
47
|
| 'count'
|
|
48
|
+
| Readonly<{count: SelectedColumns}>
|
|
48
49
|
| Readonly<{sum: GPUDataFrameColumnNamesOfFormat<T, SelectedColumns, 'float32'>}>
|
|
49
50
|
| Readonly<{min: GPUDataFrameColumnNamesOfFormat<T, SelectedColumns, 'float32'>}>
|
|
50
51
|
| Readonly<{max: GPUDataFrameColumnNamesOfFormat<T, SelectedColumns, 'float32'>}>
|
|
@@ -61,7 +62,9 @@ export type GPUDataFrameGroupedAggregationResult<
|
|
|
61
62
|
Key extends string,
|
|
62
63
|
Definitions extends Readonly<Record<string, unknown>>
|
|
63
64
|
> = Record<Key, 'uint32'> & {
|
|
64
|
-
[Name in keyof Definitions & string]: Definitions[Name] extends 'count'
|
|
65
|
+
[Name in keyof Definitions & string]: Definitions[Name] extends 'count' | {count: string}
|
|
66
|
+
? 'uint32'
|
|
67
|
+
: 'float32';
|
|
65
68
|
};
|
|
66
69
|
|
|
67
70
|
/**
|
|
@@ -187,15 +190,18 @@ export class GPUDataFrameGroupedAggregationQuery<
|
|
|
187
190
|
}
|
|
188
191
|
}
|
|
189
192
|
|
|
190
|
-
/** Normalizes a closed set of operation shapes without accepting arbitrary shader expressions. */
|
|
191
|
-
function normalizeGPUDataFrameAggregations<
|
|
193
|
+
/** Normalizes a closed set of operation shapes without accepting arbitrary shader expressions. @internal */
|
|
194
|
+
export function normalizeGPUDataFrameAggregations<
|
|
192
195
|
Logical extends GPUTypeMap,
|
|
193
196
|
SelectedColumns extends keyof Logical & string,
|
|
194
197
|
Source extends GPUTypeMap
|
|
195
198
|
>(
|
|
196
|
-
query:
|
|
197
|
-
|
|
198
|
-
|
|
199
|
+
query: Pick<
|
|
200
|
+
GPUDataFrameQuery<Logical, SelectedColumns, Source>,
|
|
201
|
+
'source' | 'selectedColumns' | 'derivedColumns'
|
|
202
|
+
>,
|
|
203
|
+
outputKey: string | undefined,
|
|
204
|
+
definitions: Readonly<Record<string, unknown>>
|
|
199
205
|
): GPUDataFrameAggregationDefinition[] {
|
|
200
206
|
const entries = Object.entries(definitions);
|
|
201
207
|
if (entries.length === 0) {
|
|
@@ -205,7 +211,7 @@ function normalizeGPUDataFrameAggregations<
|
|
|
205
211
|
const formats = getGPUDataFrameQueryColumnFormats(query);
|
|
206
212
|
const normalized: GPUDataFrameAggregationDefinition[] = [];
|
|
207
213
|
for (const [name, value] of entries) {
|
|
208
|
-
if (name.length === 0 || name ===
|
|
214
|
+
if (name.length === 0 || name === outputKey) {
|
|
209
215
|
throw new Error('GPUDataFrame aggregation names must be distinct from the group key');
|
|
210
216
|
}
|
|
211
217
|
if (value === 'count') {
|
|
@@ -221,13 +227,19 @@ function normalizeGPUDataFrameAggregations<
|
|
|
221
227
|
throw new Error(`GPUDataFrame aggregation "${name}" requires exactly one operation`);
|
|
222
228
|
}
|
|
223
229
|
const [operation, column] = operations[0];
|
|
224
|
-
if (
|
|
230
|
+
if (
|
|
231
|
+
operation !== 'count' &&
|
|
232
|
+
operation !== 'sum' &&
|
|
233
|
+
operation !== 'min' &&
|
|
234
|
+
operation !== 'max' &&
|
|
235
|
+
operation !== 'mean'
|
|
236
|
+
) {
|
|
225
237
|
throw new Error(`GPUDataFrame aggregation "${name}" has an unsupported operation`);
|
|
226
238
|
}
|
|
227
239
|
if (typeof column !== 'string' || !query.selectedColumns.includes(column as SelectedColumns)) {
|
|
228
240
|
throw new Error(`GPUDataFrame aggregation "${name}" requires a selected input column`);
|
|
229
241
|
}
|
|
230
|
-
if (formats.get(column) !== 'float32') {
|
|
242
|
+
if (operation !== 'count' && formats.get(column) !== 'float32') {
|
|
231
243
|
throw new Error(`GPUDataFrame aggregation "${name}" requires a float32 input column`);
|
|
232
244
|
}
|
|
233
245
|
normalized.push(Object.freeze({name, operation, column}));
|
|
@@ -240,7 +252,9 @@ function normalizeGPUDataFrameAggregations<
|
|
|
240
252
|
function getGPUDataFrameQueryColumnFormats<
|
|
241
253
|
Logical extends GPUTypeMap,
|
|
242
254
|
SelectedColumns extends keyof Logical & string
|
|
243
|
-
>(
|
|
255
|
+
>(
|
|
256
|
+
query: Pick<GPUDataFrameQuery<Logical, SelectedColumns, any>, 'source' | 'derivedColumns'>
|
|
257
|
+
): Map<string, string | undefined> {
|
|
244
258
|
const formats = new Map<string, string | undefined>(
|
|
245
259
|
query.source.schema.fields.map(
|
|
246
260
|
field =>
|
|
@@ -39,6 +39,7 @@ import type {GPUDataFrameJoinType, GPUDataFrameNormalizedJoinOptions} from './gp
|
|
|
39
39
|
import {
|
|
40
40
|
CompiledGPUDataFrameQuery,
|
|
41
41
|
compileGPUDataFrameQuery,
|
|
42
|
+
projectGPUDataFrameQueryResult,
|
|
42
43
|
type CompiledGPUDataFrameQueryProps,
|
|
43
44
|
type GPUDataFrameQueryExtensionContext,
|
|
44
45
|
type GPUDataFrameQueryExtensionResult,
|
|
@@ -170,7 +171,8 @@ export function compileGPUDataFrameJoin<
|
|
|
170
171
|
right: GPUDataFrame<Right>,
|
|
171
172
|
options: GPUDataFrameNormalizedJoinOptions,
|
|
172
173
|
joinType: GPUDataFrameJoinType,
|
|
173
|
-
graph: GPUCommandGraph<GPUDataFrameQueryParameters
|
|
174
|
+
graph: GPUCommandGraph<GPUDataFrameQueryParameters>,
|
|
175
|
+
resultColumns?: readonly (keyof Selection & string)[]
|
|
174
176
|
): CompiledGPUDataFrameJoin<Selection, Right> {
|
|
175
177
|
validateGPUJoinSources(source, right, options, graph);
|
|
176
178
|
const retainedRight = right.select(right.columnNames);
|
|
@@ -181,7 +183,8 @@ export function compileGPUDataFrameJoin<
|
|
|
181
183
|
Selection,
|
|
182
184
|
CompiledGPUDataFrameJoin<Selection, Right>
|
|
183
185
|
>(source, predicates, selectedColumns, graph, derivedColumns, {
|
|
184
|
-
prepare: context =>
|
|
186
|
+
prepare: context =>
|
|
187
|
+
addGPUJoinToGraph(context, retainedRight, options, joinType, resultColumns)
|
|
185
188
|
});
|
|
186
189
|
} catch (error) {
|
|
187
190
|
retainedRight.destroy();
|
|
@@ -261,7 +264,8 @@ function addGPUJoinToGraph<Left extends GPUTypeMap, Right extends GPUTypeMap>(
|
|
|
261
264
|
context: GPUDataFrameQueryExtensionContext<Left>,
|
|
262
265
|
right: GPUDataFrame<Right>,
|
|
263
266
|
options: GPUDataFrameNormalizedJoinOptions,
|
|
264
|
-
joinType: GPUDataFrameJoinType
|
|
267
|
+
joinType: GPUDataFrameJoinType,
|
|
268
|
+
resultColumns?: readonly (keyof Left & string)[]
|
|
265
269
|
): GPUDataFrameQueryExtensionResult<Left, CompiledGPUDataFrameJoin<Left, Right>> {
|
|
266
270
|
const ownedVectors: GPUVector[] = [];
|
|
267
271
|
const id = `${context.queryId}-${joinType}-join`;
|
|
@@ -401,10 +405,12 @@ function addGPUJoinToGraph<Left extends GPUTypeMap, Right extends GPUTypeMap>(
|
|
|
401
405
|
indexStatistics: indexState.indexStatistics,
|
|
402
406
|
contractViolation: indexState.contractViolation
|
|
403
407
|
};
|
|
408
|
+
const projection = resultColumns && projectGPUDataFrameQueryResult(context, resultColumns);
|
|
404
409
|
return {
|
|
405
|
-
table: context.table,
|
|
406
|
-
validity: context.validity,
|
|
407
|
-
dictionaries: context.dictionaries,
|
|
410
|
+
table: projection?.table ?? context.table,
|
|
411
|
+
validity: projection?.validity ?? context.validity,
|
|
412
|
+
dictionaries: projection?.dictionaries ?? context.dictionaries,
|
|
413
|
+
ownedTables: projection ? [projection] : [],
|
|
408
414
|
ownedVectors,
|
|
409
415
|
createCompiled: props => new CompiledGPUDataFrameJoin(props, resources)
|
|
410
416
|
};
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
// SPDX-FileCopyrightText: Copyright (c) vis.gl contributors
|
|
4
4
|
// SPDX-FileComment: Independently implemented for WebGPU; inspired by NVIDIA RAPIDS cuDF.
|
|
5
5
|
|
|
6
|
-
import {GPU_EXPRESSION_CAST_WGSL} from '../gpu-core/gpu-expression-cast';
|
|
7
6
|
import {
|
|
8
7
|
Buffer,
|
|
9
8
|
type Binding,
|
|
@@ -11,8 +10,14 @@ import {
|
|
|
11
10
|
type CommandEncoder,
|
|
12
11
|
type Device
|
|
13
12
|
} from '@luma.gl/core';
|
|
13
|
+
import {
|
|
14
|
+
GPUData,
|
|
15
|
+
GPUVector,
|
|
16
|
+
getGPUVectorWGSLLayout,
|
|
17
|
+
type GPUConstant,
|
|
18
|
+
type GPUVectorWGSLFormat as GPUExpressionNumericFormat
|
|
19
|
+
} from '@luma.gl/graph/gpu-data';
|
|
14
20
|
import {Kernel} from '../execution/compute/kernel';
|
|
15
|
-
import {GPUData, GPUVector, type GPUConstant} from '@luma.gl/graph/gpu-data';
|
|
16
21
|
import {GPURecordBatch, GPUTable, type GPUField, type GPUTypeMap} from '@luma.gl/graph/gpu-tables';
|
|
17
22
|
import {
|
|
18
23
|
type CompiledGPUCommandGraph,
|
|
@@ -25,21 +30,40 @@ import {
|
|
|
25
30
|
import {getBoundedDispatchLayout, getBoundedInvocationIndexSource} from '@luma.gl/graph/gpu-core';
|
|
26
31
|
import {GPUVisibilityWorkflow} from '@luma.gl/graph/gpu-core';
|
|
27
32
|
import {createTransientView, getViewBinding, getViewElementOffset} from '@luma.gl/graph/gpu-core';
|
|
28
|
-
import
|
|
33
|
+
import {
|
|
34
|
+
GPUDataFrame,
|
|
35
|
+
type GPUDataFrameDictionaries,
|
|
36
|
+
type GPUDataFrameValidity
|
|
37
|
+
} from './gpu-data-frame';
|
|
29
38
|
import type {GPUDataFrameDerivedColumn} from './gpu-data-frame-query';
|
|
30
39
|
import type {GPUExpression} from './gpu-expression';
|
|
31
40
|
import {
|
|
32
41
|
encodeGPUQueryExpressionControls,
|
|
33
|
-
getGPUQueryShaderType,
|
|
34
42
|
makeGPUQueryExpressionShaderPlan,
|
|
35
43
|
type GPUQueryExpressionColumn,
|
|
36
44
|
type GPUQueryExpressionOutput,
|
|
37
|
-
type GPUQueryExpressionShaderPlan
|
|
38
|
-
type GPUQueryScalarFormat
|
|
45
|
+
type GPUQueryExpressionShaderPlan
|
|
39
46
|
} from './gpu-expression-shader';
|
|
40
47
|
|
|
41
48
|
const LU_QUERY_WORKGROUP_SIZE = 256;
|
|
42
|
-
|
|
49
|
+
|
|
50
|
+
/** Borrows projected columns while the query owns its working table. @internal */
|
|
51
|
+
export function projectGPUDataFrameQueryResult<Selection extends GPUTypeMap>(
|
|
52
|
+
context: GPUDataFrameQueryExtensionContext<Selection>,
|
|
53
|
+
columns: readonly (keyof Selection & string)[]
|
|
54
|
+
): GPUDataFrame<Selection> {
|
|
55
|
+
const working = new GPUDataFrame<Selection>({
|
|
56
|
+
table: context.table,
|
|
57
|
+
validity: context.validity,
|
|
58
|
+
dictionaries: context.dictionaries,
|
|
59
|
+
ownership: 'borrowed'
|
|
60
|
+
});
|
|
61
|
+
try {
|
|
62
|
+
return working.select(columns) as GPUDataFrame<Selection>;
|
|
63
|
+
} finally {
|
|
64
|
+
working.destroy();
|
|
65
|
+
}
|
|
66
|
+
}
|
|
43
67
|
|
|
44
68
|
/** Caller-owned scalar values supplied to an already compiled dataframe filter. */
|
|
45
69
|
export type GPUDataFrameQueryParameters = Readonly<Record<string, number | boolean | null>>;
|
|
@@ -51,12 +75,12 @@ type GPUQuerySourceView = {
|
|
|
51
75
|
|
|
52
76
|
type GPUQueryDerivedOutput = {
|
|
53
77
|
plan: GPUQueryExpressionOutput;
|
|
54
|
-
values: GPUVector<
|
|
78
|
+
values: GPUVector<GPUExpressionNumericFormat>;
|
|
55
79
|
validity?: GPUVector<'uint32'>;
|
|
56
80
|
};
|
|
57
81
|
|
|
58
82
|
type GPUQueryDerivedView = {
|
|
59
|
-
values: GraphVectorView<
|
|
83
|
+
values: GraphVectorView<GPUExpressionNumericFormat>;
|
|
60
84
|
validity?: GraphVectorView<'uint32'>;
|
|
61
85
|
};
|
|
62
86
|
|
|
@@ -420,7 +444,7 @@ function validateGPUQueryBindingCapacity(
|
|
|
420
444
|
}
|
|
421
445
|
|
|
422
446
|
/** Creates one independently owned fixed-width GPU output chunk for every source batch. */
|
|
423
|
-
function createGPUQueryOutputVector<Format extends
|
|
447
|
+
function createGPUQueryOutputVector<Format extends GPUExpressionNumericFormat>(
|
|
424
448
|
device: Device,
|
|
425
449
|
name: string,
|
|
426
450
|
lengths: readonly number[],
|
|
@@ -433,7 +457,7 @@ function createGPUQueryOutputVector<Format extends GPUQueryScalarFormat>(
|
|
|
433
457
|
for (const [batchIndex, length] of lengths.entries()) {
|
|
434
458
|
const buffer = device.createBuffer({
|
|
435
459
|
id: `${name}-batch-${batchIndex}`,
|
|
436
|
-
byteLength: Math.max(length, 1) *
|
|
460
|
+
byteLength: Math.max(length, 1) * getGPUVectorWGSLLayout(format).packedByteStride,
|
|
437
461
|
usage:
|
|
438
462
|
Buffer.STORAGE |
|
|
439
463
|
Buffer.COPY_SRC |
|
|
@@ -506,7 +530,13 @@ function createGPUQueryDerivedTable<Result extends GPUTypeMap>(
|
|
|
506
530
|
const layouts: BufferLayout[] = selectedColumns.flatMap(name => {
|
|
507
531
|
const output = outputsByName.get(name);
|
|
508
532
|
if (output) {
|
|
509
|
-
return [
|
|
533
|
+
return [
|
|
534
|
+
{
|
|
535
|
+
name,
|
|
536
|
+
format: output.plan.format,
|
|
537
|
+
byteStride: getGPUVectorWGSLLayout(output.plan.format).packedByteStride
|
|
538
|
+
}
|
|
539
|
+
];
|
|
510
540
|
}
|
|
511
541
|
return selectedSource.bufferLayout
|
|
512
542
|
.filter(layout => layout.name === name)
|
|
@@ -689,7 +719,16 @@ function addGPUQueryPredicatePass(
|
|
|
689
719
|
`const INPUT_${column.index}_OFFSET: u32 = ${getViewElementOffset(values)}u;`
|
|
690
720
|
);
|
|
691
721
|
declarations.push(
|
|
692
|
-
`@group(0) @binding(${bindingIndex++}) var<storage, read> input${column.index}: array<${
|
|
722
|
+
`@group(0) @binding(${bindingIndex++}) var<storage, read> input${column.index}: array<${getGPUVectorWGSLLayout(column.format).scalarType}>;`
|
|
723
|
+
);
|
|
724
|
+
const layout = getGPUVectorWGSLLayout(column.format);
|
|
725
|
+
const components = Array.from(
|
|
726
|
+
{length: layout.components},
|
|
727
|
+
(_, component) =>
|
|
728
|
+
`input${column.index}[INPUT_${column.index}_OFFSET + row * ${layout.components}u + ${component}u]`
|
|
729
|
+
);
|
|
730
|
+
declarations.push(
|
|
731
|
+
`fn readInput${column.index}(row: u32) -> ${layout.shaderType} { return ${layout.components === 1 ? components[0] : `${layout.shaderType}(${components.join(', ')})`}; }`
|
|
693
732
|
);
|
|
694
733
|
bindings[`input${column.index}`] = values;
|
|
695
734
|
resources.push({buffer: values, usage: 'storage-read'});
|
|
@@ -730,13 +769,16 @@ function addGPUQueryPredicatePass(
|
|
|
730
769
|
`const DERIVED_${output.index}_OFFSET: u32 = ${getViewElementOffset(values)}u;`
|
|
731
770
|
);
|
|
732
771
|
declarations.push(
|
|
733
|
-
`@group(0) @binding(${bindingIndex++}) var<storage, read_write> derived${output.index}: array<${
|
|
772
|
+
`@group(0) @binding(${bindingIndex++}) var<storage, read_write> derived${output.index}: array<${getGPUVectorWGSLLayout(output.format).scalarType}>;`
|
|
734
773
|
);
|
|
735
774
|
bindings[`derived${output.index}`] = values;
|
|
736
775
|
resources.push({buffer: values, usage: 'storage-write'});
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
776
|
+
const layout = getGPUVectorWGSLLayout(output.format);
|
|
777
|
+
for (let component = 0; component < layout.components; component++) {
|
|
778
|
+
derivedWrites.push(
|
|
779
|
+
`derived${output.index}[DERIVED_${output.index}_OFFSET + index * ${layout.components}u + ${component}u] = ${layout.components === 1 ? output.value : `${output.value}[${component}]`};`
|
|
780
|
+
);
|
|
781
|
+
}
|
|
740
782
|
|
|
741
783
|
if (output.nullable) {
|
|
742
784
|
const validity = views?.validity?.data[props.batchIndex];
|
|
@@ -773,7 +815,7 @@ function addGPUQueryPredicatePass(
|
|
|
773
815
|
const source = /* wgsl */ `
|
|
774
816
|
const ELEMENT_COUNT: u32 = ${props.output.length}u;
|
|
775
817
|
${declarations.join('\n')}
|
|
776
|
-
${props.plan.
|
|
818
|
+
${props.plan.helpers.join('\n')}
|
|
777
819
|
|
|
778
820
|
@compute @workgroup_size(${LU_QUERY_WORKGROUP_SIZE})
|
|
779
821
|
fn main(
|
|
@@ -77,7 +77,7 @@ export {CompiledGPUDataFrameSort} from './gpu-sort-compiler';
|
|
|
77
77
|
export {CompiledGPUDataFrameGlobalSort} from './gpu-global-sort-compiler';
|
|
78
78
|
export {CompiledGPUDataFrameJoin, CompiledGPUDataFrameLookup} from './gpu-join-compiler';
|
|
79
79
|
|
|
80
|
-
export {vector, cast} from './gpu-expression';
|
|
80
|
+
export {vector, vectorColumn, cast} from './gpu-expression';
|
|
81
81
|
export type {GPUExpressionNumericValue} from './gpu-expression';
|
|
82
82
|
export type {
|
|
83
83
|
GPUVectorWGSLFormat as GPUExpressionNumericFormat,
|
|
@@ -14,6 +14,7 @@ import {
|
|
|
14
14
|
type GPURigidBodyCapture,
|
|
15
15
|
type GPURigidBodyWorldProps
|
|
16
16
|
} from './gpu-rigid-body-world';
|
|
17
|
+
import type {GPURigidBodyCapacityInfo} from './rigid-body-capacity';
|
|
17
18
|
|
|
18
19
|
export type GPUPhysicsWorldHandle = Readonly<{id: string; generation: number}>;
|
|
19
20
|
export type GPUPhysicsBatchProps = {
|
|
@@ -34,6 +35,8 @@ type Slot = {
|
|
|
34
35
|
checkpoint: GPURigidBodyGPUCheckpoint;
|
|
35
36
|
bytes: number;
|
|
36
37
|
worldBytes: number;
|
|
38
|
+
/** Physical scratch for the simulation graph and the world's private query graph. */
|
|
39
|
+
graphBytes: number;
|
|
37
40
|
handle: GPUPhysicsWorldHandle | null;
|
|
38
41
|
origin: [number, number, number];
|
|
39
42
|
active: boolean;
|
|
@@ -72,7 +75,7 @@ export class GPUPhysicsBatch {
|
|
|
72
75
|
const definition = structuredClone(props);
|
|
73
76
|
const probe = new GPURigidBodyWorld(definition);
|
|
74
77
|
try {
|
|
75
|
-
if (this.estimateResidentBytes(probe) > this.props.maximumResidentBytes)
|
|
78
|
+
if (this.estimateResidentBytes(probe.getCapacityInfo()) > this.props.maximumResidentBytes)
|
|
76
79
|
throw new Error('World and reset snapshot exceed residency budget');
|
|
77
80
|
this.templates.set(id, definition);
|
|
78
81
|
} finally {
|
|
@@ -115,13 +118,18 @@ export class GPUPhysicsBatch {
|
|
|
115
118
|
let graph: CompiledGPUCommandGraph<undefined> | undefined;
|
|
116
119
|
let checkpoint: GPURigidBodyGPUCheckpoint | undefined;
|
|
117
120
|
try {
|
|
118
|
-
|
|
119
|
-
const expectedBytes = this.estimateResidentBytes(world);
|
|
120
|
-
this.makeRoom(expectedBytes);
|
|
121
|
+
this.makeRoom(this.estimateResidentBytes(world.getCapacityInfo()));
|
|
121
122
|
const commands = new GPUCommandGraph<undefined>(this.props.device);
|
|
122
123
|
world.addToGraph(commands);
|
|
123
124
|
graph = await commands.compileAsync();
|
|
124
|
-
|
|
125
|
+
/** Attachment resolves scratch aliasing in the private cast index. */
|
|
126
|
+
const capacity = world.getCapacityInfo();
|
|
127
|
+
/** Graph scratch is resident, but is not copied to the reset snapshot. */
|
|
128
|
+
const graphBytes =
|
|
129
|
+
graph.stats.physicalTransientResourceBytes + capacity.queryIndexScratchBytes;
|
|
130
|
+
/** The admission estimate includes the private graph once. */
|
|
131
|
+
const bytes =
|
|
132
|
+
this.estimateResidentBytes(capacity) + graph.stats.physicalTransientResourceBytes;
|
|
125
133
|
this.makeRoom(bytes);
|
|
126
134
|
checkpoint = world.createGPUCheckpoint({includeRollbackScratch: false});
|
|
127
135
|
checkpoint.save();
|
|
@@ -131,7 +139,8 @@ export class GPUPhysicsBatch {
|
|
|
131
139
|
graph,
|
|
132
140
|
checkpoint,
|
|
133
141
|
bytes,
|
|
134
|
-
worldBytes,
|
|
142
|
+
worldBytes: capacity.ownedBufferBytes,
|
|
143
|
+
graphBytes,
|
|
135
144
|
handle: null,
|
|
136
145
|
origin: [0, 0, 0],
|
|
137
146
|
active: true,
|
|
@@ -290,10 +299,7 @@ export class GPUPhysicsBatch {
|
|
|
290
299
|
residentBytes: this.slots.reduce((sum, slot) => sum + slot.bytes, 0),
|
|
291
300
|
worldBufferBytes: this.slots.reduce((sum, slot) => sum + slot.worldBytes, 0),
|
|
292
301
|
checkpointBytes: this.slots.reduce((sum, slot) => sum + slot.checkpoint.byteLength, 0),
|
|
293
|
-
graphTransientBytes: this.slots.reduce(
|
|
294
|
-
(sum, slot) => sum + slot.graph.stats.physicalTransientResourceBytes,
|
|
295
|
-
0
|
|
296
|
-
),
|
|
302
|
+
graphTransientBytes: this.slots.reduce((sum, slot) => sum + slot.graphBytes, 0),
|
|
297
303
|
createdSlots: this.createdSlots,
|
|
298
304
|
reusedSlots: this.reusedSlots,
|
|
299
305
|
evictedSlots: this.evictedSlots
|
|
@@ -313,12 +319,12 @@ export class GPUPhysicsBatch {
|
|
|
313
319
|
this.destroyed = true;
|
|
314
320
|
}
|
|
315
321
|
|
|
316
|
-
|
|
317
|
-
|
|
322
|
+
/** Account for one reset copy of owned buffers and one copy of query scratch. */
|
|
323
|
+
private estimateResidentBytes(capacity: GPURigidBodyCapacityInfo): number {
|
|
318
324
|
const rollbackScratchBytes = capacity.buffers
|
|
319
325
|
.filter(buffer => buffer.name.startsWith('checkpoint-'))
|
|
320
326
|
.reduce((sum, buffer) => sum + buffer.byteLength, 0);
|
|
321
|
-
return capacity.ownedBufferBytes * 2 - rollbackScratchBytes;
|
|
327
|
+
return capacity.ownedBufferBytes * 2 - rollbackScratchBytes + capacity.queryIndexScratchBytes;
|
|
322
328
|
}
|
|
323
329
|
|
|
324
330
|
private makeRoom(bytes: number): void {
|
|
@@ -27,6 +27,7 @@ export type GPUPhysicsEnsembleProps = {
|
|
|
27
27
|
| 'continuous'
|
|
28
28
|
| 'collisionPartitionSize'
|
|
29
29
|
| 'ensembleBodiesPerInstance'
|
|
30
|
+
| 'ensemblePairsPerInstance'
|
|
30
31
|
| 'ensembleTerrainSlots'
|
|
31
32
|
| 'ensembleTerrainAtlas'
|
|
32
33
|
| 'maximumPairs'
|
|
@@ -38,6 +39,12 @@ export type GPUPhysicsEnsembleProps = {
|
|
|
38
39
|
terrainAtlas?: readonly GPUPhysicsTerrainAtlasPool[];
|
|
39
40
|
/** Shared power-of-two contact capacity. Overflow rejects the entire ensemble step. */
|
|
40
41
|
maximumPairs: number;
|
|
42
|
+
/**
|
|
43
|
+
* Optional power-of-two persistent contact budget per instance. Cache exhaustion rolls back
|
|
44
|
+
* and quarantines only that instance until reset. Global discovery and solver faults still
|
|
45
|
+
* reject the shared step. All instance budgets must fit within maximumPairs.
|
|
46
|
+
*/
|
|
47
|
+
maximumPairsPerInstance?: number;
|
|
41
48
|
/** Retained world buffers plus compiled graph scratch; excludes driver and compilation peaks. */
|
|
42
49
|
maximumResidentBytes: number;
|
|
43
50
|
};
|
|
@@ -144,6 +151,7 @@ export class GPUPhysicsEnsemble {
|
|
|
144
151
|
maximumPairs: props.maximumPairs,
|
|
145
152
|
collisionPartitionSize: colliderCount,
|
|
146
153
|
ensembleBodiesPerInstance: this.bodiesPerInstance,
|
|
154
|
+
ensemblePairsPerInstance: props.maximumPairsPerInstance,
|
|
147
155
|
ensembleTerrainAtlas: props.terrainAtlas,
|
|
148
156
|
ensembleTerrainSlots: this.terrainSlots.length
|
|
149
157
|
? Array.from({length: this.instances}, (_, instance) =>
|
|
@@ -161,9 +169,11 @@ export class GPUPhysicsEnsemble {
|
|
|
161
169
|
Math.min(device.limits.maxBufferSize, device.limits.maxStorageBufferBindingSize)
|
|
162
170
|
)
|
|
163
171
|
throw new Error('Ensemble terrain atlas exceeds device limits');
|
|
172
|
+
/** Reserve the private query graph along with the solver's owned buffers. */
|
|
173
|
+
const capacity = ensemble.world.getCapacityInfo();
|
|
164
174
|
if (
|
|
165
175
|
ensemble.minimumTerrainBytes > props.maximumResidentBytes ||
|
|
166
|
-
|
|
176
|
+
capacity.ownedBufferBytes + capacity.queryIndexScratchBytes > props.maximumResidentBytes
|
|
167
177
|
)
|
|
168
178
|
throw new Error('Ensemble residency budget exhausted');
|
|
169
179
|
const commands = new GPUCommandGraph<undefined>(device);
|
|
@@ -276,6 +286,7 @@ export class GPUPhysicsEnsemble {
|
|
|
276
286
|
this.world.wakeEnsembleInstance(instance);
|
|
277
287
|
}
|
|
278
288
|
|
|
289
|
+
/** Restore the template and clear this instance’s quarantine between submissions. */
|
|
279
290
|
async reset(instance: number): Promise<void> {
|
|
280
291
|
this.getBodyIndex(instance, 0);
|
|
281
292
|
this.preparing = true;
|
|
@@ -288,6 +299,7 @@ export class GPUPhysicsEnsemble {
|
|
|
288
299
|
}
|
|
289
300
|
}
|
|
290
301
|
|
|
302
|
+
/** Read the most recent scheduled participation and latched per-instance faults. */
|
|
291
303
|
async readStatus() {
|
|
292
304
|
const state = await this.world.readEnsembleState();
|
|
293
305
|
return {
|
|
@@ -298,7 +310,8 @@ export class GPUPhysicsEnsemble {
|
|
|
298
310
|
active: Boolean(state[17 + instance * 8]),
|
|
299
311
|
acceptedSteps: state[18 + instance * 8],
|
|
300
312
|
rejectedSteps: state[19 + instance * 8],
|
|
301
|
-
sharedFailure: Boolean(state[20 + instance * 8])
|
|
313
|
+
sharedFailure: Boolean(state[20 + instance * 8]),
|
|
314
|
+
failure: state[23 + instance * 8] ? ('contact-cache-capacity' as const) : null
|
|
302
315
|
}))
|
|
303
316
|
};
|
|
304
317
|
}
|
|
@@ -327,8 +340,11 @@ export class GPUPhysicsEnsemble {
|
|
|
327
340
|
}
|
|
328
341
|
|
|
329
342
|
getStats() {
|
|
330
|
-
|
|
331
|
-
const
|
|
343
|
+
/** Include query scratch in the same residency total as solver graph scratch. */
|
|
344
|
+
const {ownedBufferBytes: worldBufferBytes, queryIndexScratchBytes} =
|
|
345
|
+
this.world.getCapacityInfo();
|
|
346
|
+
const graphTransientBytes =
|
|
347
|
+
this.graph.stats.physicalTransientResourceBytes + queryIndexScratchBytes;
|
|
332
348
|
return {
|
|
333
349
|
instances: this.instances,
|
|
334
350
|
bodies: this.world.count,
|