sync 6fdf6301e2bb
Browse files- README.md +2 -2
- build/webgpu/bench.json +5 -5
- build/webgpu/loop-add-step.wgsl.jinja +1 -1
- build/webgpu/manifest.json +1 -1
- build/webgpu/metadata.json +6 -6
README.md
CHANGED
|
@@ -45,13 +45,13 @@ See the [standard ONNX `Loop` spec](https://onnx.ai/onnx/operators/onnx__Loop.ht
|
|
| 45 |
- [`metadata.json`](build/webgpu/metadata.json) — kernel metadata (id, digests, per-variant templates, provenance)
|
| 46 |
- [`manifest.json`](build/webgpu/manifest.json) — the op contract (source of truth)
|
| 47 |
- [`test.json`](build/webgpu/test.json) — correctness cases
|
| 48 |
-
- [`bench.json`](build/webgpu/bench.json) — benchmark
|
| 49 |
- [`loop-add-step.wgsl.jinja`](build/webgpu/loop-add-step.wgsl.jinja)
|
| 50 |
|
| 51 |
## Use with `@huggingface/kernels`
|
| 52 |
|
| 53 |
```sh
|
| 54 |
-
npm install --save-exact @huggingface/kernels@0.0.1-preview.
|
| 55 |
```
|
| 56 |
|
| 57 |
Outputs with inferable metadata are allocated automatically. Explicit `outputs` entries request optional results or provide metadata that cannot be inferred from the supplied inputs and attributes.
|
|
|
|
| 45 |
- [`metadata.json`](build/webgpu/metadata.json) — kernel metadata (id, digests, per-variant templates, provenance)
|
| 46 |
- [`manifest.json`](build/webgpu/manifest.json) — the op contract (source of truth)
|
| 47 |
- [`test.json`](build/webgpu/test.json) — correctness cases
|
| 48 |
+
- [`bench.json`](build/webgpu/bench.json) — benchmark cases
|
| 49 |
- [`loop-add-step.wgsl.jinja`](build/webgpu/loop-add-step.wgsl.jinja)
|
| 50 |
|
| 51 |
## Use with `@huggingface/kernels`
|
| 52 |
|
| 53 |
```sh
|
| 54 |
+
npm install --save-exact @huggingface/kernels@0.0.1-preview.3
|
| 55 |
```
|
| 56 |
|
| 57 |
Outputs with inferable metadata are allocated automatically. Explicit `outputs` entries request optional results or provide metadata that cannot be inferred from the supplied inputs and attributes.
|
build/webgpu/bench.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
| 1 |
{
|
| 2 |
"cases": [
|
| 3 |
{
|
| 4 |
-
"name": "
|
| 5 |
"preset": "smoke",
|
| 6 |
"inputs": {
|
| 7 |
"m": { "dtype": "uint32", "shape": [1], "data": { "kind": "values", "values": [128] } },
|
|
@@ -16,7 +16,7 @@
|
|
| 16 |
"bench": { "metrics": [{ "type": "bandwidth", "value": "2 * 4 * numel(shapes.scan_output)" }] }
|
| 17 |
},
|
| 18 |
{
|
| 19 |
-
"name": "
|
| 20 |
"preset": "smoke",
|
| 21 |
"inputs": {
|
| 22 |
"m": { "dtype": "uint32", "shape": [1], "data": { "kind": "values", "values": [512] } },
|
|
@@ -31,7 +31,7 @@
|
|
| 31 |
"bench": { "primary": true, "metrics": [{ "type": "bandwidth", "value": "2 * 4 * numel(shapes.scan_output)" }] }
|
| 32 |
},
|
| 33 |
{
|
| 34 |
-
"name": "
|
| 35 |
"preset": "smoke",
|
| 36 |
"inputs": {
|
| 37 |
"m": { "dtype": "uint32", "shape": [1], "data": { "kind": "values", "values": [1024] } },
|
|
@@ -46,7 +46,7 @@
|
|
| 46 |
"bench": { "metrics": [{ "type": "bandwidth", "value": "2 * 4 * numel(shapes.scan_output)" }] }
|
| 47 |
},
|
| 48 |
{
|
| 49 |
-
"name": "
|
| 50 |
"preset": "smoke",
|
| 51 |
"inputs": {
|
| 52 |
"m": { "dtype": "uint32", "shape": [1], "data": { "kind": "values", "values": [8192] } },
|
|
@@ -61,7 +61,7 @@
|
|
| 61 |
"bench": { "metrics": [{ "type": "bandwidth", "value": "2 * 4 * numel(shapes.scan_output)" }] }
|
| 62 |
},
|
| 63 |
{
|
| 64 |
-
"name": "
|
| 65 |
"preset": "smoke",
|
| 66 |
"inputs": {
|
| 67 |
"m": { "dtype": "uint32", "shape": [1], "data": { "kind": "values", "values": [1000] } },
|
|
|
|
| 1 |
{
|
| 2 |
"cases": [
|
| 3 |
{
|
| 4 |
+
"name": "lowered_control_baseline_dim128_steps128",
|
| 5 |
"preset": "smoke",
|
| 6 |
"inputs": {
|
| 7 |
"m": { "dtype": "uint32", "shape": [1], "data": { "kind": "values", "values": [128] } },
|
|
|
|
| 16 |
"bench": { "metrics": [{ "type": "bandwidth", "value": "2 * 4 * numel(shapes.scan_output)" }] }
|
| 17 |
},
|
| 18 |
{
|
| 19 |
+
"name": "lowered_stress_singlelane_serial_dim2048_steps512",
|
| 20 |
"preset": "smoke",
|
| 21 |
"inputs": {
|
| 22 |
"m": { "dtype": "uint32", "shape": [1], "data": { "kind": "values", "values": [512] } },
|
|
|
|
| 31 |
"bench": { "primary": true, "metrics": [{ "type": "bandwidth", "value": "2 * 4 * numel(shapes.scan_output)" }] }
|
| 32 |
},
|
| 33 |
{
|
| 34 |
+
"name": "lowered_stress_singlelane_serial_dim4096_steps1024",
|
| 35 |
"preset": "smoke",
|
| 36 |
"inputs": {
|
| 37 |
"m": { "dtype": "uint32", "shape": [1], "data": { "kind": "values", "values": [1024] } },
|
|
|
|
| 46 |
"bench": { "metrics": [{ "type": "bandwidth", "value": "2 * 4 * numel(shapes.scan_output)" }] }
|
| 47 |
},
|
| 48 |
{
|
| 49 |
+
"name": "lowered_stress_smalldim2_singlelane_steps8192",
|
| 50 |
"preset": "smoke",
|
| 51 |
"inputs": {
|
| 52 |
"m": { "dtype": "uint32", "shape": [1], "data": { "kind": "values", "values": [8192] } },
|
|
|
|
| 61 |
"bench": { "metrics": [{ "type": "bandwidth", "value": "2 * 4 * numel(shapes.scan_output)" }] }
|
| 62 |
},
|
| 63 |
{
|
| 64 |
+
"name": "lowered_stress_nonpow2_unaligned_dim1000_steps1000",
|
| 65 |
"preset": "smoke",
|
| 66 |
"inputs": {
|
| 67 |
"m": { "dtype": "uint32", "shape": [1], "data": { "kind": "values", "values": [1000] } },
|
build/webgpu/loop-add-step.wgsl.jinja
CHANGED
|
@@ -3,7 +3,7 @@
|
|
| 3 |
// One invocation owns each loop-carried element and walks its iterations
|
| 4 |
// serially. Columns run independently, but the per-column additions and stores
|
| 5 |
// stay sequential, preserving the f32 accumulation order.
|
| 6 |
-
@compute @workgroup_size(
|
| 7 |
fn main(@builtin(global_invocation_id) gid: vec3<u32>) {
|
| 8 |
let i = gid.x;
|
| 9 |
if (i >= params.dim) { return; }
|
|
|
|
| 3 |
// One invocation owns each loop-carried element and walks its iterations
|
| 4 |
// serially. Columns run independently, but the per-column additions and stores
|
| 5 |
// stay sequential, preserving the f32 accumulation order.
|
| 6 |
+
@compute @workgroup_size({{ workgroupSize }})
|
| 7 |
fn main(@builtin(global_invocation_id) gid: vec3<u32>) {
|
| 8 |
let i = gid.x;
|
| 9 |
if (i >= params.dim) { return; }
|
build/webgpu/manifest.json
CHANGED
|
@@ -18,7 +18,7 @@
|
|
| 18 |
{
|
| 19 |
"id": "lowered_add_step",
|
| 20 |
"when": ["ranks.m <= 1", "numel(shapes.m) == 1", "ranks.cond <= 1", "numel(shapes.cond) == 1", "ranks.v_initial == 1", "ranks.step == 1", "ranks.v_final == 1", "ranks.scan_output == 2", "dim(shapes.step, 0) == dim(shapes.v_initial, 0)", "dim(shapes.v_final, 0) == dim(shapes.v_initial, 0)", "dim(shapes.scan_output, 1) == dim(shapes.v_initial, 0)"],
|
| 21 |
-
"derive": { "dimBlocks": "ceil(dim(shapes.v_initial, 0) /
|
| 22 |
"passes": [
|
| 23 |
{
|
| 24 |
"id": "main",
|
|
|
|
| 18 |
{
|
| 19 |
"id": "lowered_add_step",
|
| 20 |
"when": ["ranks.m <= 1", "numel(shapes.m) == 1", "ranks.cond <= 1", "numel(shapes.cond) == 1", "ranks.v_initial == 1", "ranks.step == 1", "ranks.v_final == 1", "ranks.scan_output == 2", "dim(shapes.step, 0) == dim(shapes.v_initial, 0)", "dim(shapes.v_final, 0) == dim(shapes.v_initial, 0)", "dim(shapes.scan_output, 1) == dim(shapes.v_initial, 0)"],
|
| 21 |
+
"derive": { "workgroupSize": 256, "dimBlocks": "ceil(dim(shapes.v_initial, 0) / workgroupSize)" },
|
| 22 |
"passes": [
|
| 23 |
{
|
| 24 |
"id": "main",
|
build/webgpu/metadata.json
CHANGED
|
@@ -1,18 +1,18 @@
|
|
| 1 |
{
|
| 2 |
"name": "ai.onnx.Loop",
|
| 3 |
-
"id": "
|
| 4 |
"version": 1,
|
| 5 |
"license": "Apache-2.0",
|
| 6 |
"backend": { "type": "webgpu" },
|
| 7 |
"digest": {
|
| 8 |
"algorithm": "sha256",
|
| 9 |
"files": {
|
| 10 |
-
"bench.json": "
|
| 11 |
-
"loop-add-step.wgsl.jinja": "
|
| 12 |
-
"manifest.json": "
|
| 13 |
"test.json": "Rp36C1l3Leiipq280ww8mCj4exFK53UlSD0thVu/2P0="
|
| 14 |
}
|
| 15 |
},
|
| 16 |
-
"provenance": { "kernel": { "sha": "
|
| 17 |
-
"webgpu": { "manifestSpec": "2.
|
| 18 |
}
|
|
|
|
| 1 |
{
|
| 2 |
"name": "ai.onnx.Loop",
|
| 3 |
+
"id": "_ai_onnx_loop_webgpu_6b860c0",
|
| 4 |
"version": 1,
|
| 5 |
"license": "Apache-2.0",
|
| 6 |
"backend": { "type": "webgpu" },
|
| 7 |
"digest": {
|
| 8 |
"algorithm": "sha256",
|
| 9 |
"files": {
|
| 10 |
+
"bench.json": "gjMN5zadXNCeu4axKIR/IDNYDMcA9DgBZi6Dk0UVGLc=",
|
| 11 |
+
"loop-add-step.wgsl.jinja": "53Jj1FiRGGzYrUleplg+3QHim5zdxOQY2oZB2dESxr0=",
|
| 12 |
+
"manifest.json": "popStqex+yDicCRjJQwtzATv+7fwuipB98BQBGJncGg=",
|
| 13 |
"test.json": "Rp36C1l3Leiipq280ww8mCj4exFK53UlSD0thVu/2P0="
|
| 14 |
}
|
| 15 |
},
|
| 16 |
+
"provenance": { "kernel": { "sha": "6fdf6301e2bbcc2f03bf1eaf493b7ad55ef33afc", "dirty": false } },
|
| 17 |
+
"webgpu": { "manifestSpec": "2.1", "variants": { "lowered_add_step": ["loop-add-step.wgsl.jinja"] } }
|
| 18 |
}
|