Repository navigation
feat(aggregation-layers): add WebGPU ScreenGrid aggregation - #11052
Conversation
Codex Review Summary: ❌ FailedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
[Medium impact] The change reaches ScreenGrid aggregation and its cell-rendering workflow. Fix binary input compatibility before merging; integer weights and two-component positions can stop the grid from drawing. FindingsSummaryAdds WebGPU compute aggregation for
|
1321bed to
06792cc
Compare
69c129d to
ba26bba
Compare
| const position = this.props.positions || positionColumns.positions; | ||
| const components = position?.format === 'float32x2' ? 2 : 3; | ||
| const p = prepare(position, components); | ||
| const low = prepare(this.props.positions ? undefined : positionColumns.positions64Low, 3); |
There was a problem hiding this comment.
Two-component positions stop drawing
Binary getPosition inputs with size: 2 expose both position columns as float32x2. This call requires three components for positions64Low, so prepare() throws before aggregation runs and the grid cannot draw.
Use the low column's actual component count; the shader already supports two-component columns. PR #11053 retains the same mismatch.
5829a37 to
84ba584
Compare
| if (info.type !== 'float32' || info.components !== components) | ||
| throw new Error('ScreenGrid aggregation requires float32 columns'); |
There was a problem hiding this comment.
Binary getWeight inputs backed by Uint32Array stop drawing when WebGPU compute is selected. The attribute path preserves their uint32 format, but prepare() accepts only float32 and throws. These inputs previously worked through CPU aggregation.
Convert supported binary weights to floats or retain CPU fallback for unsupported formats. PR #11053 keeps the same restriction.
| This path also accepts `positions` and `weights` GPUVectors without a custom | ||
| aggregator. Positions must be single-chunk `float32x2` or `float32x3`, and weights | ||
| must be a single-chunk `float32` vector. Buffers need `STORAGE` or `COPY_SRC` usage; | ||
| non-storage inputs are copied on the GPU. Custom views require GPU positions in | ||
| the view's coordinate system. Accessor inputs use the normal position conversion. |
There was a problem hiding this comment.
P2: The GPU column rules now appear on the ScreenGrid, Grid and Hexagon pages and in aggregator.md, and they have started to drift. aggregator.md:223 names only the ScreenGrid and Grid compute paths as accepting columns without a custom aggregator, but Hexagon's page says it accepts them too. Grid and Hexagon also word the custom-view limit differently. Could the rules live once in GPU column inputs, with each page linking there? For example:
This path also accepts GPU column inputs without a custom aggregator.
Details
Proposed text for aggregator.md:
The built-in ScreenGrid, Grid and Hexagon compute paths accept positions as one
float32x2orfloat32x3chunk and weights as onefloat32chunk. Buffers needSTORAGEorCOPY_SRCusage; other buffers are copied on the GPU first. In custom views, positions must already use the view's coordinate system. Extensions need accessor data.
|
|
||
|
|
||
|
|
||
| ## Compute aggregation |
There was a problem hiding this comment.
Non-blocking: This page puts Compute aggregation in a ## section before Installation. Grid uses a #### heading among its props, and Hexagon a ##### under gpuAggregation. ScreenGrid's gpuAggregation entry also doesn't link here. Could the three pages use one placement, with each gpuAggregation entry linking to it?
Follow up of #11045; stacked on its branch.
Background
ScreenGrid currently falls back to CPU aggregation on WebGPU. Three compute passes project points, reduce bins, and write GPUVectors consumed directly by cell rendering.
Change List
Verified: 172 browser tests passed, 2 existing skips; lint and scoped aggregation typecheck passed. Full build, golden render, and website checks not run.
Note
Medium Risk
Introduces new WGSL compute shaders and GPU buffer handling for WebGPU aggregation in
ScreenGridLayer. Risk is mitigated by strict gating that falls back to CPU aggregation when compute constraints are not satisfied.Overview
Adds WebGPU compute shader aggregation to
ScreenGridLayerthrough a newWebGPUScreenGridAggregator. This enables screen-space binning reductions (SUM,MEAN,MIN,MAX, andCOUNT) to execute entirely on the GPU when running on WebGPU devices.The compute path activates when
gpuAggregationis enabled, an explicitcolorDomainis provided, and bothpickableand layer extensions are disabled, automatically falling back to CPU aggregation otherwise. It supports standard accessor inputs as well as borrowedGPUVectorposition and weight columns, retaining bin IDs and output values in GPU buffers for direct consumption by cell rendering without CPU readback.In addition,
AggregationLayeris updated to allow GPU column inputs on the built-in WebGPU path without requiring a custom aggregator instance, accompanied by new WebGPU reduction tests and documentation.Reviewed by Cursor Bugbot for commit 84ba584. Bugbot is set up for automated code reviews on this repo. Configure here.