@simulatte/webgpu-doe 0.1.3 → 0.3.2
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 +19 -0
- package/LICENSE +191 -0
- package/README.md +159 -8
- package/assets/fawn-icon-main.svg +222 -0
- package/examples/with-webgpu-compute.js +25 -0
- package/package.json +46 -4
- package/src/index.d.ts +125 -0
- package/src/index.js +731 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to `@simulatte/webgpu-doe` are documented in this file.
|
|
4
|
+
|
|
5
|
+
## [0.3.2] - 2026-03-15
|
|
6
|
+
|
|
7
|
+
### Added
|
|
8
|
+
|
|
9
|
+
- Reintroduced `@simulatte/webgpu-doe` as a standalone helper-only package.
|
|
10
|
+
- Exported `createDoeNamespace(...)`, `doe`, and the default Doe namespace.
|
|
11
|
+
- Added standalone TypeScript types for the Doe helper contract.
|
|
12
|
+
- Added a package-local smoke test and example showing how to bind Doe to
|
|
13
|
+
`@simulatte/webgpu` or `@simulatte/webgpu/compute`.
|
|
14
|
+
|
|
15
|
+
### Notes
|
|
16
|
+
|
|
17
|
+
- This package intentionally does not ship a runtime, addon, or Bun FFI layer.
|
|
18
|
+
- The Doe helper surface remains compatible with the helper contract currently
|
|
19
|
+
shipped inside `@simulatte/webgpu`.
|
package/LICENSE
ADDED
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to the Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by the Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
75
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
76
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
77
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding any notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
Copyright 2026 Fawn Contributors
|
|
180
|
+
|
|
181
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
182
|
+
you may not use this file except in compliance with the License.
|
|
183
|
+
You may obtain a copy of the License at
|
|
184
|
+
|
|
185
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
186
|
+
|
|
187
|
+
Unless required by applicable law or agreed to in writing, software
|
|
188
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
189
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
190
|
+
See the License for the specific language governing permissions and
|
|
191
|
+
limitations under the License.
|
package/README.md
CHANGED
|
@@ -1,17 +1,168 @@
|
|
|
1
1
|
# @simulatte/webgpu-doe
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
<table>
|
|
4
|
+
<tr>
|
|
5
|
+
<td valign="middle">
|
|
6
|
+
<strong>Run the Doe helper layer over real WebGPU devices from Fawn or any compatible raw runtime.</strong>
|
|
7
|
+
</td>
|
|
8
|
+
<td valign="middle">
|
|
9
|
+
<img src="assets/fawn-icon-main.svg" alt="Fawn logo" width="88" />
|
|
10
|
+
</td>
|
|
11
|
+
</tr>
|
|
12
|
+
</table>
|
|
4
13
|
|
|
5
|
-
|
|
14
|
+
`@simulatte/webgpu-doe` is the standalone Doe helper layer extracted from
|
|
15
|
+
Fawn's headless WebGPU package surface.
|
|
6
16
|
|
|
7
|
-
|
|
8
|
-
|
|
17
|
+
This package does **not** ship a runtime, native addon, Bun FFI layer, or raw
|
|
18
|
+
WebGPU implementation. It ships the Doe helper namespace only:
|
|
9
19
|
|
|
10
|
-
|
|
20
|
+
- `createDoeNamespace(...)`
|
|
21
|
+
- `doe`
|
|
22
|
+
- `default`
|
|
23
|
+
|
|
24
|
+
Use it when you want the same helper surface that exists inside
|
|
25
|
+
`@simulatte/webgpu`, but as a separate package boundary.
|
|
26
|
+
|
|
27
|
+
## What this package includes
|
|
28
|
+
|
|
29
|
+
- Doe buffer helpers: `gpu.buffer.create(...)`, `gpu.buffer.read(...)`
|
|
30
|
+
- Doe compute helpers: `gpu.kernel.run(...)`, `gpu.kernel.create(...)`,
|
|
31
|
+
`gpu.compute(...)`
|
|
32
|
+
- Generic TypeScript types for the bound Doe namespace and helper options
|
|
33
|
+
|
|
34
|
+
## What this package does not include
|
|
35
|
+
|
|
36
|
+
- no runtime or device discovery on its own
|
|
37
|
+
- no Node addon or Bun FFI transport
|
|
38
|
+
- no raw WebGPU wrapper classes
|
|
39
|
+
- no feature publication, limits, or globals
|
|
40
|
+
|
|
41
|
+
You either:
|
|
42
|
+
|
|
43
|
+
1. inject a `requestDevice(...)` function from another package, or
|
|
44
|
+
2. bind Doe to an already-created compatible device with `doe.bind(device)`
|
|
45
|
+
|
|
46
|
+
## Install
|
|
47
|
+
|
|
48
|
+
Pair it with a compatible runtime package, usually `@simulatte/webgpu`:
|
|
11
49
|
|
|
12
50
|
```bash
|
|
13
|
-
npm
|
|
14
|
-
|
|
51
|
+
npm install @simulatte/webgpu-doe @simulatte/webgpu
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
## How the packages fit together
|
|
55
|
+
|
|
56
|
+
- `@simulatte/webgpu`
|
|
57
|
+
- full headless WebGPU package
|
|
58
|
+
- includes the native runtime, raw WebGPU surface, and the same Doe helper contract
|
|
59
|
+
- `@simulatte/webgpu/compute`
|
|
60
|
+
- narrower compute-first facade over the same underlying runtime
|
|
61
|
+
- `@simulatte/webgpu-doe`
|
|
62
|
+
- helper-only package
|
|
63
|
+
- no runtime transport
|
|
64
|
+
- meant for reuse, custom binding, and independent versioning of the Doe helper contract
|
|
65
|
+
|
|
66
|
+
Normal users can keep using `@simulatte/webgpu` or `@simulatte/webgpu/compute`
|
|
67
|
+
directly. `@simulatte/webgpu-doe` is the explicit extraction for advanced
|
|
68
|
+
composition and for making the Doe helper layer independently publishable.
|
|
69
|
+
|
|
70
|
+
## Start here
|
|
71
|
+
|
|
72
|
+
The same simple compute pass, shown first as the helper-only package mounted on
|
|
73
|
+
the compute runtime and then as a direct bind over an already-created device.
|
|
74
|
+
|
|
75
|
+
### 1. Bind Doe to `@simulatte/webgpu/compute`
|
|
76
|
+
|
|
77
|
+
```js
|
|
78
|
+
import { requestDevice } from "@simulatte/webgpu/compute";
|
|
79
|
+
import { createDoeNamespace } from "@simulatte/webgpu-doe";
|
|
80
|
+
|
|
81
|
+
const doe = createDoeNamespace({ requestDevice });
|
|
82
|
+
const gpu = await doe.requestDevice();
|
|
83
|
+
|
|
84
|
+
const src = gpu.buffer.create({ data: Float32Array.of(1, 2, 3, 4) });
|
|
85
|
+
const dst = gpu.buffer.create({ size: src.size, usage: "storageReadWrite" });
|
|
86
|
+
|
|
87
|
+
await gpu.kernel.run({
|
|
88
|
+
code: `
|
|
89
|
+
@group(0) @binding(0) var<storage, read> src: array<f32>;
|
|
90
|
+
@group(0) @binding(1) var<storage, read_write> dst: array<f32>;
|
|
91
|
+
|
|
92
|
+
@compute @workgroup_size(4)
|
|
93
|
+
fn main(@builtin(global_invocation_id) gid: vec3u) {
|
|
94
|
+
let i = gid.x;
|
|
95
|
+
dst[i] = src[i] * 2.0;
|
|
96
|
+
}
|
|
97
|
+
`,
|
|
98
|
+
bindings: [src, dst],
|
|
99
|
+
workgroups: 1,
|
|
100
|
+
});
|
|
101
|
+
|
|
102
|
+
console.log(await gpu.buffer.read({ buffer: dst, type: Float32Array }));
|
|
15
103
|
```
|
|
16
104
|
|
|
17
|
-
|
|
105
|
+
### 2. Bind Doe to an existing device
|
|
106
|
+
|
|
107
|
+
```js
|
|
108
|
+
import { requestDevice } from "@simulatte/webgpu";
|
|
109
|
+
import doe from "@simulatte/webgpu-doe";
|
|
110
|
+
|
|
111
|
+
const device = await requestDevice();
|
|
112
|
+
const gpu = doe.bind(device);
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
### 3. Inject your own request path
|
|
116
|
+
|
|
117
|
+
```js
|
|
118
|
+
import { createDoeNamespace } from "@simulatte/webgpu-doe";
|
|
119
|
+
|
|
120
|
+
const doe = createDoeNamespace({
|
|
121
|
+
async requestDevice(options) {
|
|
122
|
+
return createMyCompatibleDevice(options);
|
|
123
|
+
},
|
|
124
|
+
});
|
|
125
|
+
|
|
126
|
+
const gpu = await doe.requestDevice();
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
The only requirement is that the bound device exposes the WebGPU methods Doe
|
|
130
|
+
uses internally:
|
|
131
|
+
|
|
132
|
+
- `createBuffer`
|
|
133
|
+
- `createShaderModule`
|
|
134
|
+
- `createBindGroupLayout`
|
|
135
|
+
- `createPipelineLayout`
|
|
136
|
+
- `createComputePipeline`
|
|
137
|
+
- `createBindGroup`
|
|
138
|
+
- `createCommandEncoder`
|
|
139
|
+
- `queue.writeBuffer`
|
|
140
|
+
- `queue.submit`
|
|
141
|
+
- optionally `queue.onSubmittedWorkDone`
|
|
142
|
+
|
|
143
|
+
## API surface
|
|
144
|
+
|
|
145
|
+
### `createDoeNamespace({ requestDevice } = {})`
|
|
146
|
+
|
|
147
|
+
Creates a Doe namespace object with:
|
|
148
|
+
|
|
149
|
+
- `requestDevice(options?)`
|
|
150
|
+
- `bind(device)`
|
|
151
|
+
|
|
152
|
+
If `requestDevice` is omitted, `doe.requestDevice()` throws an explicit error
|
|
153
|
+
and `doe.bind(device)` remains available.
|
|
154
|
+
|
|
155
|
+
### `doe`
|
|
156
|
+
|
|
157
|
+
Default namespace created with no injected `requestDevice(...)`. This is
|
|
158
|
+
useful when you want only `doe.bind(device)`.
|
|
159
|
+
|
|
160
|
+
## Release contract
|
|
161
|
+
|
|
162
|
+
This package intentionally owns only the helper contract. It should stay
|
|
163
|
+
transport-free. Runtime loading and raw WebGPU surfaces belong in
|
|
164
|
+
`@simulatte/webgpu`.
|
|
165
|
+
|
|
166
|
+
## License
|
|
167
|
+
|
|
168
|
+
Apache-2.0
|
|
@@ -0,0 +1,222 @@
|
|
|
1
|
+
<svg version="1.1" id="Layer_1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
|
|
2
|
+
width="100%" viewBox="0 0 1024 912" enable-background="new 0 0 1024 912" xml:space="preserve">
|
|
3
|
+
<path fill="#000000" opacity="1.000000" stroke="none"
|
|
4
|
+
d="
|
|
5
|
+
M561.720642,622.786377
|
|
6
|
+
C553.729919,627.969910 546.010742,632.904602 538.369385,637.957031
|
|
7
|
+
C535.816589,639.644958 533.450928,639.890869 530.410156,639.033569
|
|
8
|
+
C496.780701,629.553040 463.095703,620.269409 429.449615,610.847229
|
|
9
|
+
C426.789368,610.102295 424.805511,610.437683 422.541382,612.110107
|
|
10
|
+
C391.322327,635.171021 360.024384,658.125061 328.777100,681.147827
|
|
11
|
+
C326.949310,682.494568 324.665314,683.427673 323.501312,686.239502
|
|
12
|
+
C332.812775,697.053833 342.244049,708.005188 351.672821,718.958740
|
|
13
|
+
C355.911652,723.883118 360.213379,728.755676 364.352844,733.762329
|
|
14
|
+
C366.395416,736.232727 368.639038,736.733826 371.815857,736.326721
|
|
15
|
+
C395.402374,733.303955 419.023499,730.552856 442.621857,727.620361
|
|
16
|
+
C456.483551,725.897827 470.323303,723.998779 484.173126,722.180664
|
|
17
|
+
C486.255676,721.907288 488.363617,721.164978 491.108093,722.817322
|
|
18
|
+
C487.332245,727.182861 483.732910,731.417847 480.055420,735.583801
|
|
19
|
+
C462.526154,755.441467 444.874146,775.192200 427.513458,795.195923
|
|
20
|
+
C423.789734,799.486572 418.971436,798.620178 414.630371,799.096924
|
|
21
|
+
C382.224335,802.655823 349.776764,805.835388 317.347687,809.186890
|
|
22
|
+
C314.016266,809.531250 311.309998,808.870239 308.652527,806.577637
|
|
23
|
+
C293.512878,793.516846 278.267792,780.577148 262.963531,767.709290
|
|
24
|
+
C260.426514,765.575989 259.164886,763.535583 259.918427,760.033569
|
|
25
|
+
C264.604370,738.255676 269.179749,716.453125 273.615570,694.622925
|
|
26
|
+
C274.479248,690.372375 276.427002,687.729614 280.374420,685.634399
|
|
27
|
+
C319.514038,664.859131 358.537842,643.865662 397.604797,622.953308
|
|
28
|
+
C400.812408,621.236328 404.096161,619.661682 407.150513,617.578186
|
|
29
|
+
C393.732697,622.716980 380.298035,627.812378 366.900330,633.003174
|
|
30
|
+
C333.982697,645.756592 301.074982,658.535889 268.189453,671.371765
|
|
31
|
+
C265.848175,672.285645 263.776581,672.206299 261.437622,671.452393
|
|
32
|
+
C246.070526,666.499451 230.683975,661.605286 215.267365,656.808960
|
|
33
|
+
C212.194107,655.852783 210.103867,654.263794 208.742416,651.246216
|
|
34
|
+
C187.855164,604.951904 166.902298,558.687256 145.906128,512.442200
|
|
35
|
+
C144.987503,510.418915 145.157257,508.623322 145.793808,506.672943
|
|
36
|
+
C157.670425,470.283783 169.540680,433.892578 181.402237,397.498535
|
|
37
|
+
C184.754959,387.211609 188.098938,376.921692 191.383820,366.613068
|
|
38
|
+
C191.825394,365.227356 192.462067,363.790863 191.736496,361.545654
|
|
39
|
+
C184.453964,359.555237 176.801498,357.450378 169.141418,355.373566
|
|
40
|
+
C159.671265,352.806030 150.205750,350.220001 140.714081,347.734192
|
|
41
|
+
C138.026398,347.030243 135.910217,345.670532 134.053238,343.621948
|
|
42
|
+
C112.234657,319.551697 90.411766,295.485046 68.485085,271.513458
|
|
43
|
+
C65.887260,268.673370 65.523636,265.257629 64.848785,261.891754
|
|
44
|
+
C56.576641,220.633774 48.364689,179.363693 40.146648,138.094879
|
|
45
|
+
C38.665779,130.658356 37.227734,123.213303 35.690380,115.366211
|
|
46
|
+
C40.433868,114.928268 44.042770,116.909630 47.717518,118.043434
|
|
47
|
+
C99.263542,133.947342 150.750153,150.044006 202.309982,165.902649
|
|
48
|
+
C207.699402,167.560303 211.560791,170.671005 215.235367,174.679153
|
|
49
|
+
C241.804993,203.660690 268.524261,232.505081 295.080139,261.499176
|
|
50
|
+
C297.910065,264.588959 300.303467,265.394440 304.533447,264.020844
|
|
51
|
+
C329.391846,255.948639 354.393036,248.317032 379.308838,240.419434
|
|
52
|
+
C382.485748,239.412445 385.346466,239.393539 388.532715,240.395325
|
|
53
|
+
C421.252045,250.682495 454.005737,260.860382 486.755432,271.050873
|
|
54
|
+
C489.222900,271.818634 491.161682,273.269073 492.938354,275.105591
|
|
55
|
+
C506.840179,289.475433 520.896973,303.698212 534.613708,318.241974
|
|
56
|
+
C537.627380,321.437347 540.515869,321.205933 544.030640,320.376068
|
|
57
|
+
C573.657593,313.380890 603.293335,306.422607 632.920532,299.428467
|
|
58
|
+
C643.606567,296.905823 654.267090,294.274200 664.964844,291.803223
|
|
59
|
+
C666.486206,291.451813 668.108032,290.460999 669.814636,291.591919
|
|
60
|
+
C670.192810,294.030426 668.415833,295.596619 667.317017,297.350250
|
|
61
|
+
C636.976929,345.773132 606.644836,394.201294 576.122803,442.509460
|
|
62
|
+
C573.378540,446.852936 573.123657,450.225891 575.521301,454.824280
|
|
63
|
+
C590.533936,483.616547 605.209656,512.584290 620.125061,541.427734
|
|
64
|
+
C621.919067,544.897034 622.520325,548.027954 621.308167,551.859314
|
|
65
|
+
C617.644714,563.439331 614.236816,575.101990 610.866333,586.771973
|
|
66
|
+
C609.790649,590.496399 607.782532,593.152527 604.463562,595.254456
|
|
67
|
+
C590.248535,604.256714 576.158325,613.456116 561.720642,622.786377
|
|
68
|
+
M389.160492,357.400208
|
|
69
|
+
C377.895325,350.594940 366.583130,343.865631 355.395233,336.935638
|
|
70
|
+
C352.259521,334.993286 349.793701,335.102173 346.783813,337.256500
|
|
71
|
+
C319.826477,356.550690 292.800842,375.749664 265.745667,394.906525
|
|
72
|
+
C263.544037,396.465393 262.329681,398.155731 262.033478,400.936432
|
|
73
|
+
C259.216034,427.388336 256.314209,453.831604 253.309174,480.262817
|
|
74
|
+
C252.844360,484.351013 254.656021,487.205566 257.028107,490.134552
|
|
75
|
+
C275.376831,512.791016 293.711456,535.459351 311.910980,558.235474
|
|
76
|
+
C314.253540,561.167053 316.995422,562.697571 320.491333,563.678040
|
|
77
|
+
C386.520844,582.196045 452.576324,600.625305 518.489746,619.548950
|
|
78
|
+
C527.676208,622.186401 535.468384,622.854553 542.702759,615.858521
|
|
79
|
+
C543.638672,614.953491 544.956970,614.450012 546.077148,613.728088
|
|
80
|
+
C555.126221,607.895935 564.170349,602.055908 573.225342,596.212341
|
|
81
|
+
C572.119995,593.866333 570.705750,592.725342 569.262939,591.600159
|
|
82
|
+
C560.328918,584.632874 551.468567,577.568359 542.430176,570.739441
|
|
83
|
+
C539.547424,568.561401 538.424866,566.530396 539.555725,562.775269
|
|
84
|
+
C542.047974,554.499207 544.070374,546.077332 546.119263,537.674683
|
|
85
|
+
C546.786133,534.939697 548.161682,533.386230 550.904663,532.646423
|
|
86
|
+
C557.971252,530.740662 564.995850,528.676331 572.019470,526.614807
|
|
87
|
+
C578.174683,524.808228 584.305725,522.919434 590.221558,521.135132
|
|
88
|
+
C590.295715,518.215515 589.053711,516.567627 588.162903,514.813843
|
|
89
|
+
C578.734070,496.250458 569.299255,477.690063 559.808594,459.158295
|
|
90
|
+
C558.483154,456.570251 557.825989,453.944122 557.789429,451.028076
|
|
91
|
+
C557.463684,425.041412 557.033997,399.056000 556.730774,373.069092
|
|
92
|
+
C556.698120,370.272583 556.065369,367.962158 554.337524,365.703094
|
|
93
|
+
C547.252747,356.439758 540.328613,347.053741 533.316956,337.734192
|
|
94
|
+
C532.307068,336.391846 531.465698,334.758179 528.940552,334.188080
|
|
95
|
+
C529.409485,336.139984 529.619141,337.603485 530.110901,338.965118
|
|
96
|
+
C533.898621,349.453766 537.650574,359.957184 541.622253,370.376465
|
|
97
|
+
C542.796143,373.455994 543.060059,376.288116 542.416260,379.561615
|
|
98
|
+
C539.176270,396.036377 536.303406,412.583588 533.037476,429.052979
|
|
99
|
+
C532.198181,433.285675 532.293274,437.893341 529.599854,442.109650
|
|
100
|
+
C482.724701,413.845673 436.248322,385.822113 389.160492,357.400208
|
|
101
|
+
M56.569050,140.456726
|
|
102
|
+
C57.268250,143.874146 57.942520,147.296906 58.670532,150.708176
|
|
103
|
+
C65.677315,183.540237 72.641701,216.381531 79.761696,249.189041
|
|
104
|
+
C80.832840,254.124680 81.227097,259.218994 85.018944,263.441406
|
|
105
|
+
C104.823868,285.495239 124.405800,307.749481 144.034897,329.960876
|
|
106
|
+
C145.854980,332.020386 147.803009,333.319489 150.680099,333.860687
|
|
107
|
+
C177.804352,338.962921 204.896912,344.234528 231.987488,349.514313
|
|
108
|
+
C241.745834,351.416138 251.037933,353.534485 260.474915,346.848877
|
|
109
|
+
C269.175598,340.684998 269.619690,341.523285 265.387604,331.394623
|
|
110
|
+
C245.881470,284.710724 226.412018,238.011368 207.056107,191.265106
|
|
111
|
+
C205.715347,188.027054 203.863800,186.261200 200.563248,185.145782
|
|
112
|
+
C160.363266,171.560287 120.209190,157.838913 80.039070,144.164978
|
|
113
|
+
C73.424332,141.913315 66.805107,139.672226 60.154423,137.530396
|
|
114
|
+
C58.289543,136.929840 55.923115,136.065369 56.569050,140.456726
|
|
115
|
+
z"/>
|
|
116
|
+
<path fill="#000000" opacity="1.000000" stroke="none"
|
|
117
|
+
d="
|
|
118
|
+
M731.231934,682.461914
|
|
119
|
+
C736.633423,680.504578 737.072327,679.305176 733.911377,674.890747
|
|
120
|
+
C717.714111,652.270508 701.466064,629.686707 685.232239,607.092712
|
|
121
|
+
C674.152527,591.672180 663.097595,576.233704 651.947998,560.863831
|
|
122
|
+
C650.435486,558.778687 650.035583,556.890381 650.816833,554.402344
|
|
123
|
+
C664.624878,510.428223 678.360046,466.431152 692.155151,422.452911
|
|
124
|
+
C692.535828,421.239624 692.594788,419.770050 693.996399,418.885345
|
|
125
|
+
C695.775146,418.608185 696.389282,420.199554 697.320312,421.264954
|
|
126
|
+
C721.212219,448.607300 745.334717,475.754272 768.815857,503.445160
|
|
127
|
+
C774.828674,510.535950 781.631042,514.719055 790.249939,517.647888
|
|
128
|
+
C836.906738,533.502625 883.415283,549.793762 929.977234,565.927734
|
|
129
|
+
C931.684448,566.519287 933.415894,567.041077 936.217712,567.943970
|
|
130
|
+
C947.106567,519.674866 957.898376,471.835693 968.690186,423.996552
|
|
131
|
+
C972.131714,429.442688 972.162231,435.309631 973.138062,440.919861
|
|
132
|
+
C979.203796,475.792755 984.433228,510.825745 991.281860,545.540955
|
|
133
|
+
C994.246094,560.566711 991.265930,574.089050 987.032837,587.948669
|
|
134
|
+
C983.679626,598.927429 980.492371,609.957031 977.277161,620.977478
|
|
135
|
+
C976.657471,623.101196 975.759949,624.940857 974.096680,626.500854
|
|
136
|
+
C952.954529,646.330750 931.828552,666.178223 910.776245,686.103455
|
|
137
|
+
C908.674316,688.092834 906.513794,688.984924 903.652954,688.949951
|
|
138
|
+
C899.545715,688.899719 895.381104,688.465210 891.387939,689.559937
|
|
139
|
+
C890.740234,691.802307 892.010681,693.316650 892.757019,694.925049
|
|
140
|
+
C897.734436,705.651123 902.706238,716.380676 907.817871,727.042908
|
|
141
|
+
C908.992554,729.493164 909.164062,731.544678 907.919678,734.079102
|
|
142
|
+
C903.222778,743.644836 898.566772,753.240356 894.283508,762.995117
|
|
143
|
+
C892.475708,767.112061 890.086304,768.469238 885.566895,768.458862
|
|
144
|
+
C819.580444,768.307983 753.593567,768.361206 687.606750,768.364746
|
|
145
|
+
C665.111267,768.365967 642.615601,768.398621 620.120361,768.325684
|
|
146
|
+
C616.840454,768.315063 613.977173,768.965454 611.194214,770.816589
|
|
147
|
+
C587.340698,786.683594 563.404663,802.426636 539.562012,818.309875
|
|
148
|
+
C536.385132,820.426208 533.213501,821.462402 529.348572,821.449341
|
|
149
|
+
C497.188782,821.340576 465.028351,821.405029 432.868164,821.376282
|
|
150
|
+
C431.258209,821.374817 429.553650,821.838013 427.615570,820.654785
|
|
151
|
+
C428.738312,817.837585 431.083252,815.891113 432.972290,813.740784
|
|
152
|
+
C462.877960,779.697327 493.057037,745.890747 522.634949,711.565857
|
|
153
|
+
C528.071411,705.256897 534.605713,705.750427 541.086548,704.942688
|
|
154
|
+
C579.859314,700.110413 618.661011,695.507141 657.464600,690.925781
|
|
155
|
+
C681.907166,688.039978 706.370056,685.326477 731.231934,682.461914
|
|
156
|
+
M503.772980,757.260376
|
|
157
|
+
C490.344299,772.708374 476.915588,788.156372 463.486877,803.604309
|
|
158
|
+
C476.103638,804.763000 487.897797,804.808472 499.691467,804.749390
|
|
159
|
+
C510.005981,804.697693 520.971497,806.678833 530.450806,803.806396
|
|
160
|
+
C539.932312,800.933350 547.956055,793.198608 556.556702,787.501221
|
|
161
|
+
C558.981445,785.895020 561.790039,784.678650 563.506836,782.197998
|
|
162
|
+
C563.099243,781.457642 562.968811,780.891052 562.613220,780.622437
|
|
163
|
+
C547.470825,769.184448 532.304871,757.777710 517.152832,746.352539
|
|
164
|
+
C515.169067,744.856812 513.806519,745.820129 512.479919,747.346741
|
|
165
|
+
C509.750305,750.487732 506.988220,753.600464 503.772980,757.260376
|
|
166
|
+
z"/>
|
|
167
|
+
<path fill="#000000" opacity="1.000000" stroke="none"
|
|
168
|
+
d="
|
|
169
|
+
M442.079773,131.096130
|
|
170
|
+
C457.800568,112.627243 473.291626,94.427544 489.449097,75.444923
|
|
171
|
+
C493.529510,85.120598 497.185028,93.637383 500.719482,102.204109
|
|
172
|
+
C506.495819,116.204674 512.038696,130.304092 518.009521,144.220490
|
|
173
|
+
C520.044678,148.963852 520.779846,153.800201 520.931396,158.775818
|
|
174
|
+
C521.479065,176.751144 521.848450,194.731827 522.347717,212.708771
|
|
175
|
+
C522.424500,215.472504 521.754272,217.874130 520.364868,220.279236
|
|
176
|
+
C513.534912,232.101974 506.721710,243.937576 500.153809,255.906509
|
|
177
|
+
C498.311310,259.264191 496.317963,260.171509 492.587524,259.258820
|
|
178
|
+
C460.289185,251.356903 427.946198,243.637665 395.627441,235.818893
|
|
179
|
+
C389.245697,234.274994 389.202698,234.055267 391.016357,227.726776
|
|
180
|
+
C395.736450,211.256729 400.497772,194.798157 405.120117,178.300674
|
|
181
|
+
C406.180176,174.517181 407.934235,171.279755 410.482666,168.305206
|
|
182
|
+
C420.992371,156.038071 431.403015,143.686111 442.079773,131.096130
|
|
183
|
+
z"/>
|
|
184
|
+
<path fill="#000000" opacity="1.000000" stroke="none"
|
|
185
|
+
d="
|
|
186
|
+
M252.998932,712.786987
|
|
187
|
+
C250.317963,725.394775 247.725464,737.587036 245.158737,749.784668
|
|
188
|
+
C243.936020,755.595276 243.508926,755.814148 237.893997,754.554443
|
|
189
|
+
C216.489075,749.752686 195.083923,744.949646 173.643234,740.311829
|
|
190
|
+
C169.245514,739.360596 165.697144,737.598572 162.588989,734.212402
|
|
191
|
+
C153.809341,724.647400 144.771652,715.317749 135.758499,705.969727
|
|
192
|
+
C133.405960,703.529724 132.567398,700.848022 132.547668,697.449341
|
|
193
|
+
C132.463577,682.968018 132.131790,668.487671 131.830811,654.008240
|
|
194
|
+
C131.773529,651.252686 132.100418,648.758423 134.133392,646.643616
|
|
195
|
+
C145.671478,634.641052 157.163727,622.594360 168.693634,610.583862
|
|
196
|
+
C169.240112,610.014587 169.996033,609.646362 170.658371,609.181763
|
|
197
|
+
C173.133591,610.502014 173.506210,612.985535 174.467651,615.005920
|
|
198
|
+
C182.190201,631.234131 189.908066,647.465454 197.451523,663.777222
|
|
199
|
+
C199.122818,667.391174 201.509567,669.478210 205.316818,670.676331
|
|
200
|
+
C221.501770,675.769409 237.583847,681.189636 253.771881,686.272522
|
|
201
|
+
C257.208191,687.351440 258.236877,688.890198 257.385834,692.387329
|
|
202
|
+
C255.775284,699.005371 254.507935,705.706787 252.998932,712.786987
|
|
203
|
+
z"/>
|
|
204
|
+
<path fill="#000000" opacity="1.000000" stroke="none"
|
|
205
|
+
d="
|
|
206
|
+
M862.719971,430.887146
|
|
207
|
+
C858.402466,432.035706 854.776245,434.308868 849.628052,434.442932
|
|
208
|
+
C851.871216,412.718262 854.065735,391.465057 856.410034,368.761017
|
|
209
|
+
C878.879822,382.735718 900.196106,395.992981 921.512329,409.250244
|
|
210
|
+
C921.524780,409.751282 921.537170,410.252350 921.549622,410.753387
|
|
211
|
+
C902.062439,417.418610 882.575317,424.083862 862.719971,430.887146
|
|
212
|
+
z"/>
|
|
213
|
+
<path fill="#000000" opacity="1.000000" stroke="none"
|
|
214
|
+
d="
|
|
215
|
+
M821.230652,403.927551
|
|
216
|
+
C819.668640,412.961365 820.023743,421.815399 817.718933,431.213898
|
|
217
|
+
C801.171509,421.056610 785.291016,411.308716 769.410522,401.560822
|
|
218
|
+
C769.423279,401.011597 769.436035,400.462341 769.448792,399.913116
|
|
219
|
+
C786.970764,393.854431 804.492676,387.795776 822.784790,381.470795
|
|
220
|
+
C823.206604,389.521515 821.328735,396.452484 821.230652,403.927551
|
|
221
|
+
z"/>
|
|
222
|
+
</svg>
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { requestDevice } from '@simulatte/webgpu/compute';
|
|
2
|
+
import { createDoeNamespace } from '@simulatte/webgpu-doe';
|
|
3
|
+
|
|
4
|
+
const doe = createDoeNamespace({ requestDevice });
|
|
5
|
+
const gpu = await doe.requestDevice();
|
|
6
|
+
|
|
7
|
+
const src = gpu.buffer.create({ data: Float32Array.of(1, 2, 3, 4) });
|
|
8
|
+
const dst = gpu.buffer.create({ size: src.size, usage: 'storageReadWrite' });
|
|
9
|
+
|
|
10
|
+
await gpu.kernel.run({
|
|
11
|
+
code: `
|
|
12
|
+
@group(0) @binding(0) var<storage, read> src: array<f32>;
|
|
13
|
+
@group(0) @binding(1) var<storage, read_write> dst: array<f32>;
|
|
14
|
+
|
|
15
|
+
@compute @workgroup_size(4)
|
|
16
|
+
fn main(@builtin(global_invocation_id) gid: vec3u) {
|
|
17
|
+
let i = gid.x;
|
|
18
|
+
dst[i] = src[i] * 2.0;
|
|
19
|
+
}
|
|
20
|
+
`,
|
|
21
|
+
bindings: [src, dst],
|
|
22
|
+
workgroups: 1,
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
console.log(await gpu.buffer.read({ buffer: dst, type: Float32Array }));
|