@simulatte/webgpu-doe 0.1.2 → 0.1.3

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/README.md CHANGED
@@ -1,173 +1,17 @@
1
1
  # @simulatte/webgpu-doe
2
2
 
3
- Headless WebGPU for Node.js on the Doe runtime.
3
+ This package is deprecated.
4
4
 
5
- **[Fawn](https://github.com/clocksmith/fawn/tree/main/nursery/webgpu-doe)** · **[npm](https://www.npmjs.com/package/@simulatte/webgpu-doe)** · **[simulatte.world](https://simulatte.world)**
5
+ Use [`@simulatte/webgpu`](https://www.npmjs.com/package/@simulatte/webgpu) instead.
6
6
 
7
- ## Install
7
+ - Replacement package: [`@simulatte/webgpu`](https://www.npmjs.com/package/@simulatte/webgpu)
8
+ - Package page: [`@simulatte/webgpu` on npm](https://www.npmjs.com/package/@simulatte/webgpu)
8
9
 
9
- ```sh
10
- npm install @simulatte/webgpu-doe
11
- ```
12
-
13
- The published package currently targets `darwin-arm64`. The N-API addon builds
14
- from C source during install via `node-gyp`, so a local C toolchain is
15
- required (`xcode-select --install` on macOS).
16
-
17
- ## Quick start
18
-
19
- ```js
20
- import { create, globals } from '@simulatte/webgpu-doe';
21
-
22
- const gpu = create();
23
- const adapter = await gpu.requestAdapter();
24
- const device = await adapter.requestDevice();
25
-
26
- console.log(device.limits.maxComputeWorkgroupSizeX); // 1024
27
- console.log(device.features.has('shader-f16')); // true
10
+ ## Migration
28
11
 
29
- // Standard WebGPU compute workflow
30
- const buffer = device.createBuffer({
31
- size: 64,
32
- usage: globals.GPUBufferUsage.STORAGE | globals.GPUBufferUsage.COPY_SRC,
33
- });
34
-
35
- const shader = device.createShaderModule({
36
- code: `
37
- @group(0) @binding(0) var<storage, read_write> data: array<f32>;
38
- @compute @workgroup_size(64)
39
- fn main(@builtin(global_invocation_id) id: vec3u) {
40
- data[id.x] = data[id.x] * 2.0;
41
- }
42
- `,
43
- });
44
-
45
- // ... create pipeline, bind group, encode, dispatch, readback
12
+ ```bash
13
+ npm uninstall @simulatte/webgpu-doe
14
+ npm install @simulatte/webgpu
46
15
  ```
47
16
 
48
- The package loads `libdoe_webgpu` and exposes a WebGPU-shaped API for
49
- headless compute and basic render work. See [more examples](#more-examples)
50
- below for `navigator.gpu` setup and provider inspection.
51
-
52
- ## Why Doe
53
-
54
- - Native path: JavaScript calls into an N-API addon, which loads
55
- `libdoe_webgpu` and submits work through Doe's Metal backend.
56
- - Runtime ownership: WGSL is compiled to MSL inside Doe's AST-based compiler
57
- instead of going through Dawn.
58
- - Small package payload: the shared library is about 2 MB on `darwin-arm64`.
59
- - WebGPU-shaped surface: `requestAdapter`, `requestDevice`, buffer mapping,
60
- bind groups, compute pipelines, command encoders, and basic render passes are
61
- exposed directly from the package.
62
-
63
- ## Status
64
-
65
- Current package target:
66
- - macOS arm64: prebuilt library and tested package path
67
-
68
- Backend readiness:
69
-
70
- | Backend | Compute | Render | WGSL compiler | Status |
71
- |---------|---------|--------|---------------|--------|
72
- | **Metal** (macOS) | Production | Basic (no vertex/index) | WGSL -> MSL (AST-based) | Ready for package use |
73
- | **Vulkan** (Linux) | WIP | Not started | WGSL -> SPIR-V needed | Experimental |
74
- | **D3D12** (Windows) | WIP | Not started | WGSL -> HLSL/DXIL needed | Experimental |
75
-
76
- Metal currently covers the package's intended use: bind groups 0-3, buffer
77
- map/unmap, indirect dispatch, `shader-f16`, subgroups, override constants,
78
- workgroup shared memory, multiple entry points, textures, samplers, and basic
79
- render-pass execution.
80
-
81
- Vulkan and D3D12 already have native runtime paths for instance creation,
82
- compute dispatch, and buffer upload, but they still need shader translation,
83
- bind group management, buffer map/unmap, textures, and render pipelines.
84
-
85
- Performance snapshot from the Fawn Dawn-vs-Doe harness on Apple Silicon with
86
- strict comparability checks:
87
-
88
- - Compute e2e: 1.5x faster (0.23ms vs 0.35ms, 4096 threads)
89
- - Buffer upload: faster across 1 KB to 4 GB (8 sizes claimable)
90
- - Atomics: workgroup atomic and non-atomic both claimable
91
- - Matrix-vector multiply: 3 variants claimable
92
- - Concurrent execution: claimable
93
- - Zero-init workgroup memory: claimable
94
- - Draw throughput: 200k draws claimable
95
- - Binary size: about 2 MB vs Dawn's about 11 MB
96
-
97
- 19 of 30 workloads are currently claimable. The remaining 11 are limited by
98
- per-command Metal command buffer creation overhead (~350us vs Dawn's ~30us).
99
- See `fawn/bench/` and [`status.md`](../../status.md) for methodology and the
100
- broader backend matrix.
101
-
102
- ## API surface
103
-
104
- Compute:
105
-
106
- - `create()` / `setupGlobals()` / `requestAdapter()` / `requestDevice()`
107
- - `device.createBuffer()` / `device.createShaderModule()` (WGSL)
108
- - `device.createComputePipeline()` / `device.createComputePipelineAsync()`
109
- - `device.createBindGroupLayout()` / `device.createBindGroup()`
110
- - `device.createPipelineLayout()` / `pipeline.getBindGroupLayout()`
111
- - `device.createCommandEncoder()` / `encoder.beginComputePass()`
112
- - `pass.setPipeline()` / `pass.setBindGroup()` / `pass.dispatchWorkgroups()`
113
- - `pass.dispatchWorkgroupsIndirect()`
114
- - `encoder.copyBufferToBuffer()` / `queue.submit()` / `queue.writeBuffer()`
115
- - `buffer.mapAsync()` / `buffer.getMappedRange()` / `buffer.unmap()`
116
- - `queue.onSubmittedWorkDone()`
117
-
118
- Render:
119
-
120
- - `device.createTexture()` / `texture.createView()` / `device.createSampler()`
121
- - `device.createRenderPipeline()` / `encoder.beginRenderPass()`
122
- - `renderPass.setPipeline()` / `renderPass.draw()` / `renderPass.end()`
123
-
124
- Device capabilities:
125
-
126
- - `device.limits` / `adapter.limits`
127
- - `device.features` / `adapter.features` with `shader-f16`
128
-
129
- Current gaps:
130
- - Canvas and surface presentation
131
- - Vertex and index buffer binding in render passes
132
- - Full render pipeline descriptor parsing
133
-
134
- ## More examples
135
-
136
- ```js
137
- import { setupGlobals } from '@simulatte/webgpu-doe';
138
-
139
- setupGlobals(globalThis);
140
- const adapter = await navigator.gpu.requestAdapter();
141
- ```
142
-
143
- ### Provider info
144
-
145
- ```js
146
- import { providerInfo } from '@simulatte/webgpu-doe';
147
- console.log(providerInfo());
148
- // { module: '@simulatte/webgpu-doe', loaded: true, doeNative: true, ... }
149
- ```
150
-
151
- ## Configuration
152
-
153
- The library search order:
154
-
155
- 1. `DOE_WEBGPU_LIB` environment variable (full path)
156
- 2. `<package>/prebuilds/<platform>-<arch>/libdoe_webgpu.{ext}`
157
- 3. `<workspace>/zig/zig-out/lib/libdoe_webgpu.{ext}` (monorepo layout)
158
- 4. `<cwd>/zig/zig-out/lib/libdoe_webgpu.{ext}`
159
-
160
- ## Building from source
161
-
162
- Requires [Zig](https://ziglang.org/download/) (0.15+).
163
-
164
- ```sh
165
- git clone https://github.com/clocksmith/fawn
166
- cd fawn/zig
167
- zig build dropin
168
- # Output: zig-out/lib/libdoe_webgpu.{dylib,so}
169
- ```
170
-
171
- ## License
172
-
173
- ISC
17
+ `@simulatte/webgpu` is the maintained package name going forward.
package/package.json CHANGED
@@ -1,46 +1,9 @@
1
1
  {
2
2
  "name": "@simulatte/webgpu-doe",
3
- "version": "0.1.2",
4
- "description": "Doe WebGPU runtime for Node.js native Zig GPU backends (Metal, Vulkan) via N-API",
5
- "type": "module",
6
- "main": "./src/index.js",
7
- "exports": {
8
- ".": "./src/index.js",
9
- "./node": "./src/index.js"
10
- },
11
- "files": [
12
- "src/index.js",
13
- "native/",
14
- "binding.gyp",
15
- "prebuilds/",
16
- "README.md"
17
- ],
18
- "scripts": {
19
- "build:addon": "node-gyp rebuild"
20
- },
21
- "os": [
22
- "darwin"
23
- ],
24
- "cpu": [
25
- "arm64"
26
- ],
27
- "keywords": [
28
- "webgpu",
29
- "doe",
30
- "gpu",
31
- "compute",
32
- "headless",
33
- "node",
34
- "native",
35
- "napi",
36
- "metal",
37
- "vulkan",
38
- "zig"
39
- ],
40
- "repository": {
41
- "type": "git",
42
- "url": "https://github.com/clocksmith/fawn",
43
- "directory": "nursery/webgpu-doe"
44
- },
45
- "license": "ISC"
3
+ "version": "0.1.3",
4
+ "description": "Deprecated redirect package. Use @simulatte/webgpu instead.",
5
+ "license": "ISC",
6
+ "publishConfig": {
7
+ "access": "public"
8
+ }
46
9
  }
package/binding.gyp DELETED
@@ -1,20 +0,0 @@
1
- {
2
- "targets": [
3
- {
4
- "target_name": "doe_napi",
5
- "sources": ["native/doe_napi.c"],
6
- "include_dirs": [],
7
- "conditions": [
8
- ["OS=='mac'", {
9
- "xcode_settings": {
10
- "OTHER_CFLAGS": ["-std=c11"],
11
- "MACOSX_DEPLOYMENT_TARGET": "13.0"
12
- }
13
- }],
14
- ["OS=='linux'", {
15
- "cflags": ["-std=c11"]
16
- }]
17
- ]
18
- }
19
- ]
20
- }