sync 2e7068faf55e
Browse files- README.md +70 -0
- build/webgpu/bench.json +94 -0
- build/webgpu/datamove-tile-vec4.wgsl.jinja +52 -0
- build/webgpu/manifest.json +115 -0
- build/webgpu/metadata.json +19 -0
- build/webgpu/test.json +508 -0
- build/webgpu/tile.wgsl.jinja +38 -0
README.md
CHANGED
|
@@ -1,3 +1,73 @@
|
|
| 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.Tile
|
| 10 |
+
|
| 11 |
+
`ai.onnx` · standard ONNX operator · ONNX opset ≥ 13
|
| 12 |
+
|
| 13 |
+
## Description
|
| 14 |
+
|
| 15 |
+
Constructs a tensor by tiling a given tensor: each dimension `i` of the input is repeated `repeats[i]` times, so `output_dim[i] = input_dim[i] * repeats[i]`. Equivalent to NumPy `tile` but without broadcasting.
|
| 16 |
+
|
| 17 |
+
See the [ONNX `Tile` spec](https://onnx.ai/onnx/operators/onnx__Tile.html) for the reference semantics.
|
| 18 |
+
|
| 19 |
+
## Inputs
|
| 20 |
+
|
| 21 |
+
| Name | Bind key | Logical dtype | WebGPU storage | Rank | Shape | Description | Presence |
|
| 22 |
+
| --- | --- | --- | --- | --- | --- | --- | --- |
|
| 23 |
+
| `input` | `input` | `T` | runtime-selected; narrow integers and bool use 32-bit slots | — | — | Input tensor of any shape. | required |
|
| 24 |
+
| `repeats` | `repeats` | `S` | `uint32` | `1` | — | Logical int64 1-D tensor of length equal to the input rank, specifying non-negative repeat counts stored as uint32 by WebGPU. | required |
|
| 25 |
+
|
| 26 |
+
## Outputs
|
| 27 |
+
|
| 28 |
+
| Name | Bind key | Logical dtype | Rank | Shape | Description | Presence |
|
| 29 |
+
| --- | --- | --- | --- | --- | --- | --- |
|
| 30 |
+
| `output` | `output` | `T` | same as `input` | — | Output tensor of the same type as the input, with each dimension scaled by the corresponding repeat count. | required |
|
| 31 |
+
|
| 32 |
+
## Type constraints
|
| 33 |
+
|
| 34 |
+
| Variable | Allowed dtypes |
|
| 35 |
+
| --- | --- |
|
| 36 |
+
| `T` | `float32`, `float16`, `uint32`, `int32`, `int16`, `uint8`, `int8`, `bool` |
|
| 37 |
+
| `S` | `int64` |
|
| 38 |
+
|
| 39 |
+
## Files
|
| 40 |
+
|
| 41 |
+
- [`metadata.json`](build/webgpu/metadata.json) — kernel metadata (id, digests, provenance)
|
| 42 |
+
- [`manifest.json`](build/webgpu/manifest.json) — the op contract (source of truth)
|
| 43 |
+
- [`test.json`](build/webgpu/test.json) — correctness cases
|
| 44 |
+
- [`bench.json`](build/webgpu/bench.json) — benchmark + tuning cases
|
| 45 |
+
- [`datamove-tile-vec4.wgsl.jinja`](build/webgpu/datamove-tile-vec4.wgsl.jinja)
|
| 46 |
+
- [`tile.wgsl.jinja`](build/webgpu/tile.wgsl.jinja)
|
| 47 |
+
|
| 48 |
+
## Use with `@huggingface/kernels`
|
| 49 |
+
|
| 50 |
+
The loader automatically allocates outputs whose metadata it can derive from the manifest contract and this call.
|
| 51 |
+
|
| 52 |
+
The explicit `outputs` entries provide shape and logical dtype metadata for the results listed below:
|
| 53 |
+
|
| 54 |
+
- `output`
|
| 55 |
+
|
| 56 |
+
Each entry either requests an optional result or supplies metadata that cannot be inferred from the inputs.
|
| 57 |
+
|
| 58 |
+
The `version: 1` option selects the published kernel contract; it is independent of any operator opset, contrib `since_version`, or model version.
|
| 59 |
+
|
| 60 |
+
Replace each `*Data` placeholder with a typed array containing the corresponding input data.
|
| 61 |
+
|
| 62 |
+
```js
|
| 63 |
+
import { getKernel } from "@huggingface/kernels";
|
| 64 |
+
|
| 65 |
+
const kernel = await getKernel("webgpu-kernels/ai.onnx.Tile", { version: 1 });
|
| 66 |
+
// Explicit destinations request optional results or supply metadata that cannot be inferred.
|
| 67 |
+
const { output } = await kernel({
|
| 68 |
+
input: { data: inputData, shape: [2, 1, 3] },
|
| 69 |
+
repeats: { data: repeatsData, shape: [3] },
|
| 70 |
+
}, {
|
| 71 |
+
outputs: { output: { shape: [2, 1, 3], dtype: "float32" } },
|
| 72 |
+
});
|
| 73 |
+
```
|
build/webgpu/bench.json
ADDED
|
@@ -0,0 +1,94 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"op": "ai.onnx.Tile",
|
| 3 |
+
"tunableSpace": { "WORKGROUP_SIZE": [64, 128, 256] },
|
| 4 |
+
"cases": [
|
| 5 |
+
{
|
| 6 |
+
"name": "tile-vec4-rows-f32-8x512x1024-repeat4",
|
| 7 |
+
"preset": "smoke",
|
| 8 |
+
"vars": { "dtype": "float32", "outCount": 16777216 },
|
| 9 |
+
"inputs": {
|
| 10 |
+
"input": { "dtype": "float32", "shape": [8, 512, 1024], "dist": "normal", "seed": 878, "scale": 1 },
|
| 11 |
+
"repeats": { "dtype": "uint32", "shape": [3], "data": { "kind": "values", "values": [4, 1, 1] } }
|
| 12 |
+
},
|
| 13 |
+
"outputs": { "output": { "dtype": "float32", "shape": [32, 512, 1024] } },
|
| 14 |
+
"bench": {
|
| 15 |
+
"primary": true,
|
| 16 |
+
"metrics": [{ "type": "bandwidth", "value": "args.outCount * dtypeBytes(args.dtype) * 2" }]
|
| 17 |
+
}
|
| 18 |
+
},
|
| 19 |
+
{
|
| 20 |
+
"name": "rank3",
|
| 21 |
+
"inputs": {
|
| 22 |
+
"input": { "dtype": "float32", "shape": [1, 128, 64] },
|
| 23 |
+
"repeats": { "dtype": "uint32", "shape": [3], "data": { "kind": "values", "values": [4, 1, 1] } }
|
| 24 |
+
},
|
| 25 |
+
"outputs": { "output": { "dtype": "float32", "shape": [4, 128, 64] } }
|
| 26 |
+
},
|
| 27 |
+
{
|
| 28 |
+
"name": "rank1_large_output_from_scalar",
|
| 29 |
+
"preset": "edge",
|
| 30 |
+
"vars": { "dtype": "float32", "count": 1048576 },
|
| 31 |
+
"inputs": {
|
| 32 |
+
"input": { "dtype": "float32", "shape": [1], "dist": "constant", "value": 1 },
|
| 33 |
+
"repeats": { "dtype": "uint32", "shape": [1], "dist": "constant", "value": 1048576 }
|
| 34 |
+
},
|
| 35 |
+
"outputs": { "output": { "dtype": "float32", "shape": [1048576] } },
|
| 36 |
+
"bench": { "metrics": [{ "type": "bandwidth", "value": "args.count * dtypeBytes(args.dtype)" }] }
|
| 37 |
+
},
|
| 38 |
+
{
|
| 39 |
+
"name": "rank5_uniform_repeats",
|
| 40 |
+
"preset": "edge",
|
| 41 |
+
"vars": { "dtype": "float32", "count": 65536 },
|
| 42 |
+
"inputs": {
|
| 43 |
+
"input": { "dtype": "float32", "shape": [1, 8, 1, 8, 1], "dist": "normal", "seed": 877, "scale": 1 },
|
| 44 |
+
"repeats": { "dtype": "uint32", "shape": [5], "dist": "constant", "value": 4 }
|
| 45 |
+
},
|
| 46 |
+
"outputs": { "output": { "dtype": "float32", "shape": [4, 32, 4, 32, 4] } },
|
| 47 |
+
"bench": { "metrics": [{ "type": "bandwidth", "value": "args.count * dtypeBytes(args.dtype)" }] }
|
| 48 |
+
},
|
| 49 |
+
{
|
| 50 |
+
"name": "tile-vec4-rows-f16-8x512x1024-repeat4",
|
| 51 |
+
"preset": "edge",
|
| 52 |
+
"vars": { "dtype": "float16", "outCount": 16777216 },
|
| 53 |
+
"inputs": {
|
| 54 |
+
"input": { "dtype": "float16", "shape": [8, 512, 1024], "dist": "normal", "seed": 879, "scale": 1 },
|
| 55 |
+
"repeats": { "dtype": "uint32", "shape": [3], "data": { "kind": "values", "values": [4, 1, 1] } }
|
| 56 |
+
},
|
| 57 |
+
"outputs": { "output": { "dtype": "float16", "shape": [32, 512, 1024] } },
|
| 58 |
+
"bench": { "metrics": [{ "type": "bandwidth", "value": "args.outCount * dtypeBytes(args.dtype) * 2" }] }
|
| 59 |
+
},
|
| 60 |
+
{
|
| 61 |
+
"name": "tile-lastdim-not-mul4-scalar-cliff-f32-8x512x1023-repeat4",
|
| 62 |
+
"preset": "edge",
|
| 63 |
+
"vars": { "dtype": "float32", "outCount": 16760832 },
|
| 64 |
+
"inputs": {
|
| 65 |
+
"input": { "dtype": "float32", "shape": [8, 512, 1023], "dist": "normal", "seed": 880, "scale": 1 },
|
| 66 |
+
"repeats": { "dtype": "uint32", "shape": [3], "data": { "kind": "values", "values": [4, 1, 1] } }
|
| 67 |
+
},
|
| 68 |
+
"outputs": { "output": { "dtype": "float32", "shape": [32, 512, 1023] } },
|
| 69 |
+
"bench": { "metrics": [{ "type": "bandwidth", "value": "args.outCount * dtypeBytes(args.dtype) * 2" }] }
|
| 70 |
+
},
|
| 71 |
+
{
|
| 72 |
+
"name": "tile-lastaxis-repeat-broadcast-fallback-f32-16x2048-repeat4",
|
| 73 |
+
"preset": "edge",
|
| 74 |
+
"vars": { "dtype": "float32", "outCount": 131072 },
|
| 75 |
+
"inputs": {
|
| 76 |
+
"input": { "dtype": "float32", "shape": [16, 2048], "dist": "normal", "seed": 881, "scale": 1 },
|
| 77 |
+
"repeats": { "dtype": "uint32", "shape": [2], "data": { "kind": "values", "values": [1, 4] } }
|
| 78 |
+
},
|
| 79 |
+
"outputs": { "output": { "dtype": "float32", "shape": [16, 8192] } },
|
| 80 |
+
"bench": { "metrics": [{ "type": "bandwidth", "value": "args.outCount * dtypeBytes(args.dtype) * 2" }] }
|
| 81 |
+
},
|
| 82 |
+
{
|
| 83 |
+
"name": "tile-generic-rank6-deep-fold-lastaxis-repeat-f32-4x4x4x4x4x64",
|
| 84 |
+
"preset": "stress",
|
| 85 |
+
"vars": { "dtype": "float32", "outCount": 131072 },
|
| 86 |
+
"inputs": {
|
| 87 |
+
"input": { "dtype": "float32", "shape": [4, 4, 4, 4, 4, 64], "dist": "normal", "seed": 5301, "scale": 1 },
|
| 88 |
+
"repeats": { "dtype": "uint32", "shape": [6], "data": { "kind": "values", "values": [1, 1, 1, 1, 1, 2] } }
|
| 89 |
+
},
|
| 90 |
+
"outputs": { "output": { "dtype": "float32", "shape": [4, 4, 4, 4, 4, 128] } },
|
| 91 |
+
"bench": { "metrics": [{ "type": "bandwidth", "value": "args.outCount * dtypeBytes(args.dtype) * 2" }] }
|
| 92 |
+
}
|
| 93 |
+
]
|
| 94 |
+
}
|
build/webgpu/datamove-tile-vec4.wgsl.jinja
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// Tile over vec4 elements for repeats that leave the innermost axis unchanged.
|
| 2 |
+
// The equal innermost dimensions are multiples of four, so both buffers bind as
|
| 3 |
+
// vec4<T>. The per-axis modulo fold uses effective shapes whose last dimension
|
| 4 |
+
// is divided by four, enabling 128-bit loads and stores. Axes with repeat == 1
|
| 5 |
+
// skip the modulo entirely.
|
| 6 |
+
{% if usesF16 %}
|
| 7 |
+
enable f16;
|
| 8 |
+
{% endif %}
|
| 9 |
+
{{ env.wgsl.resourceDeclarations }}
|
| 10 |
+
|
| 11 |
+
const COUNT: u32 = {{ source.count }}u;
|
| 12 |
+
const WG: u32 = {{ tunables.WORKGROUP_SIZE }}u;
|
| 13 |
+
|
| 14 |
+
fn input_offset(out_index: u32) -> u32 {
|
| 15 |
+
var rem = out_index;
|
| 16 |
+
var offset = 0u;
|
| 17 |
+
{% for axis in range(source.rank) %}
|
| 18 |
+
{% set out_stride = namespace(value=1) %}
|
| 19 |
+
{% for j in range(axis + 1, source.rank) %}
|
| 20 |
+
{% set dj = ((source.outputShape[j] / 4) | int) if j == source.rank - 1 else source.outputShape[j] %}
|
| 21 |
+
{% set out_stride.value = out_stride.value * dj %}
|
| 22 |
+
{% endfor %}
|
| 23 |
+
{% set safe_out_stride = out_stride.value %}
|
| 24 |
+
{% set input_stride = namespace(value=1) %}
|
| 25 |
+
{% for j in range(axis + 1, source.rank) %}
|
| 26 |
+
{% set dj = ((source.inputShape[j] / 4) | int) if j == source.rank - 1 else source.inputShape[j] %}
|
| 27 |
+
{% set input_stride.value = input_stride.value * dj %}
|
| 28 |
+
{% endfor %}
|
| 29 |
+
{% set in_dim = ((source.inputShape[axis] / 4) | int) if axis == source.rank - 1 else source.inputShape[axis] %}
|
| 30 |
+
{% set out_dim = ((source.outputShape[axis] / 4) | int) if axis == source.rank - 1 else source.outputShape[axis] %}
|
| 31 |
+
{% set safe_in_dim = in_dim %}
|
| 32 |
+
let out_coord{{ axis }} = rem / {{ safe_out_stride }}u;
|
| 33 |
+
rem = rem % {{ safe_out_stride }}u;
|
| 34 |
+
{% if in_dim == out_dim %}
|
| 35 |
+
offset = offset + out_coord{{ axis }} * {{ input_stride.value }}u;
|
| 36 |
+
{% else %}
|
| 37 |
+
offset = offset + (out_coord{{ axis }} % {{ safe_in_dim }}u) * {{ input_stride.value }}u;
|
| 38 |
+
{% endif %}
|
| 39 |
+
{% endfor %}
|
| 40 |
+
return offset;
|
| 41 |
+
}
|
| 42 |
+
|
| 43 |
+
@compute @workgroup_size({{ tunables.WORKGROUP_SIZE }})
|
| 44 |
+
fn main(
|
| 45 |
+
@builtin(global_invocation_id) gid: vec3<u32>,
|
| 46 |
+
@builtin(num_workgroups) nwg: vec3<u32>
|
| 47 |
+
) {
|
| 48 |
+
let stride = nwg.x * WG;
|
| 49 |
+
for (var i = gid.x; i < COUNT; i += stride) {
|
| 50 |
+
output[i] = input[input_offset(i)];
|
| 51 |
+
}
|
| 52 |
+
}
|
build/webgpu/manifest.json
ADDED
|
@@ -0,0 +1,115 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"domain": "ai.onnx",
|
| 3 |
+
"name": "Tile",
|
| 4 |
+
"sinceVersion": 13,
|
| 5 |
+
"description": "Constructs a tensor by tiling a given tensor: each dimension `i` of the input is repeated `repeats[i]` times, so `output_dim[i] = input_dim[i] * repeats[i]`. Equivalent to NumPy `tile` but without broadcasting.",
|
| 6 |
+
"inputs": [
|
| 7 |
+
{ "role": "input", "dtype": "T", "description": "Input tensor of any shape." },
|
| 8 |
+
{
|
| 9 |
+
"role": "repeats",
|
| 10 |
+
"dtype": "S",
|
| 11 |
+
"description": "Logical int64 1-D tensor of length equal to the input rank, specifying non-negative repeat counts stored as uint32 by WebGPU.",
|
| 12 |
+
"rank": 1
|
| 13 |
+
}
|
| 14 |
+
],
|
| 15 |
+
"outputs": [
|
| 16 |
+
{
|
| 17 |
+
"role": "output",
|
| 18 |
+
"dtype": "T",
|
| 19 |
+
"description": "Output tensor of the same type as the input, with each dimension scaled by the corresponding repeat count.",
|
| 20 |
+
"rank": "ranks.input"
|
| 21 |
+
}
|
| 22 |
+
],
|
| 23 |
+
"typeConstraints": {
|
| 24 |
+
"T": ["float32", "float16", "uint32", "int32", "int16", "uint8", "int8", "bool"],
|
| 25 |
+
"S": ["int64"]
|
| 26 |
+
},
|
| 27 |
+
"args": {
|
| 28 |
+
"input": { "kind": "tensor", "semantic": "input", "role": "input" },
|
| 29 |
+
"repeats": { "kind": "tensor", "semantic": "repeats", "role": "repeats", "dtype": "uint32", "narrowing": "checked" },
|
| 30 |
+
"output": { "kind": "tensor", "semantic": "output", "role": "output" }
|
| 31 |
+
},
|
| 32 |
+
"tunables": { "WORKGROUP_SIZE": 256 },
|
| 33 |
+
"constants": { "usesF16": "dtypes.T == \"f16\"" },
|
| 34 |
+
"variants": [
|
| 35 |
+
{
|
| 36 |
+
"id": "inner_vec4",
|
| 37 |
+
"priority": 15,
|
| 38 |
+
"when": ["ranks.input == ranks.output", "ranks.input >= 1", "ranks.repeats == 1", "dim(shapes.repeats, 0) == ranks.input", "numel(shapes.output) > 0", "dim(shapes.input, ranks.input - 1) == dim(shapes.output, ranks.input - 1)", "dim(shapes.input, ranks.input - 1) % 4 == 0", "f16Ok(dtypes.T)"],
|
| 39 |
+
"constants": { "vectorScalar": "\"vec4<\" ~ dtypes.T ~ \">\"" },
|
| 40 |
+
"passes": [
|
| 41 |
+
{
|
| 42 |
+
"id": "main",
|
| 43 |
+
"name": "Tile.innerVec4",
|
| 44 |
+
"source": {
|
| 45 |
+
"shader": "datamove-tile-vec4.wgsl.jinja",
|
| 46 |
+
"inputs": {
|
| 47 |
+
"inputShape": "shapes.input",
|
| 48 |
+
"outputShape": "shapes.output",
|
| 49 |
+
"rank": "ranks.input",
|
| 50 |
+
"count": "numel(shapes.output) / 4"
|
| 51 |
+
}
|
| 52 |
+
},
|
| 53 |
+
"bindings": [
|
| 54 |
+
{
|
| 55 |
+
"name": "input",
|
| 56 |
+
"arg": "input",
|
| 57 |
+
"semantic": "input",
|
| 58 |
+
"buffer": { "type": "read-only-storage" },
|
| 59 |
+
"elementType": "$vectorScalar"
|
| 60 |
+
},
|
| 61 |
+
{
|
| 62 |
+
"name": "output",
|
| 63 |
+
"arg": "output",
|
| 64 |
+
"semantic": "output",
|
| 65 |
+
"buffer": { "type": "storage" },
|
| 66 |
+
"elementType": "$vectorScalar"
|
| 67 |
+
}
|
| 68 |
+
],
|
| 69 |
+
"dispatch": { "gridStride": "numel(shapes.output) / 4", "workgroupSize": "tunables.WORKGROUP_SIZE" }
|
| 70 |
+
}
|
| 71 |
+
]
|
| 72 |
+
},
|
| 73 |
+
{
|
| 74 |
+
"id": "generic",
|
| 75 |
+
"when": ["ranks.input == ranks.output", "ranks.repeats == 1", "dim(shapes.repeats, 0) == ranks.input", "f16Ok(dtypes.T)"],
|
| 76 |
+
"constants": { "scalar": "dtypes.T" },
|
| 77 |
+
"passes": [
|
| 78 |
+
{
|
| 79 |
+
"id": "main",
|
| 80 |
+
"name": "Tile",
|
| 81 |
+
"source": {
|
| 82 |
+
"shader": "tile.wgsl.jinja",
|
| 83 |
+
"inputs": { "inputShape": "shapes.input", "outputShape": "shapes.output", "rank": "ranks.input" }
|
| 84 |
+
},
|
| 85 |
+
"bindings": [
|
| 86 |
+
{
|
| 87 |
+
"name": "input",
|
| 88 |
+
"arg": "input",
|
| 89 |
+
"semantic": "input",
|
| 90 |
+
"buffer": { "type": "read-only-storage" },
|
| 91 |
+
"elementType": "$scalar"
|
| 92 |
+
},
|
| 93 |
+
{
|
| 94 |
+
"name": "output",
|
| 95 |
+
"arg": "output",
|
| 96 |
+
"semantic": "output",
|
| 97 |
+
"buffer": { "type": "storage" },
|
| 98 |
+
"elementType": "$scalar"
|
| 99 |
+
},
|
| 100 |
+
{
|
| 101 |
+
"name": "params",
|
| 102 |
+
"semantic": "kernel.params",
|
| 103 |
+
"buffer": { "type": "uniform" },
|
| 104 |
+
"struct": {
|
| 105 |
+
"name": "Params",
|
| 106 |
+
"fields": [{ "name": "count", "type": "u32", "value": "numel(shapes.output)" }]
|
| 107 |
+
}
|
| 108 |
+
}
|
| 109 |
+
],
|
| 110 |
+
"dispatch": { "threads": "numel(shapes.output)", "workgroupSize": "tunables.WORKGROUP_SIZE" }
|
| 111 |
+
}
|
| 112 |
+
]
|
| 113 |
+
}
|
| 114 |
+
]
|
| 115 |
+
}
|
build/webgpu/metadata.json
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"name": "ai.onnx.Tile",
|
| 3 |
+
"id": "_ai_onnx_tile_webgpu_d5edcce",
|
| 4 |
+
"version": 1,
|
| 5 |
+
"license": "Apache-2.0",
|
| 6 |
+
"backend": { "type": "webgpu" },
|
| 7 |
+
"digest": {
|
| 8 |
+
"algorithm": "sha256",
|
| 9 |
+
"files": {
|
| 10 |
+
"bench.json": "hvniK7wzBksemRGQsj2QyLX/PI60/fACENqZBziTjuM=",
|
| 11 |
+
"datamove-tile-vec4.wgsl.jinja": "CcDLTkiLHX6FWfMQCqjsFx8l5I7A/hjpKXFNTD3yMU4=",
|
| 12 |
+
"manifest.json": "BNBWgAaPI8XFTYVR7q3r0zDz2zipeHZwSoaHysMeEmA=",
|
| 13 |
+
"test.json": "jVFErSBn7O/ciOZlrxjMCymY4EkBVpwYcElrr+Q/Ew4=",
|
| 14 |
+
"tile.wgsl.jinja": "JsV5aQYvf0xn8l27Ads1lZJpZSPQ1umQuk9B2QC5JT0="
|
| 15 |
+
}
|
| 16 |
+
},
|
| 17 |
+
"provenance": { "kernel": { "sha": "2e7068faf55e7f43df740015f6d1ee49391a41c5", "dirty": false } },
|
| 18 |
+
"webgpu": { "manifestSpec": "1.0", "specialized": true, "opPath": "ops/ai.onnx.Tile" }
|
| 19 |
+
}
|
build/webgpu/test.json
ADDED
|
@@ -0,0 +1,508 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"op": "ai.onnx.Tile",
|
| 3 |
+
"cases": [
|
| 4 |
+
{
|
| 5 |
+
"name": "rank2",
|
| 6 |
+
"inputs": {
|
| 7 |
+
"input": { "dtype": "float32", "shape": [2, 2], "data": { "kind": "values", "values": [1.0, 2.0, 3.0, 4.0] } },
|
| 8 |
+
"repeats": { "dtype": "uint32", "shape": [2], "data": { "kind": "values", "values": [2, 3] } }
|
| 9 |
+
},
|
| 10 |
+
"outputs": { "output": { "dtype": "float32", "shape": [4, 6] } }
|
| 11 |
+
},
|
| 12 |
+
{
|
| 13 |
+
"name": "ort_float_2d_two_axes_full_repeat",
|
| 14 |
+
"provenance": {
|
| 15 |
+
"source": "onnxruntime/test/providers/cpu/tensor/tile_op_test.cc",
|
| 16 |
+
"test": "TensorOpTest.TileFloatType",
|
| 17 |
+
"notes": "RunTest<float>({2, 2}, {2, 2}) from ORT's shared Tile wrapper."
|
| 18 |
+
},
|
| 19 |
+
"inputs": {
|
| 20 |
+
"input": { "dtype": "float32", "shape": [2, 2], "data": { "kind": "values", "values": [0.0, 1.0, 2.0, 3.0] } },
|
| 21 |
+
"repeats": { "dtype": "uint32", "shape": [2], "data": { "kind": "values", "values": [2, 2] } }
|
| 22 |
+
},
|
| 23 |
+
"outputs": { "output": { "dtype": "float32", "shape": [4, 4], "tolerance": 0.000001 } }
|
| 24 |
+
},
|
| 25 |
+
{
|
| 26 |
+
"name": "ort_float_2d_first_axis_repeat",
|
| 27 |
+
"provenance": {
|
| 28 |
+
"source": "onnxruntime/test/providers/cpu/tensor/tile_op_test.cc",
|
| 29 |
+
"test": "TensorOpTest.TileFloatType",
|
| 30 |
+
"notes": "RunTest<float>({2, 3}, {2, 1}) from ORT's shared Tile wrapper."
|
| 31 |
+
},
|
| 32 |
+
"inputs": {
|
| 33 |
+
"input": {
|
| 34 |
+
"dtype": "float32",
|
| 35 |
+
"shape": [2, 3],
|
| 36 |
+
"data": { "kind": "values", "values": [0.0, 1.0, 2.0, 3.0, 4.0, 5.0] }
|
| 37 |
+
},
|
| 38 |
+
"repeats": { "dtype": "uint32", "shape": [2], "data": { "kind": "values", "values": [2, 1] } }
|
| 39 |
+
},
|
| 40 |
+
"outputs": { "output": { "dtype": "float32", "shape": [4, 3], "tolerance": 0.000001 } }
|
| 41 |
+
},
|
| 42 |
+
{
|
| 43 |
+
"name": "ort_f16_2d_two_axes_full_repeat",
|
| 44 |
+
"provenance": {
|
| 45 |
+
"source": "onnxruntime/test/providers/cpu/tensor/tile_op_test.cc",
|
| 46 |
+
"test": "TensorOpTest.TileMLFloat16Type",
|
| 47 |
+
"notes": "RunTest<MLFloat16>({2, 2}, {2, 2}) from ORT's shared Tile wrapper."
|
| 48 |
+
},
|
| 49 |
+
"inputs": {
|
| 50 |
+
"input": { "dtype": "float16", "shape": [2, 2], "data": { "kind": "values", "values": [0.0, 1.0, 2.0, 3.0] } },
|
| 51 |
+
"repeats": { "dtype": "uint32", "shape": [2], "data": { "kind": "values", "values": [2, 2] } }
|
| 52 |
+
},
|
| 53 |
+
"outputs": { "output": { "dtype": "float16", "shape": [4, 4], "tolerance": 0.001 } }
|
| 54 |
+
},
|
| 55 |
+
{
|
| 56 |
+
"name": "rank3_f16",
|
| 57 |
+
"inputs": {
|
| 58 |
+
"input": { "dtype": "float16", "shape": [1, 2, 2] },
|
| 59 |
+
"repeats": { "dtype": "uint32", "shape": [3], "data": { "kind": "values", "values": [2, 1, 2] } }
|
| 60 |
+
},
|
| 61 |
+
"outputs": { "output": { "dtype": "float16", "shape": [2, 2, 4] } },
|
| 62 |
+
"tolerance": 0.001
|
| 63 |
+
},
|
| 64 |
+
{
|
| 65 |
+
"name": "rank5_nonuniform_repeats",
|
| 66 |
+
"inputs": {
|
| 67 |
+
"input": {
|
| 68 |
+
"dtype": "float32",
|
| 69 |
+
"shape": [1, 2, 1, 2, 1],
|
| 70 |
+
"data": { "kind": "fillFloat32", "sinStep": 0.19, "cosStep": 0.11 }
|
| 71 |
+
},
|
| 72 |
+
"repeats": { "dtype": "uint32", "shape": [5], "data": { "kind": "values", "values": [2, 1, 3, 1, 4] } }
|
| 73 |
+
},
|
| 74 |
+
"outputs": { "output": { "dtype": "float32", "shape": [2, 2, 3, 2, 4], "tolerance": 0.000001 } }
|
| 75 |
+
},
|
| 76 |
+
{
|
| 77 |
+
"name": "large_output_from_scalar",
|
| 78 |
+
"inputs": {
|
| 79 |
+
"input": { "dtype": "float32", "shape": [1], "data": { "kind": "values", "values": [7.0] } },
|
| 80 |
+
"repeats": { "dtype": "uint32", "shape": [1], "data": { "kind": "values", "values": [257] } }
|
| 81 |
+
},
|
| 82 |
+
"outputs": { "output": { "dtype": "float32", "shape": [257], "tolerance": 0.000001 } }
|
| 83 |
+
},
|
| 84 |
+
{
|
| 85 |
+
"name": "rank6_nonuniform_repeats",
|
| 86 |
+
"inputs": {
|
| 87 |
+
"input": {
|
| 88 |
+
"dtype": "float32",
|
| 89 |
+
"shape": [1, 2, 1, 2, 1, 2],
|
| 90 |
+
"data": { "kind": "fillFloat32", "sinStep": 0.13, "cosStep": 0.19 }
|
| 91 |
+
},
|
| 92 |
+
"repeats": { "dtype": "uint32", "shape": [6], "data": { "kind": "values", "values": [2, 1, 3, 1, 2, 1] } }
|
| 93 |
+
},
|
| 94 |
+
"outputs": { "output": { "dtype": "float32", "shape": [2, 2, 3, 2, 2, 2], "tolerance": 0.000001 } }
|
| 95 |
+
},
|
| 96 |
+
{
|
| 97 |
+
"name": "rank0_scalar_empty_repeats_noop",
|
| 98 |
+
"inputs": {
|
| 99 |
+
"input": { "dtype": "float32", "shape": [], "data": { "kind": "values", "values": [42.5] } },
|
| 100 |
+
"repeats": { "dtype": "uint32", "shape": [0], "data": { "kind": "values", "values": [] } }
|
| 101 |
+
},
|
| 102 |
+
"outputs": { "output": { "dtype": "float32", "shape": [], "tolerance": 0.000001 } }
|
| 103 |
+
},
|
| 104 |
+
{
|
| 105 |
+
"name": "zero_repeat_axis_empty_output",
|
| 106 |
+
"inputs": {
|
| 107 |
+
"input": { "dtype": "float32", "shape": [2, 2], "data": { "kind": "values", "values": [1.0, 2.0, 3.0, 4.0] } },
|
| 108 |
+
"repeats": { "dtype": "uint32", "shape": [2], "data": { "kind": "values", "values": [0, 3] } }
|
| 109 |
+
},
|
| 110 |
+
"outputs": { "output": { "dtype": "float32", "shape": [0, 6], "tolerance": 0 } }
|
| 111 |
+
},
|
| 112 |
+
{
|
| 113 |
+
"name": "ort_int32_1d_zero_repeats",
|
| 114 |
+
"provenance": {
|
| 115 |
+
"source": "onnxruntime/test/providers/cpu/tensor/tile_op_test.cc",
|
| 116 |
+
"test": "TensorOpTest.TileInt32Type",
|
| 117 |
+
"notes": "RunTest<int32_t>({3}, {0})."
|
| 118 |
+
},
|
| 119 |
+
"inputs": {
|
| 120 |
+
"input": { "dtype": "int32", "shape": [3], "data": { "kind": "values", "values": [0, 1, 2] } },
|
| 121 |
+
"repeats": { "dtype": "uint32", "shape": [1], "data": { "kind": "values", "values": [0] } }
|
| 122 |
+
},
|
| 123 |
+
"outputs": { "output": { "dtype": "int32", "shape": [0], "tolerance": 0 } }
|
| 124 |
+
},
|
| 125 |
+
{
|
| 126 |
+
"name": "ort_int32_2d_two_axes",
|
| 127 |
+
"provenance": {
|
| 128 |
+
"source": "onnxruntime/test/providers/cpu/tensor/tile_op_test.cc",
|
| 129 |
+
"test": "TensorOpTest.TileInt32Type",
|
| 130 |
+
"notes": "RunTest<int32_t>({2, 2}, {2, 2})."
|
| 131 |
+
},
|
| 132 |
+
"inputs": {
|
| 133 |
+
"input": { "dtype": "int32", "shape": [2, 2], "data": { "kind": "values", "values": [0, 1, 2, 3] } },
|
| 134 |
+
"repeats": { "dtype": "uint32", "shape": [2], "data": { "kind": "values", "values": [2, 2] } }
|
| 135 |
+
},
|
| 136 |
+
"outputs": { "output": { "dtype": "int32", "shape": [4, 4], "tolerance": 0 } }
|
| 137 |
+
},
|
| 138 |
+
{
|
| 139 |
+
"name": "ort_int16_2d_two_axes",
|
| 140 |
+
"provenance": {
|
| 141 |
+
"source": "onnxruntime/test/providers/cpu/tensor/tile_op_test.cc",
|
| 142 |
+
"test": "TensorOpTest.TileInt16Type",
|
| 143 |
+
"notes": "RunTest<int16_t>({2, 2}, {2, 2})."
|
| 144 |
+
},
|
| 145 |
+
"inputs": {
|
| 146 |
+
"input": { "dtype": "int16", "shape": [2, 2], "data": { "kind": "values", "values": [0, 1, 2, 3] } },
|
| 147 |
+
"repeats": { "dtype": "uint32", "shape": [2], "data": { "kind": "values", "values": [2, 2] } }
|
| 148 |
+
},
|
| 149 |
+
"outputs": { "output": { "dtype": "int16", "shape": [4, 4], "tolerance": 0 } }
|
| 150 |
+
},
|
| 151 |
+
{
|
| 152 |
+
"name": "ort_uint32_3d_middle_repeat",
|
| 153 |
+
"provenance": {
|
| 154 |
+
"source": "onnxruntime/test/providers/cpu/tensor/tile_op_test.cc",
|
| 155 |
+
"test": "TensorOpTest.TileUint32Type",
|
| 156 |
+
"notes": "RunTest<uint32_t>({2, 1, 3}, {1, 2, 1})."
|
| 157 |
+
},
|
| 158 |
+
"inputs": {
|
| 159 |
+
"input": { "dtype": "uint32", "shape": [2, 1, 3], "data": { "kind": "values", "values": [0, 1, 2, 3, 4, 5] } },
|
| 160 |
+
"repeats": { "dtype": "uint32", "shape": [3], "data": { "kind": "values", "values": [1, 2, 1] } }
|
| 161 |
+
},
|
| 162 |
+
"outputs": { "output": { "dtype": "uint32", "shape": [2, 2, 3], "tolerance": 0 } }
|
| 163 |
+
},
|
| 164 |
+
{
|
| 165 |
+
"name": "ort_uint32_large_values_no_float_cast",
|
| 166 |
+
"provenance": {
|
| 167 |
+
"source": "onnxruntime/test/providers/cpu/tensor/tile_op_test.cc",
|
| 168 |
+
"test": "TensorOpTest.TileUint32Type",
|
| 169 |
+
"notes": "Uses the ORT tile copy pattern with large uint32 values to guard against f32 round trips."
|
| 170 |
+
},
|
| 171 |
+
"inputs": {
|
| 172 |
+
"input": { "dtype": "uint32", "shape": [1, 2], "data": { "kind": "values", "values": [16777217, 4000000000] } },
|
| 173 |
+
"repeats": { "dtype": "uint32", "shape": [2], "data": { "kind": "values", "values": [3, 2] } }
|
| 174 |
+
},
|
| 175 |
+
"outputs": { "output": { "dtype": "uint32", "shape": [3, 4], "tolerance": 0 } }
|
| 176 |
+
},
|
| 177 |
+
{
|
| 178 |
+
"name": "ort_int32_singleton_prefix_copy_like",
|
| 179 |
+
"provenance": {
|
| 180 |
+
"source": "onnxruntime/test/providers/cpu/tensor/tile_op_test.cc",
|
| 181 |
+
"test": "TensorOpTest.TileInt32Type",
|
| 182 |
+
"notes": "RunTest<int32_t>({1, 1, 3}, {2, 2, 1})."
|
| 183 |
+
},
|
| 184 |
+
"inputs": {
|
| 185 |
+
"input": { "dtype": "int32", "shape": [1, 1, 3], "data": { "kind": "values", "values": [-7, 0, 9] } },
|
| 186 |
+
"repeats": { "dtype": "uint32", "shape": [3], "data": { "kind": "values", "values": [2, 2, 1] } }
|
| 187 |
+
},
|
| 188 |
+
"outputs": { "output": { "dtype": "int32", "shape": [2, 2, 3], "tolerance": 0 } }
|
| 189 |
+
},
|
| 190 |
+
{
|
| 191 |
+
"name": "ort_int32_singleton_batch_copy_like",
|
| 192 |
+
"provenance": {
|
| 193 |
+
"source": "onnxruntime/test/providers/cpu/tensor/tile_op_test.cc",
|
| 194 |
+
"test": "TensorOpTest.TileInt32Type",
|
| 195 |
+
"notes": "RunTest<int32_t>({1, 1, 3}, {3, 1, 1})."
|
| 196 |
+
},
|
| 197 |
+
"inputs": {
|
| 198 |
+
"input": { "dtype": "int32", "shape": [1, 1, 3], "data": { "kind": "values", "values": [-7, 0, 9] } },
|
| 199 |
+
"repeats": { "dtype": "uint32", "shape": [3], "data": { "kind": "values", "values": [3, 1, 1] } }
|
| 200 |
+
},
|
| 201 |
+
"outputs": { "output": { "dtype": "int32", "shape": [3, 1, 3], "tolerance": 0 } }
|
| 202 |
+
},
|
| 203 |
+
{
|
| 204 |
+
"name": "ort_int32_batched_copy_like",
|
| 205 |
+
"provenance": {
|
| 206 |
+
"source": "onnxruntime/test/providers/cpu/tensor/tile_op_test.cc",
|
| 207 |
+
"test": "TensorOpTest.TileInt32Type",
|
| 208 |
+
"notes": "RunTest<int32_t>({2, 1, 3}, {2, 2, 1})."
|
| 209 |
+
},
|
| 210 |
+
"inputs": {
|
| 211 |
+
"input": { "dtype": "int32", "shape": [2, 1, 3], "data": { "kind": "values", "values": [0, 1, 2, 3, 4, 5] } },
|
| 212 |
+
"repeats": { "dtype": "uint32", "shape": [3], "data": { "kind": "values", "values": [2, 2, 1] } }
|
| 213 |
+
},
|
| 214 |
+
"outputs": { "output": { "dtype": "int32", "shape": [4, 2, 3], "tolerance": 0 } }
|
| 215 |
+
},
|
| 216 |
+
{
|
| 217 |
+
"name": "ort_1d_repeat3_f32",
|
| 218 |
+
"provenance": {
|
| 219 |
+
"source": "onnxruntime/test/providers/cpu/tensor/tile_op_test.cc",
|
| 220 |
+
"test": "TensorOpTest.TileFloatType",
|
| 221 |
+
"notes": "RunTest<float>({3}, {3})."
|
| 222 |
+
},
|
| 223 |
+
"inputs": {
|
| 224 |
+
"input": { "dtype": "float32", "shape": [3], "data": { "kind": "values", "values": [0.0, 1.0, 2.0] } },
|
| 225 |
+
"repeats": { "dtype": "uint32", "shape": [1], "data": { "kind": "values", "values": [3] } }
|
| 226 |
+
},
|
| 227 |
+
"outputs": { "output": { "dtype": "float32", "shape": [9], "tolerance": 0 } }
|
| 228 |
+
},
|
| 229 |
+
{
|
| 230 |
+
"name": "ort_2d_second_axis_zero_repeat",
|
| 231 |
+
"provenance": {
|
| 232 |
+
"source": "onnxruntime/test/providers/cpu/tensor/tile_op_test.cc",
|
| 233 |
+
"test": "TensorOpTest.TileFloatType",
|
| 234 |
+
"notes": "RunTest<float>({2, 2}, {2, 0})."
|
| 235 |
+
},
|
| 236 |
+
"inputs": {
|
| 237 |
+
"input": { "dtype": "float32", "shape": [2, 2], "data": { "kind": "values", "values": [0.0, 1.0, 2.0, 3.0] } },
|
| 238 |
+
"repeats": { "dtype": "uint32", "shape": [2], "data": { "kind": "values", "values": [2, 0] } }
|
| 239 |
+
},
|
| 240 |
+
"outputs": { "output": { "dtype": "float32", "shape": [4, 0], "tolerance": 0 } }
|
| 241 |
+
},
|
| 242 |
+
{
|
| 243 |
+
"name": "ort_rank3_all_repeats_one_noop",
|
| 244 |
+
"provenance": {
|
| 245 |
+
"source": "onnxruntime/test/providers/cpu/tensor/tile_op_test.cc",
|
| 246 |
+
"test": "TensorOpTest.TileFloatType",
|
| 247 |
+
"notes": "RunTest<float>({2, 1, 3}, {1, 1, 1})."
|
| 248 |
+
},
|
| 249 |
+
"inputs": {
|
| 250 |
+
"input": {
|
| 251 |
+
"dtype": "float32",
|
| 252 |
+
"shape": [2, 1, 3],
|
| 253 |
+
"data": { "kind": "values", "values": [0.0, 1.0, 2.0, 3.0, 4.0, 5.0] }
|
| 254 |
+
},
|
| 255 |
+
"repeats": { "dtype": "uint32", "shape": [3], "data": { "kind": "values", "values": [1, 1, 1] } }
|
| 256 |
+
},
|
| 257 |
+
"outputs": { "output": { "dtype": "float32", "shape": [2, 1, 3], "tolerance": 0 } }
|
| 258 |
+
},
|
| 259 |
+
{
|
| 260 |
+
"name": "ort_4d_repeated_middle_spatial",
|
| 261 |
+
"provenance": {
|
| 262 |
+
"source": "onnxruntime/test/providers/cpu/tensor/tile_op_test.cc",
|
| 263 |
+
"test": "TensorOpTest.TileFloatType",
|
| 264 |
+
"notes": "RunTest<float>({1, 2, 3, 4}, {2, 1, 2, 1})."
|
| 265 |
+
},
|
| 266 |
+
"inputs": {
|
| 267 |
+
"input": {
|
| 268 |
+
"dtype": "float32",
|
| 269 |
+
"shape": [1, 2, 3, 4],
|
| 270 |
+
"data": {
|
| 271 |
+
"kind": "values",
|
| 272 |
+
"values": [0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0, 13.0, 14.0, 15.0, 16.0, 17.0, 18.0, 19.0, 20.0, 21.0, 22.0, 23.0]
|
| 273 |
+
}
|
| 274 |
+
},
|
| 275 |
+
"repeats": { "dtype": "uint32", "shape": [4], "data": { "kind": "values", "values": [2, 1, 2, 1] } }
|
| 276 |
+
},
|
| 277 |
+
"outputs": { "output": { "dtype": "float32", "shape": [2, 2, 6, 4], "tolerance": 0 } }
|
| 278 |
+
},
|
| 279 |
+
{
|
| 280 |
+
"name": "ort_rank5_float_nonuniform_repeats",
|
| 281 |
+
"provenance": {
|
| 282 |
+
"source": "onnxruntime/test/providers/cpu/tensor/tile_op_test.cc",
|
| 283 |
+
"test": "TensorOpTest.TileFloatType",
|
| 284 |
+
"notes": "RunTest<float>({2, 3, 2, 3, 2}, {2, 1, 2, 1, 2})."
|
| 285 |
+
},
|
| 286 |
+
"inputs": {
|
| 287 |
+
"input": {
|
| 288 |
+
"dtype": "float32",
|
| 289 |
+
"shape": [2, 3, 2, 3, 2],
|
| 290 |
+
"data": {
|
| 291 |
+
"kind": "values",
|
| 292 |
+
"values": [0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0, 13.0, 14.0, 15.0, 16.0, 17.0, 18.0, 19.0, 20.0, 21.0, 22.0, 23.0, 24.0, 25.0, 26.0, 27.0, 28.0, 29.0, 30.0, 31.0, 32.0, 33.0, 34.0, 35.0, 36.0, 37.0, 38.0, 39.0, 40.0, 41.0, 42.0, 43.0, 44.0, 45.0, 46.0, 47.0, 48.0, 49.0, 50.0, 51.0, 52.0, 53.0, 54.0, 55.0, 56.0, 57.0, 58.0, 59.0, 60.0, 61.0, 62.0, 63.0, 64.0, 65.0, 66.0, 67.0, 68.0, 69.0, 70.0, 71.0]
|
| 293 |
+
}
|
| 294 |
+
},
|
| 295 |
+
"repeats": { "dtype": "uint32", "shape": [5], "data": { "kind": "values", "values": [2, 1, 2, 1, 2] } }
|
| 296 |
+
},
|
| 297 |
+
"outputs": { "output": { "dtype": "float32", "shape": [4, 3, 4, 3, 4], "tolerance": 0 } }
|
| 298 |
+
},
|
| 299 |
+
{
|
| 300 |
+
"name": "onnx_backend_tile_precomputed",
|
| 301 |
+
"inputs": {
|
| 302 |
+
"input": { "dtype": "float32", "shape": [2, 2], "data": { "kind": "values", "values": [0.0, 1.0, 2.0, 3.0] } },
|
| 303 |
+
"repeats": { "dtype": "uint32", "shape": [2], "data": { "kind": "values", "values": [2, 2] } }
|
| 304 |
+
},
|
| 305 |
+
"outputs": { "output": { "dtype": "float32", "shape": [4, 4] } },
|
| 306 |
+
"provenance": {
|
| 307 |
+
"source": "cmake/external/onnx/onnx/backend/test/data/node/test_tile_precomputed",
|
| 308 |
+
"notes": "ONNX int64 metadata/index tensors use framework int32/uint32 slots where representable."
|
| 309 |
+
}
|
| 310 |
+
},
|
| 311 |
+
{
|
| 312 |
+
"name": "onnx_backend_tile",
|
| 313 |
+
"provenance": {
|
| 314 |
+
"source": "cmake/external/onnx/onnx/backend/test/data/node/test_tile",
|
| 315 |
+
"notes": "ONNX repeats are int64 metadata; this framework stores non-negative repeats as uint32 metadata slots."
|
| 316 |
+
},
|
| 317 |
+
"inputs": {
|
| 318 |
+
"input": {
|
| 319 |
+
"dtype": "float32",
|
| 320 |
+
"shape": [2, 3, 4, 5],
|
| 321 |
+
"data": {
|
| 322 |
+
"kind": "values",
|
| 323 |
+
"values": [0.54881352186203, 0.7151893377304077, 0.6027633547782898, 0.5448831915855408, 0.42365479469299316, 0.6458941102027893, 0.4375872015953064, 0.891772985458374, 0.9636627435684204, 0.3834415078163147, 0.7917250394821167, 0.5288949012756348, 0.5680445432662964, 0.9255966544151306, 0.07103605568408966, 0.08712930232286453, 0.020218396559357643, 0.832619845867157, 0.7781567573547363, 0.8700121641159058, 0.978618323802948, 0.7991585731506348, 0.4614793658256531, 0.7805292010307312, 0.11827442795038223, 0.6399210095405579, 0.14335328340530396, 0.9446688890457153, 0.5218483209609985, 0.4146619439125061, 0.26455560326576233, 0.7742336988449097, 0.4561503231525421, 0.568433940410614, 0.018789799883961678, 0.6176354885101318, 0.6120957136154175, 0.6169340014457703, 0.9437480568885803, 0.681820273399353, 0.35950788855552673, 0.43703195452690125, 0.6976311802864075, 0.0602254718542099, 0.6667667031288147, 0.670637845993042, 0.21038256585597992, 0.12892629206180573, 0.31542834639549255, 0.36371076107025146, 0.5701967477798462, 0.4386015236377716, 0.9883738160133362, 0.10204481333494186, 0.20887675881385803, 0.16130951046943665, 0.6531082987785339, 0.25329160690307617, 0.4663107693195343, 0.24442559480667114, 0.15896958112716675, 0.11037514358758926, 0.6563295722007751, 0.13818295300006866, 0.1965823620557785, 0.3687251806259155, 0.8209932446479797, 0.09710127860307693, 0.8379449248313904, 0.0960984081029892, 0.9764594435691833, 0.4686512053012848, 0.9767611026763916, 0.6048455238342285, 0.7392635941505432, 0.03918779268860817, 0.28280696272850037, 0.12019655853509903, 0.296140193939209, 0.11872772127389908, 0.3179831802845001, 0.414262980222702, 0.06414749473333359, 0.6924721002578735, 0.5666014552116394, 0.26538950204849243, 0.5232480764389038, 0.09394051134586334, 0.5759465098381042, 0.9292961955070496, 0.3185689449310303, 0.6674103736877441, 0.13179786503314972, 0.7163271903991699, 0.28940609097480774, 0.18319135904312134, 0.5865129232406616, 0.02010754682123661, 0.8289400339126587, 0.004695476032793522, 0.6778165102005005, 0.2700079679489136, 0.7351940274238586, 0.9621885418891907, 0.2487531453371048, 0.5761573314666748, 0.5920419096946716, 0.5722519159317017, 0.22308163344860077, 0.9527490139007568, 0.4471253752708435, 0.8464086651802063, 0.6994792819023132, 0.2974369525909424, 0.8137978315353394, 0.396505743265152, 0.8811032176017761, 0.5812729001045227, 0.8817353844642639, 0.6925315856933594]
|
| 324 |
+
}
|
| 325 |
+
},
|
| 326 |
+
"repeats": { "dtype": "uint32", "shape": [4], "data": { "kind": "values", "values": [7, 6, 4, 2] } }
|
| 327 |
+
},
|
| 328 |
+
"outputs": { "output": { "dtype": "float32", "shape": [14, 18, 16, 10], "tolerance": 0.000001 } }
|
| 329 |
+
},
|
| 330 |
+
{
|
| 331 |
+
"name": "ort_int8_2d_two_axes_edge_values",
|
| 332 |
+
"provenance": {
|
| 333 |
+
"source": "onnxruntime/test/providers/cpu/tensor/tile_op_test.cc",
|
| 334 |
+
"test": "TensorOpTest.TileInt8Type",
|
| 335 |
+
"notes": "RunTest<int8_t>({2, 2}, {2, 2}) with signed-byte edge values."
|
| 336 |
+
},
|
| 337 |
+
"inputs": {
|
| 338 |
+
"input": { "dtype": "int8", "shape": [2, 2], "data": { "kind": "values", "values": [-128, -1, 0, 127] } },
|
| 339 |
+
"repeats": { "dtype": "uint32", "shape": [2], "data": { "kind": "values", "values": [2, 2] } }
|
| 340 |
+
},
|
| 341 |
+
"outputs": { "output": { "dtype": "int8", "shape": [4, 4], "tolerance": 0 } }
|
| 342 |
+
},
|
| 343 |
+
{
|
| 344 |
+
"name": "ort_uint8_3d_middle_repeat_edge_values",
|
| 345 |
+
"provenance": {
|
| 346 |
+
"source": "onnxruntime/test/providers/cpu/tensor/tile_op_test.cc",
|
| 347 |
+
"test": "TensorOpTest.TileUint8Type",
|
| 348 |
+
"notes": "RunTest<uint8_t>({2, 1, 3}, {1, 2, 1}) with high logical-byte values."
|
| 349 |
+
},
|
| 350 |
+
"inputs": {
|
| 351 |
+
"input": {
|
| 352 |
+
"dtype": "uint8",
|
| 353 |
+
"shape": [2, 1, 3],
|
| 354 |
+
"data": { "kind": "values", "values": [0, 1, 127, 128, 254, 255] }
|
| 355 |
+
},
|
| 356 |
+
"repeats": { "dtype": "uint32", "shape": [3], "data": { "kind": "values", "values": [1, 2, 1] } }
|
| 357 |
+
},
|
| 358 |
+
"outputs": { "output": { "dtype": "uint8", "shape": [2, 2, 3], "tolerance": 0 } }
|
| 359 |
+
},
|
| 360 |
+
{
|
| 361 |
+
"name": "inner_vec4_rank3_f16",
|
| 362 |
+
"inputs": {
|
| 363 |
+
"input": { "dtype": "float16", "shape": [2, 3, 8] },
|
| 364 |
+
"repeats": { "dtype": "uint32", "shape": [3], "data": { "kind": "values", "values": [2, 2, 1] } }
|
| 365 |
+
},
|
| 366 |
+
"outputs": { "output": { "dtype": "float16", "shape": [4, 6, 8], "tolerance": 0.001 } }
|
| 367 |
+
},
|
| 368 |
+
{
|
| 369 |
+
"name": "inner_vec4_u32_large_values",
|
| 370 |
+
"inputs": {
|
| 371 |
+
"input": {
|
| 372 |
+
"dtype": "uint32",
|
| 373 |
+
"shape": [2, 4],
|
| 374 |
+
"data": { "kind": "values", "values": [16777217, 4000000000, 1, 2, 3, 4, 5, 4294967295] }
|
| 375 |
+
},
|
| 376 |
+
"repeats": { "dtype": "uint32", "shape": [2], "data": { "kind": "values", "values": [3, 1] } }
|
| 377 |
+
},
|
| 378 |
+
"outputs": { "output": { "dtype": "uint32", "shape": [6, 4], "tolerance": 0 } }
|
| 379 |
+
},
|
| 380 |
+
{
|
| 381 |
+
"name": "ort_bool_2d_two_axes",
|
| 382 |
+
"provenance": {
|
| 383 |
+
"source": "onnxruntime/test/providers/cpu/tensor/tile_op_test.cc",
|
| 384 |
+
"test": "TensorOpTest.TileBoolType",
|
| 385 |
+
"notes": "RunTestForBool Tile2D_2Axes."
|
| 386 |
+
},
|
| 387 |
+
"inputs": {
|
| 388 |
+
"input": { "dtype": "bool", "shape": [2, 2], "data": { "kind": "values", "values": [1, 0, 1, 0] } },
|
| 389 |
+
"repeats": { "dtype": "uint32", "shape": [2], "data": { "kind": "values", "values": [2, 2] } }
|
| 390 |
+
},
|
| 391 |
+
"outputs": {
|
| 392 |
+
"output": {
|
| 393 |
+
"dtype": "bool",
|
| 394 |
+
"shape": [4, 4],
|
| 395 |
+
"tolerance": 0,
|
| 396 |
+
"data": { "kind": "values", "values": [1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0] }
|
| 397 |
+
}
|
| 398 |
+
}
|
| 399 |
+
},
|
| 400 |
+
{
|
| 401 |
+
"name": "ort_bool_2d_zero_repeat_axis",
|
| 402 |
+
"provenance": {
|
| 403 |
+
"source": "onnxruntime/test/providers/cpu/tensor/tile_op_test.cc",
|
| 404 |
+
"test": "TensorOpTest.TileBoolType",
|
| 405 |
+
"notes": "RunTestForBool Tile2DWithZeroRepeats."
|
| 406 |
+
},
|
| 407 |
+
"inputs": {
|
| 408 |
+
"input": { "dtype": "bool", "shape": [2, 2], "data": { "kind": "values", "values": [1, 0, 1, 0] } },
|
| 409 |
+
"repeats": { "dtype": "uint32", "shape": [2], "data": { "kind": "values", "values": [2, 0] } }
|
| 410 |
+
},
|
| 411 |
+
"outputs": {
|
| 412 |
+
"output": { "dtype": "bool", "shape": [4, 0], "data": { "kind": "values", "values": [] }, "tolerance": 0 }
|
| 413 |
+
}
|
| 414 |
+
},
|
| 415 |
+
{
|
| 416 |
+
"name": "rank7_unit_input_alternating_repeats",
|
| 417 |
+
"provenance": {
|
| 418 |
+
"source": "ONNX Tile spec (no rank limit) + onnxruntime CPU Tile kernel",
|
| 419 |
+
"notes": "Spec-valid rank-7 Tile. ORT CPU computes it via its generic strided copy."
|
| 420 |
+
},
|
| 421 |
+
"inputs": {
|
| 422 |
+
"input": {
|
| 423 |
+
"dtype": "float32",
|
| 424 |
+
"shape": [2, 1, 2, 1, 2, 1, 2],
|
| 425 |
+
"data": {
|
| 426 |
+
"kind": "values",
|
| 427 |
+
"values": [0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0, 11.0, 12.0, 13.0, 14.0, 15.0]
|
| 428 |
+
}
|
| 429 |
+
},
|
| 430 |
+
"repeats": { "dtype": "uint32", "shape": [7], "data": { "kind": "values", "values": [1, 2, 1, 2, 1, 2, 1] } }
|
| 431 |
+
},
|
| 432 |
+
"outputs": { "output": { "dtype": "float32", "shape": [2, 2, 2, 2, 2, 2, 2], "tolerance": 0 } }
|
| 433 |
+
},
|
| 434 |
+
{
|
| 435 |
+
"name": "inner_vec4_rank4_f16_middle_repeats",
|
| 436 |
+
"inputs": {
|
| 437 |
+
"input": {
|
| 438 |
+
"dtype": "float16",
|
| 439 |
+
"shape": [2, 3, 2, 8],
|
| 440 |
+
"data": { "kind": "fillFloat32", "sinStep": 0.17, "cosStep": 0.13 }
|
| 441 |
+
},
|
| 442 |
+
"repeats": { "dtype": "uint32", "shape": [4], "data": { "kind": "values", "values": [2, 1, 3, 1] } }
|
| 443 |
+
},
|
| 444 |
+
"outputs": { "output": { "dtype": "float16", "shape": [4, 3, 6, 8], "tolerance": 0.001 } }
|
| 445 |
+
},
|
| 446 |
+
{
|
| 447 |
+
"name": "inner_vec4_rank7_lastdim_mul4_outer_repeats",
|
| 448 |
+
"inputs": {
|
| 449 |
+
"input": {
|
| 450 |
+
"dtype": "float32",
|
| 451 |
+
"shape": [2, 1, 2, 1, 2, 1, 8],
|
| 452 |
+
"data": { "kind": "fillFloat32", "sinStep": 0.13, "cosStep": 0.23 }
|
| 453 |
+
},
|
| 454 |
+
"repeats": { "dtype": "uint32", "shape": [7], "data": { "kind": "values", "values": [2, 1, 2, 1, 2, 1, 1] } }
|
| 455 |
+
},
|
| 456 |
+
"outputs": { "output": { "dtype": "float32", "shape": [4, 1, 4, 1, 4, 1, 8], "tolerance": 0 } }
|
| 457 |
+
},
|
| 458 |
+
{
|
| 459 |
+
"name": "generic_rank6_lastaxis_repeat_broadcast_fold",
|
| 460 |
+
"inputs": {
|
| 461 |
+
"input": {
|
| 462 |
+
"dtype": "float32",
|
| 463 |
+
"shape": [2, 1, 3, 1, 2, 5],
|
| 464 |
+
"data": { "kind": "fillFloat32", "sinStep": 0.17, "cosStep": 0.29 }
|
| 465 |
+
},
|
| 466 |
+
"repeats": { "dtype": "uint32", "shape": [6], "data": { "kind": "values", "values": [2, 3, 1, 2, 1, 3] } }
|
| 467 |
+
},
|
| 468 |
+
"outputs": { "output": { "dtype": "float32", "shape": [4, 3, 3, 2, 2, 15], "tolerance": 0 } }
|
| 469 |
+
},
|
| 470 |
+
{
|
| 471 |
+
"name": "inner_vec4_int8_lastdim_mul4_outer_repeat",
|
| 472 |
+
"inputs": {
|
| 473 |
+
"input": {
|
| 474 |
+
"dtype": "int8",
|
| 475 |
+
"shape": [2, 8],
|
| 476 |
+
"data": { "kind": "values", "values": [-128, 127, 0, -1, 1, -2, 64, -64, 100, -100, 7, -7, 3, -3, 15, -15] }
|
| 477 |
+
},
|
| 478 |
+
"repeats": { "dtype": "uint32", "shape": [2], "data": { "kind": "values", "values": [3, 1] } }
|
| 479 |
+
},
|
| 480 |
+
"outputs": { "output": { "dtype": "int8", "shape": [6, 8], "tolerance": 0 } }
|
| 481 |
+
},
|
| 482 |
+
{
|
| 483 |
+
"name": "rank8_unit_input_alternating_repeats",
|
| 484 |
+
"inputs": {
|
| 485 |
+
"input": {
|
| 486 |
+
"dtype": "float32",
|
| 487 |
+
"shape": [2, 1, 2, 1, 2, 1, 2, 1],
|
| 488 |
+
"data": { "kind": "linspace", "start": 0.0, "end": 15.0 }
|
| 489 |
+
},
|
| 490 |
+
"repeats": { "dtype": "uint32", "shape": [8], "data": { "kind": "values", "values": [1, 2, 1, 2, 1, 2, 1, 2] } }
|
| 491 |
+
},
|
| 492 |
+
"outputs": { "output": { "dtype": "float32", "shape": [2, 2, 2, 2, 2, 2, 2, 2], "tolerance": 0 } }
|
| 493 |
+
},
|
| 494 |
+
{
|
| 495 |
+
"name": "empty_input_axis_generic",
|
| 496 |
+
"provenance": {
|
| 497 |
+
"notes": "An empty INPUT axis, as opposed to the zero-repeat cases which empty the OUTPUT while every input extent stays positive. The generic route divides the output coordinate by the input extent on each axis, and only this shape drives that extent to zero; the vec4 route cannot, because its guard requires a non-empty output."
|
| 498 |
+
},
|
| 499 |
+
"inputs": {
|
| 500 |
+
"input": { "dtype": "float32", "shape": [0, 3], "data": { "kind": "values", "values": [] } },
|
| 501 |
+
"repeats": { "dtype": "uint32", "shape": [2], "data": { "kind": "values", "values": [2, 2] } }
|
| 502 |
+
},
|
| 503 |
+
"outputs": {
|
| 504 |
+
"output": { "dtype": "float32", "shape": [0, 6], "tolerance": 0, "data": { "kind": "values", "values": [] } }
|
| 505 |
+
}
|
| 506 |
+
}
|
| 507 |
+
]
|
| 508 |
+
}
|
build/webgpu/tile.wgsl.jinja
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{% if usesF16 %}
|
| 2 |
+
enable f16;
|
| 3 |
+
{% endif %}
|
| 4 |
+
{{ env.wgsl.resourceDeclarations }}
|
| 5 |
+
|
| 6 |
+
fn input_offset({% if source.rank > 0 %}out_index: u32{% endif %}) -> u32 {
|
| 7 |
+
{% if source.rank > 0 %}
|
| 8 |
+
var rem = out_index;
|
| 9 |
+
{% endif %}
|
| 10 |
+
var offset = 0u;
|
| 11 |
+
{% for axis in range(source.rank) %}
|
| 12 |
+
{% set out_stride = namespace(value=1) %}
|
| 13 |
+
{% for j in range(axis + 1, source.rank) %}
|
| 14 |
+
{% set out_stride.value = out_stride.value * source.outputShape[j] %}
|
| 15 |
+
{% endfor %}
|
| 16 |
+
{% set safe_out_stride = 1 if out_stride.value == 0 else out_stride.value %}
|
| 17 |
+
{% set input_stride = namespace(value=1) %}
|
| 18 |
+
{% for j in range(axis + 1, source.rank) %}
|
| 19 |
+
{% set input_stride.value = input_stride.value * source.inputShape[j] %}
|
| 20 |
+
{% endfor %}
|
| 21 |
+
{% set safe_input_dim = 1 if source.inputShape[axis] == 0 else source.inputShape[axis] %}
|
| 22 |
+
let out_coord{{ axis }} = rem / {{ safe_out_stride }}u;
|
| 23 |
+
rem = rem % {{ safe_out_stride }}u;
|
| 24 |
+
offset = offset + (out_coord{{ axis }} % {{ safe_input_dim }}u) * {{ input_stride.value }}u;
|
| 25 |
+
{% endfor %}
|
| 26 |
+
return offset;
|
| 27 |
+
}
|
| 28 |
+
|
| 29 |
+
@compute @workgroup_size({{ tunables.WORKGROUP_SIZE }})
|
| 30 |
+
fn main(@builtin(global_invocation_id) gid: vec3<u32>, @builtin(num_workgroups) nwg: vec3<u32>) {
|
| 31 |
+
// 2D-folded flat index: gid.y carries the high bits past the
|
| 32 |
+
// maxComputeWorkgroupsPerDimension limit.
|
| 33 |
+
let i = gid.x + gid.y * nwg.x * {{ tunables.WORKGROUP_SIZE }}u;
|
| 34 |
+
if (i >= params.count) {
|
| 35 |
+
return;
|
| 36 |
+
}
|
| 37 |
+
output[i] = input[input_offset({% if source.rank > 0 %}i{% endif %})];
|
| 38 |
+
}
|