sync 2e7068faf55e
Browse files- README.md +68 -0
- build/webgpu/bench.json +51 -0
- build/webgpu/eyelike-clear-vec4.wgsl.jinja +58 -0
- build/webgpu/eyelike-diagonal.wgsl.jinja +46 -0
- build/webgpu/eyelike.wgsl.jinja +45 -0
- build/webgpu/manifest.json +146 -0
- build/webgpu/metadata.json +20 -0
- build/webgpu/test.json +316 -0
README.md
CHANGED
|
@@ -1,3 +1,71 @@
|
|
| 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.EyeLike
|
| 10 |
+
|
| 11 |
+
`ai.onnx` · standard ONNX operator · ONNX opset ≥ 22
|
| 12 |
+
|
| 13 |
+
## Description
|
| 14 |
+
|
| 15 |
+
Generates a 2D identity-like matrix with ones on (or offset from) the main diagonal and zeros everywhere else. The output has the same shape as the 2D input tensor; the output dtype defaults to the input dtype but can be overridden. Attribute `k` shifts the populated diagonal: `k=0` is the main diagonal, `k>0` is upper, `k<0` is lower.
|
| 16 |
+
|
| 17 |
+
See the [ONNX `EyeLike` spec](https://onnx.ai/onnx/operators/onnx__EyeLike.html) for the reference semantics.
|
| 18 |
+
|
| 19 |
+
## Inputs
|
| 20 |
+
|
| 21 |
+
| Name | Bind key | Logical dtype | Rank | Shape | Description | Presence |
|
| 22 |
+
| --- | --- | --- | --- | --- | --- | --- |
|
| 23 |
+
| `input` | `input` | `T1` | `2` | — | 2D input tensor whose shape (and optionally type) is copied. | required |
|
| 24 |
+
|
| 25 |
+
## Outputs
|
| 26 |
+
|
| 27 |
+
| Name | Bind key | Logical dtype | Rank | Shape | Description | Presence |
|
| 28 |
+
| --- | --- | --- | --- | --- | --- | --- |
|
| 29 |
+
| `output` | `output` | `T2` | same as `input` | same as `input` | Output tensor of the same shape as the input, with ones on the selected diagonal and zeros elsewhere. | required |
|
| 30 |
+
|
| 31 |
+
## Attributes
|
| 32 |
+
|
| 33 |
+
Attributes and default values (overridable per request):
|
| 34 |
+
|
| 35 |
+
| Attribute | Default | Description |
|
| 36 |
+
| --- | --- | --- |
|
| 37 |
+
| `k` | `0` | Index of the diagonal to populate with ones: `0` is the main diagonal, positive values select upper diagonals, negative values select lower diagonals. |
|
| 38 |
+
| `dtype` | — | Optional TensorProto DataType enum for the output. When omitted, the output dtype is the same as the input dtype. |
|
| 39 |
+
|
| 40 |
+
## Type constraints
|
| 41 |
+
|
| 42 |
+
| Variable | Allowed dtypes |
|
| 43 |
+
| --- | --- |
|
| 44 |
+
| `T1` | `float32`, `float16`, `uint32`, `int32`, `int16`, `uint8`, `int8`, `bool` |
|
| 45 |
+
| `T2` | `float32`, `float16`, `uint32`, `int32`, `int16`, `uint8`, `int8`, `bool` |
|
| 46 |
+
|
| 47 |
+
## Files
|
| 48 |
+
|
| 49 |
+
- [`metadata.json`](build/webgpu/metadata.json) — kernel metadata (id, digests, provenance)
|
| 50 |
+
- [`manifest.json`](build/webgpu/manifest.json) — the op contract (source of truth)
|
| 51 |
+
- [`test.json`](build/webgpu/test.json) — correctness cases
|
| 52 |
+
- [`bench.json`](build/webgpu/bench.json) — benchmark + tuning cases
|
| 53 |
+
- [`eyelike-clear-vec4.wgsl.jinja`](build/webgpu/eyelike-clear-vec4.wgsl.jinja)
|
| 54 |
+
- [`eyelike-diagonal.wgsl.jinja`](build/webgpu/eyelike-diagonal.wgsl.jinja)
|
| 55 |
+
- [`eyelike.wgsl.jinja`](build/webgpu/eyelike.wgsl.jinja)
|
| 56 |
+
|
| 57 |
+
## Use with `@huggingface/kernels`
|
| 58 |
+
|
| 59 |
+
The loader derives every required output's shape and logical dtype from the manifest contract and this call.
|
| 60 |
+
It then allocates the result tensors automatically.
|
| 61 |
+
|
| 62 |
+
The `version: 1` option selects the published kernel contract; it is independent of any operator opset, contrib `since_version`, or model version.
|
| 63 |
+
|
| 64 |
+
Replace each `*Data` placeholder with a typed array containing the corresponding input data.
|
| 65 |
+
|
| 66 |
+
```js
|
| 67 |
+
import { getKernel } from "@huggingface/kernels";
|
| 68 |
+
|
| 69 |
+
const kernel = await getKernel("webgpu-kernels/ai.onnx.EyeLike", { version: 1 });
|
| 70 |
+
const { output } = await kernel({ input: { data: inputData, shape: [2, 2] } });
|
| 71 |
+
```
|
build/webgpu/bench.json
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"op": "ai.onnx.EyeLike",
|
| 3 |
+
"cases": [
|
| 4 |
+
{
|
| 5 |
+
"name": "eyelike-f32-2048-square",
|
| 6 |
+
"inputs": { "input": { "dtype": "float32", "shape": [2048, 2048] } },
|
| 7 |
+
"outputs": { "output": { "dtype": "float32", "shape": [2048, 2048] } }
|
| 8 |
+
},
|
| 9 |
+
{
|
| 10 |
+
"name": "eyelike-f32-4097-square-tail-healthy",
|
| 11 |
+
"preset": "smoke",
|
| 12 |
+
"vars": { "dtype": "float32", "count": 16785409 },
|
| 13 |
+
"inputs": { "input": { "dtype": "float32", "shape": [4097, 4097] } },
|
| 14 |
+
"outputs": { "output": { "dtype": "float32", "shape": [4097, 4097] } },
|
| 15 |
+
"bench": { "primary": true, "metrics": [{ "type": "bandwidth", "value": "args.count * dtypeBytes(args.dtype)" }] }
|
| 16 |
+
},
|
| 17 |
+
{
|
| 18 |
+
"name": "eyelike-f16-4096-square-narrow-store",
|
| 19 |
+
"preset": "smoke",
|
| 20 |
+
"vars": { "dtype": "float16", "count": 16777216 },
|
| 21 |
+
"inputs": { "input": { "dtype": "float16", "shape": [4096, 4096] } },
|
| 22 |
+
"outputs": { "output": { "dtype": "float16", "shape": [4096, 4096] } },
|
| 23 |
+
"bench": { "metrics": [{ "type": "bandwidth", "value": "args.count * dtypeBytes(args.dtype)" }] }
|
| 24 |
+
},
|
| 25 |
+
{
|
| 26 |
+
"name": "eyelike-int8-4096-square-word-store-pathology",
|
| 27 |
+
"preset": "smoke",
|
| 28 |
+
"vars": { "dtype": "int8", "count": 16777216 },
|
| 29 |
+
"inputs": { "input": { "dtype": "int8", "shape": [4096, 4096] } },
|
| 30 |
+
"outputs": { "output": { "dtype": "int8", "shape": [4096, 4096] } },
|
| 31 |
+
"bench": { "metrics": [{ "type": "bandwidth", "value": "args.count * 4" }] }
|
| 32 |
+
},
|
| 33 |
+
{
|
| 34 |
+
"name": "eyelike-f32-134m-2dfold-dispatch-cliff",
|
| 35 |
+
"preset": "stress",
|
| 36 |
+
"provenance": { "notes": "Stress-only capacity case: the input and output together occupy 1 GiB of GPU storage." },
|
| 37 |
+
"vars": { "dtype": "float32", "count": 134217728 },
|
| 38 |
+
"inputs": { "input": { "dtype": "float32", "shape": [16384, 8192] } },
|
| 39 |
+
"outputs": { "output": { "dtype": "float32", "shape": [16384, 8192] } },
|
| 40 |
+
"bench": { "metrics": [{ "type": "bandwidth", "value": "args.count * dtypeBytes(args.dtype)" }] }
|
| 41 |
+
},
|
| 42 |
+
{
|
| 43 |
+
"name": "eyelike-f32-8192-square-long-context-mask",
|
| 44 |
+
"preset": "stress",
|
| 45 |
+
"vars": { "dtype": "float32", "count": 67108864 },
|
| 46 |
+
"inputs": { "input": { "dtype": "float32", "shape": [8192, 8192] } },
|
| 47 |
+
"outputs": { "output": { "dtype": "float32", "shape": [8192, 8192] } },
|
| 48 |
+
"bench": { "primary": true, "metrics": [{ "type": "bandwidth", "value": "args.count * dtypeBytes(args.dtype)" }] }
|
| 49 |
+
}
|
| 50 |
+
]
|
| 51 |
+
}
|
build/webgpu/eyelike-clear-vec4.wgsl.jinja
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{% macro flat_index_2d(name="i", bound="params.count", guardInline=false, note="dispatch-limit") %}
|
| 2 |
+
{% if note == "dispatch-limit" %}
|
| 3 |
+
// 2D-folded flat index: gid.y carries the high bits past the
|
| 4 |
+
// maxComputeWorkgroupsPerDimension dispatch limit (outputs > 16.7M elements).
|
| 5 |
+
{% elif note == "limit" %}
|
| 6 |
+
// 2D-folded flat index: gid.y carries the high bits past the
|
| 7 |
+
// maxComputeWorkgroupsPerDimension limit.
|
| 8 |
+
{% elif note == "device-axis" %}
|
| 9 |
+
// The flat dispatch is folded across x/y at the device's per-axis workgroup
|
| 10 |
+
// limit; gid.y carries the high portion of the output index.
|
| 11 |
+
{% elif note == "vec4-limit" %}
|
| 12 |
+
// 2D-folded flat vec4 index: gid.y carries the high bits past the
|
| 13 |
+
// maxComputeWorkgroupsPerDimension limit (the dispatch caps x and spills into y).
|
| 14 |
+
{% elif note == "element-limit" %}
|
| 15 |
+
// 2D-folded flat element index: gid.y carries the high bits past the
|
| 16 |
+
// maxComputeWorkgroupsPerDimension limit.
|
| 17 |
+
{% elif note == "dispatch" %}
|
| 18 |
+
// 2D-folded flat index: gid.y carries the high bits past the
|
| 19 |
+
// maxComputeWorkgroupsPerDimension dispatch limit.
|
| 20 |
+
{% endif %}
|
| 21 |
+
{% if bound == "" %}
|
| 22 |
+
let {{ name }} = gid.x + gid.y * nwg.x * {{ tunables.WORKGROUP_SIZE }}u;
|
| 23 |
+
{%- elif guardInline %}
|
| 24 |
+
let {{ name }} = gid.x + gid.y * nwg.x * {{ tunables.WORKGROUP_SIZE }}u;
|
| 25 |
+
if ({{ name }} >= {{ bound }}) { return; }
|
| 26 |
+
{%- else %}
|
| 27 |
+
let {{ name }} = gid.x + gid.y * nwg.x * {{ tunables.WORKGROUP_SIZE }}u;
|
| 28 |
+
if ({{ name }} >= {{ bound }}) {
|
| 29 |
+
return;
|
| 30 |
+
}
|
| 31 |
+
{%- endif %}
|
| 32 |
+
{% endmacro %}
|
| 33 |
+
|
| 34 |
+
{% if usesF16 %}
|
| 35 |
+
enable f16;
|
| 36 |
+
{% endif %}
|
| 37 |
+
{{ env.wgsl.resourceDeclarations }}
|
| 38 |
+
|
| 39 |
+
const COUNT4: u32 = {{ source.count4 }}u;
|
| 40 |
+
{% if tailSafe %}
|
| 41 |
+
const COUNT: u32 = {{ source.count }}u;
|
| 42 |
+
|
| 43 |
+
{% endif %}
|
| 44 |
+
@compute @workgroup_size({{ tunables.WORKGROUP_SIZE }})
|
| 45 |
+
fn main(@builtin(global_invocation_id) gid: vec3<u32>, @builtin(num_workgroups) nwg: vec3<u32>) {
|
| 46 |
+
{{ flat_index_2d("q", "", note="") }}
|
| 47 |
+
if (q < COUNT4) {
|
| 48 |
+
{% if tailSafe %}
|
| 49 |
+
let base = q * 4u;
|
| 50 |
+
output[base] = {{ outScalar }}(0);
|
| 51 |
+
if (base + 1u < COUNT) { output[base + 1u] = {{ outScalar }}(0); }
|
| 52 |
+
if (base + 2u < COUNT) { output[base + 2u] = {{ outScalar }}(0); }
|
| 53 |
+
if (base + 3u < COUNT) { output[base + 3u] = {{ outScalar }}(0); }
|
| 54 |
+
{% else %}
|
| 55 |
+
output[q] = {{ outVector }}({{ outScalar }}(0));
|
| 56 |
+
{% endif %}
|
| 57 |
+
}
|
| 58 |
+
}
|
build/webgpu/eyelike-diagonal.wgsl.jinja
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{% macro flat_index_2d(name="i", bound="params.count", guardInline=false, note="dispatch-limit") %}
|
| 2 |
+
{% if note == "dispatch-limit" %}
|
| 3 |
+
// 2D-folded flat index: gid.y carries the high bits past the
|
| 4 |
+
// maxComputeWorkgroupsPerDimension dispatch limit (outputs > 16.7M elements).
|
| 5 |
+
{% elif note == "limit" %}
|
| 6 |
+
// 2D-folded flat index: gid.y carries the high bits past the
|
| 7 |
+
// maxComputeWorkgroupsPerDimension limit.
|
| 8 |
+
{% elif note == "device-axis" %}
|
| 9 |
+
// The flat dispatch is folded across x/y at the device's per-axis workgroup
|
| 10 |
+
// limit; gid.y carries the high portion of the output index.
|
| 11 |
+
{% elif note == "vec4-limit" %}
|
| 12 |
+
// 2D-folded flat vec4 index: gid.y carries the high bits past the
|
| 13 |
+
// maxComputeWorkgroupsPerDimension limit (the dispatch caps x and spills into y).
|
| 14 |
+
{% elif note == "element-limit" %}
|
| 15 |
+
// 2D-folded flat element index: gid.y carries the high bits past the
|
| 16 |
+
// maxComputeWorkgroupsPerDimension limit.
|
| 17 |
+
{% elif note == "dispatch" %}
|
| 18 |
+
// 2D-folded flat index: gid.y carries the high bits past the
|
| 19 |
+
// maxComputeWorkgroupsPerDimension dispatch limit.
|
| 20 |
+
{% endif %}
|
| 21 |
+
{% if bound == "" %}
|
| 22 |
+
let {{ name }} = gid.x + gid.y * nwg.x * {{ tunables.WORKGROUP_SIZE }}u;
|
| 23 |
+
{%- elif guardInline %}
|
| 24 |
+
let {{ name }} = gid.x + gid.y * nwg.x * {{ tunables.WORKGROUP_SIZE }}u;
|
| 25 |
+
if ({{ name }} >= {{ bound }}) { return; }
|
| 26 |
+
{%- else %}
|
| 27 |
+
let {{ name }} = gid.x + gid.y * nwg.x * {{ tunables.WORKGROUP_SIZE }}u;
|
| 28 |
+
if ({{ name }} >= {{ bound }}) {
|
| 29 |
+
return;
|
| 30 |
+
}
|
| 31 |
+
{%- endif %}
|
| 32 |
+
{% endmacro %}
|
| 33 |
+
|
| 34 |
+
{% if usesF16 %}
|
| 35 |
+
enable f16;
|
| 36 |
+
{% endif %}
|
| 37 |
+
{{ env.wgsl.resourceDeclarations }}
|
| 38 |
+
|
| 39 |
+
@compute @workgroup_size({{ tunables.WORKGROUP_SIZE }})
|
| 40 |
+
fn main(@builtin(global_invocation_id) gid: vec3<u32>, @builtin(num_workgroups) nwg: vec3<u32>) {
|
| 41 |
+
{{ flat_index_2d("row", "params.rows", guardInline=true, note="") }}
|
| 42 |
+
let col = i32(row) + params.k;
|
| 43 |
+
if (col >= 0 && col < i32(params.cols)) {
|
| 44 |
+
output[row * params.cols + u32(col)] = {{ outScalar }}(1);
|
| 45 |
+
}
|
| 46 |
+
}
|
build/webgpu/eyelike.wgsl.jinja
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{% macro flat_index_2d(name="i", bound="params.count", guardInline=false, note="dispatch-limit") %}
|
| 2 |
+
{% if note == "dispatch-limit" %}
|
| 3 |
+
// 2D-folded flat index: gid.y carries the high bits past the
|
| 4 |
+
// maxComputeWorkgroupsPerDimension dispatch limit (outputs > 16.7M elements).
|
| 5 |
+
{% elif note == "limit" %}
|
| 6 |
+
// 2D-folded flat index: gid.y carries the high bits past the
|
| 7 |
+
// maxComputeWorkgroupsPerDimension limit.
|
| 8 |
+
{% elif note == "device-axis" %}
|
| 9 |
+
// The flat dispatch is folded across x/y at the device's per-axis workgroup
|
| 10 |
+
// limit; gid.y carries the high portion of the output index.
|
| 11 |
+
{% elif note == "vec4-limit" %}
|
| 12 |
+
// 2D-folded flat vec4 index: gid.y carries the high bits past the
|
| 13 |
+
// maxComputeWorkgroupsPerDimension limit (the dispatch caps x and spills into y).
|
| 14 |
+
{% elif note == "element-limit" %}
|
| 15 |
+
// 2D-folded flat element index: gid.y carries the high bits past the
|
| 16 |
+
// maxComputeWorkgroupsPerDimension limit.
|
| 17 |
+
{% elif note == "dispatch" %}
|
| 18 |
+
// 2D-folded flat index: gid.y carries the high bits past the
|
| 19 |
+
// maxComputeWorkgroupsPerDimension dispatch limit.
|
| 20 |
+
{% endif %}
|
| 21 |
+
{% if bound == "" %}
|
| 22 |
+
let {{ name }} = gid.x + gid.y * nwg.x * {{ tunables.WORKGROUP_SIZE }}u;
|
| 23 |
+
{%- elif guardInline %}
|
| 24 |
+
let {{ name }} = gid.x + gid.y * nwg.x * {{ tunables.WORKGROUP_SIZE }}u;
|
| 25 |
+
if ({{ name }} >= {{ bound }}) { return; }
|
| 26 |
+
{%- else %}
|
| 27 |
+
let {{ name }} = gid.x + gid.y * nwg.x * {{ tunables.WORKGROUP_SIZE }}u;
|
| 28 |
+
if ({{ name }} >= {{ bound }}) {
|
| 29 |
+
return;
|
| 30 |
+
}
|
| 31 |
+
{%- endif %}
|
| 32 |
+
{% endmacro %}
|
| 33 |
+
|
| 34 |
+
{% if usesF16 %}
|
| 35 |
+
enable f16;
|
| 36 |
+
{% endif %}
|
| 37 |
+
{{ env.wgsl.resourceDeclarations }}
|
| 38 |
+
|
| 39 |
+
@compute @workgroup_size({{ tunables.WORKGROUP_SIZE }})
|
| 40 |
+
fn main(@builtin(global_invocation_id) gid: vec3<u32>, @builtin(num_workgroups) nwg: vec3<u32>) {
|
| 41 |
+
{{ flat_index_2d() }}
|
| 42 |
+
let row = i32(i / params.cols);
|
| 43 |
+
let col = i32(i % params.cols);
|
| 44 |
+
output[i] = select({{ outScalar }}(0), {{ outScalar }}(1), col - row == params.k);
|
| 45 |
+
}
|
build/webgpu/manifest.json
ADDED
|
@@ -0,0 +1,146 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"domain": "ai.onnx",
|
| 3 |
+
"name": "EyeLike",
|
| 4 |
+
"sinceVersion": 22,
|
| 5 |
+
"description": "Generates a 2D identity-like matrix with ones on (or offset from) the main diagonal and zeros everywhere else. The output has the same shape as the 2D input tensor; the output dtype defaults to the input dtype but can be overridden. Attribute `k` shifts the populated diagonal: `k=0` is the main diagonal, `k>0` is upper, `k<0` is lower.",
|
| 6 |
+
"inputs": [
|
| 7 |
+
{
|
| 8 |
+
"role": "input",
|
| 9 |
+
"dtype": "T1",
|
| 10 |
+
"rank": 2,
|
| 11 |
+
"description": "2D input tensor whose shape (and optionally type) is copied."
|
| 12 |
+
}
|
| 13 |
+
],
|
| 14 |
+
"outputs": [
|
| 15 |
+
{
|
| 16 |
+
"role": "output",
|
| 17 |
+
"dtype": "T2",
|
| 18 |
+
"rank": "ranks.input",
|
| 19 |
+
"description": "Output tensor of the same shape as the input, with ones on the selected diagonal and zeros elsewhere.",
|
| 20 |
+
"shape": "shapes.input"
|
| 21 |
+
}
|
| 22 |
+
],
|
| 23 |
+
"attributes": { "k": 0 },
|
| 24 |
+
"attributeDescriptions": {
|
| 25 |
+
"dtype": "Optional TensorProto DataType enum for the output. When omitted, the output dtype is the same as the input dtype.",
|
| 26 |
+
"k": "Index of the diagonal to populate with ones: `0` is the main diagonal, positive values select upper diagonals, negative values select lower diagonals."
|
| 27 |
+
},
|
| 28 |
+
"typeConstraints": {
|
| 29 |
+
"T1": ["float32", "float16", "uint32", "int32", "int16", "uint8", "int8", "bool"],
|
| 30 |
+
"T2": ["float32", "float16", "uint32", "int32", "int16", "uint8", "int8", "bool"]
|
| 31 |
+
},
|
| 32 |
+
"args": {
|
| 33 |
+
"input": { "kind": "tensor", "semantic": "input", "role": "input" },
|
| 34 |
+
"output": { "kind": "tensor", "semantic": "output", "role": "output" }
|
| 35 |
+
},
|
| 36 |
+
"tunables": { "WORKGROUP_SIZE": 256 },
|
| 37 |
+
"derive": {
|
| 38 |
+
"wave32Adapter": "has(device.adapterInfo, \"subgroupMinSize\") and has(device.adapterInfo, \"subgroupMaxSize\") and device.adapterInfo.subgroupMinSize == 32 and device.adapterInfo.subgroupMaxSize == 32",
|
| 39 |
+
"reportedNonWave32Adapter": "not wave32Adapter and (has(device.adapterInfo, \"subgroupMinSize\") or has(device.adapterInfo, \"subgroupMaxSize\"))",
|
| 40 |
+
"dtypeContract": "(has(attrs, \"dtype\") and attrs.dtype == onnxDtypeCode(logicalDtypes.T2)) or (not has(attrs, \"dtype\") and logicalDtypes.T2 == logicalDtypes.T1)",
|
| 41 |
+
"packedClearPreferred": "numel(shapes.output) % 4 == 0 or not reportedNonWave32Adapter"
|
| 42 |
+
},
|
| 43 |
+
"constants": { "usesF16": "tensorDtypes.output == \"float16\"", "outScalar": "dtypes.T2" },
|
| 44 |
+
"variants": [
|
| 45 |
+
{
|
| 46 |
+
"id": "rank2_vec4",
|
| 47 |
+
"priority": 20,
|
| 48 |
+
"when": ["dtypeContract", "ranks.input == 2", "ranks.output == 2", "dim(shapes.output, 0) == dim(shapes.input, 0)", "dim(shapes.output, 1) == dim(shapes.input, 1)", "dim(shapes.output, 1) > 0", "packedClearPreferred", "f16Ok(tensorDtypes.output)"],
|
| 49 |
+
"constants": {
|
| 50 |
+
"tailSafe": "numel(shapes.output) % 4 != 0",
|
| 51 |
+
"outVector": "\"vec4<\" ~ dtypes.T2 ~ \">\"",
|
| 52 |
+
"clearElement": "dtypes.T2 if numel(shapes.output) % 4 != 0 else (\"vec4<\" ~ dtypes.T2 ~ \">\")"
|
| 53 |
+
},
|
| 54 |
+
"passes": [
|
| 55 |
+
{
|
| 56 |
+
"id": "clear",
|
| 57 |
+
"name": "EyeLike.ClearVec4",
|
| 58 |
+
"source": {
|
| 59 |
+
"shader": "eyelike-clear-vec4.wgsl.jinja",
|
| 60 |
+
"inputs": { "count4": "ceilDiv(numel(shapes.output), 4)", "count": "numel(shapes.output)" }
|
| 61 |
+
},
|
| 62 |
+
"bindings": [
|
| 63 |
+
{
|
| 64 |
+
"name": "output",
|
| 65 |
+
"arg": "output",
|
| 66 |
+
"semantic": "output",
|
| 67 |
+
"buffer": { "type": "storage" },
|
| 68 |
+
"elementType": "$clearElement"
|
| 69 |
+
}
|
| 70 |
+
],
|
| 71 |
+
"dispatch": { "threads": "ceilDiv(numel(shapes.output), 4)", "workgroupSize": "tunables.WORKGROUP_SIZE" }
|
| 72 |
+
},
|
| 73 |
+
{
|
| 74 |
+
"id": "diagonal",
|
| 75 |
+
"name": "EyeLike.Diagonal",
|
| 76 |
+
"shader": "eyelike-diagonal.wgsl.jinja",
|
| 77 |
+
"bindings": [
|
| 78 |
+
{
|
| 79 |
+
"name": "output",
|
| 80 |
+
"arg": "output",
|
| 81 |
+
"semantic": "output",
|
| 82 |
+
"buffer": { "type": "storage" },
|
| 83 |
+
"elementType": "$outScalar"
|
| 84 |
+
},
|
| 85 |
+
{
|
| 86 |
+
"name": "params",
|
| 87 |
+
"semantic": "kernel.params",
|
| 88 |
+
"buffer": { "type": "uniform" },
|
| 89 |
+
"struct": {
|
| 90 |
+
"name": "Params",
|
| 91 |
+
"fields": [
|
| 92 |
+
{ "name": "rows", "type": "u32", "value": "dim(shapes.output, 0)" },
|
| 93 |
+
{ "name": "cols", "type": "u32", "value": "dim(shapes.output, 1)" },
|
| 94 |
+
{
|
| 95 |
+
"name": "k",
|
| 96 |
+
"type": "i32",
|
| 97 |
+
"value": "max(min(attrs.k, dim(shapes.output, 1)), 0 - dim(shapes.output, 0))"
|
| 98 |
+
}
|
| 99 |
+
]
|
| 100 |
+
}
|
| 101 |
+
}
|
| 102 |
+
],
|
| 103 |
+
"dispatch": { "threads": "dim(shapes.output, 0)", "workgroupSize": "tunables.WORKGROUP_SIZE" }
|
| 104 |
+
}
|
| 105 |
+
]
|
| 106 |
+
},
|
| 107 |
+
{
|
| 108 |
+
"id": "rank2",
|
| 109 |
+
"when": ["dtypeContract", "ranks.input == 2", "ranks.output == 2", "dim(shapes.output, 0) == dim(shapes.input, 0)", "dim(shapes.output, 1) == dim(shapes.input, 1)", "f16Ok(tensorDtypes.output)"],
|
| 110 |
+
"passes": [
|
| 111 |
+
{
|
| 112 |
+
"id": "main",
|
| 113 |
+
"name": "EyeLike",
|
| 114 |
+
"shader": "eyelike.wgsl.jinja",
|
| 115 |
+
"bindings": [
|
| 116 |
+
{
|
| 117 |
+
"name": "output",
|
| 118 |
+
"arg": "output",
|
| 119 |
+
"semantic": "output",
|
| 120 |
+
"buffer": { "type": "storage" },
|
| 121 |
+
"elementType": "$outScalar"
|
| 122 |
+
},
|
| 123 |
+
{
|
| 124 |
+
"name": "params",
|
| 125 |
+
"semantic": "kernel.params",
|
| 126 |
+
"buffer": { "type": "uniform" },
|
| 127 |
+
"struct": {
|
| 128 |
+
"name": "Params",
|
| 129 |
+
"fields": [
|
| 130 |
+
{ "name": "count", "type": "u32", "value": "numel(shapes.output)" },
|
| 131 |
+
{ "name": "cols", "type": "u32", "value": "dim(shapes.output, 1)" },
|
| 132 |
+
{
|
| 133 |
+
"name": "k",
|
| 134 |
+
"type": "i32",
|
| 135 |
+
"value": "max(min(attrs.k, dim(shapes.output, 1)), 0 - dim(shapes.output, 0))"
|
| 136 |
+
}
|
| 137 |
+
]
|
| 138 |
+
}
|
| 139 |
+
}
|
| 140 |
+
],
|
| 141 |
+
"dispatch": { "threads": "numel(shapes.output)", "workgroupSize": "tunables.WORKGROUP_SIZE" }
|
| 142 |
+
}
|
| 143 |
+
]
|
| 144 |
+
}
|
| 145 |
+
]
|
| 146 |
+
}
|
build/webgpu/metadata.json
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"name": "ai.onnx.EyeLike",
|
| 3 |
+
"id": "_ai_onnx_eyelike_webgpu_abf2012",
|
| 4 |
+
"version": 1,
|
| 5 |
+
"license": "Apache-2.0",
|
| 6 |
+
"backend": { "type": "webgpu" },
|
| 7 |
+
"digest": {
|
| 8 |
+
"algorithm": "sha256",
|
| 9 |
+
"files": {
|
| 10 |
+
"bench.json": "AT1FVETPSt5mKqAQTjxmQ6hYC4cGMKFP6rnonySkJfE=",
|
| 11 |
+
"eyelike-clear-vec4.wgsl.jinja": "J0mLIcOnYIZzMcidLRWN1BS9xb1fqIeJ34dHmc+dqII=",
|
| 12 |
+
"eyelike-diagonal.wgsl.jinja": "mDunKMVacGusMV5mH1aLeddRfAffsCA0wwymCcCzVtg=",
|
| 13 |
+
"eyelike.wgsl.jinja": "G7fUoLpUu4wd3zcg6qsQOOYRVUKCduoTf1Rs3Tg2xUA=",
|
| 14 |
+
"manifest.json": "JtsNde7hNNptyv5Z2eQWDU/QAtUzbt8RmnOjd0a6J7A=",
|
| 15 |
+
"test.json": "+NBKAgSG911NlnbXaGR9KwZCbiNT3XHpsYT8t1pHWuQ="
|
| 16 |
+
}
|
| 17 |
+
},
|
| 18 |
+
"provenance": { "kernel": { "sha": "2e7068faf55e7f43df740015f6d1ee49391a41c5", "dirty": false } },
|
| 19 |
+
"webgpu": { "manifestSpec": "1.0", "specialized": true, "opPath": "ops/ai.onnx.EyeLike" }
|
| 20 |
+
}
|
build/webgpu/test.json
ADDED
|
@@ -0,0 +1,316 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"op": "ai.onnx.EyeLike",
|
| 3 |
+
"cases": [
|
| 4 |
+
{
|
| 5 |
+
"name": "vec4_upper_diagonal_rectangular_f32",
|
| 6 |
+
"attrs": { "k": 1 },
|
| 7 |
+
"inputs": { "input": { "dtype": "float32", "shape": [4, 8], "data": { "kind": "constant", "value": 7.0 } } },
|
| 8 |
+
"outputs": { "output": { "dtype": "float32", "shape": [4, 8], "tolerance": 0 } }
|
| 9 |
+
},
|
| 10 |
+
{
|
| 11 |
+
"name": "dispatch_cliff_f32_tall",
|
| 12 |
+
"attrs": { "k": 0 },
|
| 13 |
+
"inputs": {
|
| 14 |
+
"input": { "dtype": "float32", "shape": [16777217, 1], "data": { "kind": "constant", "value": 0.0 } }
|
| 15 |
+
},
|
| 16 |
+
"outputs": { "output": { "dtype": "float32", "shape": [16777217, 1], "tolerance": 0 } }
|
| 17 |
+
},
|
| 18 |
+
{
|
| 19 |
+
"name": "default_f32_rectangular",
|
| 20 |
+
"inputs": { "input": { "dtype": "float32", "shape": [3, 2], "data": { "kind": "constant", "value": 0.0 } } },
|
| 21 |
+
"outputs": { "output": { "dtype": "float32", "shape": [3, 2] } },
|
| 22 |
+
"provenance": {
|
| 23 |
+
"source": "onnxruntime/test/providers/cpu/tensor/eyelike_op_test.cc",
|
| 24 |
+
"test": "EyeLikeOpTest.EyeLikeDefault"
|
| 25 |
+
}
|
| 26 |
+
},
|
| 27 |
+
{
|
| 28 |
+
"name": "zero_rows_f32_empty_output",
|
| 29 |
+
"provenance": {
|
| 30 |
+
"source": "onnxruntime/test/providers/cpu/tensor/eyelike_op_test.cc",
|
| 31 |
+
"test": "EyeLikeOpTest.EyeLikeDefault",
|
| 32 |
+
"notes": "Zero-row rank-2 inputs produce an empty output; no diagonal elements are materialized."
|
| 33 |
+
},
|
| 34 |
+
"inputs": { "input": { "dtype": "float32", "shape": [0, 3], "data": { "kind": "values", "values": [] } } },
|
| 35 |
+
"outputs": {
|
| 36 |
+
"output": { "dtype": "float32", "shape": [0, 3], "tolerance": 0, "data": { "kind": "values", "values": [] } }
|
| 37 |
+
}
|
| 38 |
+
},
|
| 39 |
+
{
|
| 40 |
+
"name": "upper_diagonal_f32",
|
| 41 |
+
"attrs": { "k": 2 },
|
| 42 |
+
"inputs": { "input": { "dtype": "float32", "shape": [3, 4], "data": { "kind": "constant", "value": 0.0 } } },
|
| 43 |
+
"outputs": { "output": { "dtype": "float32", "shape": [3, 4] } },
|
| 44 |
+
"provenance": {
|
| 45 |
+
"source": "onnxruntime/test/providers/cpu/tensor/eyelike_op_test.cc",
|
| 46 |
+
"test": "EyeLikeOpTest.EyeLike_UpperDiagonal"
|
| 47 |
+
}
|
| 48 |
+
},
|
| 49 |
+
{
|
| 50 |
+
"name": "lower_diagonal_f32",
|
| 51 |
+
"attrs": { "k": -1 },
|
| 52 |
+
"inputs": { "input": { "dtype": "float32", "shape": [3, 2], "data": { "kind": "constant", "value": 0.0 } } },
|
| 53 |
+
"outputs": { "output": { "dtype": "float32", "shape": [3, 2] } },
|
| 54 |
+
"provenance": {
|
| 55 |
+
"source": "onnxruntime/test/providers/cpu/tensor/eyelike_op_test.cc",
|
| 56 |
+
"test": "EyeLikeOpTest.EyeLike_LowerDiagonal"
|
| 57 |
+
}
|
| 58 |
+
},
|
| 59 |
+
{
|
| 60 |
+
"name": "out_of_range_int32",
|
| 61 |
+
"attrs": { "k": 3 },
|
| 62 |
+
"inputs": { "input": { "dtype": "int32", "shape": [3, 2], "data": { "kind": "constant", "value": 0 } } },
|
| 63 |
+
"outputs": { "output": { "dtype": "int32", "shape": [3, 2] } },
|
| 64 |
+
"provenance": {
|
| 65 |
+
"source": "onnxruntime/test/providers/cpu/tensor/eyelike_op_test.cc",
|
| 66 |
+
"test": "EyeLikeOpTest.EyeLike_K_EgdeCase_1",
|
| 67 |
+
"notes": "ORT uses int64 dtype; this framework covers the same out-of-range positive diagonal with int32 output storage."
|
| 68 |
+
}
|
| 69 |
+
},
|
| 70 |
+
{
|
| 71 |
+
"name": "ort_out_of_range_negative_int32",
|
| 72 |
+
"attrs": { "k": -3 },
|
| 73 |
+
"inputs": { "input": { "dtype": "int32", "shape": [3, 2], "data": { "kind": "constant", "value": 0 } } },
|
| 74 |
+
"outputs": { "output": { "dtype": "int32", "shape": [3, 2] } },
|
| 75 |
+
"provenance": {
|
| 76 |
+
"source": "onnxruntime/test/providers/cpu/tensor/eyelike_op_test.cc",
|
| 77 |
+
"test": "EyeLikeOpTest.EyeLike_K_EgdeCase_2",
|
| 78 |
+
"notes": "ORT uses int64 dtype; this framework covers the same out-of-range negative diagonal with int32 output storage."
|
| 79 |
+
}
|
| 80 |
+
},
|
| 81 |
+
{
|
| 82 |
+
"name": "large_positive_k_does_not_wrap_to_main_diagonal",
|
| 83 |
+
"attrs": { "k": 4294967296 },
|
| 84 |
+
"inputs": { "input": { "dtype": "float32", "shape": [3, 3], "data": { "kind": "constant", "value": 0.0 } } },
|
| 85 |
+
"outputs": {
|
| 86 |
+
"output": { "dtype": "float32", "shape": [3, 3], "tolerance": 0, "data": { "kind": "constant", "value": 0.0 } }
|
| 87 |
+
},
|
| 88 |
+
"provenance": {
|
| 89 |
+
"source": "onnxruntime/test/providers/cpu/tensor/eyelike_op_test.cc",
|
| 90 |
+
"test": "EyeLikeOpTest.EyeLike_K_EgdeCase_1",
|
| 91 |
+
"notes": "ONNX k is an int64 attribute. A huge positive offset is valid and should be out of range, not wrap through a 32-bit uniform to the main diagonal."
|
| 92 |
+
}
|
| 93 |
+
},
|
| 94 |
+
{
|
| 95 |
+
"name": "large_negative_k_does_not_wrap_to_main_diagonal",
|
| 96 |
+
"attrs": { "k": -4294967296 },
|
| 97 |
+
"inputs": { "input": { "dtype": "int32", "shape": [3, 3], "data": { "kind": "constant", "value": 0 } } },
|
| 98 |
+
"outputs": {
|
| 99 |
+
"output": { "dtype": "int32", "shape": [3, 3], "tolerance": 0, "data": { "kind": "constant", "value": 0 } }
|
| 100 |
+
},
|
| 101 |
+
"provenance": {
|
| 102 |
+
"source": "onnxruntime/test/providers/cpu/tensor/eyelike_op_test.cc",
|
| 103 |
+
"test": "EyeLikeOpTest.EyeLike_K_EgdeCase_2",
|
| 104 |
+
"notes": "Negative companion for int64 k values outside the int32 range; the diagonal remains out of range."
|
| 105 |
+
}
|
| 106 |
+
},
|
| 107 |
+
{
|
| 108 |
+
"name": "main_diagonal_f16",
|
| 109 |
+
"attrs": { "dtype": 10 },
|
| 110 |
+
"inputs": { "input": { "dtype": "float16", "shape": [2, 3], "data": { "kind": "constant", "value": 0.0 } } },
|
| 111 |
+
"outputs": { "output": { "dtype": "float16", "shape": [2, 3] } }
|
| 112 |
+
},
|
| 113 |
+
{
|
| 114 |
+
"name": "uint8_output_main_diagonal",
|
| 115 |
+
"attrs": { "dtype": 2 },
|
| 116 |
+
"inputs": { "input": { "dtype": "uint8", "shape": [2, 4], "data": { "kind": "constant", "value": 99 } } },
|
| 117 |
+
"outputs": { "output": { "dtype": "uint8", "shape": [2, 4], "tolerance": 0 } }
|
| 118 |
+
},
|
| 119 |
+
{
|
| 120 |
+
"name": "int8_output_lower_diagonal",
|
| 121 |
+
"attrs": { "k": -1, "dtype": 3 },
|
| 122 |
+
"inputs": { "input": { "dtype": "int8", "shape": [4, 3], "data": { "kind": "constant", "value": -7 } } },
|
| 123 |
+
"outputs": { "output": { "dtype": "int8", "shape": [4, 3], "tolerance": 0 } }
|
| 124 |
+
},
|
| 125 |
+
{
|
| 126 |
+
"name": "uint32_extreme_input_main_diagonal",
|
| 127 |
+
"provenance": {
|
| 128 |
+
"source": "onnx/onnx/docs/Operators.md#EyeLike-22",
|
| 129 |
+
"notes": "Covers standard uint32 input and output membership; extreme input payloads are intentionally ignored because EyeLike consumes only the input shape."
|
| 130 |
+
},
|
| 131 |
+
"attrs": { "dtype": 12 },
|
| 132 |
+
"inputs": {
|
| 133 |
+
"input": {
|
| 134 |
+
"dtype": "uint32",
|
| 135 |
+
"shape": [2, 4],
|
| 136 |
+
"data": { "kind": "values", "values": [0, 4294967295, 2147483648, 16777217, 1, 42, 4000000000, 255] }
|
| 137 |
+
}
|
| 138 |
+
},
|
| 139 |
+
"outputs": { "output": { "dtype": "uint32", "shape": [2, 4], "tolerance": 0 } }
|
| 140 |
+
},
|
| 141 |
+
{
|
| 142 |
+
"name": "int16_extreme_input_lower_diagonal",
|
| 143 |
+
"provenance": {
|
| 144 |
+
"source": "onnxruntime/test/providers/cpu/tensor/eyelike_op_test.cc",
|
| 145 |
+
"test": "EyeLikeOpTest.EyeLike_LowerDiagonal",
|
| 146 |
+
"notes": "Extends ORT's lower-diagonal case to ONNX-standard int16 and proves that only the input shape, not its extreme values, affects the result."
|
| 147 |
+
},
|
| 148 |
+
"attrs": { "k": -1, "dtype": 5 },
|
| 149 |
+
"inputs": {
|
| 150 |
+
"input": { "dtype": "int16", "shape": [3, 5], "data": { "kind": "cycle", "values": [-32768, 32767, -1, 0, 1] } }
|
| 151 |
+
},
|
| 152 |
+
"outputs": { "output": { "dtype": "int16", "shape": [3, 5], "tolerance": 0 } }
|
| 153 |
+
},
|
| 154 |
+
{
|
| 155 |
+
"name": "bool_output_upper_diagonal",
|
| 156 |
+
"provenance": {
|
| 157 |
+
"source": "onnx/onnx/docs/Operators.md#EyeLike-22",
|
| 158 |
+
"notes": "Covers the ONNX-standard bool input/output route with a non-default upper diagonal."
|
| 159 |
+
},
|
| 160 |
+
"attrs": { "k": 1, "dtype": 9 },
|
| 161 |
+
"inputs": { "input": { "dtype": "bool", "shape": [3, 4], "data": { "kind": "cycle", "values": [0, 1, 1, 0] } } },
|
| 162 |
+
"outputs": { "output": { "dtype": "bool", "shape": [3, 4], "tolerance": 0 } }
|
| 163 |
+
},
|
| 164 |
+
{
|
| 165 |
+
"name": "upper_diagonal_k1_narrow",
|
| 166 |
+
"attrs": { "k": 1, "dtype": 2 },
|
| 167 |
+
"inputs": { "input": { "dtype": "float32", "shape": [3, 2], "data": { "kind": "constant", "value": 0.0 } } },
|
| 168 |
+
"outputs": { "output": { "dtype": "uint8", "shape": [3, 2], "tolerance": 0 } },
|
| 169 |
+
"provenance": {
|
| 170 |
+
"source": "onnxruntime/test/providers/cpu/tensor/eyelike_op_test.cc",
|
| 171 |
+
"test": "EyeLikeOpTest.EyeLike_UpperrDiagonal2",
|
| 172 |
+
"notes": "The same narrow upper-diagonal shape also covers the independent uint8 output-dtype route."
|
| 173 |
+
}
|
| 174 |
+
},
|
| 175 |
+
{
|
| 176 |
+
"name": "lower_diagonal_k_minus2_wide",
|
| 177 |
+
"attrs": { "k": -2, "dtype": 3 },
|
| 178 |
+
"inputs": { "input": { "dtype": "float32", "shape": [3, 4], "data": { "kind": "constant", "value": 0.0 } } },
|
| 179 |
+
"outputs": { "output": { "dtype": "int8", "shape": [3, 4], "tolerance": 0 } },
|
| 180 |
+
"provenance": {
|
| 181 |
+
"source": "onnxruntime/test/providers/cpu/tensor/eyelike_op_test.cc",
|
| 182 |
+
"test": "EyeLikeOpTest.EyeLike_LowerDiagonal2",
|
| 183 |
+
"notes": "The same wide lower-diagonal shape also covers the independent int8 output-dtype route."
|
| 184 |
+
}
|
| 185 |
+
},
|
| 186 |
+
{
|
| 187 |
+
"name": "ort_different_output_dtype_int32",
|
| 188 |
+
"attrs": { "dtype": 6 },
|
| 189 |
+
"inputs": { "input": { "dtype": "float32", "shape": [3, 3], "data": { "kind": "constant", "value": 0.0 } } },
|
| 190 |
+
"outputs": { "output": { "dtype": "int32", "shape": [3, 3], "tolerance": 0 } },
|
| 191 |
+
"provenance": {
|
| 192 |
+
"source": "onnxruntime/test/providers/cpu/tensor/eyelike_op_test.cc",
|
| 193 |
+
"test": "EyeLikeOpTest.EyeLike_DifferentDtype",
|
| 194 |
+
"notes": "ORT requests int64 via dtype attr; this framework expresses the same output-dtype behavior with supported int32 storage."
|
| 195 |
+
}
|
| 196 |
+
},
|
| 197 |
+
{
|
| 198 |
+
"name": "int32_output_nonzero_input_ignored",
|
| 199 |
+
"inputs": { "input": { "dtype": "int32", "shape": [2, 2], "data": { "kind": "constant", "value": 99 } } },
|
| 200 |
+
"outputs": { "output": { "dtype": "int32", "shape": [2, 2], "tolerance": 0 } }
|
| 201 |
+
},
|
| 202 |
+
{
|
| 203 |
+
"name": "onnx_backend_eyelike_populate_off_main_diagonal",
|
| 204 |
+
"provenance": {
|
| 205 |
+
"source": "cmake/external/onnx/onnx/backend/test/data/node/test_eyelike_populate_off_main_diagonal"
|
| 206 |
+
},
|
| 207 |
+
"attrs": { "k": 1, "dtype": 1 },
|
| 208 |
+
"inputs": {
|
| 209 |
+
"input": {
|
| 210 |
+
"dtype": "int32",
|
| 211 |
+
"shape": [4, 5],
|
| 212 |
+
"data": {
|
| 213 |
+
"kind": "values",
|
| 214 |
+
"values": [44, 47, 64, 67, 67, 9, 83, 21, 36, 87, 70, 88, 88, 12, 58, 65, 39, 87, 46, 88]
|
| 215 |
+
}
|
| 216 |
+
}
|
| 217 |
+
},
|
| 218 |
+
"outputs": { "output": { "dtype": "float32", "shape": [4, 5], "tolerance": 0 } }
|
| 219 |
+
},
|
| 220 |
+
{
|
| 221 |
+
"name": "onnx_backend_eyelike_with_dtype",
|
| 222 |
+
"provenance": {
|
| 223 |
+
"source": "cmake/external/onnx/onnx/backend/test/data/node/test_eyelike_with_dtype",
|
| 224 |
+
"notes": "Official output dtype is DOUBLE; adapted to FLOAT because this manifest does not support float64 outputs."
|
| 225 |
+
},
|
| 226 |
+
"attrs": { "dtype": 1 },
|
| 227 |
+
"inputs": {
|
| 228 |
+
"input": {
|
| 229 |
+
"dtype": "int32",
|
| 230 |
+
"shape": [3, 4],
|
| 231 |
+
"data": { "kind": "values", "values": [44, 47, 64, 67, 67, 9, 83, 21, 36, 87, 70, 88] }
|
| 232 |
+
}
|
| 233 |
+
},
|
| 234 |
+
"outputs": { "output": { "dtype": "float32", "shape": [3, 4], "tolerance": 0 } }
|
| 235 |
+
},
|
| 236 |
+
{
|
| 237 |
+
"name": "onnx_backend_eyelike_without_dtype",
|
| 238 |
+
"provenance": { "source": "cmake/external/onnx/onnx/backend/test/data/node/test_eyelike_without_dtype" },
|
| 239 |
+
"attrs": {},
|
| 240 |
+
"inputs": {
|
| 241 |
+
"input": {
|
| 242 |
+
"dtype": "int32",
|
| 243 |
+
"shape": [4, 4],
|
| 244 |
+
"data": { "kind": "values", "values": [44, 47, 64, 67, 67, 9, 83, 21, 36, 87, 70, 88, 88, 12, 58, 65] }
|
| 245 |
+
}
|
| 246 |
+
},
|
| 247 |
+
"outputs": { "output": { "dtype": "int32", "shape": [4, 4], "tolerance": 0 } }
|
| 248 |
+
},
|
| 249 |
+
{
|
| 250 |
+
"name": "empty_input_zero_dim",
|
| 251 |
+
"inputs": { "input": { "dtype": "float32", "shape": [0, 2], "data": { "kind": "values", "values": [] } } },
|
| 252 |
+
"outputs": { "output": { "dtype": "float32", "shape": [0, 2], "tolerance": 0 } }
|
| 253 |
+
},
|
| 254 |
+
{
|
| 255 |
+
"name": "f32_input_f16_output_64x64_upper_diagonal_k1",
|
| 256 |
+
"provenance": {
|
| 257 |
+
"notes": "Separates the float16 output route from the independently typed float32 shape-source input."
|
| 258 |
+
},
|
| 259 |
+
"attrs": { "k": 1, "dtype": 10 },
|
| 260 |
+
"inputs": { "input": { "dtype": "float32", "shape": [64, 64], "data": { "kind": "constant", "value": 0.0 } } },
|
| 261 |
+
"outputs": { "output": { "dtype": "float16", "shape": [64, 64], "tolerance": 0 } }
|
| 262 |
+
},
|
| 263 |
+
{
|
| 264 |
+
"name": "int32_nonsquare_tall_lower_diagonal_k_minus2",
|
| 265 |
+
"attrs": { "k": -2 },
|
| 266 |
+
"inputs": { "input": { "dtype": "int32", "shape": [5, 3], "data": { "kind": "constant", "value": 0 } } },
|
| 267 |
+
"outputs": { "output": { "dtype": "int32", "shape": [5, 3], "tolerance": 0 } }
|
| 268 |
+
},
|
| 269 |
+
{
|
| 270 |
+
"name": "k_at_negative_rows_boundary_all_zeros",
|
| 271 |
+
"provenance": {
|
| 272 |
+
"notes": "A float32 shape-source input with bool output covers the independent bool dtype route on an all-off diagonal."
|
| 273 |
+
},
|
| 274 |
+
"attrs": { "k": -3, "dtype": 9 },
|
| 275 |
+
"inputs": { "input": { "dtype": "float32", "shape": [3, 3], "data": { "kind": "constant", "value": 0.0 } } },
|
| 276 |
+
"outputs": {
|
| 277 |
+
"output": { "dtype": "bool", "shape": [3, 3], "tolerance": 0, "data": { "kind": "constant", "value": 0 } }
|
| 278 |
+
}
|
| 279 |
+
},
|
| 280 |
+
{
|
| 281 |
+
"name": "k_zero_1x1_single_element",
|
| 282 |
+
"provenance": {
|
| 283 |
+
"notes": "A float32 shape-source input with int16 output covers the independent int16 dtype route."
|
| 284 |
+
},
|
| 285 |
+
"attrs": { "k": 0, "dtype": 5 },
|
| 286 |
+
"inputs": { "input": { "dtype": "float32", "shape": [1, 1], "data": { "kind": "constant", "value": 0.0 } } },
|
| 287 |
+
"outputs": {
|
| 288 |
+
"output": { "dtype": "int16", "shape": [1, 1], "tolerance": 0, "data": { "kind": "values", "values": [1] } }
|
| 289 |
+
}
|
| 290 |
+
},
|
| 291 |
+
{
|
| 292 |
+
"name": "k_at_positive_cols_boundary_all_zeros",
|
| 293 |
+
"provenance": {
|
| 294 |
+
"notes": "A float32 shape-source input with uint32 output covers the independent uint32 dtype route on an all-off diagonal."
|
| 295 |
+
},
|
| 296 |
+
"attrs": { "k": 3, "dtype": 12 },
|
| 297 |
+
"inputs": { "input": { "dtype": "float32", "shape": [4, 3], "data": { "kind": "constant", "value": 0.0 } } },
|
| 298 |
+
"outputs": {
|
| 299 |
+
"output": { "dtype": "uint32", "shape": [4, 3], "tolerance": 0, "data": { "kind": "constant", "value": 0 } }
|
| 300 |
+
}
|
| 301 |
+
},
|
| 302 |
+
{
|
| 303 |
+
"name": "k_minus_rows_minus1_single_corner",
|
| 304 |
+
"attrs": { "k": -3 },
|
| 305 |
+
"inputs": { "input": { "dtype": "float32", "shape": [4, 3], "data": { "kind": "constant", "value": 0.0 } } },
|
| 306 |
+
"outputs": {
|
| 307 |
+
"output": {
|
| 308 |
+
"dtype": "float32",
|
| 309 |
+
"shape": [4, 3],
|
| 310 |
+
"tolerance": 0,
|
| 311 |
+
"data": { "kind": "values", "values": [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0, 0.0] }
|
| 312 |
+
}
|
| 313 |
+
}
|
| 314 |
+
}
|
| 315 |
+
]
|
| 316 |
+
}
|