sync 2e7068faf55e
Browse files- README.md +75 -0
- build/webgpu/bench.json +173 -0
- build/webgpu/manifest.json +369 -0
- build/webgpu/metadata.json +22 -0
- build/webgpu/norm-row-stats.wgsl.jinja +124 -0
- build/webgpu/rms-normalization-splitk-normalize.wgsl.jinja +93 -0
- build/webgpu/rms-normalization-splitk-partials.wgsl.jinja +93 -0
- build/webgpu/rms-normalization-stash-f16-serial.wgsl.jinja +140 -0
- build/webgpu/rms-normalization.wgsl.jinja +144 -0
- build/webgpu/test.json +1590 -0
README.md
CHANGED
|
@@ -1,3 +1,78 @@
|
|
| 1 |
---
|
|
|
|
| 2 |
license: apache-2.0
|
|
|
|
|
|
|
|
|
|
|
|
|
| 3 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
---
|
| 2 |
+
library_name: kernels
|
| 3 |
license: apache-2.0
|
| 4 |
+
tags:
|
| 5 |
+
- kernel
|
| 6 |
+
- webgpu
|
| 7 |
+
- wgsl
|
| 8 |
---
|
| 9 |
+
# ai.onnx.RMSNormalization
|
| 10 |
+
|
| 11 |
+
`ai.onnx` · standard ONNX operator · ONNX opset ≥ 23
|
| 12 |
+
|
| 13 |
+
## Description
|
| 14 |
+
|
| 15 |
+
Computes RMS normalization over the suffix dimensions of `X` starting at `axis`: `Y = X / sqrt(mean(X^2) + epsilon) * scale`. The normalization stage supports TensorProto `stash_type` values `1` (float32) and `10` (float16), and is cast back to the dtype of `X` before `scale` is applied. The input type `T` and scale/output type `V` may independently be float16 or float32; ONNX's bfloat16 and double cases are not yet implemented.
|
| 16 |
+
|
| 17 |
+
See the [ONNX `RMSNormalization` spec](https://onnx.ai/onnx/operators/onnx__RMSNormalization.html) for the reference semantics.
|
| 18 |
+
|
| 19 |
+
## Inputs
|
| 20 |
+
|
| 21 |
+
| Name | Bind key | Logical dtype | Rank | Shape | Description | Presence |
|
| 22 |
+
| --- | --- | --- | --- | --- | --- | --- |
|
| 23 |
+
| `X` | `x` | `T` | — | — | Input tensor to be normalized; the RMS is taken over the last dimensions starting at `axis`. | required |
|
| 24 |
+
| `scale` | `scale` | `V` | — | — | Scale tensor, unidirectionally broadcastable to `X`; its dtype `V` may differ from the input dtype `T`. | required |
|
| 25 |
+
|
| 26 |
+
## Outputs
|
| 27 |
+
|
| 28 |
+
| Name | Bind key | Logical dtype | Rank | Shape | Description | Presence |
|
| 29 |
+
| --- | --- | --- | --- | --- | --- | --- |
|
| 30 |
+
| `Y` | `y` | `V` | same as `X` | same as `X` | Normalized and scaled output tensor; same shape as `X` and same dtype `V` as `scale`. | required |
|
| 31 |
+
|
| 32 |
+
## Attributes
|
| 33 |
+
|
| 34 |
+
Default values (overridable per request):
|
| 35 |
+
|
| 36 |
+
| Attribute | Default | Description |
|
| 37 |
+
| --- | --- | --- |
|
| 38 |
+
| `axis` | `-1` | The first dimension of the normalization suffix; negative values count from the end, so the default `-1` normalizes over only the last dimension. |
|
| 39 |
+
| `epsilon` | `0.00001` | Small constant added to the mean square before taking the square root to avoid division by zero. |
|
| 40 |
+
| `stash_type` | `1` | TensorProto element type used for normalization: `1` computes in float32, while `10` computes in float16. |
|
| 41 |
+
|
| 42 |
+
## Type constraints
|
| 43 |
+
|
| 44 |
+
| Variable | Allowed dtypes |
|
| 45 |
+
| --- | --- |
|
| 46 |
+
| `T` | `float32`, `float16` |
|
| 47 |
+
| `V` | `float32`, `float16` |
|
| 48 |
+
|
| 49 |
+
## Files
|
| 50 |
+
|
| 51 |
+
- [`metadata.json`](build/webgpu/metadata.json) — kernel metadata (id, digests, provenance)
|
| 52 |
+
- [`manifest.json`](build/webgpu/manifest.json) — the op contract (source of truth)
|
| 53 |
+
- [`test.json`](build/webgpu/test.json) — correctness cases
|
| 54 |
+
- [`bench.json`](build/webgpu/bench.json) — benchmark + tuning cases
|
| 55 |
+
- [`norm-row-stats.wgsl.jinja`](build/webgpu/norm-row-stats.wgsl.jinja)
|
| 56 |
+
- [`rms-normalization-splitk-normalize.wgsl.jinja`](build/webgpu/rms-normalization-splitk-normalize.wgsl.jinja)
|
| 57 |
+
- [`rms-normalization-splitk-partials.wgsl.jinja`](build/webgpu/rms-normalization-splitk-partials.wgsl.jinja)
|
| 58 |
+
- [`rms-normalization-stash-f16-serial.wgsl.jinja`](build/webgpu/rms-normalization-stash-f16-serial.wgsl.jinja)
|
| 59 |
+
- [`rms-normalization.wgsl.jinja`](build/webgpu/rms-normalization.wgsl.jinja)
|
| 60 |
+
|
| 61 |
+
## Use with `@huggingface/kernels`
|
| 62 |
+
|
| 63 |
+
The loader derives every required output's shape and logical dtype from the manifest contract and this call.
|
| 64 |
+
It then allocates the result tensors automatically.
|
| 65 |
+
|
| 66 |
+
The `version: 1` option selects the published kernel contract; it is independent of any operator opset, contrib `since_version`, or model version.
|
| 67 |
+
|
| 68 |
+
Replace each `*Data` placeholder with a typed array containing the corresponding input data.
|
| 69 |
+
|
| 70 |
+
```js
|
| 71 |
+
import { getKernel } from "@huggingface/kernels";
|
| 72 |
+
|
| 73 |
+
const kernel = await getKernel("webgpu-kernels/ai.onnx.RMSNormalization", { version: 1 });
|
| 74 |
+
const { y } = await kernel({
|
| 75 |
+
x: { data: xData, shape: [1, 2, 3] },
|
| 76 |
+
scale: { data: scaleData, shape: [3] },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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"op": "ai.onnx.RMSNormalization",
|
| 3 |
+
"cases": [
|
| 4 |
+
{
|
| 5 |
+
"name": "rmsnorm-f32-256x1024",
|
| 6 |
+
"preset": "smoke",
|
| 7 |
+
"vars": { "dtype": "float32", "rows": 256, "dim": 1024 },
|
| 8 |
+
"attrs": { "epsilon": 0.000001, "axis": -1 },
|
| 9 |
+
"inputs": {
|
| 10 |
+
"x": { "shape": [256, 1024], "dtype": "float32", "dist": "normal", "seed": 710, "scale": 0.5 },
|
| 11 |
+
"scale": { "shape": [1024], "dtype": "float32", "dist": "uniform", "seed": 711, "scale": 0.25, "offset": 1 }
|
| 12 |
+
},
|
| 13 |
+
"outputs": { "y": { "shape": [256, 1024], "dtype": "float32" } },
|
| 14 |
+
"bench": {
|
| 15 |
+
"primary": true,
|
| 16 |
+
"metrics": [{ "type": "bandwidth", "value": "(args.rows * args.dim * 2 + args.dim) * dtypeBytes(args.dtype)" }]
|
| 17 |
+
}
|
| 18 |
+
},
|
| 19 |
+
{
|
| 20 |
+
"name": "rmsnorm-f32-4096x4096",
|
| 21 |
+
"preset": "smoke",
|
| 22 |
+
"vars": { "dtype": "float32", "rows": 4096, "dim": 4096 },
|
| 23 |
+
"attrs": { "epsilon": 0.000001, "axis": -1 },
|
| 24 |
+
"inputs": {
|
| 25 |
+
"x": { "shape": [4096, 4096], "dtype": "float32", "dist": "normal", "seed": 712, "scale": 0.5 },
|
| 26 |
+
"scale": { "shape": [4096], "dtype": "float32", "dist": "uniform", "seed": 713, "scale": 0.25, "offset": 1 }
|
| 27 |
+
},
|
| 28 |
+
"outputs": { "y": { "shape": [4096, 4096], "dtype": "float32" } },
|
| 29 |
+
"bench": {
|
| 30 |
+
"primary": true,
|
| 31 |
+
"metrics": [{ "type": "bandwidth", "value": "(args.rows * args.dim * 2 + args.dim) * dtypeBytes(args.dtype)" }]
|
| 32 |
+
}
|
| 33 |
+
},
|
| 34 |
+
{
|
| 35 |
+
"name": "rmsnorm-f16-4096x4096",
|
| 36 |
+
"preset": "smoke",
|
| 37 |
+
"vars": { "dtype": "float16", "rows": 4096, "dim": 4096 },
|
| 38 |
+
"attrs": { "epsilon": 0.000001, "axis": -1 },
|
| 39 |
+
"inputs": {
|
| 40 |
+
"x": { "shape": [4096, 4096], "dtype": "float16", "dist": "normal", "seed": 714, "scale": 0.5 },
|
| 41 |
+
"scale": { "shape": [4096], "dtype": "float16", "dist": "uniform", "seed": 715, "scale": 0.25, "offset": 1 }
|
| 42 |
+
},
|
| 43 |
+
"outputs": { "y": { "shape": [4096, 4096], "dtype": "float16" } },
|
| 44 |
+
"bench": {
|
| 45 |
+
"metrics": [{ "type": "bandwidth", "value": "(args.rows * args.dim * 2 + args.dim) * dtypeBytes(args.dtype)" }]
|
| 46 |
+
}
|
| 47 |
+
},
|
| 48 |
+
{
|
| 49 |
+
"name": "rmsnorm-f16-1x4096-rows1-decode",
|
| 50 |
+
"preset": "smoke",
|
| 51 |
+
"vars": { "dtype": "float16", "rows": 1, "dim": 4096 },
|
| 52 |
+
"attrs": { "epsilon": 0.000001, "axis": -1 },
|
| 53 |
+
"inputs": {
|
| 54 |
+
"x": { "shape": [1, 4096], "dtype": "float16", "dist": "normal", "seed": 7200, "scale": 0.5 },
|
| 55 |
+
"scale": { "shape": [4096], "dtype": "float16", "dist": "uniform", "seed": 7201, "scale": 0.25, "offset": 1 }
|
| 56 |
+
},
|
| 57 |
+
"outputs": { "y": { "shape": [1, 4096], "dtype": "float16" } },
|
| 58 |
+
"bench": {
|
| 59 |
+
"metrics": [{ "type": "bandwidth", "value": "(args.rows * args.dim * 2 + args.dim) * dtypeBytes(args.dtype)" }]
|
| 60 |
+
}
|
| 61 |
+
},
|
| 62 |
+
{
|
| 63 |
+
"name": "rmsnorm-f16-256x4096-aligned-vec4",
|
| 64 |
+
"preset": "smoke",
|
| 65 |
+
"vars": { "dtype": "float16", "rows": 256, "dim": 4096 },
|
| 66 |
+
"attrs": { "epsilon": 0.000001, "axis": -1 },
|
| 67 |
+
"inputs": {
|
| 68 |
+
"x": { "shape": [256, 4096], "dtype": "float16", "dist": "normal", "seed": 7210, "scale": 0.5 },
|
| 69 |
+
"scale": { "shape": [4096], "dtype": "float16", "dist": "uniform", "seed": 7211, "scale": 0.25, "offset": 1 }
|
| 70 |
+
},
|
| 71 |
+
"outputs": { "y": { "shape": [256, 4096], "dtype": "float16" } },
|
| 72 |
+
"bench": {
|
| 73 |
+
"metrics": [{ "type": "bandwidth", "value": "(args.rows * args.dim * 2 + args.dim) * dtypeBytes(args.dtype)" }]
|
| 74 |
+
}
|
| 75 |
+
},
|
| 76 |
+
{
|
| 77 |
+
"name": "rmsnorm-f16-256x4094-unaligned-alignmentcliff",
|
| 78 |
+
"preset": "smoke",
|
| 79 |
+
"vars": { "dtype": "float16", "rows": 256, "dim": 4094 },
|
| 80 |
+
"attrs": { "epsilon": 0.000001, "axis": -1 },
|
| 81 |
+
"inputs": {
|
| 82 |
+
"x": { "shape": [256, 4094], "dtype": "float16", "dist": "normal", "seed": 7220, "scale": 0.5 },
|
| 83 |
+
"scale": { "shape": [4094], "dtype": "float16", "dist": "uniform", "seed": 7221, "scale": 0.25, "offset": 1 }
|
| 84 |
+
},
|
| 85 |
+
"outputs": { "y": { "shape": [256, 4094], "dtype": "float16" } },
|
| 86 |
+
"bench": {
|
| 87 |
+
"metrics": [{ "type": "bandwidth", "value": "(args.rows * args.dim * 2 + args.dim) * dtypeBytes(args.dtype)" }]
|
| 88 |
+
}
|
| 89 |
+
},
|
| 90 |
+
{
|
| 91 |
+
"name": "rmsnorm-f32-8x256x1024-suffixaxis1-generic",
|
| 92 |
+
"preset": "smoke",
|
| 93 |
+
"vars": { "dtype": "float32", "outer": 8, "normSize": 262144 },
|
| 94 |
+
"attrs": { "epsilon": 0.000001, "axis": 1 },
|
| 95 |
+
"inputs": {
|
| 96 |
+
"x": { "shape": [8, 256, 1024], "dtype": "float32", "dist": "normal", "seed": 7230, "scale": 0.5 },
|
| 97 |
+
"scale": {
|
| 98 |
+
"shape": [256, 1024],
|
| 99 |
+
"dtype": "float32",
|
| 100 |
+
"dist": "uniform",
|
| 101 |
+
"seed": 7231,
|
| 102 |
+
"scale": 0.25,
|
| 103 |
+
"offset": 1
|
| 104 |
+
}
|
| 105 |
+
},
|
| 106 |
+
"outputs": { "y": { "shape": [8, 256, 1024], "dtype": "float32" } },
|
| 107 |
+
"bench": {
|
| 108 |
+
"metrics": [
|
| 109 |
+
{ "type": "bandwidth", "value": "(args.outer * args.normSize * 2 + args.normSize) * dtypeBytes(args.dtype)" }
|
| 110 |
+
]
|
| 111 |
+
}
|
| 112 |
+
},
|
| 113 |
+
{
|
| 114 |
+
"name": "rmsnorm-f32-65535x512-undercliff",
|
| 115 |
+
"preset": "stress",
|
| 116 |
+
"vars": { "dtype": "float32", "rows": 65535, "dim": 512 },
|
| 117 |
+
"attrs": { "epsilon": 0.000001, "axis": -1 },
|
| 118 |
+
"inputs": {
|
| 119 |
+
"x": { "shape": [65535, 512], "dtype": "float32", "dist": "normal", "seed": 7240, "scale": 0.5 },
|
| 120 |
+
"scale": { "shape": [512], "dtype": "float32", "dist": "uniform", "seed": 7241, "scale": 0.25, "offset": 1 }
|
| 121 |
+
},
|
| 122 |
+
"outputs": { "y": { "shape": [65535, 512], "dtype": "float32" } },
|
| 123 |
+
"bench": {
|
| 124 |
+
"metrics": [{ "type": "bandwidth", "value": "(args.rows * args.dim * 2 + args.dim) * dtypeBytes(args.dtype)" }]
|
| 125 |
+
}
|
| 126 |
+
},
|
| 127 |
+
{
|
| 128 |
+
"name": "rmsnorm-f32-70000x512-rows-dispatchcliff",
|
| 129 |
+
"preset": "stress",
|
| 130 |
+
"provenance": { "notes": "Stress-only dispatch/capacity case: declared tensors occupy 273 MiB of GPU storage." },
|
| 131 |
+
"vars": { "dtype": "float32", "rows": 70000, "dim": 512 },
|
| 132 |
+
"attrs": { "epsilon": 0.000001, "axis": -1 },
|
| 133 |
+
"inputs": {
|
| 134 |
+
"x": { "shape": [70000, 512], "dtype": "float32", "dist": "normal", "seed": 7250, "scale": 0.5 },
|
| 135 |
+
"scale": { "shape": [512], "dtype": "float32", "dist": "uniform", "seed": 7251, "scale": 0.25, "offset": 1 }
|
| 136 |
+
},
|
| 137 |
+
"outputs": { "y": { "shape": [70000, 512], "dtype": "float32" } },
|
| 138 |
+
"bench": {
|
| 139 |
+
"metrics": [{ "type": "bandwidth", "value": "(args.rows * args.dim * 2 + args.dim) * dtypeBytes(args.dtype)" }]
|
| 140 |
+
}
|
| 141 |
+
},
|
| 142 |
+
{
|
| 143 |
+
"name": "rmsnorm-f16-8x262144-suffixaxis0-nosplitk-occupancy-starve",
|
| 144 |
+
"preset": "stress",
|
| 145 |
+
"vars": { "dtype": "float16", "outer": 8, "normSize": 262144 },
|
| 146 |
+
"attrs": { "epsilon": 0.000001, "axis": 0 },
|
| 147 |
+
"inputs": {
|
| 148 |
+
"x": { "shape": [8, 262144], "dtype": "float16", "dist": "normal", "seed": 7260, "scale": 0.5 },
|
| 149 |
+
"scale": { "shape": [262144], "dtype": "float16", "dist": "uniform", "seed": 7261, "scale": 0.25, "offset": 1 }
|
| 150 |
+
},
|
| 151 |
+
"outputs": { "y": { "shape": [8, 262144], "dtype": "float16", "dist": "empty" } },
|
| 152 |
+
"bench": {
|
| 153 |
+
"metrics": [
|
| 154 |
+
{ "type": "bandwidth", "value": "(args.outer * args.normSize * 2 + args.normSize) * dtypeBytes(args.dtype)" }
|
| 155 |
+
]
|
| 156 |
+
}
|
| 157 |
+
},
|
| 158 |
+
{
|
| 159 |
+
"name": "rmsnorm-f32-4x262144-lastaxis-scalarscale-fallback-starve",
|
| 160 |
+
"preset": "stress",
|
| 161 |
+
"vars": { "dtype": "float32", "rows": 4, "dim": 262144 },
|
| 162 |
+
"attrs": { "epsilon": 0.000001, "axis": -1 },
|
| 163 |
+
"inputs": {
|
| 164 |
+
"x": { "shape": [4, 262144], "dtype": "float32", "dist": "normal", "seed": 7270, "scale": 0.5 },
|
| 165 |
+
"scale": { "shape": [1], "dtype": "float32", "dist": "uniform", "seed": 7271, "scale": 0.25, "offset": 1 }
|
| 166 |
+
},
|
| 167 |
+
"outputs": { "y": { "shape": [4, 262144], "dtype": "float32", "dist": "empty" } },
|
| 168 |
+
"bench": {
|
| 169 |
+
"metrics": [{ "type": "bandwidth", "value": "(args.rows * args.dim * 2 + args.dim) * dtypeBytes(args.dtype)" }]
|
| 170 |
+
}
|
| 171 |
+
}
|
| 172 |
+
]
|
| 173 |
+
}
|
build/webgpu/manifest.json
ADDED
|
@@ -0,0 +1,369 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"domain": "ai.onnx",
|
| 3 |
+
"name": "RMSNormalization",
|
| 4 |
+
"sinceVersion": 23,
|
| 5 |
+
"description": "Computes RMS normalization over the suffix dimensions of `X` starting at `axis`: `Y = X / sqrt(mean(X^2) + epsilon) * scale`. The normalization stage supports TensorProto `stash_type` values `1` (float32) and `10` (float16), and is cast back to the dtype of `X` before `scale` is applied. The input type `T` and scale/output type `V` may independently be float16 or float32; ONNX's bfloat16 and double cases are not yet implemented.",
|
| 6 |
+
"inputs": [
|
| 7 |
+
{
|
| 8 |
+
"role": "X",
|
| 9 |
+
"dtype": "T",
|
| 10 |
+
"description": "Input tensor to be normalized; the RMS is taken over the last dimensions starting at `axis`."
|
| 11 |
+
},
|
| 12 |
+
{
|
| 13 |
+
"role": "scale",
|
| 14 |
+
"dtype": "V",
|
| 15 |
+
"description": "Scale tensor, unidirectionally broadcastable to `X`; its dtype `V` may differ from the input dtype `T`."
|
| 16 |
+
}
|
| 17 |
+
],
|
| 18 |
+
"outputs": [
|
| 19 |
+
{
|
| 20 |
+
"role": "Y",
|
| 21 |
+
"dtype": "V",
|
| 22 |
+
"rank": "ranks.X",
|
| 23 |
+
"shape": "shapes.X",
|
| 24 |
+
"description": "Normalized and scaled output tensor; same shape as `X` and same dtype `V` as `scale`."
|
| 25 |
+
}
|
| 26 |
+
],
|
| 27 |
+
"attributes": { "axis": -1, "epsilon": 0.00001, "stash_type": 1 },
|
| 28 |
+
"attributeDescriptions": {
|
| 29 |
+
"axis": "The first dimension of the normalization suffix; negative values count from the end, so the default `-1` normalizes over only the last dimension.",
|
| 30 |
+
"epsilon": "Small constant added to the mean square before taking the square root to avoid division by zero.",
|
| 31 |
+
"stash_type": "TensorProto element type used for normalization: `1` computes in float32, while `10` computes in float16."
|
| 32 |
+
},
|
| 33 |
+
"attributeConstraints": { "stash_type": { "values": [1, 10] } },
|
| 34 |
+
"typeConstraints": { "T": ["float32", "float16"], "V": ["float32", "float16"] },
|
| 35 |
+
"args": {
|
| 36 |
+
"x": { "kind": "tensor", "semantic": "X", "role": "input" },
|
| 37 |
+
"scale": { "kind": "tensor", "semantic": "scale", "role": "input" },
|
| 38 |
+
"y": { "kind": "tensor", "semantic": "Y", "role": "output" }
|
| 39 |
+
},
|
| 40 |
+
"tunables": {
|
| 41 |
+
"WORKGROUP_SIZE": 256,
|
| 42 |
+
"SPLIT_MAX_ROWS": 256,
|
| 43 |
+
"SPLIT_MIN_HIDDEN": 16384,
|
| 44 |
+
"SPLIT_TARGET_ELEMENTS": 4096,
|
| 45 |
+
"MAX_SPLITS": 64
|
| 46 |
+
},
|
| 47 |
+
"derive": {
|
| 48 |
+
"deviceWorkgroupCap": "min(device.limits.maxComputeInvocationsPerWorkgroup, device.limits.maxComputeWorkgroupSizeX)",
|
| 49 |
+
"wave32Adapter": "has(device.adapterInfo, \"subgroupMinSize\") and has(device.adapterInfo, \"subgroupMaxSize\") and device.adapterInfo.subgroupMinSize == 32 and device.adapterInfo.subgroupMaxSize == 32",
|
| 50 |
+
"reportedNonWave32Adapter": "not wave32Adapter and (has(device.adapterInfo, \"subgroupMinSize\") or has(device.adapterInfo, \"subgroupMaxSize\"))",
|
| 51 |
+
"normMaxWorkgroup": "min(tunables.WORKGROUP_SIZE, deviceWorkgroupCap)",
|
| 52 |
+
"hasSubgroupId": "device.features.has(\"subgroups\") and device.wgslLanguageFeatures.has(\"subgroup_id\")",
|
| 53 |
+
"axisNorm": "attrs.axis if attrs.axis >= 0 else attrs.axis + ranks.X",
|
| 54 |
+
"normalizedRows": "outer(shapes.X, axisNorm)",
|
| 55 |
+
"normalizedHidden": "dim(shapes.X, axisNorm) * inner(shapes.X, axisNorm)",
|
| 56 |
+
"normalizedDispatchRows": "0 if normalizedHidden == 0 else normalizedRows",
|
| 57 |
+
"normalizedWorkgroupHidden": "max(1, normalizedHidden)",
|
| 58 |
+
"normalizationShapeOk": "ranks.X >= 1 and ranks.scale >= 0 and ranks.scale <= ranks.X and sameShape(shapes.Y, shapes.X) and attrs.axis + ranks.X >= 0 and attrs.axis < ranks.X and broadcastable(shapes.scale, shapes.X) and f16Ok(dtypes.T) and f16Ok(dtypes.V)",
|
| 59 |
+
"baseOk": "normalizationShapeOk and attrs.stash_type == onnxDtypeCode(\"float32\")",
|
| 60 |
+
"stashF16Ok": "normalizationShapeOk and attrs.stash_type == onnxDtypeCode(\"float16\")",
|
| 61 |
+
"lastAxisOk": "baseOk and (attrs.axis == -1 or attrs.axis == ranks.X - 1)",
|
| 62 |
+
"suffixAxisOk": "baseOk and ranks.X >= 2 and not (attrs.axis == -1 or attrs.axis == ranks.X - 1)"
|
| 63 |
+
},
|
| 64 |
+
"bindingSets": {
|
| 65 |
+
"rows": [
|
| 66 |
+
{
|
| 67 |
+
"name": "x",
|
| 68 |
+
"arg": "x",
|
| 69 |
+
"semantic": "X",
|
| 70 |
+
"buffer": { "type": "read-only-storage" },
|
| 71 |
+
"elementType": "$xElement"
|
| 72 |
+
},
|
| 73 |
+
{
|
| 74 |
+
"name": "scale",
|
| 75 |
+
"arg": "scale",
|
| 76 |
+
"semantic": "scale",
|
| 77 |
+
"buffer": { "type": "read-only-storage" },
|
| 78 |
+
"elementType": "$ioElement"
|
| 79 |
+
},
|
| 80 |
+
{ "name": "y", "arg": "y", "semantic": "Y", "buffer": { "type": "storage" }, "elementType": "$ioElement" },
|
| 81 |
+
{
|
| 82 |
+
"name": "params",
|
| 83 |
+
"semantic": "kernel.params",
|
| 84 |
+
"buffer": { "type": "uniform" },
|
| 85 |
+
"struct": {
|
| 86 |
+
"name": "Params",
|
| 87 |
+
"fields": [
|
| 88 |
+
{ "name": "rows", "type": "u32", "value": "normalizedRows" },
|
| 89 |
+
{
|
| 90 |
+
"name": "rowStride",
|
| 91 |
+
"type": "u32",
|
| 92 |
+
"value": "max(1, min(normalizedRows, device.limits.maxComputeWorkgroupsPerDimension))"
|
| 93 |
+
}
|
| 94 |
+
]
|
| 95 |
+
}
|
| 96 |
+
}
|
| 97 |
+
],
|
| 98 |
+
"splitPartials": [
|
| 99 |
+
{
|
| 100 |
+
"name": "x",
|
| 101 |
+
"arg": "x",
|
| 102 |
+
"semantic": "X",
|
| 103 |
+
"buffer": { "type": "read-only-storage" },
|
| 104 |
+
"elementType": "$xElement"
|
| 105 |
+
},
|
| 106 |
+
{ "name": "partials", "semantic": "partials", "buffer": { "type": "storage" }, "elementType": "f32" },
|
| 107 |
+
{
|
| 108 |
+
"name": "params",
|
| 109 |
+
"semantic": "kernel.params",
|
| 110 |
+
"buffer": { "type": "uniform" },
|
| 111 |
+
"struct": {
|
| 112 |
+
"name": "Params",
|
| 113 |
+
"fields": [
|
| 114 |
+
{ "name": "rows", "type": "u32", "value": "splitRows" },
|
| 115 |
+
{
|
| 116 |
+
"name": "rowStride",
|
| 117 |
+
"type": "u32",
|
| 118 |
+
"value": "max(1, min(splitRows, device.limits.maxComputeWorkgroupsPerDimension))"
|
| 119 |
+
}
|
| 120 |
+
]
|
| 121 |
+
}
|
| 122 |
+
}
|
| 123 |
+
],
|
| 124 |
+
"splitNormalize": [
|
| 125 |
+
{
|
| 126 |
+
"name": "x",
|
| 127 |
+
"arg": "x",
|
| 128 |
+
"semantic": "X",
|
| 129 |
+
"buffer": { "type": "read-only-storage" },
|
| 130 |
+
"elementType": "$xElement"
|
| 131 |
+
},
|
| 132 |
+
{
|
| 133 |
+
"name": "scale",
|
| 134 |
+
"arg": "scale",
|
| 135 |
+
"semantic": "scale",
|
| 136 |
+
"buffer": { "type": "read-only-storage" },
|
| 137 |
+
"elementType": "$ioElement"
|
| 138 |
+
},
|
| 139 |
+
{ "name": "partials", "semantic": "partials", "buffer": { "type": "read-only-storage" }, "elementType": "f32" },
|
| 140 |
+
{ "name": "y", "arg": "y", "semantic": "Y", "buffer": { "type": "storage" }, "elementType": "$ioElement" },
|
| 141 |
+
{
|
| 142 |
+
"name": "params",
|
| 143 |
+
"semantic": "kernel.params",
|
| 144 |
+
"buffer": { "type": "uniform" },
|
| 145 |
+
"struct": {
|
| 146 |
+
"name": "Params",
|
| 147 |
+
"fields": [
|
| 148 |
+
{ "name": "rows", "type": "u32", "value": "splitRows" },
|
| 149 |
+
{
|
| 150 |
+
"name": "rowStride",
|
| 151 |
+
"type": "u32",
|
| 152 |
+
"value": "max(1, min(splitRows, device.limits.maxComputeWorkgroupsPerDimension))"
|
| 153 |
+
}
|
| 154 |
+
]
|
| 155 |
+
}
|
| 156 |
+
}
|
| 157 |
+
]
|
| 158 |
+
},
|
| 159 |
+
"variants": [
|
| 160 |
+
{
|
| 161 |
+
"id": "stash_f16_serial",
|
| 162 |
+
"priority": 1000,
|
| 163 |
+
"when": "stashF16Ok",
|
| 164 |
+
"constants": {
|
| 165 |
+
"scalar": "dtypes.V",
|
| 166 |
+
"xElement": "dtypes.T",
|
| 167 |
+
"ioElement": "dtypes.V",
|
| 168 |
+
"usesF16": "dtypes.T == \"f16\" or dtypes.V == \"f16\"",
|
| 169 |
+
"hiddenSize": "normalizedHidden",
|
| 170 |
+
"epsilon": "attrs.epsilon"
|
| 171 |
+
},
|
| 172 |
+
"passes": [
|
| 173 |
+
{
|
| 174 |
+
"id": "main",
|
| 175 |
+
"name": "RMSNormalization.StashF16Serial",
|
| 176 |
+
"source": {
|
| 177 |
+
"shader": "rms-normalization-stash-f16-serial.wgsl.jinja",
|
| 178 |
+
"inputs": {
|
| 179 |
+
"xShape": "shapes.X",
|
| 180 |
+
"scaleShape": "shapes.scale",
|
| 181 |
+
"xRank": "ranks.X",
|
| 182 |
+
"scaleRank": "ranks.scale"
|
| 183 |
+
}
|
| 184 |
+
},
|
| 185 |
+
"bindings": "rows",
|
| 186 |
+
"dispatch": { "workgroups": "normalizedDispatchRows" }
|
| 187 |
+
}
|
| 188 |
+
]
|
| 189 |
+
},
|
| 190 |
+
{
|
| 191 |
+
"id": "suffix_axis_splitk",
|
| 192 |
+
"priority": 15,
|
| 193 |
+
"derive": {
|
| 194 |
+
"splitRows": "normalizedRows",
|
| 195 |
+
"splitHidden": "normalizedHidden",
|
| 196 |
+
"split": "min(tunables.MAX_SPLITS, pow2ceil(ceilDiv(splitHidden, tunables.SPLIT_TARGET_ELEMENTS)))"
|
| 197 |
+
},
|
| 198 |
+
"when": ["baseOk", "ranks.X >= 2", "normalizedRows <= tunables.SPLIT_MAX_ROWS", "normalizedHidden >= tunables.SPLIT_MIN_HIDDEN", "min(tunables.MAX_SPLITS, pow2ceil(ceilDiv(normalizedHidden, tunables.SPLIT_TARGET_ELEMENTS))) <= device.limits.maxComputeWorkgroupsPerDimension", "normalizedRows * min(tunables.MAX_SPLITS, pow2ceil(ceilDiv(normalizedHidden, tunables.SPLIT_TARGET_ELEMENTS))) * 4 <= device.limits.maxStorageBufferBindingSize", "normalizedRows * min(tunables.MAX_SPLITS, pow2ceil(ceilDiv(normalizedHidden, tunables.SPLIT_TARGET_ELEMENTS))) * 4 <= device.limits.maxBufferSize"],
|
| 199 |
+
"demoteWhen": ["reportedNonWave32Adapter"],
|
| 200 |
+
"constants": {
|
| 201 |
+
"scalar": "dtypes.V",
|
| 202 |
+
"xElement": "dtypes.T",
|
| 203 |
+
"ioElement": "dtypes.V",
|
| 204 |
+
"usesF16": "dtypes.T == \"f16\" or dtypes.V == \"f16\"",
|
| 205 |
+
"hiddenSize": "splitHidden",
|
| 206 |
+
"workgroupSize": "normMaxWorkgroup",
|
| 207 |
+
"split": "split",
|
| 208 |
+
"epsilon": "attrs.epsilon"
|
| 209 |
+
},
|
| 210 |
+
"intermediates": [{ "id": "partials", "dtype": "float32", "shape": "[splitRows * split]" }],
|
| 211 |
+
"passes": [
|
| 212 |
+
{
|
| 213 |
+
"id": "partials",
|
| 214 |
+
"name": "RMSNormalization.SplitKPartials",
|
| 215 |
+
"source": { "shader": "rms-normalization-splitk-partials.wgsl.jinja", "inputs": {} },
|
| 216 |
+
"bindings": "splitPartials",
|
| 217 |
+
"dispatch": { "workgroups": "splitRows", "z": "split" }
|
| 218 |
+
},
|
| 219 |
+
{
|
| 220 |
+
"id": "normalize",
|
| 221 |
+
"name": "RMSNormalization.SplitKNormalize",
|
| 222 |
+
"source": {
|
| 223 |
+
"shader": "rms-normalization-splitk-normalize.wgsl.jinja",
|
| 224 |
+
"inputs": {
|
| 225 |
+
"xShape": "shapes.X",
|
| 226 |
+
"scaleShape": "shapes.scale",
|
| 227 |
+
"xRank": "ranks.X",
|
| 228 |
+
"scaleRank": "ranks.scale",
|
| 229 |
+
"writeStats": false,
|
| 230 |
+
"rmsScaleAfterCast": true
|
| 231 |
+
}
|
| 232 |
+
},
|
| 233 |
+
"bindings": "splitNormalize",
|
| 234 |
+
"dispatch": { "workgroups": "splitRows", "z": "split" }
|
| 235 |
+
}
|
| 236 |
+
]
|
| 237 |
+
},
|
| 238 |
+
{
|
| 239 |
+
"id": "last_axis",
|
| 240 |
+
"priority": 0,
|
| 241 |
+
"when": "lastAxisOk",
|
| 242 |
+
"constants": {
|
| 243 |
+
"scalar": "dtypes.V",
|
| 244 |
+
"xElement": "dtypes.T",
|
| 245 |
+
"usesF16": "dtypes.T == \"f16\" or dtypes.V == \"f16\"",
|
| 246 |
+
"ioElement": "dtypes.V",
|
| 247 |
+
"hiddenSize": "normalizedHidden",
|
| 248 |
+
"workgroupSize": "min(normMaxWorkgroup, pow2ceil(normalizedWorkgroupHidden))",
|
| 249 |
+
"epsilon": "attrs.epsilon"
|
| 250 |
+
},
|
| 251 |
+
"passes": [
|
| 252 |
+
{
|
| 253 |
+
"id": "main",
|
| 254 |
+
"name": "RMSNormalization",
|
| 255 |
+
"source": {
|
| 256 |
+
"shader": "rms-normalization.wgsl.jinja",
|
| 257 |
+
"inputs": {
|
| 258 |
+
"xShape": "shapes.X",
|
| 259 |
+
"scaleShape": "shapes.scale",
|
| 260 |
+
"xRank": "ranks.X",
|
| 261 |
+
"scaleRank": "ranks.scale",
|
| 262 |
+
"writeStats": false,
|
| 263 |
+
"rmsScaleAfterCast": true
|
| 264 |
+
}
|
| 265 |
+
},
|
| 266 |
+
"bindings": "rows",
|
| 267 |
+
"dispatch": { "workgroups": "normalizedDispatchRows" }
|
| 268 |
+
}
|
| 269 |
+
]
|
| 270 |
+
},
|
| 271 |
+
{
|
| 272 |
+
"id": "suffix_axis",
|
| 273 |
+
"priority": 10,
|
| 274 |
+
"when": "suffixAxisOk",
|
| 275 |
+
"constants": {
|
| 276 |
+
"scalar": "dtypes.V",
|
| 277 |
+
"xElement": "dtypes.T",
|
| 278 |
+
"usesF16": "dtypes.T == \"f16\" or dtypes.V == \"f16\"",
|
| 279 |
+
"ioElement": "dtypes.V",
|
| 280 |
+
"hiddenSize": "normalizedHidden",
|
| 281 |
+
"workgroupSize": "min(normMaxWorkgroup, pow2ceil(normalizedWorkgroupHidden))",
|
| 282 |
+
"epsilon": "attrs.epsilon"
|
| 283 |
+
},
|
| 284 |
+
"passes": [
|
| 285 |
+
{
|
| 286 |
+
"id": "main",
|
| 287 |
+
"name": "RMSNormalization.SuffixAxis",
|
| 288 |
+
"source": {
|
| 289 |
+
"shader": "rms-normalization.wgsl.jinja",
|
| 290 |
+
"inputs": {
|
| 291 |
+
"xShape": "shapes.X",
|
| 292 |
+
"scaleShape": "shapes.scale",
|
| 293 |
+
"xRank": "ranks.X",
|
| 294 |
+
"scaleRank": "ranks.scale",
|
| 295 |
+
"writeStats": false,
|
| 296 |
+
"rmsScaleAfterCast": true
|
| 297 |
+
}
|
| 298 |
+
},
|
| 299 |
+
"bindings": "rows",
|
| 300 |
+
"dispatch": { "workgroups": "normalizedDispatchRows" }
|
| 301 |
+
}
|
| 302 |
+
]
|
| 303 |
+
},
|
| 304 |
+
{
|
| 305 |
+
"id": "last_axis_row_vec4",
|
| 306 |
+
"priority": 110,
|
| 307 |
+
"when": ["lastAxisOk", "dtypes.T == dtypes.V", "ranks.scale >= 1", "numel(shapes.scale) == dim(shapes.X, -1)", "dim(shapes.scale, -1) == dim(shapes.X, -1)", "dim(shapes.X, -1) % 4 == 0"],
|
| 308 |
+
"constants": { "xElement": "\"vec4<\" ~ dtypes.T ~ \">\"", "ioElement": "\"vec4<\" ~ dtypes.T ~ \">\"" },
|
| 309 |
+
"passes": [
|
| 310 |
+
{
|
| 311 |
+
"id": "main",
|
| 312 |
+
"name": "RMSNormalization.LastAxisRow",
|
| 313 |
+
"source": {
|
| 314 |
+
"shader": "norm-row-stats.wgsl.jinja",
|
| 315 |
+
"inputs": {
|
| 316 |
+
"mode": "\"rms\"",
|
| 317 |
+
"vec4": true,
|
| 318 |
+
"writeStats": false,
|
| 319 |
+
"rmsScaleAfterCast": true,
|
| 320 |
+
"scalar": "dtypes.T",
|
| 321 |
+
"usesF16": "dtypes.T == \"f16\"",
|
| 322 |
+
"hidden": "dim(shapes.X, -1)",
|
| 323 |
+
"wg": "min(normMaxWorkgroup, pow2ceil(max(1, dim(shapes.X, -1) / 4)))",
|
| 324 |
+
"epsilon": "attrs.epsilon",
|
| 325 |
+
"hiddenVec": "dim(shapes.X, -1) / 4",
|
| 326 |
+
"vecType": "\"vec4<\" ~ dtypes.T ~ \">\"",
|
| 327 |
+
"combineSubgroups": "hasSubgroupId"
|
| 328 |
+
}
|
| 329 |
+
},
|
| 330 |
+
"subgroupCollectivesWidth": "portable",
|
| 331 |
+
"bindings": "rows",
|
| 332 |
+
"dispatch": { "workgroups": "normalizedDispatchRows" }
|
| 333 |
+
}
|
| 334 |
+
]
|
| 335 |
+
},
|
| 336 |
+
{
|
| 337 |
+
"id": "last_axis_row",
|
| 338 |
+
"priority": 100,
|
| 339 |
+
"when": ["lastAxisOk", "dtypes.T == dtypes.V", "ranks.scale >= 1", "numel(shapes.scale) == dim(shapes.X, -1)", "dim(shapes.scale, -1) == dim(shapes.X, -1)", "true"],
|
| 340 |
+
"constants": { "xElement": "dtypes.T", "ioElement": "dtypes.T" },
|
| 341 |
+
"passes": [
|
| 342 |
+
{
|
| 343 |
+
"id": "main",
|
| 344 |
+
"name": "RMSNormalization.LastAxisRow",
|
| 345 |
+
"source": {
|
| 346 |
+
"shader": "norm-row-stats.wgsl.jinja",
|
| 347 |
+
"inputs": {
|
| 348 |
+
"mode": "\"rms\"",
|
| 349 |
+
"vec4": false,
|
| 350 |
+
"writeStats": false,
|
| 351 |
+
"rmsScaleAfterCast": true,
|
| 352 |
+
"scalar": "dtypes.T",
|
| 353 |
+
"usesF16": "dtypes.T == \"f16\"",
|
| 354 |
+
"hidden": "dim(shapes.X, -1)",
|
| 355 |
+
"wg": "min(normMaxWorkgroup, pow2ceil(max(1, dim(shapes.X, -1))))",
|
| 356 |
+
"epsilon": "attrs.epsilon",
|
| 357 |
+
"hiddenVec": 1,
|
| 358 |
+
"vecType": "\"vec4<\" ~ dtypes.T ~ \">\"",
|
| 359 |
+
"combineSubgroups": "hasSubgroupId"
|
| 360 |
+
}
|
| 361 |
+
},
|
| 362 |
+
"subgroupCollectivesWidth": "portable",
|
| 363 |
+
"bindings": "rows",
|
| 364 |
+
"dispatch": { "workgroups": "normalizedDispatchRows" }
|
| 365 |
+
}
|
| 366 |
+
]
|
| 367 |
+
}
|
| 368 |
+
]
|
| 369 |
+
}
|
build/webgpu/metadata.json
ADDED
|
@@ -0,0 +1,22 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"name": "ai.onnx.RMSNormalization",
|
| 3 |
+
"id": "_ai_onnx_rmsnormalization_webgpu_78878c2",
|
| 4 |
+
"version": 1,
|
| 5 |
+
"license": "Apache-2.0",
|
| 6 |
+
"backend": { "type": "webgpu" },
|
| 7 |
+
"digest": {
|
| 8 |
+
"algorithm": "sha256",
|
| 9 |
+
"files": {
|
| 10 |
+
"bench.json": "aQ8RZqdCxZw7VI+7n2XQneyE8kM1Qzire3++ZtvURxg=",
|
| 11 |
+
"manifest.json": "Nl952QCnY+Pw6VgYi/lKfYZEh3PpBL2LijyCQqtMTTg=",
|
| 12 |
+
"norm-row-stats.wgsl.jinja": "uxWNeifDOH5P8jfrDfE95ow3QGhewBtScBqM76ps2YI=",
|
| 13 |
+
"rms-normalization-splitk-normalize.wgsl.jinja": "TXhEDbPnIGP5Ba5SckUHyuuAdCWCip2BH5sJLZ43DdE=",
|
| 14 |
+
"rms-normalization-splitk-partials.wgsl.jinja": "GbYu7Cj/LLO9y2Rvhw30RJAUAduI0xfN5YS3H/4Z1k8=",
|
| 15 |
+
"rms-normalization-stash-f16-serial.wgsl.jinja": "tzxVAVThZ5QRnu0dtHoYwqYErZwth2dViidXHaqsVGo=",
|
| 16 |
+
"rms-normalization.wgsl.jinja": "2YtdapcEAWQUL/wotiMPs8i6wfRV3VG+y+CPhdu47nM=",
|
| 17 |
+
"test.json": "09ASLvCprHAheaBj+hX9jc5xDu/05mUj7mOoFwJWWyk="
|
| 18 |
+
}
|
| 19 |
+
},
|
| 20 |
+
"provenance": { "kernel": { "sha": "2e7068faf55e7f43df740015f6d1ee49391a41c5", "dirty": false } },
|
| 21 |
+
"webgpu": { "manifestSpec": "1.0", "specialized": true, "opPath": "ops/ai.onnx.RMSNormalization" }
|
| 22 |
+
}
|
build/webgpu/norm-row-stats.wgsl.jinja
ADDED
|
@@ -0,0 +1,124 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{% if source.usesF16 %}
|
| 2 |
+
enable f16;
|
| 3 |
+
{% endif %}
|
| 4 |
+
{% set combineSubgroups = source.combineSubgroups %}
|
| 5 |
+
{% set scalarIo = source.scalarIo if source.scalarIo is defined else false %}
|
| 6 |
+
{% set rmsScaleVec = "vec4<f32>(scale[i])" %}
|
| 7 |
+
{% set rmsScaleScalar = "f32(scale[i])" %}
|
| 8 |
+
{% set reduceThreadParameters = ", sg_lane: u32, sg_id: u32, num_sg: u32"
|
| 9 |
+
if combineSubgroups else ", tid: u32" %}
|
| 10 |
+
{% set reduceThreadArguments = ", sg_lane, sg_id, num_sg"
|
| 11 |
+
if combineSubgroups else ", tid" %}
|
| 12 |
+
{% if combineSubgroups %}
|
| 13 |
+
enable subgroups;
|
| 14 |
+
{% endif %}
|
| 15 |
+
{{ env.wgsl.resourceDeclarations }}
|
| 16 |
+
|
| 17 |
+
// Workgroup-parallel single-pass row statistics + fused normalize/affine.
|
| 18 |
+
//
|
| 19 |
+
// One workgroup owns one contiguous normalization span ("row": a last-axis
|
| 20 |
+
// row, an instance plane, or a channel group). Threads stride the row once,
|
| 21 |
+
// accumulating (sum, sum_sq) simultaneously. Partials are reduced either with
|
| 22 |
+
// subgroupAdd plus a shared-memory combine or with a portable shared-memory
|
| 23 |
+
// tree, then every thread applies the fused normalize + affine write.
|
| 24 |
+
//
|
| 25 |
+
// RMS mode uses sum_sq / HIDDEN without computing or subtracting a mean.
|
| 26 |
+
const HIDDEN: u32 = {{ source.hidden }}u;
|
| 27 |
+
{% if source.vec4 %}
|
| 28 |
+
const HIDDEN_V: u32 = {{ source.hiddenVec }}u;
|
| 29 |
+
{% endif %}
|
| 30 |
+
const WG: u32 = {{ source.wg }}u;
|
| 31 |
+
const EPSILON: f32 = {{ source.epsilon }};
|
| 32 |
+
|
| 33 |
+
|
| 34 |
+
|
| 35 |
+
{% if combineSubgroups %}
|
| 36 |
+
var<workgroup> sg_partials: array<f32, WG>;
|
| 37 |
+
|
| 38 |
+
fn reduce_scalar(value: f32{{ reduceThreadParameters }}) -> f32 {
|
| 39 |
+
let s = subgroupAdd(value);
|
| 40 |
+
if (num_sg == 1u) {
|
| 41 |
+
return s;
|
| 42 |
+
}
|
| 43 |
+
if (sg_lane == 0u) {
|
| 44 |
+
sg_partials[sg_id] = s;
|
| 45 |
+
}
|
| 46 |
+
workgroupBarrier();
|
| 47 |
+
var total = 0.0;
|
| 48 |
+
for (var i = 0u; i < num_sg; i++) {
|
| 49 |
+
total += sg_partials[i];
|
| 50 |
+
}
|
| 51 |
+
return total;
|
| 52 |
+
}
|
| 53 |
+
{% else %}
|
| 54 |
+
// Each shared-memory tree reduction deliberately ends with a barrier. It keeps
|
| 55 |
+
// lanes that have read the result from starting a later reduction and
|
| 56 |
+
// overwriting scratch while slower lanes are still reading it.
|
| 57 |
+
var<workgroup> tr0: array<f32, WG>;
|
| 58 |
+
fn reduce_scalar(value: f32, tid: u32) -> f32 {
|
| 59 |
+
tr0[tid] = value;
|
| 60 |
+
workgroupBarrier();
|
| 61 |
+
var stride: u32 = WG / 2u;
|
| 62 |
+
loop {
|
| 63 |
+
if (stride == 0u) { break; }
|
| 64 |
+
if (tid < stride) { tr0[tid] = tr0[tid] + tr0[tid + stride]; }
|
| 65 |
+
stride = stride / 2u;
|
| 66 |
+
workgroupBarrier();
|
| 67 |
+
}
|
| 68 |
+
let reduced = tr0[0];
|
| 69 |
+
workgroupBarrier();
|
| 70 |
+
return reduced;
|
| 71 |
+
}
|
| 72 |
+
{% endif %}
|
| 73 |
+
|
| 74 |
+
@compute @workgroup_size(WG, 1, 1)
|
| 75 |
+
fn main(
|
| 76 |
+
@builtin(workgroup_id) wg_id: vec3<u32>,
|
| 77 |
+
@builtin(local_invocation_id) lid: vec3<u32>{% if combineSubgroups %},
|
| 78 |
+
@builtin(subgroup_invocation_id) sg_lane: u32,
|
| 79 |
+
@builtin(subgroup_id) sg_id: u32,
|
| 80 |
+
@builtin(num_subgroups) num_sg: u32{% endif %}
|
| 81 |
+
) {
|
| 82 |
+
let row = wg_id.x + wg_id.y * params.rowStride;
|
| 83 |
+
if (row >= params.rows) {
|
| 84 |
+
return;
|
| 85 |
+
}
|
| 86 |
+
let tid = lid.x;
|
| 87 |
+
{% if source.vec4 and not scalarIo %}
|
| 88 |
+
let base = row * HIDDEN_V;
|
| 89 |
+
{% else %}
|
| 90 |
+
let base = row * HIDDEN;
|
| 91 |
+
{% endif %}
|
| 92 |
+
|
| 93 |
+
|
| 94 |
+
var acc = 0.0;
|
| 95 |
+
{% if source.vec4 %}
|
| 96 |
+
for (var i = tid; i < HIDDEN_V; i = i + WG) {
|
| 97 |
+
let v = vec4<f32>(x[base + i]);
|
| 98 |
+
acc = acc + dot(v, v);
|
| 99 |
+
}
|
| 100 |
+
{% else %}
|
| 101 |
+
for (var i = tid; i < HIDDEN; i = i + WG) {
|
| 102 |
+
let v = f32(x[base + i]);
|
| 103 |
+
acc = acc + v * v;
|
| 104 |
+
}
|
| 105 |
+
{% endif %}
|
| 106 |
+
|
| 107 |
+
let total = reduce_scalar(acc{{ reduceThreadArguments }});
|
| 108 |
+
|
| 109 |
+
let inv = inverseSqrt(total / f32(HIDDEN) + EPSILON);
|
| 110 |
+
|
| 111 |
+
{% if source.vec4 %}
|
| 112 |
+
for (var i = tid; i < HIDDEN_V; i = i + WG) {
|
| 113 |
+
let idx = base + i;
|
| 114 |
+
let v = vec4<f32>(x[idx]);
|
| 115 |
+
y[idx] = {{ source.vecType }}(v * inv) * {{ source.vecType }}({{ rmsScaleVec }});
|
| 116 |
+
}
|
| 117 |
+
{% else %}
|
| 118 |
+
for (var i = tid; i < HIDDEN; i = i + WG) {
|
| 119 |
+
let idx = base + i;
|
| 120 |
+
let v = f32(x[idx]);
|
| 121 |
+
y[idx] = {{ source.scalar }}(v * inv) * {{ source.scalar }}({{ rmsScaleScalar }});
|
| 122 |
+
}
|
| 123 |
+
{% endif %}
|
| 124 |
+
}
|
build/webgpu/rms-normalization-splitk-normalize.wgsl.jinja
ADDED
|
@@ -0,0 +1,93 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
// Split-K normalize pass. Each workgroup (row = wg.x, split index = wg.z)
|
| 2 |
+
// folds the SPLIT per-row partial sums of squares into the RMS scale, then
|
| 3 |
+
// normalizes its HIDDEN/SPLIT slice. SPLIT is small (<=64), so the serial fold
|
| 4 |
+
// avoids a third combine pass. Scale offsets follow the suffix-axis broadcast
|
| 5 |
+
// contract.
|
| 6 |
+
{% if usesF16 %}
|
| 7 |
+
enable f16;
|
| 8 |
+
{% endif %}
|
| 9 |
+
{{ env.wgsl.resourceDeclarations }}
|
| 10 |
+
|
| 11 |
+
const HIDDEN: u32 = {{ hiddenSize }}u;
|
| 12 |
+
const EPSILON: f32 = {{ epsilon }};
|
| 13 |
+
const WG: u32 = {{ workgroupSize }}u;
|
| 14 |
+
const SPLIT: u32 = {{ split }}u;
|
| 15 |
+
|
| 16 |
+
{% if source.scaleRank > 0 %}
|
| 17 |
+
const X_RANK: u32 = {{ source.xRank }}u;
|
| 18 |
+
const SCALE_RANK: u32 = {{ source.scaleRank }}u;
|
| 19 |
+
const X_SHAPE: array<u32, {{ source.xRank }}> = array<u32, {{ source.xRank }}>({% for d in source.xShape %}{{ d }}u{% if not loop.last %}, {% endif %}{% endfor %});
|
| 20 |
+
const SCALE_SHAPE: array<u32, {{ source.scaleRank }}> = array<u32, {{ source.scaleRank }}>({% for d in source.scaleShape %}{{ d }}u{% if not loop.last %}, {% endif %}{% endfor %});
|
| 21 |
+
|
| 22 |
+
fn x_stride(axis: u32) -> u32 {
|
| 23 |
+
var stride = 1u;
|
| 24 |
+
for (var i = axis + 1u; i < X_RANK; i += 1u) {
|
| 25 |
+
stride *= X_SHAPE[i];
|
| 26 |
+
}
|
| 27 |
+
return stride;
|
| 28 |
+
}
|
| 29 |
+
|
| 30 |
+
fn scale_stride(axis: u32) -> u32 {
|
| 31 |
+
var stride = 1u;
|
| 32 |
+
for (var i = axis + 1u; i < SCALE_RANK; i += 1u) {
|
| 33 |
+
stride *= SCALE_SHAPE[i];
|
| 34 |
+
}
|
| 35 |
+
return stride;
|
| 36 |
+
}
|
| 37 |
+
|
| 38 |
+
{% endif %}
|
| 39 |
+
fn scale_offset({% if source.scaleRank > 0 %}out_index: u32{% endif %}) -> u32 {
|
| 40 |
+
{% if source.scaleRank == 0 %}
|
| 41 |
+
return 0u;
|
| 42 |
+
{% else %}
|
| 43 |
+
var rem = out_index;
|
| 44 |
+
var offset = 0u;
|
| 45 |
+
for (var axis = 0u; axis < X_RANK; axis += 1u) {
|
| 46 |
+
let stride = x_stride(axis);
|
| 47 |
+
let coord = rem / stride;
|
| 48 |
+
rem %= stride;
|
| 49 |
+
let scale_axis = i32(axis) - i32(X_RANK - SCALE_RANK);
|
| 50 |
+
if (scale_axis >= 0) {
|
| 51 |
+
let s_axis = u32(scale_axis);
|
| 52 |
+
if (SCALE_SHAPE[s_axis] != 1u) {
|
| 53 |
+
offset += coord * scale_stride(s_axis);
|
| 54 |
+
}
|
| 55 |
+
}
|
| 56 |
+
}
|
| 57 |
+
return offset;
|
| 58 |
+
{% endif %}
|
| 59 |
+
}
|
| 60 |
+
|
| 61 |
+
|
| 62 |
+
@compute @workgroup_size(WG, 1, 1)
|
| 63 |
+
fn main(@builtin(workgroup_id) wg: vec3<u32>, @builtin(local_invocation_id) lid: vec3<u32>) {
|
| 64 |
+
let row = wg.x + wg.y * params.rowStride;
|
| 65 |
+
if (row >= params.rows) {
|
| 66 |
+
return;
|
| 67 |
+
}
|
| 68 |
+
let k = wg.z;
|
| 69 |
+
let tid = lid.x;
|
| 70 |
+
|
| 71 |
+
var total = 0.0;
|
| 72 |
+
for (var i = 0u; i < SPLIT; i = i + 1u) {
|
| 73 |
+
total = total + partials[row * SPLIT + i];
|
| 74 |
+
}
|
| 75 |
+
let inv = inverseSqrt(total / f32(HIDDEN) + EPSILON);
|
| 76 |
+
let chunk = (HIDDEN + SPLIT - 1u) / SPLIT;
|
| 77 |
+
let start = k * chunk;
|
| 78 |
+
var end = start + chunk;
|
| 79 |
+
if (end > HIDDEN) { end = HIDDEN; }
|
| 80 |
+
let base = row * HIDDEN;
|
| 81 |
+
|
| 82 |
+
var d = start + tid;
|
| 83 |
+
loop {
|
| 84 |
+
if (d >= end) { break; }
|
| 85 |
+
let index = base + d;
|
| 86 |
+
// Preserve the ONNX stage boundary: round Normalized to X's dtype before
|
| 87 |
+
// the affine scale is applied.
|
| 88 |
+
let normalized = {{ xElement }}(f32(x[index]) * inv);
|
| 89 |
+
let value = f32(normalized) * f32(scale[scale_offset({% if source.scaleRank > 0 %}index{% endif %})]);
|
| 90 |
+
y[index] = {{ scalar }}(value);
|
| 91 |
+
d = d + WG;
|
| 92 |
+
}
|
| 93 |
+
}
|
build/webgpu/rms-normalization-splitk-partials.wgsl.jinja
ADDED
|
@@ -0,0 +1,93 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{% macro wgsl_tree_fold_stmt(a, op, idx, svar) %}
|
| 2 |
+
{% if op == "max" %}
|
| 3 |
+
{{ a }}[{{ idx }}] = max({{ a }}[{{ idx }}], {{ a }}[{{ idx }} + {{ svar }}]);
|
| 4 |
+
{%- else %}
|
| 5 |
+
{{ a }}[{{ idx }}] = {{ a }}[{{ idx }}] + {{ a }}[{{ idx }} + {{ svar }}];
|
| 6 |
+
{%- endif %}
|
| 7 |
+
{% endmacro %}
|
| 8 |
+
{% macro wgsl_tree_fold(arrays, op="add", idx="lid", wg="WORKGROUP_SIZE", svar="stride", typed=false, form="tail", breakInline=false, bodyInline=false, barrierFirst=false) %}
|
| 9 |
+
var {{ svar }}{{ ": u32 " if typed else " " }}= {{ wg }} / 2u;
|
| 10 |
+
loop {
|
| 11 |
+
{% if form == "head" %}
|
| 12 |
+
{% if breakInline %}
|
| 13 |
+
if ({{ svar }} == 0u) { break; }
|
| 14 |
+
{% else %}
|
| 15 |
+
if ({{ svar }} == 0u) {
|
| 16 |
+
break;
|
| 17 |
+
}
|
| 18 |
+
{% endif %}
|
| 19 |
+
{% endif %}
|
| 20 |
+
{% if bodyInline %}
|
| 21 |
+
if ({{ idx }} < {{ svar }}) { {{ wgsl_tree_fold_stmt(arrays[0], op, idx, svar) }} }
|
| 22 |
+
{% else %}
|
| 23 |
+
if ({{ idx }} < {{ svar }}) {
|
| 24 |
+
{% for a in arrays %}
|
| 25 |
+
{{ wgsl_tree_fold_stmt(a, op, idx, svar) }}
|
| 26 |
+
{% endfor %}
|
| 27 |
+
}
|
| 28 |
+
{% endif %}
|
| 29 |
+
{% if form == "head" %}
|
| 30 |
+
{% if barrierFirst %}
|
| 31 |
+
workgroupBarrier();
|
| 32 |
+
{{ svar }} = {{ svar }} / 2u;
|
| 33 |
+
{% else %}
|
| 34 |
+
{{ svar }} = {{ svar }} / 2u;
|
| 35 |
+
workgroupBarrier();
|
| 36 |
+
{% endif %}
|
| 37 |
+
{% else %}
|
| 38 |
+
workgroupBarrier();
|
| 39 |
+
if ({{ svar }} == 1u) {
|
| 40 |
+
break;
|
| 41 |
+
}
|
| 42 |
+
{{ svar }} = {{ svar }} / 2u;
|
| 43 |
+
{% endif %}
|
| 44 |
+
}
|
| 45 |
+
{%- endmacro %}
|
| 46 |
+
|
| 47 |
+
/* Split-K partial sum-of-squares for tensors with few rows and a large hidden
|
| 48 |
+
dimension. A workgroup-per-row kernel exposes too little parallelism in this
|
| 49 |
+
regime, so this pass splits each row across SPLIT workgroups
|
| 50 |
+
(row = wg.x, split index = wg.z). Each workgroup accumulates a partial
|
| 51 |
+
sum-of-squares over its HIDDEN/SPLIT slice and writes one partial to scratch.
|
| 52 |
+
The normalize pass folds the SPLIT partials per row. Split-K reassociates the
|
| 53 |
+
f32 sum, so this route is not bit-identical to the unsplit reduction. */
|
| 54 |
+
{% if usesF16 %}
|
| 55 |
+
enable f16;
|
| 56 |
+
{% endif %}
|
| 57 |
+
{{ env.wgsl.resourceDeclarations }}
|
| 58 |
+
|
| 59 |
+
const HIDDEN: u32 = {{ hiddenSize }}u;
|
| 60 |
+
const WG: u32 = {{ workgroupSize }}u;
|
| 61 |
+
const SPLIT: u32 = {{ split }}u;
|
| 62 |
+
|
| 63 |
+
var<workgroup> red: array<f32, WG>;
|
| 64 |
+
|
| 65 |
+
@compute @workgroup_size(WG, 1, 1)
|
| 66 |
+
fn main(@builtin(workgroup_id) wg: vec3<u32>, @builtin(local_invocation_id) lid: vec3<u32>) {
|
| 67 |
+
let row = wg.x + wg.y * params.rowStride;
|
| 68 |
+
if (row >= params.rows) {
|
| 69 |
+
return;
|
| 70 |
+
}
|
| 71 |
+
let k = wg.z;
|
| 72 |
+
let tid = lid.x;
|
| 73 |
+
let chunk = (HIDDEN + SPLIT - 1u) / SPLIT;
|
| 74 |
+
let start = k * chunk;
|
| 75 |
+
var end = start + chunk;
|
| 76 |
+
if (end > HIDDEN) { end = HIDDEN; }
|
| 77 |
+
let base = row * HIDDEN;
|
| 78 |
+
|
| 79 |
+
var acc = 0.0;
|
| 80 |
+
var d = start + tid;
|
| 81 |
+
loop {
|
| 82 |
+
if (d >= end) { break; }
|
| 83 |
+
let v = f32(x[base + d]);
|
| 84 |
+
acc = acc + v * v;
|
| 85 |
+
d = d + WG;
|
| 86 |
+
}
|
| 87 |
+
red[tid] = acc;
|
| 88 |
+
workgroupBarrier();
|
| 89 |
+
{{ wgsl_tree_fold(["red"], idx="tid", wg="WG", typed=true, form="head", breakInline=true, bodyInline=true) }}
|
| 90 |
+
if (tid == 0u) {
|
| 91 |
+
partials[row * SPLIT + k] = red[0];
|
| 92 |
+
}
|
| 93 |
+
}
|
build/webgpu/rms-normalization-stash-f16-serial.wgsl.jinja
ADDED
|
@@ -0,0 +1,140 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{% if usesF16 %}enable f16;
|
| 2 |
+
{% endif %}
|
| 3 |
+
{{ env.wgsl.resourceDeclarations }}
|
| 4 |
+
|
| 5 |
+
const HIDDEN: u32 = {{ hiddenSize }}u;
|
| 6 |
+
const EPSILON: f32 = {{ epsilon }};
|
| 7 |
+
|
| 8 |
+
fn round_f16_bits_rte(value: f32) -> u32 {
|
| 9 |
+
let bits = bitcast<u32>(value);
|
| 10 |
+
let sign = (bits >> 16u) & 0x8000u;
|
| 11 |
+
let exponent_f32 = (bits >> 23u) & 0xffu;
|
| 12 |
+
let mantissa_f32 = bits & 0x7fffffu;
|
| 13 |
+
|
| 14 |
+
if (exponent_f32 == 0xffu) {
|
| 15 |
+
if (mantissa_f32 != 0u) {
|
| 16 |
+
return 0x7e00u;
|
| 17 |
+
}
|
| 18 |
+
return sign | 0x7c00u;
|
| 19 |
+
}
|
| 20 |
+
|
| 21 |
+
var exponent_f16 = i32(exponent_f32) - 127 + 15;
|
| 22 |
+
if (exponent_f16 >= 0x1f) {
|
| 23 |
+
return sign | 0x7c00u;
|
| 24 |
+
}
|
| 25 |
+
|
| 26 |
+
if (exponent_f16 <= 0) {
|
| 27 |
+
if (exponent_f16 < -10) {
|
| 28 |
+
return sign;
|
| 29 |
+
}
|
| 30 |
+
let significand = mantissa_f32 | 0x800000u;
|
| 31 |
+
let shift = u32(14 - exponent_f16);
|
| 32 |
+
let halfway = 1u << (shift - 1u);
|
| 33 |
+
let discarded = significand & ((1u << shift) - 1u);
|
| 34 |
+
var fraction = significand >> shift;
|
| 35 |
+
if (discarded > halfway || (discarded == halfway && (fraction & 1u) == 1u)) {
|
| 36 |
+
fraction = fraction + 1u;
|
| 37 |
+
}
|
| 38 |
+
return sign | fraction;
|
| 39 |
+
}
|
| 40 |
+
|
| 41 |
+
let halfway = 1u << 12u;
|
| 42 |
+
let discarded = mantissa_f32 & 0x1fffu;
|
| 43 |
+
var mantissa_f16 = mantissa_f32 >> 13u;
|
| 44 |
+
if (discarded > halfway || (discarded == halfway && (mantissa_f16 & 1u) == 1u)) {
|
| 45 |
+
mantissa_f16 = mantissa_f16 + 1u;
|
| 46 |
+
if (mantissa_f16 == 0x400u) {
|
| 47 |
+
mantissa_f16 = 0u;
|
| 48 |
+
exponent_f16 = exponent_f16 + 1;
|
| 49 |
+
}
|
| 50 |
+
}
|
| 51 |
+
if (exponent_f16 >= 0x1f) {
|
| 52 |
+
return sign | 0x7c00u;
|
| 53 |
+
}
|
| 54 |
+
return sign | (u32(exponent_f16) << 10u) | mantissa_f16;
|
| 55 |
+
}
|
| 56 |
+
|
| 57 |
+
fn widen_f16_bits(value: u32) -> f32 {
|
| 58 |
+
return unpack2x16float(value & 0xffffu).x;
|
| 59 |
+
}
|
| 60 |
+
|
| 61 |
+
|
| 62 |
+
{% if source.scaleRank > 0 %}
|
| 63 |
+
const X_RANK: u32 = {{ source.xRank }}u;
|
| 64 |
+
const SCALE_RANK: u32 = {{ source.scaleRank }}u;
|
| 65 |
+
const X_SHAPE: array<u32, {{ source.xRank }}> = array<u32, {{ source.xRank }}>({% for d in source.xShape %}{{ d }}u{% if not loop.last %}, {% endif %}{% endfor %});
|
| 66 |
+
const SCALE_SHAPE: array<u32, {{ source.scaleRank }}> = array<u32, {{ source.scaleRank }}>({% for d in source.scaleShape %}{{ d }}u{% if not loop.last %}, {% endif %}{% endfor %});
|
| 67 |
+
|
| 68 |
+
fn x_stride(axis: u32) -> u32 {
|
| 69 |
+
var stride = 1u;
|
| 70 |
+
for (var i = axis + 1u; i < X_RANK; i += 1u) {
|
| 71 |
+
stride *= X_SHAPE[i];
|
| 72 |
+
}
|
| 73 |
+
return stride;
|
| 74 |
+
}
|
| 75 |
+
|
| 76 |
+
fn scale_stride(axis: u32) -> u32 {
|
| 77 |
+
var stride = 1u;
|
| 78 |
+
for (var i = axis + 1u; i < SCALE_RANK; i += 1u) {
|
| 79 |
+
stride *= SCALE_SHAPE[i];
|
| 80 |
+
}
|
| 81 |
+
return stride;
|
| 82 |
+
}
|
| 83 |
+
|
| 84 |
+
{% endif %}
|
| 85 |
+
fn scale_offset({% if source.scaleRank > 0 %}out_index: u32{% endif %}) -> u32 {
|
| 86 |
+
{% if source.scaleRank == 0 %}
|
| 87 |
+
return 0u;
|
| 88 |
+
{% else %}
|
| 89 |
+
var rem = out_index;
|
| 90 |
+
var offset = 0u;
|
| 91 |
+
for (var axis = 0u; axis < X_RANK; axis += 1u) {
|
| 92 |
+
let stride = x_stride(axis);
|
| 93 |
+
let coord = rem / stride;
|
| 94 |
+
rem %= stride;
|
| 95 |
+
let scale_axis = i32(axis) - i32(X_RANK - SCALE_RANK);
|
| 96 |
+
if (scale_axis >= 0) {
|
| 97 |
+
let s_axis = u32(scale_axis);
|
| 98 |
+
if (SCALE_SHAPE[s_axis] != 1u) {
|
| 99 |
+
offset += coord * scale_stride(s_axis);
|
| 100 |
+
}
|
| 101 |
+
}
|
| 102 |
+
}
|
| 103 |
+
return offset;
|
| 104 |
+
{% endif %}
|
| 105 |
+
}
|
| 106 |
+
|
| 107 |
+
|
| 108 |
+
// ONNX RMSNormalization-23 expresses the stash_type=FLOAT16 stage as a graph
|
| 109 |
+
// of f16 tensor operators. Keeping one normalization row on one invocation
|
| 110 |
+
// preserves f16 accumulation and every stage boundary.
|
| 111 |
+
@compute @workgroup_size(1, 1, 1)
|
| 112 |
+
fn main(@builtin(workgroup_id) wg: vec3<u32>) {
|
| 113 |
+
let row = wg.x + wg.y * params.rowStride;
|
| 114 |
+
if (row >= params.rows) {
|
| 115 |
+
return;
|
| 116 |
+
}
|
| 117 |
+
let base = row * HIDDEN;
|
| 118 |
+
|
| 119 |
+
// Preserve the reduction state as bits so native compilers cannot reassociate
|
| 120 |
+
// the loop into a wider-precision sum across binary16 tensor boundaries.
|
| 121 |
+
var square_sum = round_f16_bits_rte(0.0);
|
| 122 |
+
for (var d = 0u; d < HIDDEN; d = d + 1u) {
|
| 123 |
+
let value = round_f16_bits_rte(f32(x[base + d]));
|
| 124 |
+
let squared = round_f16_bits_rte(widen_f16_bits(value) * widen_f16_bits(value));
|
| 125 |
+
square_sum = round_f16_bits_rte(widen_f16_bits(square_sum) + widen_f16_bits(squared));
|
| 126 |
+
}
|
| 127 |
+
let mean_square = round_f16_bits_rte(widen_f16_bits(square_sum) / f32(HIDDEN));
|
| 128 |
+
let epsilon_f16 = round_f16_bits_rte(EPSILON);
|
| 129 |
+
let mean_square_epsilon = round_f16_bits_rte(widen_f16_bits(mean_square) + widen_f16_bits(epsilon_f16));
|
| 130 |
+
let rms = round_f16_bits_rte(sqrt(widen_f16_bits(mean_square_epsilon)));
|
| 131 |
+
|
| 132 |
+
for (var d = 0u; d < HIDDEN; d = d + 1u) {
|
| 133 |
+
let index = base + d;
|
| 134 |
+
let value_f16 = round_f16_bits_rte(f32(x[index]));
|
| 135 |
+
let normalized = round_f16_bits_rte(widen_f16_bits(value_f16) / widen_f16_bits(rms));
|
| 136 |
+
let value = widen_f16_bits(normalized)
|
| 137 |
+
* f32(scale[scale_offset({% if source.scaleRank > 0 %}index{% endif %})]);
|
| 138 |
+
y[index] = {{ scalar }}(value);
|
| 139 |
+
}
|
| 140 |
+
}
|
build/webgpu/rms-normalization.wgsl.jinja
ADDED
|
@@ -0,0 +1,144 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
{% if usesF16 %}
|
| 2 |
+
enable f16;
|
| 3 |
+
{% endif %}
|
| 4 |
+
{{ env.wgsl.resourceDeclarations }}
|
| 5 |
+
|
| 6 |
+
const HIDDEN: u32 = {{ hiddenSize }}u;
|
| 7 |
+
const EPSILON: f32 = {{ epsilon }};
|
| 8 |
+
const WG: u32 = {{ workgroupSize }}u;
|
| 9 |
+
|
| 10 |
+
var<workgroup> partial: array<f32, WG>;
|
| 11 |
+
|
| 12 |
+
{% if source.scaleRank > 0 %}
|
| 13 |
+
const X_RANK: u32 = {{ source.xRank }}u;
|
| 14 |
+
const SCALE_RANK: u32 = {{ source.scaleRank }}u;
|
| 15 |
+
const X_SHAPE: array<u32, {{ source.xRank }}> = array<u32, {{ source.xRank }}>({% for d in source.xShape %}{{ d }}u{% if not loop.last %}, {% endif %}{% endfor %});
|
| 16 |
+
const SCALE_SHAPE: array<u32, {{ source.scaleRank }}> = array<u32, {{ source.scaleRank }}>({% for d in source.scaleShape %}{{ d }}u{% if not loop.last %}, {% endif %}{% endfor %});
|
| 17 |
+
|
| 18 |
+
fn x_stride(axis: u32) -> u32 {
|
| 19 |
+
var stride = 1u;
|
| 20 |
+
for (var i = axis + 1u; i < X_RANK; i += 1u) {
|
| 21 |
+
stride *= X_SHAPE[i];
|
| 22 |
+
}
|
| 23 |
+
return stride;
|
| 24 |
+
}
|
| 25 |
+
|
| 26 |
+
fn scale_stride(axis: u32) -> u32 {
|
| 27 |
+
var stride = 1u;
|
| 28 |
+
for (var i = axis + 1u; i < SCALE_RANK; i += 1u) {
|
| 29 |
+
stride *= SCALE_SHAPE[i];
|
| 30 |
+
}
|
| 31 |
+
return stride;
|
| 32 |
+
}
|
| 33 |
+
|
| 34 |
+
{% endif %}
|
| 35 |
+
fn scale_offset({% if source.scaleRank > 0 %}out_index: u32{% endif %}) -> u32 {
|
| 36 |
+
{% if source.scaleRank == 0 %}
|
| 37 |
+
return 0u;
|
| 38 |
+
{% else %}
|
| 39 |
+
var rem = out_index;
|
| 40 |
+
var offset = 0u;
|
| 41 |
+
for (var axis = 0u; axis < X_RANK; axis += 1u) {
|
| 42 |
+
let stride = x_stride(axis);
|
| 43 |
+
let coord = rem / stride;
|
| 44 |
+
rem %= stride;
|
| 45 |
+
let scale_axis = i32(axis) - i32(X_RANK - SCALE_RANK);
|
| 46 |
+
if (scale_axis >= 0) {
|
| 47 |
+
let s_axis = u32(scale_axis);
|
| 48 |
+
if (SCALE_SHAPE[s_axis] != 1u) {
|
| 49 |
+
offset += coord * scale_stride(s_axis);
|
| 50 |
+
}
|
| 51 |
+
}
|
| 52 |
+
}
|
| 53 |
+
return offset;
|
| 54 |
+
{% endif %}
|
| 55 |
+
}
|
| 56 |
+
|
| 57 |
+
|
| 58 |
+
{% macro wgsl_tree_fold_stmt(a, op, idx, svar) %}
|
| 59 |
+
{% if op == "max" %}
|
| 60 |
+
{{ a }}[{{ idx }}] = max({{ a }}[{{ idx }}], {{ a }}[{{ idx }} + {{ svar }}]);
|
| 61 |
+
{%- else %}
|
| 62 |
+
{{ a }}[{{ idx }}] = {{ a }}[{{ idx }}] + {{ a }}[{{ idx }} + {{ svar }}];
|
| 63 |
+
{%- endif %}
|
| 64 |
+
{% endmacro %}
|
| 65 |
+
{% macro wgsl_tree_fold(arrays, op="add", idx="lid", wg="WORKGROUP_SIZE", svar="stride", typed=false, form="tail", breakInline=false, bodyInline=false, barrierFirst=false) %}
|
| 66 |
+
var {{ svar }}{{ ": u32 " if typed else " " }}= {{ wg }} / 2u;
|
| 67 |
+
loop {
|
| 68 |
+
{% if form == "head" %}
|
| 69 |
+
{% if breakInline %}
|
| 70 |
+
if ({{ svar }} == 0u) { break; }
|
| 71 |
+
{% else %}
|
| 72 |
+
if ({{ svar }} == 0u) {
|
| 73 |
+
break;
|
| 74 |
+
}
|
| 75 |
+
{% endif %}
|
| 76 |
+
{% endif %}
|
| 77 |
+
{% if bodyInline %}
|
| 78 |
+
if ({{ idx }} < {{ svar }}) { {{ wgsl_tree_fold_stmt(arrays[0], op, idx, svar) }} }
|
| 79 |
+
{% else %}
|
| 80 |
+
if ({{ idx }} < {{ svar }}) {
|
| 81 |
+
{% for a in arrays %}
|
| 82 |
+
{{ wgsl_tree_fold_stmt(a, op, idx, svar) }}
|
| 83 |
+
{% endfor %}
|
| 84 |
+
}
|
| 85 |
+
{% endif %}
|
| 86 |
+
{% if form == "head" %}
|
| 87 |
+
{% if barrierFirst %}
|
| 88 |
+
workgroupBarrier();
|
| 89 |
+
{{ svar }} = {{ svar }} / 2u;
|
| 90 |
+
{% else %}
|
| 91 |
+
{{ svar }} = {{ svar }} / 2u;
|
| 92 |
+
workgroupBarrier();
|
| 93 |
+
{% endif %}
|
| 94 |
+
{% else %}
|
| 95 |
+
workgroupBarrier();
|
| 96 |
+
if ({{ svar }} == 1u) {
|
| 97 |
+
break;
|
| 98 |
+
}
|
| 99 |
+
{{ svar }} = {{ svar }} / 2u;
|
| 100 |
+
{% endif %}
|
| 101 |
+
}
|
| 102 |
+
{%- endmacro %}
|
| 103 |
+
|
| 104 |
+
// Reusing partial after this reduction requires a barrier between the read of
|
| 105 |
+
// partial[0] and the next write, or the next round can race the prior readers.
|
| 106 |
+
{% set trailingBarrier = trailingBarrier is defined and trailingBarrier %}
|
| 107 |
+
fn reduce_sum(value: f32, tid: u32) -> f32 {
|
| 108 |
+
partial[tid] = value;
|
| 109 |
+
workgroupBarrier();
|
| 110 |
+
{{ wgsl_tree_fold(["partial"], idx="tid", wg="WG", form="head") }}
|
| 111 |
+
{% if trailingBarrier %}
|
| 112 |
+
let total = partial[0];
|
| 113 |
+
workgroupBarrier();
|
| 114 |
+
return total;
|
| 115 |
+
{% else %}
|
| 116 |
+
return partial[0];
|
| 117 |
+
{% endif %}
|
| 118 |
+
}
|
| 119 |
+
|
| 120 |
+
|
| 121 |
+
@compute @workgroup_size(WG, 1, 1)
|
| 122 |
+
fn main(@builtin(workgroup_id) wg: vec3<u32>, @builtin(local_invocation_id) lid: vec3<u32>) {
|
| 123 |
+
let row = wg.x + wg.y * params.rowStride;
|
| 124 |
+
if (row >= params.rows) {
|
| 125 |
+
return;
|
| 126 |
+
}
|
| 127 |
+
let tid = lid.x;
|
| 128 |
+
let base = row * HIDDEN;
|
| 129 |
+
|
| 130 |
+
var local_sq = 0.0;
|
| 131 |
+
for (var d = tid; d < HIDDEN; d = d + WG) {
|
| 132 |
+
let value = f32(x[base + d]);
|
| 133 |
+
local_sq = local_sq + value * value;
|
| 134 |
+
}
|
| 135 |
+
let inv = inverseSqrt(reduce_sum(local_sq, tid) / f32(HIDDEN) + EPSILON);
|
| 136 |
+
for (var d = tid; d < HIDDEN; d = d + WG) {
|
| 137 |
+
let index = base + d;
|
| 138 |
+
// ONNX stage one ends by casting Normalized back to X's dtype; Scale is
|
| 139 |
+
// applied only after that rounding point.
|
| 140 |
+
let normalized = {{ xElement }}(f32(x[index]) * inv);
|
| 141 |
+
let value = f32(normalized) * f32(scale[scale_offset({% if source.scaleRank > 0 %}index{% endif %})]);
|
| 142 |
+
y[base + d] = {{ scalar }}(value);
|
| 143 |
+
}
|
| 144 |
+
}
|
build/webgpu/test.json
ADDED
|
@@ -0,0 +1,1590 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
| 1 |
+
{
|
| 2 |
+
"op": "ai.onnx.RMSNormalization",
|
| 3 |
+
"fixtureArrays": {
|
| 4 |
+
"f16_scalar_cast_x": [-1.1103515625, 2.982421875, 1.248046875, -1.8544921875],
|
| 5 |
+
"f16_scalar_cast_scale": [2.015625],
|
| 6 |
+
"f16_scalar_cast_y": [-1.150390625, 3.091796875, 1.29296875, -1.921875],
|
| 7 |
+
"onnx_backend_rms_normalization_3d_input_x": [1.764052391052246, 0.40015721321105957, 0.978738009929657, 2.2408931255340576, 1.8675580024719238, -0.9772778749465942, 0.9500884413719177, -0.15135720372200012, -0.10321885347366333, 0.4105985164642334, 0.14404356479644775, 1.4542734622955322, 0.7610377073287964, 0.12167501449584961, 0.44386324286460876, 0.3336743414402008, 1.4940791130065918, -0.2051582634449005, 0.3130677044391632, -0.8540957570075989, -2.5529897212982178, 0.653618574142456, 0.8644362092018127, -0.7421650290489197, 2.269754648208618, -1.4543657302856445, 0.04575851559638977, -0.18718385696411133, 1.5327792167663574, 1.4693588018417358],
|
| 8 |
+
"onnx_backend_rms_normalization_input_x": [1.764052391052246, 0.40015721321105957, 0.978738009929657, 2.2408931255340576, 1.8675580024719238, -0.9772778749465942, 0.9500884413719177, -0.15135720372200012, -0.10321885347366333, 0.4105985164642334, 0.14404356479644775, 1.4542734622955322, 0.7610377073287964, 0.12167501449584961, 0.44386324286460876, 0.3336743414402008, 1.4940791130065918, -0.2051582634449005, 0.3130677044391632, -0.8540957570075989, -2.5529897212982178, 0.653618574142456, 0.8644362092018127, -0.7421650290489197, 2.269754648208618, -1.4543657302856445, 0.04575851559638977, -0.18718385696411133, 1.5327792167663574, 1.4693588018417358, 0.154947429895401, 0.37816253304481506, -0.8877857327461243, -1.980796456336975, -0.34791216254234314, 0.15634897351264954, 1.2302906513214111, 1.202379822731018, -0.38732680678367615, -0.302302747964859, -1.0485529899597168, -1.420017957687378, -1.7062702178955078, 1.950775384902954, -0.5096521973609924, -0.4380742907524109, -1.2527953386306763, 0.7774903774261475, -1.6138978004455566, -0.21274028718471527, -0.8954665660858154, 0.38690251111984253, -0.5108051300048828, -1.18063223361969, -0.02818222902715206, 0.4283318817615509, 0.06651721894741058, 0.30247190594673157, -0.6343221068382263, -0.3627411723136902, -0.6724604368209839, -0.35955315828323364, -0.8131462931632996, -1.7262825965881348, 0.17742614448070526, -0.4017809331417084, -1.630198359489441, 0.46278226375579834, -0.9072983860969543, 0.05194539576768875, 0.7290905714035034, 0.12898291647434235, 1.1394007205963135, -1.234825849533081, 0.4023416340351105, -0.6848101019859314, -0.8707971572875977, -0.5788496732711792, -0.3115525245666504, 0.056165341287851334, -1.1651498079299927, 0.9008265137672424, 0.4656624495983124, -1.5362436771392822, 1.4882521629333496, 1.895889163017273, 1.1787796020507812, -0.1799248307943344, -1.0707526206970215, 1.0544517040252686, -0.4031769335269928, 1.222445011138916, 0.2082749754190445, 0.9766390323638916, 0.3563663959503174, 0.7065731883049011, 0.01050002034753561, 1.7858705520629883, 0.12691208720207214, 0.4019893705844879, 1.8831506967544556, -1.3477590084075928, -1.2704850435256958, 0.969396710395813, -1.1731233596801758, 1.9436211585998535, -0.4136189818382263, -0.747454822063446, 1.922942042350769, 1.4805147647857666, 1.8675589561462402, 0.9060446619987488, -0.8612256646156311, 1.910064935684204, -0.26800337433815, 0.8024563789367676, 0.9472519755363464, -0.15501008927822113, 0.6140793561935425, 0.922206699848175],
|
| 9 |
+
"ort_axis2_vector3_scale_input_x": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29],
|
| 10 |
+
"ort_f16_axis1_outer_inner_broadcast_scale_input_x": [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23]
|
| 11 |
+
},
|
| 12 |
+
"cases": [
|
| 13 |
+
{
|
| 14 |
+
"name": "subgroup_vec4_2x512",
|
| 15 |
+
"attrs": { "epsilon": 0.000001, "axis": -1 },
|
| 16 |
+
"inputs": {
|
| 17 |
+
"x": {
|
| 18 |
+
"dtype": "float32",
|
| 19 |
+
"shape": [2, 512],
|
| 20 |
+
"data": { "kind": "fillFloat32", "sinStep": 0.13, "cosStep": 0.21 }
|
| 21 |
+
},
|
| 22 |
+
"scale": {
|
| 23 |
+
"dtype": "float32",
|
| 24 |
+
"shape": [512],
|
| 25 |
+
"data": { "kind": "fillFloat32", "sinStep": 0.29, "cosStep": 0.11, "scale": 0.5 }
|
| 26 |
+
}
|
| 27 |
+
},
|
| 28 |
+
"outputs": { "y": { "dtype": "float32", "shape": [2, 512], "tolerance": 0.000002 } }
|
| 29 |
+
},
|
| 30 |
+
{
|
| 31 |
+
"name": "f32_default_epsilon_small_magnitude",
|
| 32 |
+
"attrs": { "axis": -1 },
|
| 33 |
+
"inputs": {
|
| 34 |
+
"x": {
|
| 35 |
+
"dtype": "float32",
|
| 36 |
+
"shape": [2, 8],
|
| 37 |
+
"data": { "kind": "fillFloat32", "sinStep": 0.17, "cosStep": 0.23, "scale": 0.001 }
|
| 38 |
+
},
|
| 39 |
+
"scale": {
|
| 40 |
+
"dtype": "float32",
|
| 41 |
+
"shape": [8],
|
| 42 |
+
"data": { "kind": "fillFloat32", "sinStep": 0.31, "cosStep": 0.07, "scale": 0.4 }
|
| 43 |
+
}
|
| 44 |
+
},
|
| 45 |
+
"outputs": { "y": { "dtype": "float32", "shape": [2, 8], "tolerance": 0.000001 } },
|
| 46 |
+
"provenance": {
|
| 47 |
+
"source": "onnx/defs/nn/defs.cc",
|
| 48 |
+
"test": "RMSNormalization-23 schema",
|
| 49 |
+
"notes": "Pins the default-epsilon path: no epsilon attribute is passed, so manifest and oracle defaults must both match the ONNX schema default 1e-5. Small-magnitude rows make epsilon dominate the mean-square, so a wrong default (e.g. 1e-6) diverges by >2x."
|
| 50 |
+
}
|
| 51 |
+
},
|
| 52 |
+
{
|
| 53 |
+
"name": "subgroup_vec4_f16_4x32",
|
| 54 |
+
"attrs": { "epsilon": 0.00001, "axis": -1 },
|
| 55 |
+
"inputs": {
|
| 56 |
+
"x": {
|
| 57 |
+
"dtype": "float16",
|
| 58 |
+
"shape": [4, 32],
|
| 59 |
+
"data": { "kind": "fillFloat32", "sinStep": 0.11, "cosStep": 0.27 }
|
| 60 |
+
},
|
| 61 |
+
"scale": {
|
| 62 |
+
"dtype": "float16",
|
| 63 |
+
"shape": [32],
|
| 64 |
+
"data": { "kind": "fillFloat32", "sinStep": 0.21, "cosStep": 0.13, "scale": 0.5 }
|
| 65 |
+
}
|
| 66 |
+
},
|
| 67 |
+
"outputs": { "y": { "dtype": "float16", "shape": [4, 32], "tolerance": 0.005 } }
|
| 68 |
+
},
|
| 69 |
+
{
|
| 70 |
+
"name": "last_axis_3x8",
|
| 71 |
+
"attrs": { "epsilon": 0.000001, "axis": -1 },
|
| 72 |
+
"inputs": {
|
| 73 |
+
"x": {
|
| 74 |
+
"dtype": "float32",
|
| 75 |
+
"shape": [3, 8],
|
| 76 |
+
"data": { "kind": "fillFloat32", "sinStep": 0.17, "cosStep": 0.29 }
|
| 77 |
+
},
|
| 78 |
+
"scale": {
|
| 79 |
+
"dtype": "float32",
|
| 80 |
+
"shape": [8],
|
| 81 |
+
"data": { "kind": "fillFloat32", "sinStep": 0.31, "cosStep": 0.07, "scale": 0.4 }
|
| 82 |
+
}
|
| 83 |
+
},
|
| 84 |
+
"outputs": { "y": { "dtype": "float32", "shape": [3, 8], "tolerance": 0.000001 } }
|
| 85 |
+
},
|
| 86 |
+
{
|
| 87 |
+
"name": "last_axis_rank3",
|
| 88 |
+
"attrs": { "epsilon": 0.00001, "axis": -1 },
|
| 89 |
+
"inputs": {
|
| 90 |
+
"x": {
|
| 91 |
+
"dtype": "float32",
|
| 92 |
+
"shape": [2, 3, 7],
|
| 93 |
+
"data": { "kind": "fillFloat32", "sinStep": 0.11, "cosStep": 0.23 }
|
| 94 |
+
},
|
| 95 |
+
"scale": {
|
| 96 |
+
"dtype": "float32",
|
| 97 |
+
"shape": [7],
|
| 98 |
+
"data": { "kind": "fillFloat32", "sinStep": 0.19, "cosStep": 0.13, "scale": 0.35 }
|
| 99 |
+
}
|
| 100 |
+
},
|
| 101 |
+
"outputs": { "y": { "dtype": "float32", "shape": [2, 3, 7], "tolerance": 0.000001 } }
|
| 102 |
+
},
|
| 103 |
+
{
|
| 104 |
+
"name": "f32_tiny_rms_epsilon_zero_gpu_gap",
|
| 105 |
+
"skipGpu": {
|
| 106 |
+
"category": "permanent",
|
| 107 |
+
"reason": "Portable WGSL floating-point semantics do not guarantee preservation of the subnormal values required by this fixture. Backend evidence: WebGPU/Metal flushes subnormals to zero in f32; the subnormal RMS denominator collapses to zero so normalization is non-finite."
|
| 108 |
+
},
|
| 109 |
+
"provenance": {
|
| 110 |
+
"source": "onnxruntime/test/providers/cpu/nn/rms_norm_op_test.cc",
|
| 111 |
+
"test": "RMSNormalizationOpTest.RMSNorm",
|
| 112 |
+
"notes": "Valid epsilon=0 edge: the RMS denominator is positive subnormal, so tiny normal inputs normalize to finite order-one values."
|
| 113 |
+
},
|
| 114 |
+
"attrs": { "epsilon": 0, "axis": -1 },
|
| 115 |
+
"inputs": {
|
| 116 |
+
"x": {
|
| 117 |
+
"dtype": "float32",
|
| 118 |
+
"shape": [2, 2],
|
| 119 |
+
"data": { "kind": "values", "values": [1e-20, -1e-20, 2e-20, -2e-20] }
|
| 120 |
+
},
|
| 121 |
+
"scale": { "dtype": "float32", "shape": [2], "data": { "kind": "values", "values": [1.0, 1.0] } }
|
| 122 |
+
},
|
| 123 |
+
"outputs": { "y": { "dtype": "float32", "shape": [2, 2], "tolerance": 0.00001 } }
|
| 124 |
+
},
|
| 125 |
+
{
|
| 126 |
+
"name": "f32_subnormal_scale_last_axis_vec4_gpu_gap",
|
| 127 |
+
"skipGpu": {
|
| 128 |
+
"category": "permanent",
|
| 129 |
+
"reason": "Portable WGSL floating-point semantics do not guarantee preservation of the subnormal values required by this fixture. Backend evidence: WebGPU/Metal flushes subnormals to zero in f32; the subnormal affine scale collapses to zero, losing the tiny output (vec4 path)."
|
| 130 |
+
},
|
| 131 |
+
"provenance": {
|
| 132 |
+
"source": "onnxruntime/test/providers/cpu/nn/rms_norm_op_test.cc",
|
| 133 |
+
"test": "RMSNormalizationOpTest.RMSNorm_Scale",
|
| 134 |
+
"notes": "Subnormal scale values are valid; with a nonzero RMS denominator they should produce subnormal outputs, not zeros."
|
| 135 |
+
},
|
| 136 |
+
"attrs": { "epsilon": 0, "axis": -1 },
|
| 137 |
+
"inputs": {
|
| 138 |
+
"x": { "dtype": "float32", "shape": [1, 4], "data": { "kind": "values", "values": [-1.0, 1.0, 2.0, -2.0] } },
|
| 139 |
+
"scale": {
|
| 140 |
+
"dtype": "float32",
|
| 141 |
+
"shape": [4],
|
| 142 |
+
"data": { "kind": "values", "values": [1e-40, -2e-40, 3e-40, -4e-40] }
|
| 143 |
+
}
|
| 144 |
+
},
|
| 145 |
+
"outputs": { "y": { "dtype": "float32", "shape": [1, 4], "tolerance": 1e-44 } }
|
| 146 |
+
},
|
| 147 |
+
{
|
| 148 |
+
"name": "f32_subnormal_scale_last_axis_odd_hidden_gpu_gap",
|
| 149 |
+
"skipGpu": {
|
| 150 |
+
"category": "permanent",
|
| 151 |
+
"reason": "Portable WGSL floating-point semantics do not guarantee preservation of the subnormal values required by this fixture. Backend evidence: WebGPU/Metal flushes subnormals to zero in f32; the subnormal affine scale collapses to zero (odd hidden size)."
|
| 152 |
+
},
|
| 153 |
+
"provenance": {
|
| 154 |
+
"source": "onnxruntime/test/providers/cpu/nn/rms_norm_op_test.cc",
|
| 155 |
+
"test": "RMSNormalizationOpTest.RMSNorm_Scale",
|
| 156 |
+
"notes": "Odd hidden-size companion for valid subnormal scale outputs."
|
| 157 |
+
},
|
| 158 |
+
"attrs": { "epsilon": 0, "axis": -1 },
|
| 159 |
+
"inputs": {
|
| 160 |
+
"x": { "dtype": "float32", "shape": [1, 3], "data": { "kind": "values", "values": [-1.0, 1.0, 2.0] } },
|
| 161 |
+
"scale": { "dtype": "float32", "shape": [3], "data": { "kind": "values", "values": [1e-40, -2e-40, 3e-40] } }
|
| 162 |
+
},
|
| 163 |
+
"outputs": { "y": { "dtype": "float32", "shape": [1, 3], "tolerance": 1e-44 } }
|
| 164 |
+
},
|
| 165 |
+
{
|
| 166 |
+
"name": "ort_basic_1x2x3",
|
| 167 |
+
"attrs": { "epsilon": 0.00001, "axis": -1 },
|
| 168 |
+
"inputs": {
|
| 169 |
+
"x": {
|
| 170 |
+
"dtype": "float32",
|
| 171 |
+
"shape": [1, 2, 3],
|
| 172 |
+
"data": { "kind": "values", "values": [1.0, 2.0, 3.0, 4.0, 5.0, 6.0] }
|
| 173 |
+
},
|
| 174 |
+
"scale": { "dtype": "float32", "shape": [3], "data": { "kind": "values", "values": [1.0, 1.0, 1.0] } }
|
| 175 |
+
},
|
| 176 |
+
"outputs": {
|
| 177 |
+
"y": {
|
| 178 |
+
"dtype": "float32",
|
| 179 |
+
"shape": [1, 2, 3],
|
| 180 |
+
"tolerance": 0.0001,
|
| 181 |
+
"data": { "kind": "values", "values": [0.4629, 0.9258, 1.3887, 0.7895, 0.9869, 1.1843] }
|
| 182 |
+
}
|
| 183 |
+
},
|
| 184 |
+
"provenance": {
|
| 185 |
+
"source": "onnxruntime/test/providers/cpu/nn/rms_norm_op_test.cc",
|
| 186 |
+
"test": "RMSNormalizationOpTest.RMSNorm"
|
| 187 |
+
}
|
| 188 |
+
},
|
| 189 |
+
{
|
| 190 |
+
"name": "mixed_x_f32_scale_y_f16",
|
| 191 |
+
"provenance": {
|
| 192 |
+
"source": "onnx/defs/nn/defs.cc",
|
| 193 |
+
"test": "RMSNormalization-23 schema",
|
| 194 |
+
"notes": "Exercises the standard's independent T and V variables with float32 X and float16 scale/output."
|
| 195 |
+
},
|
| 196 |
+
"attrs": { "epsilon": 0.00001, "axis": -1 },
|
| 197 |
+
"inputs": {
|
| 198 |
+
"x": {
|
| 199 |
+
"dtype": "float32",
|
| 200 |
+
"shape": [1, 2, 3],
|
| 201 |
+
"data": { "kind": "values", "values": [1.0, 2.0, 3.0, 4.0, 5.0, 6.0] }
|
| 202 |
+
},
|
| 203 |
+
"scale": { "dtype": "float16", "shape": [3], "data": { "kind": "values", "values": [0.75, -1.25, 1.5] } }
|
| 204 |
+
},
|
| 205 |
+
"outputs": { "y": { "dtype": "float16", "shape": [1, 2, 3], "tolerance": 0.002 } }
|
| 206 |
+
},
|
| 207 |
+
{
|
| 208 |
+
"name": "mixed_x_f16_scale_y_f32",
|
| 209 |
+
"provenance": {
|
| 210 |
+
"source": "onnx/defs/nn/defs.cc",
|
| 211 |
+
"test": "RMSNormalization-23 schema",
|
| 212 |
+
"notes": "Exercises the standard's independent T and V variables with float16 X and float32 scale/output, including the cast-to-T stage boundary before scaling."
|
| 213 |
+
},
|
| 214 |
+
"attrs": { "epsilon": 0.00001, "axis": -1 },
|
| 215 |
+
"inputs": {
|
| 216 |
+
"x": {
|
| 217 |
+
"dtype": "float16",
|
| 218 |
+
"shape": [1, 2, 3],
|
| 219 |
+
"data": { "kind": "values", "values": [1.0, 2.0, 3.0, 4.0, 5.0, 6.0] }
|
| 220 |
+
},
|
| 221 |
+
"scale": { "dtype": "float32", "shape": [3], "data": { "kind": "values", "values": [0.75, -1.25, 1.5] } }
|
| 222 |
+
},
|
| 223 |
+
"outputs": { "y": { "dtype": "float32", "shape": [1, 2, 3], "tolerance": 0.00001 } }
|
| 224 |
+
},
|
| 225 |
+
{
|
| 226 |
+
"name": "zero_rows_noop",
|
| 227 |
+
"attrs": { "epsilon": 0.000001, "axis": -1 },
|
| 228 |
+
"inputs": {
|
| 229 |
+
"x": { "dtype": "float32", "shape": [0, 4], "data": { "kind": "values", "values": [] } },
|
| 230 |
+
"scale": { "dtype": "float32", "shape": [4], "data": { "kind": "values", "values": [1.0, 1.0, 1.0, 1.0] } }
|
| 231 |
+
},
|
| 232 |
+
"outputs": { "y": { "dtype": "float32", "shape": [0, 4], "tolerance": 0.000001 } }
|
| 233 |
+
},
|
| 234 |
+
{
|
| 235 |
+
"name": "axis1_rank3_scale_matrix",
|
| 236 |
+
"attrs": { "epsilon": 0.000001, "axis": 1 },
|
| 237 |
+
"inputs": {
|
| 238 |
+
"x": {
|
| 239 |
+
"dtype": "float32",
|
| 240 |
+
"shape": [2, 3, 4],
|
| 241 |
+
"data": { "kind": "fillFloat32", "sinStep": 0.11, "cosStep": 0.23 }
|
| 242 |
+
},
|
| 243 |
+
"scale": {
|
| 244 |
+
"dtype": "float32",
|
| 245 |
+
"shape": [3, 4],
|
| 246 |
+
"data": { "kind": "fillFloat32", "sinStep": 0.19, "cosStep": 0.13, "scale": 0.35 }
|
| 247 |
+
}
|
| 248 |
+
},
|
| 249 |
+
"outputs": { "y": { "dtype": "float32", "shape": [2, 3, 4], "tolerance": 0.000001 } }
|
| 250 |
+
},
|
| 251 |
+
{
|
| 252 |
+
"name": "ort_basic_1x2x3_f16",
|
| 253 |
+
"provenance": {
|
| 254 |
+
"source": "onnxruntime/test/providers/cpu/nn/rms_norm_op_test.cc",
|
| 255 |
+
"test": "RMSNormalizationOpTest.RMSNorm_float16"
|
| 256 |
+
},
|
| 257 |
+
"attrs": { "epsilon": 0.00001, "axis": -1 },
|
| 258 |
+
"inputs": {
|
| 259 |
+
"x": {
|
| 260 |
+
"dtype": "float16",
|
| 261 |
+
"shape": [1, 2, 3],
|
| 262 |
+
"data": { "kind": "values", "values": [1.0, 2.0, 3.0, 4.0, 5.0, 6.0] }
|
| 263 |
+
},
|
| 264 |
+
"scale": { "dtype": "float16", "shape": [3], "data": { "kind": "values", "values": [1.0, 1.0, 1.0] } }
|
| 265 |
+
},
|
| 266 |
+
"outputs": {
|
| 267 |
+
"y": {
|
| 268 |
+
"dtype": "float16",
|
| 269 |
+
"shape": [1, 2, 3],
|
| 270 |
+
"tolerance": 0.002,
|
| 271 |
+
"data": { "kind": "values", "values": [0.4629, 0.9258, 1.3887, 0.7895, 0.9869, 1.1843] }
|
| 272 |
+
}
|
| 273 |
+
}
|
| 274 |
+
},
|
| 275 |
+
{
|
| 276 |
+
"name": "ort_scale_2x2x2_f32",
|
| 277 |
+
"provenance": {
|
| 278 |
+
"source": "onnxruntime/test/providers/cpu/nn/rms_norm_op_test.cc",
|
| 279 |
+
"test": "RMSNormalizationOpTest.RMSNorm_Scale"
|
| 280 |
+
},
|
| 281 |
+
"attrs": { "epsilon": 0.00001, "axis": -1 },
|
| 282 |
+
"inputs": {
|
| 283 |
+
"x": {
|
| 284 |
+
"dtype": "float32",
|
| 285 |
+
"shape": [2, 2, 2],
|
| 286 |
+
"data": {
|
| 287 |
+
"kind": "values",
|
| 288 |
+
"values": [-10.264, 8.6453, 43.1561, -0.641239, -8.2164, 0.11412, 41.3156, 3.0458]
|
| 289 |
+
}
|
| 290 |
+
},
|
| 291 |
+
"scale": { "dtype": "float32", "shape": [2], "data": { "kind": "values", "values": [-0.6953, 5.1824] } }
|
| 292 |
+
},
|
| 293 |
+
"outputs": {
|
| 294 |
+
"y": {
|
| 295 |
+
"dtype": "float32",
|
| 296 |
+
"shape": [2, 2, 2],
|
| 297 |
+
"tolerance": 0.0001,
|
| 298 |
+
"data": { "kind": "values", "values": [0.7521, 4.7215, -0.9832, -0.1089, 0.9832, 0.1018, -0.9806, 0.5388] }
|
| 299 |
+
}
|
| 300 |
+
}
|
| 301 |
+
},
|
| 302 |
+
{
|
| 303 |
+
"name": "ort_scale_2x2x2_f16",
|
| 304 |
+
"provenance": {
|
| 305 |
+
"source": "onnxruntime/test/providers/cpu/nn/rms_norm_op_test.cc",
|
| 306 |
+
"test": "RMSNormalizationOpTest.RMSNorm_Scale_Float16"
|
| 307 |
+
},
|
| 308 |
+
"attrs": { "epsilon": 0.00001, "axis": -1 },
|
| 309 |
+
"inputs": {
|
| 310 |
+
"x": {
|
| 311 |
+
"dtype": "float16",
|
| 312 |
+
"shape": [2, 2, 2],
|
| 313 |
+
"data": {
|
| 314 |
+
"kind": "values",
|
| 315 |
+
"values": [-10.264, 8.6453, 43.1561, -0.641239, -8.2164, 0.11412, 41.3156, 3.0458]
|
| 316 |
+
}
|
| 317 |
+
},
|
| 318 |
+
"scale": { "dtype": "float16", "shape": [2], "data": { "kind": "values", "values": [-0.6953, 5.1824] } }
|
| 319 |
+
},
|
| 320 |
+
"outputs": {
|
| 321 |
+
"y": {
|
| 322 |
+
"dtype": "float16",
|
| 323 |
+
"shape": [2, 2, 2],
|
| 324 |
+
"tolerance": 0.01,
|
| 325 |
+
"data": { "kind": "values", "values": [0.7521, 4.7215, -0.9832, -0.1089, 0.9832, 0.1018, -0.9806, 0.5388] }
|
| 326 |
+
}
|
| 327 |
+
}
|
| 328 |
+
},
|
| 329 |
+
{
|
| 330 |
+
"name": "ort_axis2_vector3_scale",
|
| 331 |
+
"provenance": {
|
| 332 |
+
"source": "onnxruntime/test/providers/cpu/nn/rms_norm_op_test.cc",
|
| 333 |
+
"test": "RMSNormalizationOpTest.RMSNorm_Scale_Vector3_Axis2"
|
| 334 |
+
},
|
| 335 |
+
"attrs": { "epsilon": 0.00001, "axis": 2 },
|
| 336 |
+
"inputs": {
|
| 337 |
+
"x": {
|
| 338 |
+
"dtype": "float32",
|
| 339 |
+
"shape": [2, 5, 3],
|
| 340 |
+
"data": { "kind": "values", "values": { "$ref": "#/fixtureArrays/ort_axis2_vector3_scale_input_x" } }
|
| 341 |
+
},
|
| 342 |
+
"scale": { "dtype": "float32", "shape": [3], "data": { "kind": "values", "values": [1.5, 1.5, 1.5] } }
|
| 343 |
+
},
|
| 344 |
+
"outputs": { "y": { "dtype": "float32", "shape": [2, 5, 3], "tolerance": 0.0001 } }
|
| 345 |
+
},
|
| 346 |
+
{
|
| 347 |
+
"name": "ort_axis2_scalar_scale",
|
| 348 |
+
"provenance": {
|
| 349 |
+
"source": "onnxruntime/test/providers/cpu/nn/rms_norm_op_test.cc",
|
| 350 |
+
"test": "RMSNormalizationOpTest.RMSNorm_Scale_Scalar_Axis2"
|
| 351 |
+
},
|
| 352 |
+
"attrs": { "epsilon": 0.00001, "axis": 2 },
|
| 353 |
+
"inputs": {
|
| 354 |
+
"x": {
|
| 355 |
+
"dtype": "float32",
|
| 356 |
+
"shape": [2, 5, 3],
|
| 357 |
+
"data": { "kind": "values", "values": { "$ref": "#/fixtureArrays/ort_axis2_vector3_scale_input_x" } }
|
| 358 |
+
},
|
| 359 |
+
"scale": { "dtype": "float32", "shape": [], "data": { "kind": "values", "values": [1.5] } }
|
| 360 |
+
},
|
| 361 |
+
"outputs": { "y": { "dtype": "float32", "shape": [2, 5, 3], "tolerance": 0.0001 } }
|
| 362 |
+
},
|
| 363 |
+
{
|
| 364 |
+
"name": "ort_axis2_batch_outer_broadcast_scale",
|
| 365 |
+
"provenance": {
|
| 366 |
+
"source": "onnxruntime/test/providers/cpu/nn/rms_norm_op_test.cc",
|
| 367 |
+
"test": "RMSNormalizationOpTest.RMSNorm_Scale_Bx1x3_Axis2"
|
| 368 |
+
},
|
| 369 |
+
"attrs": { "epsilon": 0.00001, "axis": 2 },
|
| 370 |
+
"inputs": {
|
| 371 |
+
"x": {
|
| 372 |
+
"dtype": "float32",
|
| 373 |
+
"shape": [3, 2, 3],
|
| 374 |
+
"data": {
|
| 375 |
+
"kind": "values",
|
| 376 |
+
"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]
|
| 377 |
+
}
|
| 378 |
+
},
|
| 379 |
+
"scale": {
|
| 380 |
+
"dtype": "float32",
|
| 381 |
+
"shape": [3, 1, 3],
|
| 382 |
+
"data": { "kind": "values", "values": [1.0, 1.0, 1.0, 1.2, 1.2, 1.2, 1.4, 1.4, 1.4] }
|
| 383 |
+
}
|
| 384 |
+
},
|
| 385 |
+
"outputs": { "y": { "dtype": "float32", "shape": [3, 2, 3], "tolerance": 0.0001 } }
|
| 386 |
+
},
|
| 387 |
+
{
|
| 388 |
+
"name": "ort_negative_axis_outer_inner_broadcast_scale",
|
| 389 |
+
"provenance": {
|
| 390 |
+
"source": "onnxruntime/test/providers/cpu/nn/rms_norm_op_test.cc",
|
| 391 |
+
"test": "RMSNormalizationOpTest.RMSNorm_Scale_1xSx1xW_AxisNeg2"
|
| 392 |
+
},
|
| 393 |
+
"attrs": { "epsilon": 0.00001, "axis": -2 },
|
| 394 |
+
"inputs": {
|
| 395 |
+
"x": {
|
| 396 |
+
"dtype": "float32",
|
| 397 |
+
"shape": [1, 2, 2, 2],
|
| 398 |
+
"data": { "kind": "values", "values": [0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0] }
|
| 399 |
+
},
|
| 400 |
+
"scale": {
|
| 401 |
+
"dtype": "float32",
|
| 402 |
+
"shape": [1, 2, 1, 2],
|
| 403 |
+
"data": { "kind": "values", "values": [1.0, 1.2, 1.4, 1.6] }
|
| 404 |
+
}
|
| 405 |
+
},
|
| 406 |
+
"outputs": { "y": { "dtype": "float32", "shape": [1, 2, 2, 2], "tolerance": 0.0001 } }
|
| 407 |
+
},
|
| 408 |
+
{
|
| 409 |
+
"name": "ort_axis2_outer_inner_broadcast_scale",
|
| 410 |
+
"provenance": {
|
| 411 |
+
"source": "onnxruntime/test/providers/cpu/nn/rms_norm_op_test.cc",
|
| 412 |
+
"test": "RMSNormalizationOpTest.RMSNorm_Scale_1xSx1xW_Axis2"
|
| 413 |
+
},
|
| 414 |
+
"attrs": { "epsilon": 0.00001, "axis": 2 },
|
| 415 |
+
"inputs": {
|
| 416 |
+
"x": {
|
| 417 |
+
"dtype": "float32",
|
| 418 |
+
"shape": [1, 2, 2, 2],
|
| 419 |
+
"data": { "kind": "values", "values": [0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0] }
|
| 420 |
+
},
|
| 421 |
+
"scale": {
|
| 422 |
+
"dtype": "float32",
|
| 423 |
+
"shape": [1, 2, 1, 2],
|
| 424 |
+
"data": { "kind": "values", "values": [1.0, 1.2, 1.4, 1.6] }
|
| 425 |
+
}
|
| 426 |
+
},
|
| 427 |
+
"outputs": {
|
| 428 |
+
"y": {
|
| 429 |
+
"dtype": "float32",
|
| 430 |
+
"shape": [1, 2, 2, 2],
|
| 431 |
+
"tolerance": 0.0001,
|
| 432 |
+
"data": { "kind": "values", "values": [0.0, 0.6414, 1.069, 1.9243, 0.9978, 1.4254, 1.4967, 1.9956] }
|
| 433 |
+
}
|
| 434 |
+
}
|
| 435 |
+
},
|
| 436 |
+
{
|
| 437 |
+
"name": "ort_f16_axis1_outer_inner_broadcast_scale",
|
| 438 |
+
"provenance": {
|
| 439 |
+
"source": "onnxruntime/test/providers/cpu/nn/rms_norm_op_test.cc",
|
| 440 |
+
"test": "RMSNormalizationOpTest.RMSNorm_Scale_Float16_OuterInnerBroadcast_Axis1"
|
| 441 |
+
},
|
| 442 |
+
"attrs": { "epsilon": 0.00001, "axis": 1 },
|
| 443 |
+
"inputs": {
|
| 444 |
+
"x": {
|
| 445 |
+
"dtype": "float16",
|
| 446 |
+
"shape": [2, 3, 4],
|
| 447 |
+
"data": {
|
| 448 |
+
"kind": "values",
|
| 449 |
+
"values": { "$ref": "#/fixtureArrays/ort_f16_axis1_outer_inner_broadcast_scale_input_x" }
|
| 450 |
+
}
|
| 451 |
+
},
|
| 452 |
+
"scale": { "dtype": "float16", "shape": [1, 3, 1], "data": { "kind": "values", "values": [1.0, 2.0, 3.0] } }
|
| 453 |
+
},
|
| 454 |
+
"outputs": { "y": { "dtype": "float16", "shape": [2, 3, 4], "tolerance": 0.02 } }
|
| 455 |
+
},
|
| 456 |
+
{
|
| 457 |
+
"name": "ort_axis2_ranked_scalar_scale_1x1x1",
|
| 458 |
+
"provenance": {
|
| 459 |
+
"source": "onnxruntime/test/providers/cpu/nn/rms_norm_op_test.cc",
|
| 460 |
+
"test": "RMSNormalizationOpTest.RMSNorm_Scale_1x1x1_Axis2"
|
| 461 |
+
},
|
| 462 |
+
"attrs": { "epsilon": 0.00001, "axis": 2 },
|
| 463 |
+
"inputs": {
|
| 464 |
+
"x": {
|
| 465 |
+
"dtype": "float32",
|
| 466 |
+
"shape": [2, 2, 2],
|
| 467 |
+
"data": { "kind": "values", "values": [0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0] }
|
| 468 |
+
},
|
| 469 |
+
"scale": { "dtype": "float32", "shape": [1, 1, 1], "data": { "kind": "values", "values": [1.0] } }
|
| 470 |
+
},
|
| 471 |
+
"outputs": { "y": { "dtype": "float32", "shape": [2, 2, 2], "tolerance": 0.0001 } }
|
| 472 |
+
},
|
| 473 |
+
{
|
| 474 |
+
"name": "ort_axis2_trailing_rank3_scale_1x1x3",
|
| 475 |
+
"provenance": {
|
| 476 |
+
"source": "onnxruntime/test/providers/cpu/nn/rms_norm_op_test.cc",
|
| 477 |
+
"test": "RMSNormalizationOpTest.RMSNorm_Scale_1x1x3_Axis2"
|
| 478 |
+
},
|
| 479 |
+
"attrs": { "epsilon": 0.00001, "axis": 2 },
|
| 480 |
+
"inputs": {
|
| 481 |
+
"x": {
|
| 482 |
+
"dtype": "float32",
|
| 483 |
+
"shape": [2, 5, 3],
|
| 484 |
+
"data": { "kind": "values", "values": { "$ref": "#/fixtureArrays/ort_axis2_vector3_scale_input_x" } }
|
| 485 |
+
},
|
| 486 |
+
"scale": { "dtype": "float32", "shape": [1, 1, 3], "data": { "kind": "constant", "value": 1.5 } }
|
| 487 |
+
},
|
| 488 |
+
"outputs": { "y": { "dtype": "float32", "shape": [2, 5, 3], "tolerance": 0.0001 } }
|
| 489 |
+
},
|
| 490 |
+
{
|
| 491 |
+
"name": "ort_axis2_outer_sequence_scale_1x4x3",
|
| 492 |
+
"provenance": {
|
| 493 |
+
"source": "onnxruntime/test/providers/cpu/nn/rms_norm_op_test.cc",
|
| 494 |
+
"test": "RMSNormalizationOpTest.RMSNorm_Scale_1xSx3_Axis2"
|
| 495 |
+
},
|
| 496 |
+
"attrs": { "epsilon": 0.00001, "axis": 2 },
|
| 497 |
+
"inputs": {
|
| 498 |
+
"x": {
|
| 499 |
+
"dtype": "float32",
|
| 500 |
+
"shape": [2, 4, 3],
|
| 501 |
+
"data": {
|
| 502 |
+
"kind": "values",
|
| 503 |
+
"values": { "$ref": "#/fixtureArrays/ort_f16_axis1_outer_inner_broadcast_scale_input_x" }
|
| 504 |
+
}
|
| 505 |
+
},
|
| 506 |
+
"scale": {
|
| 507 |
+
"dtype": "float32",
|
| 508 |
+
"shape": [1, 4, 3],
|
| 509 |
+
"data": { "kind": "values", "values": [1.1, 1.1, 1.1, 1.2, 1.2, 1.2, 1.3, 1.3, 1.3, 1.4, 1.4, 1.4] }
|
| 510 |
+
}
|
| 511 |
+
},
|
| 512 |
+
"outputs": { "y": { "dtype": "float32", "shape": [2, 4, 3], "tolerance": 0.0001 } }
|
| 513 |
+
},
|
| 514 |
+
{
|
| 515 |
+
"name": "ort_axis2_full_scale_no_broadcast",
|
| 516 |
+
"provenance": {
|
| 517 |
+
"source": "onnxruntime/test/providers/cpu/nn/rms_norm_op_test.cc",
|
| 518 |
+
"test": "RMSNormalizationOpTest.RMSNorm_Scale_NoBroadcast_BxSx3_Axis2"
|
| 519 |
+
},
|
| 520 |
+
"attrs": { "epsilon": 0.00001, "axis": 2 },
|
| 521 |
+
"inputs": {
|
| 522 |
+
"x": {
|
| 523 |
+
"dtype": "float32",
|
| 524 |
+
"shape": [2, 5, 3],
|
| 525 |
+
"data": { "kind": "values", "values": { "$ref": "#/fixtureArrays/ort_axis2_vector3_scale_input_x" } }
|
| 526 |
+
},
|
| 527 |
+
"scale": { "dtype": "float32", "shape": [2, 5, 3], "data": { "kind": "constant", "value": 1.5 } }
|
| 528 |
+
},
|
| 529 |
+
"outputs": { "y": { "dtype": "float32", "shape": [2, 5, 3], "tolerance": 0.0001 } }
|
| 530 |
+
},
|
| 531 |
+
{
|
| 532 |
+
"name": "ort_axis1_nchw_channel_scale_1x4x1x1",
|
| 533 |
+
"provenance": {
|
| 534 |
+
"source": "onnxruntime/test/providers/cpu/nn/rms_norm_op_test.cc",
|
| 535 |
+
"test": "RMSNormalizationOpTest.RMSNorm_Scale_1xCx1x1_Axis1"
|
| 536 |
+
},
|
| 537 |
+
"attrs": { "epsilon": 0.00001, "axis": 1 },
|
| 538 |
+
"inputs": {
|
| 539 |
+
"x": {
|
| 540 |
+
"dtype": "float32",
|
| 541 |
+
"shape": [1, 4, 2, 2],
|
| 542 |
+
"data": {
|
| 543 |
+
"kind": "values",
|
| 544 |
+
"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]
|
| 545 |
+
}
|
| 546 |
+
},
|
| 547 |
+
"scale": {
|
| 548 |
+
"dtype": "float32",
|
| 549 |
+
"shape": [1, 4, 1, 1],
|
| 550 |
+
"data": { "kind": "values", "values": [1.1, 1.2, 1.3, 1.4] }
|
| 551 |
+
}
|
| 552 |
+
},
|
| 553 |
+
"outputs": { "y": { "dtype": "float32", "shape": [1, 4, 2, 2], "tolerance": 0.0001 } }
|
| 554 |
+
},
|
| 555 |
+
{
|
| 556 |
+
"name": "ort_axis1_rank3_scale_1x3x1",
|
| 557 |
+
"provenance": {
|
| 558 |
+
"source": "onnxruntime/test/providers/cpu/nn/rms_norm_op_test.cc",
|
| 559 |
+
"test": "RMSNormalizationOpTest.RMSNorm_Scale_1xCx1_Axis1"
|
| 560 |
+
},
|
| 561 |
+
"attrs": { "epsilon": 0.00001, "axis": 1 },
|
| 562 |
+
"inputs": {
|
| 563 |
+
"x": {
|
| 564 |
+
"dtype": "float32",
|
| 565 |
+
"shape": [2, 3, 2],
|
| 566 |
+
"data": { "kind": "values", "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] }
|
| 567 |
+
},
|
| 568 |
+
"scale": { "dtype": "float32", "shape": [1, 3, 1], "data": { "kind": "values", "values": [1.0, 1.2, 1.4] } }
|
| 569 |
+
},
|
| 570 |
+
"outputs": { "y": { "dtype": "float32", "shape": [2, 3, 2], "tolerance": 0.0001 } }
|
| 571 |
+
},
|
| 572 |
+
{
|
| 573 |
+
"name": "ort_axis1_rank4_scale_1x3x2x1",
|
| 574 |
+
"provenance": {
|
| 575 |
+
"source": "onnxruntime/test/providers/cpu/nn/rms_norm_op_test.cc",
|
| 576 |
+
"test": "RMSNormalizationOpTest.RMSNorm_Scale_1x3x2x1_Axis1"
|
| 577 |
+
},
|
| 578 |
+
"attrs": { "epsilon": 0.00001, "axis": 1 },
|
| 579 |
+
"inputs": {
|
| 580 |
+
"x": {
|
| 581 |
+
"dtype": "float32",
|
| 582 |
+
"shape": [1, 3, 2, 2],
|
| 583 |
+
"data": { "kind": "values", "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] }
|
| 584 |
+
},
|
| 585 |
+
"scale": {
|
| 586 |
+
"dtype": "float32",
|
| 587 |
+
"shape": [1, 3, 2, 1],
|
| 588 |
+
"data": { "kind": "values", "values": [1.0, 1.1, 1.2, 1.3, 1.4, 1.5] }
|
| 589 |
+
}
|
| 590 |
+
},
|
| 591 |
+
"outputs": { "y": { "dtype": "float32", "shape": [1, 3, 2, 2], "tolerance": 0.0001 } }
|
| 592 |
+
},
|
| 593 |
+
{
|
| 594 |
+
"name": "ort_axis2_scale_1x1xHx1",
|
| 595 |
+
"provenance": {
|
| 596 |
+
"source": "onnxruntime/test/providers/cpu/nn/rms_norm_op_test.cc",
|
| 597 |
+
"test": "RMSNormalizationOpTest.RMSNorm_Scale_1x1xHx1_Axis2"
|
| 598 |
+
},
|
| 599 |
+
"attrs": { "epsilon": 0.00001, "axis": 2 },
|
| 600 |
+
"inputs": {
|
| 601 |
+
"x": {
|
| 602 |
+
"dtype": "float32",
|
| 603 |
+
"shape": [1, 2, 2, 2],
|
| 604 |
+
"data": { "kind": "values", "values": [0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0] }
|
| 605 |
+
},
|
| 606 |
+
"scale": { "dtype": "float32", "shape": [1, 1, 2, 1], "data": { "kind": "values", "values": [1.0, 1.3] } }
|
| 607 |
+
},
|
| 608 |
+
"outputs": { "y": { "dtype": "float32", "shape": [1, 2, 2, 2], "tolerance": 0.0001 } }
|
| 609 |
+
},
|
| 610 |
+
{
|
| 611 |
+
"name": "ort_axis2_scale_1x1x1xW",
|
| 612 |
+
"provenance": {
|
| 613 |
+
"source": "onnxruntime/test/providers/cpu/nn/rms_norm_op_test.cc",
|
| 614 |
+
"test": "RMSNormalizationOpTest.RMSNorm_Scale_1x1x1xW_Axis2"
|
| 615 |
+
},
|
| 616 |
+
"attrs": { "epsilon": 0.00001, "axis": 2 },
|
| 617 |
+
"inputs": {
|
| 618 |
+
"x": {
|
| 619 |
+
"dtype": "float32",
|
| 620 |
+
"shape": [1, 2, 2, 3],
|
| 621 |
+
"data": { "kind": "values", "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] }
|
| 622 |
+
},
|
| 623 |
+
"scale": { "dtype": "float32", "shape": [1, 1, 1, 3], "data": { "kind": "values", "values": [1.0, 1.2, 1.4] } }
|
| 624 |
+
},
|
| 625 |
+
"outputs": { "y": { "dtype": "float32", "shape": [1, 2, 2, 3], "tolerance": 0.0001 } }
|
| 626 |
+
},
|
| 627 |
+
{
|
| 628 |
+
"name": "ort_axis2_scale_1xSx1x1",
|
| 629 |
+
"provenance": {
|
| 630 |
+
"source": "onnxruntime/test/providers/cpu/nn/rms_norm_op_test.cc",
|
| 631 |
+
"test": "RMSNormalizationOpTest.RMSNorm_Scale_1xSx1x1_Axis2"
|
| 632 |
+
},
|
| 633 |
+
"attrs": { "epsilon": 0.00001, "axis": 2 },
|
| 634 |
+
"inputs": {
|
| 635 |
+
"x": {
|
| 636 |
+
"dtype": "float32",
|
| 637 |
+
"shape": [1, 3, 2, 2],
|
| 638 |
+
"data": { "kind": "values", "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] }
|
| 639 |
+
},
|
| 640 |
+
"scale": { "dtype": "float32", "shape": [1, 3, 1, 1], "data": { "kind": "values", "values": [1.0, 1.2, 1.4] } }
|
| 641 |
+
},
|
| 642 |
+
"outputs": { "y": { "dtype": "float32", "shape": [1, 3, 2, 2], "tolerance": 0.0001 } }
|
| 643 |
+
},
|
| 644 |
+
{
|
| 645 |
+
"name": "ort_axis2_scale_Bx1x1xW",
|
| 646 |
+
"provenance": {
|
| 647 |
+
"source": "onnxruntime/test/providers/cpu/nn/rms_norm_op_test.cc",
|
| 648 |
+
"test": "RMSNormalizationOpTest.RMSNorm_Scale_Bx1x1xW_Axis2"
|
| 649 |
+
},
|
| 650 |
+
"attrs": { "epsilon": 0.00001, "axis": 2 },
|
| 651 |
+
"inputs": {
|
| 652 |
+
"x": {
|
| 653 |
+
"dtype": "float32",
|
| 654 |
+
"shape": [2, 1, 2, 2],
|
| 655 |
+
"data": { "kind": "values", "values": [0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0] }
|
| 656 |
+
},
|
| 657 |
+
"scale": {
|
| 658 |
+
"dtype": "float32",
|
| 659 |
+
"shape": [2, 1, 1, 2],
|
| 660 |
+
"data": { "kind": "values", "values": [1.0, 1.1, 1.3, 1.4] }
|
| 661 |
+
}
|
| 662 |
+
},
|
| 663 |
+
"outputs": { "y": { "dtype": "float32", "shape": [2, 1, 2, 2], "tolerance": 0.0001 } }
|
| 664 |
+
},
|
| 665 |
+
{
|
| 666 |
+
"name": "ort_axis2_scale_1x1xHxW",
|
| 667 |
+
"provenance": {
|
| 668 |
+
"source": "onnxruntime/test/providers/cpu/nn/rms_norm_op_test.cc",
|
| 669 |
+
"test": "RMSNormalizationOpTest.RMSNorm_Scale_1x1xHxW_Axis2"
|
| 670 |
+
},
|
| 671 |
+
"attrs": { "epsilon": 0.00001, "axis": 2 },
|
| 672 |
+
"inputs": {
|
| 673 |
+
"x": {
|
| 674 |
+
"dtype": "float32",
|
| 675 |
+
"shape": [1, 2, 2, 3],
|
| 676 |
+
"data": { "kind": "values", "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] }
|
| 677 |
+
},
|
| 678 |
+
"scale": {
|
| 679 |
+
"dtype": "float32",
|
| 680 |
+
"shape": [1, 1, 2, 3],
|
| 681 |
+
"data": { "kind": "values", "values": [1.0, 1.1, 1.2, 1.3, 1.4, 1.5] }
|
| 682 |
+
}
|
| 683 |
+
},
|
| 684 |
+
"outputs": { "y": { "dtype": "float32", "shape": [1, 2, 2, 3], "tolerance": 0.0001 } }
|
| 685 |
+
},
|
| 686 |
+
{
|
| 687 |
+
"name": "ort_axis3_rank5_scale_1xSx1x1xC",
|
| 688 |
+
"provenance": {
|
| 689 |
+
"source": "onnxruntime/test/providers/cpu/nn/rms_norm_op_test.cc",
|
| 690 |
+
"test": "RMSNormalizationOpTest.RMSNorm_Scale_1xSx1x1xC_Axis3"
|
| 691 |
+
},
|
| 692 |
+
"attrs": { "epsilon": 0.00001, "axis": 3 },
|
| 693 |
+
"inputs": {
|
| 694 |
+
"x": {
|
| 695 |
+
"dtype": "float32",
|
| 696 |
+
"shape": [1, 2, 2, 2, 3],
|
| 697 |
+
"data": {
|
| 698 |
+
"kind": "values",
|
| 699 |
+
"values": { "$ref": "#/fixtureArrays/ort_f16_axis1_outer_inner_broadcast_scale_input_x" }
|
| 700 |
+
}
|
| 701 |
+
},
|
| 702 |
+
"scale": {
|
| 703 |
+
"dtype": "float32",
|
| 704 |
+
"shape": [1, 2, 1, 1, 3],
|
| 705 |
+
"data": { "kind": "values", "values": [1.0, 1.1, 1.2, 1.3, 1.4, 1.5] }
|
| 706 |
+
}
|
| 707 |
+
},
|
| 708 |
+
"outputs": { "y": { "dtype": "float32", "shape": [1, 2, 2, 2, 3], "tolerance": 0.0001 } }
|
| 709 |
+
},
|
| 710 |
+
{
|
| 711 |
+
"name": "ort_f16_axis2_outer_broadcast_scale",
|
| 712 |
+
"provenance": {
|
| 713 |
+
"source": "onnxruntime/test/providers/cpu/nn/rms_norm_op_test.cc",
|
| 714 |
+
"test": "RMSNormalizationOpTest.RMSNorm_Scale_Float16_OuterBroadcast_BxSx1_Axis2"
|
| 715 |
+
},
|
| 716 |
+
"attrs": { "epsilon": 0.00001, "axis": 2 },
|
| 717 |
+
"inputs": {
|
| 718 |
+
"x": {
|
| 719 |
+
"dtype": "float16",
|
| 720 |
+
"shape": [2, 2, 3],
|
| 721 |
+
"data": { "kind": "values", "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] }
|
| 722 |
+
},
|
| 723 |
+
"scale": {
|
| 724 |
+
"dtype": "float16",
|
| 725 |
+
"shape": [2, 2, 1],
|
| 726 |
+
"data": { "kind": "values", "values": [1.0, 2.0, 3.0, 4.0] }
|
| 727 |
+
}
|
| 728 |
+
},
|
| 729 |
+
"outputs": { "y": { "dtype": "float16", "shape": [2, 2, 3], "tolerance": 0.02 } }
|
| 730 |
+
},
|
| 731 |
+
{
|
| 732 |
+
"name": "ort_axis1_inner_mixed_scale_1x4",
|
| 733 |
+
"provenance": {
|
| 734 |
+
"source": "onnxruntime/test/providers/cpu/nn/rms_norm_op_test.cc",
|
| 735 |
+
"test": "RMSNormalizationOpTest.RMSNorm_Scale_Broadcast_Inner_Mixed"
|
| 736 |
+
},
|
| 737 |
+
"attrs": { "epsilon": 0.00001, "axis": 1 },
|
| 738 |
+
"inputs": {
|
| 739 |
+
"x": {
|
| 740 |
+
"dtype": "float32",
|
| 741 |
+
"shape": [1, 2, 4],
|
| 742 |
+
"data": { "kind": "values", "values": [0.0, 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0] }
|
| 743 |
+
},
|
| 744 |
+
"scale": { "dtype": "float32", "shape": [1, 4], "data": { "kind": "values", "values": [1.0, 0.5, 1.0, 0.5] } }
|
| 745 |
+
},
|
| 746 |
+
"outputs": { "y": { "dtype": "float32", "shape": [1, 2, 4], "tolerance": 0.0001 } }
|
| 747 |
+
},
|
| 748 |
+
{
|
| 749 |
+
"name": "onnx_backend_rms_normalization_2d_axis0",
|
| 750 |
+
"provenance": { "source": "cmake/external/onnx/onnx/backend/test/data/node/test_rms_normalization_2d_axis0" },
|
| 751 |
+
"inputs": {
|
| 752 |
+
"x": {
|
| 753 |
+
"dtype": "float32",
|
| 754 |
+
"shape": [3, 4],
|
| 755 |
+
"data": {
|
| 756 |
+
"kind": "values",
|
| 757 |
+
"values": [1.764052391052246, 0.40015721321105957, 0.978738009929657, 2.2408931255340576, 1.8675580024719238, -0.9772778749465942, 0.9500884413719177, -0.15135720372200012, -0.10321885347366333, 0.4105985164642334, 0.14404356479644775, 1.4542734622955322]
|
| 758 |
+
}
|
| 759 |
+
},
|
| 760 |
+
"scale": {
|
| 761 |
+
"dtype": "float32",
|
| 762 |
+
"shape": [3, 4],
|
| 763 |
+
"data": {
|
| 764 |
+
"kind": "values",
|
| 765 |
+
"values": [0.7610377073287964, 0.12167501449584961, 0.44386324286460876, 0.3336743414402008, 1.4940791130065918, -0.2051582634449005, 0.3130677044391632, -0.8540957570075989, -2.5529897212982178, 0.653618574142456, 0.8644362092018127, -0.7421650290489197]
|
| 766 |
+
}
|
| 767 |
+
}
|
| 768 |
+
},
|
| 769 |
+
"outputs": { "y": { "dtype": "float32", "shape": [3, 4], "tolerance": 0.0001 } },
|
| 770 |
+
"attrs": { "axis": 0 }
|
| 771 |
+
},
|
| 772 |
+
{
|
| 773 |
+
"name": "onnx_backend_rms_normalization_2d_axis1",
|
| 774 |
+
"provenance": { "source": "cmake/external/onnx/onnx/backend/test/data/node/test_rms_normalization_2d_axis1" },
|
| 775 |
+
"inputs": {
|
| 776 |
+
"x": {
|
| 777 |
+
"dtype": "float32",
|
| 778 |
+
"shape": [3, 4],
|
| 779 |
+
"data": {
|
| 780 |
+
"kind": "values",
|
| 781 |
+
"values": [1.764052391052246, 0.40015721321105957, 0.978738009929657, 2.2408931255340576, 1.8675580024719238, -0.9772778749465942, 0.9500884413719177, -0.15135720372200012, -0.10321885347366333, 0.4105985164642334, 0.14404356479644775, 1.4542734622955322]
|
| 782 |
+
}
|
| 783 |
+
},
|
| 784 |
+
"scale": {
|
| 785 |
+
"dtype": "float32",
|
| 786 |
+
"shape": [4],
|
| 787 |
+
"data": {
|
| 788 |
+
"kind": "values",
|
| 789 |
+
"values": [1.2302906513214111, 1.202379822731018, -0.38732680678367615, -0.302302747964859]
|
| 790 |
+
}
|
| 791 |
+
}
|
| 792 |
+
},
|
| 793 |
+
"outputs": { "y": { "dtype": "float32", "shape": [3, 4], "tolerance": 0.0001 } },
|
| 794 |
+
"attrs": { "axis": 1 }
|
| 795 |
+
},
|
| 796 |
+
{
|
| 797 |
+
"name": "onnx_backend_rms_normalization_2d_axis_negative_1",
|
| 798 |
+
"provenance": {
|
| 799 |
+
"source": "cmake/external/onnx/onnx/backend/test/data/node/test_rms_normalization_2d_axis_negative_1"
|
| 800 |
+
},
|
| 801 |
+
"inputs": {
|
| 802 |
+
"x": {
|
| 803 |
+
"dtype": "float32",
|
| 804 |
+
"shape": [3, 4],
|
| 805 |
+
"data": {
|
| 806 |
+
"kind": "values",
|
| 807 |
+
"values": [1.764052391052246, 0.40015721321105957, 0.978738009929657, 2.2408931255340576, 1.8675580024719238, -0.9772778749465942, 0.9500884413719177, -0.15135720372200012, -0.10321885347366333, 0.4105985164642334, 0.14404356479644775, 1.4542734622955322]
|
| 808 |
+
}
|
| 809 |
+
},
|
| 810 |
+
"scale": {
|
| 811 |
+
"dtype": "float32",
|
| 812 |
+
"shape": [4],
|
| 813 |
+
"data": {
|
| 814 |
+
"kind": "values",
|
| 815 |
+
"values": [-1.0485529899597168, -1.420017957687378, -1.7062702178955078, 1.950775384902954]
|
| 816 |
+
}
|
| 817 |
+
}
|
| 818 |
+
},
|
| 819 |
+
"outputs": { "y": { "dtype": "float32", "shape": [3, 4], "tolerance": 0.0001 } },
|
| 820 |
+
"attrs": { "axis": -1 }
|
| 821 |
+
},
|
| 822 |
+
{
|
| 823 |
+
"name": "onnx_backend_rms_normalization_2d_axis_negative_2",
|
| 824 |
+
"provenance": {
|
| 825 |
+
"source": "cmake/external/onnx/onnx/backend/test/data/node/test_rms_normalization_2d_axis_negative_2"
|
| 826 |
+
},
|
| 827 |
+
"inputs": {
|
| 828 |
+
"x": {
|
| 829 |
+
"dtype": "float32",
|
| 830 |
+
"shape": [3, 4],
|
| 831 |
+
"data": {
|
| 832 |
+
"kind": "values",
|
| 833 |
+
"values": [1.764052391052246, 0.40015721321105957, 0.978738009929657, 2.2408931255340576, 1.8675580024719238, -0.9772778749465942, 0.9500884413719177, -0.15135720372200012, -0.10321885347366333, 0.4105985164642334, 0.14404356479644775, 1.4542734622955322]
|
| 834 |
+
}
|
| 835 |
+
},
|
| 836 |
+
"scale": {
|
| 837 |
+
"dtype": "float32",
|
| 838 |
+
"shape": [3, 4],
|
| 839 |
+
"data": {
|
| 840 |
+
"kind": "values",
|
| 841 |
+
"values": [2.269754648208618, -1.4543657302856445, 0.04575851559638977, -0.18718385696411133, 1.5327792167663574, 1.4693588018417358, 0.154947429895401, 0.37816253304481506, -0.8877857327461243, -1.980796456336975, -0.34791216254234314, 0.15634897351264954]
|
| 842 |
+
}
|
| 843 |
+
}
|
| 844 |
+
},
|
| 845 |
+
"outputs": { "y": { "dtype": "float32", "shape": [3, 4], "tolerance": 0.0001 } },
|
| 846 |
+
"attrs": { "axis": -2 }
|
| 847 |
+
},
|
| 848 |
+
{
|
| 849 |
+
"name": "onnx_backend_rms_normalization_3d_axis0_epsilon",
|
| 850 |
+
"provenance": {
|
| 851 |
+
"source": "cmake/external/onnx/onnx/backend/test/data/node/test_rms_normalization_3d_axis0_epsilon"
|
| 852 |
+
},
|
| 853 |
+
"inputs": {
|
| 854 |
+
"x": {
|
| 855 |
+
"dtype": "float32",
|
| 856 |
+
"shape": [2, 3, 5],
|
| 857 |
+
"data": {
|
| 858 |
+
"kind": "values",
|
| 859 |
+
"values": { "$ref": "#/fixtureArrays/onnx_backend_rms_normalization_3d_input_x" }
|
| 860 |
+
}
|
| 861 |
+
},
|
| 862 |
+
"scale": {
|
| 863 |
+
"dtype": "float32",
|
| 864 |
+
"shape": [2, 3, 5],
|
| 865 |
+
"data": {
|
| 866 |
+
"kind": "values",
|
| 867 |
+
"values": [0.154947429895401, 0.37816253304481506, -0.8877857327461243, -1.980796456336975, -0.34791216254234314, 0.15634897351264954, 1.2302906513214111, 1.202379822731018, -0.38732680678367615, -0.302302747964859, -1.0485529899597168, -1.420017957687378, -1.7062702178955078, 1.950775384902954, -0.5096521973609924, -0.4380742907524109, -1.2527953386306763, 0.7774903774261475, -1.6138978004455566, -0.21274028718471527, -0.8954665660858154, 0.38690251111984253, -0.5108051300048828, -1.18063223361969, -0.02818222902715206, 0.4283318817615509, 0.06651721894741058, 0.30247190594673157, -0.6343221068382263, -0.3627411723136902]
|
| 868 |
+
}
|
| 869 |
+
}
|
| 870 |
+
},
|
| 871 |
+
"outputs": { "y": { "dtype": "float32", "shape": [2, 3, 5], "tolerance": 0.0001 } },
|
| 872 |
+
"attrs": { "axis": 0, "epsilon": 0.10000000149011612 }
|
| 873 |
+
},
|
| 874 |
+
{
|
| 875 |
+
"name": "onnx_backend_rms_normalization_3d_axis1_epsilon",
|
| 876 |
+
"provenance": {
|
| 877 |
+
"source": "cmake/external/onnx/onnx/backend/test/data/node/test_rms_normalization_3d_axis1_epsilon"
|
| 878 |
+
},
|
| 879 |
+
"inputs": {
|
| 880 |
+
"x": {
|
| 881 |
+
"dtype": "float32",
|
| 882 |
+
"shape": [2, 3, 5],
|
| 883 |
+
"data": {
|
| 884 |
+
"kind": "values",
|
| 885 |
+
"values": { "$ref": "#/fixtureArrays/onnx_backend_rms_normalization_3d_input_x" }
|
| 886 |
+
}
|
| 887 |
+
},
|
| 888 |
+
"scale": {
|
| 889 |
+
"dtype": "float32",
|
| 890 |
+
"shape": [3, 5],
|
| 891 |
+
"data": {
|
| 892 |
+
"kind": "values",
|
| 893 |
+
"values": [-0.4031769335269928, 1.222445011138916, 0.2082749754190445, 0.9766390323638916, 0.3563663959503174, 0.7065731883049011, 0.01050002034753561, 1.7858705520629883, 0.12691208720207214, 0.4019893705844879, 1.8831506967544556, -1.3477590084075928, -1.2704850435256958, 0.969396710395813, -1.1731233596801758]
|
| 894 |
+
}
|
| 895 |
+
}
|
| 896 |
+
},
|
| 897 |
+
"outputs": { "y": { "dtype": "float32", "shape": [2, 3, 5], "tolerance": 0.0001 } },
|
| 898 |
+
"attrs": { "axis": 1, "epsilon": 0.10000000149011612 }
|
| 899 |
+
},
|
| 900 |
+
{
|
| 901 |
+
"name": "onnx_backend_rms_normalization_3d_axis2_epsilon",
|
| 902 |
+
"provenance": {
|
| 903 |
+
"source": "cmake/external/onnx/onnx/backend/test/data/node/test_rms_normalization_3d_axis2_epsilon"
|
| 904 |
+
},
|
| 905 |
+
"inputs": {
|
| 906 |
+
"x": {
|
| 907 |
+
"dtype": "float32",
|
| 908 |
+
"shape": [2, 3, 5],
|
| 909 |
+
"data": {
|
| 910 |
+
"kind": "values",
|
| 911 |
+
"values": { "$ref": "#/fixtureArrays/onnx_backend_rms_normalization_3d_input_x" }
|
| 912 |
+
}
|
| 913 |
+
},
|
| 914 |
+
"scale": {
|
| 915 |
+
"dtype": "float32",
|
| 916 |
+
"shape": [5],
|
| 917 |
+
"data": {
|
| 918 |
+
"kind": "values",
|
| 919 |
+
"values": [0.37642553448677063, -1.0994007587432861, 0.29823818802833557, 1.3263858556747437, -0.694567859172821]
|
| 920 |
+
}
|
| 921 |
+
}
|
| 922 |
+
},
|
| 923 |
+
"outputs": { "y": { "dtype": "float32", "shape": [2, 3, 5], "tolerance": 0.0001 } },
|
| 924 |
+
"attrs": { "axis": 2, "epsilon": 0.10000000149011612 }
|
| 925 |
+
},
|
| 926 |
+
{
|
| 927 |
+
"name": "onnx_backend_rms_normalization_3d_axis_negative_1_epsilon",
|
| 928 |
+
"provenance": {
|
| 929 |
+
"source": "cmake/external/onnx/onnx/backend/test/data/node/test_rms_normalization_3d_axis_negative_1_epsilon"
|
| 930 |
+
},
|
| 931 |
+
"inputs": {
|
| 932 |
+
"x": {
|
| 933 |
+
"dtype": "float32",
|
| 934 |
+
"shape": [2, 3, 5],
|
| 935 |
+
"data": {
|
| 936 |
+
"kind": "values",
|
| 937 |
+
"values": { "$ref": "#/fixtureArrays/onnx_backend_rms_normalization_3d_input_x" }
|
| 938 |
+
}
|
| 939 |
+
},
|
| 940 |
+
"scale": {
|
| 941 |
+
"dtype": "float32",
|
| 942 |
+
"shape": [5],
|
| 943 |
+
"data": {
|
| 944 |
+
"kind": "values",
|
| 945 |
+
"values": [-0.14963454008102417, -0.4351535439491272, 1.8492637872695923, 0.6722947359085083, 0.40746182203292847]
|
| 946 |
+
}
|
| 947 |
+
}
|
| 948 |
+
},
|
| 949 |
+
"outputs": { "y": { "dtype": "float32", "shape": [2, 3, 5], "tolerance": 0.0001 } },
|
| 950 |
+
"attrs": { "axis": -1, "epsilon": 0.10000000149011612 }
|
| 951 |
+
},
|
| 952 |
+
{
|
| 953 |
+
"name": "onnx_backend_rms_normalization_3d_axis_negative_2_epsilon",
|
| 954 |
+
"provenance": {
|
| 955 |
+
"source": "cmake/external/onnx/onnx/backend/test/data/node/test_rms_normalization_3d_axis_negative_2_epsilon"
|
| 956 |
+
},
|
| 957 |
+
"inputs": {
|
| 958 |
+
"x": {
|
| 959 |
+
"dtype": "float32",
|
| 960 |
+
"shape": [2, 3, 5],
|
| 961 |
+
"data": {
|
| 962 |
+
"kind": "values",
|
| 963 |
+
"values": { "$ref": "#/fixtureArrays/onnx_backend_rms_normalization_3d_input_x" }
|
| 964 |
+
}
|
| 965 |
+
},
|
| 966 |
+
"scale": {
|
| 967 |
+
"dtype": "float32",
|
| 968 |
+
"shape": [3, 5],
|
| 969 |
+
"data": {
|
| 970 |
+
"kind": "values",
|
| 971 |
+
"values": [1.9436211585998535, -0.4136189818382263, -0.747454822063446, 1.922942042350769, 1.4805147647857666, 1.8675589561462402, 0.9060446619987488, -0.8612256646156311, 1.910064935684204, -0.26800337433815, 0.8024563789367676, 0.9472519755363464, -0.15501008927822113, 0.6140793561935425, 0.922206699848175]
|
| 972 |
+
}
|
| 973 |
+
}
|
| 974 |
+
},
|
| 975 |
+
"outputs": { "y": { "dtype": "float32", "shape": [2, 3, 5], "tolerance": 0.0001 } },
|
| 976 |
+
"attrs": { "axis": -2, "epsilon": 0.10000000149011612 }
|
| 977 |
+
},
|
| 978 |
+
{
|
| 979 |
+
"name": "onnx_backend_rms_normalization_3d_axis_negative_3_epsilon",
|
| 980 |
+
"provenance": {
|
| 981 |
+
"source": "cmake/external/onnx/onnx/backend/test/data/node/test_rms_normalization_3d_axis_negative_3_epsilon"
|
| 982 |
+
},
|
| 983 |
+
"inputs": {
|
| 984 |
+
"x": {
|
| 985 |
+
"dtype": "float32",
|
| 986 |
+
"shape": [2, 3, 5],
|
| 987 |
+
"data": {
|
| 988 |
+
"kind": "values",
|
| 989 |
+
"values": { "$ref": "#/fixtureArrays/onnx_backend_rms_normalization_3d_input_x" }
|
| 990 |
+
}
|
| 991 |
+
},
|
| 992 |
+
"scale": {
|
| 993 |
+
"dtype": "float32",
|
| 994 |
+
"shape": [2, 3, 5],
|
| 995 |
+
"data": {
|
| 996 |
+
"kind": "values",
|
| 997 |
+
"values": [-0.6724604368209839, -0.35955315828323364, -0.8131462931632996, -1.7262825965881348, 0.17742614448070526, -0.4017809331417084, -1.630198359489441, 0.46278226375579834, -0.9072983860969543, 0.05194539576768875, 0.7290905714035034, 0.12898291647434235, 1.1394007205963135, -1.234825849533081, 0.4023416340351105, -0.6848101019859314, -0.8707971572875977, -0.5788496732711792, -0.3115525245666504, 0.056165341287851334, -1.1651498079299927, 0.9008265137672424, 0.4656624495983124, -1.5362436771392822, 1.4882521629333496, 1.895889163017273, 1.1787796020507812, -0.1799248307943344, -1.0707526206970215, 1.0544517040252686]
|
| 998 |
+
}
|
| 999 |
+
}
|
| 1000 |
+
},
|
| 1001 |
+
"outputs": { "y": { "dtype": "float32", "shape": [2, 3, 5], "tolerance": 0.0001 } },
|
| 1002 |
+
"attrs": { "axis": -3, "epsilon": 0.10000000149011612 }
|
| 1003 |
+
},
|
| 1004 |
+
{
|
| 1005 |
+
"name": "onnx_backend_rms_normalization_4d_axis0",
|
| 1006 |
+
"provenance": { "source": "cmake/external/onnx/onnx/backend/test/data/node/test_rms_normalization_4d_axis0" },
|
| 1007 |
+
"inputs": {
|
| 1008 |
+
"x": {
|
| 1009 |
+
"dtype": "float32",
|
| 1010 |
+
"shape": [2, 3, 4, 5],
|
| 1011 |
+
"data": { "kind": "values", "values": { "$ref": "#/fixtureArrays/onnx_backend_rms_normalization_input_x" } }
|
| 1012 |
+
},
|
| 1013 |
+
"scale": {
|
| 1014 |
+
"dtype": "float32",
|
| 1015 |
+
"shape": [2, 3, 4, 5],
|
| 1016 |
+
"data": {
|
| 1017 |
+
"kind": "values",
|
| 1018 |
+
"values": [0.37642553448677063, -1.0994007587432861, 0.29823818802833557, 1.3263858556747437, -0.694567859172821, -0.14963454008102417, -0.4351535439491272, 1.8492637872695923, 0.6722947359085083, 0.40746182203292847, -0.7699160575866699, 0.5392491817474365, -0.6743326783180237, 0.0318305566906929, -0.6358460783958435, 0.676433265209198, 0.5765908360481262, -0.20829875767230988, 0.39600670337677, -1.0930615663528442, -1.4912575483322144, 0.43939170241355896, 0.16667349636554718, 0.6350314617156982, 2.3831448554992676, 0.9444794654846191, -0.9128222465515137, 1.117016315460205, -1.31590735912323, -0.46158459782600403, -0.06824160367250443, 1.7133426666259766, -0.7447548508644104, -0.8264385461807251, -0.09845252335071564, -0.6634783148765564, 1.1266359090805054, -1.0799314975738525, -1.1474686861038208, -0.43782004714012146, -0.49803245067596436, 1.9295320510864258, 0.9494208097457886, 0.08755124360322952, -1.225435495376587, 0.8443629741668701, -1.0002152919769287, -1.5447710752487183, 1.1880297660827637, 0.31694260239601135, 0.9208588004112244, 0.31872764229774475, 0.8568305969238281, -0.6510255932807922, -1.034242868423462, 0.6815944910049438, -0.8034096360206604, -0.6895498037338257, -0.4555324912071228, 0.01747915893793106, -0.3539939224720001, -1.3749512434005737, -0.6436184048652649, -2.223403215408325, 0.6252314448356628, -1.602057695388794, -1.1043833494186401, 0.05216507986187935, -0.73956298828125, 1.543014645576477, -1.2928569316864014, 0.2670508623123169, -0.039282817393541336, -1.1680934429168701, 0.523276686668396, -0.1715463250875473, 0.7717905640602112, 0.8235041499137878, 2.163235902786255, 1.336527943611145, -0.3691818416118622, -0.2393791824579239, 1.0996595621109009, 0.6552637219429016, 0.6401315331459045, -1.6169559955596924, -0.024326125159859657, -0.7380309104919434, 0.279924601316452, -0.09815038740634918, 0.9101788997650146, 0.31721821427345276, 0.7863279581069946, -0.4664191007614136, -0.9444462656974792, -0.410049706697464, -0.017020413652062416, 0.37915173172950745, 2.2593090534210205, -0.0422571524977684, -0.9559450149536133, -0.34598177671432495, -0.463595986366272, 0.4814814627170563, -1.5407969951629639, 0.06326199322938919, 0.15650653839111328, 0.23218104243278503, -0.5973160862922668, -0.23792172968387604, -1.4240609407424927, -0.49331986904144287, -0.5428614616394043, 0.4160500466823578, -1.1561824083328247, 0.7811980843544006, 1.494484543800354, -2.0699849128723145, 0.42625874280929565, 0.676908016204834]
|
| 1019 |
+
}
|
| 1020 |
+
}
|
| 1021 |
+
},
|
| 1022 |
+
"outputs": { "y": { "dtype": "float32", "shape": [2, 3, 4, 5], "tolerance": 0.0001 } },
|
| 1023 |
+
"attrs": { "axis": 0 }
|
| 1024 |
+
},
|
| 1025 |
+
{
|
| 1026 |
+
"name": "onnx_backend_rms_normalization_4d_axis1",
|
| 1027 |
+
"provenance": { "source": "cmake/external/onnx/onnx/backend/test/data/node/test_rms_normalization_4d_axis1" },
|
| 1028 |
+
"inputs": {
|
| 1029 |
+
"x": {
|
| 1030 |
+
"dtype": "float32",
|
| 1031 |
+
"shape": [2, 3, 4, 5],
|
| 1032 |
+
"data": { "kind": "values", "values": { "$ref": "#/fixtureArrays/onnx_backend_rms_normalization_input_x" } }
|
| 1033 |
+
},
|
| 1034 |
+
"scale": {
|
| 1035 |
+
"dtype": "float32",
|
| 1036 |
+
"shape": [3, 4, 5],
|
| 1037 |
+
"data": {
|
| 1038 |
+
"kind": "values",
|
| 1039 |
+
"values": [0.6984571218490601, 0.003770889015868306, 0.9318483471870422, 0.33996498584747314, -0.01568211242556572, 0.1609281748533249, -0.1906534880399704, -0.3948495090007782, -0.26773354411125183, -1.1280113458633423, 0.2804417014122009, -0.9931235909461975, 0.841631293296814, -0.24945858120918274, 0.04949498176574707, 0.49383679032325745, 0.6433144807815552, -1.5706233978271484, -0.20690368115901947, 0.8801789283752441, -1.698105812072754, 0.3872804641723633, -2.2555642127990723, -1.022506833076477, 0.03863055258989334, -1.6567151546478271, -0.9855107665061951, -1.4718350172042847, 1.6481349468231201, 0.16422775387763977, 0.5672903060913086, -0.22267509996891022, -0.353431761264801, -1.6164741516113281, -0.2918373644351959, -0.7614921927452087, 0.8579239249229431, 1.1411018371582031, 1.466578722000122, 0.8525519371032715, -0.5986539125442505, -1.1158969402313232, 0.7666631937026978, 0.35629281401634216, -1.768538475036621, 0.3554818034172058, 0.8145198225975037, 0.05892558768391609, -0.18505367636680603, -0.8076484799385071, -1.4465347528457642, 0.8002979755401611, -0.3091144561767578, -0.23346665501594543, 1.732721209526062, 0.6845011115074158, 0.37082499265670776, 0.14206179976463318, 1.519994854927063, 1.719589352607727]
|
| 1040 |
+
}
|
| 1041 |
+
}
|
| 1042 |
+
},
|
| 1043 |
+
"outputs": { "y": { "dtype": "float32", "shape": [2, 3, 4, 5], "tolerance": 0.0001 } },
|
| 1044 |
+
"attrs": { "axis": 1 }
|
| 1045 |
+
},
|
| 1046 |
+
{
|
| 1047 |
+
"name": "onnx_backend_rms_normalization_4d_axis2",
|
| 1048 |
+
"provenance": { "source": "cmake/external/onnx/onnx/backend/test/data/node/test_rms_normalization_4d_axis2" },
|
| 1049 |
+
"inputs": {
|
| 1050 |
+
"x": {
|
| 1051 |
+
"dtype": "float32",
|
| 1052 |
+
"shape": [2, 3, 4, 5],
|
| 1053 |
+
"data": { "kind": "values", "values": { "$ref": "#/fixtureArrays/onnx_backend_rms_normalization_input_x" } }
|
| 1054 |
+
},
|
| 1055 |
+
"scale": {
|
| 1056 |
+
"dtype": "float32",
|
| 1057 |
+
"shape": [4, 5],
|
| 1058 |
+
"data": {
|
| 1059 |
+
"kind": "values",
|
| 1060 |
+
"values": [0.7714059352874756, 1.029438853263855, -0.9087632298469543, -0.4243176281452179, 0.8625960350036621, -2.6556191444396973, 1.5133280754089355, 0.5531320571899414, -0.045703962445259094, 0.2205076515674591, -1.0299352407455444, -0.3499433696269989, 1.1002843379974365, 1.2980220317840576, 2.6962239742279053, -0.07392466813325882, -0.6585529446601868, -0.5142339468002319, -1.0180418491363525, -0.07785475254058838]
|
| 1061 |
+
}
|
| 1062 |
+
}
|
| 1063 |
+
},
|
| 1064 |
+
"outputs": { "y": { "dtype": "float32", "shape": [2, 3, 4, 5], "tolerance": 0.0001 } },
|
| 1065 |
+
"attrs": { "axis": 2 }
|
| 1066 |
+
},
|
| 1067 |
+
{
|
| 1068 |
+
"name": "onnx_backend_rms_normalization_4d_axis3",
|
| 1069 |
+
"provenance": { "source": "cmake/external/onnx/onnx/backend/test/data/node/test_rms_normalization_4d_axis3" },
|
| 1070 |
+
"inputs": {
|
| 1071 |
+
"x": {
|
| 1072 |
+
"dtype": "float32",
|
| 1073 |
+
"shape": [2, 3, 4, 5],
|
| 1074 |
+
"data": { "kind": "values", "values": { "$ref": "#/fixtureArrays/onnx_backend_rms_normalization_input_x" } }
|
| 1075 |
+
},
|
| 1076 |
+
"scale": {
|
| 1077 |
+
"dtype": "float32",
|
| 1078 |
+
"shape": [5],
|
| 1079 |
+
"data": {
|
| 1080 |
+
"kind": "values",
|
| 1081 |
+
"values": [-0.22260567545890808, -0.9130792021751404, -1.6812182664871216, -0.8889713287353516, 0.2421179562807083]
|
| 1082 |
+
}
|
| 1083 |
+
}
|
| 1084 |
+
},
|
| 1085 |
+
"outputs": { "y": { "dtype": "float32", "shape": [2, 3, 4, 5], "tolerance": 0.0001 } },
|
| 1086 |
+
"attrs": { "axis": 3 }
|
| 1087 |
+
},
|
| 1088 |
+
{
|
| 1089 |
+
"name": "onnx_backend_rms_normalization_4d_axis_negative_1",
|
| 1090 |
+
"provenance": {
|
| 1091 |
+
"source": "cmake/external/onnx/onnx/backend/test/data/node/test_rms_normalization_4d_axis_negative_1"
|
| 1092 |
+
},
|
| 1093 |
+
"inputs": {
|
| 1094 |
+
"x": {
|
| 1095 |
+
"dtype": "float32",
|
| 1096 |
+
"shape": [2, 3, 4, 5],
|
| 1097 |
+
"data": { "kind": "values", "values": { "$ref": "#/fixtureArrays/onnx_backend_rms_normalization_input_x" } }
|
| 1098 |
+
},
|
| 1099 |
+
"scale": {
|
| 1100 |
+
"dtype": "float32",
|
| 1101 |
+
"shape": [5],
|
| 1102 |
+
"data": {
|
| 1103 |
+
"kind": "values",
|
| 1104 |
+
"values": [-0.8887202739715576, 0.9367424845695496, 1.4123276472091675, -2.369586944580078, 0.8640522956848145]
|
| 1105 |
+
}
|
| 1106 |
+
}
|
| 1107 |
+
},
|
| 1108 |
+
"outputs": { "y": { "dtype": "float32", "shape": [2, 3, 4, 5], "tolerance": 0.0002 } },
|
| 1109 |
+
"attrs": { "axis": -1 }
|
| 1110 |
+
},
|
| 1111 |
+
{
|
| 1112 |
+
"name": "onnx_backend_rms_normalization_4d_axis_negative_2",
|
| 1113 |
+
"provenance": {
|
| 1114 |
+
"source": "cmake/external/onnx/onnx/backend/test/data/node/test_rms_normalization_4d_axis_negative_2"
|
| 1115 |
+
},
|
| 1116 |
+
"inputs": {
|
| 1117 |
+
"x": {
|
| 1118 |
+
"dtype": "float32",
|
| 1119 |
+
"shape": [2, 3, 4, 5],
|
| 1120 |
+
"data": { "kind": "values", "values": { "$ref": "#/fixtureArrays/onnx_backend_rms_normalization_input_x" } }
|
| 1121 |
+
},
|
| 1122 |
+
"scale": {
|
| 1123 |
+
"dtype": "float32",
|
| 1124 |
+
"shape": [4, 5],
|
| 1125 |
+
"data": {
|
| 1126 |
+
"kind": "values",
|
| 1127 |
+
"values": [0.38273242115974426, -0.03424227982759476, 1.0963468551635742, -0.23421579599380493, -0.3474506437778473, -0.5812684893608093, -1.6326345205307007, -1.5677677392959595, -1.1791579723358154, 1.3014280796051025, 0.8952602744102478, 1.3749641180038452, -1.3322116136550903, -1.9686247110366821, -0.6600562930107117, 0.17581894993782043, 0.49869027733802795, 1.0479722023010254, 0.2842796742916107, 1.7426687479019165]
|
| 1128 |
+
}
|
| 1129 |
+
}
|
| 1130 |
+
},
|
| 1131 |
+
"outputs": { "y": { "dtype": "float32", "shape": [2, 3, 4, 5], "tolerance": 0.0001 } },
|
| 1132 |
+
"attrs": { "axis": -2 }
|
| 1133 |
+
},
|
| 1134 |
+
{
|
| 1135 |
+
"name": "onnx_backend_rms_normalization_4d_axis_negative_3",
|
| 1136 |
+
"provenance": {
|
| 1137 |
+
"source": "cmake/external/onnx/onnx/backend/test/data/node/test_rms_normalization_4d_axis_negative_3"
|
| 1138 |
+
},
|
| 1139 |
+
"inputs": {
|
| 1140 |
+
"x": {
|
| 1141 |
+
"dtype": "float32",
|
| 1142 |
+
"shape": [2, 3, 4, 5],
|
| 1143 |
+
"data": { "kind": "values", "values": { "$ref": "#/fixtureArrays/onnx_backend_rms_normalization_input_x" } }
|
| 1144 |
+
},
|
| 1145 |
+
"scale": {
|
| 1146 |
+
"dtype": "float32",
|
| 1147 |
+
"shape": [3, 4, 5],
|
| 1148 |
+
"data": {
|
| 1149 |
+
"kind": "values",
|
| 1150 |
+
"values": [0.9295051097869873, 0.5822246074676514, -2.0946030616760254, 0.12372191250324249, -0.13010695576667786, 0.09395322948694229, 0.9430460929870605, -2.7396771907806396, -0.5693120360374451, 0.26990434527397156, -0.4668455421924591, -1.4169061183929443, 0.8689634799957275, 0.276871919631958, -0.9711045622825623, 0.3148171901702881, 0.8215857148170471, 0.005292646121233702, 0.8005648255348206, 0.07826017588376999, -0.3952289819717407, -1.1594204902648926, -0.08593076467514038, 0.19429293274879456, 0.875832736492157, -0.1151074692606926, 0.4574156105518341, -0.9646120071411133, -0.782629132270813, -0.11038929969072342, -1.0546284914016724, 0.8202478289604187, 0.46313032507896423, 0.27909576892852783, 0.33890411257743835, 2.021043539047241, -0.46886420249938965, -2.2014412879943848, 0.19930019974708557, -0.05060354247689247, -0.5175190567970276, -0.9788298606872559, -0.43918952345848083, 0.18133842945098877, -0.5028166770935059, 2.4124536514282227, -0.9605043530464172, -0.793117344379425, -2.2886199951171875, 0.2514844238758087, -2.016406536102295, -0.5394546389579773, -0.27567052841186523, -0.709727942943573, 1.7388726472854614, 0.9943943619728088, 1.3191368579864502, -0.8824188113212585, 1.1285940408706665, 0.4960009455680847]
|
| 1151 |
+
}
|
| 1152 |
+
}
|
| 1153 |
+
},
|
| 1154 |
+
"outputs": { "y": { "dtype": "float32", "shape": [2, 3, 4, 5], "tolerance": 0.0001 } },
|
| 1155 |
+
"attrs": { "axis": -3 }
|
| 1156 |
+
},
|
| 1157 |
+
{
|
| 1158 |
+
"name": "onnx_backend_rms_normalization_4d_axis_negative_4",
|
| 1159 |
+
"provenance": {
|
| 1160 |
+
"source": "cmake/external/onnx/onnx/backend/test/data/node/test_rms_normalization_4d_axis_negative_4"
|
| 1161 |
+
},
|
| 1162 |
+
"inputs": {
|
| 1163 |
+
"x": {
|
| 1164 |
+
"dtype": "float32",
|
| 1165 |
+
"shape": [2, 3, 4, 5],
|
| 1166 |
+
"data": { "kind": "values", "values": { "$ref": "#/fixtureArrays/onnx_backend_rms_normalization_input_x" } }
|
| 1167 |
+
},
|
| 1168 |
+
"scale": {
|
| 1169 |
+
"dtype": "float32",
|
| 1170 |
+
"shape": [2, 3, 4, 5],
|
| 1171 |
+
"data": {
|
| 1172 |
+
"kind": "values",
|
| 1173 |
+
"values": [-0.6374370455741882, -0.3972718119621277, -0.1328805834054947, -0.29779088497161865, -0.3090129792690277, -1.6760038137435913, 1.1523315906524658, 1.0796185731887817, -0.8133642673492432, -1.4664243459701538, 0.5210648775100708, -0.5757879614830017, 0.14195317029953003, -0.3193284273147583, 0.6915387511253357, 0.694749116897583, -0.7255973815917969, -1.383363962173462, -1.5829384326934814, 0.6103793978691101, -1.188859224319458, -0.5068163275718689, -0.596314013004303, -0.05256729573011398, -1.9362797737121582, 0.1887785941362381, 0.523891031742096, 0.08842208981513977, -0.3108861744403839, 0.09740016609430313, 0.3990463316440582, -2.772592782974243, 1.9559123516082764, 0.3900933265686035, -0.6524085998535156, -0.3909533619880676, 0.4937417805194855, -0.11610393971204758, -2.030684471130371, 2.06449294090271, -0.11054065823554993, 1.0201727151870728, -0.6920498609542847, 1.5363770723342896, 0.28634369373321533, 0.6088438630104065, -1.0452533960342407, 1.211145281791687, 0.6898181438446045, 1.3018462657928467, -0.62808758020401, -0.48102712631225586, 2.3039166927337646, -1.0600157976150513, -0.13594970107078552, 1.1368913650512695, 0.09772496670484543, 0.582953691482544, -0.39944902062416077, 0.3700558841228485, -1.3065268993377686, 1.6581306457519531, -0.1181640475988388, -0.6801782250404358, 0.6663830876350403, -0.4607197940349579, -1.3342584371566772, -1.3467174768447876, 0.6937731504440308, -0.15957343578338623, -0.13370156288146973, 1.0777437686920166, -1.1268258094787598, -0.7306777238845825, -0.38487979769706726, 0.09435158967971802, -0.042171452194452286, -0.28688719868659973, -0.06162640079855919, -0.10730527341365814, -0.7196043729782104, -0.8129929900169373, 0.27451634407043457, -0.8909150958061218, -1.1573553085327148, -0.3122922480106354, -0.15766701102256775, 2.256723403930664, -0.7047002911567688, 0.9432607293128967, 0.7471883296966553, -1.188944935798645, 0.7732529640197754, -1.1838806867599487, -2.659172296524048, 0.6063195466995239, -1.7558906078338623, 0.4509344696998596, -0.684010922908783, 1.6595507860183716, 1.0685093402862549, -0.4533858001232147, -0.6878376007080078, -1.214077353477478, -0.4409226179122925, -0.2803554832935333, -0.3646935522556305, 0.1567038595676422, 0.5785214900970459, 0.3496544659137726, -0.7641439437866211, -1.4377914667129517, 1.3645318746566772, -0.6894491910934448, -0.6522936224937439, -0.5211893320083618, -1.8430695533752441, -0.477973997592926, -0.47965580224990845, 0.6203582882881165]
|
| 1174 |
+
}
|
| 1175 |
+
}
|
| 1176 |
+
},
|
| 1177 |
+
"outputs": { "y": { "dtype": "float32", "shape": [2, 3, 4, 5], "tolerance": 0.0001 } },
|
| 1178 |
+
"attrs": { "axis": -4 }
|
| 1179 |
+
},
|
| 1180 |
+
{
|
| 1181 |
+
"name": "onnx_backend_rms_normalization_default_axis",
|
| 1182 |
+
"provenance": { "source": "cmake/external/onnx/onnx/backend/test/data/node/test_rms_normalization_default_axis" },
|
| 1183 |
+
"inputs": {
|
| 1184 |
+
"x": {
|
| 1185 |
+
"dtype": "float32",
|
| 1186 |
+
"shape": [2, 3, 4, 5],
|
| 1187 |
+
"data": { "kind": "values", "values": { "$ref": "#/fixtureArrays/onnx_backend_rms_normalization_input_x" } }
|
| 1188 |
+
},
|
| 1189 |
+
"scale": {
|
| 1190 |
+
"dtype": "float32",
|
| 1191 |
+
"shape": [5],
|
| 1192 |
+
"data": {
|
| 1193 |
+
"kind": "values",
|
| 1194 |
+
"values": [0.37642553448677063, -1.0994007587432861, 0.29823818802833557, 1.3263858556747437, -0.694567859172821]
|
| 1195 |
+
}
|
| 1196 |
+
}
|
| 1197 |
+
},
|
| 1198 |
+
"outputs": { "y": { "dtype": "float32", "shape": [2, 3, 4, 5], "tolerance": 0.0001 } }
|
| 1199 |
+
},
|
| 1200 |
+
{
|
| 1201 |
+
"name": "f16_last_axis_vec4_hidden2048_multisubgroup",
|
| 1202 |
+
"attrs": { "epsilon": 0.000001, "axis": -1 },
|
| 1203 |
+
"inputs": {
|
| 1204 |
+
"x": {
|
| 1205 |
+
"dtype": "float16",
|
| 1206 |
+
"shape": [64, 2048],
|
| 1207 |
+
"data": { "kind": "fillFloat32", "sinStep": 0.013, "cosStep": 0.021, "scale": 0.4 }
|
| 1208 |
+
},
|
| 1209 |
+
"scale": {
|
| 1210 |
+
"dtype": "float16",
|
| 1211 |
+
"shape": [2048],
|
| 1212 |
+
"data": { "kind": "fillFloat32", "sinStep": 0.029, "cosStep": 0.011, "scale": 0.25, "offset": 1.0 }
|
| 1213 |
+
}
|
| 1214 |
+
},
|
| 1215 |
+
"outputs": { "y": { "dtype": "float16", "shape": [64, 2048], "tolerance": 0.01 } }
|
| 1216 |
+
},
|
| 1217 |
+
{
|
| 1218 |
+
"name": "f16_last_axis_unaligned_hidden2050_alignment_cliff",
|
| 1219 |
+
"attrs": { "epsilon": 0.000001, "axis": -1 },
|
| 1220 |
+
"inputs": {
|
| 1221 |
+
"x": {
|
| 1222 |
+
"dtype": "float16",
|
| 1223 |
+
"shape": [32, 2050],
|
| 1224 |
+
"data": { "kind": "fillFloat32", "sinStep": 0.011, "cosStep": 0.017, "scale": 0.4 }
|
| 1225 |
+
},
|
| 1226 |
+
"scale": {
|
| 1227 |
+
"dtype": "float16",
|
| 1228 |
+
"shape": [2050],
|
| 1229 |
+
"data": { "kind": "fillFloat32", "sinStep": 0.023, "cosStep": 0.013, "scale": 0.25, "offset": 1.0 }
|
| 1230 |
+
}
|
| 1231 |
+
},
|
| 1232 |
+
"outputs": { "y": { "dtype": "float16", "shape": [32, 2050], "tolerance": 0.01 } }
|
| 1233 |
+
},
|
| 1234 |
+
{
|
| 1235 |
+
"name": "f16_suffix_axis1_nchw_channel_norm",
|
| 1236 |
+
"attrs": { "epsilon": 0.000001, "axis": 1 },
|
| 1237 |
+
"inputs": {
|
| 1238 |
+
"x": {
|
| 1239 |
+
"dtype": "float16",
|
| 1240 |
+
"shape": [2, 64, 16, 16],
|
| 1241 |
+
"data": { "kind": "fillFloat32", "sinStep": 0.013, "cosStep": 0.019, "scale": 0.4 }
|
| 1242 |
+
},
|
| 1243 |
+
"scale": {
|
| 1244 |
+
"dtype": "float16",
|
| 1245 |
+
"shape": [1, 64, 1, 1],
|
| 1246 |
+
"data": { "kind": "fillFloat32", "sinStep": 0.027, "cosStep": 0.011, "scale": 0.25, "offset": 1.0 }
|
| 1247 |
+
}
|
| 1248 |
+
},
|
| 1249 |
+
"outputs": { "y": { "dtype": "float16", "shape": [2, 64, 16, 16], "tolerance": 0.01 } }
|
| 1250 |
+
},
|
| 1251 |
+
{
|
| 1252 |
+
"name": "f32_last_axis_vec4_hidden1024_scale_offset_rank3",
|
| 1253 |
+
"attrs": { "epsilon": 0.000001, "axis": -1 },
|
| 1254 |
+
"inputs": {
|
| 1255 |
+
"x": {
|
| 1256 |
+
"dtype": "float32",
|
| 1257 |
+
"shape": [4, 8, 1024],
|
| 1258 |
+
"data": { "kind": "fillFloat32", "sinStep": 0.013, "cosStep": 0.021, "scale": 0.5 }
|
| 1259 |
+
},
|
| 1260 |
+
"scale": {
|
| 1261 |
+
"dtype": "float32",
|
| 1262 |
+
"shape": [1024],
|
| 1263 |
+
"data": { "kind": "fillFloat32", "sinStep": 0.031, "cosStep": 0.009, "scale": 0.25, "offset": 1.0 }
|
| 1264 |
+
}
|
| 1265 |
+
},
|
| 1266 |
+
"outputs": { "y": { "dtype": "float32", "shape": [4, 8, 1024], "tolerance": 0.00001 } }
|
| 1267 |
+
},
|
| 1268 |
+
{
|
| 1269 |
+
"name": "f32_suffix_axis_splitk_2x64x512",
|
| 1270 |
+
"attrs": { "epsilon": 0.000001, "axis": 1 },
|
| 1271 |
+
"inputs": {
|
| 1272 |
+
"x": {
|
| 1273 |
+
"dtype": "float32",
|
| 1274 |
+
"shape": [2, 64, 512],
|
| 1275 |
+
"data": { "kind": "fillFloat32", "sinStep": 0.017, "cosStep": 0.023, "scale": 0.5 }
|
| 1276 |
+
},
|
| 1277 |
+
"scale": {
|
| 1278 |
+
"dtype": "float32",
|
| 1279 |
+
"shape": [64, 512],
|
| 1280 |
+
"data": { "kind": "fillFloat32", "sinStep": 0.031, "cosStep": 0.009, "scale": 0.25, "offset": 1.0 }
|
| 1281 |
+
}
|
| 1282 |
+
},
|
| 1283 |
+
"outputs": { "y": { "dtype": "float32", "shape": [2, 64, 512], "tolerance": 0.00001 } }
|
| 1284 |
+
},
|
| 1285 |
+
{
|
| 1286 |
+
"name": "f32_suffix_axis_splitk_scalar_scale_1x32x512",
|
| 1287 |
+
"attrs": { "epsilon": 0.000001, "axis": 1 },
|
| 1288 |
+
"inputs": {
|
| 1289 |
+
"x": {
|
| 1290 |
+
"dtype": "float32",
|
| 1291 |
+
"shape": [1, 32, 512],
|
| 1292 |
+
"data": { "kind": "fillFloat32", "sinStep": 0.019, "cosStep": 0.013, "scale": 0.5 }
|
| 1293 |
+
},
|
| 1294 |
+
"scale": { "dtype": "float32", "shape": [], "data": { "kind": "values", "values": [0.75] } }
|
| 1295 |
+
},
|
| 1296 |
+
"outputs": { "y": { "dtype": "float32", "shape": [1, 32, 512], "tolerance": 0.00001 } }
|
| 1297 |
+
},
|
| 1298 |
+
{
|
| 1299 |
+
"name": "empty_outer_0x3x4_suffix_axis",
|
| 1300 |
+
"attrs": { "epsilon": 0.000001, "axis": 1 },
|
| 1301 |
+
"inputs": {
|
| 1302 |
+
"x": { "dtype": "float32", "shape": [0, 3, 4], "data": { "kind": "values", "values": [] } },
|
| 1303 |
+
"scale": {
|
| 1304 |
+
"dtype": "float32",
|
| 1305 |
+
"shape": [3, 4],
|
| 1306 |
+
"data": { "kind": "fillFloat32", "sinStep": 0.031, "cosStep": 0.009, "scale": 0.25, "offset": 1.0 }
|
| 1307 |
+
}
|
| 1308 |
+
},
|
| 1309 |
+
"outputs": {
|
| 1310 |
+
"y": {
|
| 1311 |
+
"dtype": "float32",
|
| 1312 |
+
"shape": [0, 3, 4],
|
| 1313 |
+
"tolerance": 0.000001,
|
| 1314 |
+
"data": { "kind": "values", "values": [] }
|
| 1315 |
+
}
|
| 1316 |
+
}
|
| 1317 |
+
},
|
| 1318 |
+
{
|
| 1319 |
+
"name": "empty_hidden_2x0_lastaxis_array0_const",
|
| 1320 |
+
"attrs": { "epsilon": 0.000001, "axis": -1 },
|
| 1321 |
+
"inputs": {
|
| 1322 |
+
"x": { "dtype": "float32", "shape": [2, 0], "data": { "kind": "values", "values": [] } },
|
| 1323 |
+
"scale": { "dtype": "float32", "shape": [0], "data": { "kind": "values", "values": [] } }
|
| 1324 |
+
},
|
| 1325 |
+
"outputs": {
|
| 1326 |
+
"y": { "dtype": "float32", "shape": [2, 0], "tolerance": 0.000001, "data": { "kind": "values", "values": [] } }
|
| 1327 |
+
}
|
| 1328 |
+
},
|
| 1329 |
+
{
|
| 1330 |
+
"name": "rows_fold_65537x8_lastaxis_vec4_dispatch2d",
|
| 1331 |
+
"attrs": { "epsilon": 0.000001, "axis": -1 },
|
| 1332 |
+
"inputs": {
|
| 1333 |
+
"x": {
|
| 1334 |
+
"dtype": "float32",
|
| 1335 |
+
"shape": [65537, 8],
|
| 1336 |
+
"data": { "kind": "fillFloat32", "sinStep": 0.013, "cosStep": 0.021, "scale": 0.5 }
|
| 1337 |
+
},
|
| 1338 |
+
"scale": {
|
| 1339 |
+
"dtype": "float32",
|
| 1340 |
+
"shape": [8],
|
| 1341 |
+
"data": { "kind": "fillFloat32", "sinStep": 0.031, "cosStep": 0.009, "scale": 0.25, "offset": 1.0 }
|
| 1342 |
+
}
|
| 1343 |
+
},
|
| 1344 |
+
"outputs": { "y": { "dtype": "float32", "shape": [65537, 8], "tolerance": 0.00001 } }
|
| 1345 |
+
},
|
| 1346 |
+
{
|
| 1347 |
+
"name": "lastaxis_broadcast_scale1_fallback_hidden8",
|
| 1348 |
+
"attrs": { "epsilon": 0.00001, "axis": -1 },
|
| 1349 |
+
"inputs": {
|
| 1350 |
+
"x": {
|
| 1351 |
+
"dtype": "float32",
|
| 1352 |
+
"shape": [3, 8],
|
| 1353 |
+
"data": { "kind": "fillFloat32", "sinStep": 0.17, "cosStep": 0.29 }
|
| 1354 |
+
},
|
| 1355 |
+
"scale": { "dtype": "float32", "shape": [1], "data": { "kind": "values", "values": [0.75] } }
|
| 1356 |
+
},
|
| 1357 |
+
"outputs": { "y": { "dtype": "float32", "shape": [3, 8], "tolerance": 0.00001 } }
|
| 1358 |
+
},
|
| 1359 |
+
{
|
| 1360 |
+
"name": "all_zero_row_epsilon_floor_finite_not_nan",
|
| 1361 |
+
"attrs": { "epsilon": 0.01, "axis": -1 },
|
| 1362 |
+
"inputs": {
|
| 1363 |
+
"x": {
|
| 1364 |
+
"dtype": "float32",
|
| 1365 |
+
"shape": [2, 4],
|
| 1366 |
+
"data": { "kind": "values", "values": [0.0, 0.0, 0.0, 0.0, 2.0, -2.0, 2.0, -2.0] }
|
| 1367 |
+
},
|
| 1368 |
+
"scale": { "dtype": "float32", "shape": [4], "data": { "kind": "values", "values": [1.0, 1.0, 1.0, 1.0] } }
|
| 1369 |
+
},
|
| 1370 |
+
"outputs": { "y": { "dtype": "float32", "shape": [2, 4], "tolerance": 0.0001 } }
|
| 1371 |
+
},
|
| 1372 |
+
{
|
| 1373 |
+
"name": "f16_lastaxis_unaligned_hidden4094",
|
| 1374 |
+
"provenance": {
|
| 1375 |
+
"notes": "Compact correctness sibling for the f16 unaligned-hidden benchmark cliff; dim=4094 exercises the scalar tail path next to the vec4/subgroup path."
|
| 1376 |
+
},
|
| 1377 |
+
"attrs": { "epsilon": 0.000001, "axis": -1 },
|
| 1378 |
+
"inputs": {
|
| 1379 |
+
"x": {
|
| 1380 |
+
"dtype": "float16",
|
| 1381 |
+
"shape": [2, 4094],
|
| 1382 |
+
"data": { "kind": "fillFloat32", "sinStep": 0.017, "cosStep": 0.023, "scale": 0.5 }
|
| 1383 |
+
},
|
| 1384 |
+
"scale": {
|
| 1385 |
+
"dtype": "float16",
|
| 1386 |
+
"shape": [4094],
|
| 1387 |
+
"data": { "kind": "fillFloat32", "sinStep": 0.031, "cosStep": 0.009, "scale": 0.25, "offset": 1.0 }
|
| 1388 |
+
}
|
| 1389 |
+
},
|
| 1390 |
+
"outputs": { "y": { "dtype": "float16", "shape": [2, 4094], "tolerance": 0.02 } }
|
| 1391 |
+
},
|
| 1392 |
+
{
|
| 1393 |
+
"name": "onnx23_f16_cast_before_scale_row_vec4_exact",
|
| 1394 |
+
"provenance": {
|
| 1395 |
+
"notes": "ONNX RMSNormalization-23 stage one casts Normalized back to X's dtype before Scale. This vector-scale case selects the optimized vec4 row kernel and differs by one f16 ULP if the cast is deferred until after Scale."
|
| 1396 |
+
},
|
| 1397 |
+
"requires": { "features": ["shader-f16"] },
|
| 1398 |
+
"attrs": { "epsilon": 0.00001, "axis": -1 },
|
| 1399 |
+
"inputs": {
|
| 1400 |
+
"x": {
|
| 1401 |
+
"dtype": "float16",
|
| 1402 |
+
"shape": [1, 4],
|
| 1403 |
+
"data": { "kind": "values", "values": [-1.4765625, -1.861328125, 1.4697265625, 1.0703125] }
|
| 1404 |
+
},
|
| 1405 |
+
"scale": {
|
| 1406 |
+
"dtype": "float16",
|
| 1407 |
+
"shape": [4],
|
| 1408 |
+
"data": { "kind": "values", "values": [0.316162109375, -2.791015625, -0.0877685546875, 2.0859375] }
|
| 1409 |
+
}
|
| 1410 |
+
},
|
| 1411 |
+
"outputs": {
|
| 1412 |
+
"y": {
|
| 1413 |
+
"dtype": "float16",
|
| 1414 |
+
"shape": [1, 4],
|
| 1415 |
+
"tolerance": 0,
|
| 1416 |
+
"relTolerance": 0,
|
| 1417 |
+
"data": { "kind": "values", "values": [-0.312255859375, 3.47265625, -0.08624267578125, 1.4921875] }
|
| 1418 |
+
}
|
| 1419 |
+
}
|
| 1420 |
+
},
|
| 1421 |
+
{
|
| 1422 |
+
"name": "onnx23_f16_cast_before_scale_generic_scalar_exact",
|
| 1423 |
+
"provenance": {
|
| 1424 |
+
"notes": "ONNX RMSNormalization-23 stage-one cast boundary on the generic broadcast kernel. A scalar Scale prevents the specialized row variant; two outputs differ by one f16 ULP if normalization stays in float32 through the multiply."
|
| 1425 |
+
},
|
| 1426 |
+
"requires": { "features": ["shader-f16"] },
|
| 1427 |
+
"attrs": { "epsilon": 0.00001, "axis": -1 },
|
| 1428 |
+
"inputs": {
|
| 1429 |
+
"x": {
|
| 1430 |
+
"dtype": "float16",
|
| 1431 |
+
"shape": [1, 4],
|
| 1432 |
+
"data": { "kind": "values", "values": { "$ref": "#/fixtureArrays/f16_scalar_cast_x" } }
|
| 1433 |
+
},
|
| 1434 |
+
"scale": {
|
| 1435 |
+
"dtype": "float16",
|
| 1436 |
+
"shape": [],
|
| 1437 |
+
"data": { "kind": "values", "values": { "$ref": "#/fixtureArrays/f16_scalar_cast_scale" } }
|
| 1438 |
+
}
|
| 1439 |
+
},
|
| 1440 |
+
"outputs": {
|
| 1441 |
+
"y": {
|
| 1442 |
+
"dtype": "float16",
|
| 1443 |
+
"shape": [1, 4],
|
| 1444 |
+
"tolerance": 0,
|
| 1445 |
+
"relTolerance": 0,
|
| 1446 |
+
"data": { "kind": "values", "values": { "$ref": "#/fixtureArrays/f16_scalar_cast_y" } }
|
| 1447 |
+
}
|
| 1448 |
+
}
|
| 1449 |
+
},
|
| 1450 |
+
{
|
| 1451 |
+
"name": "onnx23_f16_cast_before_scale_splitk_exact",
|
| 1452 |
+
"provenance": {
|
| 1453 |
+
"notes": "Forces the split-K shared kernel on the same exact f16 boundary case, pinning the standardized cast of Normalized back to X before Scale."
|
| 1454 |
+
},
|
| 1455 |
+
"requires": { "features": ["shader-f16"] },
|
| 1456 |
+
"tunables": { "SPLIT_MIN_HIDDEN": 1, "SPLIT_TARGET_ELEMENTS": 1 },
|
| 1457 |
+
"attrs": { "epsilon": 0.00001, "axis": -1 },
|
| 1458 |
+
"inputs": {
|
| 1459 |
+
"x": {
|
| 1460 |
+
"dtype": "float16",
|
| 1461 |
+
"shape": [1, 4],
|
| 1462 |
+
"data": { "kind": "values", "values": { "$ref": "#/fixtureArrays/f16_scalar_cast_x" } }
|
| 1463 |
+
},
|
| 1464 |
+
"scale": {
|
| 1465 |
+
"dtype": "float16",
|
| 1466 |
+
"shape": [],
|
| 1467 |
+
"data": { "kind": "values", "values": { "$ref": "#/fixtureArrays/f16_scalar_cast_scale" } }
|
| 1468 |
+
}
|
| 1469 |
+
},
|
| 1470 |
+
"outputs": {
|
| 1471 |
+
"y": {
|
| 1472 |
+
"dtype": "float16",
|
| 1473 |
+
"shape": [1, 4],
|
| 1474 |
+
"tolerance": 0,
|
| 1475 |
+
"relTolerance": 0,
|
| 1476 |
+
"data": { "kind": "values", "values": { "$ref": "#/fixtureArrays/f16_scalar_cast_y" } }
|
| 1477 |
+
}
|
| 1478 |
+
}
|
| 1479 |
+
},
|
| 1480 |
+
{
|
| 1481 |
+
"name": "onnx23_f16_stash_float16_rounding",
|
| 1482 |
+
"provenance": {
|
| 1483 |
+
"source": "onnx/defs/nn/defs.cc RMSNormalization-23 function body",
|
| 1484 |
+
"notes": "TensorProto FLOAT16 stash (10). Sequential f16 sum-of-squares and normalization produce outputs separated by multiple f16 ULPs from the default float32-stash route."
|
| 1485 |
+
},
|
| 1486 |
+
"requires": { "features": ["shader-f16"] },
|
| 1487 |
+
"attrs": { "epsilon": 0.00001, "axis": -1, "stash_type": 10 },
|
| 1488 |
+
"inputs": {
|
| 1489 |
+
"x": {
|
| 1490 |
+
"dtype": "float16",
|
| 1491 |
+
"shape": [1, 4],
|
| 1492 |
+
"data": { "kind": "values", "values": [8.171875, 0.15771484375, -0.1475830078125, -2.125] }
|
| 1493 |
+
},
|
| 1494 |
+
"scale": {
|
| 1495 |
+
"dtype": "float16",
|
| 1496 |
+
"shape": [4],
|
| 1497 |
+
"data": { "kind": "values", "values": [3.640625, -3.275390625, -1.51953125, -0.85205078125] }
|
| 1498 |
+
}
|
| 1499 |
+
},
|
| 1500 |
+
"outputs": {
|
| 1501 |
+
"y": {
|
| 1502 |
+
"dtype": "float16",
|
| 1503 |
+
"shape": [1, 4],
|
| 1504 |
+
"tolerance": 0.004,
|
| 1505 |
+
"relTolerance": 0,
|
| 1506 |
+
"data": { "kind": "values", "values": [7.0546875, -0.1224365234375, 0.053131103515625, 0.429443359375] }
|
| 1507 |
+
}
|
| 1508 |
+
}
|
| 1509 |
+
},
|
| 1510 |
+
{
|
| 1511 |
+
"name": "onnx23_f32_stash_float16_rounding",
|
| 1512 |
+
"provenance": {
|
| 1513 |
+
"source": "onnx/defs/nn/defs.cc RMSNormalization-23 function body",
|
| 1514 |
+
"notes": "TensorProto FLOAT16 stash (10) with float32 X and V. Non-f16 input and scale values expose both the cast into float16 stage one and the cast of Normalized back to float32 before the affine multiply."
|
| 1515 |
+
},
|
| 1516 |
+
"requires": { "features": ["shader-f16"] },
|
| 1517 |
+
"attrs": { "epsilon": 0.00001, "axis": -1, "stash_type": 10 },
|
| 1518 |
+
"inputs": {
|
| 1519 |
+
"x": {
|
| 1520 |
+
"dtype": "float32",
|
| 1521 |
+
"shape": [1, 4],
|
| 1522 |
+
"data": { "kind": "values", "values": [2.2851, -3.3284, 0.07473, 0.8293] }
|
| 1523 |
+
},
|
| 1524 |
+
"scale": {
|
| 1525 |
+
"dtype": "float32",
|
| 1526 |
+
"shape": [4],
|
| 1527 |
+
"data": { "kind": "values", "values": [2.3753, 2.8352, 2.3861, 1.0394] }
|
| 1528 |
+
}
|
| 1529 |
+
},
|
| 1530 |
+
"outputs": {
|
| 1531 |
+
"y": {
|
| 1532 |
+
"dtype": "float32",
|
| 1533 |
+
"shape": [1, 4],
|
| 1534 |
+
"tolerance": 0.000001,
|
| 1535 |
+
"relTolerance": 0,
|
| 1536 |
+
"data": {
|
| 1537 |
+
"kind": "values",
|
| 1538 |
+
"values": [2.635098457336426, -4.579512596130371, 0.08650777488946915, 0.41819608211517334]
|
| 1539 |
+
}
|
| 1540 |
+
}
|
| 1541 |
+
}
|
| 1542 |
+
},
|
| 1543 |
+
{
|
| 1544 |
+
"name": "onnx23_f32_stash_float16_scalar_scale",
|
| 1545 |
+
"provenance": {
|
| 1546 |
+
"source": "onnx/defs/nn/defs.cc RMSNormalization-23 function body",
|
| 1547 |
+
"notes": "Float32 X with TensorProto FLOAT16 stash (10) and a scalar float32 Scale covers the scalar broadcast path while preserving the float16 normalization and float32 affine boundaries."
|
| 1548 |
+
},
|
| 1549 |
+
"requires": { "features": ["shader-f16"] },
|
| 1550 |
+
"attrs": { "epsilon": 0.00001, "axis": -1, "stash_type": 10 },
|
| 1551 |
+
"inputs": {
|
| 1552 |
+
"x": {
|
| 1553 |
+
"dtype": "float32",
|
| 1554 |
+
"shape": [1, 4],
|
| 1555 |
+
"data": { "kind": "values", "values": [8.1716, 0.15772, -0.14759, -2.1252] }
|
| 1556 |
+
},
|
| 1557 |
+
"scale": { "dtype": "float32", "shape": [], "data": { "kind": "values", "values": [1.234567] } }
|
| 1558 |
+
},
|
| 1559 |
+
"outputs": {
|
| 1560 |
+
"y": {
|
| 1561 |
+
"dtype": "float32",
|
| 1562 |
+
"shape": [1, 4],
|
| 1563 |
+
"tolerance": 0.000001,
|
| 1564 |
+
"relTolerance": 0,
|
| 1565 |
+
"data": {
|
| 1566 |
+
"kind": "values",
|
| 1567 |
+
"values": [2.3919737339019775, 0.04615309461951256, -0.043176691979169846, -0.6221060752868652]
|
| 1568 |
+
}
|
| 1569 |
+
}
|
| 1570 |
+
}
|
| 1571 |
+
},
|
| 1572 |
+
{
|
| 1573 |
+
"name": "explicit_stash_type_float32",
|
| 1574 |
+
"attrs": { "epsilon": 0.00001, "axis": -1, "stash_type": 1 },
|
| 1575 |
+
"inputs": {
|
| 1576 |
+
"x": {
|
| 1577 |
+
"dtype": "float32",
|
| 1578 |
+
"shape": [2, 8],
|
| 1579 |
+
"data": { "kind": "fillFloat32", "sinStep": 0.29, "cosStep": 0.13 }
|
| 1580 |
+
},
|
| 1581 |
+
"scale": {
|
| 1582 |
+
"dtype": "float32",
|
| 1583 |
+
"shape": [8],
|
| 1584 |
+
"data": { "kind": "fillFloat32", "sinStep": 0.07, "cosStep": 0.37, "scale": 0.5 }
|
| 1585 |
+
}
|
| 1586 |
+
},
|
| 1587 |
+
"outputs": { "y": { "dtype": "float32", "shape": [2, 8], "tolerance": 0.000002 } }
|
| 1588 |
+
}
|
| 1589 |
+
]
|
| 1590 |
+
}
|