sync 4385228f788d
Browse files- README.md +18 -42
- build/webgpu/bench.json +0 -17
- build/webgpu/manifest.json +1 -1553
- build/webgpu/metadata.json +1 -70
- build/webgpu/norm-skip-row-vec4.wgsl.jinja +18 -11
- build/webgpu/norm-skip-row.wgsl.jinja +46 -21
- build/webgpu/norm-stats-copy.wgsl.jinja +6 -3
- build/webgpu/test.json +128 -56
README.md
CHANGED
|
@@ -54,69 +54,45 @@ Default values (overridable per request):
|
|
| 54 |
|
| 55 |
One implementation is selected per call from the device capabilities, the request shapes and the dtypes; these notes say what each one covers.
|
| 56 |
|
| 57 |
-
- `
|
| 58 |
-
- `
|
| 59 |
-
- `hidden1_f16_no_beta` — Closed-form one-element rows bind only gamma, optional beta, the output, and row parameters. Each invocation writes one row without reading the unused residual inputs.
|
| 60 |
-
- `hidden1_f16_beta` — Closed-form one-element rows bind only gamma, optional beta, the output, and row parameters. Each invocation writes one row without reading the unused residual inputs.
|
| 61 |
-
- `stats_mean_plain` — Row normalization returning mean statistics with `plain` optional inputs and outputs.
|
| 62 |
-
- `stats_mean_residual` — Row normalization returning mean statistics with `residual` optional inputs and outputs.
|
| 63 |
-
- `stats_mean_beta` — Row normalization returning mean statistics with `beta` optional inputs and outputs.
|
| 64 |
-
- `stats_mean_beta_residual` — Row normalization returning mean statistics with `beta_residual` optional inputs and outputs.
|
| 65 |
-
- `stats_mean_bias` — Row normalization returning mean statistics with `bias` optional inputs and outputs.
|
| 66 |
-
- `stats_mean_bias_residual` — Row normalization returning mean statistics with `bias_residual` optional inputs and outputs.
|
| 67 |
-
- `stats_mean_bias_beta` — Row normalization returning mean statistics with `bias_beta` optional inputs and outputs.
|
| 68 |
-
- `stats_mean_bias_beta_residual` — Row normalization returning mean statistics with `bias_beta_residual` optional inputs and outputs.
|
| 69 |
-
- `stats_inv_plain` — Row normalization returning inv statistics with `plain` optional inputs and outputs.
|
| 70 |
-
- `stats_inv_residual` — Row normalization returning inv statistics with `residual` optional inputs and outputs.
|
| 71 |
-
- `stats_inv_beta` — Row normalization returning inv statistics with `beta` optional inputs and outputs.
|
| 72 |
-
- `stats_inv_beta_residual` — Row normalization returning inv statistics with `beta_residual` optional inputs and outputs.
|
| 73 |
-
- `stats_inv_bias` — Row normalization returning inv statistics with `bias` optional inputs and outputs.
|
| 74 |
-
- `stats_inv_bias_residual` — Row normalization returning inv statistics with `bias_residual` optional inputs and outputs.
|
| 75 |
-
- `stats_inv_bias_beta` — Row normalization returning inv statistics with `bias_beta` optional inputs and outputs.
|
| 76 |
-
- `stats_inv_bias_beta_residual` — Row normalization returning inv statistics with `bias_beta_residual` optional inputs and outputs.
|
| 77 |
-
- `stats_both_plain` — Row normalization returning both statistics with `plain` optional inputs and outputs.
|
| 78 |
-
- `stats_both_residual` — Row normalization returning both statistics with `residual` optional inputs and outputs.
|
| 79 |
-
- `stats_both_beta` — Row normalization returning both statistics with `beta` optional inputs and outputs.
|
| 80 |
-
- `stats_both_beta_residual` — Row normalization returning both statistics with `beta_residual` optional inputs and outputs.
|
| 81 |
-
- `stats_both_bias` — Row normalization returning both statistics with `bias` optional inputs and outputs.
|
| 82 |
-
- `stats_both_bias_residual` — Row normalization returning both statistics with `bias_residual` optional inputs and outputs.
|
| 83 |
-
- `stats_both_bias_beta` — Row normalization returning both statistics with `bias_beta` optional inputs and outputs.
|
| 84 |
-
- `stats_both_bias_beta_residual` — Row normalization returning both statistics with `bias_beta_residual` optional inputs and outputs.
|
| 85 |
-
|
| 86 |
-
## Device requirements
|
| 87 |
-
|
| 88 |
-
Some implementation variants require `shader-f16`. These are route-specific capabilities, not package-wide requirements; availability also depends on the request shape and dtype.
|
| 89 |
|
| 90 |
## Files
|
| 91 |
|
| 92 |
-
- [`metadata.json`](build/webgpu/metadata.json) — kernel metadata (id, digests,
|
| 93 |
-
- [`manifest.json`](build/webgpu/manifest.json) — the op contract (source of truth)
|
| 94 |
-
- [`test.json`](build/webgpu/test.json) — correctness cases
|
| 95 |
-
- [`bench.json`](build/webgpu/bench.json) — benchmark cases
|
| 96 |
-
- [`norm-skip-row-vec4.wgsl.jinja`](build/webgpu/norm-skip-row-vec4.wgsl.jinja)
|
| 97 |
-
- [`norm-skip-row.wgsl.jinja`](build/webgpu/norm-skip-row.wgsl.jinja)
|
| 98 |
-
- [`norm-stats-copy.wgsl.jinja`](build/webgpu/norm-stats-copy.wgsl.jinja)
|
| 99 |
|
| 100 |
## Use with `@huggingface/kernels`
|
| 101 |
|
| 102 |
```sh
|
| 103 |
-
npm install --save-exact @huggingface/kernels@0.0.1-preview.
|
| 104 |
```
|
| 105 |
|
|
|
|
|
|
|
| 106 |
Required output shapes and logical data types are inferred from the supplied inputs and attributes; result tensors are allocated automatically.
|
| 107 |
|
| 108 |
The `version: 1` option selects the published kernel contract; it is independent of any operator opset, contrib `since_version`, or model version.
|
| 109 |
It follows the `v1` branch as fixes land. To pin exact artifact bytes, pass a 40-character commit `revision` instead of `version`.
|
| 110 |
|
| 111 |
-
Replace each `*Data` placeholder with a typed array containing the corresponding input data.
|
| 112 |
-
|
| 113 |
```js
|
| 114 |
import { getKernel } from "@huggingface/kernels";
|
| 115 |
|
| 116 |
const kernel = await getKernel("webgpu-kernels/com.microsoft.SkipLayerNormalization", { version: 1 });
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 117 |
const { outputT } = await kernel({
|
| 118 |
inputT: { data: inputTData, shape: [2, 4] },
|
| 119 |
skipT: { data: skipTData, shape: [2, 4] },
|
| 120 |
gammaT: { data: gammaTData, shape: [4] },
|
| 121 |
});
|
|
|
|
| 122 |
```
|
|
|
|
| 54 |
|
| 55 |
One implementation is selected per call from the device capabilities, the request shapes and the dtypes; these notes say what each one covers.
|
| 56 |
|
| 57 |
+
- `row` — One workgroup reduces each row; one-element rows instead run one invocation each and classify the rounded input-plus-skip residual and scale before using their closed-form epilogue.
|
| 58 |
+
- `stats` — Row normalization that also returns the requested statistics; when both are requested the row pass packs them and a second pass copies them out.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 59 |
|
| 60 |
## Files
|
| 61 |
|
| 62 |
+
- [`metadata.json`](https://huggingface.co/kernels/webgpu-kernels/com.microsoft.SkipLayerNormalization/blob/v1/build/webgpu/metadata.json) — kernel metadata (id, file digests, manifest spec, provenance)
|
| 63 |
+
- [`manifest.json`](https://huggingface.co/kernels/webgpu-kernels/com.microsoft.SkipLayerNormalization/blob/v1/build/webgpu/manifest.json) — the op contract (source of truth)
|
| 64 |
+
- [`test.json`](https://huggingface.co/kernels/webgpu-kernels/com.microsoft.SkipLayerNormalization/blob/v1/build/webgpu/test.json) — correctness cases
|
| 65 |
+
- [`bench.json`](https://huggingface.co/kernels/webgpu-kernels/com.microsoft.SkipLayerNormalization/blob/v1/build/webgpu/bench.json) — benchmark cases
|
| 66 |
+
- [`norm-skip-row-vec4.wgsl.jinja`](https://huggingface.co/kernels/webgpu-kernels/com.microsoft.SkipLayerNormalization/blob/v1/build/webgpu/norm-skip-row-vec4.wgsl.jinja)
|
| 67 |
+
- [`norm-skip-row.wgsl.jinja`](https://huggingface.co/kernels/webgpu-kernels/com.microsoft.SkipLayerNormalization/blob/v1/build/webgpu/norm-skip-row.wgsl.jinja)
|
| 68 |
+
- [`norm-stats-copy.wgsl.jinja`](https://huggingface.co/kernels/webgpu-kernels/com.microsoft.SkipLayerNormalization/blob/v1/build/webgpu/norm-stats-copy.wgsl.jinja)
|
| 69 |
|
| 70 |
## Use with `@huggingface/kernels`
|
| 71 |
|
| 72 |
```sh
|
| 73 |
+
npm install --save-exact @huggingface/kernels@0.0.1-preview.4
|
| 74 |
```
|
| 75 |
|
| 76 |
+
Paste the example into a browser app that resolves npm imports. Serve the app over HTTPS or localhost with WebGPU available.
|
| 77 |
+
|
| 78 |
Required output shapes and logical data types are inferred from the supplied inputs and attributes; result tensors are allocated automatically.
|
| 79 |
|
| 80 |
The `version: 1` option selects the published kernel contract; it is independent of any operator opset, contrib `since_version`, or model version.
|
| 81 |
It follows the `v1` branch as fixes land. To pin exact artifact bytes, pass a 40-character commit `revision` instead of `version`.
|
| 82 |
|
|
|
|
|
|
|
| 83 |
```js
|
| 84 |
import { getKernel } from "@huggingface/kernels";
|
| 85 |
|
| 86 |
const kernel = await getKernel("webgpu-kernels/com.microsoft.SkipLayerNormalization", { version: 1 });
|
| 87 |
+
|
| 88 |
+
const inputTData = Float32Array.of(0.8, -0.5, 0, 1, 0.5, 0.2, 0.3, -0.6);
|
| 89 |
+
const skipTData = Float32Array.of(0.1, -0.2, 0.3, 1, 0.5, 0.1, 0.4, 1.6);
|
| 90 |
+
const gammaTData = Float32Array.of(0.3, 0.2, 4, 2.2);
|
| 91 |
+
|
| 92 |
const { outputT } = await kernel({
|
| 93 |
inputT: { data: inputTData, shape: [2, 4] },
|
| 94 |
skipT: { data: skipTData, shape: [2, 4] },
|
| 95 |
gammaT: { data: gammaTData, shape: [4] },
|
| 96 |
});
|
| 97 |
+
console.log({ outputT });
|
| 98 |
```
|
build/webgpu/bench.json
CHANGED
|
@@ -137,23 +137,6 @@
|
|
| 137 |
},
|
| 138 |
"bench": { "metrics": [{ "type": "bandwidth", "value": "4 * (4 * args.rows * args.hidden + 2 * args.hidden)" }] }
|
| 139 |
},
|
| 140 |
-
{
|
| 141 |
-
"name": "skip-layernorm-f32-4096x768-hidden768-aligned",
|
| 142 |
-
"preset": "model",
|
| 143 |
-
"vars": { "rows": 4096, "hidden": 768 },
|
| 144 |
-
"attrs": { "epsilon": 0.00001 },
|
| 145 |
-
"inputs": {
|
| 146 |
-
"inputT": { "shape": [4096, 768], "dtype": "float32", "dist": "normal", "seed": 413, "scale": 0.2 },
|
| 147 |
-
"skipT": { "shape": [4096, 768], "dtype": "float32", "dist": "normal", "seed": 414, "scale": 0.2 },
|
| 148 |
-
"gammaT": { "shape": [768], "dtype": "float32", "dist": "uniform", "seed": 415, "scale": 0.1, "offset": 1 },
|
| 149 |
-
"betaT": { "shape": [768], "dtype": "float32", "dist": "normal", "seed": 416, "scale": 0.1 }
|
| 150 |
-
},
|
| 151 |
-
"outputs": {
|
| 152 |
-
"outputT": { "shape": [4096, 768], "dtype": "float32" },
|
| 153 |
-
"residualT": { "shape": [4096, 768], "dtype": "float32" }
|
| 154 |
-
},
|
| 155 |
-
"bench": { "metrics": [{ "type": "bandwidth", "value": "4 * (4 * args.rows * args.hidden + 2 * args.hidden)" }] }
|
| 156 |
-
},
|
| 157 |
{
|
| 158 |
"name": "skip-layernorm-f32-rows1-hidden4096-decode",
|
| 159 |
"preset": "model",
|
|
|
|
| 137 |
},
|
| 138 |
"bench": { "metrics": [{ "type": "bandwidth", "value": "4 * (4 * args.rows * args.hidden + 2 * args.hidden)" }] }
|
| 139 |
},
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 140 |
{
|
| 141 |
"name": "skip-layernorm-f32-rows1-hidden4096-decode",
|
| 142 |
"preset": "model",
|
build/webgpu/manifest.json
CHANGED
|
@@ -1,1553 +1 @@
|
|
| 1 |
-
{
|
| 2 |
-
"domain": "com.microsoft",
|
| 3 |
-
"name": "SkipLayerNormalization",
|
| 4 |
-
"sinceVersion": 1,
|
| 5 |
-
"inputs": {
|
| 6 |
-
"inputT": { "onnx": "input", "dtype": "T" },
|
| 7 |
-
"skipT": { "onnx": "skip", "dtype": "T" },
|
| 8 |
-
"gammaT": { "onnx": "gamma", "dtype": "T", "rank": 1 },
|
| 9 |
-
"betaT": { "onnx": "beta", "dtype": "T", "rank": 1, "optional": true },
|
| 10 |
-
"biasT": { "onnx": "bias", "dtype": "T", "rank": 1, "optional": true }
|
| 11 |
-
},
|
| 12 |
-
"outputs": {
|
| 13 |
-
"outputT": { "onnx": "output", "dtype": "T", "rank": "ranks.inputT", "shape": "shapes.inputT" },
|
| 14 |
-
"meanT": {
|
| 15 |
-
"onnx": "mean",
|
| 16 |
-
"dtype": "U",
|
| 17 |
-
"optional": true,
|
| 18 |
-
"rank": "ranks.inputT",
|
| 19 |
-
"shape": "prefix(shapes.inputT, ranks.inputT - 1) + [1]"
|
| 20 |
-
},
|
| 21 |
-
"invStdT": {
|
| 22 |
-
"onnx": "inv_std_var",
|
| 23 |
-
"dtype": "U",
|
| 24 |
-
"optional": true,
|
| 25 |
-
"rank": "ranks.inputT",
|
| 26 |
-
"shape": "prefix(shapes.inputT, ranks.inputT - 1) + [1]"
|
| 27 |
-
},
|
| 28 |
-
"residualT": {
|
| 29 |
-
"onnx": "input_skip_bias_sum",
|
| 30 |
-
"dtype": "T",
|
| 31 |
-
"rank": "ranks.inputT",
|
| 32 |
-
"optional": true,
|
| 33 |
-
"shape": "shapes.inputT"
|
| 34 |
-
}
|
| 35 |
-
},
|
| 36 |
-
"attributes": { "epsilon": { "default": 9.999999960041972e-13 } },
|
| 37 |
-
"typeConstraints": { "T": ["float32", "float16"], "U": ["float32"] },
|
| 38 |
-
"tunables": { "MAX_WORKGROUP_SIZE": { "default": 256 } },
|
| 39 |
-
"derive": {
|
| 40 |
-
"rowCount": "numel(shapes.inputT) / max(1, dim(shapes.inputT, -1))",
|
| 41 |
-
"hiddenSize": "dim(shapes.inputT, -1)",
|
| 42 |
-
"skipWg": "max(1, min(tunables.MAX_WORKGROUP_SIZE, device.limits.maxComputeInvocationsPerWorkgroup, device.limits.maxComputeWorkgroupSizeX)) if hiddenSize == 1 else (max(1, min(tunables.MAX_WORKGROUP_SIZE, device.limits.maxComputeInvocationsPerWorkgroup, device.limits.maxComputeWorkgroupSizeX, pow2ceil(hiddenSize))))",
|
| 43 |
-
"skipWgVec4": "max(1, min(tunables.MAX_WORKGROUP_SIZE, device.limits.maxComputeInvocationsPerWorkgroup, device.limits.maxComputeWorkgroupSizeX, pow2ceil(ceilDiv(hiddenSize, 4))))",
|
| 44 |
-
"rowDispatchFits": "rowCount <= min(device.limits.maxComputeWorkgroupsPerDimension, 65535) * min(device.limits.maxComputeWorkgroupsPerDimension, 65535)",
|
| 45 |
-
"normResourcesFit": "skipWg * 8 <= device.limits.maxComputeWorkgroupStorageSize and skipWgVec4 * 8 <= device.limits.maxComputeWorkgroupStorageSize",
|
| 46 |
-
"epsilonOk": "attrs.epsilon >= 0",
|
| 47 |
-
"coreContract": "epsilonOk and (ranks.inputT == 2 or ranks.inputT == 3) and ranks.skipT == ranks.inputT and ranks.gammaT == 1 and ranks.outputT == ranks.inputT and sameShape(shapes.inputT, shapes.skipT) and sameShape(shapes.outputT, shapes.inputT) and dim(shapes.inputT, -1) > 0 and dim(shapes.gammaT, 0) == dim(shapes.inputT, -1)",
|
| 48 |
-
"residualOutputContract": "present.residualT and sameShape(shapes.residualT, shapes.inputT)",
|
| 49 |
-
"outputOnlyContract": "not present.residualT",
|
| 50 |
-
"f32MainDtypes": "tensorDtypes.inputT == \"float32\" and tensorDtypes.skipT == \"float32\" and tensorDtypes.gammaT == \"float32\" and tensorDtypes.outputT == \"float32\"",
|
| 51 |
-
"f16MainDtypes": "tensorDtypes.inputT == \"float16\" and tensorDtypes.skipT == \"float16\" and tensorDtypes.gammaT == \"float16\" and tensorDtypes.outputT == \"float16\"",
|
| 52 |
-
"f32ResidualDtypes": "f32MainDtypes and tensorDtypes.residualT == \"float32\" if present.residualT else false",
|
| 53 |
-
"f16ResidualDtypes": "f16MainDtypes and tensorDtypes.residualT == \"float16\" if present.residualT else false",
|
| 54 |
-
"vec4Aligned": "dim(shapes.inputT, -1) % 4 == 0",
|
| 55 |
-
"hasSubgroups": "device.features.has(\"subgroups\") and device.wgslLanguageFeatures.has(\"subgroup_id\")",
|
| 56 |
-
"hasF16": "device.features.has(\"shader-f16\")",
|
| 57 |
-
"statsRequested": "present.meanT or present.invStdT",
|
| 58 |
-
"portableWideExecution": "not has(device.adapterInfo, \"subgroupMinSize\") or device.adapterInfo.subgroupMinSize >= 32",
|
| 59 |
-
"broadcastRows": "dim(shapes.inputT, 0) * dim(shapes.inputT, 1)",
|
| 60 |
-
"broadcastHiddenSize": "dim(shapes.inputT, 2)",
|
| 61 |
-
"broadcastSkipWgVec4": "max(1, min(tunables.MAX_WORKGROUP_SIZE, device.limits.maxComputeInvocationsPerWorkgroup, device.limits.maxComputeWorkgroupSizeX, pow2ceil(ceilDiv(broadcastHiddenSize, 4))))",
|
| 62 |
-
"broadcastDispatchFits": "broadcastRows <= min(device.limits.maxComputeWorkgroupsPerDimension, 65535) * min(device.limits.maxComputeWorkgroupsPerDimension, 65535)",
|
| 63 |
-
"broadcastResourcesFit": "broadcastSkipWgVec4 * 8 <= device.limits.maxComputeWorkgroupStorageSize",
|
| 64 |
-
"betaContract": "false if not present.betaT else (ranks.betaT == 1 and dim(shapes.betaT, 0) == dim(shapes.inputT, -1))",
|
| 65 |
-
"noBetaContract": "not present.betaT",
|
| 66 |
-
"broadcastSkipShapeOk": "(ranks.skipT == 2 and dim(shapes.skipT, 0) == dim(shapes.inputT, 1) and dim(shapes.skipT, 1) == dim(shapes.inputT, 2)) or (ranks.skipT == 3 and ((dim(shapes.skipT, 0) == 1 and dim(shapes.skipT, 1) == dim(shapes.inputT, 1) and dim(shapes.skipT, 2) == dim(shapes.inputT, 2)) or sameShape(shapes.skipT, shapes.inputT)))",
|
| 67 |
-
"broadcastOutputOnlyContract": "false if ranks.inputT != 3 or not present.betaT else (epsilonOk and not present.biasT and not present.residualT and dim(shapes.inputT, 2) % 4 == 0 and broadcastSkipShapeOk and ranks.gammaT == 1 and ranks.betaT == 1 and ranks.outputT == 3 and tensorDtypes.inputT == \"float32\" and tensorDtypes.skipT == \"float32\" and tensorDtypes.gammaT == \"float32\" and tensorDtypes.betaT == \"float32\" and tensorDtypes.outputT == \"float32\" and dim(shapes.inputT, 2) > 0 and dim(shapes.gammaT, 0) == dim(shapes.inputT, 2) and dim(shapes.betaT, 0) == dim(shapes.inputT, 2) and sameShape(shapes.outputT, shapes.inputT))",
|
| 68 |
-
"f32_beta_no_bias_residual_contract": "coreContract and residualOutputContract and betaContract and f32ResidualDtypes and not present.biasT and tensorDtypes.betaT == \"float32\"",
|
| 69 |
-
"f32_beta_bias_residual_contract": "false if not present.biasT else (coreContract and residualOutputContract and betaContract and f32ResidualDtypes and ranks.biasT == 1 and tensorDtypes.betaT == \"float32\" and tensorDtypes.biasT == \"float32\" and dim(shapes.biasT, 0) == hiddenSize)",
|
| 70 |
-
"f16_beta_bias_residual_contract": "false if not present.biasT else (hasF16 and coreContract and residualOutputContract and betaContract and f16ResidualDtypes and ranks.biasT == 1 and tensorDtypes.betaT == \"float16\" and tensorDtypes.biasT == \"float16\" and dim(shapes.biasT, 0) == hiddenSize)",
|
| 71 |
-
"f32_no_beta_output_contract": "coreContract and outputOnlyContract and noBetaContract and f32MainDtypes and not present.biasT",
|
| 72 |
-
"f32_beta_no_bias_output_only_contract": "coreContract and outputOnlyContract and betaContract and f32MainDtypes and not present.biasT and tensorDtypes.betaT == \"float32\"",
|
| 73 |
-
"f32_beta_bias_output_only_contract": "false if not present.biasT else (coreContract and outputOnlyContract and betaContract and f32MainDtypes and ranks.biasT == 1 and tensorDtypes.betaT == \"float32\" and tensorDtypes.biasT == \"float32\" and dim(shapes.biasT, 0) == hiddenSize)",
|
| 74 |
-
"f16_no_beta_output_contract": "hasF16 and coreContract and outputOnlyContract and noBetaContract and f16MainDtypes and not present.biasT",
|
| 75 |
-
"f16_beta_no_bias_output_only_contract": "hasF16 and coreContract and outputOnlyContract and betaContract and f16MainDtypes and not present.biasT and tensorDtypes.betaT == \"float16\"",
|
| 76 |
-
"f16_beta_bias_output_only_contract": "false if not present.biasT else (hasF16 and coreContract and outputOnlyContract and betaContract and f16MainDtypes and ranks.biasT == 1 and tensorDtypes.betaT == \"float16\" and tensorDtypes.biasT == \"float16\" and dim(shapes.biasT, 0) == hiddenSize)",
|
| 77 |
-
"statsContract": "statsRequested and coreContract and f16Ok(dtypes.T) and (not present.biasT or (ranks.biasT == 1 and dim(shapes.biasT, 0) == hiddenSize)) and (not present.residualT or sameShape(shapes.residualT, shapes.inputT)) and (not present.betaT or (ranks.betaT == 1 and dim(shapes.betaT, 0) == hiddenSize))"
|
| 78 |
-
},
|
| 79 |
-
"bindings": {
|
| 80 |
-
"input": { "arg": "inputT", "elementType": "$vectorScalar" },
|
| 81 |
-
"skip": { "arg": "skipT", "elementType": "$vectorScalar" },
|
| 82 |
-
"gamma": { "arg": "gammaT", "elementType": "$vectorScalar", "length": "$HIDDEN_LEN" },
|
| 83 |
-
"beta": { "arg": "betaT", "elementType": "$vectorScalar", "length": "$HIDDEN_LEN" },
|
| 84 |
-
"output": { "arg": "outputT", "elementType": "$vectorScalar" },
|
| 85 |
-
"bias": { "arg": "biasT", "elementType": "$vectorScalar", "length": "$HIDDEN_LEN" },
|
| 86 |
-
"input_skip_bias_sum": { "arg": "residualT", "elementType": "$vectorScalar" },
|
| 87 |
-
"params_main": {
|
| 88 |
-
"name": "params",
|
| 89 |
-
"struct": [
|
| 90 |
-
{ "name": "rows", "type": "u32", "value": "rowCount" },
|
| 91 |
-
{
|
| 92 |
-
"name": "rowStride",
|
| 93 |
-
"type": "u32",
|
| 94 |
-
"value": "max(1, min(rowCount, min(device.limits.maxComputeWorkgroupsPerDimension, 65535)))"
|
| 95 |
-
},
|
| 96 |
-
{ "name": "epsilon", "type": "f32", "value": "attrs.epsilon" }
|
| 97 |
-
]
|
| 98 |
-
},
|
| 99 |
-
"input_main": { "arg": "inputT", "name": "input", "elementType": "$scalar" },
|
| 100 |
-
"skip_main": { "arg": "skipT", "name": "skip", "elementType": "$scalar" },
|
| 101 |
-
"bias_main": { "arg": "biasT", "name": "bias", "elementType": "$scalar", "length": "$HIDDEN_LEN" },
|
| 102 |
-
"gamma_main": { "arg": "gammaT", "name": "gamma", "elementType": "$scalar", "length": "$HIDDEN_LEN" },
|
| 103 |
-
"beta_main": { "arg": "betaT", "name": "beta", "elementType": "$scalar", "length": "$HIDDEN_LEN" },
|
| 104 |
-
"output_main": { "arg": "outputT", "name": "output", "elementType": "$scalar" },
|
| 105 |
-
"input_skip_bias_sum_main": { "arg": "residualT", "name": "input_skip_bias_sum", "elementType": "$scalar" },
|
| 106 |
-
"params__uniform": {
|
| 107 |
-
"name": "params",
|
| 108 |
-
"struct": [
|
| 109 |
-
{ "name": "rows", "type": "u32", "value": "rowCount" },
|
| 110 |
-
{ "name": "epsilon", "type": "f32", "value": "attrs.epsilon" }
|
| 111 |
-
]
|
| 112 |
-
},
|
| 113 |
-
"mean": { "arg": "meanT", "elementType": "f32" },
|
| 114 |
-
"inv_std_var": { "arg": "invStdT", "elementType": "f32" },
|
| 115 |
-
"row_stats": { "scratch": "rowStats", "elementType": "vec2<f32>" },
|
| 116 |
-
"row_stats_read": {
|
| 117 |
-
"scratch": "rowStats",
|
| 118 |
-
"name": "row_stats",
|
| 119 |
-
"buffer": "read-only-storage",
|
| 120 |
-
"elementType": "vec2<f32>"
|
| 121 |
-
},
|
| 122 |
-
"params_stats": { "name": "params", "struct": [{ "name": "rows", "type": "u32", "value": "rowCount" }] }
|
| 123 |
-
},
|
| 124 |
-
"variants": [
|
| 125 |
-
{
|
| 126 |
-
"id": "hidden1_f32_no_beta",
|
| 127 |
-
"priority": 20,
|
| 128 |
-
"when": ["f32_no_beta_output_contract", "hiddenSize == 1", "normResourcesFit", "rowDispatchFits", "not present.meanT and not present.invStdT"],
|
| 129 |
-
"derive": {
|
| 130 |
-
"simplified": false,
|
| 131 |
-
"hasBias": false,
|
| 132 |
-
"hasBeta": "present.betaT",
|
| 133 |
-
"writeResidualSum": false,
|
| 134 |
-
"useSubgroups": false,
|
| 135 |
-
"scalar": "dtypes.T",
|
| 136 |
-
"workgroupSize": "skipWg",
|
| 137 |
-
"HIDDEN_LEN": "hiddenSize"
|
| 138 |
-
},
|
| 139 |
-
"passes": [
|
| 140 |
-
{
|
| 141 |
-
"id": "main",
|
| 142 |
-
"name": "SkipLayerNormalization.Hidden1",
|
| 143 |
-
"shader": "norm-skip-row.wgsl.jinja",
|
| 144 |
-
"bindings": ["gamma_main", "output_main", "params__uniform"],
|
| 145 |
-
"dispatch": {
|
| 146 |
-
"x": "min(ceilDiv((rowCount), (skipWg)), 65535)",
|
| 147 |
-
"y": "ceilDiv(ceilDiv((rowCount), (skipWg)), 65535)",
|
| 148 |
-
"z": 1
|
| 149 |
-
}
|
| 150 |
-
}
|
| 151 |
-
]
|
| 152 |
-
},
|
| 153 |
-
{
|
| 154 |
-
"id": "hidden1_f32_beta",
|
| 155 |
-
"priority": 20,
|
| 156 |
-
"when": ["(f32_beta_no_bias_output_only_contract or f32_beta_bias_output_only_contract)", "hiddenSize == 1", "normResourcesFit", "rowDispatchFits", "not present.meanT and not present.invStdT"],
|
| 157 |
-
"derive": {
|
| 158 |
-
"simplified": false,
|
| 159 |
-
"hasBias": false,
|
| 160 |
-
"hasBeta": "present.betaT",
|
| 161 |
-
"writeResidualSum": false,
|
| 162 |
-
"useSubgroups": false,
|
| 163 |
-
"scalar": "dtypes.T",
|
| 164 |
-
"workgroupSize": "skipWg",
|
| 165 |
-
"HIDDEN_LEN": "hiddenSize"
|
| 166 |
-
},
|
| 167 |
-
"passes": [
|
| 168 |
-
{
|
| 169 |
-
"id": "main",
|
| 170 |
-
"name": "SkipLayerNormalization.Hidden1",
|
| 171 |
-
"shader": "norm-skip-row.wgsl.jinja",
|
| 172 |
-
"bindings": ["gamma_main", "beta_main", "output_main", "params__uniform"],
|
| 173 |
-
"dispatch": {
|
| 174 |
-
"x": "min(ceilDiv((rowCount), (skipWg)), 65535)",
|
| 175 |
-
"y": "ceilDiv(ceilDiv((rowCount), (skipWg)), 65535)",
|
| 176 |
-
"z": 1
|
| 177 |
-
}
|
| 178 |
-
}
|
| 179 |
-
]
|
| 180 |
-
},
|
| 181 |
-
{
|
| 182 |
-
"id": "hidden1_f16_no_beta",
|
| 183 |
-
"priority": 20,
|
| 184 |
-
"when": ["f16_no_beta_output_contract", "hiddenSize == 1", "normResourcesFit", "rowDispatchFits", "not present.meanT and not present.invStdT"],
|
| 185 |
-
"derive": {
|
| 186 |
-
"simplified": false,
|
| 187 |
-
"hasBias": false,
|
| 188 |
-
"hasBeta": "present.betaT",
|
| 189 |
-
"writeResidualSum": false,
|
| 190 |
-
"useSubgroups": false,
|
| 191 |
-
"scalar": "dtypes.T",
|
| 192 |
-
"workgroupSize": "skipWg",
|
| 193 |
-
"HIDDEN_LEN": "hiddenSize"
|
| 194 |
-
},
|
| 195 |
-
"passes": [
|
| 196 |
-
{
|
| 197 |
-
"id": "main",
|
| 198 |
-
"name": "SkipLayerNormalization.Hidden1",
|
| 199 |
-
"shader": "norm-skip-row.wgsl.jinja",
|
| 200 |
-
"bindings": ["gamma_main", "output_main", "params__uniform"],
|
| 201 |
-
"dispatch": {
|
| 202 |
-
"x": "min(ceilDiv((rowCount), (skipWg)), 65535)",
|
| 203 |
-
"y": "ceilDiv(ceilDiv((rowCount), (skipWg)), 65535)",
|
| 204 |
-
"z": 1
|
| 205 |
-
}
|
| 206 |
-
}
|
| 207 |
-
]
|
| 208 |
-
},
|
| 209 |
-
{
|
| 210 |
-
"id": "hidden1_f16_beta",
|
| 211 |
-
"priority": 20,
|
| 212 |
-
"when": ["(f16_beta_no_bias_output_only_contract or f16_beta_bias_output_only_contract)", "hiddenSize == 1", "normResourcesFit", "rowDispatchFits", "not present.meanT and not present.invStdT"],
|
| 213 |
-
"derive": {
|
| 214 |
-
"simplified": false,
|
| 215 |
-
"hasBias": false,
|
| 216 |
-
"hasBeta": "present.betaT",
|
| 217 |
-
"writeResidualSum": false,
|
| 218 |
-
"useSubgroups": false,
|
| 219 |
-
"scalar": "dtypes.T",
|
| 220 |
-
"workgroupSize": "skipWg",
|
| 221 |
-
"HIDDEN_LEN": "hiddenSize"
|
| 222 |
-
},
|
| 223 |
-
"passes": [
|
| 224 |
-
{
|
| 225 |
-
"id": "main",
|
| 226 |
-
"name": "SkipLayerNormalization.Hidden1",
|
| 227 |
-
"shader": "norm-skip-row.wgsl.jinja",
|
| 228 |
-
"bindings": ["gamma_main", "beta_main", "output_main", "params__uniform"],
|
| 229 |
-
"dispatch": {
|
| 230 |
-
"x": "min(ceilDiv((rowCount), (skipWg)), 65535)",
|
| 231 |
-
"y": "ceilDiv(ceilDiv((rowCount), (skipWg)), 65535)",
|
| 232 |
-
"z": 1
|
| 233 |
-
}
|
| 234 |
-
}
|
| 235 |
-
]
|
| 236 |
-
},
|
| 237 |
-
{
|
| 238 |
-
"id": "beta_output_only_vec4_broadcast",
|
| 239 |
-
"priority": 19,
|
| 240 |
-
"when": ["broadcastOutputOnlyContract", "broadcastResourcesFit", "broadcastDispatchFits", "not present.meanT and not present.invStdT"],
|
| 241 |
-
"derive": { "vectorScalar": "\"vec4<f32>\"", "HIDDEN_LEN": "broadcastHiddenSize / 4" },
|
| 242 |
-
"passes": [
|
| 243 |
-
{
|
| 244 |
-
"id": "main",
|
| 245 |
-
"name": "SkipLayerNormalization.BroadcastSkip",
|
| 246 |
-
"shader": "norm-skip-row-vec4.wgsl.jinja",
|
| 247 |
-
"derive": {
|
| 248 |
-
"simplified": false,
|
| 249 |
-
"hasBias": false,
|
| 250 |
-
"hasBeta": true,
|
| 251 |
-
"writeResidualSum": false,
|
| 252 |
-
"broadcastSkip": true,
|
| 253 |
-
"hidden": "broadcastHiddenSize",
|
| 254 |
-
"hiddenVec": "broadcastHiddenSize / 4",
|
| 255 |
-
"wg": "broadcastSkipWgVec4",
|
| 256 |
-
"vecType": "\"vec4<f32>\"",
|
| 257 |
-
"useSubgroups": "hasSubgroups"
|
| 258 |
-
},
|
| 259 |
-
"bindings": [
|
| 260 |
-
"input",
|
| 261 |
-
"skip",
|
| 262 |
-
"gamma",
|
| 263 |
-
"beta",
|
| 264 |
-
"output",
|
| 265 |
-
{
|
| 266 |
-
"name": "params",
|
| 267 |
-
"struct": [
|
| 268 |
-
{ "name": "rows", "type": "u32", "value": "dim(shapes.inputT, 0) * dim(shapes.inputT, 1)" },
|
| 269 |
-
{
|
| 270 |
-
"name": "rowStride",
|
| 271 |
-
"type": "u32",
|
| 272 |
-
"value": "max(1, min(broadcastRows, min(device.limits.maxComputeWorkgroupsPerDimension, 65535)))"
|
| 273 |
-
},
|
| 274 |
-
{ "name": "epsilon", "type": "f32", "value": "attrs.epsilon" },
|
| 275 |
-
{ "name": "skipRows", "type": "u32", "value": "numel(shapes.skipT) / broadcastHiddenSize" }
|
| 276 |
-
]
|
| 277 |
-
}
|
| 278 |
-
],
|
| 279 |
-
"dispatch": { "x": "min(broadcastRows, 65535)", "y": "ceilDiv(broadcastRows, 65535)", "z": 1 }
|
| 280 |
-
}
|
| 281 |
-
]
|
| 282 |
-
},
|
| 283 |
-
{
|
| 284 |
-
"id": "beta_bias_vec4",
|
| 285 |
-
"priority": 15,
|
| 286 |
-
"when": ["f32_beta_bias_residual_contract", "vec4Aligned", "hasSubgroups or \"bias\" == \"bias\" or portableWideExecution", "normResourcesFit", "rowDispatchFits", "not present.meanT and not present.invStdT"],
|
| 287 |
-
"derive": { "vectorScalar": "\"vec4<f32>\"", "hasBias": "\"bias\" == \"bias\"", "HIDDEN_LEN": "hiddenSize / 4" },
|
| 288 |
-
"passes": [
|
| 289 |
-
{
|
| 290 |
-
"id": "normalize",
|
| 291 |
-
"name": "SkipLayerNormalization.Vec4.Normalize",
|
| 292 |
-
"shader": "norm-skip-row-vec4.wgsl.jinja",
|
| 293 |
-
"derive": {
|
| 294 |
-
"simplified": false,
|
| 295 |
-
"hasBeta": true,
|
| 296 |
-
"writeResidualSum": true,
|
| 297 |
-
"hidden": "hiddenSize",
|
| 298 |
-
"hiddenVec": "hiddenSize / 4",
|
| 299 |
-
"wg": "skipWgVec4",
|
| 300 |
-
"vecType": "\"vec4<f32>\"",
|
| 301 |
-
"useSubgroups": "hasSubgroups"
|
| 302 |
-
},
|
| 303 |
-
"bindings": ["input", "skip", "bias", "gamma", "beta", "output", "input_skip_bias_sum", "params_main"],
|
| 304 |
-
"dispatch": { "x": "min(rowCount, 65535)", "y": "ceilDiv(rowCount, 65535)", "z": 1 }
|
| 305 |
-
}
|
| 306 |
-
]
|
| 307 |
-
},
|
| 308 |
-
{
|
| 309 |
-
"id": "beta_bias_row",
|
| 310 |
-
"priority": 5,
|
| 311 |
-
"when": ["f32_beta_bias_residual_contract", "normResourcesFit", "rowDispatchFits", "not present.meanT and not present.invStdT"],
|
| 312 |
-
"derive": {
|
| 313 |
-
"simplified": false,
|
| 314 |
-
"useSubgroups": "hasSubgroups",
|
| 315 |
-
"hasBeta": true,
|
| 316 |
-
"writeResidualSum": true,
|
| 317 |
-
"hasBias": "\"bias\" == \"bias\"",
|
| 318 |
-
"scalar": "\"f32\"",
|
| 319 |
-
"workgroupSize": "skipWg",
|
| 320 |
-
"HIDDEN_LEN": "hiddenSize"
|
| 321 |
-
},
|
| 322 |
-
"passes": [
|
| 323 |
-
{
|
| 324 |
-
"id": "normalize",
|
| 325 |
-
"name": "SkipLayerNormalization.Row.Normalize",
|
| 326 |
-
"shader": "norm-skip-row.wgsl.jinja",
|
| 327 |
-
"derive": { "writeResidualSum": true },
|
| 328 |
-
"bindings": ["input_main", "skip_main", "bias_main", "gamma_main", "beta_main", "output_main", "input_skip_bias_sum_main", "params__uniform"],
|
| 329 |
-
"dispatch": {
|
| 330 |
-
"x": "min(ceilDiv((rowCount * (1 if hiddenSize == 1 else skipWg)), (skipWg)), 65535)",
|
| 331 |
-
"y": "ceilDiv(ceilDiv((rowCount * (1 if hiddenSize == 1 else skipWg)), (skipWg)), 65535)",
|
| 332 |
-
"z": 1
|
| 333 |
-
}
|
| 334 |
-
}
|
| 335 |
-
]
|
| 336 |
-
},
|
| 337 |
-
{
|
| 338 |
-
"id": "beta_no_bias_vec4",
|
| 339 |
-
"priority": 20,
|
| 340 |
-
"when": ["f32_beta_no_bias_residual_contract", "vec4Aligned", "hasSubgroups or portableWideExecution", "normResourcesFit", "rowDispatchFits", "not present.meanT and not present.invStdT"],
|
| 341 |
-
"derive": {
|
| 342 |
-
"vectorScalar": "\"vec4<f32>\"",
|
| 343 |
-
"hasBias": "\"no_bias\" == \"bias\"",
|
| 344 |
-
"HIDDEN_LEN": "hiddenSize / 4"
|
| 345 |
-
},
|
| 346 |
-
"passes": [
|
| 347 |
-
{
|
| 348 |
-
"id": "main",
|
| 349 |
-
"name": "SkipLayerNormalization.Vec4",
|
| 350 |
-
"shader": "norm-skip-row-vec4.wgsl.jinja",
|
| 351 |
-
"derive": {
|
| 352 |
-
"simplified": false,
|
| 353 |
-
"hasBeta": true,
|
| 354 |
-
"writeResidualSum": true,
|
| 355 |
-
"hidden": "hiddenSize",
|
| 356 |
-
"hiddenVec": "hiddenSize / 4",
|
| 357 |
-
"wg": "skipWgVec4",
|
| 358 |
-
"vecType": "\"vec4<f32>\"",
|
| 359 |
-
"useSubgroups": "hasSubgroups"
|
| 360 |
-
},
|
| 361 |
-
"bindings": ["input", "skip", "gamma", "beta", "output", "input_skip_bias_sum", "params_main"],
|
| 362 |
-
"dispatch": { "x": "min(rowCount, 65535)", "y": "ceilDiv(rowCount, 65535)", "z": 1 }
|
| 363 |
-
}
|
| 364 |
-
]
|
| 365 |
-
},
|
| 366 |
-
{
|
| 367 |
-
"id": "beta_no_bias_row",
|
| 368 |
-
"priority": 10,
|
| 369 |
-
"when": ["f32_beta_no_bias_residual_contract", "normResourcesFit", "rowDispatchFits", "not present.meanT and not present.invStdT"],
|
| 370 |
-
"derive": {
|
| 371 |
-
"simplified": false,
|
| 372 |
-
"useSubgroups": "hasSubgroups",
|
| 373 |
-
"hasBeta": true,
|
| 374 |
-
"writeResidualSum": true,
|
| 375 |
-
"hasBias": "\"no_bias\" == \"bias\"",
|
| 376 |
-
"scalar": "\"f32\"",
|
| 377 |
-
"workgroupSize": "skipWg",
|
| 378 |
-
"HIDDEN_LEN": "hiddenSize"
|
| 379 |
-
},
|
| 380 |
-
"passes": [
|
| 381 |
-
{
|
| 382 |
-
"id": "main",
|
| 383 |
-
"name": "SkipLayerNormalization.Row",
|
| 384 |
-
"shader": "norm-skip-row.wgsl.jinja",
|
| 385 |
-
"bindings": ["input_main", "skip_main", "gamma_main", "beta_main", "output_main", "input_skip_bias_sum_main", "params__uniform"],
|
| 386 |
-
"dispatch": {
|
| 387 |
-
"x": "min(ceilDiv((rowCount * (1 if hiddenSize == 1 else skipWg)), (skipWg)), 65535)",
|
| 388 |
-
"y": "ceilDiv(ceilDiv((rowCount * (1 if hiddenSize == 1 else skipWg)), (skipWg)), 65535)",
|
| 389 |
-
"z": 1
|
| 390 |
-
}
|
| 391 |
-
}
|
| 392 |
-
]
|
| 393 |
-
},
|
| 394 |
-
{
|
| 395 |
-
"id": "beta_bias_vec4_f16",
|
| 396 |
-
"priority": 21,
|
| 397 |
-
"when": ["f16_beta_bias_residual_contract", "vec4Aligned", "normResourcesFit", "rowDispatchFits", "not present.meanT and not present.invStdT"],
|
| 398 |
-
"derive": { "vectorScalar": "\"vec4<f16>\"", "HIDDEN_LEN": "hiddenSize / 4" },
|
| 399 |
-
"passes": [
|
| 400 |
-
{
|
| 401 |
-
"id": "main",
|
| 402 |
-
"name": "SkipLayerNormalization.Vec4",
|
| 403 |
-
"shader": "norm-skip-row-vec4.wgsl.jinja",
|
| 404 |
-
"derive": {
|
| 405 |
-
"simplified": false,
|
| 406 |
-
"hasBias": true,
|
| 407 |
-
"hasBeta": true,
|
| 408 |
-
"writeResidualSum": true,
|
| 409 |
-
"hidden": "hiddenSize",
|
| 410 |
-
"hiddenVec": "hiddenSize / 4",
|
| 411 |
-
"wg": "skipWgVec4",
|
| 412 |
-
"vecType": "\"vec4<f16>\"",
|
| 413 |
-
"useSubgroups": "hasSubgroups"
|
| 414 |
-
},
|
| 415 |
-
"bindings": ["input", "skip", "bias", "gamma", "beta", "output", "input_skip_bias_sum", "params_main"],
|
| 416 |
-
"dispatch": { "x": "min(rowCount, 65535)", "y": "ceilDiv(rowCount, 65535)", "z": 1 }
|
| 417 |
-
}
|
| 418 |
-
]
|
| 419 |
-
},
|
| 420 |
-
{
|
| 421 |
-
"id": "no_beta_output_only_vec4",
|
| 422 |
-
"priority": 20,
|
| 423 |
-
"when": ["f32_no_beta_output_contract", "vec4Aligned", "normResourcesFit", "rowDispatchFits", "not present.meanT and not present.invStdT"],
|
| 424 |
-
"derive": { "vectorScalar": "\"vec4<f32>\"", "HIDDEN_LEN": "hiddenSize / 4" },
|
| 425 |
-
"passes": [
|
| 426 |
-
{
|
| 427 |
-
"id": "main",
|
| 428 |
-
"name": "SkipLayerNormalization.NoBetaOutputOnly.Vec4",
|
| 429 |
-
"shader": "norm-skip-row-vec4.wgsl.jinja",
|
| 430 |
-
"derive": {
|
| 431 |
-
"simplified": false,
|
| 432 |
-
"hasBias": "present.biasT",
|
| 433 |
-
"hasBeta": "present.betaT",
|
| 434 |
-
"writeResidualSum": false,
|
| 435 |
-
"hidden": "hiddenSize",
|
| 436 |
-
"hiddenVec": "hiddenSize / 4",
|
| 437 |
-
"wg": "skipWgVec4",
|
| 438 |
-
"vecType": "\"vec4<f32>\"",
|
| 439 |
-
"useSubgroups": "hasSubgroups"
|
| 440 |
-
},
|
| 441 |
-
"bindings": ["input", "skip", "gamma", "output", "params_main"],
|
| 442 |
-
"dispatch": { "x": "min(rowCount, 65535)", "y": "ceilDiv(rowCount, 65535)", "z": 1 }
|
| 443 |
-
}
|
| 444 |
-
]
|
| 445 |
-
},
|
| 446 |
-
{
|
| 447 |
-
"id": "no_beta_output_only_row",
|
| 448 |
-
"priority": 10,
|
| 449 |
-
"when": ["f32_no_beta_output_contract", "normResourcesFit", "rowDispatchFits", "hiddenSize != 1", "not present.meanT and not present.invStdT"],
|
| 450 |
-
"derive": {
|
| 451 |
-
"simplified": false,
|
| 452 |
-
"hasBias": "present.biasT",
|
| 453 |
-
"hasBeta": "present.betaT",
|
| 454 |
-
"writeResidualSum": false,
|
| 455 |
-
"useSubgroups": "hasSubgroups",
|
| 456 |
-
"scalar": "\"f32\"",
|
| 457 |
-
"workgroupSize": "skipWg",
|
| 458 |
-
"HIDDEN_LEN": "hiddenSize"
|
| 459 |
-
},
|
| 460 |
-
"passes": [
|
| 461 |
-
{
|
| 462 |
-
"id": "main",
|
| 463 |
-
"name": "SkipLayerNormalization.NoBetaOutputOnly.Row",
|
| 464 |
-
"shader": "norm-skip-row.wgsl.jinja",
|
| 465 |
-
"bindings": ["input_main", "skip_main", "gamma_main", "output_main", "params__uniform"],
|
| 466 |
-
"dispatch": {
|
| 467 |
-
"x": "min(ceilDiv((rowCount * (1 if hiddenSize == 1 else skipWg)), (skipWg)), 65535)",
|
| 468 |
-
"y": "ceilDiv(ceilDiv((rowCount * (1 if hiddenSize == 1 else skipWg)), (skipWg)), 65535)",
|
| 469 |
-
"z": 1
|
| 470 |
-
}
|
| 471 |
-
}
|
| 472 |
-
]
|
| 473 |
-
},
|
| 474 |
-
{
|
| 475 |
-
"id": "no_beta_output_only_vec4_f16",
|
| 476 |
-
"priority": 20,
|
| 477 |
-
"when": ["f16_no_beta_output_contract", "vec4Aligned", "normResourcesFit", "rowDispatchFits", "not present.meanT and not present.invStdT"],
|
| 478 |
-
"derive": { "vectorScalar": "\"vec4<f16>\"", "HIDDEN_LEN": "hiddenSize / 4" },
|
| 479 |
-
"passes": [
|
| 480 |
-
{
|
| 481 |
-
"id": "main",
|
| 482 |
-
"name": "SkipLayerNormalization.NoBetaOutputOnly.Vec4.F16",
|
| 483 |
-
"shader": "norm-skip-row-vec4.wgsl.jinja",
|
| 484 |
-
"derive": {
|
| 485 |
-
"simplified": false,
|
| 486 |
-
"hasBias": "present.biasT",
|
| 487 |
-
"hasBeta": "present.betaT",
|
| 488 |
-
"writeResidualSum": false,
|
| 489 |
-
"hidden": "hiddenSize",
|
| 490 |
-
"hiddenVec": "hiddenSize / 4",
|
| 491 |
-
"wg": "skipWgVec4",
|
| 492 |
-
"vecType": "\"vec4<f16>\"",
|
| 493 |
-
"useSubgroups": "hasSubgroups"
|
| 494 |
-
},
|
| 495 |
-
"bindings": ["input", "skip", "gamma", "output", "params_main"],
|
| 496 |
-
"dispatch": { "x": "min(rowCount, 65535)", "y": "ceilDiv(rowCount, 65535)", "z": 1 }
|
| 497 |
-
}
|
| 498 |
-
]
|
| 499 |
-
},
|
| 500 |
-
{
|
| 501 |
-
"id": "no_beta_output_only_row_f16",
|
| 502 |
-
"priority": 10,
|
| 503 |
-
"when": ["f16_no_beta_output_contract", "normResourcesFit", "rowDispatchFits", "hiddenSize != 1", "not present.meanT and not present.invStdT"],
|
| 504 |
-
"derive": {
|
| 505 |
-
"simplified": false,
|
| 506 |
-
"hasBias": "present.biasT",
|
| 507 |
-
"hasBeta": "present.betaT",
|
| 508 |
-
"writeResidualSum": false,
|
| 509 |
-
"useSubgroups": "hasSubgroups",
|
| 510 |
-
"scalar": "\"f16\"",
|
| 511 |
-
"workgroupSize": "skipWg",
|
| 512 |
-
"HIDDEN_LEN": "hiddenSize"
|
| 513 |
-
},
|
| 514 |
-
"passes": [
|
| 515 |
-
{
|
| 516 |
-
"id": "main",
|
| 517 |
-
"name": "SkipLayerNormalization.NoBetaOutputOnly.Row.F16",
|
| 518 |
-
"shader": "norm-skip-row.wgsl.jinja",
|
| 519 |
-
"bindings": ["input_main", "skip_main", "gamma_main", "output_main", "params__uniform"],
|
| 520 |
-
"dispatch": {
|
| 521 |
-
"x": "min(ceilDiv((rowCount * (1 if hiddenSize == 1 else skipWg)), (skipWg)), 65535)",
|
| 522 |
-
"y": "ceilDiv(ceilDiv((rowCount * (1 if hiddenSize == 1 else skipWg)), (skipWg)), 65535)",
|
| 523 |
-
"z": 1
|
| 524 |
-
}
|
| 525 |
-
}
|
| 526 |
-
]
|
| 527 |
-
},
|
| 528 |
-
{
|
| 529 |
-
"id": "beta_no_bias_output_only_vec4",
|
| 530 |
-
"priority": 20,
|
| 531 |
-
"when": ["f32_beta_no_bias_output_only_contract", "vec4Aligned", "hasSubgroups or portableWideExecution", "normResourcesFit", "rowDispatchFits", "not present.meanT and not present.invStdT"],
|
| 532 |
-
"derive": { "vectorScalar": "\"vec4<f32>\"", "HIDDEN_LEN": "hiddenSize / 4" },
|
| 533 |
-
"passes": [
|
| 534 |
-
{
|
| 535 |
-
"id": "main",
|
| 536 |
-
"name": "SkipLayerNormalization.Vec4",
|
| 537 |
-
"shader": "norm-skip-row-vec4.wgsl.jinja",
|
| 538 |
-
"derive": {
|
| 539 |
-
"simplified": false,
|
| 540 |
-
"hasBias": "present.biasT",
|
| 541 |
-
"hasBeta": "present.betaT",
|
| 542 |
-
"writeResidualSum": false,
|
| 543 |
-
"hidden": "hiddenSize",
|
| 544 |
-
"hiddenVec": "hiddenSize / 4",
|
| 545 |
-
"wg": "skipWgVec4",
|
| 546 |
-
"vecType": "\"vec4<f32>\"",
|
| 547 |
-
"useSubgroups": "hasSubgroups"
|
| 548 |
-
},
|
| 549 |
-
"bindings": ["input", "skip", "gamma", "beta", "output", "params_main"],
|
| 550 |
-
"dispatch": { "x": "min(rowCount, 65535)", "y": "ceilDiv(rowCount, 65535)", "z": 1 }
|
| 551 |
-
}
|
| 552 |
-
]
|
| 553 |
-
},
|
| 554 |
-
{
|
| 555 |
-
"id": "beta_no_bias_output_only_row",
|
| 556 |
-
"priority": 10,
|
| 557 |
-
"when": ["f32_beta_no_bias_output_only_contract", "normResourcesFit", "rowDispatchFits", "hiddenSize != 1", "not present.meanT and not present.invStdT"],
|
| 558 |
-
"derive": {
|
| 559 |
-
"simplified": false,
|
| 560 |
-
"hasBias": "present.biasT",
|
| 561 |
-
"hasBeta": "present.betaT",
|
| 562 |
-
"writeResidualSum": false,
|
| 563 |
-
"useSubgroups": "hasSubgroups",
|
| 564 |
-
"scalar": "\"f32\"",
|
| 565 |
-
"workgroupSize": "skipWg",
|
| 566 |
-
"HIDDEN_LEN": "hiddenSize"
|
| 567 |
-
},
|
| 568 |
-
"passes": [
|
| 569 |
-
{
|
| 570 |
-
"id": "main",
|
| 571 |
-
"name": "SkipLayerNormalization.Row",
|
| 572 |
-
"shader": "norm-skip-row.wgsl.jinja",
|
| 573 |
-
"bindings": ["input_main", "skip_main", "gamma_main", "beta_main", "output_main", "params__uniform"],
|
| 574 |
-
"dispatch": {
|
| 575 |
-
"x": "min(ceilDiv((rowCount * (1 if hiddenSize == 1 else skipWg)), (skipWg)), 65535)",
|
| 576 |
-
"y": "ceilDiv(ceilDiv((rowCount * (1 if hiddenSize == 1 else skipWg)), (skipWg)), 65535)",
|
| 577 |
-
"z": 1
|
| 578 |
-
}
|
| 579 |
-
}
|
| 580 |
-
]
|
| 581 |
-
},
|
| 582 |
-
{
|
| 583 |
-
"id": "beta_no_bias_output_only_vec4_f16",
|
| 584 |
-
"priority": 20,
|
| 585 |
-
"when": ["f16_beta_no_bias_output_only_contract", "vec4Aligned", "hasSubgroups or portableWideExecution", "normResourcesFit", "rowDispatchFits", "not present.meanT and not present.invStdT"],
|
| 586 |
-
"derive": { "vectorScalar": "\"vec4<f16>\"", "HIDDEN_LEN": "hiddenSize / 4" },
|
| 587 |
-
"passes": [
|
| 588 |
-
{
|
| 589 |
-
"id": "main",
|
| 590 |
-
"name": "SkipLayerNormalization.Vec4.F16",
|
| 591 |
-
"shader": "norm-skip-row-vec4.wgsl.jinja",
|
| 592 |
-
"derive": {
|
| 593 |
-
"simplified": false,
|
| 594 |
-
"hasBias": "present.biasT",
|
| 595 |
-
"hasBeta": "present.betaT",
|
| 596 |
-
"writeResidualSum": false,
|
| 597 |
-
"hidden": "hiddenSize",
|
| 598 |
-
"hiddenVec": "hiddenSize / 4",
|
| 599 |
-
"wg": "skipWgVec4",
|
| 600 |
-
"vecType": "\"vec4<f16>\"",
|
| 601 |
-
"useSubgroups": "hasSubgroups"
|
| 602 |
-
},
|
| 603 |
-
"bindings": ["input", "skip", "gamma", "beta", "output", "params_main"],
|
| 604 |
-
"dispatch": { "x": "min(rowCount, 65535)", "y": "ceilDiv(rowCount, 65535)", "z": 1 }
|
| 605 |
-
}
|
| 606 |
-
]
|
| 607 |
-
},
|
| 608 |
-
{
|
| 609 |
-
"id": "beta_no_bias_output_only_row_f16",
|
| 610 |
-
"priority": 10,
|
| 611 |
-
"when": ["f16_beta_no_bias_output_only_contract", "normResourcesFit", "rowDispatchFits", "hiddenSize != 1", "not present.meanT and not present.invStdT"],
|
| 612 |
-
"derive": {
|
| 613 |
-
"simplified": false,
|
| 614 |
-
"hasBias": "present.biasT",
|
| 615 |
-
"hasBeta": "present.betaT",
|
| 616 |
-
"writeResidualSum": false,
|
| 617 |
-
"useSubgroups": "hasSubgroups",
|
| 618 |
-
"scalar": "\"f16\"",
|
| 619 |
-
"workgroupSize": "skipWg",
|
| 620 |
-
"HIDDEN_LEN": "hiddenSize"
|
| 621 |
-
},
|
| 622 |
-
"passes": [
|
| 623 |
-
{
|
| 624 |
-
"id": "main",
|
| 625 |
-
"name": "SkipLayerNormalization.Row.F16",
|
| 626 |
-
"shader": "norm-skip-row.wgsl.jinja",
|
| 627 |
-
"bindings": ["input_main", "skip_main", "gamma_main", "beta_main", "output_main", "params__uniform"],
|
| 628 |
-
"dispatch": {
|
| 629 |
-
"x": "min(ceilDiv((rowCount * (1 if hiddenSize == 1 else skipWg)), (skipWg)), 65535)",
|
| 630 |
-
"y": "ceilDiv(ceilDiv((rowCount * (1 if hiddenSize == 1 else skipWg)), (skipWg)), 65535)",
|
| 631 |
-
"z": 1
|
| 632 |
-
}
|
| 633 |
-
}
|
| 634 |
-
]
|
| 635 |
-
},
|
| 636 |
-
{
|
| 637 |
-
"id": "beta_bias_output_only_vec4",
|
| 638 |
-
"priority": 20,
|
| 639 |
-
"when": ["f32_beta_bias_output_only_contract", "vec4Aligned", "normResourcesFit", "rowDispatchFits", "not present.meanT and not present.invStdT"],
|
| 640 |
-
"derive": { "vectorScalar": "\"vec4<f32>\"", "HIDDEN_LEN": "hiddenSize / 4" },
|
| 641 |
-
"passes": [
|
| 642 |
-
{
|
| 643 |
-
"id": "main",
|
| 644 |
-
"name": "SkipLayerNormalization.Vec4",
|
| 645 |
-
"shader": "norm-skip-row-vec4.wgsl.jinja",
|
| 646 |
-
"derive": {
|
| 647 |
-
"simplified": false,
|
| 648 |
-
"hasBias": "present.biasT",
|
| 649 |
-
"hasBeta": "present.betaT",
|
| 650 |
-
"writeResidualSum": false,
|
| 651 |
-
"hidden": "hiddenSize",
|
| 652 |
-
"hiddenVec": "hiddenSize / 4",
|
| 653 |
-
"wg": "skipWgVec4",
|
| 654 |
-
"vecType": "\"vec4<f32>\"",
|
| 655 |
-
"useSubgroups": "hasSubgroups"
|
| 656 |
-
},
|
| 657 |
-
"bindings": ["input", "skip", "gamma", "beta", "bias", "output", "params_main"],
|
| 658 |
-
"dispatch": { "x": "min(rowCount, 65535)", "y": "ceilDiv(rowCount, 65535)", "z": 1 }
|
| 659 |
-
}
|
| 660 |
-
]
|
| 661 |
-
},
|
| 662 |
-
{
|
| 663 |
-
"id": "beta_bias_output_only_row",
|
| 664 |
-
"priority": 10,
|
| 665 |
-
"when": ["f32_beta_bias_output_only_contract", "normResourcesFit", "rowDispatchFits", "hiddenSize != 1", "not present.meanT and not present.invStdT"],
|
| 666 |
-
"derive": {
|
| 667 |
-
"simplified": false,
|
| 668 |
-
"hasBias": "present.biasT",
|
| 669 |
-
"hasBeta": "present.betaT",
|
| 670 |
-
"writeResidualSum": false,
|
| 671 |
-
"useSubgroups": "hasSubgroups",
|
| 672 |
-
"scalar": "\"f32\"",
|
| 673 |
-
"workgroupSize": "skipWg",
|
| 674 |
-
"HIDDEN_LEN": "hiddenSize"
|
| 675 |
-
},
|
| 676 |
-
"passes": [
|
| 677 |
-
{
|
| 678 |
-
"id": "main",
|
| 679 |
-
"name": "SkipLayerNormalization.Row",
|
| 680 |
-
"shader": "norm-skip-row.wgsl.jinja",
|
| 681 |
-
"bindings": ["input_main", "skip_main", "bias_main", "gamma_main", "beta_main", "output_main", "params__uniform"],
|
| 682 |
-
"dispatch": {
|
| 683 |
-
"x": "min(ceilDiv((rowCount * (1 if hiddenSize == 1 else skipWg)), (skipWg)), 65535)",
|
| 684 |
-
"y": "ceilDiv(ceilDiv((rowCount * (1 if hiddenSize == 1 else skipWg)), (skipWg)), 65535)",
|
| 685 |
-
"z": 1
|
| 686 |
-
}
|
| 687 |
-
}
|
| 688 |
-
]
|
| 689 |
-
},
|
| 690 |
-
{
|
| 691 |
-
"id": "beta_bias_output_only_vec4_f16",
|
| 692 |
-
"priority": 20,
|
| 693 |
-
"when": ["f16_beta_bias_output_only_contract", "vec4Aligned", "normResourcesFit", "rowDispatchFits", "not present.meanT and not present.invStdT"],
|
| 694 |
-
"derive": { "vectorScalar": "\"vec4<f16>\"", "HIDDEN_LEN": "hiddenSize / 4" },
|
| 695 |
-
"passes": [
|
| 696 |
-
{
|
| 697 |
-
"id": "main",
|
| 698 |
-
"name": "SkipLayerNormalization.Vec4.F16",
|
| 699 |
-
"shader": "norm-skip-row-vec4.wgsl.jinja",
|
| 700 |
-
"derive": {
|
| 701 |
-
"simplified": false,
|
| 702 |
-
"hasBias": "present.biasT",
|
| 703 |
-
"hasBeta": "present.betaT",
|
| 704 |
-
"writeResidualSum": false,
|
| 705 |
-
"hidden": "hiddenSize",
|
| 706 |
-
"hiddenVec": "hiddenSize / 4",
|
| 707 |
-
"wg": "skipWgVec4",
|
| 708 |
-
"vecType": "\"vec4<f16>\"",
|
| 709 |
-
"useSubgroups": "hasSubgroups"
|
| 710 |
-
},
|
| 711 |
-
"bindings": ["input", "skip", "gamma", "beta", "bias", "output", "params_main"],
|
| 712 |
-
"dispatch": { "x": "min(rowCount, 65535)", "y": "ceilDiv(rowCount, 65535)", "z": 1 }
|
| 713 |
-
}
|
| 714 |
-
]
|
| 715 |
-
},
|
| 716 |
-
{
|
| 717 |
-
"id": "beta_bias_output_only_row_f16",
|
| 718 |
-
"priority": 10,
|
| 719 |
-
"when": ["f16_beta_bias_output_only_contract", "normResourcesFit", "rowDispatchFits", "hiddenSize != 1", "not present.meanT and not present.invStdT"],
|
| 720 |
-
"derive": {
|
| 721 |
-
"simplified": false,
|
| 722 |
-
"hasBias": "present.biasT",
|
| 723 |
-
"hasBeta": "present.betaT",
|
| 724 |
-
"writeResidualSum": false,
|
| 725 |
-
"useSubgroups": "hasSubgroups",
|
| 726 |
-
"scalar": "\"f16\"",
|
| 727 |
-
"workgroupSize": "skipWg",
|
| 728 |
-
"HIDDEN_LEN": "hiddenSize"
|
| 729 |
-
},
|
| 730 |
-
"passes": [
|
| 731 |
-
{
|
| 732 |
-
"id": "main",
|
| 733 |
-
"name": "SkipLayerNormalization.Row.F16",
|
| 734 |
-
"shader": "norm-skip-row.wgsl.jinja",
|
| 735 |
-
"bindings": ["input_main", "skip_main", "bias_main", "gamma_main", "beta_main", "output_main", "params__uniform"],
|
| 736 |
-
"dispatch": {
|
| 737 |
-
"x": "min(ceilDiv((rowCount * (1 if hiddenSize == 1 else skipWg)), (skipWg)), 65535)",
|
| 738 |
-
"y": "ceilDiv(ceilDiv((rowCount * (1 if hiddenSize == 1 else skipWg)), (skipWg)), 65535)",
|
| 739 |
-
"z": 1
|
| 740 |
-
}
|
| 741 |
-
}
|
| 742 |
-
]
|
| 743 |
-
},
|
| 744 |
-
{
|
| 745 |
-
"id": "stats_mean_plain",
|
| 746 |
-
"when": ["statsContract", "present.meanT", "not present.invStdT", "not present.biasT", "not present.betaT", "not present.residualT", "normResourcesFit", "rowDispatchFits"],
|
| 747 |
-
"derive": {
|
| 748 |
-
"simplified": false,
|
| 749 |
-
"hasBias": "present.biasT",
|
| 750 |
-
"hasBeta": "present.betaT",
|
| 751 |
-
"writeResidualSum": "present.residualT",
|
| 752 |
-
"writeMean": "present.meanT",
|
| 753 |
-
"writeInvStd": "present.invStdT",
|
| 754 |
-
"scalar": "dtypes.T",
|
| 755 |
-
"useSubgroups": false,
|
| 756 |
-
"workgroupSize": "skipWg",
|
| 757 |
-
"HIDDEN_LEN": "hiddenSize",
|
| 758 |
-
"packedStatistics": false
|
| 759 |
-
},
|
| 760 |
-
"passes": [
|
| 761 |
-
{
|
| 762 |
-
"id": "main",
|
| 763 |
-
"shader": "norm-skip-row.wgsl.jinja",
|
| 764 |
-
"bindings": ["input_main", "skip_main", "gamma_main", "output_main", "mean", "params__uniform"],
|
| 765 |
-
"dispatch": {
|
| 766 |
-
"x": "min(ceilDiv(rowCount, skipWg) if hiddenSize == 1 else rowCount, 65535)",
|
| 767 |
-
"y": "ceilDiv(ceilDiv(rowCount, skipWg) if hiddenSize == 1 else rowCount, 65535)",
|
| 768 |
-
"z": 1
|
| 769 |
-
}
|
| 770 |
-
}
|
| 771 |
-
],
|
| 772 |
-
"intermediates": []
|
| 773 |
-
},
|
| 774 |
-
{
|
| 775 |
-
"id": "stats_mean_residual",
|
| 776 |
-
"when": ["statsContract", "present.meanT", "not present.invStdT", "not present.biasT", "not present.betaT", "present.residualT", "normResourcesFit", "rowDispatchFits"],
|
| 777 |
-
"derive": {
|
| 778 |
-
"simplified": false,
|
| 779 |
-
"hasBias": "present.biasT",
|
| 780 |
-
"hasBeta": "present.betaT",
|
| 781 |
-
"writeResidualSum": "present.residualT",
|
| 782 |
-
"writeMean": "present.meanT",
|
| 783 |
-
"writeInvStd": "present.invStdT",
|
| 784 |
-
"scalar": "dtypes.T",
|
| 785 |
-
"useSubgroups": false,
|
| 786 |
-
"workgroupSize": "skipWg",
|
| 787 |
-
"HIDDEN_LEN": "hiddenSize",
|
| 788 |
-
"packedStatistics": false
|
| 789 |
-
},
|
| 790 |
-
"passes": [
|
| 791 |
-
{
|
| 792 |
-
"id": "main",
|
| 793 |
-
"shader": "norm-skip-row.wgsl.jinja",
|
| 794 |
-
"bindings": ["input_main", "skip_main", "gamma_main", "input_skip_bias_sum_main", "output_main", "mean", "params__uniform"],
|
| 795 |
-
"dispatch": {
|
| 796 |
-
"x": "min(ceilDiv(rowCount, skipWg) if hiddenSize == 1 else rowCount, 65535)",
|
| 797 |
-
"y": "ceilDiv(ceilDiv(rowCount, skipWg) if hiddenSize == 1 else rowCount, 65535)",
|
| 798 |
-
"z": 1
|
| 799 |
-
}
|
| 800 |
-
}
|
| 801 |
-
],
|
| 802 |
-
"intermediates": []
|
| 803 |
-
},
|
| 804 |
-
{
|
| 805 |
-
"id": "stats_mean_beta",
|
| 806 |
-
"when": ["statsContract", "present.meanT", "not present.invStdT", "not present.biasT", "present.betaT", "not present.residualT", "normResourcesFit", "rowDispatchFits"],
|
| 807 |
-
"derive": {
|
| 808 |
-
"simplified": false,
|
| 809 |
-
"hasBias": "present.biasT",
|
| 810 |
-
"hasBeta": "present.betaT",
|
| 811 |
-
"writeResidualSum": "present.residualT",
|
| 812 |
-
"writeMean": "present.meanT",
|
| 813 |
-
"writeInvStd": "present.invStdT",
|
| 814 |
-
"scalar": "dtypes.T",
|
| 815 |
-
"useSubgroups": false,
|
| 816 |
-
"workgroupSize": "skipWg",
|
| 817 |
-
"HIDDEN_LEN": "hiddenSize",
|
| 818 |
-
"packedStatistics": false
|
| 819 |
-
},
|
| 820 |
-
"passes": [
|
| 821 |
-
{
|
| 822 |
-
"id": "main",
|
| 823 |
-
"shader": "norm-skip-row.wgsl.jinja",
|
| 824 |
-
"bindings": ["input_main", "skip_main", "gamma_main", "beta_main", "output_main", "mean", "params__uniform"],
|
| 825 |
-
"dispatch": {
|
| 826 |
-
"x": "min(ceilDiv(rowCount, skipWg) if hiddenSize == 1 else rowCount, 65535)",
|
| 827 |
-
"y": "ceilDiv(ceilDiv(rowCount, skipWg) if hiddenSize == 1 else rowCount, 65535)",
|
| 828 |
-
"z": 1
|
| 829 |
-
}
|
| 830 |
-
}
|
| 831 |
-
],
|
| 832 |
-
"intermediates": []
|
| 833 |
-
},
|
| 834 |
-
{
|
| 835 |
-
"id": "stats_mean_beta_residual",
|
| 836 |
-
"when": ["statsContract", "present.meanT", "not present.invStdT", "not present.biasT", "present.betaT", "present.residualT", "normResourcesFit", "rowDispatchFits"],
|
| 837 |
-
"derive": {
|
| 838 |
-
"simplified": false,
|
| 839 |
-
"hasBias": "present.biasT",
|
| 840 |
-
"hasBeta": "present.betaT",
|
| 841 |
-
"writeResidualSum": "present.residualT",
|
| 842 |
-
"writeMean": "present.meanT",
|
| 843 |
-
"writeInvStd": "present.invStdT",
|
| 844 |
-
"scalar": "dtypes.T",
|
| 845 |
-
"useSubgroups": false,
|
| 846 |
-
"workgroupSize": "skipWg",
|
| 847 |
-
"HIDDEN_LEN": "hiddenSize",
|
| 848 |
-
"packedStatistics": false
|
| 849 |
-
},
|
| 850 |
-
"passes": [
|
| 851 |
-
{
|
| 852 |
-
"id": "main",
|
| 853 |
-
"shader": "norm-skip-row.wgsl.jinja",
|
| 854 |
-
"bindings": ["input_main", "skip_main", "gamma_main", "beta_main", "input_skip_bias_sum_main", "output_main", "mean", "params__uniform"],
|
| 855 |
-
"dispatch": {
|
| 856 |
-
"x": "min(ceilDiv(rowCount, skipWg) if hiddenSize == 1 else rowCount, 65535)",
|
| 857 |
-
"y": "ceilDiv(ceilDiv(rowCount, skipWg) if hiddenSize == 1 else rowCount, 65535)",
|
| 858 |
-
"z": 1
|
| 859 |
-
}
|
| 860 |
-
}
|
| 861 |
-
],
|
| 862 |
-
"intermediates": []
|
| 863 |
-
},
|
| 864 |
-
{
|
| 865 |
-
"id": "stats_mean_bias",
|
| 866 |
-
"when": ["statsContract", "present.meanT", "not present.invStdT", "present.biasT", "not present.betaT", "not present.residualT", "normResourcesFit", "rowDispatchFits"],
|
| 867 |
-
"derive": {
|
| 868 |
-
"simplified": false,
|
| 869 |
-
"hasBias": "present.biasT",
|
| 870 |
-
"hasBeta": "present.betaT",
|
| 871 |
-
"writeResidualSum": "present.residualT",
|
| 872 |
-
"writeMean": "present.meanT",
|
| 873 |
-
"writeInvStd": "present.invStdT",
|
| 874 |
-
"scalar": "dtypes.T",
|
| 875 |
-
"useSubgroups": false,
|
| 876 |
-
"workgroupSize": "skipWg",
|
| 877 |
-
"HIDDEN_LEN": "hiddenSize",
|
| 878 |
-
"packedStatistics": false
|
| 879 |
-
},
|
| 880 |
-
"passes": [
|
| 881 |
-
{
|
| 882 |
-
"id": "main",
|
| 883 |
-
"shader": "norm-skip-row.wgsl.jinja",
|
| 884 |
-
"bindings": ["input_main", "skip_main", "gamma_main", "bias_main", "output_main", "mean", "params__uniform"],
|
| 885 |
-
"dispatch": {
|
| 886 |
-
"x": "min(ceilDiv(rowCount, skipWg) if hiddenSize == 1 else rowCount, 65535)",
|
| 887 |
-
"y": "ceilDiv(ceilDiv(rowCount, skipWg) if hiddenSize == 1 else rowCount, 65535)",
|
| 888 |
-
"z": 1
|
| 889 |
-
}
|
| 890 |
-
}
|
| 891 |
-
],
|
| 892 |
-
"intermediates": []
|
| 893 |
-
},
|
| 894 |
-
{
|
| 895 |
-
"id": "stats_mean_bias_residual",
|
| 896 |
-
"when": ["statsContract", "present.meanT", "not present.invStdT", "present.biasT", "not present.betaT", "present.residualT", "normResourcesFit", "rowDispatchFits"],
|
| 897 |
-
"derive": {
|
| 898 |
-
"simplified": false,
|
| 899 |
-
"hasBias": "present.biasT",
|
| 900 |
-
"hasBeta": "present.betaT",
|
| 901 |
-
"writeResidualSum": "present.residualT",
|
| 902 |
-
"writeMean": "present.meanT",
|
| 903 |
-
"writeInvStd": "present.invStdT",
|
| 904 |
-
"scalar": "dtypes.T",
|
| 905 |
-
"useSubgroups": false,
|
| 906 |
-
"workgroupSize": "skipWg",
|
| 907 |
-
"HIDDEN_LEN": "hiddenSize",
|
| 908 |
-
"packedStatistics": false
|
| 909 |
-
},
|
| 910 |
-
"passes": [
|
| 911 |
-
{
|
| 912 |
-
"id": "main",
|
| 913 |
-
"shader": "norm-skip-row.wgsl.jinja",
|
| 914 |
-
"bindings": ["input_main", "skip_main", "gamma_main", "bias_main", "input_skip_bias_sum_main", "output_main", "mean", "params__uniform"],
|
| 915 |
-
"dispatch": {
|
| 916 |
-
"x": "min(ceilDiv(rowCount, skipWg) if hiddenSize == 1 else rowCount, 65535)",
|
| 917 |
-
"y": "ceilDiv(ceilDiv(rowCount, skipWg) if hiddenSize == 1 else rowCount, 65535)",
|
| 918 |
-
"z": 1
|
| 919 |
-
}
|
| 920 |
-
}
|
| 921 |
-
],
|
| 922 |
-
"intermediates": []
|
| 923 |
-
},
|
| 924 |
-
{
|
| 925 |
-
"id": "stats_mean_bias_beta",
|
| 926 |
-
"when": ["statsContract", "present.meanT", "not present.invStdT", "present.biasT", "present.betaT", "not present.residualT", "normResourcesFit", "rowDispatchFits"],
|
| 927 |
-
"derive": {
|
| 928 |
-
"simplified": false,
|
| 929 |
-
"hasBias": "present.biasT",
|
| 930 |
-
"hasBeta": "present.betaT",
|
| 931 |
-
"writeResidualSum": "present.residualT",
|
| 932 |
-
"writeMean": "present.meanT",
|
| 933 |
-
"writeInvStd": "present.invStdT",
|
| 934 |
-
"scalar": "dtypes.T",
|
| 935 |
-
"useSubgroups": false,
|
| 936 |
-
"workgroupSize": "skipWg",
|
| 937 |
-
"HIDDEN_LEN": "hiddenSize",
|
| 938 |
-
"packedStatistics": false
|
| 939 |
-
},
|
| 940 |
-
"passes": [
|
| 941 |
-
{
|
| 942 |
-
"id": "main",
|
| 943 |
-
"shader": "norm-skip-row.wgsl.jinja",
|
| 944 |
-
"bindings": ["input_main", "skip_main", "gamma_main", "bias_main", "beta_main", "output_main", "mean", "params__uniform"],
|
| 945 |
-
"dispatch": {
|
| 946 |
-
"x": "min(ceilDiv(rowCount, skipWg) if hiddenSize == 1 else rowCount, 65535)",
|
| 947 |
-
"y": "ceilDiv(ceilDiv(rowCount, skipWg) if hiddenSize == 1 else rowCount, 65535)",
|
| 948 |
-
"z": 1
|
| 949 |
-
}
|
| 950 |
-
}
|
| 951 |
-
],
|
| 952 |
-
"intermediates": []
|
| 953 |
-
},
|
| 954 |
-
{
|
| 955 |
-
"id": "stats_mean_bias_beta_residual",
|
| 956 |
-
"when": ["statsContract", "present.meanT", "not present.invStdT", "present.biasT", "present.betaT", "present.residualT", "normResourcesFit", "rowDispatchFits"],
|
| 957 |
-
"derive": {
|
| 958 |
-
"simplified": false,
|
| 959 |
-
"hasBias": "present.biasT",
|
| 960 |
-
"hasBeta": "present.betaT",
|
| 961 |
-
"writeResidualSum": "present.residualT",
|
| 962 |
-
"writeMean": "present.meanT",
|
| 963 |
-
"writeInvStd": "present.invStdT",
|
| 964 |
-
"scalar": "dtypes.T",
|
| 965 |
-
"useSubgroups": false,
|
| 966 |
-
"workgroupSize": "skipWg",
|
| 967 |
-
"HIDDEN_LEN": "hiddenSize",
|
| 968 |
-
"packedStatistics": false
|
| 969 |
-
},
|
| 970 |
-
"passes": [
|
| 971 |
-
{
|
| 972 |
-
"id": "main",
|
| 973 |
-
"shader": "norm-skip-row.wgsl.jinja",
|
| 974 |
-
"bindings": ["input_main", "skip_main", "gamma_main", "bias_main", "beta_main", "input_skip_bias_sum_main", "output_main", "mean", "params__uniform"],
|
| 975 |
-
"dispatch": {
|
| 976 |
-
"x": "min(ceilDiv(rowCount, skipWg) if hiddenSize == 1 else rowCount, 65535)",
|
| 977 |
-
"y": "ceilDiv(ceilDiv(rowCount, skipWg) if hiddenSize == 1 else rowCount, 65535)",
|
| 978 |
-
"z": 1
|
| 979 |
-
}
|
| 980 |
-
}
|
| 981 |
-
],
|
| 982 |
-
"intermediates": []
|
| 983 |
-
},
|
| 984 |
-
{
|
| 985 |
-
"id": "stats_inv_plain",
|
| 986 |
-
"when": ["statsContract", "not present.meanT", "present.invStdT", "not present.biasT", "not present.betaT", "not present.residualT", "normResourcesFit", "rowDispatchFits"],
|
| 987 |
-
"derive": {
|
| 988 |
-
"simplified": false,
|
| 989 |
-
"hasBias": "present.biasT",
|
| 990 |
-
"hasBeta": "present.betaT",
|
| 991 |
-
"writeResidualSum": "present.residualT",
|
| 992 |
-
"writeMean": "present.meanT",
|
| 993 |
-
"writeInvStd": "present.invStdT",
|
| 994 |
-
"scalar": "dtypes.T",
|
| 995 |
-
"useSubgroups": false,
|
| 996 |
-
"workgroupSize": "skipWg",
|
| 997 |
-
"HIDDEN_LEN": "hiddenSize",
|
| 998 |
-
"packedStatistics": false
|
| 999 |
-
},
|
| 1000 |
-
"passes": [
|
| 1001 |
-
{
|
| 1002 |
-
"id": "main",
|
| 1003 |
-
"shader": "norm-skip-row.wgsl.jinja",
|
| 1004 |
-
"bindings": ["input_main", "skip_main", "gamma_main", "output_main", "inv_std_var", "params__uniform"],
|
| 1005 |
-
"dispatch": {
|
| 1006 |
-
"x": "min(ceilDiv(rowCount, skipWg) if hiddenSize == 1 else rowCount, 65535)",
|
| 1007 |
-
"y": "ceilDiv(ceilDiv(rowCount, skipWg) if hiddenSize == 1 else rowCount, 65535)",
|
| 1008 |
-
"z": 1
|
| 1009 |
-
}
|
| 1010 |
-
}
|
| 1011 |
-
],
|
| 1012 |
-
"intermediates": []
|
| 1013 |
-
},
|
| 1014 |
-
{
|
| 1015 |
-
"id": "stats_inv_residual",
|
| 1016 |
-
"when": ["statsContract", "not present.meanT", "present.invStdT", "not present.biasT", "not present.betaT", "present.residualT", "normResourcesFit", "rowDispatchFits"],
|
| 1017 |
-
"derive": {
|
| 1018 |
-
"simplified": false,
|
| 1019 |
-
"hasBias": "present.biasT",
|
| 1020 |
-
"hasBeta": "present.betaT",
|
| 1021 |
-
"writeResidualSum": "present.residualT",
|
| 1022 |
-
"writeMean": "present.meanT",
|
| 1023 |
-
"writeInvStd": "present.invStdT",
|
| 1024 |
-
"scalar": "dtypes.T",
|
| 1025 |
-
"useSubgroups": false,
|
| 1026 |
-
"workgroupSize": "skipWg",
|
| 1027 |
-
"HIDDEN_LEN": "hiddenSize",
|
| 1028 |
-
"packedStatistics": false
|
| 1029 |
-
},
|
| 1030 |
-
"passes": [
|
| 1031 |
-
{
|
| 1032 |
-
"id": "main",
|
| 1033 |
-
"shader": "norm-skip-row.wgsl.jinja",
|
| 1034 |
-
"bindings": ["input_main", "skip_main", "gamma_main", "input_skip_bias_sum_main", "output_main", "inv_std_var", "params__uniform"],
|
| 1035 |
-
"dispatch": {
|
| 1036 |
-
"x": "min(ceilDiv(rowCount, skipWg) if hiddenSize == 1 else rowCount, 65535)",
|
| 1037 |
-
"y": "ceilDiv(ceilDiv(rowCount, skipWg) if hiddenSize == 1 else rowCount, 65535)",
|
| 1038 |
-
"z": 1
|
| 1039 |
-
}
|
| 1040 |
-
}
|
| 1041 |
-
],
|
| 1042 |
-
"intermediates": []
|
| 1043 |
-
},
|
| 1044 |
-
{
|
| 1045 |
-
"id": "stats_inv_beta",
|
| 1046 |
-
"when": ["statsContract", "not present.meanT", "present.invStdT", "not present.biasT", "present.betaT", "not present.residualT", "normResourcesFit", "rowDispatchFits"],
|
| 1047 |
-
"derive": {
|
| 1048 |
-
"simplified": false,
|
| 1049 |
-
"hasBias": "present.biasT",
|
| 1050 |
-
"hasBeta": "present.betaT",
|
| 1051 |
-
"writeResidualSum": "present.residualT",
|
| 1052 |
-
"writeMean": "present.meanT",
|
| 1053 |
-
"writeInvStd": "present.invStdT",
|
| 1054 |
-
"scalar": "dtypes.T",
|
| 1055 |
-
"useSubgroups": false,
|
| 1056 |
-
"workgroupSize": "skipWg",
|
| 1057 |
-
"HIDDEN_LEN": "hiddenSize",
|
| 1058 |
-
"packedStatistics": false
|
| 1059 |
-
},
|
| 1060 |
-
"passes": [
|
| 1061 |
-
{
|
| 1062 |
-
"id": "main",
|
| 1063 |
-
"shader": "norm-skip-row.wgsl.jinja",
|
| 1064 |
-
"bindings": ["input_main", "skip_main", "gamma_main", "beta_main", "output_main", "inv_std_var", "params__uniform"],
|
| 1065 |
-
"dispatch": {
|
| 1066 |
-
"x": "min(ceilDiv(rowCount, skipWg) if hiddenSize == 1 else rowCount, 65535)",
|
| 1067 |
-
"y": "ceilDiv(ceilDiv(rowCount, skipWg) if hiddenSize == 1 else rowCount, 65535)",
|
| 1068 |
-
"z": 1
|
| 1069 |
-
}
|
| 1070 |
-
}
|
| 1071 |
-
],
|
| 1072 |
-
"intermediates": []
|
| 1073 |
-
},
|
| 1074 |
-
{
|
| 1075 |
-
"id": "stats_inv_beta_residual",
|
| 1076 |
-
"when": ["statsContract", "not present.meanT", "present.invStdT", "not present.biasT", "present.betaT", "present.residualT", "normResourcesFit", "rowDispatchFits"],
|
| 1077 |
-
"derive": {
|
| 1078 |
-
"simplified": false,
|
| 1079 |
-
"hasBias": "present.biasT",
|
| 1080 |
-
"hasBeta": "present.betaT",
|
| 1081 |
-
"writeResidualSum": "present.residualT",
|
| 1082 |
-
"writeMean": "present.meanT",
|
| 1083 |
-
"writeInvStd": "present.invStdT",
|
| 1084 |
-
"scalar": "dtypes.T",
|
| 1085 |
-
"useSubgroups": false,
|
| 1086 |
-
"workgroupSize": "skipWg",
|
| 1087 |
-
"HIDDEN_LEN": "hiddenSize",
|
| 1088 |
-
"packedStatistics": false
|
| 1089 |
-
},
|
| 1090 |
-
"passes": [
|
| 1091 |
-
{
|
| 1092 |
-
"id": "main",
|
| 1093 |
-
"shader": "norm-skip-row.wgsl.jinja",
|
| 1094 |
-
"bindings": ["input_main", "skip_main", "gamma_main", "beta_main", "input_skip_bias_sum_main", "output_main", "inv_std_var", "params__uniform"],
|
| 1095 |
-
"dispatch": {
|
| 1096 |
-
"x": "min(ceilDiv(rowCount, skipWg) if hiddenSize == 1 else rowCount, 65535)",
|
| 1097 |
-
"y": "ceilDiv(ceilDiv(rowCount, skipWg) if hiddenSize == 1 else rowCount, 65535)",
|
| 1098 |
-
"z": 1
|
| 1099 |
-
}
|
| 1100 |
-
}
|
| 1101 |
-
],
|
| 1102 |
-
"intermediates": []
|
| 1103 |
-
},
|
| 1104 |
-
{
|
| 1105 |
-
"id": "stats_inv_bias",
|
| 1106 |
-
"when": ["statsContract", "not present.meanT", "present.invStdT", "present.biasT", "not present.betaT", "not present.residualT", "normResourcesFit", "rowDispatchFits"],
|
| 1107 |
-
"derive": {
|
| 1108 |
-
"simplified": false,
|
| 1109 |
-
"hasBias": "present.biasT",
|
| 1110 |
-
"hasBeta": "present.betaT",
|
| 1111 |
-
"writeResidualSum": "present.residualT",
|
| 1112 |
-
"writeMean": "present.meanT",
|
| 1113 |
-
"writeInvStd": "present.invStdT",
|
| 1114 |
-
"scalar": "dtypes.T",
|
| 1115 |
-
"useSubgroups": false,
|
| 1116 |
-
"workgroupSize": "skipWg",
|
| 1117 |
-
"HIDDEN_LEN": "hiddenSize",
|
| 1118 |
-
"packedStatistics": false
|
| 1119 |
-
},
|
| 1120 |
-
"passes": [
|
| 1121 |
-
{
|
| 1122 |
-
"id": "main",
|
| 1123 |
-
"shader": "norm-skip-row.wgsl.jinja",
|
| 1124 |
-
"bindings": ["input_main", "skip_main", "gamma_main", "bias_main", "output_main", "inv_std_var", "params__uniform"],
|
| 1125 |
-
"dispatch": {
|
| 1126 |
-
"x": "min(ceilDiv(rowCount, skipWg) if hiddenSize == 1 else rowCount, 65535)",
|
| 1127 |
-
"y": "ceilDiv(ceilDiv(rowCount, skipWg) if hiddenSize == 1 else rowCount, 65535)",
|
| 1128 |
-
"z": 1
|
| 1129 |
-
}
|
| 1130 |
-
}
|
| 1131 |
-
],
|
| 1132 |
-
"intermediates": []
|
| 1133 |
-
},
|
| 1134 |
-
{
|
| 1135 |
-
"id": "stats_inv_bias_residual",
|
| 1136 |
-
"when": ["statsContract", "not present.meanT", "present.invStdT", "present.biasT", "not present.betaT", "present.residualT", "normResourcesFit", "rowDispatchFits"],
|
| 1137 |
-
"derive": {
|
| 1138 |
-
"simplified": false,
|
| 1139 |
-
"hasBias": "present.biasT",
|
| 1140 |
-
"hasBeta": "present.betaT",
|
| 1141 |
-
"writeResidualSum": "present.residualT",
|
| 1142 |
-
"writeMean": "present.meanT",
|
| 1143 |
-
"writeInvStd": "present.invStdT",
|
| 1144 |
-
"scalar": "dtypes.T",
|
| 1145 |
-
"useSubgroups": false,
|
| 1146 |
-
"workgroupSize": "skipWg",
|
| 1147 |
-
"HIDDEN_LEN": "hiddenSize",
|
| 1148 |
-
"packedStatistics": false
|
| 1149 |
-
},
|
| 1150 |
-
"passes": [
|
| 1151 |
-
{
|
| 1152 |
-
"id": "main",
|
| 1153 |
-
"shader": "norm-skip-row.wgsl.jinja",
|
| 1154 |
-
"bindings": ["input_main", "skip_main", "gamma_main", "bias_main", "input_skip_bias_sum_main", "output_main", "inv_std_var", "params__uniform"],
|
| 1155 |
-
"dispatch": {
|
| 1156 |
-
"x": "min(ceilDiv(rowCount, skipWg) if hiddenSize == 1 else rowCount, 65535)",
|
| 1157 |
-
"y": "ceilDiv(ceilDiv(rowCount, skipWg) if hiddenSize == 1 else rowCount, 65535)",
|
| 1158 |
-
"z": 1
|
| 1159 |
-
}
|
| 1160 |
-
}
|
| 1161 |
-
],
|
| 1162 |
-
"intermediates": []
|
| 1163 |
-
},
|
| 1164 |
-
{
|
| 1165 |
-
"id": "stats_inv_bias_beta",
|
| 1166 |
-
"when": ["statsContract", "not present.meanT", "present.invStdT", "present.biasT", "present.betaT", "not present.residualT", "normResourcesFit", "rowDispatchFits"],
|
| 1167 |
-
"derive": {
|
| 1168 |
-
"simplified": false,
|
| 1169 |
-
"hasBias": "present.biasT",
|
| 1170 |
-
"hasBeta": "present.betaT",
|
| 1171 |
-
"writeResidualSum": "present.residualT",
|
| 1172 |
-
"writeMean": "present.meanT",
|
| 1173 |
-
"writeInvStd": "present.invStdT",
|
| 1174 |
-
"scalar": "dtypes.T",
|
| 1175 |
-
"useSubgroups": false,
|
| 1176 |
-
"workgroupSize": "skipWg",
|
| 1177 |
-
"HIDDEN_LEN": "hiddenSize",
|
| 1178 |
-
"packedStatistics": false
|
| 1179 |
-
},
|
| 1180 |
-
"passes": [
|
| 1181 |
-
{
|
| 1182 |
-
"id": "main",
|
| 1183 |
-
"shader": "norm-skip-row.wgsl.jinja",
|
| 1184 |
-
"bindings": ["input_main", "skip_main", "gamma_main", "bias_main", "beta_main", "output_main", "inv_std_var", "params__uniform"],
|
| 1185 |
-
"dispatch": {
|
| 1186 |
-
"x": "min(ceilDiv(rowCount, skipWg) if hiddenSize == 1 else rowCount, 65535)",
|
| 1187 |
-
"y": "ceilDiv(ceilDiv(rowCount, skipWg) if hiddenSize == 1 else rowCount, 65535)",
|
| 1188 |
-
"z": 1
|
| 1189 |
-
}
|
| 1190 |
-
}
|
| 1191 |
-
],
|
| 1192 |
-
"intermediates": []
|
| 1193 |
-
},
|
| 1194 |
-
{
|
| 1195 |
-
"id": "stats_inv_bias_beta_residual",
|
| 1196 |
-
"when": ["statsContract", "not present.meanT", "present.invStdT", "present.biasT", "present.betaT", "present.residualT", "normResourcesFit", "rowDispatchFits"],
|
| 1197 |
-
"derive": {
|
| 1198 |
-
"simplified": false,
|
| 1199 |
-
"hasBias": "present.biasT",
|
| 1200 |
-
"hasBeta": "present.betaT",
|
| 1201 |
-
"writeResidualSum": "present.residualT",
|
| 1202 |
-
"writeMean": "present.meanT",
|
| 1203 |
-
"writeInvStd": "present.invStdT",
|
| 1204 |
-
"scalar": "dtypes.T",
|
| 1205 |
-
"useSubgroups": false,
|
| 1206 |
-
"workgroupSize": "skipWg",
|
| 1207 |
-
"HIDDEN_LEN": "hiddenSize",
|
| 1208 |
-
"packedStatistics": false
|
| 1209 |
-
},
|
| 1210 |
-
"passes": [
|
| 1211 |
-
{
|
| 1212 |
-
"id": "main",
|
| 1213 |
-
"shader": "norm-skip-row.wgsl.jinja",
|
| 1214 |
-
"bindings": ["input_main", "skip_main", "gamma_main", "bias_main", "beta_main", "input_skip_bias_sum_main", "output_main", "inv_std_var", "params__uniform"],
|
| 1215 |
-
"dispatch": {
|
| 1216 |
-
"x": "min(ceilDiv(rowCount, skipWg) if hiddenSize == 1 else rowCount, 65535)",
|
| 1217 |
-
"y": "ceilDiv(ceilDiv(rowCount, skipWg) if hiddenSize == 1 else rowCount, 65535)",
|
| 1218 |
-
"z": 1
|
| 1219 |
-
}
|
| 1220 |
-
}
|
| 1221 |
-
],
|
| 1222 |
-
"intermediates": []
|
| 1223 |
-
},
|
| 1224 |
-
{
|
| 1225 |
-
"id": "stats_both_plain",
|
| 1226 |
-
"when": ["statsContract", "present.meanT", "present.invStdT", "not present.biasT", "not present.betaT", "not present.residualT", "normResourcesFit", "rowDispatchFits"],
|
| 1227 |
-
"derive": {
|
| 1228 |
-
"simplified": false,
|
| 1229 |
-
"hasBias": "present.biasT",
|
| 1230 |
-
"hasBeta": "present.betaT",
|
| 1231 |
-
"writeResidualSum": "present.residualT",
|
| 1232 |
-
"writeMean": "present.meanT",
|
| 1233 |
-
"writeInvStd": "present.invStdT",
|
| 1234 |
-
"scalar": "dtypes.T",
|
| 1235 |
-
"useSubgroups": false,
|
| 1236 |
-
"workgroupSize": "skipWg",
|
| 1237 |
-
"HIDDEN_LEN": "hiddenSize",
|
| 1238 |
-
"packedStatistics": true
|
| 1239 |
-
},
|
| 1240 |
-
"passes": [
|
| 1241 |
-
{
|
| 1242 |
-
"id": "main",
|
| 1243 |
-
"shader": "norm-skip-row.wgsl.jinja",
|
| 1244 |
-
"bindings": ["input_main", "skip_main", "gamma_main", "output_main", "row_stats", "params__uniform"],
|
| 1245 |
-
"dispatch": {
|
| 1246 |
-
"x": "min(ceilDiv(rowCount, skipWg) if hiddenSize == 1 else rowCount, 65535)",
|
| 1247 |
-
"y": "ceilDiv(ceilDiv(rowCount, skipWg) if hiddenSize == 1 else rowCount, 65535)",
|
| 1248 |
-
"z": 1
|
| 1249 |
-
}
|
| 1250 |
-
},
|
| 1251 |
-
{
|
| 1252 |
-
"id": "statistics",
|
| 1253 |
-
"shader": "norm-stats-copy.wgsl.jinja",
|
| 1254 |
-
"derive": { "workgroupSize": 64 },
|
| 1255 |
-
"bindings": ["row_stats_read", "mean", "inv_std_var", "params_stats"],
|
| 1256 |
-
"dispatch": {
|
| 1257 |
-
"x": "min(ceilDiv((rowCount), (workgroupSize)), 65535)",
|
| 1258 |
-
"y": "ceilDiv(ceilDiv((rowCount), (workgroupSize)), 65535)",
|
| 1259 |
-
"z": 1
|
| 1260 |
-
}
|
| 1261 |
-
}
|
| 1262 |
-
],
|
| 1263 |
-
"intermediates": [{ "id": "rowStats", "dtype": "float32", "shape": "[rowCount, 2]" }]
|
| 1264 |
-
},
|
| 1265 |
-
{
|
| 1266 |
-
"id": "stats_both_residual",
|
| 1267 |
-
"when": ["statsContract", "present.meanT", "present.invStdT", "not present.biasT", "not present.betaT", "present.residualT", "normResourcesFit", "rowDispatchFits"],
|
| 1268 |
-
"derive": {
|
| 1269 |
-
"simplified": false,
|
| 1270 |
-
"hasBias": "present.biasT",
|
| 1271 |
-
"hasBeta": "present.betaT",
|
| 1272 |
-
"writeResidualSum": "present.residualT",
|
| 1273 |
-
"writeMean": "present.meanT",
|
| 1274 |
-
"writeInvStd": "present.invStdT",
|
| 1275 |
-
"scalar": "dtypes.T",
|
| 1276 |
-
"useSubgroups": false,
|
| 1277 |
-
"workgroupSize": "skipWg",
|
| 1278 |
-
"HIDDEN_LEN": "hiddenSize",
|
| 1279 |
-
"packedStatistics": true
|
| 1280 |
-
},
|
| 1281 |
-
"passes": [
|
| 1282 |
-
{
|
| 1283 |
-
"id": "main",
|
| 1284 |
-
"shader": "norm-skip-row.wgsl.jinja",
|
| 1285 |
-
"bindings": ["input_main", "skip_main", "gamma_main", "input_skip_bias_sum_main", "output_main", "row_stats", "params__uniform"],
|
| 1286 |
-
"dispatch": {
|
| 1287 |
-
"x": "min(ceilDiv(rowCount, skipWg) if hiddenSize == 1 else rowCount, 65535)",
|
| 1288 |
-
"y": "ceilDiv(ceilDiv(rowCount, skipWg) if hiddenSize == 1 else rowCount, 65535)",
|
| 1289 |
-
"z": 1
|
| 1290 |
-
}
|
| 1291 |
-
},
|
| 1292 |
-
{
|
| 1293 |
-
"id": "statistics",
|
| 1294 |
-
"shader": "norm-stats-copy.wgsl.jinja",
|
| 1295 |
-
"derive": { "workgroupSize": 64 },
|
| 1296 |
-
"bindings": ["row_stats_read", "mean", "inv_std_var", "params_stats"],
|
| 1297 |
-
"dispatch": {
|
| 1298 |
-
"x": "min(ceilDiv((rowCount), (workgroupSize)), 65535)",
|
| 1299 |
-
"y": "ceilDiv(ceilDiv((rowCount), (workgroupSize)), 65535)",
|
| 1300 |
-
"z": 1
|
| 1301 |
-
}
|
| 1302 |
-
}
|
| 1303 |
-
],
|
| 1304 |
-
"intermediates": [{ "id": "rowStats", "dtype": "float32", "shape": "[rowCount, 2]" }]
|
| 1305 |
-
},
|
| 1306 |
-
{
|
| 1307 |
-
"id": "stats_both_beta",
|
| 1308 |
-
"when": ["statsContract", "present.meanT", "present.invStdT", "not present.biasT", "present.betaT", "not present.residualT", "normResourcesFit", "rowDispatchFits"],
|
| 1309 |
-
"derive": {
|
| 1310 |
-
"simplified": false,
|
| 1311 |
-
"hasBias": "present.biasT",
|
| 1312 |
-
"hasBeta": "present.betaT",
|
| 1313 |
-
"writeResidualSum": "present.residualT",
|
| 1314 |
-
"writeMean": "present.meanT",
|
| 1315 |
-
"writeInvStd": "present.invStdT",
|
| 1316 |
-
"scalar": "dtypes.T",
|
| 1317 |
-
"useSubgroups": false,
|
| 1318 |
-
"workgroupSize": "skipWg",
|
| 1319 |
-
"HIDDEN_LEN": "hiddenSize",
|
| 1320 |
-
"packedStatistics": true
|
| 1321 |
-
},
|
| 1322 |
-
"passes": [
|
| 1323 |
-
{
|
| 1324 |
-
"id": "main",
|
| 1325 |
-
"shader": "norm-skip-row.wgsl.jinja",
|
| 1326 |
-
"bindings": ["input_main", "skip_main", "gamma_main", "beta_main", "output_main", "row_stats", "params__uniform"],
|
| 1327 |
-
"dispatch": {
|
| 1328 |
-
"x": "min(ceilDiv(rowCount, skipWg) if hiddenSize == 1 else rowCount, 65535)",
|
| 1329 |
-
"y": "ceilDiv(ceilDiv(rowCount, skipWg) if hiddenSize == 1 else rowCount, 65535)",
|
| 1330 |
-
"z": 1
|
| 1331 |
-
}
|
| 1332 |
-
},
|
| 1333 |
-
{
|
| 1334 |
-
"id": "statistics",
|
| 1335 |
-
"shader": "norm-stats-copy.wgsl.jinja",
|
| 1336 |
-
"derive": { "workgroupSize": 64 },
|
| 1337 |
-
"bindings": ["row_stats_read", "mean", "inv_std_var", "params_stats"],
|
| 1338 |
-
"dispatch": {
|
| 1339 |
-
"x": "min(ceilDiv((rowCount), (workgroupSize)), 65535)",
|
| 1340 |
-
"y": "ceilDiv(ceilDiv((rowCount), (workgroupSize)), 65535)",
|
| 1341 |
-
"z": 1
|
| 1342 |
-
}
|
| 1343 |
-
}
|
| 1344 |
-
],
|
| 1345 |
-
"intermediates": [{ "id": "rowStats", "dtype": "float32", "shape": "[rowCount, 2]" }]
|
| 1346 |
-
},
|
| 1347 |
-
{
|
| 1348 |
-
"id": "stats_both_beta_residual",
|
| 1349 |
-
"when": ["statsContract", "present.meanT", "present.invStdT", "not present.biasT", "present.betaT", "present.residualT", "normResourcesFit", "rowDispatchFits"],
|
| 1350 |
-
"derive": {
|
| 1351 |
-
"simplified": false,
|
| 1352 |
-
"hasBias": "present.biasT",
|
| 1353 |
-
"hasBeta": "present.betaT",
|
| 1354 |
-
"writeResidualSum": "present.residualT",
|
| 1355 |
-
"writeMean": "present.meanT",
|
| 1356 |
-
"writeInvStd": "present.invStdT",
|
| 1357 |
-
"scalar": "dtypes.T",
|
| 1358 |
-
"useSubgroups": false,
|
| 1359 |
-
"workgroupSize": "skipWg",
|
| 1360 |
-
"HIDDEN_LEN": "hiddenSize",
|
| 1361 |
-
"packedStatistics": true
|
| 1362 |
-
},
|
| 1363 |
-
"passes": [
|
| 1364 |
-
{
|
| 1365 |
-
"id": "main",
|
| 1366 |
-
"shader": "norm-skip-row.wgsl.jinja",
|
| 1367 |
-
"bindings": ["input_main", "skip_main", "gamma_main", "beta_main", "input_skip_bias_sum_main", "output_main", "row_stats", "params__uniform"],
|
| 1368 |
-
"dispatch": {
|
| 1369 |
-
"x": "min(ceilDiv(rowCount, skipWg) if hiddenSize == 1 else rowCount, 65535)",
|
| 1370 |
-
"y": "ceilDiv(ceilDiv(rowCount, skipWg) if hiddenSize == 1 else rowCount, 65535)",
|
| 1371 |
-
"z": 1
|
| 1372 |
-
}
|
| 1373 |
-
},
|
| 1374 |
-
{
|
| 1375 |
-
"id": "statistics",
|
| 1376 |
-
"shader": "norm-stats-copy.wgsl.jinja",
|
| 1377 |
-
"derive": { "workgroupSize": 64 },
|
| 1378 |
-
"bindings": ["row_stats_read", "mean", "inv_std_var", "params_stats"],
|
| 1379 |
-
"dispatch": {
|
| 1380 |
-
"x": "min(ceilDiv((rowCount), (workgroupSize)), 65535)",
|
| 1381 |
-
"y": "ceilDiv(ceilDiv((rowCount), (workgroupSize)), 65535)",
|
| 1382 |
-
"z": 1
|
| 1383 |
-
}
|
| 1384 |
-
}
|
| 1385 |
-
],
|
| 1386 |
-
"intermediates": [{ "id": "rowStats", "dtype": "float32", "shape": "[rowCount, 2]" }]
|
| 1387 |
-
},
|
| 1388 |
-
{
|
| 1389 |
-
"id": "stats_both_bias",
|
| 1390 |
-
"when": ["statsContract", "present.meanT", "present.invStdT", "present.biasT", "not present.betaT", "not present.residualT", "normResourcesFit", "rowDispatchFits"],
|
| 1391 |
-
"derive": {
|
| 1392 |
-
"simplified": false,
|
| 1393 |
-
"hasBias": "present.biasT",
|
| 1394 |
-
"hasBeta": "present.betaT",
|
| 1395 |
-
"writeResidualSum": "present.residualT",
|
| 1396 |
-
"writeMean": "present.meanT",
|
| 1397 |
-
"writeInvStd": "present.invStdT",
|
| 1398 |
-
"scalar": "dtypes.T",
|
| 1399 |
-
"useSubgroups": false,
|
| 1400 |
-
"workgroupSize": "skipWg",
|
| 1401 |
-
"HIDDEN_LEN": "hiddenSize",
|
| 1402 |
-
"packedStatistics": true
|
| 1403 |
-
},
|
| 1404 |
-
"passes": [
|
| 1405 |
-
{
|
| 1406 |
-
"id": "main",
|
| 1407 |
-
"shader": "norm-skip-row.wgsl.jinja",
|
| 1408 |
-
"bindings": ["input_main", "skip_main", "gamma_main", "bias_main", "output_main", "row_stats", "params__uniform"],
|
| 1409 |
-
"dispatch": {
|
| 1410 |
-
"x": "min(ceilDiv(rowCount, skipWg) if hiddenSize == 1 else rowCount, 65535)",
|
| 1411 |
-
"y": "ceilDiv(ceilDiv(rowCount, skipWg) if hiddenSize == 1 else rowCount, 65535)",
|
| 1412 |
-
"z": 1
|
| 1413 |
-
}
|
| 1414 |
-
},
|
| 1415 |
-
{
|
| 1416 |
-
"id": "statistics",
|
| 1417 |
-
"shader": "norm-stats-copy.wgsl.jinja",
|
| 1418 |
-
"derive": { "workgroupSize": 64 },
|
| 1419 |
-
"bindings": ["row_stats_read", "mean", "inv_std_var", "params_stats"],
|
| 1420 |
-
"dispatch": {
|
| 1421 |
-
"x": "min(ceilDiv((rowCount), (workgroupSize)), 65535)",
|
| 1422 |
-
"y": "ceilDiv(ceilDiv((rowCount), (workgroupSize)), 65535)",
|
| 1423 |
-
"z": 1
|
| 1424 |
-
}
|
| 1425 |
-
}
|
| 1426 |
-
],
|
| 1427 |
-
"intermediates": [{ "id": "rowStats", "dtype": "float32", "shape": "[rowCount, 2]" }]
|
| 1428 |
-
},
|
| 1429 |
-
{
|
| 1430 |
-
"id": "stats_both_bias_residual",
|
| 1431 |
-
"when": ["statsContract", "present.meanT", "present.invStdT", "present.biasT", "not present.betaT", "present.residualT", "normResourcesFit", "rowDispatchFits"],
|
| 1432 |
-
"derive": {
|
| 1433 |
-
"simplified": false,
|
| 1434 |
-
"hasBias": "present.biasT",
|
| 1435 |
-
"hasBeta": "present.betaT",
|
| 1436 |
-
"writeResidualSum": "present.residualT",
|
| 1437 |
-
"writeMean": "present.meanT",
|
| 1438 |
-
"writeInvStd": "present.invStdT",
|
| 1439 |
-
"scalar": "dtypes.T",
|
| 1440 |
-
"useSubgroups": false,
|
| 1441 |
-
"workgroupSize": "skipWg",
|
| 1442 |
-
"HIDDEN_LEN": "hiddenSize",
|
| 1443 |
-
"packedStatistics": true
|
| 1444 |
-
},
|
| 1445 |
-
"passes": [
|
| 1446 |
-
{
|
| 1447 |
-
"id": "main",
|
| 1448 |
-
"shader": "norm-skip-row.wgsl.jinja",
|
| 1449 |
-
"bindings": ["input_main", "skip_main", "gamma_main", "bias_main", "input_skip_bias_sum_main", "output_main", "row_stats", "params__uniform"],
|
| 1450 |
-
"dispatch": {
|
| 1451 |
-
"x": "min(ceilDiv(rowCount, skipWg) if hiddenSize == 1 else rowCount, 65535)",
|
| 1452 |
-
"y": "ceilDiv(ceilDiv(rowCount, skipWg) if hiddenSize == 1 else rowCount, 65535)",
|
| 1453 |
-
"z": 1
|
| 1454 |
-
}
|
| 1455 |
-
},
|
| 1456 |
-
{
|
| 1457 |
-
"id": "statistics",
|
| 1458 |
-
"shader": "norm-stats-copy.wgsl.jinja",
|
| 1459 |
-
"derive": { "workgroupSize": 64 },
|
| 1460 |
-
"bindings": ["row_stats_read", "mean", "inv_std_var", "params_stats"],
|
| 1461 |
-
"dispatch": {
|
| 1462 |
-
"x": "min(ceilDiv((rowCount), (workgroupSize)), 65535)",
|
| 1463 |
-
"y": "ceilDiv(ceilDiv((rowCount), (workgroupSize)), 65535)",
|
| 1464 |
-
"z": 1
|
| 1465 |
-
}
|
| 1466 |
-
}
|
| 1467 |
-
],
|
| 1468 |
-
"intermediates": [{ "id": "rowStats", "dtype": "float32", "shape": "[rowCount, 2]" }]
|
| 1469 |
-
},
|
| 1470 |
-
{
|
| 1471 |
-
"id": "stats_both_bias_beta",
|
| 1472 |
-
"when": ["statsContract", "present.meanT", "present.invStdT", "present.biasT", "present.betaT", "not present.residualT", "normResourcesFit", "rowDispatchFits"],
|
| 1473 |
-
"derive": {
|
| 1474 |
-
"simplified": false,
|
| 1475 |
-
"hasBias": "present.biasT",
|
| 1476 |
-
"hasBeta": "present.betaT",
|
| 1477 |
-
"writeResidualSum": "present.residualT",
|
| 1478 |
-
"writeMean": "present.meanT",
|
| 1479 |
-
"writeInvStd": "present.invStdT",
|
| 1480 |
-
"scalar": "dtypes.T",
|
| 1481 |
-
"useSubgroups": false,
|
| 1482 |
-
"workgroupSize": "skipWg",
|
| 1483 |
-
"HIDDEN_LEN": "hiddenSize",
|
| 1484 |
-
"packedStatistics": true
|
| 1485 |
-
},
|
| 1486 |
-
"passes": [
|
| 1487 |
-
{
|
| 1488 |
-
"id": "main",
|
| 1489 |
-
"shader": "norm-skip-row.wgsl.jinja",
|
| 1490 |
-
"bindings": ["input_main", "skip_main", "gamma_main", "bias_main", "beta_main", "output_main", "row_stats", "params__uniform"],
|
| 1491 |
-
"dispatch": {
|
| 1492 |
-
"x": "min(ceilDiv(rowCount, skipWg) if hiddenSize == 1 else rowCount, 65535)",
|
| 1493 |
-
"y": "ceilDiv(ceilDiv(rowCount, skipWg) if hiddenSize == 1 else rowCount, 65535)",
|
| 1494 |
-
"z": 1
|
| 1495 |
-
}
|
| 1496 |
-
},
|
| 1497 |
-
{
|
| 1498 |
-
"id": "statistics",
|
| 1499 |
-
"shader": "norm-stats-copy.wgsl.jinja",
|
| 1500 |
-
"derive": { "workgroupSize": 64 },
|
| 1501 |
-
"bindings": ["row_stats_read", "mean", "inv_std_var", "params_stats"],
|
| 1502 |
-
"dispatch": {
|
| 1503 |
-
"x": "min(ceilDiv((rowCount), (workgroupSize)), 65535)",
|
| 1504 |
-
"y": "ceilDiv(ceilDiv((rowCount), (workgroupSize)), 65535)",
|
| 1505 |
-
"z": 1
|
| 1506 |
-
}
|
| 1507 |
-
}
|
| 1508 |
-
],
|
| 1509 |
-
"intermediates": [{ "id": "rowStats", "dtype": "float32", "shape": "[rowCount, 2]" }]
|
| 1510 |
-
},
|
| 1511 |
-
{
|
| 1512 |
-
"id": "stats_both_bias_beta_residual",
|
| 1513 |
-
"when": ["statsContract", "present.meanT", "present.invStdT", "present.biasT", "present.betaT", "present.residualT", "normResourcesFit", "rowDispatchFits"],
|
| 1514 |
-
"derive": {
|
| 1515 |
-
"simplified": false,
|
| 1516 |
-
"hasBias": "present.biasT",
|
| 1517 |
-
"hasBeta": "present.betaT",
|
| 1518 |
-
"writeResidualSum": "present.residualT",
|
| 1519 |
-
"writeMean": "present.meanT",
|
| 1520 |
-
"writeInvStd": "present.invStdT",
|
| 1521 |
-
"scalar": "dtypes.T",
|
| 1522 |
-
"useSubgroups": false,
|
| 1523 |
-
"workgroupSize": "skipWg",
|
| 1524 |
-
"HIDDEN_LEN": "hiddenSize",
|
| 1525 |
-
"packedStatistics": true
|
| 1526 |
-
},
|
| 1527 |
-
"passes": [
|
| 1528 |
-
{
|
| 1529 |
-
"id": "main",
|
| 1530 |
-
"shader": "norm-skip-row.wgsl.jinja",
|
| 1531 |
-
"bindings": ["input_main", "skip_main", "gamma_main", "bias_main", "beta_main", "input_skip_bias_sum_main", "output_main", "row_stats", "params__uniform"],
|
| 1532 |
-
"dispatch": {
|
| 1533 |
-
"x": "min(ceilDiv(rowCount, skipWg) if hiddenSize == 1 else rowCount, 65535)",
|
| 1534 |
-
"y": "ceilDiv(ceilDiv(rowCount, skipWg) if hiddenSize == 1 else rowCount, 65535)",
|
| 1535 |
-
"z": 1
|
| 1536 |
-
}
|
| 1537 |
-
},
|
| 1538 |
-
{
|
| 1539 |
-
"id": "statistics",
|
| 1540 |
-
"shader": "norm-stats-copy.wgsl.jinja",
|
| 1541 |
-
"derive": { "workgroupSize": 64 },
|
| 1542 |
-
"bindings": ["row_stats_read", "mean", "inv_std_var", "params_stats"],
|
| 1543 |
-
"dispatch": {
|
| 1544 |
-
"x": "min(ceilDiv((rowCount), (workgroupSize)), 65535)",
|
| 1545 |
-
"y": "ceilDiv(ceilDiv((rowCount), (workgroupSize)), 65535)",
|
| 1546 |
-
"z": 1
|
| 1547 |
-
}
|
| 1548 |
-
}
|
| 1549 |
-
],
|
| 1550 |
-
"intermediates": [{ "id": "rowStats", "dtype": "float32", "shape": "[rowCount, 2]" }]
|
| 1551 |
-
}
|
| 1552 |
-
]
|
| 1553 |
-
}
|
|
|
|
| 1 |
+
{"domain":"com.microsoft","name":"SkipLayerNormalization","sinceVersion":1,"inputs":{"inputT":{"onnx":"input","dtype":"T"},"skipT":{"onnx":"skip","dtype":"T"},"gammaT":{"onnx":"gamma","dtype":"T","rank":1},"betaT":{"onnx":"beta","dtype":"T","rank":1,"optional":true},"biasT":{"onnx":"bias","dtype":"T","rank":1,"optional":true}},"outputs":{"outputT":{"onnx":"output","dtype":"T","rank":"ranks.inputT","shape":"shapes.inputT"},"meanT":{"onnx":"mean","dtype":"U","optional":true,"rank":"ranks.inputT","shape":"prefix(shapes.inputT, ranks.inputT - 1) + [1]"},"invStdT":{"onnx":"inv_std_var","dtype":"U","optional":true,"rank":"ranks.inputT","shape":"prefix(shapes.inputT, ranks.inputT - 1) + [1]"},"residualT":{"onnx":"input_skip_bias_sum","dtype":"T","rank":"ranks.inputT","optional":true,"shape":"shapes.inputT"}},"attributes":{"epsilon":{"default":9.999999960041972e-13}},"typeConstraints":{"T":["float32","float16"],"U":["float32"]},"tunables":{"MAX_WORKGROUP_SIZE":{"default":256}},"derive":{"rowCount":"numel(shapes.inputT) / max(1, dim(shapes.inputT, -1))","hiddenSize":"dim(shapes.inputT, -1)","skipWg":"max(1, min(tunables.MAX_WORKGROUP_SIZE, device.limits.maxComputeInvocationsPerWorkgroup, device.limits.maxComputeWorkgroupSizeX)) if hiddenSize == 1 else max(1, min(tunables.MAX_WORKGROUP_SIZE, device.limits.maxComputeInvocationsPerWorkgroup, device.limits.maxComputeWorkgroupSizeX, pow2ceil(hiddenSize)))","skipWgVec4":"max(1, min(tunables.MAX_WORKGROUP_SIZE, device.limits.maxComputeInvocationsPerWorkgroup, device.limits.maxComputeWorkgroupSizeX, pow2ceil(ceilDiv(hiddenSize, 4))))","rowDispatchFits":"rowCount <= min(device.limits.maxComputeWorkgroupsPerDimension, 65535) * min(device.limits.maxComputeWorkgroupsPerDimension, 65535)","normResourcesFit":"skipWg * 8 <= device.limits.maxComputeWorkgroupStorageSize and skipWgVec4 * 8 <= device.limits.maxComputeWorkgroupStorageSize","epsilonOk":"attrs.epsilon >= 0","coreContract":"epsilonOk and (ranks.inputT == 2 or ranks.inputT == 3) and ranks.skipT == ranks.inputT and ranks.gammaT == 1 and ranks.outputT == ranks.inputT and sameShape(shapes.inputT, shapes.skipT) and sameShape(shapes.outputT, shapes.inputT) and dim(shapes.inputT, -1) > 0 and dim(shapes.gammaT, 0) == dim(shapes.inputT, -1)","residualOutputContract":"present.residualT and sameShape(shapes.residualT, shapes.inputT)","outputOnlyContract":"not present.residualT","f32MainDtypes":"tensorDtypes.inputT == \"float32\" and tensorDtypes.skipT == \"float32\" and tensorDtypes.gammaT == \"float32\" and tensorDtypes.outputT == \"float32\"","f16MainDtypes":"tensorDtypes.inputT == \"float16\" and tensorDtypes.skipT == \"float16\" and tensorDtypes.gammaT == \"float16\" and tensorDtypes.outputT == \"float16\"","f32ResidualDtypes":"f32MainDtypes and tensorDtypes.residualT == \"float32\" if present.residualT else false","f16ResidualDtypes":"f16MainDtypes and tensorDtypes.residualT == \"float16\" if present.residualT else false","vec4Aligned":"dim(shapes.inputT, -1) % 4 == 0","hasSubgroups":"device.features.has(\"subgroups\") and device.wgslLanguageFeatures.has(\"subgroup_id\")","hasF16":"device.features.has(\"shader-f16\")","statsRequested":"present.meanT or present.invStdT","portableWideExecution":"not has(device.adapterInfo, \"subgroupMinSize\") or device.adapterInfo.subgroupMinSize >= 32","broadcastRows":"dim(shapes.inputT, 0) * dim(shapes.inputT, 1)","broadcastHiddenSize":"dim(shapes.inputT, 2)","broadcastSkipWgVec4":"max(1, min(tunables.MAX_WORKGROUP_SIZE, device.limits.maxComputeInvocationsPerWorkgroup, device.limits.maxComputeWorkgroupSizeX, pow2ceil(ceilDiv(broadcastHiddenSize, 4))))","broadcastDispatchFits":"broadcastRows <= min(device.limits.maxComputeWorkgroupsPerDimension, 65535) * min(device.limits.maxComputeWorkgroupsPerDimension, 65535)","broadcastResourcesFit":"broadcastSkipWgVec4 * 8 <= device.limits.maxComputeWorkgroupStorageSize","broadcastSkipShapeOk":"(ranks.skipT == 2 and dim(shapes.skipT, 0) == dim(shapes.inputT, 1) and dim(shapes.skipT, 1) == dim(shapes.inputT, 2)) or (ranks.skipT == 3 and ((dim(shapes.skipT, 0) == 1 and dim(shapes.skipT, 1) == dim(shapes.inputT, 1) and dim(shapes.skipT, 2) == dim(shapes.inputT, 2)) or sameShape(shapes.skipT, shapes.inputT)))","broadcastOutputOnlyContract":"false if ranks.inputT != 3 or not present.betaT else (epsilonOk and not present.biasT and not present.residualT and dim(shapes.inputT, 2) % 4 == 0 and broadcastSkipShapeOk and ranks.gammaT == 1 and ranks.betaT == 1 and ranks.outputT == 3 and tensorDtypes.inputT == \"float32\" and tensorDtypes.skipT == \"float32\" and tensorDtypes.gammaT == \"float32\" and tensorDtypes.betaT == \"float32\" and tensorDtypes.outputT == \"float32\" and dim(shapes.inputT, 2) > 0 and dim(shapes.gammaT, 0) == dim(shapes.inputT, 2) and dim(shapes.betaT, 0) == dim(shapes.inputT, 2) and sameShape(shapes.outputT, shapes.inputT))","fusedContract":"coreContract and (f32MainDtypes or (hasF16 and f16MainDtypes)) and (not present.betaT or (ranks.betaT == 1 and dim(shapes.betaT, 0) == hiddenSize and tensorDtypes.betaT == tensorDtypes.inputT)) and (not present.biasT or (present.betaT and ranks.biasT == 1 and dim(shapes.biasT, 0) == hiddenSize and tensorDtypes.biasT == tensorDtypes.inputT)) and (outputOnlyContract or (present.betaT and residualOutputContract and (f32ResidualDtypes or f16ResidualDtypes)))","statsContract":"statsRequested and coreContract and f16Ok(dtypes.T) and (not present.biasT or (ranks.biasT == 1 and dim(shapes.biasT, 0) == hiddenSize)) and (not present.residualT or sameShape(shapes.residualT, shapes.inputT)) and (not present.betaT or (ranks.betaT == 1 and dim(shapes.betaT, 0) == hiddenSize))"},"bindings":{"input":{"arg":"inputT","elementType":"$vectorScalar"},"skip":{"arg":"skipT","elementType":"$vectorScalar"},"gamma":{"arg":"gammaT","elementType":"$vectorScalar","length":"$HIDDEN_LEN"},"beta":{"arg":"betaT","elementType":"$vectorScalar","length":"$HIDDEN_LEN","when":"present.betaT"},"output":{"arg":"outputT","elementType":"$vectorScalar"},"bias_before_gamma":{"arg":"biasT","name":"bias","elementType":"$vectorScalar","length":"$HIDDEN_LEN","when":"present.biasT and present.residualT"},"bias_after_beta":{"arg":"biasT","name":"bias","elementType":"$vectorScalar","length":"$HIDDEN_LEN","when":"present.biasT and not present.residualT"},"input_skip_bias_sum":{"arg":"residualT","elementType":"$vectorScalar","when":"present.residualT"},"params_main":{"name":"params","struct":[{"name":"rows","type":"u32","value":"rowCount"},{"name":"rowStride","type":"u32","value":"max(1, min(rowCount, min(device.limits.maxComputeWorkgroupsPerDimension, 65535)))"},{"name":"epsilon","type":"f32","value":"attrs.epsilon"}]},"input_main":{"arg":"inputT","name":"input","elementType":"$scalar"},"skip_main":{"arg":"skipT","name":"skip","elementType":"$scalar"},"bias_main":{"arg":"biasT","name":"bias","elementType":"$scalar","length":"$HIDDEN_LEN","when":"present.biasT"},"gamma_main":{"arg":"gammaT","name":"gamma","elementType":"$scalar","length":"$HIDDEN_LEN"},"beta_main":{"arg":"betaT","name":"beta","elementType":"$scalar","length":"$HIDDEN_LEN","when":"present.betaT"},"output_main":{"arg":"outputT","name":"output","elementType":"$scalar"},"input_skip_bias_sum_main":{"arg":"residualT","name":"input_skip_bias_sum","elementType":"$scalar","when":"present.residualT"},"params__uniform":{"name":"params","struct":[{"name":"rows","type":"u32","value":"rowCount"},{"name":"epsilon","type":"f32","value":"attrs.epsilon"}]},"mean":{"arg":"meanT","elementType":"f32"},"inv_std_var":{"arg":"invStdT","elementType":"f32"},"mean_main":{"arg":"meanT","name":"mean","elementType":"f32","when":"present.meanT and not present.invStdT"},"inv_std_var_main":{"arg":"invStdT","name":"inv_std_var","elementType":"f32","when":"present.invStdT and not present.meanT"},"row_stats":{"scratch":"rowStats","elementType":"vec2<f32>","when":"present.meanT and present.invStdT"},"row_stats_read":{"scratch":"rowStats","name":"row_stats","buffer":"read-only-storage","elementType":"vec2<f32>"},"params_stats":{"name":"params","struct":[{"name":"rows","type":"u32","value":"rowCount"}]}},"variants":[{"id":"row","priority":10,"when":["fusedContract","f32MainDtypes or not present.residualT","normResourcesFit","rowDispatchFits","not statsRequested"],"derive":{"simplified":false,"useSubgroups":"hasSubgroups","hasBeta":"present.betaT","hasBias":"present.biasT","writeResidualSum":"present.residualT","scalar":"dtypes.T","workgroupSize":"skipWg","HIDDEN_LEN":"hiddenSize"},"passes":[{"id":"main","name":"SkipLayerNormalization.Row","shader":"norm-skip-row.wgsl.jinja","bindings":["input_main","skip_main","bias_main","gamma_main","beta_main","output_main","input_skip_bias_sum_main","params__uniform"],"dispatch":{"x":"min(ceilDiv((rowCount * (1 if hiddenSize == 1 else skipWg)), (skipWg)), 65535)","y":"ceilDiv(ceilDiv((rowCount * (1 if hiddenSize == 1 else skipWg)), (skipWg)), 65535)","z":1}}]},{"id":"beta_output_only_vec4_broadcast","priority":19,"when":["broadcastOutputOnlyContract","broadcastResourcesFit","broadcastDispatchFits","not present.meanT and not present.invStdT"],"derive":{"vectorScalar":"\"vec4<f32>\"","HIDDEN_LEN":"broadcastHiddenSize / 4"},"passes":[{"id":"main","name":"SkipLayerNormalization.BroadcastSkip","shader":"norm-skip-row-vec4.wgsl.jinja","derive":{"simplified":false,"hasBias":false,"hasBeta":true,"writeResidualSum":false,"broadcastSkip":true,"hidden":"broadcastHiddenSize","hiddenVec":"broadcastHiddenSize / 4","wg":"broadcastSkipWgVec4","vecType":"\"vec4<f32>\"","useSubgroups":"hasSubgroups"},"bindings":["input","skip","gamma","beta","output",{"name":"params","struct":[{"name":"rows","type":"u32","value":"dim(shapes.inputT, 0) * dim(shapes.inputT, 1)"},{"name":"rowStride","type":"u32","value":"max(1, min(broadcastRows, min(device.limits.maxComputeWorkgroupsPerDimension, 65535)))"},{"name":"epsilon","type":"f32","value":"attrs.epsilon"},{"name":"skipRows","type":"u32","value":"numel(shapes.skipT) / broadcastHiddenSize"}]}],"dispatch":{"x":"min(broadcastRows, 65535)","y":"ceilDiv(broadcastRows, 65535)","z":1}}]},{"id":"vec4","priority":20,"when":["fusedContract","vec4Aligned","f32MainDtypes or present.biasT or not present.residualT","present.biasT or not present.betaT or hasSubgroups or portableWideExecution","normResourcesFit","rowDispatchFits","not statsRequested"],"derive":{"vectorScalar":"\"vec4<f16>\" if dtypes.T == \"f16\" else \"vec4<f32>\"","HIDDEN_LEN":"hiddenSize / 4"},"passes":[{"id":"main","name":"SkipLayerNormalization.Vec4","shader":"norm-skip-row-vec4.wgsl.jinja","derive":{"simplified":false,"hasBias":"present.biasT","hasBeta":"present.betaT","writeResidualSum":"present.residualT","hidden":"hiddenSize","hiddenVec":"hiddenSize / 4","wg":"skipWgVec4","vecType":"vectorScalar","useSubgroups":"hasSubgroups"},"bindings":["input","skip","bias_before_gamma","gamma","beta","bias_after_beta","output","input_skip_bias_sum","params_main"],"dispatch":{"x":"min(rowCount, 65535)","y":"ceilDiv(rowCount, 65535)","z":1}}]},{"id":"stats","when":["statsContract","normResourcesFit","rowDispatchFits"],"derive":{"simplified":false,"hasBias":"present.biasT","hasBeta":"present.betaT","writeResidualSum":"present.residualT","writeMean":"present.meanT","writeInvStd":"present.invStdT","scalar":"dtypes.T","useSubgroups":false,"workgroupSize":"skipWg","HIDDEN_LEN":"hiddenSize","packedStatistics":"present.meanT and present.invStdT"},"intermediates":[{"id":"rowStats","dtype":"float32","shape":"[rowCount, 2]"}],"passes":[{"id":"main","shader":"norm-skip-row.wgsl.jinja","bindings":["input_main","skip_main","gamma_main","bias_main","beta_main","input_skip_bias_sum_main","output_main","mean_main","inv_std_var_main","row_stats","params__uniform"],"dispatch":{"x":"min(ceilDiv(rowCount, skipWg) if hiddenSize == 1 else rowCount, 65535)","y":"ceilDiv(ceilDiv(rowCount, skipWg) if hiddenSize == 1 else rowCount, 65535)","z":1}},{"repeat":{"index":"statsCopy","count":"1 if present.meanT and present.invStdT else 0"},"passes":[{"id":"statistics","shader":"norm-stats-copy.wgsl.jinja","derive":{"workgroupSize":64},"bindings":["row_stats_read","mean","inv_std_var","params_stats"],"dispatch":{"x":"min(ceilDiv((rowCount), (workgroupSize)), 65535)","y":"ceilDiv(ceilDiv((rowCount), (workgroupSize)), 65535)","z":1}}]}]}]}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
build/webgpu/metadata.json
CHANGED
|
@@ -1,70 +1 @@
|
|
| 1 |
-
{
|
| 2 |
-
"name": "com.microsoft.SkipLayerNormalization",
|
| 3 |
-
"id": "_com_microsoft_skiplayernormalization_webgpu_a30f1f2",
|
| 4 |
-
"version": 1,
|
| 5 |
-
"license": "Apache-2.0",
|
| 6 |
-
"backend": { "type": "webgpu" },
|
| 7 |
-
"digest": {
|
| 8 |
-
"algorithm": "sha256",
|
| 9 |
-
"files": {
|
| 10 |
-
"bench.json": "cVSe9BmYyynkTmGaCfti3+3as2tY8s7SiHcDUGZXadQ=",
|
| 11 |
-
"manifest.json": "eBeukaRPaePto8cDuxf/pVi95UUFHU+jR4Tcc4/FFh4=",
|
| 12 |
-
"norm-skip-row-vec4.wgsl.jinja": "hpoa1+W36ADP2AlqvZAoWFHCZPTBrUIlgVIQXE98oTE=",
|
| 13 |
-
"norm-skip-row.wgsl.jinja": "LOw1CZFwolmaeaXpWSTi8ToiXzTfvJDoaapF2N6a0x4=",
|
| 14 |
-
"norm-stats-copy.wgsl.jinja": "4PNrRNFbMWP9csH7RrxSvJuAGSn5aDfZZPw/IZEVmjU=",
|
| 15 |
-
"test.json": "upshAVlCpYOJn3G1M4TGhznjHzx8ybo8uae8zkB932s="
|
| 16 |
-
}
|
| 17 |
-
},
|
| 18 |
-
"provenance": { "kernel": { "sha": "6fdf6301e2bbcc2f03bf1eaf493b7ad55ef33afc", "dirty": false } },
|
| 19 |
-
"webgpu": {
|
| 20 |
-
"manifestSpec": "2.1",
|
| 21 |
-
"variants": {
|
| 22 |
-
"hidden1_f32_no_beta": ["norm-skip-row.wgsl.jinja"],
|
| 23 |
-
"hidden1_f32_beta": ["norm-skip-row.wgsl.jinja"],
|
| 24 |
-
"hidden1_f16_no_beta": ["norm-skip-row.wgsl.jinja"],
|
| 25 |
-
"hidden1_f16_beta": ["norm-skip-row.wgsl.jinja"],
|
| 26 |
-
"beta_output_only_vec4_broadcast": ["norm-skip-row-vec4.wgsl.jinja"],
|
| 27 |
-
"beta_bias_vec4": ["norm-skip-row-vec4.wgsl.jinja"],
|
| 28 |
-
"beta_bias_row": ["norm-skip-row.wgsl.jinja"],
|
| 29 |
-
"beta_no_bias_vec4": ["norm-skip-row-vec4.wgsl.jinja"],
|
| 30 |
-
"beta_no_bias_row": ["norm-skip-row.wgsl.jinja"],
|
| 31 |
-
"beta_bias_vec4_f16": ["norm-skip-row-vec4.wgsl.jinja"],
|
| 32 |
-
"no_beta_output_only_vec4": ["norm-skip-row-vec4.wgsl.jinja"],
|
| 33 |
-
"no_beta_output_only_row": ["norm-skip-row.wgsl.jinja"],
|
| 34 |
-
"no_beta_output_only_vec4_f16": ["norm-skip-row-vec4.wgsl.jinja"],
|
| 35 |
-
"no_beta_output_only_row_f16": ["norm-skip-row.wgsl.jinja"],
|
| 36 |
-
"beta_no_bias_output_only_vec4": ["norm-skip-row-vec4.wgsl.jinja"],
|
| 37 |
-
"beta_no_bias_output_only_row": ["norm-skip-row.wgsl.jinja"],
|
| 38 |
-
"beta_no_bias_output_only_vec4_f16": ["norm-skip-row-vec4.wgsl.jinja"],
|
| 39 |
-
"beta_no_bias_output_only_row_f16": ["norm-skip-row.wgsl.jinja"],
|
| 40 |
-
"beta_bias_output_only_vec4": ["norm-skip-row-vec4.wgsl.jinja"],
|
| 41 |
-
"beta_bias_output_only_row": ["norm-skip-row.wgsl.jinja"],
|
| 42 |
-
"beta_bias_output_only_vec4_f16": ["norm-skip-row-vec4.wgsl.jinja"],
|
| 43 |
-
"beta_bias_output_only_row_f16": ["norm-skip-row.wgsl.jinja"],
|
| 44 |
-
"stats_mean_plain": ["norm-skip-row.wgsl.jinja"],
|
| 45 |
-
"stats_mean_residual": ["norm-skip-row.wgsl.jinja"],
|
| 46 |
-
"stats_mean_beta": ["norm-skip-row.wgsl.jinja"],
|
| 47 |
-
"stats_mean_beta_residual": ["norm-skip-row.wgsl.jinja"],
|
| 48 |
-
"stats_mean_bias": ["norm-skip-row.wgsl.jinja"],
|
| 49 |
-
"stats_mean_bias_residual": ["norm-skip-row.wgsl.jinja"],
|
| 50 |
-
"stats_mean_bias_beta": ["norm-skip-row.wgsl.jinja"],
|
| 51 |
-
"stats_mean_bias_beta_residual": ["norm-skip-row.wgsl.jinja"],
|
| 52 |
-
"stats_inv_plain": ["norm-skip-row.wgsl.jinja"],
|
| 53 |
-
"stats_inv_residual": ["norm-skip-row.wgsl.jinja"],
|
| 54 |
-
"stats_inv_beta": ["norm-skip-row.wgsl.jinja"],
|
| 55 |
-
"stats_inv_beta_residual": ["norm-skip-row.wgsl.jinja"],
|
| 56 |
-
"stats_inv_bias": ["norm-skip-row.wgsl.jinja"],
|
| 57 |
-
"stats_inv_bias_residual": ["norm-skip-row.wgsl.jinja"],
|
| 58 |
-
"stats_inv_bias_beta": ["norm-skip-row.wgsl.jinja"],
|
| 59 |
-
"stats_inv_bias_beta_residual": ["norm-skip-row.wgsl.jinja"],
|
| 60 |
-
"stats_both_plain": ["norm-skip-row.wgsl.jinja", "norm-stats-copy.wgsl.jinja"],
|
| 61 |
-
"stats_both_residual": ["norm-skip-row.wgsl.jinja", "norm-stats-copy.wgsl.jinja"],
|
| 62 |
-
"stats_both_beta": ["norm-skip-row.wgsl.jinja", "norm-stats-copy.wgsl.jinja"],
|
| 63 |
-
"stats_both_beta_residual": ["norm-skip-row.wgsl.jinja", "norm-stats-copy.wgsl.jinja"],
|
| 64 |
-
"stats_both_bias": ["norm-skip-row.wgsl.jinja", "norm-stats-copy.wgsl.jinja"],
|
| 65 |
-
"stats_both_bias_residual": ["norm-skip-row.wgsl.jinja", "norm-stats-copy.wgsl.jinja"],
|
| 66 |
-
"stats_both_bias_beta": ["norm-skip-row.wgsl.jinja", "norm-stats-copy.wgsl.jinja"],
|
| 67 |
-
"stats_both_bias_beta_residual": ["norm-skip-row.wgsl.jinja", "norm-stats-copy.wgsl.jinja"]
|
| 68 |
-
}
|
| 69 |
-
}
|
| 70 |
-
}
|
|
|
|
| 1 |
+
{"name":"com.microsoft.SkipLayerNormalization","id":"_com_microsoft_skiplayernormalization_webgpu_4e77e0d","version":1,"license":"Apache-2.0","backend":{"type":"webgpu"},"digest":{"algorithm":"sha256","files":{"bench.json":"SWSQFoxcME16BoI46yhBO4WH7c+z3Sgw6IifTc/vS4Y=","manifest.json":"2HMasjYK8IQoX3ktVwQyyUHTGfHyx0IkbhI0iw7P7/Q=","norm-skip-row-vec4.wgsl.jinja":"x2hFBTHo8BUEpvPp24SDSWk2vmM2vKBtPCNDwwPoPJI=","norm-skip-row.wgsl.jinja":"7nDNFUalZu/QwY/29E0y9NlKZnYCJEkI+BAtm/HTzVc=","norm-stats-copy.wgsl.jinja":"Dss4qJTpAPjQtVp3OvI/LEbiAW/QNXb6aUPDp/7s9v8=","test.json":"qlIirchgkSYwzWTqjp2eXOvTyJgnYtMptlBuTkFVePM="}},"provenance":{"kernel":{"sha":"4385228f788ddaa1bd7aec6a80a20f3ddffd8011","dirty":false}},"webgpu":{"manifestSpec":"2.2"}}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
build/webgpu/norm-skip-row-vec4.wgsl.jinja
CHANGED
|
@@ -2,10 +2,12 @@
|
|
| 2 |
{% if op == "max" or op == "min" %}
|
| 3 |
{{ a }}[{{ idx }}] = {{ op }}({{ a }}[{{ idx }}], {{ a }}[{{ idx }} + {{ svar }}]);{% else %}
|
| 4 |
{{ a }}[{{ idx }}] = {{ a }}[{{ idx }}] {{ "*" if op == "prod" else "+" }} {{ a }}[{{ idx }} + {{ svar }}];{% endif %}{% endmacro %}
|
| 5 |
-
{% macro wgsl_tree_fold(arrays, op="add", idx="lid", wg="WORKGROUP_SIZE", svar="stride", typed=false, form="tail",
|
| 6 |
var {{ svar }}{{ ": u32 " if typed else " " }}= {{ wg }} / 2u;
|
| 7 |
loop {
|
| 8 |
-
if ({{ svar }} == 0u) {
|
|
|
|
|
|
|
| 9 |
if ({{ idx }} < {{ svar }}) {
|
| 10 |
{% for a in arrays %}
|
| 11 |
{{ wgsl_tree_fold_stmt(a, op, idx, svar) }}
|
|
@@ -26,26 +28,31 @@ const WG: u32 = {{ wg }}u;
|
|
| 26 |
|
| 27 |
var<workgroup> sg_partials: array<vec2<f32>, WG>;
|
| 28 |
|
| 29 |
-
fn reduce_pair(value: vec2<f32>{% if useSubgroups %},
|
| 30 |
{% if useSubgroups %}
|
| 31 |
let s = vec2<f32>(subgroupAdd(value.x), subgroupAdd(value.y));
|
| 32 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 33 |
return s;
|
| 34 |
}
|
| 35 |
-
if (
|
| 36 |
sg_partials[sg_id] = s;
|
| 37 |
}
|
| 38 |
workgroupBarrier();
|
| 39 |
var total = vec2<f32>(0.0, 0.0);
|
| 40 |
-
for (var i = 0u; i <
|
| 41 |
total = total + sg_partials[i];
|
| 42 |
}
|
| 43 |
return total;
|
| 44 |
{% else %}
|
| 45 |
-
//
|
| 46 |
sg_partials[tid] = value;
|
| 47 |
workgroupBarrier();
|
| 48 |
-
{{ wgsl_tree_fold(["sg_partials"], idx="tid", wg="WG", form="head"
|
| 49 |
return sg_partials[0];
|
| 50 |
{% endif %}
|
| 51 |
}
|
|
@@ -65,9 +72,9 @@ fn residual_value(idx: u32, skip_idx: u32{% if hasBias %}, vi: u32{% endif %}) -
|
|
| 65 |
fn main(
|
| 66 |
@builtin(workgroup_id) wg_id: vec3<u32>,
|
| 67 |
@builtin(local_invocation_id) lid: vec3<u32>{% if useSubgroups %},
|
| 68 |
-
@builtin(subgroup_invocation_id) sg_lane: u32,
|
| 69 |
@builtin(subgroup_id) sg_id: u32,
|
| 70 |
-
@builtin(num_subgroups) num_sg: u32
|
|
|
|
| 71 |
) {
|
| 72 |
let row = wg_id.x + wg_id.y * params.rowStride;
|
| 73 |
if (row >= params.rows) {
|
|
@@ -93,7 +100,7 @@ fn main(
|
|
| 93 |
acc.y = acc.y + dot(d, d);
|
| 94 |
}
|
| 95 |
|
| 96 |
-
let totals = reduce_pair(acc{% if useSubgroups %},
|
| 97 |
let mean_d = totals.x / f32(HIDDEN);
|
| 98 |
let variance = max(totals.y / f32(HIDDEN) - mean_d * mean_d, 0.0);
|
| 99 |
let row_inv = inverseSqrt(variance + params.epsilon);
|
|
|
|
| 2 |
{% if op == "max" or op == "min" %}
|
| 3 |
{{ a }}[{{ idx }}] = {{ op }}({{ a }}[{{ idx }}], {{ a }}[{{ idx }} + {{ svar }}]);{% else %}
|
| 4 |
{{ a }}[{{ idx }}] = {{ a }}[{{ idx }}] {{ "*" if op == "prod" else "+" }} {{ a }}[{{ idx }} + {{ svar }}];{% endif %}{% endmacro %}
|
| 5 |
+
{% macro wgsl_tree_fold(arrays, op="add", idx="lid", wg="WORKGROUP_SIZE", svar="stride", typed=false, form="tail", barrierFirst=false, reuse=false) %}
|
| 6 |
var {{ svar }}{{ ": u32 " if typed else " " }}= {{ wg }} / 2u;
|
| 7 |
loop {
|
| 8 |
+
if ({{ svar }} == 0u) {
|
| 9 |
+
break;
|
| 10 |
+
}
|
| 11 |
if ({{ idx }} < {{ svar }}) {
|
| 12 |
{% for a in arrays %}
|
| 13 |
{{ wgsl_tree_fold_stmt(a, op, idx, svar) }}
|
|
|
|
| 28 |
|
| 29 |
var<workgroup> sg_partials: array<vec2<f32>, WG>;
|
| 30 |
|
| 31 |
+
fn reduce_pair(value: vec2<f32>{% if useSubgroups %}, sg_id: u32, num_sg: u32, sg_size: u32{% else %}, tid: u32{% endif %}) -> vec2<f32> {
|
| 32 |
{% if useSubgroups %}
|
| 33 |
let s = vec2<f32>(subgroupAdd(value.x), subgroupAdd(value.y));
|
| 34 |
+
// Chrome on Qualcomm Adreno reports num_subgroups = 1 for a workgroup that spans several subgroups.
|
| 35 |
+
// The reported subgroup count can be too low. Raise it to the fewest subgroups the workgroup can occupy, so an
|
| 36 |
+
// under-reported count can neither take the one-subgroup return nor cut the fold short; a conformant count
|
| 37 |
+
// always wins.
|
| 38 |
+
let fold_count = max(num_sg, (WG + sg_size - 1u) >> firstTrailingBit(sg_size));
|
| 39 |
+
if (fold_count == 1u) {
|
| 40 |
return s;
|
| 41 |
}
|
| 42 |
+
if (subgroupElect()) {
|
| 43 |
sg_partials[sg_id] = s;
|
| 44 |
}
|
| 45 |
workgroupBarrier();
|
| 46 |
var total = vec2<f32>(0.0, 0.0);
|
| 47 |
+
for (var i = 0u; i < fold_count; i = i + 1u) {
|
| 48 |
total = total + sg_partials[i];
|
| 49 |
}
|
| 50 |
return total;
|
| 51 |
{% else %}
|
| 52 |
+
// Without subgroups: workgroup barrier tree-reduction (WG is a power of two).
|
| 53 |
sg_partials[tid] = value;
|
| 54 |
workgroupBarrier();
|
| 55 |
+
{{ wgsl_tree_fold(["sg_partials"], idx="tid", wg="WG", form="head") }}
|
| 56 |
return sg_partials[0];
|
| 57 |
{% endif %}
|
| 58 |
}
|
|
|
|
| 72 |
fn main(
|
| 73 |
@builtin(workgroup_id) wg_id: vec3<u32>,
|
| 74 |
@builtin(local_invocation_id) lid: vec3<u32>{% if useSubgroups %},
|
|
|
|
| 75 |
@builtin(subgroup_id) sg_id: u32,
|
| 76 |
+
@builtin(num_subgroups) num_sg: u32,
|
| 77 |
+
@builtin(subgroup_size) sg_size: u32{% endif %}
|
| 78 |
) {
|
| 79 |
let row = wg_id.x + wg_id.y * params.rowStride;
|
| 80 |
if (row >= params.rows) {
|
|
|
|
| 100 |
acc.y = acc.y + dot(d, d);
|
| 101 |
}
|
| 102 |
|
| 103 |
+
let totals = reduce_pair(acc{% if useSubgroups %}, sg_id, num_sg, sg_size{% else %}, tid{% endif %});
|
| 104 |
let mean_d = totals.x / f32(HIDDEN);
|
| 105 |
let variance = max(totals.y / f32(HIDDEN) - mean_d * mean_d, 0.0);
|
| 106 |
let row_inv = inverseSqrt(variance + params.epsilon);
|
build/webgpu/norm-skip-row.wgsl.jinja
CHANGED
|
@@ -2,7 +2,7 @@
|
|
| 2 |
{% if op == "max" or op == "min" %}
|
| 3 |
{{ a }}[{{ idx }}] = {{ op }}({{ a }}[{{ idx }}], {{ a }}[{{ idx }} + {{ svar }}]);{% else %}
|
| 4 |
{{ a }}[{{ idx }}] = {{ a }}[{{ idx }}] {{ "*" if op == "prod" else "+" }} {{ a }}[{{ idx }} + {{ svar }}];{% endif %}{% endmacro %}
|
| 5 |
-
{% macro wgsl_tree_fold(arrays, op="add", idx="lid", wg="WORKGROUP_SIZE", svar="stride", typed=false, form="tail",
|
| 6 |
var {{ svar }}{{ ": u32 " if typed else " " }}= {{ wg }} / 2u;
|
| 7 |
loop {
|
| 8 |
if ({{ svar }} == 0u) {
|
|
@@ -24,26 +24,29 @@ enable subgroups;
|
|
| 24 |
{% endif %}
|
| 25 |
{{ env.wgsl.resourceDeclarations }}
|
| 26 |
|
| 27 |
-
{% if not degenerateRow or writeResidualSum or (writeMean is defined and writeMean) %}
|
| 28 |
const HIDDEN: u32 = {{ hiddenSize }}u;
|
| 29 |
-
{% endif %}
|
| 30 |
const WG: u32 = {{ workgroupSize }}u;
|
| 31 |
{% if not degenerateRow %}
|
| 32 |
|
| 33 |
var<workgroup> pair_partial: array<vec2<f32>, WG>;
|
| 34 |
|
| 35 |
{% if useSubgroups %}
|
| 36 |
-
fn reduce_pair(value: vec2<f32>,
|
| 37 |
let s = vec2<f32>(subgroupAdd(value.x), subgroupAdd(value.y));
|
| 38 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 39 |
return s;
|
| 40 |
}
|
| 41 |
-
if (
|
| 42 |
pair_partial[sg_id] = s;
|
| 43 |
}
|
| 44 |
workgroupBarrier();
|
| 45 |
var total = vec2<f32>(0.0, 0.0);
|
| 46 |
-
for (var i = 0u; i <
|
| 47 |
total = total + pair_partial[i];
|
| 48 |
}
|
| 49 |
return total;
|
|
@@ -57,7 +60,6 @@ fn reduce_pair(value: vec2<f32>, tid: u32) -> vec2<f32> {
|
|
| 57 |
}
|
| 58 |
{% endif %}
|
| 59 |
{% endif %}
|
| 60 |
-
{% if not degenerateRow or writeResidualSum or (writeMean is defined and writeMean) %}
|
| 61 |
|
| 62 |
fn residual_value(row: u32, d: u32) -> f32 {
|
| 63 |
let index = row * HIDDEN + d;
|
|
@@ -67,15 +69,14 @@ fn residual_value(row: u32, d: u32) -> f32 {
|
|
| 67 |
{% endif %}
|
| 68 |
return value;
|
| 69 |
}
|
| 70 |
-
{% endif %}
|
| 71 |
|
| 72 |
@compute @workgroup_size(WG, 1, 1)
|
| 73 |
fn main(
|
| 74 |
@builtin({{ "global_invocation_id" if degenerateRow else "workgroup_id" }}) {{ "gid" if degenerateRow else "wg" }}: vec3<u32>{% if not degenerateRow %},
|
| 75 |
@builtin(local_invocation_id) lid: vec3<u32>{% endif %}{% if useSubgroups and not degenerateRow %},
|
| 76 |
-
@builtin(subgroup_invocation_id) sg_lane: u32,
|
| 77 |
@builtin(subgroup_id) sg_id: u32,
|
| 78 |
-
@builtin(num_subgroups) num_sg: u32
|
|
|
|
| 79 |
) {
|
| 80 |
// Fold the row grid across workgroups; independent rows also include the
|
| 81 |
// invocation offset. The bounds guard drops the final dispatch tail.
|
|
@@ -92,24 +93,48 @@ fn main(
|
|
| 92 |
{% endif %}
|
| 93 |
{% if degenerateRow %}
|
| 94 |
|
| 95 |
-
//
|
| 96 |
-
//
|
| 97 |
-
|
| 98 |
-
let
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 99 |
{% if packedStatistics is defined and packedStatistics %}
|
| 100 |
-
row_stats[row] = vec2<f32>(
|
| 101 |
{% elif writeMean is defined and writeMean %}
|
| 102 |
-
mean[row] =
|
| 103 |
{% endif %}
|
| 104 |
{% if writeInvStd is defined and writeInvStd and not (packedStatistics is defined and packedStatistics) %}
|
| 105 |
inv_std_var[row] = row_inv;
|
| 106 |
{% endif %}
|
| 107 |
{% if writeResidualSum %}
|
| 108 |
-
let residual = residual_value(row, 0u);
|
| 109 |
input_skip_bias_sum[row] = {{ scalar }}(residual);
|
| 110 |
{% endif %}
|
| 111 |
-
|
| 112 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 113 |
{% else %}
|
| 114 |
|
| 115 |
// Shifted moments: accumulating (x - x[0], (x - x[0])^2) keeps the sums
|
|
@@ -124,7 +149,7 @@ fn main(
|
|
| 124 |
}
|
| 125 |
|
| 126 |
{% if useSubgroups %}
|
| 127 |
-
let totals = reduce_pair(acc,
|
| 128 |
{% else %}
|
| 129 |
let totals = reduce_pair(acc, tid);
|
| 130 |
{% endif %}
|
|
|
|
| 2 |
{% if op == "max" or op == "min" %}
|
| 3 |
{{ a }}[{{ idx }}] = {{ op }}({{ a }}[{{ idx }}], {{ a }}[{{ idx }} + {{ svar }}]);{% else %}
|
| 4 |
{{ a }}[{{ idx }}] = {{ a }}[{{ idx }}] {{ "*" if op == "prod" else "+" }} {{ a }}[{{ idx }} + {{ svar }}];{% endif %}{% endmacro %}
|
| 5 |
+
{% macro wgsl_tree_fold(arrays, op="add", idx="lid", wg="WORKGROUP_SIZE", svar="stride", typed=false, form="tail", barrierFirst=false, reuse=false) %}
|
| 6 |
var {{ svar }}{{ ": u32 " if typed else " " }}= {{ wg }} / 2u;
|
| 7 |
loop {
|
| 8 |
if ({{ svar }} == 0u) {
|
|
|
|
| 24 |
{% endif %}
|
| 25 |
{{ env.wgsl.resourceDeclarations }}
|
| 26 |
|
|
|
|
| 27 |
const HIDDEN: u32 = {{ hiddenSize }}u;
|
|
|
|
| 28 |
const WG: u32 = {{ workgroupSize }}u;
|
| 29 |
{% if not degenerateRow %}
|
| 30 |
|
| 31 |
var<workgroup> pair_partial: array<vec2<f32>, WG>;
|
| 32 |
|
| 33 |
{% if useSubgroups %}
|
| 34 |
+
fn reduce_pair(value: vec2<f32>, sg_id: u32, num_sg: u32, sg_size: u32) -> vec2<f32> {
|
| 35 |
let s = vec2<f32>(subgroupAdd(value.x), subgroupAdd(value.y));
|
| 36 |
+
// Chrome on Qualcomm Adreno reports num_subgroups = 1 for a workgroup that spans several subgroups.
|
| 37 |
+
// The reported subgroup count can be too low. Raise it to the fewest subgroups the workgroup can occupy, so an
|
| 38 |
+
// under-reported count can neither take the one-subgroup return nor cut the fold short; a conformant count
|
| 39 |
+
// always wins.
|
| 40 |
+
let fold_count = max(num_sg, (WG + sg_size - 1u) >> firstTrailingBit(sg_size));
|
| 41 |
+
if (fold_count == 1u) {
|
| 42 |
return s;
|
| 43 |
}
|
| 44 |
+
if (subgroupElect()) {
|
| 45 |
pair_partial[sg_id] = s;
|
| 46 |
}
|
| 47 |
workgroupBarrier();
|
| 48 |
var total = vec2<f32>(0.0, 0.0);
|
| 49 |
+
for (var i = 0u; i < fold_count; i = i + 1u) {
|
| 50 |
total = total + pair_partial[i];
|
| 51 |
}
|
| 52 |
return total;
|
|
|
|
| 60 |
}
|
| 61 |
{% endif %}
|
| 62 |
{% endif %}
|
|
|
|
| 63 |
|
| 64 |
fn residual_value(row: u32, d: u32) -> f32 {
|
| 65 |
let index = row * HIDDEN + d;
|
|
|
|
| 69 |
{% endif %}
|
| 70 |
return value;
|
| 71 |
}
|
|
|
|
| 72 |
|
| 73 |
@compute @workgroup_size(WG, 1, 1)
|
| 74 |
fn main(
|
| 75 |
@builtin({{ "global_invocation_id" if degenerateRow else "workgroup_id" }}) {{ "gid" if degenerateRow else "wg" }}: vec3<u32>{% if not degenerateRow %},
|
| 76 |
@builtin(local_invocation_id) lid: vec3<u32>{% endif %}{% if useSubgroups and not degenerateRow %},
|
|
|
|
| 77 |
@builtin(subgroup_id) sg_id: u32,
|
| 78 |
+
@builtin(num_subgroups) num_sg: u32,
|
| 79 |
+
@builtin(subgroup_size) sg_size: u32{% endif %}
|
| 80 |
) {
|
| 81 |
// Fold the row grid across workgroups; independent rows also include the
|
| 82 |
// invocation offset. The bounds guard drops the final dispatch tail.
|
|
|
|
| 93 |
{% endif %}
|
| 94 |
{% if degenerateRow %}
|
| 95 |
|
| 96 |
+
// A one-element row has zero variance only when its rounded residual is
|
| 97 |
+
// finite. Classify before using the closed form; invalid rows retain NaN.
|
| 98 |
+
let residual = residual_value(row, 0u);
|
| 99 |
+
let residual_bits = bitcast<u32>(residual);
|
| 100 |
+
let residual_nonfinite = (residual_bits & 0x7f800000u) == 0x7f800000u;
|
| 101 |
+
let epsilon_bits = bitcast<u32>(params.epsilon);
|
| 102 |
+
let epsilon_zero = (epsilon_bits & 0x7fffffffu) == 0u;
|
| 103 |
+
var row_inv = 0.0;
|
| 104 |
+
if (residual_nonfinite) {
|
| 105 |
+
row_inv = bitcast<f32>(residual_bits | 0x7fc00000u);
|
| 106 |
+
} else if (epsilon_zero) {
|
| 107 |
+
row_inv = bitcast<f32>((epsilon_bits & 0x7fffffffu) | 0x7f800000u);
|
| 108 |
+
} else if (epsilon_bits == 0x7f800000u) {
|
| 109 |
+
row_inv = 0.0;
|
| 110 |
+
} else {
|
| 111 |
+
row_inv = inverseSqrt(params.epsilon);
|
| 112 |
+
}
|
| 113 |
{% if packedStatistics is defined and packedStatistics %}
|
| 114 |
+
row_stats[row] = vec2<f32>(residual, row_inv);
|
| 115 |
{% elif writeMean is defined and writeMean %}
|
| 116 |
+
mean[row] = residual;
|
| 117 |
{% endif %}
|
| 118 |
{% if writeInvStd is defined and writeInvStd and not (packedStatistics is defined and packedStatistics) %}
|
| 119 |
inv_std_var[row] = row_inv;
|
| 120 |
{% endif %}
|
| 121 |
{% if writeResidualSum %}
|
|
|
|
| 122 |
input_skip_bias_sum[row] = {{ scalar }}(residual);
|
| 123 |
{% endif %}
|
| 124 |
+
|
| 125 |
+
let gamma_value = f32(gamma[0]);
|
| 126 |
+
let gamma_nonfinite = (bitcast<u32>(gamma_value) & 0x7f800000u) == 0x7f800000u;
|
| 127 |
+
{% if hasBeta %}
|
| 128 |
+
let beta_value = f32(beta[0]);
|
| 129 |
+
let beta_nan = (bitcast<u32>(beta_value) & 0x7fffffffu) > 0x7f800000u;
|
| 130 |
+
{% endif %}
|
| 131 |
+
if (residual_nonfinite || epsilon_zero || gamma_nonfinite{% if hasBeta %} || beta_nan{% endif %}) {
|
| 132 |
+
output[row] = {{ scalar }}(bitcast<f32>(epsilon_bits | 0x7fc00000u));
|
| 133 |
+
return;
|
| 134 |
+
}
|
| 135 |
+
// Finite residual and scale: the output is 0 * inv * gamma, plus beta when
|
| 136 |
+
// present, which keeps an infinite beta and the sign of a zero result.
|
| 137 |
+
output[row] = {{ scalar }}(0.0 * row_inv * gamma_value{% if hasBeta %} + beta_value{% endif %});
|
| 138 |
{% else %}
|
| 139 |
|
| 140 |
// Shifted moments: accumulating (x - x[0], (x - x[0])^2) keeps the sums
|
|
|
|
| 149 |
}
|
| 150 |
|
| 151 |
{% if useSubgroups %}
|
| 152 |
+
let totals = reduce_pair(acc, sg_id, num_sg, sg_size);
|
| 153 |
{% else %}
|
| 154 |
let totals = reduce_pair(acc, tid);
|
| 155 |
{% endif %}
|
build/webgpu/norm-stats-copy.wgsl.jinja
CHANGED
|
@@ -1,14 +1,17 @@
|
|
| 1 |
-
{% macro flat_index_2d(workgroupSize, name="i", bound="params.count"
|
| 2 |
{% set wgTerm = workgroupSize ~ "u" if workgroupSize is number else workgroupSize %}
|
| 3 |
// 2D-folded flat index: gid.y carries the high bits past the dispatch's
|
| 4 |
// per-axis workgroup fold width.
|
| 5 |
let {{ name }} = gid.x + gid.y * {{ DISPATCH_FOLD_WIDTH }}u * {{ wgTerm }};
|
| 6 |
-
if ({{ name }} >= {{ bound }}) {
|
|
|
|
|
|
|
|
|
|
| 7 |
{{ env.wgsl.resourceDeclarations }}
|
| 8 |
// Separate optional outputs keep the reduction within eight storage bindings.
|
| 9 |
@compute @workgroup_size({{ workgroupSize }})
|
| 10 |
fn main(@builtin(global_invocation_id) gid: vec3<u32>) {
|
| 11 |
-
{{ flat_index_2d(workgroupSize, "row", "params.rows"
|
| 12 |
let stats = row_stats[row];
|
| 13 |
mean[row] = stats.x;
|
| 14 |
inv_std_var[row] = stats.y;
|
|
|
|
| 1 |
+
{% macro flat_index_2d(workgroupSize, name="i", bound="params.count") %}
|
| 2 |
{% set wgTerm = workgroupSize ~ "u" if workgroupSize is number else workgroupSize %}
|
| 3 |
// 2D-folded flat index: gid.y carries the high bits past the dispatch's
|
| 4 |
// per-axis workgroup fold width.
|
| 5 |
let {{ name }} = gid.x + gid.y * {{ DISPATCH_FOLD_WIDTH }}u * {{ wgTerm }};
|
| 6 |
+
if ({{ name }} >= {{ bound }}) {
|
| 7 |
+
return;
|
| 8 |
+
}
|
| 9 |
+
{% endmacro %}
|
| 10 |
{{ env.wgsl.resourceDeclarations }}
|
| 11 |
// Separate optional outputs keep the reduction within eight storage bindings.
|
| 12 |
@compute @workgroup_size({{ workgroupSize }})
|
| 13 |
fn main(@builtin(global_invocation_id) gid: vec3<u32>) {
|
| 14 |
+
{{ flat_index_2d(workgroupSize, "row", "params.rows") }}
|
| 15 |
let stats = row_stats[row];
|
| 16 |
mean[row] = stats.x;
|
| 17 |
inv_std_var[row] = stats.y;
|
build/webgpu/test.json
CHANGED
|
@@ -1,8 +1,9 @@
|
|
| 1 |
{
|
| 2 |
"fixtureArrays": {
|
| 3 |
"ort_batch2_bias_flattened_tokens_input_skipT": [0.1, -0.2, 0.3, 1, 0.5, 0.1, 0.4, 1.6, 1.8, -0.3, 0, 1, -0.5, 0.4, 0.8, -0.6],
|
| 4 |
-
"
|
| 5 |
-
"
|
|
|
|
| 6 |
},
|
| 7 |
"cases": [
|
| 8 |
{
|
|
@@ -146,44 +147,126 @@
|
|
| 146 |
"name": "hidden_size_one_bias_path",
|
| 147 |
"attrs": { "epsilon": 0.00001 },
|
| 148 |
"inputs": {
|
| 149 |
-
"inputT": {
|
| 150 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 151 |
"gammaT": { "dtype": "float32", "shape": [1], "data": { "kind": "values", "values": [7.0] } },
|
| 152 |
"betaT": { "dtype": "float32", "shape": [1], "data": { "kind": "values", "values": [-2.0] } },
|
| 153 |
"biasT": { "dtype": "float32", "shape": [1], "data": { "kind": "values", "values": [0.25] } }
|
| 154 |
},
|
| 155 |
"outputs": {
|
| 156 |
-
"outputT": {
|
| 157 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 158 |
}
|
| 159 |
},
|
| 160 |
{
|
| 161 |
"name": "hidden_size_one_bias_output_only",
|
| 162 |
"provenance": {
|
| 163 |
-
"notes": "
|
| 164 |
},
|
| 165 |
"attrs": { "epsilon": 0.00001 },
|
| 166 |
"inputs": {
|
| 167 |
-
"inputT": {
|
| 168 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 169 |
"gammaT": { "dtype": "float32", "shape": [1], "data": { "kind": "values", "values": [7.0] } },
|
| 170 |
"betaT": { "dtype": "float32", "shape": [1], "data": { "kind": "values", "values": [-2.0] } },
|
| 171 |
"biasT": { "dtype": "float32", "shape": [1], "data": { "kind": "values", "values": [0.25] } }
|
| 172 |
},
|
| 173 |
-
"outputs": {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 174 |
},
|
| 175 |
{
|
| 176 |
"name": "hidden_size_one_no_beta_output_only",
|
| 177 |
"provenance": {
|
| 178 |
-
"notes": "
|
| 179 |
},
|
| 180 |
"attrs": { "epsilon": 0.00001 },
|
| 181 |
"inputs": {
|
| 182 |
-
"inputT": {
|
| 183 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 184 |
"gammaT": { "dtype": "float32", "shape": [1], "data": { "kind": "values", "values": [7.0] } }
|
| 185 |
},
|
| 186 |
-
"outputs": {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 187 |
},
|
| 188 |
{
|
| 189 |
"name": "hidden_size_one_bias_rows65535_dispatch_edge",
|
|
@@ -290,10 +373,7 @@
|
|
| 290 |
"inputT": {
|
| 291 |
"dtype": "float32",
|
| 292 |
"shape": [4, 4],
|
| 293 |
-
"data": {
|
| 294 |
-
"kind": "values",
|
| 295 |
-
"values": [0.7, -0.4, -0.2, 1.2, 0.4, 0.3, 0.1, -0.4, 0.7, -0.4, -0.2, 1.2, 0.4, 0.3, 0.1, -0.4]
|
| 296 |
-
}
|
| 297 |
},
|
| 298 |
"skipT": {
|
| 299 |
"dtype": "float32",
|
|
@@ -324,7 +404,7 @@
|
|
| 324 |
"inputT": {
|
| 325 |
"dtype": "float32",
|
| 326 |
"shape": [4, 4],
|
| 327 |
-
"data": { "kind": "
|
| 328 |
},
|
| 329 |
"skipT": {
|
| 330 |
"dtype": "float32",
|
|
@@ -418,7 +498,7 @@
|
|
| 418 |
"inputT": {
|
| 419 |
"dtype": "float32",
|
| 420 |
"shape": [2, 2, 4],
|
| 421 |
-
"data": { "kind": "
|
| 422 |
},
|
| 423 |
"skipT": {
|
| 424 |
"dtype": "float32",
|
|
@@ -445,7 +525,7 @@
|
|
| 445 |
"provenance": {
|
| 446 |
"source": "onnxruntime/test/contrib_ops/skiplayernorm_op_test.cc",
|
| 447 |
"test": "SkipLayerNormTest.SkipLayerNormBatch1_NoBeta",
|
| 448 |
-
"notes": "
|
| 449 |
},
|
| 450 |
"attrs": { "epsilon": 1e-12 },
|
| 451 |
"inputs": {
|
|
@@ -595,9 +675,7 @@
|
|
| 595 |
},
|
| 596 |
{
|
| 597 |
"name": "beta_bias_output_only_hidden6_unaligned_row",
|
| 598 |
-
"provenance": {
|
| 599 |
-
"notes": "Row-kernel arm of beta_bias_output_only: hidden=6 fails vec4Aligned. 6 storage buffers."
|
| 600 |
-
},
|
| 601 |
"attrs": { "epsilon": 0.00001 },
|
| 602 |
"inputs": {
|
| 603 |
"inputT": {
|
|
@@ -639,7 +717,7 @@
|
|
| 639 |
"inputT": {
|
| 640 |
"dtype": "float32",
|
| 641 |
"shape": [2, 2, 4],
|
| 642 |
-
"data": { "kind": "
|
| 643 |
},
|
| 644 |
"skipT": {
|
| 645 |
"dtype": "float32",
|
|
@@ -699,9 +777,7 @@
|
|
| 699 |
},
|
| 700 |
{
|
| 701 |
"name": "f32_hidden768_no_bias_residual",
|
| 702 |
-
"provenance": {
|
| 703 |
-
"notes": "A compact hidden-size-768 residual normalization exercises the subgroup route and its reduced-tier fallback without bias."
|
| 704 |
-
},
|
| 705 |
"attrs": { "epsilon": 0.00001 },
|
| 706 |
"inputs": {
|
| 707 |
"inputT": {
|
|
@@ -768,7 +844,7 @@
|
|
| 768 |
{
|
| 769 |
"name": "f32_hidden1025_bias_residual",
|
| 770 |
"provenance": {
|
| 771 |
-
"notes": "A
|
| 772 |
},
|
| 773 |
"attrs": { "epsilon": 0.00001 },
|
| 774 |
"inputs": {
|
|
@@ -934,9 +1010,7 @@
|
|
| 934 |
},
|
| 935 |
{
|
| 936 |
"name": "rank3_no_bias_residual",
|
| 937 |
-
"provenance": {
|
| 938 |
-
"notes": "Rank-3 activation shape carrying the residual output, the form ONNX Runtime's transformer fusion emits when the pre-normalization sum feeds the next block."
|
| 939 |
-
},
|
| 940 |
"attrs": { "epsilon": 0.00001 },
|
| 941 |
"inputs": {
|
| 942 |
"inputT": {
|
|
@@ -968,7 +1042,7 @@
|
|
| 968 |
{
|
| 969 |
"name": "rank3_beta_no_bias_output_only_hidden6_unaligned_row",
|
| 970 |
"provenance": {
|
| 971 |
-
"notes": "Rank-3
|
| 972 |
},
|
| 973 |
"attrs": { "epsilon": 0.00001 },
|
| 974 |
"inputs": {
|
|
@@ -1033,7 +1107,7 @@
|
|
| 1033 |
},
|
| 1034 |
{
|
| 1035 |
"name": "f16_beta_bias_output_only_hidden6_unaligned_row",
|
| 1036 |
-
"provenance": { "notes": "
|
| 1037 |
"requires": { "features": ["shader-f16"] },
|
| 1038 |
"attrs": { "epsilon": 0.00001 },
|
| 1039 |
"inputs": {
|
|
@@ -1149,9 +1223,7 @@
|
|
| 1149 |
},
|
| 1150 |
{
|
| 1151 |
"name": "f16_no_beta_output_only",
|
| 1152 |
-
"provenance": {
|
| 1153 |
-
"notes": "Half precision with neither beta nor bias at an aligned hidden size, which is the vec4 arm of that pair."
|
| 1154 |
-
},
|
| 1155 |
"requires": { "features": ["shader-f16"] },
|
| 1156 |
"attrs": { "epsilon": 0.00001 },
|
| 1157 |
"inputs": {
|
|
@@ -1176,7 +1248,7 @@
|
|
| 1176 |
{
|
| 1177 |
"name": "independent_rows_float32_257x1_option0_wgdefault_epsilon0.00001",
|
| 1178 |
"provenance": {
|
| 1179 |
-
"notes": "
|
| 1180 |
},
|
| 1181 |
"attrs": { "epsilon": 0.00001 },
|
| 1182 |
"inputs": {
|
|
@@ -1189,7 +1261,7 @@
|
|
| 1189 |
{
|
| 1190 |
"name": "independent_rows_float32_257x1_option1_wgdefault_epsilon0.00001",
|
| 1191 |
"provenance": {
|
| 1192 |
-
"notes": "
|
| 1193 |
},
|
| 1194 |
"attrs": { "epsilon": 0.00001 },
|
| 1195 |
"inputs": {
|
|
@@ -1203,7 +1275,7 @@
|
|
| 1203 |
{
|
| 1204 |
"name": "independent_rows_float32_257x1_option2_wgdefault_epsilon0.00001",
|
| 1205 |
"provenance": {
|
| 1206 |
-
"notes": "
|
| 1207 |
},
|
| 1208 |
"attrs": { "epsilon": 0.00001 },
|
| 1209 |
"inputs": {
|
|
@@ -1218,7 +1290,7 @@
|
|
| 1218 |
{
|
| 1219 |
"name": "independent_rows_float32_3x31x1_option2_wg1_epsilon0.00001",
|
| 1220 |
"provenance": {
|
| 1221 |
-
"notes": "
|
| 1222 |
},
|
| 1223 |
"attrs": { "epsilon": 0.00001 },
|
| 1224 |
"tunables": { "MAX_WORKGROUP_SIZE": 1 },
|
|
@@ -1234,7 +1306,7 @@
|
|
| 1234 |
{
|
| 1235 |
"name": "independent_rows_float32_3x31x1_option2_wg8_epsilon0.00001",
|
| 1236 |
"provenance": {
|
| 1237 |
-
"notes": "
|
| 1238 |
},
|
| 1239 |
"attrs": { "epsilon": 0.00001 },
|
| 1240 |
"tunables": { "MAX_WORKGROUP_SIZE": 8 },
|
|
@@ -1250,7 +1322,7 @@
|
|
| 1250 |
{
|
| 1251 |
"name": "independent_rows_float32_3x31x1_option2_wg64_epsilon0.00001",
|
| 1252 |
"provenance": {
|
| 1253 |
-
"notes": "
|
| 1254 |
},
|
| 1255 |
"attrs": { "epsilon": 0.00001 },
|
| 1256 |
"tunables": { "MAX_WORKGROUP_SIZE": 64 },
|
|
@@ -1266,7 +1338,7 @@
|
|
| 1266 |
{
|
| 1267 |
"name": "independent_rows_float32_3x31x1_option2_wg128_epsilon0.00001",
|
| 1268 |
"provenance": {
|
| 1269 |
-
"notes": "
|
| 1270 |
},
|
| 1271 |
"attrs": { "epsilon": 0.00001 },
|
| 1272 |
"tunables": { "MAX_WORKGROUP_SIZE": 128 },
|
|
@@ -1282,7 +1354,7 @@
|
|
| 1282 |
{
|
| 1283 |
"name": "independent_rows_float32_524289x1_option3_wg8_epsilon0.00001",
|
| 1284 |
"provenance": {
|
| 1285 |
-
"notes": "
|
| 1286 |
},
|
| 1287 |
"attrs": { "epsilon": 0.00001 },
|
| 1288 |
"tunables": { "MAX_WORKGROUP_SIZE": 8 },
|
|
@@ -1301,7 +1373,7 @@
|
|
| 1301 |
{
|
| 1302 |
"name": "independent_rows_float32_257x1_option2_wgdefault_epsilon0",
|
| 1303 |
"provenance": {
|
| 1304 |
-
"notes": "
|
| 1305 |
},
|
| 1306 |
"attrs": { "epsilon": 0 },
|
| 1307 |
"inputs": {
|
|
@@ -1316,7 +1388,7 @@
|
|
| 1316 |
{
|
| 1317 |
"name": "independent_rows_float16_257x1_option0_wgdefault_epsilon0.00001",
|
| 1318 |
"provenance": {
|
| 1319 |
-
"notes": "
|
| 1320 |
},
|
| 1321 |
"attrs": { "epsilon": 0.00001 },
|
| 1322 |
"inputs": {
|
|
@@ -1329,7 +1401,7 @@
|
|
| 1329 |
{
|
| 1330 |
"name": "independent_rows_float16_257x1_option1_wgdefault_epsilon0.00001",
|
| 1331 |
"provenance": {
|
| 1332 |
-
"notes": "
|
| 1333 |
},
|
| 1334 |
"attrs": { "epsilon": 0.00001 },
|
| 1335 |
"inputs": {
|
|
@@ -1343,7 +1415,7 @@
|
|
| 1343 |
{
|
| 1344 |
"name": "independent_rows_float16_257x1_option2_wgdefault_epsilon0.00001",
|
| 1345 |
"provenance": {
|
| 1346 |
-
"notes": "
|
| 1347 |
},
|
| 1348 |
"attrs": { "epsilon": 0.00001 },
|
| 1349 |
"inputs": {
|
|
@@ -1358,7 +1430,7 @@
|
|
| 1358 |
{
|
| 1359 |
"name": "independent_rows_float16_3x31x1_option2_wg1_epsilon0.00001",
|
| 1360 |
"provenance": {
|
| 1361 |
-
"notes": "
|
| 1362 |
},
|
| 1363 |
"attrs": { "epsilon": 0.00001 },
|
| 1364 |
"tunables": { "MAX_WORKGROUP_SIZE": 1 },
|
|
@@ -1374,7 +1446,7 @@
|
|
| 1374 |
{
|
| 1375 |
"name": "independent_rows_float16_3x31x1_option2_wg8_epsilon0.00001",
|
| 1376 |
"provenance": {
|
| 1377 |
-
"notes": "
|
| 1378 |
},
|
| 1379 |
"attrs": { "epsilon": 0.00001 },
|
| 1380 |
"tunables": { "MAX_WORKGROUP_SIZE": 8 },
|
|
@@ -1390,7 +1462,7 @@
|
|
| 1390 |
{
|
| 1391 |
"name": "independent_rows_float16_3x31x1_option2_wg64_epsilon0.00001",
|
| 1392 |
"provenance": {
|
| 1393 |
-
"notes": "
|
| 1394 |
},
|
| 1395 |
"attrs": { "epsilon": 0.00001 },
|
| 1396 |
"tunables": { "MAX_WORKGROUP_SIZE": 64 },
|
|
@@ -1406,7 +1478,7 @@
|
|
| 1406 |
{
|
| 1407 |
"name": "independent_rows_float16_3x31x1_option2_wg128_epsilon0.00001",
|
| 1408 |
"provenance": {
|
| 1409 |
-
"notes": "
|
| 1410 |
},
|
| 1411 |
"attrs": { "epsilon": 0.00001 },
|
| 1412 |
"tunables": { "MAX_WORKGROUP_SIZE": 128 },
|
|
@@ -1422,7 +1494,7 @@
|
|
| 1422 |
{
|
| 1423 |
"name": "independent_rows_float16_524289x1_option2_wg8_epsilon0.00001",
|
| 1424 |
"provenance": {
|
| 1425 |
-
"notes": "
|
| 1426 |
},
|
| 1427 |
"attrs": { "epsilon": 0.00001 },
|
| 1428 |
"tunables": { "MAX_WORKGROUP_SIZE": 8 },
|
|
@@ -1438,7 +1510,7 @@
|
|
| 1438 |
{
|
| 1439 |
"name": "independent_rows_float16_257x1_option2_wgdefault_epsilon0",
|
| 1440 |
"provenance": {
|
| 1441 |
-
"notes": "
|
| 1442 |
},
|
| 1443 |
"attrs": { "epsilon": 0 },
|
| 1444 |
"inputs": {
|
|
@@ -1453,7 +1525,7 @@
|
|
| 1453 |
{
|
| 1454 |
"name": "independent_rows_float32_257x1_option3_wgdefault_epsilon0.00001",
|
| 1455 |
"provenance": {
|
| 1456 |
-
"notes": "
|
| 1457 |
},
|
| 1458 |
"attrs": { "epsilon": 0.00001 },
|
| 1459 |
"inputs": {
|
|
|
|
| 1 |
{
|
| 2 |
"fixtureArrays": {
|
| 3 |
"ort_batch2_bias_flattened_tokens_input_skipT": [0.1, -0.2, 0.3, 1, 0.5, 0.1, 0.4, 1.6, 1.8, -0.3, 0, 1, -0.5, 0.4, 0.8, -0.6],
|
| 4 |
+
"ort_batch2_skip_broadcast_no_batch_size_output_outputT": [0.2843385934829712, -0.17090578377246857, -0.9289716482162476, 4.692415237426758, 0.4611165225505829, -0.21333980560302734, -0.29631003737449646, 3.5148544311523438, 0.2843385934829712, -0.17090578377246857, -0.9289716482162476, 4.692415237426758, 0.4611165225505829, -0.21333980560302734, -0.29631003737449646, 3.5148544311523438],
|
| 5 |
+
"hidden_size_one_bias_output_only_input_inputT": [2, "Infinity", "-Infinity", "NaN", 1, 1, 1, 3.4028234663852886e+38, 2, -4, 0.5, 1.25, -2, 4, -0.5, 0, 3],
|
| 6 |
+
"hidden_size_one_bias_output_only_input_skipT": [3, 0, 0, 0, "Infinity", "-Infinity", "NaN", 3.4028234663852886e+38, 3, 1, -0.5, 0.5, 1, -2, 2, 0, -1]
|
| 7 |
},
|
| 8 |
"cases": [
|
| 9 |
{
|
|
|
|
| 147 |
"name": "hidden_size_one_bias_path",
|
| 148 |
"attrs": { "epsilon": 0.00001 },
|
| 149 |
"inputs": {
|
| 150 |
+
"inputT": {
|
| 151 |
+
"dtype": "float32",
|
| 152 |
+
"shape": [10, 1],
|
| 153 |
+
"data": {
|
| 154 |
+
"kind": "values",
|
| 155 |
+
"values": [2.0, -4.0, 0.5, "Infinity", "-Infinity", "NaN", 1.0, 1.0, 1.0, 3.4028234663852886e+38]
|
| 156 |
+
}
|
| 157 |
+
},
|
| 158 |
+
"skipT": {
|
| 159 |
+
"dtype": "float32",
|
| 160 |
+
"shape": [10, 1],
|
| 161 |
+
"data": {
|
| 162 |
+
"kind": "values",
|
| 163 |
+
"values": [3.0, 1.0, -0.5, 0.0, 0.0, 0.0, "Infinity", "-Infinity", "NaN", 3.4028234663852886e+38]
|
| 164 |
+
}
|
| 165 |
+
},
|
| 166 |
"gammaT": { "dtype": "float32", "shape": [1], "data": { "kind": "values", "values": [7.0] } },
|
| 167 |
"betaT": { "dtype": "float32", "shape": [1], "data": { "kind": "values", "values": [-2.0] } },
|
| 168 |
"biasT": { "dtype": "float32", "shape": [1], "data": { "kind": "values", "values": [0.25] } }
|
| 169 |
},
|
| 170 |
"outputs": {
|
| 171 |
+
"outputT": {
|
| 172 |
+
"dtype": "float32",
|
| 173 |
+
"shape": [10, 1],
|
| 174 |
+
"tolerance": 0.000001,
|
| 175 |
+
"data": { "kind": "values", "values": [-2.0, -2.0, -2.0, "NaN", "NaN", "NaN", "NaN", "NaN", "NaN", "NaN"] },
|
| 176 |
+
"allowNaN": true
|
| 177 |
+
},
|
| 178 |
+
"residualT": {
|
| 179 |
+
"dtype": "float32",
|
| 180 |
+
"shape": [10, 1],
|
| 181 |
+
"tolerance": 0.000001,
|
| 182 |
+
"data": {
|
| 183 |
+
"kind": "values",
|
| 184 |
+
"values": [5.25, -2.75, 0.25, "Infinity", "-Infinity", "NaN", "Infinity", "-Infinity", "NaN", "Infinity"]
|
| 185 |
+
},
|
| 186 |
+
"allowNaN": true
|
| 187 |
+
}
|
| 188 |
+
},
|
| 189 |
+
"provenance": {
|
| 190 |
+
"notes": "Hidden size one with bias 0.25, gamma 7 and beta -2 over ten rows: three finite rows, rows with +-Infinity or NaN in the input or skip, and finite inputs whose sum overflows to +Infinity. The residual output holds each sum; the normalized output is beta (-2) for a finite residual and NaN otherwise."
|
| 191 |
}
|
| 192 |
},
|
| 193 |
{
|
| 194 |
"name": "hidden_size_one_bias_output_only",
|
| 195 |
"provenance": {
|
| 196 |
+
"notes": "Hidden size one over 4,097 rows with bias 0.25, gamma 7 and beta -2: a 17-row cycle mixes finite rows with rows whose input or skip is +-Infinity or NaN and a row of finite inputs whose sum overflows. Each finite residual normalizes to zero, giving beta (-2), and each non-finite residual gives NaN."
|
| 197 |
},
|
| 198 |
"attrs": { "epsilon": 0.00001 },
|
| 199 |
"inputs": {
|
| 200 |
+
"inputT": {
|
| 201 |
+
"dtype": "float32",
|
| 202 |
+
"shape": [4097, 1],
|
| 203 |
+
"data": {
|
| 204 |
+
"kind": "cycle",
|
| 205 |
+
"values": { "$ref": "#/fixtureArrays/hidden_size_one_bias_output_only_input_inputT" }
|
| 206 |
+
}
|
| 207 |
+
},
|
| 208 |
+
"skipT": {
|
| 209 |
+
"dtype": "float32",
|
| 210 |
+
"shape": [4097, 1],
|
| 211 |
+
"data": {
|
| 212 |
+
"kind": "cycle",
|
| 213 |
+
"values": { "$ref": "#/fixtureArrays/hidden_size_one_bias_output_only_input_skipT" }
|
| 214 |
+
}
|
| 215 |
+
},
|
| 216 |
"gammaT": { "dtype": "float32", "shape": [1], "data": { "kind": "values", "values": [7.0] } },
|
| 217 |
"betaT": { "dtype": "float32", "shape": [1], "data": { "kind": "values", "values": [-2.0] } },
|
| 218 |
"biasT": { "dtype": "float32", "shape": [1], "data": { "kind": "values", "values": [0.25] } }
|
| 219 |
},
|
| 220 |
+
"outputs": {
|
| 221 |
+
"outputT": {
|
| 222 |
+
"dtype": "float32",
|
| 223 |
+
"shape": [4097, 1],
|
| 224 |
+
"tolerance": 0.000001,
|
| 225 |
+
"data": {
|
| 226 |
+
"kind": "cycle",
|
| 227 |
+
"values": [-2.0, "NaN", "NaN", "NaN", "NaN", "NaN", "NaN", "NaN", -2.0, -2.0, -2.0, -2.0, -2.0, -2.0, -2.0, -2.0, -2.0]
|
| 228 |
+
},
|
| 229 |
+
"allowNaN": true
|
| 230 |
+
}
|
| 231 |
+
}
|
| 232 |
},
|
| 233 |
{
|
| 234 |
"name": "hidden_size_one_no_beta_output_only",
|
| 235 |
"provenance": {
|
| 236 |
+
"notes": "Hidden size one over 4,097 rows with gamma 7 and no bias or beta: a 17-row cycle mixes finite rows with rows whose input or skip is +-Infinity or NaN and a row of finite inputs whose sum overflows. Each finite residual normalizes to zero, giving 0, and each non-finite residual gives NaN."
|
| 237 |
},
|
| 238 |
"attrs": { "epsilon": 0.00001 },
|
| 239 |
"inputs": {
|
| 240 |
+
"inputT": {
|
| 241 |
+
"dtype": "float32",
|
| 242 |
+
"shape": [4097, 1],
|
| 243 |
+
"data": {
|
| 244 |
+
"kind": "cycle",
|
| 245 |
+
"values": { "$ref": "#/fixtureArrays/hidden_size_one_bias_output_only_input_inputT" }
|
| 246 |
+
}
|
| 247 |
+
},
|
| 248 |
+
"skipT": {
|
| 249 |
+
"dtype": "float32",
|
| 250 |
+
"shape": [4097, 1],
|
| 251 |
+
"data": {
|
| 252 |
+
"kind": "cycle",
|
| 253 |
+
"values": { "$ref": "#/fixtureArrays/hidden_size_one_bias_output_only_input_skipT" }
|
| 254 |
+
}
|
| 255 |
+
},
|
| 256 |
"gammaT": { "dtype": "float32", "shape": [1], "data": { "kind": "values", "values": [7.0] } }
|
| 257 |
},
|
| 258 |
+
"outputs": {
|
| 259 |
+
"outputT": {
|
| 260 |
+
"dtype": "float32",
|
| 261 |
+
"shape": [4097, 1],
|
| 262 |
+
"tolerance": 0.000001,
|
| 263 |
+
"data": {
|
| 264 |
+
"kind": "cycle",
|
| 265 |
+
"values": [0.0, "NaN", "NaN", "NaN", "NaN", "NaN", "NaN", "NaN", 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0]
|
| 266 |
+
},
|
| 267 |
+
"allowNaN": true
|
| 268 |
+
}
|
| 269 |
+
}
|
| 270 |
},
|
| 271 |
{
|
| 272 |
"name": "hidden_size_one_bias_rows65535_dispatch_edge",
|
|
|
|
| 373 |
"inputT": {
|
| 374 |
"dtype": "float32",
|
| 375 |
"shape": [4, 4],
|
| 376 |
+
"data": { "kind": "cycle", "values": [0.7, -0.4, -0.2, 1.2, 0.4, 0.3, 0.1, -0.4] }
|
|
|
|
|
|
|
|
|
|
| 377 |
},
|
| 378 |
"skipT": {
|
| 379 |
"dtype": "float32",
|
|
|
|
| 404 |
"inputT": {
|
| 405 |
"dtype": "float32",
|
| 406 |
"shape": [4, 4],
|
| 407 |
+
"data": { "kind": "cycle", "values": [0.8, -0.5, 0.0, 1.0, 0.5, 0.2, 0.3, -0.6] }
|
| 408 |
},
|
| 409 |
"skipT": {
|
| 410 |
"dtype": "float32",
|
|
|
|
| 498 |
"inputT": {
|
| 499 |
"dtype": "float32",
|
| 500 |
"shape": [2, 2, 4],
|
| 501 |
+
"data": { "kind": "cycle", "values": [0.8, -0.5, 0.0, 1.0, 0.5, 0.2, 0.3, -0.6] }
|
| 502 |
},
|
| 503 |
"skipT": {
|
| 504 |
"dtype": "float32",
|
|
|
|
| 525 |
"provenance": {
|
| 526 |
"source": "onnxruntime/test/contrib_ops/skiplayernorm_op_test.cc",
|
| 527 |
"test": "SkipLayerNormTest.SkipLayerNormBatch1_NoBeta",
|
| 528 |
+
"notes": "Two tokens of width 4, with a scale and a skip input but no beta."
|
| 529 |
},
|
| 530 |
"attrs": { "epsilon": 1e-12 },
|
| 531 |
"inputs": {
|
|
|
|
| 675 |
},
|
| 676 |
{
|
| 677 |
"name": "beta_bias_output_only_hidden6_unaligned_row",
|
| 678 |
+
"provenance": { "notes": "Hidden size 6 is not a multiple of 4, with beta and bias present." },
|
|
|
|
|
|
|
| 679 |
"attrs": { "epsilon": 0.00001 },
|
| 680 |
"inputs": {
|
| 681 |
"inputT": {
|
|
|
|
| 717 |
"inputT": {
|
| 718 |
"dtype": "float32",
|
| 719 |
"shape": [2, 2, 4],
|
| 720 |
+
"data": { "kind": "cycle", "values": [0.8, -0.5, 0.0, 1.0, 0.5, 0.2, 0.3, -0.6] }
|
| 721 |
},
|
| 722 |
"skipT": {
|
| 723 |
"dtype": "float32",
|
|
|
|
| 777 |
},
|
| 778 |
{
|
| 779 |
"name": "f32_hidden768_no_bias_residual",
|
| 780 |
+
"provenance": { "notes": "A hidden size of 768 (4 rows, float32) with beta, no bias and the residual output." },
|
|
|
|
|
|
|
| 781 |
"attrs": { "epsilon": 0.00001 },
|
| 782 |
"inputs": {
|
| 783 |
"inputT": {
|
|
|
|
| 844 |
{
|
| 845 |
"name": "f32_hidden1025_bias_residual",
|
| 846 |
"provenance": {
|
| 847 |
+
"notes": "A hidden size of 1025 (3 rows, float32) with beta, bias and the residual output; 1025 leaves a remainder of 1 after multiples of 4."
|
| 848 |
},
|
| 849 |
"attrs": { "epsilon": 0.00001 },
|
| 850 |
"inputs": {
|
|
|
|
| 1010 |
},
|
| 1011 |
{
|
| 1012 |
"name": "rank3_no_bias_residual",
|
| 1013 |
+
"provenance": { "notes": "Rank-3 activation [1, 4, 768] with the residual (sum) output present and no bias." },
|
|
|
|
|
|
|
| 1014 |
"attrs": { "epsilon": 0.00001 },
|
| 1015 |
"inputs": {
|
| 1016 |
"inputT": {
|
|
|
|
| 1042 |
{
|
| 1043 |
"name": "rank3_beta_no_bias_output_only_hidden6_unaligned_row",
|
| 1044 |
"provenance": {
|
| 1045 |
+
"notes": "Rank-3 activation [1, 2, 6] whose hidden size of 6 is not a multiple of 4, with beta and no bias."
|
| 1046 |
},
|
| 1047 |
"attrs": { "epsilon": 0.00001 },
|
| 1048 |
"inputs": {
|
|
|
|
| 1107 |
},
|
| 1108 |
{
|
| 1109 |
"name": "f16_beta_bias_output_only_hidden6_unaligned_row",
|
| 1110 |
+
"provenance": { "notes": "Float16 with hidden size 6 (not a multiple of 4), beta and bias." },
|
| 1111 |
"requires": { "features": ["shader-f16"] },
|
| 1112 |
"attrs": { "epsilon": 0.00001 },
|
| 1113 |
"inputs": {
|
|
|
|
| 1223 |
},
|
| 1224 |
{
|
| 1225 |
"name": "f16_no_beta_output_only",
|
| 1226 |
+
"provenance": { "notes": "Float16 with neither beta nor bias at a hidden size of 8 (a multiple of 4)." },
|
|
|
|
|
|
|
| 1227 |
"requires": { "features": ["shader-f16"] },
|
| 1228 |
"attrs": { "epsilon": 0.00001 },
|
| 1229 |
"inputs": {
|
|
|
|
| 1248 |
{
|
| 1249 |
"name": "independent_rows_float32_257x1_option0_wgdefault_epsilon0.00001",
|
| 1250 |
"provenance": {
|
| 1251 |
+
"notes": "257 float32 rows of hidden size 1 (input 1.25, skip 0.5, constant) with gamma and epsilon 1e-05: each row normalizes a single element, so the result is uniform and has a closed form. The outputs are the normalized values."
|
| 1252 |
},
|
| 1253 |
"attrs": { "epsilon": 0.00001 },
|
| 1254 |
"inputs": {
|
|
|
|
| 1261 |
{
|
| 1262 |
"name": "independent_rows_float32_257x1_option1_wgdefault_epsilon0.00001",
|
| 1263 |
"provenance": {
|
| 1264 |
+
"notes": "257 float32 rows of hidden size 1 (input 1.25, skip 0.5, constant) with gamma and beta and epsilon 1e-05: each row normalizes a single element, so the result is uniform and has a closed form. The outputs are the normalized values."
|
| 1265 |
},
|
| 1266 |
"attrs": { "epsilon": 0.00001 },
|
| 1267 |
"inputs": {
|
|
|
|
| 1275 |
{
|
| 1276 |
"name": "independent_rows_float32_257x1_option2_wgdefault_epsilon0.00001",
|
| 1277 |
"provenance": {
|
| 1278 |
+
"notes": "257 float32 rows of hidden size 1 (input 1.25, skip 0.5, constant) with gamma and beta and bias and epsilon 1e-05: each row normalizes a single element, so the result is uniform and has a closed form. The outputs are the normalized values."
|
| 1279 |
},
|
| 1280 |
"attrs": { "epsilon": 0.00001 },
|
| 1281 |
"inputs": {
|
|
|
|
| 1290 |
{
|
| 1291 |
"name": "independent_rows_float32_3x31x1_option2_wg1_epsilon0.00001",
|
| 1292 |
"provenance": {
|
| 1293 |
+
"notes": "93 float32 rows of hidden size 1 (input 1.25, skip 0.5, constant) with gamma and beta and bias and epsilon 1e-05: each row normalizes a single element, so the result is uniform and has a closed form. The outputs are the normalized values. Its tunable sets a maximum workgroup size of 1."
|
| 1294 |
},
|
| 1295 |
"attrs": { "epsilon": 0.00001 },
|
| 1296 |
"tunables": { "MAX_WORKGROUP_SIZE": 1 },
|
|
|
|
| 1306 |
{
|
| 1307 |
"name": "independent_rows_float32_3x31x1_option2_wg8_epsilon0.00001",
|
| 1308 |
"provenance": {
|
| 1309 |
+
"notes": "93 float32 rows of hidden size 1 (input 1.25, skip 0.5, constant) with gamma and beta and bias and epsilon 1e-05: each row normalizes a single element, so the result is uniform and has a closed form. The outputs are the normalized values. Its tunable sets a maximum workgroup size of 8."
|
| 1310 |
},
|
| 1311 |
"attrs": { "epsilon": 0.00001 },
|
| 1312 |
"tunables": { "MAX_WORKGROUP_SIZE": 8 },
|
|
|
|
| 1322 |
{
|
| 1323 |
"name": "independent_rows_float32_3x31x1_option2_wg64_epsilon0.00001",
|
| 1324 |
"provenance": {
|
| 1325 |
+
"notes": "93 float32 rows of hidden size 1 (input 1.25, skip 0.5, constant) with gamma and beta and bias and epsilon 1e-05: each row normalizes a single element, so the result is uniform and has a closed form. The outputs are the normalized values. Its tunable sets a maximum workgroup size of 64."
|
| 1326 |
},
|
| 1327 |
"attrs": { "epsilon": 0.00001 },
|
| 1328 |
"tunables": { "MAX_WORKGROUP_SIZE": 64 },
|
|
|
|
| 1338 |
{
|
| 1339 |
"name": "independent_rows_float32_3x31x1_option2_wg128_epsilon0.00001",
|
| 1340 |
"provenance": {
|
| 1341 |
+
"notes": "93 float32 rows of hidden size 1 (input 1.25, skip 0.5, constant) with gamma and beta and bias and epsilon 1e-05: each row normalizes a single element, so the result is uniform and has a closed form. The outputs are the normalized values. Its tunable sets a maximum workgroup size of 128."
|
| 1342 |
},
|
| 1343 |
"attrs": { "epsilon": 0.00001 },
|
| 1344 |
"tunables": { "MAX_WORKGROUP_SIZE": 128 },
|
|
|
|
| 1354 |
{
|
| 1355 |
"name": "independent_rows_float32_524289x1_option3_wg8_epsilon0.00001",
|
| 1356 |
"provenance": {
|
| 1357 |
+
"notes": "524,289 float32 rows of hidden size 1 (input 1.25, skip 0.5, constant) with gamma and beta and bias and epsilon 1e-05: each row normalizes a single element, so the result is uniform and has a closed form. The outputs are the normalized values and a residual sum. Its tunable sets a maximum workgroup size of 8."
|
| 1358 |
},
|
| 1359 |
"attrs": { "epsilon": 0.00001 },
|
| 1360 |
"tunables": { "MAX_WORKGROUP_SIZE": 8 },
|
|
|
|
| 1373 |
{
|
| 1374 |
"name": "independent_rows_float32_257x1_option2_wgdefault_epsilon0",
|
| 1375 |
"provenance": {
|
| 1376 |
+
"notes": "257 float32 rows of hidden size 1 (input 1.25, skip 0.5, constant) with gamma and beta and bias and epsilon 0: with a single element the variance is zero, so the normalization divides zero by zero and NaN outputs are allowed."
|
| 1377 |
},
|
| 1378 |
"attrs": { "epsilon": 0 },
|
| 1379 |
"inputs": {
|
|
|
|
| 1388 |
{
|
| 1389 |
"name": "independent_rows_float16_257x1_option0_wgdefault_epsilon0.00001",
|
| 1390 |
"provenance": {
|
| 1391 |
+
"notes": "257 float16 rows of hidden size 1 (input 1.25, skip 0.5, constant) with gamma and epsilon 1e-05: each row normalizes a single element, so the result is uniform and has a closed form. The outputs are the normalized values."
|
| 1392 |
},
|
| 1393 |
"attrs": { "epsilon": 0.00001 },
|
| 1394 |
"inputs": {
|
|
|
|
| 1401 |
{
|
| 1402 |
"name": "independent_rows_float16_257x1_option1_wgdefault_epsilon0.00001",
|
| 1403 |
"provenance": {
|
| 1404 |
+
"notes": "257 float16 rows of hidden size 1 (input 1.25, skip 0.5, constant) with gamma and beta and epsilon 1e-05: each row normalizes a single element, so the result is uniform and has a closed form. The outputs are the normalized values."
|
| 1405 |
},
|
| 1406 |
"attrs": { "epsilon": 0.00001 },
|
| 1407 |
"inputs": {
|
|
|
|
| 1415 |
{
|
| 1416 |
"name": "independent_rows_float16_257x1_option2_wgdefault_epsilon0.00001",
|
| 1417 |
"provenance": {
|
| 1418 |
+
"notes": "257 float16 rows of hidden size 1 (input 1.25, skip 0.5, constant) with gamma and beta and bias and epsilon 1e-05: each row normalizes a single element, so the result is uniform and has a closed form. The outputs are the normalized values."
|
| 1419 |
},
|
| 1420 |
"attrs": { "epsilon": 0.00001 },
|
| 1421 |
"inputs": {
|
|
|
|
| 1430 |
{
|
| 1431 |
"name": "independent_rows_float16_3x31x1_option2_wg1_epsilon0.00001",
|
| 1432 |
"provenance": {
|
| 1433 |
+
"notes": "93 float16 rows of hidden size 1 (input 1.25, skip 0.5, constant) with gamma and beta and bias and epsilon 1e-05: each row normalizes a single element, so the result is uniform and has a closed form. The outputs are the normalized values. Its tunable sets a maximum workgroup size of 1."
|
| 1434 |
},
|
| 1435 |
"attrs": { "epsilon": 0.00001 },
|
| 1436 |
"tunables": { "MAX_WORKGROUP_SIZE": 1 },
|
|
|
|
| 1446 |
{
|
| 1447 |
"name": "independent_rows_float16_3x31x1_option2_wg8_epsilon0.00001",
|
| 1448 |
"provenance": {
|
| 1449 |
+
"notes": "93 float16 rows of hidden size 1 (input 1.25, skip 0.5, constant) with gamma and beta and bias and epsilon 1e-05: each row normalizes a single element, so the result is uniform and has a closed form. The outputs are the normalized values. Its tunable sets a maximum workgroup size of 8."
|
| 1450 |
},
|
| 1451 |
"attrs": { "epsilon": 0.00001 },
|
| 1452 |
"tunables": { "MAX_WORKGROUP_SIZE": 8 },
|
|
|
|
| 1462 |
{
|
| 1463 |
"name": "independent_rows_float16_3x31x1_option2_wg64_epsilon0.00001",
|
| 1464 |
"provenance": {
|
| 1465 |
+
"notes": "93 float16 rows of hidden size 1 (input 1.25, skip 0.5, constant) with gamma and beta and bias and epsilon 1e-05: each row normalizes a single element, so the result is uniform and has a closed form. The outputs are the normalized values. Its tunable sets a maximum workgroup size of 64."
|
| 1466 |
},
|
| 1467 |
"attrs": { "epsilon": 0.00001 },
|
| 1468 |
"tunables": { "MAX_WORKGROUP_SIZE": 64 },
|
|
|
|
| 1478 |
{
|
| 1479 |
"name": "independent_rows_float16_3x31x1_option2_wg128_epsilon0.00001",
|
| 1480 |
"provenance": {
|
| 1481 |
+
"notes": "93 float16 rows of hidden size 1 (input 1.25, skip 0.5, constant) with gamma and beta and bias and epsilon 1e-05: each row normalizes a single element, so the result is uniform and has a closed form. The outputs are the normalized values. Its tunable sets a maximum workgroup size of 128."
|
| 1482 |
},
|
| 1483 |
"attrs": { "epsilon": 0.00001 },
|
| 1484 |
"tunables": { "MAX_WORKGROUP_SIZE": 128 },
|
|
|
|
| 1494 |
{
|
| 1495 |
"name": "independent_rows_float16_524289x1_option2_wg8_epsilon0.00001",
|
| 1496 |
"provenance": {
|
| 1497 |
+
"notes": "524,289 float16 rows of hidden size 1 (input 1.25, skip 0.5, constant) with gamma and beta and bias and epsilon 1e-05: each row normalizes a single element, so the result is uniform and has a closed form. The outputs are the normalized values. Its tunable sets a maximum workgroup size of 8."
|
| 1498 |
},
|
| 1499 |
"attrs": { "epsilon": 0.00001 },
|
| 1500 |
"tunables": { "MAX_WORKGROUP_SIZE": 8 },
|
|
|
|
| 1510 |
{
|
| 1511 |
"name": "independent_rows_float16_257x1_option2_wgdefault_epsilon0",
|
| 1512 |
"provenance": {
|
| 1513 |
+
"notes": "257 float16 rows of hidden size 1 (input 1.25, skip 0.5, constant) with gamma and beta and bias and epsilon 0: with a single element the variance is zero, so the normalization divides zero by zero and NaN outputs are allowed."
|
| 1514 |
},
|
| 1515 |
"attrs": { "epsilon": 0 },
|
| 1516 |
"inputs": {
|
|
|
|
| 1525 |
{
|
| 1526 |
"name": "independent_rows_float32_257x1_option3_wgdefault_epsilon0.00001",
|
| 1527 |
"provenance": {
|
| 1528 |
+
"notes": "257 float32 rows of hidden size 1 (input 1.25, skip 0.5, constant) with gamma and beta and bias and epsilon 1e-05: each row normalizes a single element, so the result is uniform and has a closed form. The outputs are the normalized values and a residual sum."
|
| 1529 |
},
|
| 1530 |
"attrs": { "epsilon": 0.00001 },
|
| 1531 |
"inputs": {
|