You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Declared update routes for layer props: when a prop change should be a uniform write, not an attribute rebuild
#10757
I'm building a binary-native pipeline on top of deck.gl (duckdb-deck-demo, a draft Noodles.gl v2). Attributes are computed on the GPU and handed to layers as app-owned luma Buffers through data.attributes. That connection works today (FINDINGS §5). Several recent PRs of mine came out of making it work on WebGPU.
What's left is how interaction costs. We measured 30 consecutive changes to a slider-bound parameter at 1M rows (FINDINGS §3):
route
per change
GPU uniform write + kernel re-dispatch
~2 ms at 1M rows, 16 bytes uploaded
deck accessor re-evaluation (updateTriggers)
56 ms at 1M, 200 ms at 5M, full attribute re-upload
The gap isn't WebGL vs WebGPU. It's who owns the buffer and whether the change is declared cheap.
What deck already does
deck already has this idea, but hard-coded per prop. radiusScale, opacity, widthScale and friends are uniforms, so dragging them is free. Anything that feeds an accessor goes through updateTriggers, which rebuilds the attribute from CPU data. Which props get the cheap path is decided when the layer is written, not by the app. An app that computes its own attributes can't say "this prop is a uniform for me; don't rebuild".
The idea: a typed invalidation route per prop
Our runtime classifies every parameter by the cheapest thing its change invalidates (Runtime.classify):
route
invalidates
rebuild
the plan: new shaders and pipelines
requery
the data: re-run the query, re-upload
cpu
a CPU pass plus upload
uniform
nothing but a uniform
compact
a GPU compaction pass; attributes untouched
The planner prices each route by the parameter's change rate, and that is what decides where the work runs.
For deck, the smallest useful version would be:
Make the existing route explicit. Prop types already have metadata ({type: 'number', min: 0, value: 1}), and an update: 'uniform' | 'attribute' | 'model' field would state what deck already does implicitly. There's no behaviour change, but the route becomes visible to tools, debug output and docs.
Let external attributes opt out of rebuilds. For an attribute supplied as an app-owned Buffer, updateTriggers can't do anything useful, since deck can't recompute a buffer it didn't produce. Today a trigger change on such an attribute is either wasted work or a silent no-op, depending on the path. A warning, or a documented "external attributes ignore triggers", would make the contract explicit.
Later, and only if (1)–(2) land: a way for a layer extension (or the app) to declare custom uniforms that a shader-module reads, so a prop like threshold on a DataFilterExtension-style filter is a uniform write rather than a filter-attribute rebuild. filterRange already works this way. It's the precedent.
Related: drawing a GPU-filtered subset
The measurement that motivated this (FINDINGS §12) is that a GPU discard mask, which is what DataFilterExtension does too, costs 5.3 ms/frame at 4M rows keeping 5%. Drawing only the survivors, with compacted ids and a GPU-resident count via drawIndirect, costs 0.30 ms. Drawing with a GPU-resident instance count needs a Model change in luma first. Model.draw only calls renderPass.draw with a CPU count, although WebGPU RenderPass.drawIndirect exists. I'll follow up with an RFC covering both sides.
Questions
Is there appetite for making prop update routes explicit metadata, or is the implicit uniform/attribute split considered an implementation detail?
For app-owned Buffer attributes, what should updateTriggers mean? Should it be an error, a no-op, or a re-bind of whatever the prop now holds?
Does the RenderBundles work ([RFC] Use RenderBundles on WebGPU #10440) change this? A uniform-only change keeps a bundle valid, while an attribute rebuild doesn't, so an explicit route seems useful there too.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Context
I'm building a binary-native pipeline on top of deck.gl (duckdb-deck-demo, a draft Noodles.gl v2). Attributes are computed on the GPU and handed to layers as app-owned luma
Buffers throughdata.attributes. That connection works today (FINDINGS §5). Several recent PRs of mine came out of making it work on WebGPU.What's left is how interaction costs. We measured 30 consecutive changes to a slider-bound parameter at 1M rows (FINDINGS §3):
updateTriggers)The gap isn't WebGL vs WebGPU. It's who owns the buffer and whether the change is declared cheap.
What deck already does
deck already has this idea, but hard-coded per prop.
radiusScale,opacity,widthScaleand friends are uniforms, so dragging them is free. Anything that feeds an accessor goes throughupdateTriggers, which rebuilds the attribute from CPU data. Which props get the cheap path is decided when the layer is written, not by the app. An app that computes its own attributes can't say "this prop is a uniform for me; don't rebuild".The idea: a typed invalidation route per prop
Our runtime classifies every parameter by the cheapest thing its change invalidates (
Runtime.classify):rebuildrequerycpuuniformcompactThe planner prices each route by the parameter's change rate, and that is what decides where the work runs.
For deck, the smallest useful version would be:
{type: 'number', min: 0, value: 1}), and anupdate: 'uniform' | 'attribute' | 'model'field would state what deck already does implicitly. There's no behaviour change, but the route becomes visible to tools, debug output and docs.Buffer,updateTriggerscan't do anything useful, since deck can't recompute a buffer it didn't produce. Today a trigger change on such an attribute is either wasted work or a silent no-op, depending on the path. A warning, or a documented "external attributes ignore triggers", would make the contract explicit.thresholdon aDataFilterExtension-style filter is a uniform write rather than a filter-attribute rebuild.filterRangealready works this way. It's the precedent.Related: drawing a GPU-filtered subset
The measurement that motivated this (FINDINGS §12) is that a GPU discard mask, which is what
DataFilterExtensiondoes too, costs 5.3 ms/frame at 4M rows keeping 5%. Drawing only the survivors, with compacted ids and a GPU-resident count viadrawIndirect, costs 0.30 ms. Drawing with a GPU-resident instance count needs aModelchange in luma first.Model.drawonly callsrenderPass.drawwith a CPU count, although WebGPURenderPass.drawIndirectexists. I'll follow up with an RFC covering both sides.Questions
Bufferattributes, what shouldupdateTriggersmean? Should it be an error, a no-op, or a re-bind of whatever the prop now holds?All reactions