Repository navigation
Conversation
They aren't part of the pipeline's soul, since logs are read back by the runtime that resolved the pipeline. Capturing a pipeline for another host needs them to describe where its console.log calls write.
… can read Splits serialization into capture() and emit(). capture() runs an arrow on the recording root and describes what it created as plain data: prune's tables, plus annotated schemas, layout and vertex layout names, immediates, fragment target keys and console.log descriptions, which only hosts other than the pruned runtime need. emit() turns that into the code precompile() calls are replaced with, generating codecs only for the schemas the runtime moves values of. Exported as @typegpu/prune/capture, for build tools of native hosts.
|
pkg.pr.new packages benchmark commit |
Bundle size comparison (
|
| 🟢 Decreased | ➖ Unchanged | 🔴 Increased | ❔ Unknown |
|---|---|---|---|
| 0 | 355 | 0 | 0 |
No notable changes.
If you wish to run a comparison for other, slower bundlers, run the 'Tree-shake test' from the GitHub Actions menu.
Resolution Time Benchmark---
config:
themeVariables:
xyChart:
plotColorPalette: "#E63946, #3B82F6, #059669"
---
xychart
title "Random Branching (🔴 PR | 🔵 main | 🟢 release)"
x-axis "max depth" [1, 2, 3, 4, 5, 6, 7, 8]
y-axis "time (ms)"
line [1.09, 2.33, 5.15, 8.54, 8.88, 15.43, 29.37, 30.90]
line [1.10, 2.28, 4.73, 8.27, 8.56, 12.94, 28.88, 32.00]
line [1.06, 2.20, 4.93, 7.58, 9.18, 12.80, 28.74, 25.48]
---
config:
themeVariables:
xyChart:
plotColorPalette: "#E63946, #3B82F6, #059669"
---
xychart
title "Linear Recursion (🔴 PR | 🔵 main | 🟢 release)"
x-axis "max depth" [1, 2, 3, 4, 5, 6, 7, 8]
y-axis "time (ms)"
line [0.32, 0.56, 0.76, 0.91, 1.31, 1.35, 1.58, 1.74]
line [0.31, 0.54, 0.73, 0.91, 1.25, 1.29, 1.50, 1.73]
line [0.31, 0.55, 0.79, 0.97, 1.34, 1.35, 1.62, 1.76]
---
config:
themeVariables:
xyChart:
plotColorPalette: "#E63946, #3B82F6, #059669"
---
xychart
title "Full Tree (🔴 PR | 🔵 main | 🟢 release)"
x-axis "max depth" [1, 2, 3, 4, 5, 6, 7, 8]
y-axis "time (ms)"
line [1.01, 2.67, 4.17, 8.28, 14.81, 29.99, 66.12, 130.20]
line [0.97, 2.33, 5.04, 8.88, 15.19, 29.82, 63.24, 130.57]
line [1.05, 2.90, 4.75, 8.24, 14.95, 29.36, 63.72, 126.07]
|
Contributor
Author
|
clanker |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stacked on #3303.
What
Splits prune's serializer in two, so that what it records can be read by hosts other than the pruned JS runtime:
capture(fn, options)runs the arrow on the recording root and returns anArtifact: plain JSON, prune's tables plus what only other hosts need.emit(artifact, { async })turns the artifact into the code aprecompile()call becomes.serializePrecompiledis nowcapturethenemit. The runtimeTablesand__tgpuPruneAttachare unchanged.@typegpu/prune/captureexports both, for build tools of native hosts.~internaladdition,getLogResources(pipeline). Log resources are not part of a pipeline's soul.There is no new public TypeGPU API.
Why
A native host, such as wgpu through typegpu-wgpu (a local experiment that generates typed Rust bindings from TypeGPU modules), needs what prune already records: what TypeGPU asks WebGPU for. Today it reconstructs that by other means:
resolveWithContext, an unreleaseddescribeRenderPipeline, and patchingLogGeneratorNullImplso that logs survive resolving without a root. Capturing through the recording root gives prune and native hosts one IR between TypeGPU and WebGPU.What the artifact adds to the tables
schemasserializeDataSchemaoutput with every node annotated withsize,align, structnameandoffsets(packed for unstructs), and arraystride.deserializeDataSchemaignores the annotations. Runtime-sized arrays havecount: 0. Codecs are generated from these inemit, and only for the schemas the runtime uses.name, theschemasof buffer entries, and the$idxindexname, elementschemaimmediate(name and schema),logs(group, bindings, capacity, and calls with op and arg schemas). Render pipelines also gettargetKeys, the fragment output of each target.surfaceCapture options:
features,wgslLanguageFeatures(forimmediate_address_space),stripLogs(defaulttrue),minify(defaulttrue) andnames.emitstill rejects pipelines that use immediates, as before.Validation
emit, which builds codecs from deserialized schemas.capturelocally. Every manifest field is read from artifacts, and live objects are only used to find exports and build pipelines on the recording root. Results:seed[0i]becameseed.xin@typegpu/noise).cargo test --workspacepass. That includes interop tests running the pipelines on a wgpu device, with logs, function calls,config/enableExtensionsvariants and hot reload.feat/pipeline-descriptor(unrolling comptime-known iterables, and genericstd.mix). Those fixes are not part of this PR.Notes
root.with,enableExtensionsas device features) are per pipeline. It merges the artifacts by structural identity.indexmakes possible.