@simulatte/webgpu 0.2.1 → 0.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +104 -0
- package/README.md +135 -108
- package/{API_CONTRACT.md → api-contract.md} +63 -3
- package/assets/fawn-icon-main-256.png +0 -0
- package/assets/package-surface-cube-snapshot.svg +14 -14
- package/compat-scope.md +46 -0
- package/headless-webgpu-comparison.md +3 -3
- package/layering-plan.md +259 -0
- package/native/doe_napi.c +110 -17
- package/package.json +28 -8
- package/prebuilds/darwin-arm64/doe_napi.node +0 -0
- package/prebuilds/darwin-arm64/libwebgpu_doe.dylib +0 -0
- package/prebuilds/darwin-arm64/metadata.json +5 -5
- package/prebuilds/linux-x64/doe_napi.node +0 -0
- package/prebuilds/linux-x64/libwebgpu_dawn.so +0 -0
- package/prebuilds/linux-x64/libwebgpu_doe.so +0 -0
- package/prebuilds/linux-x64/metadata.json +26 -0
- package/scripts/generate-readme-assets.js +2 -2
- package/src/bun-ffi.js +3 -2
- package/src/bun.js +2 -2
- package/src/compute.d.ts +161 -0
- package/src/compute.js +277 -0
- package/src/doe.d.ts +84 -0
- package/src/doe.js +275 -0
- package/src/full.d.ts +112 -0
- package/src/full.js +10 -0
- package/src/index.js +114 -15
- package/src/node-runtime.js +2 -2
- package/src/node.js +2 -2
- package/src/runtime_cli.js +3 -1
- package/support-contracts.md +339 -0
- package/zig-source-inventory.md +468 -0
- package/COMPAT_SCOPE.md +0 -32
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to `@simulatte/webgpu` are documented in this file.
|
|
4
|
+
|
|
5
|
+
This changelog is package-facing and release-oriented. Early entries were
|
|
6
|
+
retrofitted from package version history and package-surface commits so the npm
|
|
7
|
+
package has a conventional release history alongside the broader Fawn status
|
|
8
|
+
and process documents.
|
|
9
|
+
|
|
10
|
+
## [0.2.4] - 2026-03-11
|
|
11
|
+
|
|
12
|
+
### Changed
|
|
13
|
+
|
|
14
|
+
- `doe.runCompute()` now infers binding access from Doe helper-created buffer
|
|
15
|
+
usage and fails fast when a bare binding lacks Doe usage metadata or uses a
|
|
16
|
+
non-bindable/ambiguous usage shape.
|
|
17
|
+
- Simplified the compute-surface README example to use inferred binding access
|
|
18
|
+
(`bindings: [input, output]`) and the device-bound `doe.bind(await
|
|
19
|
+
requestDevice())` flow directly.
|
|
20
|
+
- Clarified the install contract for non-prebuilt platforms: the `node-gyp`
|
|
21
|
+
fallback only builds the native addon and does not bundle `libwebgpu_doe`
|
|
22
|
+
plus the required Dawn sidecar.
|
|
23
|
+
- Aligned the published package docs and API contract with the current
|
|
24
|
+
`@simulatte/webgpu`, `@simulatte/webgpu/compute`, and `@simulatte/webgpu/full`
|
|
25
|
+
export surface.
|
|
26
|
+
|
|
27
|
+
## [0.2.3] - 2026-03-10
|
|
28
|
+
|
|
29
|
+
### Added
|
|
30
|
+
|
|
31
|
+
- macOS arm64 (Metal) prebuilds shipped alongside existing Linux x64 (Vulkan).
|
|
32
|
+
- "Verify your install" section with `npm run smoke` and `npm test` guidance.
|
|
33
|
+
- Added explicit package export surfaces for `@simulatte/webgpu` (default
|
|
34
|
+
full) and `@simulatte/webgpu/compute`, plus the first `doe` ergonomic
|
|
35
|
+
namespace for buffer/readback/compute helpers.
|
|
36
|
+
- Added `doe.bind(device)` so the ergonomic helper surface supports device-bound
|
|
37
|
+
workflows in addition to static helper calls.
|
|
38
|
+
|
|
39
|
+
### Changed
|
|
40
|
+
|
|
41
|
+
- Restructured the package README around the default full surface,
|
|
42
|
+
`@simulatte/webgpu/compute`, and the `doe` helper surface.
|
|
43
|
+
- `doe.runCompute()` now infers binding access from Doe helper-created buffer
|
|
44
|
+
usage and fails fast for bare bindings that do not carry Doe usage metadata.
|
|
45
|
+
- Fixed broken README image links to use bundled asset paths instead of dead
|
|
46
|
+
raw GitHub URLs.
|
|
47
|
+
- Root Fawn README now directs package users to the package README.
|
|
48
|
+
- Fixed 4 Metal benchmark workload contracts with asymmetric repeat accounting;
|
|
49
|
+
all 31 comparable workloads now have symmetric `leftCommandRepeat` /
|
|
50
|
+
`rightCommandRepeat`.
|
|
51
|
+
|
|
52
|
+
## [0.2.2] - 2026-03-10
|
|
53
|
+
|
|
54
|
+
### Added
|
|
55
|
+
|
|
56
|
+
- Added a Linux regression test guarding the drop-in loader against reopening
|
|
57
|
+
`libwebgpu_doe` as its own target WebGPU provider.
|
|
58
|
+
|
|
59
|
+
### Changed
|
|
60
|
+
|
|
61
|
+
- Fixed Linux drop-in proc resolution so workspace-local Node and Bun package
|
|
62
|
+
loads resolve Dawn/WebGPU target symbols instead of recursing through the Doe
|
|
63
|
+
drop-in library.
|
|
64
|
+
- Validated the package release surface on Linux Vulkan with addon build, smoke,
|
|
65
|
+
Node tests, prebuild assembly, and Bun contract tests.
|
|
66
|
+
|
|
67
|
+
## [0.2.1] - 2026-03-07
|
|
68
|
+
|
|
69
|
+
### Added
|
|
70
|
+
|
|
71
|
+
- Added package repository, homepage, and issue metadata.
|
|
72
|
+
- Added packaged README asset generation support and shipped package assets.
|
|
73
|
+
- Added additional package-surface contract documents and metadata schemas to
|
|
74
|
+
the published file set.
|
|
75
|
+
|
|
76
|
+
### Changed
|
|
77
|
+
|
|
78
|
+
- Refined the package surface around the canonical Doe-backed Node and Bun
|
|
79
|
+
entrypoints.
|
|
80
|
+
- Expanded package publishing inputs to include scripts, prebuilds, and package
|
|
81
|
+
documentation needed for reproducible installs.
|
|
82
|
+
|
|
83
|
+
## [0.2.0] - 2026-03-06
|
|
84
|
+
|
|
85
|
+
### Added
|
|
86
|
+
|
|
87
|
+
- Promoted the package to the public `@simulatte/webgpu` name.
|
|
88
|
+
- Added Node and Bun entrypoints, benchmark CLI wrappers, and a native addon
|
|
89
|
+
bridge for headless WebGPU execution.
|
|
90
|
+
- Added package install, build, test, smoke, and prebuild workflows.
|
|
91
|
+
|
|
92
|
+
### Changed
|
|
93
|
+
|
|
94
|
+
- Replaced the earlier placeholder package metadata with a real publishable
|
|
95
|
+
package surface for Doe-backed headless compute and benchmarking.
|
|
96
|
+
- Shifted the package from scaffold-only metadata to a documented package with
|
|
97
|
+
explicit published files and package-surface contracts.
|
|
98
|
+
|
|
99
|
+
## [0.0.1] - 2026-03-01
|
|
100
|
+
|
|
101
|
+
### Added
|
|
102
|
+
|
|
103
|
+
- Initial package scaffold for the Doe WebGPU package surface under
|
|
104
|
+
`nursery/webgpu`.
|
package/README.md
CHANGED
|
@@ -1,138 +1,165 @@
|
|
|
1
1
|
# @simulatte/webgpu
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
headless runtime integration.
|
|
3
|
+
Headless WebGPU for Node.js and Bun, powered by Doe.
|
|
5
4
|
|
|
6
5
|
<p align="center">
|
|
7
|
-
<img src="
|
|
6
|
+
<img src="assets/fawn-icon-main-256.png" alt="Fawn logo" width="196" />
|
|
8
7
|
</p>
|
|
9
8
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
allocator control, and keeping hot runtime paths minimal across
|
|
13
|
-
Vulkan/Metal/D3D12 backends. Optional `-Dlean-verified=true` builds use Lean 4
|
|
14
|
-
where proved invariants can be hoisted out of runtime branches instead of being
|
|
15
|
-
re-checked on every command; package consumers should not assume that path by
|
|
16
|
-
default.
|
|
17
|
-
|
|
18
|
-
Doe also keeps adapter and driver quirks explicit. Profile selection happens at
|
|
19
|
-
startup, quirk data is schema-backed, and the runtime binds the selected
|
|
20
|
-
profile instead of relying on hidden per-command fallback logic.
|
|
21
|
-
|
|
22
|
-
In this package, Node uses an N-API addon and Bun uses Bun FFI to load
|
|
23
|
-
`libwebgpu_doe`. Current package builds still ship a Dawn sidecar where proc
|
|
24
|
-
resolution requires it.
|
|
25
|
-
|
|
26
|
-
This directory is the package root for `@simulatte/webgpu`. It contains the
|
|
27
|
-
Node provider source, the addon build contract, the Bun FFI entrypoint, and
|
|
28
|
-
the CLI helpers used by benchmark and CI workflows.
|
|
29
|
-
|
|
30
|
-
## Surface maturity
|
|
31
|
-
|
|
32
|
-
- Node is the primary supported package surface (N-API bridge).
|
|
33
|
-
- Bun has API parity with Node via direct FFI to `libwebgpu_doe` (57/57
|
|
34
|
-
contract tests passing). Bun benchmark cube maturity remains prototype
|
|
35
|
-
until Bun cells are populated by comparable benchmark artifacts.
|
|
36
|
-
- Package-surface comparisons should be read through the benchmark cube outputs
|
|
37
|
-
under `bench/out/cube/`, not as a replacement for strict backend reports.
|
|
38
|
-
|
|
39
|
-
The **benchmark cube** is a cross-product matrix of surface (backend_native,
|
|
40
|
-
node_package, bun_package) × provider pair (e.g. doe_vs_dawn) × workload set
|
|
41
|
-
(e.g. compute_e2e, render, upload). Each intersection is a **cell** with its
|
|
42
|
-
own comparability and claimability status. Cube outputs live in
|
|
43
|
-
`bench/out/cube/` and include a dashboard, matrix summary, and per-row data.
|
|
9
|
+
Use this package for compute, CI, benchmarking, and offscreen GPU execution.
|
|
10
|
+
It is not a DOM/canvas package and it does not target browser-surface parity.
|
|
44
11
|
|
|
45
|
-
|
|
46
|
-
<img src="https://raw.githubusercontent.com/clocksmith/fawn/main/nursery/webgpu/assets/package-surface-cube-snapshot.svg" alt="Static package-surface benchmark cube snapshot" width="920" />
|
|
47
|
-
</p>
|
|
48
|
-
|
|
49
|
-
Static snapshot above:
|
|
50
|
-
|
|
51
|
-
- source: `bench/out/cube/latest/cube.summary.json`
|
|
52
|
-
- renderer: `npm run build:readme-assets`
|
|
53
|
-
- scope: package surfaces only; backend-native strict claim lanes remain separate
|
|
54
|
-
|
|
55
|
-
## Quickstart
|
|
12
|
+
## Install
|
|
56
13
|
|
|
57
14
|
```bash
|
|
58
15
|
npm install @simulatte/webgpu
|
|
59
16
|
```
|
|
60
17
|
|
|
18
|
+
The install ships platform-specific prebuilds for macOS arm64 (Metal) and
|
|
19
|
+
Linux x64 (Vulkan). If no prebuild matches your platform, the installer falls
|
|
20
|
+
back to building the native addon with `node-gyp` only; it does not build or
|
|
21
|
+
bundle `libwebgpu_doe` and the required Dawn sidecar for you. On unsupported
|
|
22
|
+
platforms, use a local Fawn workspace build for those runtime libraries.
|
|
23
|
+
|
|
24
|
+
## Choose a surface
|
|
25
|
+
|
|
26
|
+
| Import | Surface | Includes |
|
|
27
|
+
| --- | --- | --- |
|
|
28
|
+
| `@simulatte/webgpu` | Default full surface | Buffers, compute, textures, samplers, render, Doe helpers |
|
|
29
|
+
| `@simulatte/webgpu/compute` | Compute-first surface | Buffers, compute, copy/upload/readback, Doe helpers |
|
|
30
|
+
| `@simulatte/webgpu/full` | Explicit full surface | Same contract as the default package surface |
|
|
31
|
+
|
|
32
|
+
Use `@simulatte/webgpu/compute` when you want the constrained package contract
|
|
33
|
+
for AI workloads and other buffer/dispatch-heavy headless execution. The
|
|
34
|
+
compute surface intentionally omits render and sampler methods from the JS
|
|
35
|
+
facade.
|
|
36
|
+
|
|
37
|
+
## Quick examples
|
|
38
|
+
|
|
39
|
+
### Inspect the provider
|
|
40
|
+
|
|
61
41
|
```js
|
|
62
|
-
import { providerInfo
|
|
42
|
+
import { providerInfo } from "@simulatte/webgpu";
|
|
63
43
|
|
|
64
44
|
console.log(providerInfo());
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### Request a full device
|
|
48
|
+
|
|
49
|
+
```js
|
|
50
|
+
import { requestDevice } from "@simulatte/webgpu";
|
|
65
51
|
|
|
66
52
|
const device = await requestDevice();
|
|
67
53
|
console.log(device.limits.maxBufferSize);
|
|
68
54
|
```
|
|
69
55
|
|
|
70
|
-
|
|
71
|
-
listed below.
|
|
56
|
+
### Request a compute-only device
|
|
72
57
|
|
|
73
|
-
|
|
58
|
+
```js
|
|
59
|
+
import { requestDevice } from "@simulatte/webgpu/compute";
|
|
74
60
|
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
61
|
+
const device = await requestDevice();
|
|
62
|
+
console.log(typeof device.createComputePipeline); // "function"
|
|
63
|
+
console.log(typeof device.createRenderPipeline); // "undefined"
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
### Run a small compute job with `doe`
|
|
78
67
|
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
68
|
+
```js
|
|
69
|
+
import { doe, requestDevice } from "@simulatte/webgpu/compute";
|
|
70
|
+
|
|
71
|
+
const gpu = doe.bind(await requestDevice());
|
|
72
|
+
|
|
73
|
+
const input = gpu.createBufferFromData(new Float32Array([1, 2, 3, 4]));
|
|
74
|
+
|
|
75
|
+
const output = gpu.createBuffer({
|
|
76
|
+
size: input.size,
|
|
77
|
+
usage: "storage-readwrite",
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
await gpu.runCompute({
|
|
81
|
+
code: `
|
|
82
|
+
@group(0) @binding(0) var<storage, read> src: array<f32>;
|
|
83
|
+
@group(0) @binding(1) var<storage, read_write> dst: array<f32>;
|
|
84
|
+
|
|
85
|
+
@compute @workgroup_size(4)
|
|
86
|
+
fn main(@builtin(global_invocation_id) gid: vec3u) {
|
|
87
|
+
let i = gid.x;
|
|
88
|
+
dst[i] = src[i] * 2.0;
|
|
89
|
+
}
|
|
90
|
+
`,
|
|
91
|
+
bindings: [input, output],
|
|
92
|
+
workgroups: 1,
|
|
93
|
+
});
|
|
94
|
+
|
|
95
|
+
const result = await gpu.readBuffer(output, Float32Array);
|
|
96
|
+
console.log(Array.from(result)); // [2, 4, 6, 8]
|
|
82
97
|
```
|
|
83
98
|
|
|
84
|
-
|
|
85
|
-
|
|
99
|
+
`doe` is available from both `@simulatte/webgpu` and
|
|
100
|
+
`@simulatte/webgpu/compute`. It provides a small ergonomic layer for common
|
|
101
|
+
headless tasks: `doe.bind(device)` for device-bound workflows, plus static
|
|
102
|
+
buffer creation, readback, one-shot compute dispatch, and
|
|
103
|
+
reusable compiled compute kernels.
|
|
104
|
+
Binding access is inferred from Doe helper-created buffer usage when possible.
|
|
105
|
+
For raw WebGPU buffers or non-bindable/ambiguous usage, pass
|
|
106
|
+
`{ buffer, access }` explicitly.
|
|
107
|
+
|
|
108
|
+
## What this package is
|
|
109
|
+
|
|
110
|
+
`@simulatte/webgpu` is the canonical package surface for Doe. Node uses an
|
|
111
|
+
N-API addon and Bun currently routes through the same addon-backed runtime
|
|
112
|
+
entry to load `libwebgpu_doe`. Current builds still ship a Dawn sidecar where
|
|
113
|
+
proc resolution requires it.
|
|
114
|
+
|
|
115
|
+
Doe is a Zig-first WebGPU runtime with explicit profile and quirk binding, a
|
|
116
|
+
native WGSL pipeline (`lexer -> parser -> semantic analysis -> IR -> backend
|
|
117
|
+
emitters`), and explicit Vulkan/Metal/D3D12 execution paths in one system.
|
|
118
|
+
Optional `-Dlean-verified=true` builds use Lean 4 where proved invariants can
|
|
119
|
+
be hoisted out of runtime branches instead of being re-checked on every
|
|
120
|
+
command; package consumers should not assume that path by default.
|
|
121
|
+
|
|
122
|
+
## Current scope
|
|
123
|
+
|
|
124
|
+
- `@simulatte/webgpu` is the default full headless package surface.
|
|
125
|
+
- `@simulatte/webgpu/compute` is the compute-first subset for AI workloads.
|
|
126
|
+
- Node is the primary supported package surface.
|
|
127
|
+
- Bun currently shares the addon-backed runtime entry with Node.
|
|
128
|
+
- Package-surface comparisons should be read through the published repository
|
|
129
|
+
benchmark artifacts, not as a replacement for strict backend reports.
|
|
130
|
+
|
|
131
|
+
<p align="center">
|
|
132
|
+
<img src="assets/package-surface-cube-snapshot.svg" alt="Static package-surface benchmark cube snapshot" width="920" />
|
|
133
|
+
</p>
|
|
86
134
|
|
|
87
|
-
##
|
|
135
|
+
## Verify your install
|
|
88
136
|
|
|
89
137
|
```bash
|
|
90
|
-
npm run
|
|
138
|
+
npm run smoke
|
|
139
|
+
npm test
|
|
140
|
+
npm run test:bun
|
|
91
141
|
```
|
|
92
142
|
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
-
|
|
115
|
-
|
|
116
|
-
- Node provider comparisons are host-local package/runtime evidence measured
|
|
117
|
-
with package-level timers. They are useful surface-positioning data, not
|
|
118
|
-
backend claim substantiation or a broad "the package is faster" claim.
|
|
119
|
-
- `@simulatte/webgpu` does not yet have a single broad cross-surface speed
|
|
120
|
-
claim. Current performance evidence is split across Node package-surface
|
|
121
|
-
runs, prototype Bun package-surface runs, and workload-specific strict
|
|
122
|
-
backend reports.
|
|
123
|
-
- Linux Node Doe-native path is now wired end-to-end (Linux guard removed).
|
|
124
|
-
No `DOE_WEBGPU_LIB` env var needed when prebuilds or workspace artifacts
|
|
125
|
-
are present.
|
|
126
|
-
- Bun has API parity with Node (57/57 contract tests). Bun benchmark lane
|
|
127
|
-
is at `bench/bun/compare.js` and compares Doe FFI against the `bun-webgpu`
|
|
128
|
-
package. Latest validated local run observed 7/11 claimable rows, but this
|
|
129
|
-
remains prototype-quality package-surface evidence rather than a
|
|
130
|
-
publication-grade performance claim. Benchmark cube policy now isolates
|
|
131
|
-
directional `compute_dispatch_simple` into a dispatch-only cell so the Bun
|
|
132
|
-
compute-e2e cube cell reflects the claimable end-to-end rows.
|
|
133
|
-
`buffer_map_write_unmap` remains slower (~19µs polling overhead). Cube
|
|
134
|
-
maturity remains prototype until cell coverage stabilizes.
|
|
135
|
-
- Self-contained install ships prebuilt `doe_napi.node` + `libwebgpu_doe` +
|
|
136
|
-
Dawn sidecar per platform. Clean-machine smoke test: `npm run smoke`.
|
|
137
|
-
- API details live in `API_CONTRACT.md`.
|
|
138
|
-
- Compatibility scope is documented in `COMPAT_SCOPE.md`.
|
|
143
|
+
`npm run smoke` checks native library loading and a GPU round-trip. `npm test`
|
|
144
|
+
covers the Node package contract and a packed-tarball export/import check.
|
|
145
|
+
|
|
146
|
+
## Caveats
|
|
147
|
+
|
|
148
|
+
- This is a headless package, not a browser DOM/canvas package.
|
|
149
|
+
- `@simulatte/webgpu/compute` is intentionally narrower than the default full
|
|
150
|
+
surface.
|
|
151
|
+
- Bun currently shares the addon-backed runtime entry with Node. Package-surface
|
|
152
|
+
contract tests are green, and current comparable macOS package cells are
|
|
153
|
+
claimable. Any FFI-specific claims remain scoped to the experimental Bun FFI
|
|
154
|
+
path until separately revalidated.
|
|
155
|
+
- Package-surface benchmark rows are positioning data; backend-native claim
|
|
156
|
+
lanes remain the source of truth for strict Doe-vs-Dawn claims.
|
|
157
|
+
|
|
158
|
+
## Further reading
|
|
159
|
+
|
|
160
|
+
- [API contract](./api-contract.md)
|
|
161
|
+
- [Support contracts](./support-contracts.md)
|
|
162
|
+
- [Compatibility scope](./compat-scope.md)
|
|
163
|
+
- [Layering plan](./layering-plan.md)
|
|
164
|
+
- [Headless WebGPU comparison](./headless-webgpu-comparison.md)
|
|
165
|
+
- [Zig source inventory](./zig-source-inventory.md)
|
|
@@ -2,11 +2,45 @@
|
|
|
2
2
|
|
|
3
3
|
Contract version: `v1`
|
|
4
4
|
|
|
5
|
-
Scope:
|
|
5
|
+
Scope: current headless WebGPU package contract for Node.js and Bun, with a
|
|
6
|
+
default `full` surface, an explicit `compute` subpath, and Doe runtime helpers
|
|
7
|
+
used by benchmarking, CI, and artifact-backed comparison workflows.
|
|
6
8
|
|
|
7
|
-
|
|
9
|
+
For the current `compute` vs `full` support split, see
|
|
10
|
+
[`./support-contracts.md`](./support-contracts.md).
|
|
8
11
|
|
|
9
|
-
|
|
12
|
+
This contract covers package-surface GPU access, provider metadata, and helper
|
|
13
|
+
entrypoints. It does not promise DOM/canvas ownership or browser-process
|
|
14
|
+
parity.
|
|
15
|
+
|
|
16
|
+
## Export surfaces
|
|
17
|
+
|
|
18
|
+
### `@simulatte/webgpu`
|
|
19
|
+
|
|
20
|
+
Default package surface.
|
|
21
|
+
|
|
22
|
+
Contract:
|
|
23
|
+
|
|
24
|
+
- headless `full` surface
|
|
25
|
+
- includes compute plus render/sampler/surface APIs already exposed by the package runtime
|
|
26
|
+
- also exports the `doe` ergonomic namespace
|
|
27
|
+
|
|
28
|
+
### `@simulatte/webgpu/compute`
|
|
29
|
+
|
|
30
|
+
Compute-first package surface.
|
|
31
|
+
|
|
32
|
+
Contract:
|
|
33
|
+
|
|
34
|
+
- sized for AI workloads and other buffer/dispatch-heavy headless execution
|
|
35
|
+
- excludes render/sampler/surface methods from the public JS facade
|
|
36
|
+
- also exports the same `doe` ergonomic namespace
|
|
37
|
+
|
|
38
|
+
## Shared runtime API
|
|
39
|
+
|
|
40
|
+
Modules:
|
|
41
|
+
|
|
42
|
+
- `@simulatte/webgpu`
|
|
43
|
+
- `@simulatte/webgpu/compute`
|
|
10
44
|
|
|
11
45
|
### `create(createArgs?)`
|
|
12
46
|
|
|
@@ -63,6 +97,11 @@ Output:
|
|
|
63
97
|
|
|
64
98
|
- `Promise<GPUDevice>`
|
|
65
99
|
|
|
100
|
+
On `@simulatte/webgpu/compute`, the returned device is a compute-only facade:
|
|
101
|
+
|
|
102
|
+
- buffer / bind group / compute pipeline / command encoder / queue methods are available
|
|
103
|
+
- render / sampler / surface methods are intentionally absent from the facade
|
|
104
|
+
|
|
66
105
|
### `providerInfo()`
|
|
67
106
|
|
|
68
107
|
Output object:
|
|
@@ -85,6 +124,27 @@ Behavior:
|
|
|
85
124
|
metadata is available
|
|
86
125
|
- does not guess: if metadata is unavailable, `leanVerifiedBuild` is `null`
|
|
87
126
|
|
|
127
|
+
### `doe`
|
|
128
|
+
|
|
129
|
+
Output object:
|
|
130
|
+
|
|
131
|
+
- `bind(device)`
|
|
132
|
+
- `createBuffer(device, options)`
|
|
133
|
+
- `createBufferFromData(device, data, options?)`
|
|
134
|
+
- `readBuffer(device, buffer, TypedArray, options?)`
|
|
135
|
+
- `runCompute(device, options)`
|
|
136
|
+
- `compileCompute(device, options)`
|
|
137
|
+
|
|
138
|
+
Behavior:
|
|
139
|
+
|
|
140
|
+
- provides an ergonomic JS surface for common headless compute tasks
|
|
141
|
+
- supports both static helper calls and `doe.bind(device)` for device-bound workflows
|
|
142
|
+
- infers `runCompute(...).bindings` access from Doe helper-created buffer usage when that
|
|
143
|
+
usage maps to one bindable access mode (`uniform`, `storage-read`, `storage-readwrite`)
|
|
144
|
+
- fails fast for bare bindings that do not carry Doe helper usage metadata or whose
|
|
145
|
+
usage is non-bindable/ambiguous; callers must pass `{ buffer, access }` explicitly
|
|
146
|
+
- additive only; it does not replace the raw WebGPU-facing package API
|
|
147
|
+
|
|
88
148
|
### `createDoeRuntime(options?)`
|
|
89
149
|
|
|
90
150
|
Input:
|
|
Binary file
|
|
@@ -36,46 +36,46 @@
|
|
|
36
36
|
</defs>
|
|
37
37
|
<rect width="1200" height="640" fill="url(#bg)"/>
|
|
38
38
|
<text x="72" y="72" class="title">@simulatte/webgpu package snapshot</text>
|
|
39
|
-
<text x="72" y="102" class="subtitle">Derived from bench/out/cube/latest/cube.summary.json | latest populated cell 2026-03-
|
|
39
|
+
<text x="72" y="102" class="subtitle">Derived from bench/out/cube/latest/cube.summary.json | latest populated cell 2026-03-10T20:24:06.544Z</text>
|
|
40
40
|
<text x="72" y="128" class="subtitle">Package-surface evidence only. Backend-native strict claim lanes remain separate.</text>
|
|
41
41
|
|
|
42
42
|
<rect x="72" y="176" width="488" height="318" rx="24" class="panel toneLeft"/>
|
|
43
43
|
<text x="100" y="216" class="cardTitle">Node package lane</text>
|
|
44
44
|
<text x="100" y="244" class="cardMeta">Primary support | mac_apple_silicon</text>
|
|
45
|
-
<text x="100" y="266" class="cardMeta">latest populated cell 2026-03-
|
|
45
|
+
<text x="100" y="266" class="cardMeta">latest populated cell 2026-03-10T20:24:06.544Z</text>
|
|
46
46
|
|
|
47
47
|
<rect x="90" y="300" width="452" height="82" rx="16" class="metric toneLeft"/>
|
|
48
48
|
<text x="114" y="331" class="metricTitle">Uploads</text>
|
|
49
49
|
<rect x="386" y="315" width="132" height="28" rx="14" fill="#16a34a" stroke="#86efac" stroke-width="1.5"/>
|
|
50
50
|
<text x="452" y="334" text-anchor="middle" class="pillText">CLAIMABLE</text>
|
|
51
51
|
<text x="114" y="357" class="metricBody">5 rows | claimable</text>
|
|
52
|
-
<text x="114" y="377" class="metricBody">median p50 delta +
|
|
52
|
+
<text x="114" y="377" class="metricBody">median p50 delta +37.2%</text>
|
|
53
53
|
|
|
54
54
|
<rect x="90" y="396" width="452" height="82" rx="16" class="metric toneLeft"/>
|
|
55
55
|
<text x="114" y="427" class="metricTitle">Compute E2E</text>
|
|
56
|
-
<rect x="386" y="411" width="132" height="28" rx="14" fill="#
|
|
57
|
-
<text x="452" y="430" text-anchor="middle" class="pillText">
|
|
58
|
-
<text x="114" y="453" class="metricBody">3 rows |
|
|
59
|
-
<text x="114" y="473" class="metricBody">median p50 delta +
|
|
56
|
+
<rect x="386" y="411" width="132" height="28" rx="14" fill="#16a34a" stroke="#86efac" stroke-width="1.5"/>
|
|
57
|
+
<text x="452" y="430" text-anchor="middle" class="pillText">CLAIMABLE</text>
|
|
58
|
+
<text x="114" y="453" class="metricBody">3 rows | claimable</text>
|
|
59
|
+
<text x="114" y="473" class="metricBody">median p50 delta +48.1%</text>
|
|
60
60
|
|
|
61
61
|
<rect x="640" y="176" width="488" height="318" rx="24" class="panel toneRight"/>
|
|
62
62
|
<text x="668" y="216" class="cardTitle">Bun package lane</text>
|
|
63
|
-
<text x="668" y="244" class="cardMeta">
|
|
64
|
-
<text x="668" y="266" class="cardMeta">latest populated cell 2026-03-
|
|
63
|
+
<text x="668" y="244" class="cardMeta">Validated support | mac_apple_silicon</text>
|
|
64
|
+
<text x="668" y="266" class="cardMeta">latest populated cell 2026-03-10T19:50:22.523Z</text>
|
|
65
65
|
|
|
66
66
|
<rect x="658" y="300" width="452" height="82" rx="16" class="metric toneRight"/>
|
|
67
67
|
<text x="682" y="331" class="metricTitle">Compute E2E</text>
|
|
68
68
|
<rect x="954" y="315" width="132" height="28" rx="14" fill="#16a34a" stroke="#86efac" stroke-width="1.5"/>
|
|
69
69
|
<text x="1020" y="334" text-anchor="middle" class="pillText">CLAIMABLE</text>
|
|
70
70
|
<text x="682" y="357" class="metricBody">3 rows | claimable</text>
|
|
71
|
-
<text x="682" y="377" class="metricBody">median p50 delta +
|
|
71
|
+
<text x="682" y="377" class="metricBody">median p50 delta +53.1%</text>
|
|
72
72
|
|
|
73
73
|
<rect x="658" y="396" width="452" height="82" rx="16" class="metric toneRight"/>
|
|
74
74
|
<text x="682" y="427" class="metricTitle">Uploads</text>
|
|
75
|
-
<rect x="954" y="411" width="132" height="28" rx="14" fill="#
|
|
76
|
-
<text x="1020" y="430" text-anchor="middle" class="pillText">
|
|
77
|
-
<text x="682" y="453" class="metricBody">5 rows |
|
|
78
|
-
<text x="682" y="473" class="metricBody">median p50 delta +8
|
|
75
|
+
<rect x="954" y="411" width="132" height="28" rx="14" fill="#16a34a" stroke="#86efac" stroke-width="1.5"/>
|
|
76
|
+
<text x="1020" y="430" text-anchor="middle" class="pillText">CLAIMABLE</text>
|
|
77
|
+
<text x="682" y="453" class="metricBody">5 rows | claimable</text>
|
|
78
|
+
<text x="682" y="473" class="metricBody">median p50 delta +67.8%</text>
|
|
79
79
|
<text x="72" y="590" class="foot">Generated by nursery/webgpu/scripts/generate-readme-assets.js.</text>
|
|
80
80
|
<text x="72" y="612" class="foot">Static claim and comparability card from the package-surface cube. It is not a substitute for strict backend reports.</text>
|
|
81
81
|
</svg>
|
package/compat-scope.md
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
# Compatibility Scope: what we actually need
|
|
2
|
+
|
|
3
|
+
This note narrows compatibility work to concrete headless integration value for
|
|
4
|
+
the current package surface.
|
|
5
|
+
|
|
6
|
+
## Required now
|
|
7
|
+
|
|
8
|
+
1. Stable headless Node/Bun provider behavior for real Doe-native execution.
|
|
9
|
+
2. Stable command/trace orchestration for benchmark and CI pipelines.
|
|
10
|
+
3. Reliable wrappers for:
|
|
11
|
+
- Doe native bench runs
|
|
12
|
+
- Dawn-vs-Doe compare runs
|
|
13
|
+
4. Deterministic artifact paths and non-zero exit-code propagation.
|
|
14
|
+
5. Minimal convenience entrypoints for Node consumers:
|
|
15
|
+
- `create(args?)`
|
|
16
|
+
- `globals`
|
|
17
|
+
- `requestAdapter`/`requestDevice` convenience helpers
|
|
18
|
+
- `setupGlobals` for `navigator.gpu` + enum bootstrap
|
|
19
|
+
|
|
20
|
+
The point of this package is headless GPU work in Node/Bun: compute, offscreen
|
|
21
|
+
execution, benchmarking, and CI. Compatibility work should serve those
|
|
22
|
+
surfaces first.
|
|
23
|
+
|
|
24
|
+
## Optional later (only when demanded by integrations)
|
|
25
|
+
|
|
26
|
+
1. Minimal constants compatibility:
|
|
27
|
+
- only constants required by real integrations, not full WebGPU enum surface.
|
|
28
|
+
2. Provider-module swap support for non-default backends beyond `webgpu`.
|
|
29
|
+
|
|
30
|
+
## Not planned by default
|
|
31
|
+
|
|
32
|
+
1. Full `navigator.gpu` browser-parity behavior in Node.
|
|
33
|
+
2. Full object lifetime/event parity (`device lost`, full error scopes, full mapping semantics).
|
|
34
|
+
3. Broad drop-in support for arbitrary npm packages expecting complete `webgpu` behavior.
|
|
35
|
+
|
|
36
|
+
Decision rule:
|
|
37
|
+
|
|
38
|
+
- Add parity features only after a concrete headless integration is blocked by
|
|
39
|
+
a missing capability and cannot be addressed by the existing package,
|
|
40
|
+
bridge, or CLI contract.
|
|
41
|
+
|
|
42
|
+
Layering note:
|
|
43
|
+
|
|
44
|
+
- this file describes the current package surface and its present non-goals
|
|
45
|
+
- proposed future `core` vs `full` support contracts are defined separately in
|
|
46
|
+
[`./support-contracts.md`](./support-contracts.md)
|
|
@@ -7,7 +7,7 @@ This document outlines qualitative differences and target use-cases for headless
|
|
|
7
7
|
| **Underlying Engine** | `libwebgpu_doe` (Zig + Lean pipeline) | Google Dawn (C++) | Google Dawn (C++) |
|
|
8
8
|
| **Primary Focus** | Deterministic Compute, ML/AI, Verifiability | Browser Parity, Graphics | Browser Parity, Graphics |
|
|
9
9
|
| **Binary Footprint** | Smaller targeted runtime expected | Varies by build/distribution | Varies by build/distribution |
|
|
10
|
-
| **JS Binding Layer** | Node-API (N-API)
|
|
10
|
+
| **JS Binding Layer** | Node-API (N-API); experimental Bun FFI implementation also exists | Node-API (N-API) | Bun FFI (Fast Foreign Function) |
|
|
11
11
|
| **Security Model** | Explicit schema/gate discipline in Fawn pipeline | Runtime heuristics + Dawn validation | Runtime heuristics + Dawn validation |
|
|
12
12
|
| **Resource Allocation** | Arena-backed, predictable memory | General WebGPU async allocations | General WebGPU async allocations |
|
|
13
13
|
| **WebGPU Spec Compliance**| Compute-prioritized subset target | Broad Chromium-aligned coverage | Broad Chromium-aligned coverage |
|
|
@@ -17,7 +17,7 @@ This document outlines qualitative differences and target use-cases for headless
|
|
|
17
17
|
## Architectural Takeaways for Fawn
|
|
18
18
|
|
|
19
19
|
1. Determinism and fail-fast contracts are the intended Doe value proposition for benchmarking workflows.
|
|
20
|
-
2. Bun FFI
|
|
20
|
+
2. The package currently defaults Bun to the addon-backed runtime for correctness parity. The separate Bun FFI path may reduce wrapper overhead later, but end-to-end results must be measured per workload.
|
|
21
21
|
3. Distribution size and startup claims must be backed by measured artifacts before release claims.
|
|
22
22
|
|
|
23
23
|
## Ecosystem reference: official/community competitors and stats
|
|
@@ -38,6 +38,6 @@ Notes:
|
|
|
38
38
|
|
|
39
39
|
## Scaffolding the Fawn NPM Package
|
|
40
40
|
|
|
41
|
-
- Doe is exposed through a native C ABI and
|
|
41
|
+
- Doe is exposed through a native C ABI and also ships an experimental Bun FFI implementation, but the package-default Bun entry currently uses the addon-backed runtime for stability.
|
|
42
42
|
- Node N-API support now exists in the canonical `@simulatte/webgpu` package.
|
|
43
43
|
- Browser API parity is not claimed by this draft package; the current focus is headless benchmarking workflows.
|