sync 2e7068faf55e
Browse files- README.md +75 -0
- build/webgpu/bench.json +80 -0
- build/webgpu/loop-add-step.wgsl.jinja +21 -0
- build/webgpu/manifest.json +128 -0
- build/webgpu/metadata.json +18 -0
- build/webgpu/test.json +299 -0
README.md
CHANGED
|
@@ -1,3 +1,78 @@
|
|
| 1 |
---
|
|
|
|
| 2 |
license: apache-2.0
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
---
|
| 2 |
+
library_name: kernels
|
| 3 |
license: apache-2.0
|
| 4 |
+
tags:
|
| 5 |
+
- kernel
|
| 6 |
+
- webgpu
|
| 7 |
+
- wgsl
|
| 8 |
---
|
| 9 |
+
# ai.onnx.Loop
|
| 10 |
+
|
| 11 |
+
`ai.onnx` · internal tensor lowering (non-standard) · reviewed against ONNX opset 25
|
| 12 |
+
|
| 13 |
+
## Description
|
| 14 |
+
|
| 15 |
+
Support status: the standard ONNX `Loop` control-flow operator is not implemented because standalone kernel packages cannot carry or execute its body graph. This internal lowering performs one fixed recurrence—adding `step` to a rank-1 loop-carried tensor for up to `M` iterations while writing a dense scan tensor; `step` is not an ONNX `Loop` input, and this lowering must not be treated as ONNX `Loop`.
|
| 16 |
+
|
| 17 |
+
See the [standard ONNX `Loop` spec](https://onnx.ai/onnx/operators/onnx__Loop.html) for the contract this internal lowering does not implement.
|
| 18 |
+
|
| 19 |
+
## Inputs
|
| 20 |
+
|
| 21 |
+
| Name | Bind key | Logical dtype | Rank | Shape | Description | Presence |
|
| 22 |
+
| --- | --- | --- | --- | --- | --- | --- |
|
| 23 |
+
| `M` | `m` | `I` | — | — | Required uint32 trip-count limit encoded as either a scalar tensor or a one-element rank-1 tensor. The lowering executes at most `min(M, scan_output.shape[0])` iterations. | required |
|
| 24 |
+
| `cond` | `cond` | `B` | — | — | Required initial condition encoded as either a scalar tensor or a one-element rank-1 tensor. A false value executes zero iterations; a true value permits all iterations selected by `M`. This fixed lowering does not update the condition inside the loop. | required |
|
| 25 |
+
| `v_initial` | `v_initial` | `T` | `1` | — | Initial rank-1 loop-carried state of shape `[dim]`. | required |
|
| 26 |
+
| `step` | `step` | `T` | `1` | — | Implementation-specific rank-1 increment of shape `[dim]`, added elementwise to the state on every executed iteration. This is not a standard ONNX `Loop` input. | required |
|
| 27 |
+
|
| 28 |
+
## Outputs
|
| 29 |
+
|
| 30 |
+
| Name | Bind key | Logical dtype | Rank | Shape | Description | Presence |
|
| 31 |
+
| --- | --- | --- | --- | --- | --- | --- |
|
| 32 |
+
| `v_final` | `v_final` | `T` | `1` | same as `v_initial` | Final rank-1 state of shape `[dim]` after the executed additions. | required |
|
| 33 |
+
| `scan_output` | `scan_output` | `T` | `2` | — | Dense tensor of shape `[scan_steps, dim]`. Each executed row contains the updated state for that iteration; rows beyond the executed trip count are zero-filled. | required |
|
| 34 |
+
|
| 35 |
+
## Type constraints
|
| 36 |
+
|
| 37 |
+
| Variable | Allowed dtypes |
|
| 38 |
+
| --- | --- |
|
| 39 |
+
| `T` | `float32` |
|
| 40 |
+
| `I` | `uint32` |
|
| 41 |
+
| `B` | `uint32`, `bool` |
|
| 42 |
+
|
| 43 |
+
## Files
|
| 44 |
+
|
| 45 |
+
- [`metadata.json`](build/webgpu/metadata.json) — kernel metadata (id, digests, 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 + tuning cases
|
| 49 |
+
- [`loop-add-step.wgsl.jinja`](build/webgpu/loop-add-step.wgsl.jinja)
|
| 50 |
+
|
| 51 |
+
## Use with `@huggingface/kernels`
|
| 52 |
+
|
| 53 |
+
The loader automatically allocates outputs whose metadata it can derive from the manifest contract and this call.
|
| 54 |
+
|
| 55 |
+
The explicit `outputs` entries provide shape and logical dtype metadata for the results listed below:
|
| 56 |
+
|
| 57 |
+
- `scan_output`
|
| 58 |
+
|
| 59 |
+
Each entry either requests an optional result or supplies metadata that cannot be inferred from the inputs.
|
| 60 |
+
|
| 61 |
+
The `version: 1` option selects the published kernel contract; it is independent of any operator opset, contrib `since_version`, or model version.
|
| 62 |
+
|
| 63 |
+
Replace each `*Data` placeholder with a typed array containing the corresponding input data.
|
| 64 |
+
|
| 65 |
+
```js
|
| 66 |
+
import { getKernel } from "@huggingface/kernels";
|
| 67 |
+
|
| 68 |
+
const kernel = await getKernel("webgpu-kernels/ai.onnx.Loop", { version: 1 });
|
| 69 |
+
// Explicit destinations request optional results or supply metadata that cannot be inferred.
|
| 70 |
+
const { v_final, scan_output } = await kernel({
|
| 71 |
+
m: { data: mData, shape: [1] },
|
| 72 |
+
cond: { data: condData, shape: [1] },
|
| 73 |
+
v_initial: { data: v_initialData, shape: [1] },
|
| 74 |
+
step: { data: stepData, shape: [1] },
|
| 75 |
+
}, {
|
| 76 |
+
outputs: { scan_output: { shape: [1, 1], dtype: "float32" } },
|
| 77 |
+
});
|
| 78 |
+
```
|
build/webgpu/bench.json
ADDED
|
@@ -0,0 +1,80 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"op": "ai.onnx.Loop",
|
| 3 |
+
"cases": [
|
| 4 |
+
{
|
| 5 |
+
"name": "lowered_HEALTHY_baseline_dim128_steps128",
|
| 6 |
+
"preset": "smoke",
|
| 7 |
+
"inputs": {
|
| 8 |
+
"m": { "dtype": "uint32", "shape": [1], "data": { "kind": "values", "values": [128] } },
|
| 9 |
+
"cond": { "dtype": "uint32", "shape": [1], "data": { "kind": "values", "values": [1] } },
|
| 10 |
+
"v_initial": { "dtype": "float32", "shape": [128], "dist": "normal", "seed": 8101, "scale": 0.1 },
|
| 11 |
+
"step": { "dtype": "float32", "shape": [128], "dist": "normal", "seed": 8102, "scale": 0.1 }
|
| 12 |
+
},
|
| 13 |
+
"outputs": {
|
| 14 |
+
"v_final": { "dtype": "float32", "shape": [128] },
|
| 15 |
+
"scan_output": { "dtype": "float32", "shape": [128, 128] }
|
| 16 |
+
},
|
| 17 |
+
"bench": { "metrics": [{ "type": "bandwidth", "value": "2 * 4 * numel(shapes.scan_output)" }] }
|
| 18 |
+
},
|
| 19 |
+
{
|
| 20 |
+
"name": "lowered_PATHO_singlelane_serial_dim2048_steps512",
|
| 21 |
+
"preset": "smoke",
|
| 22 |
+
"inputs": {
|
| 23 |
+
"m": { "dtype": "uint32", "shape": [1], "data": { "kind": "values", "values": [512] } },
|
| 24 |
+
"cond": { "dtype": "uint32", "shape": [1], "data": { "kind": "values", "values": [1] } },
|
| 25 |
+
"v_initial": { "dtype": "float32", "shape": [2048], "dist": "normal", "seed": 8103, "scale": 0.1 },
|
| 26 |
+
"step": { "dtype": "float32", "shape": [2048], "dist": "normal", "seed": 8104, "scale": 0.1 }
|
| 27 |
+
},
|
| 28 |
+
"outputs": {
|
| 29 |
+
"v_final": { "dtype": "float32", "shape": [2048] },
|
| 30 |
+
"scan_output": { "dtype": "float32", "shape": [512, 2048] }
|
| 31 |
+
},
|
| 32 |
+
"bench": { "primary": true, "metrics": [{ "type": "bandwidth", "value": "2 * 4 * numel(shapes.scan_output)" }] }
|
| 33 |
+
},
|
| 34 |
+
{
|
| 35 |
+
"name": "lowered_PATHO_singlelane_serial_dim4096_steps1024",
|
| 36 |
+
"preset": "smoke",
|
| 37 |
+
"inputs": {
|
| 38 |
+
"m": { "dtype": "uint32", "shape": [1], "data": { "kind": "values", "values": [1024] } },
|
| 39 |
+
"cond": { "dtype": "uint32", "shape": [1], "data": { "kind": "values", "values": [1] } },
|
| 40 |
+
"v_initial": { "dtype": "float32", "shape": [4096], "dist": "normal", "seed": 8105, "scale": 0.1 },
|
| 41 |
+
"step": { "dtype": "float32", "shape": [4096], "dist": "normal", "seed": 8106, "scale": 0.1 }
|
| 42 |
+
},
|
| 43 |
+
"outputs": {
|
| 44 |
+
"v_final": { "dtype": "float32", "shape": [4096] },
|
| 45 |
+
"scan_output": { "dtype": "float32", "shape": [1024, 4096] }
|
| 46 |
+
},
|
| 47 |
+
"bench": { "metrics": [{ "type": "bandwidth", "value": "2 * 4 * numel(shapes.scan_output)" }] }
|
| 48 |
+
},
|
| 49 |
+
{
|
| 50 |
+
"name": "lowered_PATHO_smalldim2_singlelane_steps8192",
|
| 51 |
+
"preset": "smoke",
|
| 52 |
+
"inputs": {
|
| 53 |
+
"m": { "dtype": "uint32", "shape": [1], "data": { "kind": "values", "values": [8192] } },
|
| 54 |
+
"cond": { "dtype": "uint32", "shape": [1], "data": { "kind": "values", "values": [1] } },
|
| 55 |
+
"v_initial": { "dtype": "float32", "shape": [2], "dist": "normal", "seed": 8107, "scale": 0.1 },
|
| 56 |
+
"step": { "dtype": "float32", "shape": [2], "dist": "normal", "seed": 8108, "scale": 0.1 }
|
| 57 |
+
},
|
| 58 |
+
"outputs": {
|
| 59 |
+
"v_final": { "dtype": "float32", "shape": [2] },
|
| 60 |
+
"scan_output": { "dtype": "float32", "shape": [8192, 2] }
|
| 61 |
+
},
|
| 62 |
+
"bench": { "metrics": [{ "type": "bandwidth", "value": "2 * 4 * numel(shapes.scan_output)" }] }
|
| 63 |
+
},
|
| 64 |
+
{
|
| 65 |
+
"name": "lowered_PATHO_nonpow2_unaligned_dim1000_steps1000",
|
| 66 |
+
"preset": "smoke",
|
| 67 |
+
"inputs": {
|
| 68 |
+
"m": { "dtype": "uint32", "shape": [1], "data": { "kind": "values", "values": [1000] } },
|
| 69 |
+
"cond": { "dtype": "uint32", "shape": [1], "data": { "kind": "values", "values": [1] } },
|
| 70 |
+
"v_initial": { "dtype": "float32", "shape": [1000], "dist": "normal", "seed": 8109, "scale": 0.1 },
|
| 71 |
+
"step": { "dtype": "float32", "shape": [1000], "dist": "normal", "seed": 8110, "scale": 0.1 }
|
| 72 |
+
},
|
| 73 |
+
"outputs": {
|
| 74 |
+
"v_final": { "dtype": "float32", "shape": [1000] },
|
| 75 |
+
"scan_output": { "dtype": "float32", "shape": [1000, 1000] }
|
| 76 |
+
},
|
| 77 |
+
"bench": { "metrics": [{ "type": "bandwidth", "value": "2 * 4 * numel(shapes.scan_output)" }] }
|
| 78 |
+
}
|
| 79 |
+
]
|
| 80 |
+
}
|
build/webgpu/loop-add-step.wgsl.jinja
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{{ env.wgsl.resourceDeclarations }}
|
| 2 |
+
|
| 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(256)
|
| 7 |
+
fn main(@builtin(global_invocation_id) gid: vec3<u32>) {
|
| 8 |
+
let i = gid.x;
|
| 9 |
+
if (i >= params.dim) { return; }
|
| 10 |
+
let iterations = select(0u, min(m[0], params.scanSteps), cond[0] != 0u);
|
| 11 |
+
var value = v_initial[i];
|
| 12 |
+
for (var t = 0u; t < params.scanSteps; t = t + 1u) {
|
| 13 |
+
if (t < iterations) {
|
| 14 |
+
value = value + step[i];
|
| 15 |
+
scan_output[t * params.dim + i] = value;
|
| 16 |
+
} else {
|
| 17 |
+
scan_output[t * params.dim + i] = 0.0;
|
| 18 |
+
}
|
| 19 |
+
}
|
| 20 |
+
v_final[i] = value;
|
| 21 |
+
}
|
build/webgpu/manifest.json
ADDED
|
@@ -0,0 +1,128 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"domain": "ai.onnx",
|
| 3 |
+
"name": "Loop",
|
| 4 |
+
"conformance": "internal-lowering",
|
| 5 |
+
"sinceVersion": 25,
|
| 6 |
+
"description": "Support status: the standard ONNX `Loop` control-flow operator is not implemented because standalone kernel packages cannot carry or execute its body graph. This internal lowering performs one fixed recurrence—adding `step` to a rank-1 loop-carried tensor for up to `M` iterations while writing a dense scan tensor; `step` is not an ONNX `Loop` input, and this lowering must not be treated as ONNX `Loop`.",
|
| 7 |
+
"inputs": [
|
| 8 |
+
{
|
| 9 |
+
"role": "M",
|
| 10 |
+
"dtype": "I",
|
| 11 |
+
"description": "Required uint32 trip-count limit encoded as either a scalar tensor or a one-element rank-1 tensor. The lowering executes at most `min(M, scan_output.shape[0])` iterations."
|
| 12 |
+
},
|
| 13 |
+
{
|
| 14 |
+
"role": "cond",
|
| 15 |
+
"dtype": "B",
|
| 16 |
+
"description": "Required initial condition encoded as either a scalar tensor or a one-element rank-1 tensor. A false value executes zero iterations; a true value permits all iterations selected by `M`. This fixed lowering does not update the condition inside the loop."
|
| 17 |
+
},
|
| 18 |
+
{
|
| 19 |
+
"role": "v_initial",
|
| 20 |
+
"dtype": "T",
|
| 21 |
+
"rank": 1,
|
| 22 |
+
"description": "Initial rank-1 loop-carried state of shape `[dim]`."
|
| 23 |
+
},
|
| 24 |
+
{
|
| 25 |
+
"role": "step",
|
| 26 |
+
"dtype": "T",
|
| 27 |
+
"rank": 1,
|
| 28 |
+
"description": "Implementation-specific rank-1 increment of shape `[dim]`, added elementwise to the state on every executed iteration. This is not a standard ONNX `Loop` input."
|
| 29 |
+
}
|
| 30 |
+
],
|
| 31 |
+
"outputs": [
|
| 32 |
+
{
|
| 33 |
+
"role": "v_final",
|
| 34 |
+
"dtype": "T",
|
| 35 |
+
"rank": 1,
|
| 36 |
+
"description": "Final rank-1 state of shape `[dim]` after the executed additions.",
|
| 37 |
+
"shape": "shapes.v_initial"
|
| 38 |
+
},
|
| 39 |
+
{
|
| 40 |
+
"role": "scan_output",
|
| 41 |
+
"dtype": "T",
|
| 42 |
+
"rank": 2,
|
| 43 |
+
"description": "Dense tensor of shape `[scan_steps, dim]`. Each executed row contains the updated state for that iteration; rows beyond the executed trip count are zero-filled."
|
| 44 |
+
}
|
| 45 |
+
],
|
| 46 |
+
"typeConstraints": { "T": ["float32"], "I": ["uint32"], "B": ["uint32", "bool"] },
|
| 47 |
+
"args": {
|
| 48 |
+
"m": { "kind": "tensor", "semantic": "M", "role": "input" },
|
| 49 |
+
"cond": { "kind": "tensor", "semantic": "cond", "role": "input" },
|
| 50 |
+
"v_initial": { "kind": "tensor", "semantic": "v_initial", "role": "input" },
|
| 51 |
+
"step": { "kind": "tensor", "semantic": "step", "role": "input" },
|
| 52 |
+
"v_final": { "kind": "tensor", "semantic": "v_final", "role": "output" },
|
| 53 |
+
"scan_output": { "kind": "tensor", "semantic": "scan_output", "role": "output" }
|
| 54 |
+
},
|
| 55 |
+
"variants": [
|
| 56 |
+
{
|
| 57 |
+
"id": "lowered_add_step",
|
| 58 |
+
"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)"],
|
| 59 |
+
"derive": { "dimBlocks": "ceil(dim(shapes.v_initial, 0) / 256)" },
|
| 60 |
+
"passes": [
|
| 61 |
+
{
|
| 62 |
+
"id": "main",
|
| 63 |
+
"name": "Loop",
|
| 64 |
+
"shader": "loop-add-step.wgsl.jinja",
|
| 65 |
+
"bindings": [
|
| 66 |
+
{
|
| 67 |
+
"name": "m",
|
| 68 |
+
"arg": "m",
|
| 69 |
+
"semantic": "M",
|
| 70 |
+
"buffer": { "type": "read-only-storage" },
|
| 71 |
+
"elementType": "u32",
|
| 72 |
+
"length": 1
|
| 73 |
+
},
|
| 74 |
+
{
|
| 75 |
+
"name": "cond",
|
| 76 |
+
"arg": "cond",
|
| 77 |
+
"semantic": "cond",
|
| 78 |
+
"buffer": { "type": "read-only-storage" },
|
| 79 |
+
"elementType": "u32",
|
| 80 |
+
"length": 1
|
| 81 |
+
},
|
| 82 |
+
{
|
| 83 |
+
"name": "v_initial",
|
| 84 |
+
"arg": "v_initial",
|
| 85 |
+
"semantic": "v_initial",
|
| 86 |
+
"buffer": { "type": "read-only-storage" },
|
| 87 |
+
"elementType": "f32"
|
| 88 |
+
},
|
| 89 |
+
{
|
| 90 |
+
"name": "step",
|
| 91 |
+
"arg": "step",
|
| 92 |
+
"semantic": "step",
|
| 93 |
+
"buffer": { "type": "read-only-storage" },
|
| 94 |
+
"elementType": "f32"
|
| 95 |
+
},
|
| 96 |
+
{
|
| 97 |
+
"name": "v_final",
|
| 98 |
+
"arg": "v_final",
|
| 99 |
+
"semantic": "v_final",
|
| 100 |
+
"buffer": { "type": "storage" },
|
| 101 |
+
"elementType": "f32"
|
| 102 |
+
},
|
| 103 |
+
{
|
| 104 |
+
"name": "scan_output",
|
| 105 |
+
"arg": "scan_output",
|
| 106 |
+
"semantic": "scan_output",
|
| 107 |
+
"buffer": { "type": "storage" },
|
| 108 |
+
"elementType": "f32"
|
| 109 |
+
},
|
| 110 |
+
{
|
| 111 |
+
"name": "params",
|
| 112 |
+
"semantic": "kernel.params",
|
| 113 |
+
"buffer": { "type": "uniform" },
|
| 114 |
+
"struct": {
|
| 115 |
+
"name": "Params",
|
| 116 |
+
"fields": [
|
| 117 |
+
{ "name": "dim", "type": "u32", "value": "dim(shapes.v_initial, 0)" },
|
| 118 |
+
{ "name": "scanSteps", "type": "u32", "value": "dim(shapes.scan_output, 0)" }
|
| 119 |
+
]
|
| 120 |
+
}
|
| 121 |
+
}
|
| 122 |
+
],
|
| 123 |
+
"dispatch": { "x": "dimBlocks" }
|
| 124 |
+
}
|
| 125 |
+
]
|
| 126 |
+
}
|
| 127 |
+
]
|
| 128 |
+
}
|
build/webgpu/metadata.json
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"name": "ai.onnx.Loop",
|
| 3 |
+
"id": "_ai_onnx_loop_webgpu_fb2e7a5",
|
| 4 |
+
"version": 1,
|
| 5 |
+
"license": "Apache-2.0",
|
| 6 |
+
"backend": { "type": "webgpu" },
|
| 7 |
+
"digest": {
|
| 8 |
+
"algorithm": "sha256",
|
| 9 |
+
"files": {
|
| 10 |
+
"bench.json": "xq5d0FI/A9ESZ8tyzz5qAxP39qxO5jGxCNji2YREKxI=",
|
| 11 |
+
"loop-add-step.wgsl.jinja": "Sk4601cYmNLKCMIFX47m3mKo2M5oh/fekvOwLOUN1D8=",
|
| 12 |
+
"manifest.json": "C5Kc57/iLS4XSFrNuO6zRpUHfXkgOI8Hm+LlxTfs/eg=",
|
| 13 |
+
"test.json": "UG6yKjMh8XfBVE9AZSF2FfMZjBNwXajveageqJpYjWY="
|
| 14 |
+
}
|
| 15 |
+
},
|
| 16 |
+
"provenance": { "kernel": { "sha": "2e7068faf55e7f43df740015f6d1ee49391a41c5", "dirty": false } },
|
| 17 |
+
"webgpu": { "manifestSpec": "1.0", "specialized": true, "opPath": "ops/ai.onnx.Loop" }
|
| 18 |
+
}
|
build/webgpu/test.json
ADDED
|
@@ -0,0 +1,299 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"op": "ai.onnx.Loop",
|
| 3 |
+
"cases": [
|
| 4 |
+
{
|
| 5 |
+
"name": "lowered_add_step_scan",
|
| 6 |
+
"inputs": {
|
| 7 |
+
"m": { "dtype": "uint32", "shape": [1], "data": { "kind": "values", "values": [4] } },
|
| 8 |
+
"cond": { "dtype": "uint32", "shape": [1], "data": { "kind": "values", "values": [1] } },
|
| 9 |
+
"v_initial": { "dtype": "float32", "shape": [2], "data": { "kind": "values", "values": [1.0, -1.0] } },
|
| 10 |
+
"step": { "dtype": "float32", "shape": [2], "data": { "kind": "values", "values": [0.5, 2.0] } }
|
| 11 |
+
},
|
| 12 |
+
"outputs": {
|
| 13 |
+
"v_final": { "dtype": "float32", "shape": [2], "tolerance": 0.000001 },
|
| 14 |
+
"scan_output": { "dtype": "float32", "shape": [4, 2], "tolerance": 0.000001 }
|
| 15 |
+
}
|
| 16 |
+
},
|
| 17 |
+
{
|
| 18 |
+
"name": "lowered_cond_false_zero_iterations",
|
| 19 |
+
"inputs": {
|
| 20 |
+
"m": { "dtype": "uint32", "shape": [1], "data": { "kind": "values", "values": [3] } },
|
| 21 |
+
"cond": { "dtype": "uint32", "shape": [1], "data": { "kind": "values", "values": [0] } },
|
| 22 |
+
"v_initial": { "dtype": "float32", "shape": [1], "data": { "kind": "values", "values": [7.0] } },
|
| 23 |
+
"step": { "dtype": "float32", "shape": [1], "data": { "kind": "values", "values": [2.0] } }
|
| 24 |
+
},
|
| 25 |
+
"outputs": {
|
| 26 |
+
"v_final": { "dtype": "float32", "shape": [1], "tolerance": 0.000001 },
|
| 27 |
+
"scan_output": { "dtype": "float32", "shape": [3, 1], "tolerance": 0.000001 }
|
| 28 |
+
}
|
| 29 |
+
},
|
| 30 |
+
{
|
| 31 |
+
"name": "lowered_ort_projection_single_iteration_scan_value",
|
| 32 |
+
"provenance": {
|
| 33 |
+
"source": "onnxruntime/test/providers/cpu/controlflow/loop_test.cc",
|
| 34 |
+
"test": "Loop.Opset11WithNoVariadicInputsAndOutputs",
|
| 35 |
+
"notes": "Projection onto the framework's lowered add-step loop: one true iteration produces one scan output value."
|
| 36 |
+
},
|
| 37 |
+
"inputs": {
|
| 38 |
+
"m": { "dtype": "uint32", "shape": [1], "data": { "kind": "values", "values": [1] } },
|
| 39 |
+
"cond": { "dtype": "uint32", "shape": [1], "data": { "kind": "values", "values": [1] } },
|
| 40 |
+
"v_initial": { "dtype": "float32", "shape": [1], "data": { "kind": "values", "values": [0.0] } },
|
| 41 |
+
"step": { "dtype": "float32", "shape": [1], "data": { "kind": "values", "values": [1.0] } }
|
| 42 |
+
},
|
| 43 |
+
"outputs": {
|
| 44 |
+
"v_final": { "dtype": "float32", "shape": [1], "tolerance": 0.000001 },
|
| 45 |
+
"scan_output": { "dtype": "float32", "shape": [1, 1], "tolerance": 0.000001 }
|
| 46 |
+
}
|
| 47 |
+
},
|
| 48 |
+
{
|
| 49 |
+
"name": "lowered_ort_projection_zero_iterations_initial_passthrough",
|
| 50 |
+
"provenance": {
|
| 51 |
+
"source": "onnxruntime/test/providers/cpu/controlflow/loop_test.cc",
|
| 52 |
+
"test": "Loop.ZeroIterations",
|
| 53 |
+
"notes": "Projection onto the framework's lowered add-step loop: trip count zero must leave carried state unchanged and produce no scan elements."
|
| 54 |
+
},
|
| 55 |
+
"inputs": {
|
| 56 |
+
"m": { "dtype": "uint32", "shape": [1], "data": { "kind": "values", "values": [0] } },
|
| 57 |
+
"cond": { "dtype": "uint32", "shape": [1], "data": { "kind": "values", "values": [1] } },
|
| 58 |
+
"v_initial": { "dtype": "float32", "shape": [2], "data": { "kind": "values", "values": [123.0, -456.0] } },
|
| 59 |
+
"step": { "dtype": "float32", "shape": [2], "data": { "kind": "values", "values": [99.0, 99.0] } }
|
| 60 |
+
},
|
| 61 |
+
"outputs": {
|
| 62 |
+
"v_final": { "dtype": "float32", "shape": [2], "tolerance": 0.000001 },
|
| 63 |
+
"scan_output": { "dtype": "float32", "shape": [0, 2], "tolerance": 0.000001 }
|
| 64 |
+
}
|
| 65 |
+
},
|
| 66 |
+
{
|
| 67 |
+
"name": "lowered_ort_projection_exit_due_to_max_iterations",
|
| 68 |
+
"provenance": {
|
| 69 |
+
"source": "onnxruntime/test/providers/cpu/controlflow/loop_test.cc",
|
| 70 |
+
"test": "Loop.ExitDueToMaxIterations",
|
| 71 |
+
"notes": "Projection onto the framework's lowered add-step loop: two iterations advance the carried state and produce two scan values."
|
| 72 |
+
},
|
| 73 |
+
"inputs": {
|
| 74 |
+
"m": { "dtype": "uint32", "shape": [1], "data": { "kind": "values", "values": [2] } },
|
| 75 |
+
"cond": { "dtype": "uint32", "shape": [1], "data": { "kind": "values", "values": [1] } },
|
| 76 |
+
"v_initial": { "dtype": "float32", "shape": [1], "data": { "kind": "values", "values": [0.0] } },
|
| 77 |
+
"step": { "dtype": "float32", "shape": [1], "data": { "kind": "values", "values": [3.0] } }
|
| 78 |
+
},
|
| 79 |
+
"outputs": {
|
| 80 |
+
"v_final": { "dtype": "float32", "shape": [1], "tolerance": 0.000001 },
|
| 81 |
+
"scan_output": { "dtype": "float32", "shape": [2, 1], "tolerance": 0.000001 }
|
| 82 |
+
}
|
| 83 |
+
},
|
| 84 |
+
{
|
| 85 |
+
"name": "lowered_trip_count_exceeds_scan_capacity",
|
| 86 |
+
"inputs": {
|
| 87 |
+
"m": { "dtype": "uint32", "shape": [1], "data": { "kind": "values", "values": [6] } },
|
| 88 |
+
"cond": { "dtype": "uint32", "shape": [1], "data": { "kind": "values", "values": [1] } },
|
| 89 |
+
"v_initial": { "dtype": "float32", "shape": [2], "data": { "kind": "values", "values": [10.0, -10.0] } },
|
| 90 |
+
"step": { "dtype": "float32", "shape": [2], "data": { "kind": "values", "values": [1.0, -2.0] } }
|
| 91 |
+
},
|
| 92 |
+
"outputs": {
|
| 93 |
+
"v_final": { "dtype": "float32", "shape": [2], "tolerance": 0.000001 },
|
| 94 |
+
"scan_output": { "dtype": "float32", "shape": [3, 2], "tolerance": 0.000001 }
|
| 95 |
+
}
|
| 96 |
+
},
|
| 97 |
+
{
|
| 98 |
+
"name": "lowered_zero_trip_count_cond_true",
|
| 99 |
+
"inputs": {
|
| 100 |
+
"m": { "dtype": "uint32", "shape": [1], "data": { "kind": "values", "values": [0] } },
|
| 101 |
+
"cond": { "dtype": "uint32", "shape": [1], "data": { "kind": "values", "values": [1] } },
|
| 102 |
+
"v_initial": { "dtype": "float32", "shape": [1], "data": { "kind": "values", "values": [5.0] } },
|
| 103 |
+
"step": { "dtype": "float32", "shape": [1], "data": { "kind": "values", "values": [99.0] } }
|
| 104 |
+
},
|
| 105 |
+
"outputs": {
|
| 106 |
+
"v_final": { "dtype": "float32", "shape": [1], "tolerance": 0.000001 },
|
| 107 |
+
"scan_output": { "dtype": "float32", "shape": [0, 1], "tolerance": 0.000001 }
|
| 108 |
+
}
|
| 109 |
+
},
|
| 110 |
+
{
|
| 111 |
+
"name": "lowered_trip_count_less_than_scan_capacity_tail_zero",
|
| 112 |
+
"inputs": {
|
| 113 |
+
"m": { "dtype": "uint32", "shape": [1], "data": { "kind": "values", "values": [2] } },
|
| 114 |
+
"cond": { "dtype": "uint32", "shape": [1], "data": { "kind": "values", "values": [1] } },
|
| 115 |
+
"v_initial": { "dtype": "float32", "shape": [2], "data": { "kind": "values", "values": [1.0, -1.0] } },
|
| 116 |
+
"step": { "dtype": "float32", "shape": [2], "data": { "kind": "values", "values": [0.25, -0.5] } }
|
| 117 |
+
},
|
| 118 |
+
"outputs": {
|
| 119 |
+
"v_final": { "dtype": "float32", "shape": [2], "tolerance": 0.000001 },
|
| 120 |
+
"scan_output": { "dtype": "float32", "shape": [5, 2], "tolerance": 0.000001 }
|
| 121 |
+
}
|
| 122 |
+
},
|
| 123 |
+
{
|
| 124 |
+
"name": "lowered_zero_step_preserves_lane",
|
| 125 |
+
"inputs": {
|
| 126 |
+
"m": { "dtype": "uint32", "shape": [1], "data": { "kind": "values", "values": [3] } },
|
| 127 |
+
"cond": { "dtype": "uint32", "shape": [1], "data": { "kind": "values", "values": [1] } },
|
| 128 |
+
"v_initial": { "dtype": "float32", "shape": [3], "data": { "kind": "values", "values": [2.0, -2.0, 5.0] } },
|
| 129 |
+
"step": { "dtype": "float32", "shape": [3], "data": { "kind": "values", "values": [0.0, 1.5, -2.0] } }
|
| 130 |
+
},
|
| 131 |
+
"outputs": {
|
| 132 |
+
"v_final": { "dtype": "float32", "shape": [3], "tolerance": 0.000001 },
|
| 133 |
+
"scan_output": { "dtype": "float32", "shape": [3, 3], "tolerance": 0.000001 }
|
| 134 |
+
}
|
| 135 |
+
},
|
| 136 |
+
{
|
| 137 |
+
"name": "lowered_scalar_trip_count_and_cond",
|
| 138 |
+
"provenance": {
|
| 139 |
+
"source": "onnxruntime/test/providers/cpu/controlflow/loop_test.cc",
|
| 140 |
+
"test": "Loop.ExitDueToMaxIterations",
|
| 141 |
+
"notes": "ONNX Loop trip count and initial condition are scalar values. The project-lowered add-step form should accept scalar logical uint32 metadata as well as [1] tensors."
|
| 142 |
+
},
|
| 143 |
+
"inputs": {
|
| 144 |
+
"m": { "dtype": "uint32", "shape": [], "data": { "kind": "values", "values": [3] } },
|
| 145 |
+
"cond": { "dtype": "uint32", "shape": [], "data": { "kind": "values", "values": [1] } },
|
| 146 |
+
"v_initial": { "dtype": "float32", "shape": [2], "data": { "kind": "values", "values": [1.0, -2.0] } },
|
| 147 |
+
"step": { "dtype": "float32", "shape": [2], "data": { "kind": "values", "values": [0.5, 3.0] } }
|
| 148 |
+
},
|
| 149 |
+
"outputs": {
|
| 150 |
+
"v_final": { "dtype": "float32", "shape": [2], "tolerance": 0.000001 },
|
| 151 |
+
"scan_output": { "dtype": "float32", "shape": [3, 2], "tolerance": 0.000001 }
|
| 152 |
+
}
|
| 153 |
+
},
|
| 154 |
+
{
|
| 155 |
+
"name": "lowered_bool_scalar_cond_true",
|
| 156 |
+
"provenance": {
|
| 157 |
+
"source": "onnxruntime/test/providers/cpu/controlflow/loop_test.cc",
|
| 158 |
+
"test": "Loop.ExitDueToMaxIterations",
|
| 159 |
+
"notes": "ONNX Loop conditions are bool tensors. This lowered add-step projection verifies scalar logical bool storage enables iteration."
|
| 160 |
+
},
|
| 161 |
+
"inputs": {
|
| 162 |
+
"m": { "dtype": "uint32", "shape": [], "data": { "kind": "values", "values": [2] } },
|
| 163 |
+
"cond": { "dtype": "bool", "shape": [], "data": { "kind": "values", "values": [1] } },
|
| 164 |
+
"v_initial": { "dtype": "float32", "shape": [2], "data": { "kind": "values", "values": [2.0, -3.0] } },
|
| 165 |
+
"step": { "dtype": "float32", "shape": [2], "data": { "kind": "values", "values": [4.0, 0.5] } }
|
| 166 |
+
},
|
| 167 |
+
"outputs": {
|
| 168 |
+
"v_final": { "dtype": "float32", "shape": [2], "tolerance": 0 },
|
| 169 |
+
"scan_output": { "dtype": "float32", "shape": [2, 2], "tolerance": 0 }
|
| 170 |
+
}
|
| 171 |
+
},
|
| 172 |
+
{
|
| 173 |
+
"name": "lowered_bool_len1_cond_false_zero_iterations",
|
| 174 |
+
"provenance": {
|
| 175 |
+
"source": "onnxruntime/test/providers/cpu/controlflow/loop_test.cc",
|
| 176 |
+
"test": "Loop.ZeroIterations",
|
| 177 |
+
"notes": "Length-1 logical bool false condition must prevent all iterations, leave state unchanged, and zero-fill the bounded scan output."
|
| 178 |
+
},
|
| 179 |
+
"inputs": {
|
| 180 |
+
"m": { "dtype": "uint32", "shape": [1], "data": { "kind": "values", "values": [5] } },
|
| 181 |
+
"cond": { "dtype": "bool", "shape": [1], "data": { "kind": "values", "values": [0] } },
|
| 182 |
+
"v_initial": { "dtype": "float32", "shape": [3], "data": { "kind": "values", "values": [1.0, -1.0, 10.0] } },
|
| 183 |
+
"step": { "dtype": "float32", "shape": [3], "data": { "kind": "values", "values": [100.0, 100.0, 100.0] } }
|
| 184 |
+
},
|
| 185 |
+
"outputs": {
|
| 186 |
+
"v_final": { "dtype": "float32", "shape": [3], "tolerance": 0 },
|
| 187 |
+
"scan_output": { "dtype": "float32", "shape": [4, 3], "tolerance": 0 }
|
| 188 |
+
}
|
| 189 |
+
},
|
| 190 |
+
{
|
| 191 |
+
"name": "lowered_noncanonical_cond_true_value_two",
|
| 192 |
+
"provenance": {
|
| 193 |
+
"source": "onnxruntime/test/providers/cpu/controlflow/loop_test.cc",
|
| 194 |
+
"test": "Loop.ExitDueToMaxIterations",
|
| 195 |
+
"notes": "ONNX only requires the loop condition to be a bool; runtimes that store it as an integer may emit any nonzero value. The lowered kernel must treat any nonzero cond (here 2) as true via cond[0] != 0u, matching the reference's !== 0 test, not a literal == 1 comparison."
|
| 196 |
+
},
|
| 197 |
+
"inputs": {
|
| 198 |
+
"m": { "dtype": "uint32", "shape": [1], "data": { "kind": "values", "values": [3] } },
|
| 199 |
+
"cond": { "dtype": "uint32", "shape": [1], "data": { "kind": "values", "values": [2] } },
|
| 200 |
+
"v_initial": { "dtype": "float32", "shape": [2], "data": { "kind": "values", "values": [1.0, -1.0] } },
|
| 201 |
+
"step": { "dtype": "float32", "shape": [2], "data": { "kind": "values", "values": [0.5, 2.0] } }
|
| 202 |
+
},
|
| 203 |
+
"outputs": {
|
| 204 |
+
"v_final": { "dtype": "float32", "shape": [2], "tolerance": 0 },
|
| 205 |
+
"scan_output": { "dtype": "float32", "shape": [3, 2], "tolerance": 0 }
|
| 206 |
+
}
|
| 207 |
+
},
|
| 208 |
+
{
|
| 209 |
+
"name": "lowered_trip_count_equals_capacity_full_fill_wide_dim64",
|
| 210 |
+
"provenance": {
|
| 211 |
+
"source": "onnxruntime/test/providers/cpu/controlflow/loop_test.cc",
|
| 212 |
+
"test": "Loop.ExitDueToMaxIterations",
|
| 213 |
+
"notes": "Realistic carried-state width (dim 64, a typical small recurrent hidden size) with trip count exactly equal to the scan capacity so every scan row is produced by an iteration and the tail-zero branch is never taken. Exercises the min(m, scanSteps) clamp at its equality boundary across many lanes."
|
| 214 |
+
},
|
| 215 |
+
"inputs": {
|
| 216 |
+
"m": { "dtype": "uint32", "shape": [1], "data": { "kind": "values", "values": [8] } },
|
| 217 |
+
"cond": { "dtype": "uint32", "shape": [1], "data": { "kind": "values", "values": [1] } },
|
| 218 |
+
"v_initial": {
|
| 219 |
+
"dtype": "float32",
|
| 220 |
+
"shape": [64],
|
| 221 |
+
"data": {
|
| 222 |
+
"kind": "values",
|
| 223 |
+
"values": [-0.5, 0.2, -0.2, 0.5, 0.1, -0.3, 0.4, 0.0, -0.4, 0.3, -0.1, -0.5, 0.2, -0.2, 0.5, 0.1, -0.3, 0.4, 0.0, -0.4, 0.3, -0.1, -0.5, 0.2, -0.2, 0.5, 0.1, -0.3, 0.4, 0.0, -0.4, 0.3, -0.1, -0.5, 0.2, -0.2, 0.5, 0.1, -0.3, 0.4, 0.0, -0.4, 0.3, -0.1, -0.5, 0.2, -0.2, 0.5, 0.1, -0.3, 0.4, 0.0, -0.4, 0.3, -0.1, -0.5, 0.2, -0.2, 0.5, 0.1, -0.3, 0.4, 0.0, -0.4]
|
| 224 |
+
}
|
| 225 |
+
},
|
| 226 |
+
"step": {
|
| 227 |
+
"dtype": "float32",
|
| 228 |
+
"shape": [64],
|
| 229 |
+
"data": {
|
| 230 |
+
"kind": "values",
|
| 231 |
+
"values": [-0.4, 0.1, -0.3, 0.2, -0.2, 0.3, -0.1, 0.4, 0.0, -0.4, 0.1, -0.3, 0.2, -0.2, 0.3, -0.1, 0.4, 0.0, -0.4, 0.1, -0.3, 0.2, -0.2, 0.3, -0.1, 0.4, 0.0, -0.4, 0.1, -0.3, 0.2, -0.2, 0.3, -0.1, 0.4, 0.0, -0.4, 0.1, -0.3, 0.2, -0.2, 0.3, -0.1, 0.4, 0.0, -0.4, 0.1, -0.3, 0.2, -0.2, 0.3, -0.1, 0.4, 0.0, -0.4, 0.1, -0.3, 0.2, -0.2, 0.3, -0.1, 0.4, 0.0, -0.4]
|
| 232 |
+
}
|
| 233 |
+
}
|
| 234 |
+
},
|
| 235 |
+
"outputs": {
|
| 236 |
+
"v_final": { "dtype": "float32", "shape": [64], "tolerance": 0.000001 },
|
| 237 |
+
"scan_output": { "dtype": "float32", "shape": [8, 64], "tolerance": 0.000001 }
|
| 238 |
+
}
|
| 239 |
+
},
|
| 240 |
+
{
|
| 241 |
+
"name": "lowered_clamped_trip_count_partial_fill_wide_dim33_unaligned",
|
| 242 |
+
"provenance": {
|
| 243 |
+
"source": "onnxruntime/test/providers/cpu/controlflow/loop_test.cc",
|
| 244 |
+
"test": "Loop.ExitDueToMaxIterations",
|
| 245 |
+
"notes": "Non-multiple-of-4 carried-state width (dim 33) combined with a trip count larger than the scan capacity. iterations = min(m, scanSteps) clamps to the capacity, the first rows accumulate, and the unaligned final lane must still be written correctly by the scalar per-lane loop with no vec4 over-read at the dim tail."
|
| 246 |
+
},
|
| 247 |
+
"inputs": {
|
| 248 |
+
"m": { "dtype": "uint32", "shape": [1], "data": { "kind": "values", "values": [10] } },
|
| 249 |
+
"cond": { "dtype": "uint32", "shape": [1], "data": { "kind": "values", "values": [1] } },
|
| 250 |
+
"v_initial": {
|
| 251 |
+
"dtype": "float32",
|
| 252 |
+
"shape": [33],
|
| 253 |
+
"data": {
|
| 254 |
+
"kind": "values",
|
| 255 |
+
"values": [-0.5, 0.2, -0.2, 0.5, 0.1, -0.3, 0.4, 0.0, -0.4, 0.3, -0.1, -0.5, 0.2, -0.2, 0.5, 0.1, -0.3, 0.4, 0.0, -0.4, 0.3, -0.1, -0.5, 0.2, -0.2, 0.5, 0.1, -0.3, 0.4, 0.0, -0.4, 0.3, -0.1]
|
| 256 |
+
}
|
| 257 |
+
},
|
| 258 |
+
"step": {
|
| 259 |
+
"dtype": "float32",
|
| 260 |
+
"shape": [33],
|
| 261 |
+
"data": {
|
| 262 |
+
"kind": "values",
|
| 263 |
+
"values": [-0.4, 0.1, -0.3, 0.2, -0.2, 0.3, -0.1, 0.4, 0.0, -0.4, 0.1, -0.3, 0.2, -0.2, 0.3, -0.1, 0.4, 0.0, -0.4, 0.1, -0.3, 0.2, -0.2, 0.3, -0.1, 0.4, 0.0, -0.4, 0.1, -0.3, 0.2, -0.2, 0.3]
|
| 264 |
+
}
|
| 265 |
+
}
|
| 266 |
+
},
|
| 267 |
+
"outputs": {
|
| 268 |
+
"v_final": { "dtype": "float32", "shape": [33], "tolerance": 0.000001 },
|
| 269 |
+
"scan_output": { "dtype": "float32", "shape": [6, 33], "tolerance": 0.000001 }
|
| 270 |
+
}
|
| 271 |
+
},
|
| 272 |
+
{
|
| 273 |
+
"name": "lowered_positive_m_zero_scan_capacity_preserves_initial",
|
| 274 |
+
"inputs": {
|
| 275 |
+
"m": { "dtype": "uint32", "shape": [1], "data": { "kind": "values", "values": [5] } },
|
| 276 |
+
"cond": { "dtype": "uint32", "shape": [1], "data": { "kind": "values", "values": [1] } },
|
| 277 |
+
"v_initial": { "dtype": "float32", "shape": [3], "data": { "kind": "values", "values": [1.0, -2.0, 3.5] } },
|
| 278 |
+
"step": { "dtype": "float32", "shape": [3], "data": { "kind": "values", "values": [100.0, 100.0, 100.0] } }
|
| 279 |
+
},
|
| 280 |
+
"outputs": {
|
| 281 |
+
"v_final": { "dtype": "float32", "shape": [3], "tolerance": 0 },
|
| 282 |
+
"scan_output": { "dtype": "float32", "shape": [0, 3], "tolerance": 0 }
|
| 283 |
+
}
|
| 284 |
+
},
|
| 285 |
+
{
|
| 286 |
+
"name": "lowered_dim_straddles_workgroup_boundary_dim258",
|
| 287 |
+
"inputs": {
|
| 288 |
+
"m": { "dtype": "uint32", "shape": [1], "data": { "kind": "values", "values": [3] } },
|
| 289 |
+
"cond": { "dtype": "uint32", "shape": [1], "data": { "kind": "values", "values": [1] } },
|
| 290 |
+
"v_initial": { "dtype": "float32", "shape": [258], "data": { "kind": "constant", "value": 1.0 } },
|
| 291 |
+
"step": { "dtype": "float32", "shape": [258], "data": { "kind": "constant", "value": 0.5 } }
|
| 292 |
+
},
|
| 293 |
+
"outputs": {
|
| 294 |
+
"v_final": { "dtype": "float32", "shape": [258], "tolerance": 0.000001 },
|
| 295 |
+
"scan_output": { "dtype": "float32", "shape": [3, 258], "tolerance": 0.000001 }
|
| 296 |
+
}
|
| 297 |
+
}
|
| 298 |
+
]
|
| 299 |
+
}
|