Skip to content

ContourLayer: aggregate on WebGPU before CPU contour generation - #11079

Merged
ibgreen merged 26 commits into
masterfrom
codex/contour-webgpu-compute
Nov 17, 2026
Merged

ibgreen merged 26 commits into
masterfrom
codex/contour-webgpu-compute

Conversation

@ibgreen

@ibgreen ibgreen commented Nov 9, 2026 •

Copy link
Copy Markdown
Collaborator

For #10712.

Background

ContourLayer renders on WebGPU but aggregates on the CPU. Use compute reduction and asynchronous value copies for existing CPU contour generation. Keep completed contours and their transforms visible until replacement results arrive.

Change List

  • Add single-channel Contour compute reduction
  • Read completed values for isolines and isobands
  • Retain completed contours during updates and retry failed readbacks
  • Preserve format and device-limit CPU fallbacks
  • Support borrowed columns and row-prefix updates
  • Unit tests
  • Documentation

Verified 19 contour tests, scoped typechecking, lint, and 119 node tests. Extensions retain CPU aggregation. Parity tests isolate computation because polygon/path resource-count checks also fail on the existing CPU path.


Note

Medium Risk
Adds WebGPU compute shader pipelines and GPU buffer copy retention logic across aggregation layers, though risks are mitigated by automatic CPU fallbacks.

Overview
Enables WebGPU compute aggregation for ContourLayer when gpuAggregation is enabled, performing point reduction in a compute shader before generating isolines and isobands on the CPU.

Completed contours and their transforms are now retained during updates, keeping previous geometry visible until asynchronous aggregate readbacks arrive. The layer automatically falls back to CPU aggregation when layer extensions are present or when inputs exceed device buffer limits.

Additionally updates base AggregationLayer to copy and retain GPU-only cell buffers during transitions to automatic domains or CPU distribution scales, preventing in-flight updates from corrupting displayed cells.

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

Review follow-up: integrates merged Hexagon and graph ScreenGrid changes. Also preserves GPU-only Grid/Hexagon cells when an update enables automatic domains or CPU distribution scales, copying GPU outputs only for that transition and releasing the copies when replacement metadata is ready.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

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

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-09T19:56:05.098195Z 4083eaa 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.

@greptile-apps

greptile-apps Bot commented Nov 9, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge based on this follow-up review.

Summary

This PR adds WebGPU aggregation to ContourLayer while keeping contour generation on the CPU.

  • ContourLayer computes bins on WebGPU before building contours.
  • Completed contours keep their transform while replacement results load.
  • Grid and hexagon cells keep their GPU data while CPU values are pending.

The follow-up adds the requested TSDoc to the test helper. All supplied previous documentation findings are addressed. No new issues found.

Reviews (9) · Last reviewed commit: "Document the Contour computation test he..." · 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.

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

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 6e3ab66. Configure here.

@coveralls

coveralls commented Nov 9, 2026 •

Copy link
Copy Markdown

Coverage Status

coverage: 82.553% (-0.2%) from 82.727% — codex/contour-webgpu-compute into master

Comment thread docs/whats-new.md Resolved
@chrisgervang

Copy link
Copy Markdown
Collaborator

Reviewed 2ced2cc; comments only at this point. One P1: on WebGPU, ContourLayer now draws nothing for 1 to 4+ frames after each change.

On swiftshader WebGPU, empty bins read NaN on both paths. Contour line and band counts match the WebGL GPU path for SUM, MEAN, MIN and MAX on the SF bike-parking points.

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

@ibgreen
ibgreen requested a review from chrisgervang November 10, 2026 11:20

@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 ad74807; recommend approval. The P1 and both docs items are addressed.

On swiftshader WebGPU with cellSize 200, 800, 100, the previous contours stay until the new ones arrive, so no frame is empty after the first load. Contour counts are unchanged from 2ced2cc.

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

@ibgreen
ibgreen merged commit 5cdf294 into master Nov 17, 2026
9 checks passed
@ibgreen
ibgreen deleted the codex/contour-webgpu-compute branch November 17, 2026 23:46
@ibgreen ibgreen mentioned this pull request Nov 17, 2026
14 of 70 tasks
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.

3 participants