Skip to content

feat(aggregation-layers): accept custom aggregator instances and GPUVectors - #11044

Merged
ibgreen merged 11 commits into
masterfrom
codex/aggregation-vector-prep
Nov 6, 2026
Merged

ibgreen merged 11 commits into
masterfrom
codex/aggregation-vector-prep

Conversation

@ibgreen

@ibgreen ibgreen commented Nov 5, 2026 •

Copy link
Copy Markdown
Collaborator

Expose an aggregator interface on GridLayer, HexagonLayer, ScreenGridLayer, and ContourLayer. Applications can supply aggregator: new CustomAggregator(); omitting the prop creates the existing default.

Changes:

  • Adopt supplied instances with optional initialize(device) and layer-owned replacement/finalization. Extension changes retain the custom instance.
  • Accept borrowed position/weight GPUVectors and explicit bounds for world-space binning.
  • Accept GPUVector results directly through AttributeManager/GPUVectorModel, preserving vector identity, offsets, and strides without copying or readback.
  • Register custom contour callbacks, update input prefix counts, and keep cell draw counts independent of input counts.
  • Document ownership, result formats, and supported CPU-facing operations.

Validation:

  • Aggregation and attribute suites: 162 passed, 2 existing skips, including an explicit WebGPU-device rendering test.
  • Commit-hook node tests: 49 passed.
  • yarn lint, scoped source TypeScript check, and git diff --check passed.
  • Full build, render-golden, and website checks were not run. The repository-wide TypeScript invocation reports unrelated example/dependency errors.

Note

Medium Risk
Modifies core attribute ingestion and aggregation layer lifecycle to handle GPU-backed vector data, but retains fallback defaults and backwards compatibility for existing aggregation pipelines.

Overview
Adds support for custom Aggregator instances across GridLayer, HexagonLayer, ScreenGridLayer, and ContourLayer, allowing callers to supply specialized aggregation pipelines or reuse existing layer setups. Custom aggregators follow layer-owned lifecycles with an optional initialize(device) hook and are preserved across layer extension updates.

Layers and Attribute.setBinaryValue now accept borrowed luma GPUVector inputs for positions and weights along with an explicit dataBounds prop, bypassing accessor generation and CPU preprojection. In addition, getBins() and getResult() can return GPUVector objects directly, which cell sublayers consume without CPU copy or buffer readbacks while preserving vector identity, offsets, and strides.

Reviewed by Cursor Bugbot for commit d4f5714. Bugbot is set up for automated code reviews on this repo. Configure here.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ⚠️ Failed 2026-11-05T01:37:00.467200Z
We couldn’t complete this review. Comment @codex review to try again.
ee0e747 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector

Copy link
Copy Markdown

You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard.
To continue using code reviews, add credits to your account and enable them for code reviews in your settings.

@greptile-apps

greptile-apps Bot commented Nov 5, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 5/5

[High impact] The PR appears safe to merge; no new actionable issues were found.

Summary

Adds custom aggregator instances and borrowed GPUVector inputs and results across four aggregation layers.

  • Aggregation layers can use a caller-supplied aggregator instance.
  • Aggregation layers can bin caller-supplied GPU columns.
  • GPUVector aggregation results feed cell layers without copying.
  • ContourLayer can build contours from CPU-readable custom results.

All four supplied prior findings are addressed in the current code. Their threads have no supplied comment numbers, so previousFindings is empty.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart LR
  A[Accessor data] --> B[Position attributes]
  C[Borrowed GPU columns] --> D[Custom aggregator]
  B --> E[Default or custom aggregator]
  D --> F[Bin and channel results]
  E --> F
  F --> G[Cell layers or CPU contours]
Loading

Reviews (12) · Last reviewed commit: "Preserve source projection settings for ..." · Reviewed by Greptile

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale Bugbot comment from a previous run.

@coveralls

coveralls commented Nov 5, 2026 •

Copy link
Copy Markdown

Coverage Status

coverage: 84.975% (-0.03%) from 85.008% — codex/aggregation-vector-prep into master

@ibgreen ibgreen changed the title feat(aggregation-layers): prepare pluggable GPUVector aggregators feat(aggregation-layers): accept custom aggregator instances and GPUVectors Nov 5, 2026

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using default effort and found 2 potential issues.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit a9bdaed. Configure here.

@ibgreen
ibgreen merged commit 2032933 into master Nov 6, 2026
9 checks passed
@ibgreen
ibgreen deleted the codex/aggregation-vector-prep branch November 6, 2026 20:32

@chrisgervang chrisgervang left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Reviewed d4f5714 after merge; follow-ups below.

No P1s. The new layer props have no entries on the layer pages, and GPUVector data.attributes inputs are documented only on the internal Attribute page.

Labels: P1 settle before this is merged, P2 can follow, Non-blocking optional.

Comment on lines +172 to +174
`ScreenGridLayer`, `GridLayer`, `HexagonLayer`, and `ContourLayer` accept an optional
`aggregator` instance. When omitted, the layer creates its default aggregator using the
existing layer settings.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: aggregator, positions, weights and dataBounds have no prop entries on the Grid, Hexagon, Contour or ScreenGrid pages. The Grid page's compute example on master uses positions, weights and dataBounds, but readers can't look them up there. Could each page get entries like ### GPU column inputs on heatmap-layer.md, linking here for details?

Details

Proposed entries for grid-layer.md:

### Custom aggregation

#### `aggregator` (Aggregator, optional) {#aggregator}

* Default: `null`

A custom [Aggregator](./aggregator.md) that replaces the built-in CPU or GPU aggregation. The layer destroys it when the prop changes or the layer is removed. See [Supplying an aggregator to a layer](./aggregator.md#supplying-an-aggregator-to-a-layer).

#### `positions` (GPUVector, optional) {#positions}

* Default: `null`

Positions already on the GPU, used instead of `getPosition`. Requires `weights` and `dataBounds`. See [GPU column inputs](./aggregator.md#gpu-column-inputs).

#### `weights` (GPUVector[], optional) {#weights}

* Default: `null`

Two weight columns, color then elevation, used instead of `getColorWeight` and `getElevationWeight`. Each has the same length as `positions`.

#### `dataBounds` ([number[], number[]], optional) {#databounds}

* Default: `null`

`[min, max]` of `positions`, in input coordinates. Required with `positions`, because the layer cannot read GPU positions to compute bounds.

ScreenGridLayer and ContourLayer take one weight column, and ScreenGridLayer does not need dataBounds. The positions TSDoc (aggregation-layer.ts:30) still says it requires a custom aggregator, but the Grid, Hexagon and ScreenGrid compute paths on master accept it without one.

Comment on lines +77 to +84
### GPUVector inputs

Accessor entries in `data.attributes` can contain borrowed luma `GPUVector` objects.
The attribute preserves the vector's identity, buffer offset, and stride, so supplying the
same vector again does not rebind unchanged storage. Supply a new vector when its layout changes.
Vectors must provide a format and one fixed-width chunk backed by a concrete buffer, with
at least as many rows as the draw count. Float16 and variable-length formats are unsupported.
The caller owns the vector and its buffer. Attributes requiring CPU transforms need CPU data.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2: Any layer's data.attributes can now take a GPUVector, but only this page, titled Internal, says so. The format list at layer.md#dataattributes doesn't mention it. Could it get a bullet there, with this section linking to it? For example:

  • A luma.gl GPUVector with one fixed-width chunk and at least as many rows as the layer draws. The layer borrows it without copying. Pass a new vector when its layout changes. Float16 formats are not supported, and attributes the layer transforms on the CPU still need CPU data.


[modules/aggregation-layers/src/common/aggregator/aggregator.ts](https://github.com/visgl/deck.gl/tree/master/modules/aggregation-layers/src/common/aggregator/aggregator.ts)

## Supplying an aggregator to a layer

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Non-blocking: These sections start after ## Source, so the page looks finished before they appear. Could they move above ## Source?

Comment on lines +227 to +232
`getBins()` and `getResult(channel)` may return either the existing `BinaryAttribute` or a
borrowed `GPUVector`. Cell rendering uses the same AttributeManager/`GPUVectorModel` path as
accessor-backed layers, including ArcLayer. The vector adapter preserves offsets and strides
without uploading, copying, or reading the buffer. Results require one concrete
buffer chunk: `float32x2` bin IDs and `float32` channel values. Result vectors and
buffers remain owned by the aggregator, and must stay valid through sublayer drawing.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Non-blocking: AttributeManager, GPUVectorModel, ArcLayer and the vector adapter are internals. Could this keep only the requirements? The getBins and getResult entries above also still list only a binary attribute as the return value.

Suggested change
`getBins()` and `getResult(channel)` may return either the existing `BinaryAttribute` or a
borrowed `GPUVector`. Cell rendering uses the same AttributeManager/`GPUVectorModel` path as
accessor-backed layers, including ArcLayer. The vector adapter preserves offsets and strides
without uploading, copying, or reading the buffer. Results require one concrete
buffer chunk: `float32x2` bin IDs and `float32` channel values. Result vectors and
buffers remain owned by the aggregator, and must stay valid through sublayer drawing.
`getBins()` and `getResult(channel)` may return a `BinaryAttribute` or a borrowed `GPUVector`.
Layers draw a `GPUVector` without copying or reading it. It must have one buffer chunk, with
`float32x2` bin IDs and `float32` channel values. The aggregator owns the vectors and their
buffers, and must keep them valid until the sublayers have drawn.

Comment thread docs/whats-new.md

## Unreleased

### Custom aggregators and GPUVector inputs

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Non-blocking: Unreleased now has six aggregation entries in a row (Hexagon, ScreenGrid and Grid features, Heatmap columns, Grid, ScreenGrid, custom aggregators). Could they become one section with a linked bullet per feature? For example:

Aggregation layers

  • ScreenGridLayer, GridLayer and HexagonLayer aggregate in WebGPU compute shaders with gpuAggregation: true. See Compute aggregation.
  • aggregator on GridLayer, HexagonLayer, ScreenGridLayer and ContourLayer takes a custom aggregator instance.
  • positions and weights pass GPU columns to these layers and to HeatmapLayer without copying them to the CPU.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants