Xenova HF Staff commited on
Commit
2c28f1c
·
verified ·
1 Parent(s): 5b47652

sync 91d990483a17

Browse files
README.md CHANGED
@@ -18,25 +18,25 @@ See the [ONNX Runtime `EmbedLayerNormalization` contrib-operator spec](https://g
18
 
19
  ## Inputs
20
 
21
- | Name | Bind key | Logical dtype | WebGPU storage | Rank | Shape | Description | Presence |
22
  | --- | --- | --- | --- | --- | --- | --- | --- |
23
- | `input_ids` | `inputIdsT` | `T1` | `int32` | `2` | — | Word ids of shape `(batch_size, sequence_length)`. | required |
24
- | `segment_ids` | `segmentIdsT` | `T1` | `int32` | `2` | — | Segment ids `(batch_size, sequence_length)`. Requires `segment_embedding`; when omitted with that table present, every token uses row 0. Values must be valid non-negative table-row indices. | optional |
25
- | `word_embedding` | `wordEmbeddingT` | `T` | same as logical dtype | `2` | — | Non-empty word embedding table `(vocab, hidden_size)`. Every `input_ids` value must be a valid non-negative row index. | required |
26
- | `position_embedding` | `positionEmbeddingT` | `T` | same as logical dtype | `2` | — | Non-empty position embedding table `(max_positions, hidden_size)`. Without `position_ids`, it must contain at least `sequence_length` rows. | required |
27
- | `segment_embedding` | `segmentEmbeddingT` | `T` | same as logical dtype | `2` | — | Non-empty segment embedding table `(segments, hidden_size)`. If `segment_ids` is absent, row 0 is used for every token. | optional |
28
- | `gamma` | `gammaT` | `T` | same as logical dtype | `1` | — | Layer-normalization scale of shape `(hidden_size)`. | required |
29
- | `beta` | `betaT` | `T` | same as logical dtype | `1` | — | Layer-normalization bias of shape `(hidden_size)`. | required |
30
- | `mask` | `maskT` | `T1` | `int32` | `2` | — | Attention mask of shape `(batch_size, sequence_length)`. Only used to produce `mask_index`. | optional |
31
- | `position_ids` | `positionIdsT` | `T1` | `int32` | `2` | — | Position ids `(batch_size, sequence_length)`, or `(1, sequence_length)` to share one row across the batch. Values must be valid non-negative table-row indices; absent uses the position within the sequence. | optional |
32
 
33
  ## Outputs
34
 
35
- | Name | Bind key | Logical dtype | WebGPU storage | Rank | Shape | Description | Presence |
36
  | --- | --- | --- | --- | --- | --- | --- | --- |
37
- | `output` | `outputT` | `T` | same as logical dtype | `3` | derived; see description | Normalized embeddings of shape `(batch_size, sequence_length, hidden_size)`. | required |
38
- | `mask_index` | `maskIndexT` | `T1` | `int32` | `1` | `[input_ids[0]]` | Position of the first zero in each mask row, or `sequence_length` when no zero exists; shape `(batch_size)`. It is zero when the optional mask input is absent. | optional |
39
- | `embedding_sum` | `embeddingSumT` | `T` | same as logical dtype | `3` | derived; see description | The summed embeddings before normalization, including the segment term when present. Float16 uses staged `(word + segment) + position`; float32 uses `(word + position) + segment`. | optional |
40
 
41
  ## Attributes
42
 
@@ -45,7 +45,7 @@ Attributes and default values (overridable per request):
45
  | Attribute | Default | Description |
46
  | --- | --- | --- |
47
  | `epsilon` | `9.999999960041972e-13` | Non-negative epsilon added to the layer-normalization variance before taking the square root. |
48
- | `mask_index_type` | — | Optional shape-inference hint for the `mask_index` output type. The schema's `T1` constraint fixes the runtime tensor type to int32. |
49
 
50
  ## Type constraints
51
 
@@ -56,7 +56,7 @@ Attributes and default values (overridable per request):
56
 
57
  ## Files
58
 
59
- - [`metadata.json`](build/webgpu/metadata.json) — kernel metadata (id, digests, provenance)
60
  - [`manifest.json`](build/webgpu/manifest.json) — the op contract (source of truth)
61
  - [`test.json`](build/webgpu/test.json) — correctness cases
62
  - [`bench.json`](build/webgpu/bench.json) — benchmark + tuning cases
@@ -66,10 +66,14 @@ Attributes and default values (overridable per request):
66
 
67
  ## Use with `@huggingface/kernels`
68
 
69
- The loader derives every required output's shape and logical dtype from the manifest contract and this call.
70
- It then allocates the result tensors automatically.
 
 
 
71
 
72
  The `version: 1` option selects the published kernel contract; it is independent of any operator opset, contrib `since_version`, or model version.
 
73
 
74
  Replace each `*Data` placeholder with a typed array containing the corresponding input data.
75
 
 
18
 
19
  ## Inputs
20
 
21
+ | Name | Upstream name | Logical dtype | WebGPU storage | Rank | Shape | Description | Presence |
22
  | --- | --- | --- | --- | --- | --- | --- | --- |
23
+ | `inputIdsT` | `input_ids` | `T1` | `int32` | `2` | — | Word ids of shape `(batch_size, sequence_length)`. | required |
24
+ | `segmentIdsT` | `segment_ids` | `T1` | `int32` | `2` | — | Segment ids `(batch_size, sequence_length)`. Requires `segment_embedding`; when omitted with that table present, every token uses row 0. Values must be valid non-negative table-row indices. | optional |
25
+ | `wordEmbeddingT` | `word_embedding` | `T` | same as logical dtype | `2` | — | Non-empty word embedding table `(vocab, hidden_size)`. Every `input_ids` value must be a valid non-negative row index. | required |
26
+ | `positionEmbeddingT` | `position_embedding` | `T` | same as logical dtype | `2` | — | Non-empty position embedding table `(max_positions, hidden_size)`. Without `position_ids`, it must contain at least `sequence_length` rows. | required |
27
+ | `segmentEmbeddingT` | `segment_embedding` | `T` | same as logical dtype | `2` | — | Non-empty segment embedding table `(segments, hidden_size)`. If `segment_ids` is absent, row 0 is used for every token. | optional |
28
+ | `gammaT` | `gamma` | `T` | same as logical dtype | `1` | — | Layer-normalization scale of shape `(hidden_size)`. | required |
29
+ | `betaT` | `beta` | `T` | same as logical dtype | `1` | — | Layer-normalization bias of shape `(hidden_size)`. | required |
30
+ | `maskT` | `mask` | `T1` | `int32` | `2` | — | Attention mask of shape `(batch_size, sequence_length)`. Only used to produce `mask_index`. | optional |
31
+ | `positionIdsT` | `position_ids` | `T1` | `int32` | `2` | — | Position ids `(batch_size, sequence_length)`, or `(1, sequence_length)` to share one row across the batch. Values must be valid non-negative table-row indices; absent uses the position within the sequence. | optional |
32
 
33
  ## Outputs
34
 
35
+ | Name | Upstream name | Logical dtype | WebGPU storage | Rank | Shape | Description | Presence |
36
  | --- | --- | --- | --- | --- | --- | --- | --- |
37
+ | `outputT` | `output` | `T` | same as logical dtype | `3` | derived | Normalized embeddings of shape `(batch_size, sequence_length, hidden_size)`. | required |
38
+ | `maskIndexT` | `mask_index` | `T1` | `int32` | `1` | `[inputIdsT[0]]` | Position of the first zero in each mask row, or `sequence_length` when no zero exists; shape `(batch_size)`. It is zero when the optional mask input is absent. | optional |
39
+ | `embeddingSumT` | `embedding_sum` | `T` | same as logical dtype | `3` | derived | The summed embeddings before normalization, including the segment term when present. Float16 uses staged `(word + segment) + position`; float32 uses `(word + position) + segment`. | optional |
40
 
41
  ## Attributes
42
 
 
45
  | Attribute | Default | Description |
46
  | --- | --- | --- |
47
  | `epsilon` | `9.999999960041972e-13` | Non-negative epsilon added to the layer-normalization variance before taking the square root. |
48
+ | `mask_index_type` | — | Optional shape-inference hint for the `mask_index` output type. The schema's `T1` constraint fixes the output tensor data type to int32. |
49
 
50
  ## Type constraints
51
 
 
56
 
57
  ## Files
58
 
59
+ - [`metadata.json`](build/webgpu/metadata.json) — kernel metadata (id, digests, per-variant templates, provenance)
60
  - [`manifest.json`](build/webgpu/manifest.json) — the op contract (source of truth)
61
  - [`test.json`](build/webgpu/test.json) — correctness cases
62
  - [`bench.json`](build/webgpu/bench.json) — benchmark + tuning cases
 
66
 
67
  ## Use with `@huggingface/kernels`
68
 
69
+ ```sh
70
+ npm install --save-exact @huggingface/kernels@0.0.1-preview.2
71
+ ```
72
+
73
+ Required output shapes and logical data types are inferred from the supplied inputs and attributes; result tensors are allocated automatically.
74
 
75
  The `version: 1` option selects the published kernel contract; it is independent of any operator opset, contrib `since_version`, or model version.
76
+ It follows the `v1` branch as fixes land. To pin exact artifact bytes, pass a 40-character commit `revision` instead of `version`.
77
 
78
  Replace each `*Data` placeholder with a typed array containing the corresponding input data.
79
 
build/webgpu/bench.json CHANGED
@@ -1,5 +1,4 @@
1
  {
2
- "op": "com.microsoft.EmbedLayerNormalization",
3
  "tunableSpace": { "WORKGROUP_SIZE": [64, 128, 256] },
4
  "cases": [
5
  {
 
1
  {
 
2
  "tunableSpace": { "WORKGROUP_SIZE": [64, 128, 256] },
3
  "cases": [
4
  {
build/webgpu/embed-normalize.wgsl.jinja CHANGED
@@ -1,6 +1,3 @@
1
- {% if usesF16 %}
2
- enable f16;
3
- {% endif %}
4
  {{ env.wgsl.resourceDeclarations }}
5
 
6
  // com.microsoft.EmbedLayerNormalization, normalization pass.
@@ -79,11 +76,10 @@ fn reduce_sum(value: f32, tid: u32) -> f32 {
79
 
80
  @compute @workgroup_size(WG, 1, 1)
81
  fn main(@builtin(workgroup_id) wg: vec3<u32>,
82
- @builtin(num_workgroups) nwg: vec3<u32>,
83
  @builtin(local_invocation_id) lid: vec3<u32>) {
84
  // 2D-folded row index: wg.y carries the high bits past the
85
- // maxComputeWorkgroupsPerDimension dispatch limit.
86
- let token = wg.x + wg.y * nwg.x;
87
  if (token >= params.tokens) {
88
  return;
89
  }
 
 
 
 
1
  {{ env.wgsl.resourceDeclarations }}
2
 
3
  // com.microsoft.EmbedLayerNormalization, normalization pass.
 
76
 
77
  @compute @workgroup_size(WG, 1, 1)
78
  fn main(@builtin(workgroup_id) wg: vec3<u32>,
 
79
  @builtin(local_invocation_id) lid: vec3<u32>) {
80
  // 2D-folded row index: wg.y carries the high bits past the
81
+ // per-axis dispatch fold width.
82
+ let token = wg.x + wg.y * {{ DISPATCH_FOLD_WIDTH }}u;
83
  if (token >= params.tokens) {
84
  return;
85
  }
build/webgpu/embed-sum.wgsl.jinja CHANGED
@@ -1,6 +1,3 @@
1
- {% if usesF16 %}
2
- enable f16;
3
- {% endif %}
4
  {{ env.wgsl.resourceDeclarations }}
5
 
6
  // com.microsoft.EmbedLayerNormalization, embedding-sum pass.
@@ -20,8 +17,8 @@ const HIDDEN: u32 = {{ hidden }}u;
20
  const SEQUENCE: u32 = {{ sequenceLength }}u;
21
  {% endif %}
22
  const WG: u32 = {{ workgroupSize }}u;
23
- // Defensive row clamps keep an invalid id from reading outside an embedding
24
- // table. Request validation rejects such ids before a valid dispatch.
25
  const WORD_ROWS: u32 = {{ wordRows }}u;
26
  const POSITION_ROWS: u32 = {{ positionRows }}u;
27
  {% if hasSegment and hasSegmentIds %}
@@ -30,11 +27,10 @@ const SEGMENT_ROWS: u32 = {{ segmentRows }}u;
30
 
31
  @compute @workgroup_size(WG, 1, 1)
32
  fn main(@builtin(workgroup_id) wg: vec3<u32>,
33
- @builtin(num_workgroups) nwg: vec3<u32>,
34
  @builtin(local_invocation_id) lid: vec3<u32>) {
35
  // 2D-folded row index: wg.y carries the high bits past the
36
- // maxComputeWorkgroupsPerDimension dispatch limit.
37
- let token = wg.x + wg.y * nwg.x;
38
  if (token >= params.tokens) {
39
  return;
40
  }
 
 
 
 
1
  {{ env.wgsl.resourceDeclarations }}
2
 
3
  // com.microsoft.EmbedLayerNormalization, embedding-sum pass.
 
17
  const SEQUENCE: u32 = {{ sequenceLength }}u;
18
  {% endif %}
19
  const WG: u32 = {{ workgroupSize }}u;
20
+ // IDs must index valid embedding rows. Defensive clamps prevent out-of-bounds
21
+ // reads if that precondition is violated.
22
  const WORD_ROWS: u32 = {{ wordRows }}u;
23
  const POSITION_ROWS: u32 = {{ positionRows }}u;
24
  {% if hasSegment and hasSegmentIds %}
 
27
 
28
  @compute @workgroup_size(WG, 1, 1)
29
  fn main(@builtin(workgroup_id) wg: vec3<u32>,
 
30
  @builtin(local_invocation_id) lid: vec3<u32>) {
31
  // 2D-folded row index: wg.y carries the high bits past the
32
+ // per-axis dispatch fold width.
33
+ let token = wg.x + wg.y * {{ DISPATCH_FOLD_WIDTH }}u;
34
  if (token >= params.tokens) {
35
  return;
36
  }
build/webgpu/manifest.json CHANGED
@@ -2,110 +2,44 @@
2
  "domain": "com.microsoft",
3
  "name": "EmbedLayerNormalization",
4
  "sinceVersion": 1,
5
- "description": "BERT embedding fusion: looks up word and position tables, optionally adds a segment table, then applies layer normalization. A segment table without IDs uses row 0. `embedding_sum` is the pre-normalization sum. `mask_index` is the first zero or the sequence length; without `mask`, it is zero. Batch and sequence dimensions must be non-empty.",
6
- "inputs": [
7
- {
8
- "role": "input_ids",
9
- "dtype": "T1",
10
- "rank": 2,
11
- "description": "Word ids of shape `(batch_size, sequence_length)`."
12
- },
13
- {
14
- "role": "segment_ids",
15
- "dtype": "T1",
16
- "rank": 2,
17
- "optional": true,
18
- "description": "Segment ids `(batch_size, sequence_length)`. Requires `segment_embedding`; when omitted with that table present, every token uses row 0. Values must be valid non-negative table-row indices."
19
- },
20
- {
21
- "role": "word_embedding",
22
- "dtype": "T",
23
- "rank": 2,
24
- "description": "Non-empty word embedding table `(vocab, hidden_size)`. Every `input_ids` value must be a valid non-negative row index."
25
- },
26
- {
27
- "role": "position_embedding",
28
- "dtype": "T",
29
- "rank": 2,
30
- "description": "Non-empty position embedding table `(max_positions, hidden_size)`. Without `position_ids`, it must contain at least `sequence_length` rows."
31
- },
32
- {
33
- "role": "segment_embedding",
34
- "dtype": "T",
35
- "rank": 2,
36
- "optional": true,
37
- "description": "Non-empty segment embedding table `(segments, hidden_size)`. If `segment_ids` is absent, row 0 is used for every token."
38
- },
39
- { "role": "gamma", "dtype": "T", "rank": 1, "description": "Layer-normalization scale of shape `(hidden_size)`." },
40
- { "role": "beta", "dtype": "T", "rank": 1, "description": "Layer-normalization bias of shape `(hidden_size)`." },
41
- {
42
- "role": "mask",
43
- "dtype": "T1",
44
- "rank": 2,
45
- "optional": true,
46
- "description": "Attention mask of shape `(batch_size, sequence_length)`. Only used to produce `mask_index`."
47
- },
48
- {
49
- "role": "position_ids",
50
- "dtype": "T1",
51
- "rank": 2,
52
- "optional": true,
53
- "description": "Position ids `(batch_size, sequence_length)`, or `(1, sequence_length)` to share one row across the batch. Values must be valid non-negative table-row indices; absent uses the position within the sequence."
54
- }
55
- ],
56
- "outputs": [
57
- {
58
- "role": "output",
59
  "dtype": "T",
60
  "rank": 3,
61
- "shape": "[dim(shapes.inputIdsT, 0), dim(shapes.inputIdsT, 1), hidden]",
62
- "description": "Normalized embeddings of shape `(batch_size, sequence_length, hidden_size)`."
63
  },
64
- {
65
- "role": "mask_index",
66
  "dtype": "T1",
67
  "rank": 1,
68
  "optional": true,
69
  "shape": "[dim(shapes.inputIdsT, 0)]",
70
- "description": "Position of the first zero in each mask row, or `sequence_length` when no zero exists; shape `(batch_size)`. It is zero when the optional mask input is absent."
71
  },
72
- {
73
- "role": "embedding_sum",
74
  "dtype": "T",
75
  "rank": 3,
76
  "optional": true,
77
- "shape": "[dim(shapes.inputIdsT, 0), dim(shapes.inputIdsT, 1), hidden]",
78
- "description": "The summed embeddings before normalization, including the segment term when present. Float16 uses staged `(word + segment) + position`; float32 uses `(word + position) + segment`."
79
  }
80
- ],
81
- "attributes": { "epsilon": 9.999999960041972e-13 },
82
- "attributeDescriptions": {
83
- "epsilon": "Non-negative epsilon added to the layer-normalization variance before taking the square root.",
84
- "mask_index_type": "Optional shape-inference hint for the `mask_index` output type. The schema's `T1` constraint fixes the runtime tensor type to int32."
85
  },
 
86
  "attributeConstraints": { "mask_index_type": { "values": [0, 1] } },
87
  "typeConstraints": { "T": ["float32", "float16"], "T1": ["int32"] },
88
- "args": {
89
- "inputIdsT": { "kind": "tensor", "semantic": "input_ids", "role": "input", "dtype": "int32" },
90
- "segmentIdsT": { "kind": "tensor", "semantic": "segment_ids", "role": "input", "dtype": "int32", "required": false },
91
- "wordEmbeddingT": { "kind": "tensor", "semantic": "word_embedding", "role": "weights" },
92
- "positionEmbeddingT": { "kind": "tensor", "semantic": "position_embedding", "role": "weights" },
93
- "segmentEmbeddingT": { "kind": "tensor", "semantic": "segment_embedding", "role": "weights", "required": false },
94
- "gammaT": { "kind": "tensor", "semantic": "gamma", "role": "weights" },
95
- "betaT": { "kind": "tensor", "semantic": "beta", "role": "weights" },
96
- "maskT": { "kind": "tensor", "semantic": "mask", "role": "input", "dtype": "int32", "required": false },
97
- "positionIdsT": {
98
- "kind": "tensor",
99
- "semantic": "position_ids",
100
- "role": "input",
101
- "dtype": "int32",
102
- "required": false
103
- },
104
- "outputT": { "kind": "tensor", "semantic": "output", "role": "output" },
105
- "maskIndexT": { "kind": "tensor", "semantic": "mask_index", "role": "output", "dtype": "int32", "required": false },
106
- "embeddingSumT": { "kind": "tensor", "semantic": "embedding_sum", "role": "output", "required": false }
107
- },
108
- "tunables": { "WORKGROUP_SIZE": 128, "MASK_WORKGROUP_SIZE": 64 },
109
  "derive": {
110
  "batchSize": "dim(shapes.inputIdsT, 0)",
111
  "sequenceLength": "dim(shapes.inputIdsT, 1)",
@@ -123,14 +57,9 @@
123
  "embeddingSumContract": "ranks.embeddingSumT == 3 and sameShape(shapes.embeddingSumT, shapes.outputT) and tensorDtypes.embeddingSumT == tensorDtypes.wordEmbeddingT if present.embeddingSumT else true",
124
  "maskIndexShapeOk": "ranks.maskIndexT == 1 and dim(shapes.maskIndexT, 0) == batchSize if present.maskIndexT else true",
125
  "embedContractOk": "epsilonOk and tableShapeOk and segmentContract and positionIdsContract and maskContract and maskIndexTypeOk and ioShapeOk and embeddingSumContract and maskIndexShapeOk and batchSize > 0 and sequenceLength > 0",
126
- "dispatchFits": "tunables.WORKGROUP_SIZE <= device.limits.maxComputeInvocationsPerWorkgroup and tunables.MASK_WORKGROUP_SIZE <= device.limits.maxComputeInvocationsPerWorkgroup"
127
- },
128
- "constants": {
129
  "aScalar": "dtypes.T",
130
  "scalar": "dtypes.T",
131
- "usesF16": "dtypes.T == \"f16\"",
132
- "hidden": "hidden",
133
- "sequenceLength": "sequenceLength",
134
  "epsilon": "epsilonValue",
135
  "workgroupSize": "tunables.WORKGROUP_SIZE",
136
  "maskWorkgroupSize": "tunables.MASK_WORKGROUP_SIZE",
@@ -140,1567 +69,1013 @@
140
  "hasSegment": "present.segmentEmbeddingT",
141
  "hasSegmentIds": "present.segmentIdsT",
142
  "hasPositionIds": "present.positionIdsT",
143
- "broadcastPositionIds": "broadcastPositionIds",
144
  "writeEmbeddingSum": "present.embeddingSumT",
145
  "hasMask": "present.maskT",
146
  "HIDDEN_LEN": "hidden"
147
  },
148
- "bindingSets": {
149
- "embed_noseg_nopos_nosum": [
150
- {
151
- "name": "input_ids",
152
- "arg": "inputIdsT",
153
- "semantic": "input_ids",
154
- "buffer": { "type": "read-only-storage" },
155
- "elementType": "i32"
156
- },
157
- {
158
- "name": "word_embedding",
159
- "arg": "wordEmbeddingT",
160
- "semantic": "word_embedding",
161
- "buffer": { "type": "read-only-storage" },
162
- "elementType": "$aScalar"
163
- },
164
- {
165
- "name": "position_embedding",
166
- "arg": "positionEmbeddingT",
167
- "semantic": "position_embedding",
168
- "buffer": { "type": "read-only-storage" },
169
- "elementType": "$aScalar"
170
- },
171
- {
172
- "name": "output",
173
- "arg": "outputT",
174
- "semantic": "output",
175
- "buffer": { "type": "storage" },
176
- "elementType": "$aScalar"
177
- },
178
- {
179
- "name": "params",
180
- "semantic": "kernel.params",
181
- "buffer": { "type": "uniform" },
182
- "struct": { "name": "Params", "fields": [{ "name": "tokens", "type": "u32", "value": "tokens" }] }
183
- }
184
- ],
185
- "embed_noseg_nopos_sum": [
186
- {
187
- "name": "input_ids",
188
- "arg": "inputIdsT",
189
- "semantic": "input_ids",
190
- "buffer": { "type": "read-only-storage" },
191
- "elementType": "i32"
192
- },
193
- {
194
- "name": "word_embedding",
195
- "arg": "wordEmbeddingT",
196
- "semantic": "word_embedding",
197
- "buffer": { "type": "read-only-storage" },
198
- "elementType": "$aScalar"
199
- },
200
- {
201
- "name": "position_embedding",
202
- "arg": "positionEmbeddingT",
203
- "semantic": "position_embedding",
204
- "buffer": { "type": "read-only-storage" },
205
- "elementType": "$aScalar"
206
- },
207
- {
208
- "name": "output",
209
- "arg": "outputT",
210
- "semantic": "output",
211
- "buffer": { "type": "storage" },
212
- "elementType": "$aScalar"
213
- },
214
- {
215
- "name": "embedding_sum",
216
- "arg": "embeddingSumT",
217
- "semantic": "embedding_sum",
218
- "buffer": { "type": "storage" },
219
- "elementType": "$aScalar"
220
- },
221
- {
222
- "name": "params",
223
- "semantic": "kernel.params",
224
- "buffer": { "type": "uniform" },
225
- "struct": { "name": "Params", "fields": [{ "name": "tokens", "type": "u32", "value": "tokens" }] }
226
- }
227
- ],
228
- "embed_noseg_posids_nosum": [
229
- {
230
- "name": "input_ids",
231
- "arg": "inputIdsT",
232
- "semantic": "input_ids",
233
- "buffer": { "type": "read-only-storage" },
234
- "elementType": "i32"
235
- },
236
- {
237
- "name": "position_ids",
238
- "arg": "positionIdsT",
239
- "semantic": "position_ids",
240
- "buffer": { "type": "read-only-storage" },
241
- "elementType": "i32"
242
- },
243
- {
244
- "name": "word_embedding",
245
- "arg": "wordEmbeddingT",
246
- "semantic": "word_embedding",
247
- "buffer": { "type": "read-only-storage" },
248
- "elementType": "$aScalar"
249
- },
250
- {
251
- "name": "position_embedding",
252
- "arg": "positionEmbeddingT",
253
- "semantic": "position_embedding",
254
- "buffer": { "type": "read-only-storage" },
255
- "elementType": "$aScalar"
256
- },
257
- {
258
- "name": "output",
259
- "arg": "outputT",
260
- "semantic": "output",
261
- "buffer": { "type": "storage" },
262
- "elementType": "$aScalar"
263
- },
264
- {
265
- "name": "params",
266
- "semantic": "kernel.params",
267
- "buffer": { "type": "uniform" },
268
- "struct": { "name": "Params", "fields": [{ "name": "tokens", "type": "u32", "value": "tokens" }] }
269
- }
270
- ],
271
- "embed_noseg_posids_sum": [
272
- {
273
- "name": "input_ids",
274
- "arg": "inputIdsT",
275
- "semantic": "input_ids",
276
- "buffer": { "type": "read-only-storage" },
277
- "elementType": "i32"
278
- },
279
- {
280
- "name": "position_ids",
281
- "arg": "positionIdsT",
282
- "semantic": "position_ids",
283
- "buffer": { "type": "read-only-storage" },
284
- "elementType": "i32"
285
- },
286
- {
287
- "name": "word_embedding",
288
- "arg": "wordEmbeddingT",
289
- "semantic": "word_embedding",
290
- "buffer": { "type": "read-only-storage" },
291
- "elementType": "$aScalar"
292
- },
293
- {
294
- "name": "position_embedding",
295
- "arg": "positionEmbeddingT",
296
- "semantic": "position_embedding",
297
- "buffer": { "type": "read-only-storage" },
298
- "elementType": "$aScalar"
299
- },
300
- {
301
- "name": "output",
302
- "arg": "outputT",
303
- "semantic": "output",
304
- "buffer": { "type": "storage" },
305
- "elementType": "$aScalar"
306
- },
307
- {
308
- "name": "embedding_sum",
309
- "arg": "embeddingSumT",
310
- "semantic": "embedding_sum",
311
- "buffer": { "type": "storage" },
312
- "elementType": "$aScalar"
313
- },
314
- {
315
- "name": "params",
316
- "semantic": "kernel.params",
317
- "buffer": { "type": "uniform" },
318
- "struct": { "name": "Params", "fields": [{ "name": "tokens", "type": "u32", "value": "tokens" }] }
319
- }
320
- ],
321
- "embed_segdefault_nopos_nosum": [
322
- {
323
- "name": "input_ids",
324
- "arg": "inputIdsT",
325
- "semantic": "input_ids",
326
- "buffer": { "type": "read-only-storage" },
327
- "elementType": "i32"
328
- },
329
- {
330
- "name": "word_embedding",
331
- "arg": "wordEmbeddingT",
332
- "semantic": "word_embedding",
333
- "buffer": { "type": "read-only-storage" },
334
- "elementType": "$aScalar"
335
- },
336
- {
337
- "name": "position_embedding",
338
- "arg": "positionEmbeddingT",
339
- "semantic": "position_embedding",
340
- "buffer": { "type": "read-only-storage" },
341
- "elementType": "$aScalar"
342
- },
343
- {
344
- "name": "segment_embedding",
345
- "arg": "segmentEmbeddingT",
346
- "semantic": "segment_embedding",
347
- "buffer": { "type": "read-only-storage" },
348
- "elementType": "$aScalar"
349
- },
350
- {
351
- "name": "output",
352
- "arg": "outputT",
353
- "semantic": "output",
354
- "buffer": { "type": "storage" },
355
- "elementType": "$aScalar"
356
- },
357
- {
358
- "name": "params",
359
- "semantic": "kernel.params",
360
- "buffer": { "type": "uniform" },
361
- "struct": { "name": "Params", "fields": [{ "name": "tokens", "type": "u32", "value": "tokens" }] }
362
- }
363
- ],
364
- "embed_segdefault_nopos_sum": [
365
- {
366
- "name": "input_ids",
367
- "arg": "inputIdsT",
368
- "semantic": "input_ids",
369
- "buffer": { "type": "read-only-storage" },
370
- "elementType": "i32"
371
- },
372
- {
373
- "name": "word_embedding",
374
- "arg": "wordEmbeddingT",
375
- "semantic": "word_embedding",
376
- "buffer": { "type": "read-only-storage" },
377
- "elementType": "$aScalar"
378
- },
379
- {
380
- "name": "position_embedding",
381
- "arg": "positionEmbeddingT",
382
- "semantic": "position_embedding",
383
- "buffer": { "type": "read-only-storage" },
384
- "elementType": "$aScalar"
385
- },
386
- {
387
- "name": "segment_embedding",
388
- "arg": "segmentEmbeddingT",
389
- "semantic": "segment_embedding",
390
- "buffer": { "type": "read-only-storage" },
391
- "elementType": "$aScalar"
392
- },
393
- {
394
- "name": "output",
395
- "arg": "outputT",
396
- "semantic": "output",
397
- "buffer": { "type": "storage" },
398
- "elementType": "$aScalar"
399
- },
400
- {
401
- "name": "embedding_sum",
402
- "arg": "embeddingSumT",
403
- "semantic": "embedding_sum",
404
- "buffer": { "type": "storage" },
405
- "elementType": "$aScalar"
406
- },
407
- {
408
- "name": "params",
409
- "semantic": "kernel.params",
410
- "buffer": { "type": "uniform" },
411
- "struct": { "name": "Params", "fields": [{ "name": "tokens", "type": "u32", "value": "tokens" }] }
412
- }
413
- ],
414
- "embed_segdefault_posids_nosum": [
415
- {
416
- "name": "input_ids",
417
- "arg": "inputIdsT",
418
- "semantic": "input_ids",
419
- "buffer": { "type": "read-only-storage" },
420
- "elementType": "i32"
421
- },
422
- {
423
- "name": "position_ids",
424
- "arg": "positionIdsT",
425
- "semantic": "position_ids",
426
- "buffer": { "type": "read-only-storage" },
427
- "elementType": "i32"
428
- },
429
- {
430
- "name": "word_embedding",
431
- "arg": "wordEmbeddingT",
432
- "semantic": "word_embedding",
433
- "buffer": { "type": "read-only-storage" },
434
- "elementType": "$aScalar"
435
- },
436
- {
437
- "name": "position_embedding",
438
- "arg": "positionEmbeddingT",
439
- "semantic": "position_embedding",
440
- "buffer": { "type": "read-only-storage" },
441
- "elementType": "$aScalar"
442
- },
443
- {
444
- "name": "segment_embedding",
445
- "arg": "segmentEmbeddingT",
446
- "semantic": "segment_embedding",
447
- "buffer": { "type": "read-only-storage" },
448
- "elementType": "$aScalar"
449
- },
450
- {
451
- "name": "output",
452
- "arg": "outputT",
453
- "semantic": "output",
454
- "buffer": { "type": "storage" },
455
- "elementType": "$aScalar"
456
- },
457
- {
458
- "name": "params",
459
- "semantic": "kernel.params",
460
- "buffer": { "type": "uniform" },
461
- "struct": { "name": "Params", "fields": [{ "name": "tokens", "type": "u32", "value": "tokens" }] }
462
- }
463
- ],
464
- "embed_segdefault_posids_sum": [
465
- {
466
- "name": "input_ids",
467
- "arg": "inputIdsT",
468
- "semantic": "input_ids",
469
- "buffer": { "type": "read-only-storage" },
470
- "elementType": "i32"
471
- },
472
- {
473
- "name": "position_ids",
474
- "arg": "positionIdsT",
475
- "semantic": "position_ids",
476
- "buffer": { "type": "read-only-storage" },
477
- "elementType": "i32"
478
- },
479
- {
480
- "name": "word_embedding",
481
- "arg": "wordEmbeddingT",
482
- "semantic": "word_embedding",
483
- "buffer": { "type": "read-only-storage" },
484
- "elementType": "$aScalar"
485
- },
486
- {
487
- "name": "position_embedding",
488
- "arg": "positionEmbeddingT",
489
- "semantic": "position_embedding",
490
- "buffer": { "type": "read-only-storage" },
491
- "elementType": "$aScalar"
492
- },
493
- {
494
- "name": "segment_embedding",
495
- "arg": "segmentEmbeddingT",
496
- "semantic": "segment_embedding",
497
- "buffer": { "type": "read-only-storage" },
498
- "elementType": "$aScalar"
499
- },
500
- {
501
- "name": "output",
502
- "arg": "outputT",
503
- "semantic": "output",
504
- "buffer": { "type": "storage" },
505
- "elementType": "$aScalar"
506
- },
507
- {
508
- "name": "embedding_sum",
509
- "arg": "embeddingSumT",
510
- "semantic": "embedding_sum",
511
- "buffer": { "type": "storage" },
512
- "elementType": "$aScalar"
513
- },
514
- {
515
- "name": "params",
516
- "semantic": "kernel.params",
517
- "buffer": { "type": "uniform" },
518
- "struct": { "name": "Params", "fields": [{ "name": "tokens", "type": "u32", "value": "tokens" }] }
519
- }
520
- ],
521
- "embed_seg_nopos_nosum": [
522
- {
523
- "name": "input_ids",
524
- "arg": "inputIdsT",
525
- "semantic": "input_ids",
526
- "buffer": { "type": "read-only-storage" },
527
- "elementType": "i32"
528
- },
529
- {
530
- "name": "segment_ids",
531
- "arg": "segmentIdsT",
532
- "semantic": "segment_ids",
533
- "buffer": { "type": "read-only-storage" },
534
- "elementType": "i32"
535
- },
536
- {
537
- "name": "word_embedding",
538
- "arg": "wordEmbeddingT",
539
- "semantic": "word_embedding",
540
- "buffer": { "type": "read-only-storage" },
541
- "elementType": "$aScalar"
542
- },
543
- {
544
- "name": "position_embedding",
545
- "arg": "positionEmbeddingT",
546
- "semantic": "position_embedding",
547
- "buffer": { "type": "read-only-storage" },
548
- "elementType": "$aScalar"
549
- },
550
- {
551
- "name": "segment_embedding",
552
- "arg": "segmentEmbeddingT",
553
- "semantic": "segment_embedding",
554
- "buffer": { "type": "read-only-storage" },
555
- "elementType": "$aScalar"
556
- },
557
- {
558
- "name": "output",
559
- "arg": "outputT",
560
- "semantic": "output",
561
- "buffer": { "type": "storage" },
562
- "elementType": "$aScalar"
563
- },
564
- {
565
- "name": "params",
566
- "semantic": "kernel.params",
567
- "buffer": { "type": "uniform" },
568
- "struct": { "name": "Params", "fields": [{ "name": "tokens", "type": "u32", "value": "tokens" }] }
569
- }
570
- ],
571
- "embed_seg_nopos_sum": [
572
- {
573
- "name": "input_ids",
574
- "arg": "inputIdsT",
575
- "semantic": "input_ids",
576
- "buffer": { "type": "read-only-storage" },
577
- "elementType": "i32"
578
- },
579
- {
580
- "name": "segment_ids",
581
- "arg": "segmentIdsT",
582
- "semantic": "segment_ids",
583
- "buffer": { "type": "read-only-storage" },
584
- "elementType": "i32"
585
- },
586
- {
587
- "name": "word_embedding",
588
- "arg": "wordEmbeddingT",
589
- "semantic": "word_embedding",
590
- "buffer": { "type": "read-only-storage" },
591
- "elementType": "$aScalar"
592
- },
593
- {
594
- "name": "position_embedding",
595
- "arg": "positionEmbeddingT",
596
- "semantic": "position_embedding",
597
- "buffer": { "type": "read-only-storage" },
598
- "elementType": "$aScalar"
599
- },
600
- {
601
- "name": "segment_embedding",
602
- "arg": "segmentEmbeddingT",
603
- "semantic": "segment_embedding",
604
- "buffer": { "type": "read-only-storage" },
605
- "elementType": "$aScalar"
606
- },
607
- {
608
- "name": "output",
609
- "arg": "outputT",
610
- "semantic": "output",
611
- "buffer": { "type": "storage" },
612
- "elementType": "$aScalar"
613
- },
614
- {
615
- "name": "embedding_sum",
616
- "arg": "embeddingSumT",
617
- "semantic": "embedding_sum",
618
- "buffer": { "type": "storage" },
619
- "elementType": "$aScalar"
620
- },
621
- {
622
- "name": "params",
623
- "semantic": "kernel.params",
624
- "buffer": { "type": "uniform" },
625
- "struct": { "name": "Params", "fields": [{ "name": "tokens", "type": "u32", "value": "tokens" }] }
626
- }
627
- ],
628
- "embed_seg_posids_nosum": [
629
- {
630
- "name": "input_ids",
631
- "arg": "inputIdsT",
632
- "semantic": "input_ids",
633
- "buffer": { "type": "read-only-storage" },
634
- "elementType": "i32"
635
- },
636
- {
637
- "name": "segment_ids",
638
- "arg": "segmentIdsT",
639
- "semantic": "segment_ids",
640
- "buffer": { "type": "read-only-storage" },
641
- "elementType": "i32"
642
- },
643
- {
644
- "name": "position_ids",
645
- "arg": "positionIdsT",
646
- "semantic": "position_ids",
647
- "buffer": { "type": "read-only-storage" },
648
- "elementType": "i32"
649
- },
650
- {
651
- "name": "word_embedding",
652
- "arg": "wordEmbeddingT",
653
- "semantic": "word_embedding",
654
- "buffer": { "type": "read-only-storage" },
655
- "elementType": "$aScalar"
656
- },
657
- {
658
- "name": "position_embedding",
659
- "arg": "positionEmbeddingT",
660
- "semantic": "position_embedding",
661
- "buffer": { "type": "read-only-storage" },
662
- "elementType": "$aScalar"
663
- },
664
- {
665
- "name": "segment_embedding",
666
- "arg": "segmentEmbeddingT",
667
- "semantic": "segment_embedding",
668
- "buffer": { "type": "read-only-storage" },
669
- "elementType": "$aScalar"
670
- },
671
- {
672
- "name": "output",
673
- "arg": "outputT",
674
- "semantic": "output",
675
- "buffer": { "type": "storage" },
676
- "elementType": "$aScalar"
677
- },
678
- {
679
- "name": "params",
680
- "semantic": "kernel.params",
681
- "buffer": { "type": "uniform" },
682
- "struct": { "name": "Params", "fields": [{ "name": "tokens", "type": "u32", "value": "tokens" }] }
683
- }
684
- ],
685
- "embed_seg_posids_sum": [
686
- {
687
- "name": "input_ids",
688
- "arg": "inputIdsT",
689
- "semantic": "input_ids",
690
- "buffer": { "type": "read-only-storage" },
691
- "elementType": "i32"
692
- },
693
- {
694
- "name": "segment_ids",
695
- "arg": "segmentIdsT",
696
- "semantic": "segment_ids",
697
- "buffer": { "type": "read-only-storage" },
698
- "elementType": "i32"
699
- },
700
- {
701
- "name": "position_ids",
702
- "arg": "positionIdsT",
703
- "semantic": "position_ids",
704
- "buffer": { "type": "read-only-storage" },
705
- "elementType": "i32"
706
- },
707
- {
708
- "name": "word_embedding",
709
- "arg": "wordEmbeddingT",
710
- "semantic": "word_embedding",
711
- "buffer": { "type": "read-only-storage" },
712
- "elementType": "$aScalar"
713
- },
714
- {
715
- "name": "position_embedding",
716
- "arg": "positionEmbeddingT",
717
- "semantic": "position_embedding",
718
- "buffer": { "type": "read-only-storage" },
719
- "elementType": "$aScalar"
720
- },
721
- {
722
- "name": "segment_embedding",
723
- "arg": "segmentEmbeddingT",
724
- "semantic": "segment_embedding",
725
- "buffer": { "type": "read-only-storage" },
726
- "elementType": "$aScalar"
727
- },
728
- {
729
- "name": "output",
730
- "arg": "outputT",
731
- "semantic": "output",
732
- "buffer": { "type": "storage" },
733
- "elementType": "$aScalar"
734
- },
735
- {
736
- "name": "embedding_sum",
737
- "arg": "embeddingSumT",
738
- "semantic": "embedding_sum",
739
- "buffer": { "type": "storage" },
740
- "elementType": "$aScalar"
741
- },
742
- {
743
- "name": "params",
744
- "semantic": "kernel.params",
745
- "buffer": { "type": "uniform" },
746
- "struct": { "name": "Params", "fields": [{ "name": "tokens", "type": "u32", "value": "tokens" }] }
747
- }
748
- ],
749
- "normalizeSet": [
750
- {
751
- "name": "output",
752
- "arg": "outputT",
753
- "semantic": "output",
754
- "buffer": { "type": "storage" },
755
- "elementType": "$aScalar"
756
- },
757
- {
758
- "name": "gamma",
759
- "arg": "gammaT",
760
- "semantic": "gamma",
761
- "buffer": { "type": "read-only-storage" },
762
- "elementType": "$aScalar",
763
- "length": "$HIDDEN_LEN"
764
- },
765
- {
766
- "name": "beta",
767
- "arg": "betaT",
768
- "semantic": "beta",
769
- "buffer": { "type": "read-only-storage" },
770
- "elementType": "$aScalar",
771
- "length": "$HIDDEN_LEN"
772
- },
773
- {
774
- "name": "params",
775
- "semantic": "kernel.params",
776
- "buffer": { "type": "uniform" },
777
- "struct": { "name": "Params", "fields": [{ "name": "tokens", "type": "u32", "value": "tokens" }] }
778
- }
779
- ],
780
- "maskIndexSet": [
781
- {
782
- "name": "mask",
783
- "arg": "maskT",
784
- "semantic": "mask",
785
- "buffer": { "type": "read-only-storage" },
786
- "elementType": "i32"
787
- },
788
- {
789
- "name": "mask_index",
790
- "arg": "maskIndexT",
791
- "semantic": "mask_index",
792
- "buffer": { "type": "storage" },
793
- "elementType": "i32"
794
- },
795
- {
796
- "name": "params",
797
- "semantic": "kernel.params",
798
- "buffer": { "type": "uniform" },
799
- "struct": { "name": "Params", "fields": [{ "name": "batch", "type": "u32", "value": "batchSize" }] }
800
- }
801
- ],
802
- "zeroMaskIndexSet": [
803
- {
804
- "name": "mask_index",
805
- "arg": "maskIndexT",
806
- "semantic": "mask_index",
807
- "buffer": { "type": "storage" },
808
- "elementType": "i32"
809
- },
810
- {
811
- "name": "params",
812
- "semantic": "kernel.params",
813
- "buffer": { "type": "uniform" },
814
- "struct": { "name": "Params", "fields": [{ "name": "batch", "type": "u32", "value": "batchSize" }] }
815
- }
816
- ]
817
  },
818
  "variants": [
819
  {
820
  "id": "noseg_nopos_nosum_nomask",
821
- "when": ["embedContractOk", "dispatchFits", "not present.segmentEmbeddingT", "not present.positionIdsT", "not present.embeddingSumT", "not present.maskIndexT"],
822
  "passes": [
823
  {
824
  "id": "sum",
825
  "name": "EmbedLayerNormalization.EmbeddingSum",
826
  "shader": "embed-sum.wgsl.jinja",
827
- "bindings": "embed_noseg_nopos_nosum",
828
- "dispatch": { "workgroups": "tokens" }
829
  },
830
  {
831
  "id": "normalize",
832
  "name": "EmbedLayerNormalization.Normalize",
833
  "shader": "embed-normalize.wgsl.jinja",
834
- "bindings": "normalizeSet",
835
- "dispatch": { "workgroups": "tokens" }
836
  }
837
  ]
838
  },
839
  {
840
  "id": "noseg_nopos_nosum_mask",
841
- "when": ["embedContractOk", "dispatchFits", "not present.segmentEmbeddingT", "not present.positionIdsT", "not present.embeddingSumT", "present.maskIndexT", "present.maskT"],
842
  "passes": [
843
  {
844
  "id": "sum",
845
  "name": "EmbedLayerNormalization.EmbeddingSum",
846
  "shader": "embed-sum.wgsl.jinja",
847
- "bindings": "embed_noseg_nopos_nosum",
848
- "dispatch": { "workgroups": "tokens" }
849
  },
850
  {
851
  "id": "normalize",
852
  "name": "EmbedLayerNormalization.Normalize",
853
  "shader": "embed-normalize.wgsl.jinja",
854
- "bindings": "normalizeSet",
855
- "dispatch": { "workgroups": "tokens" }
856
  },
857
  {
858
  "id": "maskIndex",
859
  "name": "EmbedLayerNormalization.MaskIndex",
860
  "shader": "embed-mask-index.wgsl.jinja",
861
- "bindings": "maskIndexSet",
862
- "dispatch": { "threads": "batchSize", "workgroupSize": "tunables.MASK_WORKGROUP_SIZE" }
 
 
 
 
863
  }
864
  ]
865
  },
866
  {
867
  "id": "noseg_nopos_sum_nomask",
868
- "when": ["embedContractOk", "dispatchFits", "not present.segmentEmbeddingT", "not present.positionIdsT", "present.embeddingSumT", "not present.maskIndexT"],
869
  "passes": [
870
  {
871
  "id": "sum",
872
  "name": "EmbedLayerNormalization.EmbeddingSum",
873
  "shader": "embed-sum.wgsl.jinja",
874
- "bindings": "embed_noseg_nopos_sum",
875
- "dispatch": { "workgroups": "tokens" }
876
  },
877
  {
878
  "id": "normalize",
879
  "name": "EmbedLayerNormalization.Normalize",
880
  "shader": "embed-normalize.wgsl.jinja",
881
- "bindings": "normalizeSet",
882
- "dispatch": { "workgroups": "tokens" }
883
  }
884
  ]
885
  },
886
  {
887
  "id": "noseg_nopos_sum_mask",
888
- "when": ["embedContractOk", "dispatchFits", "not present.segmentEmbeddingT", "not present.positionIdsT", "present.embeddingSumT", "present.maskIndexT", "present.maskT"],
889
  "passes": [
890
  {
891
  "id": "sum",
892
  "name": "EmbedLayerNormalization.EmbeddingSum",
893
  "shader": "embed-sum.wgsl.jinja",
894
- "bindings": "embed_noseg_nopos_sum",
895
- "dispatch": { "workgroups": "tokens" }
896
  },
897
  {
898
  "id": "normalize",
899
  "name": "EmbedLayerNormalization.Normalize",
900
  "shader": "embed-normalize.wgsl.jinja",
901
- "bindings": "normalizeSet",
902
- "dispatch": { "workgroups": "tokens" }
903
  },
904
  {
905
  "id": "maskIndex",
906
  "name": "EmbedLayerNormalization.MaskIndex",
907
  "shader": "embed-mask-index.wgsl.jinja",
908
- "bindings": "maskIndexSet",
909
- "dispatch": { "threads": "batchSize", "workgroupSize": "tunables.MASK_WORKGROUP_SIZE" }
 
 
 
 
910
  }
911
  ]
912
  },
913
  {
914
  "id": "noseg_posids_nosum_nomask",
915
- "when": ["embedContractOk", "dispatchFits", "not present.segmentEmbeddingT", "present.positionIdsT", "not present.embeddingSumT", "not present.maskIndexT"],
916
  "passes": [
917
  {
918
  "id": "sum",
919
  "name": "EmbedLayerNormalization.EmbeddingSum",
920
  "shader": "embed-sum.wgsl.jinja",
921
- "bindings": "embed_noseg_posids_nosum",
922
- "dispatch": { "workgroups": "tokens" }
923
  },
924
  {
925
  "id": "normalize",
926
  "name": "EmbedLayerNormalization.Normalize",
927
  "shader": "embed-normalize.wgsl.jinja",
928
- "bindings": "normalizeSet",
929
- "dispatch": { "workgroups": "tokens" }
930
  }
931
  ]
932
  },
933
  {
934
  "id": "noseg_posids_nosum_mask",
935
- "when": ["embedContractOk", "dispatchFits", "not present.segmentEmbeddingT", "present.positionIdsT", "not present.embeddingSumT", "present.maskIndexT", "present.maskT"],
936
  "passes": [
937
  {
938
  "id": "sum",
939
  "name": "EmbedLayerNormalization.EmbeddingSum",
940
  "shader": "embed-sum.wgsl.jinja",
941
- "bindings": "embed_noseg_posids_nosum",
942
- "dispatch": { "workgroups": "tokens" }
943
  },
944
  {
945
  "id": "normalize",
946
  "name": "EmbedLayerNormalization.Normalize",
947
  "shader": "embed-normalize.wgsl.jinja",
948
- "bindings": "normalizeSet",
949
- "dispatch": { "workgroups": "tokens" }
950
  },
951
  {
952
  "id": "maskIndex",
953
  "name": "EmbedLayerNormalization.MaskIndex",
954
  "shader": "embed-mask-index.wgsl.jinja",
955
- "bindings": "maskIndexSet",
956
- "dispatch": { "threads": "batchSize", "workgroupSize": "tunables.MASK_WORKGROUP_SIZE" }
 
 
 
 
957
  }
958
  ]
959
  },
960
  {
961
  "id": "noseg_posids_sum_nomask",
962
- "when": ["embedContractOk", "dispatchFits", "not present.segmentEmbeddingT", "present.positionIdsT", "present.embeddingSumT", "not present.maskIndexT"],
963
  "passes": [
964
  {
965
  "id": "sum",
966
  "name": "EmbedLayerNormalization.EmbeddingSum",
967
  "shader": "embed-sum.wgsl.jinja",
968
- "bindings": "embed_noseg_posids_sum",
969
- "dispatch": { "workgroups": "tokens" }
970
  },
971
  {
972
  "id": "normalize",
973
  "name": "EmbedLayerNormalization.Normalize",
974
  "shader": "embed-normalize.wgsl.jinja",
975
- "bindings": "normalizeSet",
976
- "dispatch": { "workgroups": "tokens" }
977
  }
978
  ]
979
  },
980
  {
981
  "id": "noseg_posids_sum_mask",
982
- "when": ["embedContractOk", "dispatchFits", "not present.segmentEmbeddingT", "present.positionIdsT", "present.embeddingSumT", "present.maskIndexT", "present.maskT"],
983
  "passes": [
984
  {
985
  "id": "sum",
986
  "name": "EmbedLayerNormalization.EmbeddingSum",
987
  "shader": "embed-sum.wgsl.jinja",
988
- "bindings": "embed_noseg_posids_sum",
989
- "dispatch": { "workgroups": "tokens" }
990
  },
991
  {
992
  "id": "normalize",
993
  "name": "EmbedLayerNormalization.Normalize",
994
  "shader": "embed-normalize.wgsl.jinja",
995
- "bindings": "normalizeSet",
996
- "dispatch": { "workgroups": "tokens" }
997
  },
998
  {
999
  "id": "maskIndex",
1000
  "name": "EmbedLayerNormalization.MaskIndex",
1001
  "shader": "embed-mask-index.wgsl.jinja",
1002
- "bindings": "maskIndexSet",
1003
- "dispatch": { "threads": "batchSize", "workgroupSize": "tunables.MASK_WORKGROUP_SIZE" }
 
 
 
 
1004
  }
1005
  ]
1006
  },
1007
  {
1008
  "id": "seg_nopos_nosum_nomask",
1009
- "when": ["embedContractOk", "dispatchFits", "present.segmentEmbeddingT", "present.segmentIdsT", "not present.positionIdsT", "not present.embeddingSumT", "not present.maskIndexT"],
1010
  "passes": [
1011
  {
1012
  "id": "sum",
1013
  "name": "EmbedLayerNormalization.EmbeddingSum",
1014
  "shader": "embed-sum.wgsl.jinja",
1015
- "bindings": "embed_seg_nopos_nosum",
1016
- "dispatch": { "workgroups": "tokens" }
1017
  },
1018
  {
1019
  "id": "normalize",
1020
  "name": "EmbedLayerNormalization.Normalize",
1021
  "shader": "embed-normalize.wgsl.jinja",
1022
- "bindings": "normalizeSet",
1023
- "dispatch": { "workgroups": "tokens" }
1024
  }
1025
  ]
1026
  },
1027
  {
1028
  "id": "seg_nopos_nosum_mask",
1029
- "when": ["embedContractOk", "dispatchFits", "present.segmentEmbeddingT", "present.segmentIdsT", "not present.positionIdsT", "not present.embeddingSumT", "present.maskIndexT", "present.maskT"],
1030
  "passes": [
1031
  {
1032
  "id": "sum",
1033
  "name": "EmbedLayerNormalization.EmbeddingSum",
1034
  "shader": "embed-sum.wgsl.jinja",
1035
- "bindings": "embed_seg_nopos_nosum",
1036
- "dispatch": { "workgroups": "tokens" }
1037
  },
1038
  {
1039
  "id": "normalize",
1040
  "name": "EmbedLayerNormalization.Normalize",
1041
  "shader": "embed-normalize.wgsl.jinja",
1042
- "bindings": "normalizeSet",
1043
- "dispatch": { "workgroups": "tokens" }
1044
  },
1045
  {
1046
  "id": "maskIndex",
1047
  "name": "EmbedLayerNormalization.MaskIndex",
1048
  "shader": "embed-mask-index.wgsl.jinja",
1049
- "bindings": "maskIndexSet",
1050
- "dispatch": { "threads": "batchSize", "workgroupSize": "tunables.MASK_WORKGROUP_SIZE" }
 
 
 
 
1051
  }
1052
  ]
1053
  },
1054
  {
1055
  "id": "seg_nopos_sum_nomask",
1056
- "when": ["embedContractOk", "dispatchFits", "present.segmentEmbeddingT", "present.segmentIdsT", "not present.positionIdsT", "present.embeddingSumT", "not present.maskIndexT"],
1057
  "passes": [
1058
  {
1059
  "id": "sum",
1060
  "name": "EmbedLayerNormalization.EmbeddingSum",
1061
  "shader": "embed-sum.wgsl.jinja",
1062
- "bindings": "embed_seg_nopos_sum",
1063
- "dispatch": { "workgroups": "tokens" }
1064
  },
1065
  {
1066
  "id": "normalize",
1067
  "name": "EmbedLayerNormalization.Normalize",
1068
  "shader": "embed-normalize.wgsl.jinja",
1069
- "bindings": "normalizeSet",
1070
- "dispatch": { "workgroups": "tokens" }
1071
  }
1072
  ]
1073
  },
1074
  {
1075
  "id": "seg_nopos_sum_mask",
1076
- "when": ["embedContractOk", "dispatchFits", "present.segmentEmbeddingT", "present.segmentIdsT", "not present.positionIdsT", "present.embeddingSumT", "present.maskIndexT", "present.maskT"],
1077
  "passes": [
1078
  {
1079
  "id": "sum",
1080
  "name": "EmbedLayerNormalization.EmbeddingSum",
1081
  "shader": "embed-sum.wgsl.jinja",
1082
- "bindings": "embed_seg_nopos_sum",
1083
- "dispatch": { "workgroups": "tokens" }
1084
  },
1085
  {
1086
  "id": "normalize",
1087
  "name": "EmbedLayerNormalization.Normalize",
1088
  "shader": "embed-normalize.wgsl.jinja",
1089
- "bindings": "normalizeSet",
1090
- "dispatch": { "workgroups": "tokens" }
1091
  },
1092
  {
1093
  "id": "maskIndex",
1094
  "name": "EmbedLayerNormalization.MaskIndex",
1095
  "shader": "embed-mask-index.wgsl.jinja",
1096
- "bindings": "maskIndexSet",
1097
- "dispatch": { "threads": "batchSize", "workgroupSize": "tunables.MASK_WORKGROUP_SIZE" }
 
 
 
 
1098
  }
1099
  ]
1100
  },
1101
  {
1102
  "id": "seg_posids_nosum_nomask",
1103
- "when": ["embedContractOk", "dispatchFits", "present.segmentEmbeddingT", "present.segmentIdsT", "present.positionIdsT", "not present.embeddingSumT", "not present.maskIndexT"],
1104
  "passes": [
1105
  {
1106
  "id": "sum",
1107
  "name": "EmbedLayerNormalization.EmbeddingSum",
1108
  "shader": "embed-sum.wgsl.jinja",
1109
- "bindings": "embed_seg_posids_nosum",
1110
- "dispatch": { "workgroups": "tokens" }
1111
  },
1112
  {
1113
  "id": "normalize",
1114
  "name": "EmbedLayerNormalization.Normalize",
1115
  "shader": "embed-normalize.wgsl.jinja",
1116
- "bindings": "normalizeSet",
1117
- "dispatch": { "workgroups": "tokens" }
1118
  }
1119
  ]
1120
  },
1121
  {
1122
  "id": "seg_posids_nosum_mask",
1123
- "when": ["embedContractOk", "dispatchFits", "present.segmentEmbeddingT", "present.segmentIdsT", "present.positionIdsT", "not present.embeddingSumT", "present.maskIndexT", "present.maskT"],
1124
  "passes": [
1125
  {
1126
  "id": "sum",
1127
  "name": "EmbedLayerNormalization.EmbeddingSum",
1128
  "shader": "embed-sum.wgsl.jinja",
1129
- "bindings": "embed_seg_posids_nosum",
1130
- "dispatch": { "workgroups": "tokens" }
1131
  },
1132
  {
1133
  "id": "normalize",
1134
  "name": "EmbedLayerNormalization.Normalize",
1135
  "shader": "embed-normalize.wgsl.jinja",
1136
- "bindings": "normalizeSet",
1137
- "dispatch": { "workgroups": "tokens" }
1138
  },
1139
  {
1140
  "id": "maskIndex",
1141
  "name": "EmbedLayerNormalization.MaskIndex",
1142
  "shader": "embed-mask-index.wgsl.jinja",
1143
- "bindings": "maskIndexSet",
1144
- "dispatch": { "threads": "batchSize", "workgroupSize": "tunables.MASK_WORKGROUP_SIZE" }
 
 
 
 
1145
  }
1146
  ]
1147
  },
1148
  {
1149
  "id": "seg_posids_sum_nomask",
1150
- "when": ["embedContractOk", "dispatchFits", "present.segmentEmbeddingT", "present.segmentIdsT", "present.positionIdsT", "present.embeddingSumT", "not present.maskIndexT"],
1151
  "passes": [
1152
  {
1153
  "id": "sum",
1154
  "name": "EmbedLayerNormalization.EmbeddingSum",
1155
  "shader": "embed-sum.wgsl.jinja",
1156
- "bindings": "embed_seg_posids_sum",
1157
- "dispatch": { "workgroups": "tokens" }
1158
  },
1159
  {
1160
  "id": "normalize",
1161
  "name": "EmbedLayerNormalization.Normalize",
1162
  "shader": "embed-normalize.wgsl.jinja",
1163
- "bindings": "normalizeSet",
1164
- "dispatch": { "workgroups": "tokens" }
1165
  }
1166
  ]
1167
  },
1168
  {
1169
  "id": "seg_posids_sum_mask",
1170
- "when": ["embedContractOk", "dispatchFits", "present.segmentEmbeddingT", "present.segmentIdsT", "present.positionIdsT", "present.embeddingSumT", "present.maskIndexT", "present.maskT"],
1171
  "passes": [
1172
  {
1173
  "id": "sum",
1174
  "name": "EmbedLayerNormalization.EmbeddingSum",
1175
  "shader": "embed-sum.wgsl.jinja",
1176
- "bindings": "embed_seg_posids_sum",
1177
- "dispatch": { "workgroups": "tokens" }
1178
  },
1179
  {
1180
  "id": "normalize",
1181
  "name": "EmbedLayerNormalization.Normalize",
1182
  "shader": "embed-normalize.wgsl.jinja",
1183
- "bindings": "normalizeSet",
1184
- "dispatch": { "workgroups": "tokens" }
1185
  },
1186
  {
1187
  "id": "maskIndex",
1188
  "name": "EmbedLayerNormalization.MaskIndex",
1189
  "shader": "embed-mask-index.wgsl.jinja",
1190
- "bindings": "maskIndexSet",
1191
- "dispatch": { "threads": "batchSize", "workgroupSize": "tunables.MASK_WORKGROUP_SIZE" }
 
 
 
 
1192
  }
1193
  ]
1194
  },
1195
  {
1196
  "id": "segdefault_nopos_nosum_nomask",
1197
- "when": ["embedContractOk", "dispatchFits", "present.segmentEmbeddingT", "not present.segmentIdsT", "present.positionIdsT == (\"nopos\" == \"posids\")", "present.embeddingSumT == (\"nosum\" == \"sum\")", "not present.maskIndexT"],
1198
  "passes": [
1199
  {
1200
  "id": "sum",
1201
  "name": "EmbedLayerNormalization.EmbeddingSum",
1202
  "shader": "embed-sum.wgsl.jinja",
1203
- "bindings": "embed_segdefault_nopos_nosum",
1204
- "dispatch": { "workgroups": "tokens" }
1205
  },
1206
  {
1207
  "id": "normalize",
1208
  "name": "EmbedLayerNormalization.Normalize",
1209
  "shader": "embed-normalize.wgsl.jinja",
1210
- "bindings": "normalizeSet",
1211
- "dispatch": { "workgroups": "tokens" }
1212
  }
1213
  ]
1214
  },
1215
  {
1216
  "id": "segdefault_nopos_nosum_mask",
1217
- "when": ["embedContractOk", "dispatchFits", "present.segmentEmbeddingT", "not present.segmentIdsT", "present.positionIdsT == (\"nopos\" == \"posids\")", "present.embeddingSumT == (\"nosum\" == \"sum\")", "present.maskIndexT", "present.maskT"],
1218
  "passes": [
1219
  {
1220
  "id": "sum",
1221
  "name": "EmbedLayerNormalization.EmbeddingSum",
1222
  "shader": "embed-sum.wgsl.jinja",
1223
- "bindings": "embed_segdefault_nopos_nosum",
1224
- "dispatch": { "workgroups": "tokens" }
1225
  },
1226
  {
1227
  "id": "normalize",
1228
  "name": "EmbedLayerNormalization.Normalize",
1229
  "shader": "embed-normalize.wgsl.jinja",
1230
- "bindings": "normalizeSet",
1231
- "dispatch": { "workgroups": "tokens" }
1232
  },
1233
  {
1234
  "id": "maskIndex",
1235
  "name": "EmbedLayerNormalization.MaskIndex",
1236
  "shader": "embed-mask-index.wgsl.jinja",
1237
- "bindings": "maskIndexSet",
1238
- "dispatch": { "threads": "batchSize", "workgroupSize": "tunables.MASK_WORKGROUP_SIZE" }
 
 
 
 
1239
  }
1240
  ]
1241
  },
1242
  {
1243
  "id": "segdefault_nopos_sum_nomask",
1244
- "when": ["embedContractOk", "dispatchFits", "present.segmentEmbeddingT", "not present.segmentIdsT", "present.positionIdsT == (\"nopos\" == \"posids\")", "present.embeddingSumT == (\"sum\" == \"sum\")", "not present.maskIndexT"],
1245
  "passes": [
1246
  {
1247
  "id": "sum",
1248
  "name": "EmbedLayerNormalization.EmbeddingSum",
1249
  "shader": "embed-sum.wgsl.jinja",
1250
- "bindings": "embed_segdefault_nopos_sum",
1251
- "dispatch": { "workgroups": "tokens" }
1252
  },
1253
  {
1254
  "id": "normalize",
1255
  "name": "EmbedLayerNormalization.Normalize",
1256
  "shader": "embed-normalize.wgsl.jinja",
1257
- "bindings": "normalizeSet",
1258
- "dispatch": { "workgroups": "tokens" }
1259
  }
1260
  ]
1261
  },
1262
  {
1263
  "id": "segdefault_nopos_sum_mask",
1264
- "when": ["embedContractOk", "dispatchFits", "present.segmentEmbeddingT", "not present.segmentIdsT", "present.positionIdsT == (\"nopos\" == \"posids\")", "present.embeddingSumT == (\"sum\" == \"sum\")", "present.maskIndexT", "present.maskT"],
1265
  "passes": [
1266
  {
1267
  "id": "sum",
1268
  "name": "EmbedLayerNormalization.EmbeddingSum",
1269
  "shader": "embed-sum.wgsl.jinja",
1270
- "bindings": "embed_segdefault_nopos_sum",
1271
- "dispatch": { "workgroups": "tokens" }
1272
  },
1273
  {
1274
  "id": "normalize",
1275
  "name": "EmbedLayerNormalization.Normalize",
1276
  "shader": "embed-normalize.wgsl.jinja",
1277
- "bindings": "normalizeSet",
1278
- "dispatch": { "workgroups": "tokens" }
1279
  },
1280
  {
1281
  "id": "maskIndex",
1282
  "name": "EmbedLayerNormalization.MaskIndex",
1283
  "shader": "embed-mask-index.wgsl.jinja",
1284
- "bindings": "maskIndexSet",
1285
- "dispatch": { "threads": "batchSize", "workgroupSize": "tunables.MASK_WORKGROUP_SIZE" }
 
 
 
 
1286
  }
1287
  ]
1288
  },
1289
  {
1290
  "id": "segdefault_posids_nosum_nomask",
1291
- "when": ["embedContractOk", "dispatchFits", "present.segmentEmbeddingT", "not present.segmentIdsT", "present.positionIdsT == (\"posids\" == \"posids\")", "present.embeddingSumT == (\"nosum\" == \"sum\")", "not present.maskIndexT"],
1292
  "passes": [
1293
  {
1294
  "id": "sum",
1295
  "name": "EmbedLayerNormalization.EmbeddingSum",
1296
  "shader": "embed-sum.wgsl.jinja",
1297
- "bindings": "embed_segdefault_posids_nosum",
1298
- "dispatch": { "workgroups": "tokens" }
1299
  },
1300
  {
1301
  "id": "normalize",
1302
  "name": "EmbedLayerNormalization.Normalize",
1303
  "shader": "embed-normalize.wgsl.jinja",
1304
- "bindings": "normalizeSet",
1305
- "dispatch": { "workgroups": "tokens" }
1306
  }
1307
  ]
1308
  },
1309
  {
1310
  "id": "segdefault_posids_nosum_mask",
1311
- "when": ["embedContractOk", "dispatchFits", "present.segmentEmbeddingT", "not present.segmentIdsT", "present.positionIdsT == (\"posids\" == \"posids\")", "present.embeddingSumT == (\"nosum\" == \"sum\")", "present.maskIndexT", "present.maskT"],
1312
  "passes": [
1313
  {
1314
  "id": "sum",
1315
  "name": "EmbedLayerNormalization.EmbeddingSum",
1316
  "shader": "embed-sum.wgsl.jinja",
1317
- "bindings": "embed_segdefault_posids_nosum",
1318
- "dispatch": { "workgroups": "tokens" }
1319
  },
1320
  {
1321
  "id": "normalize",
1322
  "name": "EmbedLayerNormalization.Normalize",
1323
  "shader": "embed-normalize.wgsl.jinja",
1324
- "bindings": "normalizeSet",
1325
- "dispatch": { "workgroups": "tokens" }
1326
  },
1327
  {
1328
  "id": "maskIndex",
1329
  "name": "EmbedLayerNormalization.MaskIndex",
1330
  "shader": "embed-mask-index.wgsl.jinja",
1331
- "bindings": "maskIndexSet",
1332
- "dispatch": { "threads": "batchSize", "workgroupSize": "tunables.MASK_WORKGROUP_SIZE" }
 
 
 
 
1333
  }
1334
  ]
1335
  },
1336
  {
1337
  "id": "segdefault_posids_sum_nomask",
1338
- "when": ["embedContractOk", "dispatchFits", "present.segmentEmbeddingT", "not present.segmentIdsT", "present.positionIdsT == (\"posids\" == \"posids\")", "present.embeddingSumT == (\"sum\" == \"sum\")", "not present.maskIndexT"],
1339
  "passes": [
1340
  {
1341
  "id": "sum",
1342
  "name": "EmbedLayerNormalization.EmbeddingSum",
1343
  "shader": "embed-sum.wgsl.jinja",
1344
- "bindings": "embed_segdefault_posids_sum",
1345
- "dispatch": { "workgroups": "tokens" }
1346
  },
1347
  {
1348
  "id": "normalize",
1349
  "name": "EmbedLayerNormalization.Normalize",
1350
  "shader": "embed-normalize.wgsl.jinja",
1351
- "bindings": "normalizeSet",
1352
- "dispatch": { "workgroups": "tokens" }
1353
  }
1354
  ]
1355
  },
1356
  {
1357
  "id": "segdefault_posids_sum_mask",
1358
- "when": ["embedContractOk", "dispatchFits", "present.segmentEmbeddingT", "not present.segmentIdsT", "present.positionIdsT == (\"posids\" == \"posids\")", "present.embeddingSumT == (\"sum\" == \"sum\")", "present.maskIndexT", "present.maskT"],
1359
  "passes": [
1360
  {
1361
  "id": "sum",
1362
  "name": "EmbedLayerNormalization.EmbeddingSum",
1363
  "shader": "embed-sum.wgsl.jinja",
1364
- "bindings": "embed_segdefault_posids_sum",
1365
- "dispatch": { "workgroups": "tokens" }
1366
  },
1367
  {
1368
  "id": "normalize",
1369
  "name": "EmbedLayerNormalization.Normalize",
1370
  "shader": "embed-normalize.wgsl.jinja",
1371
- "bindings": "normalizeSet",
1372
- "dispatch": { "workgroups": "tokens" }
1373
  },
1374
  {
1375
  "id": "maskIndex",
1376
  "name": "EmbedLayerNormalization.MaskIndex",
1377
  "shader": "embed-mask-index.wgsl.jinja",
1378
- "bindings": "maskIndexSet",
1379
- "dispatch": { "threads": "batchSize", "workgroupSize": "tunables.MASK_WORKGROUP_SIZE" }
 
 
 
 
1380
  }
1381
  ]
1382
  },
1383
  {
1384
  "id": "noseg_nopos_nosum_mask_without_input",
1385
- "when": ["embedContractOk", "dispatchFits", "present.segmentEmbeddingT == (\"noseg\" != \"noseg\")", "present.segmentIdsT == (\"noseg\" == \"seg\")", "present.positionIdsT == (\"nopos\" == \"posids\")", "present.embeddingSumT == (\"nosum\" == \"sum\")", "present.maskIndexT", "not present.maskT"],
1386
  "passes": [
1387
  {
1388
  "id": "sum",
1389
  "name": "EmbedLayerNormalization.EmbeddingSum",
1390
  "shader": "embed-sum.wgsl.jinja",
1391
- "bindings": "embed_noseg_nopos_nosum",
1392
- "dispatch": { "workgroups": "tokens" }
1393
  },
1394
  {
1395
  "id": "normalize",
1396
  "name": "EmbedLayerNormalization.Normalize",
1397
  "shader": "embed-normalize.wgsl.jinja",
1398
- "bindings": "normalizeSet",
1399
- "dispatch": { "workgroups": "tokens" }
1400
  },
1401
  {
1402
  "id": "maskIndex",
1403
  "name": "EmbedLayerNormalization.ZeroMaskIndex",
1404
  "shader": "embed-mask-index.wgsl.jinja",
1405
- "bindings": "zeroMaskIndexSet",
1406
- "dispatch": { "threads": "batchSize", "workgroupSize": "tunables.MASK_WORKGROUP_SIZE" }
 
 
 
 
1407
  }
1408
  ]
1409
  },
1410
  {
1411
  "id": "noseg_nopos_sum_mask_without_input",
1412
- "when": ["embedContractOk", "dispatchFits", "present.segmentEmbeddingT == (\"noseg\" != \"noseg\")", "present.segmentIdsT == (\"noseg\" == \"seg\")", "present.positionIdsT == (\"nopos\" == \"posids\")", "present.embeddingSumT == (\"sum\" == \"sum\")", "present.maskIndexT", "not present.maskT"],
1413
  "passes": [
1414
  {
1415
  "id": "sum",
1416
  "name": "EmbedLayerNormalization.EmbeddingSum",
1417
  "shader": "embed-sum.wgsl.jinja",
1418
- "bindings": "embed_noseg_nopos_sum",
1419
- "dispatch": { "workgroups": "tokens" }
1420
  },
1421
  {
1422
  "id": "normalize",
1423
  "name": "EmbedLayerNormalization.Normalize",
1424
  "shader": "embed-normalize.wgsl.jinja",
1425
- "bindings": "normalizeSet",
1426
- "dispatch": { "workgroups": "tokens" }
1427
  },
1428
  {
1429
  "id": "maskIndex",
1430
  "name": "EmbedLayerNormalization.ZeroMaskIndex",
1431
  "shader": "embed-mask-index.wgsl.jinja",
1432
- "bindings": "zeroMaskIndexSet",
1433
- "dispatch": { "threads": "batchSize", "workgroupSize": "tunables.MASK_WORKGROUP_SIZE" }
 
 
 
 
1434
  }
1435
  ]
1436
  },
1437
  {
1438
  "id": "noseg_posids_nosum_mask_without_input",
1439
- "when": ["embedContractOk", "dispatchFits", "present.segmentEmbeddingT == (\"noseg\" != \"noseg\")", "present.segmentIdsT == (\"noseg\" == \"seg\")", "present.positionIdsT == (\"posids\" == \"posids\")", "present.embeddingSumT == (\"nosum\" == \"sum\")", "present.maskIndexT", "not present.maskT"],
1440
  "passes": [
1441
  {
1442
  "id": "sum",
1443
  "name": "EmbedLayerNormalization.EmbeddingSum",
1444
  "shader": "embed-sum.wgsl.jinja",
1445
- "bindings": "embed_noseg_posids_nosum",
1446
- "dispatch": { "workgroups": "tokens" }
1447
  },
1448
  {
1449
  "id": "normalize",
1450
  "name": "EmbedLayerNormalization.Normalize",
1451
  "shader": "embed-normalize.wgsl.jinja",
1452
- "bindings": "normalizeSet",
1453
- "dispatch": { "workgroups": "tokens" }
1454
  },
1455
  {
1456
  "id": "maskIndex",
1457
  "name": "EmbedLayerNormalization.ZeroMaskIndex",
1458
  "shader": "embed-mask-index.wgsl.jinja",
1459
- "bindings": "zeroMaskIndexSet",
1460
- "dispatch": { "threads": "batchSize", "workgroupSize": "tunables.MASK_WORKGROUP_SIZE" }
 
 
 
 
1461
  }
1462
  ]
1463
  },
1464
  {
1465
  "id": "noseg_posids_sum_mask_without_input",
1466
- "when": ["embedContractOk", "dispatchFits", "present.segmentEmbeddingT == (\"noseg\" != \"noseg\")", "present.segmentIdsT == (\"noseg\" == \"seg\")", "present.positionIdsT == (\"posids\" == \"posids\")", "present.embeddingSumT == (\"sum\" == \"sum\")", "present.maskIndexT", "not present.maskT"],
1467
  "passes": [
1468
  {
1469
  "id": "sum",
1470
  "name": "EmbedLayerNormalization.EmbeddingSum",
1471
  "shader": "embed-sum.wgsl.jinja",
1472
- "bindings": "embed_noseg_posids_sum",
1473
- "dispatch": { "workgroups": "tokens" }
1474
  },
1475
  {
1476
  "id": "normalize",
1477
  "name": "EmbedLayerNormalization.Normalize",
1478
  "shader": "embed-normalize.wgsl.jinja",
1479
- "bindings": "normalizeSet",
1480
- "dispatch": { "workgroups": "tokens" }
1481
  },
1482
  {
1483
  "id": "maskIndex",
1484
  "name": "EmbedLayerNormalization.ZeroMaskIndex",
1485
  "shader": "embed-mask-index.wgsl.jinja",
1486
- "bindings": "zeroMaskIndexSet",
1487
- "dispatch": { "threads": "batchSize", "workgroupSize": "tunables.MASK_WORKGROUP_SIZE" }
 
 
 
 
1488
  }
1489
  ]
1490
  },
1491
  {
1492
  "id": "segdefault_nopos_nosum_mask_without_input",
1493
- "when": ["embedContractOk", "dispatchFits", "present.segmentEmbeddingT == (\"segdefault\" != \"noseg\")", "present.segmentIdsT == (\"segdefault\" == \"seg\")", "present.positionIdsT == (\"nopos\" == \"posids\")", "present.embeddingSumT == (\"nosum\" == \"sum\")", "present.maskIndexT", "not present.maskT"],
1494
  "passes": [
1495
  {
1496
  "id": "sum",
1497
  "name": "EmbedLayerNormalization.EmbeddingSum",
1498
  "shader": "embed-sum.wgsl.jinja",
1499
- "bindings": "embed_segdefault_nopos_nosum",
1500
- "dispatch": { "workgroups": "tokens" }
1501
  },
1502
  {
1503
  "id": "normalize",
1504
  "name": "EmbedLayerNormalization.Normalize",
1505
  "shader": "embed-normalize.wgsl.jinja",
1506
- "bindings": "normalizeSet",
1507
- "dispatch": { "workgroups": "tokens" }
1508
  },
1509
  {
1510
  "id": "maskIndex",
1511
  "name": "EmbedLayerNormalization.ZeroMaskIndex",
1512
  "shader": "embed-mask-index.wgsl.jinja",
1513
- "bindings": "zeroMaskIndexSet",
1514
- "dispatch": { "threads": "batchSize", "workgroupSize": "tunables.MASK_WORKGROUP_SIZE" }
 
 
 
 
1515
  }
1516
  ]
1517
  },
1518
  {
1519
  "id": "segdefault_nopos_sum_mask_without_input",
1520
- "when": ["embedContractOk", "dispatchFits", "present.segmentEmbeddingT == (\"segdefault\" != \"noseg\")", "present.segmentIdsT == (\"segdefault\" == \"seg\")", "present.positionIdsT == (\"nopos\" == \"posids\")", "present.embeddingSumT == (\"sum\" == \"sum\")", "present.maskIndexT", "not present.maskT"],
1521
  "passes": [
1522
  {
1523
  "id": "sum",
1524
  "name": "EmbedLayerNormalization.EmbeddingSum",
1525
  "shader": "embed-sum.wgsl.jinja",
1526
- "bindings": "embed_segdefault_nopos_sum",
1527
- "dispatch": { "workgroups": "tokens" }
1528
  },
1529
  {
1530
  "id": "normalize",
1531
  "name": "EmbedLayerNormalization.Normalize",
1532
  "shader": "embed-normalize.wgsl.jinja",
1533
- "bindings": "normalizeSet",
1534
- "dispatch": { "workgroups": "tokens" }
1535
  },
1536
  {
1537
  "id": "maskIndex",
1538
  "name": "EmbedLayerNormalization.ZeroMaskIndex",
1539
  "shader": "embed-mask-index.wgsl.jinja",
1540
- "bindings": "zeroMaskIndexSet",
1541
- "dispatch": { "threads": "batchSize", "workgroupSize": "tunables.MASK_WORKGROUP_SIZE" }
 
 
 
 
1542
  }
1543
  ]
1544
  },
1545
  {
1546
  "id": "segdefault_posids_nosum_mask_without_input",
1547
- "when": ["embedContractOk", "dispatchFits", "present.segmentEmbeddingT == (\"segdefault\" != \"noseg\")", "present.segmentIdsT == (\"segdefault\" == \"seg\")", "present.positionIdsT == (\"posids\" == \"posids\")", "present.embeddingSumT == (\"nosum\" == \"sum\")", "present.maskIndexT", "not present.maskT"],
1548
  "passes": [
1549
  {
1550
  "id": "sum",
1551
  "name": "EmbedLayerNormalization.EmbeddingSum",
1552
  "shader": "embed-sum.wgsl.jinja",
1553
- "bindings": "embed_segdefault_posids_nosum",
1554
- "dispatch": { "workgroups": "tokens" }
1555
  },
1556
  {
1557
  "id": "normalize",
1558
  "name": "EmbedLayerNormalization.Normalize",
1559
  "shader": "embed-normalize.wgsl.jinja",
1560
- "bindings": "normalizeSet",
1561
- "dispatch": { "workgroups": "tokens" }
1562
  },
1563
  {
1564
  "id": "maskIndex",
1565
  "name": "EmbedLayerNormalization.ZeroMaskIndex",
1566
  "shader": "embed-mask-index.wgsl.jinja",
1567
- "bindings": "zeroMaskIndexSet",
1568
- "dispatch": { "threads": "batchSize", "workgroupSize": "tunables.MASK_WORKGROUP_SIZE" }
 
 
 
 
1569
  }
1570
  ]
1571
  },
1572
  {
1573
  "id": "segdefault_posids_sum_mask_without_input",
1574
- "when": ["embedContractOk", "dispatchFits", "present.segmentEmbeddingT == (\"segdefault\" != \"noseg\")", "present.segmentIdsT == (\"segdefault\" == \"seg\")", "present.positionIdsT == (\"posids\" == \"posids\")", "present.embeddingSumT == (\"sum\" == \"sum\")", "present.maskIndexT", "not present.maskT"],
1575
  "passes": [
1576
  {
1577
  "id": "sum",
1578
  "name": "EmbedLayerNormalization.EmbeddingSum",
1579
  "shader": "embed-sum.wgsl.jinja",
1580
- "bindings": "embed_segdefault_posids_sum",
1581
- "dispatch": { "workgroups": "tokens" }
1582
  },
1583
  {
1584
  "id": "normalize",
1585
  "name": "EmbedLayerNormalization.Normalize",
1586
  "shader": "embed-normalize.wgsl.jinja",
1587
- "bindings": "normalizeSet",
1588
- "dispatch": { "workgroups": "tokens" }
1589
  },
1590
  {
1591
  "id": "maskIndex",
1592
  "name": "EmbedLayerNormalization.ZeroMaskIndex",
1593
  "shader": "embed-mask-index.wgsl.jinja",
1594
- "bindings": "zeroMaskIndexSet",
1595
- "dispatch": { "threads": "batchSize", "workgroupSize": "tunables.MASK_WORKGROUP_SIZE" }
 
 
 
 
1596
  }
1597
  ]
1598
  },
1599
  {
1600
  "id": "seg_nopos_nosum_mask_without_input",
1601
- "when": ["embedContractOk", "dispatchFits", "present.segmentEmbeddingT == (\"seg\" != \"noseg\")", "present.segmentIdsT == (\"seg\" == \"seg\")", "present.positionIdsT == (\"nopos\" == \"posids\")", "present.embeddingSumT == (\"nosum\" == \"sum\")", "present.maskIndexT", "not present.maskT"],
1602
  "passes": [
1603
  {
1604
  "id": "sum",
1605
  "name": "EmbedLayerNormalization.EmbeddingSum",
1606
  "shader": "embed-sum.wgsl.jinja",
1607
- "bindings": "embed_seg_nopos_nosum",
1608
- "dispatch": { "workgroups": "tokens" }
1609
  },
1610
  {
1611
  "id": "normalize",
1612
  "name": "EmbedLayerNormalization.Normalize",
1613
  "shader": "embed-normalize.wgsl.jinja",
1614
- "bindings": "normalizeSet",
1615
- "dispatch": { "workgroups": "tokens" }
1616
  },
1617
  {
1618
  "id": "maskIndex",
1619
  "name": "EmbedLayerNormalization.ZeroMaskIndex",
1620
  "shader": "embed-mask-index.wgsl.jinja",
1621
- "bindings": "zeroMaskIndexSet",
1622
- "dispatch": { "threads": "batchSize", "workgroupSize": "tunables.MASK_WORKGROUP_SIZE" }
 
 
 
 
1623
  }
1624
  ]
1625
  },
1626
  {
1627
  "id": "seg_nopos_sum_mask_without_input",
1628
- "when": ["embedContractOk", "dispatchFits", "present.segmentEmbeddingT == (\"seg\" != \"noseg\")", "present.segmentIdsT == (\"seg\" == \"seg\")", "present.positionIdsT == (\"nopos\" == \"posids\")", "present.embeddingSumT == (\"sum\" == \"sum\")", "present.maskIndexT", "not present.maskT"],
1629
  "passes": [
1630
  {
1631
  "id": "sum",
1632
  "name": "EmbedLayerNormalization.EmbeddingSum",
1633
  "shader": "embed-sum.wgsl.jinja",
1634
- "bindings": "embed_seg_nopos_sum",
1635
- "dispatch": { "workgroups": "tokens" }
1636
  },
1637
  {
1638
  "id": "normalize",
1639
  "name": "EmbedLayerNormalization.Normalize",
1640
  "shader": "embed-normalize.wgsl.jinja",
1641
- "bindings": "normalizeSet",
1642
- "dispatch": { "workgroups": "tokens" }
1643
  },
1644
  {
1645
  "id": "maskIndex",
1646
  "name": "EmbedLayerNormalization.ZeroMaskIndex",
1647
  "shader": "embed-mask-index.wgsl.jinja",
1648
- "bindings": "zeroMaskIndexSet",
1649
- "dispatch": { "threads": "batchSize", "workgroupSize": "tunables.MASK_WORKGROUP_SIZE" }
 
 
 
 
1650
  }
1651
  ]
1652
  },
1653
  {
1654
  "id": "seg_posids_nosum_mask_without_input",
1655
- "when": ["embedContractOk", "dispatchFits", "present.segmentEmbeddingT == (\"seg\" != \"noseg\")", "present.segmentIdsT == (\"seg\" == \"seg\")", "present.positionIdsT == (\"posids\" == \"posids\")", "present.embeddingSumT == (\"nosum\" == \"sum\")", "present.maskIndexT", "not present.maskT"],
1656
  "passes": [
1657
  {
1658
  "id": "sum",
1659
  "name": "EmbedLayerNormalization.EmbeddingSum",
1660
  "shader": "embed-sum.wgsl.jinja",
1661
- "bindings": "embed_seg_posids_nosum",
1662
- "dispatch": { "workgroups": "tokens" }
1663
  },
1664
  {
1665
  "id": "normalize",
1666
  "name": "EmbedLayerNormalization.Normalize",
1667
  "shader": "embed-normalize.wgsl.jinja",
1668
- "bindings": "normalizeSet",
1669
- "dispatch": { "workgroups": "tokens" }
1670
  },
1671
  {
1672
  "id": "maskIndex",
1673
  "name": "EmbedLayerNormalization.ZeroMaskIndex",
1674
  "shader": "embed-mask-index.wgsl.jinja",
1675
- "bindings": "zeroMaskIndexSet",
1676
- "dispatch": { "threads": "batchSize", "workgroupSize": "tunables.MASK_WORKGROUP_SIZE" }
 
 
 
 
1677
  }
1678
  ]
1679
  },
1680
  {
1681
  "id": "seg_posids_sum_mask_without_input",
1682
- "when": ["embedContractOk", "dispatchFits", "present.segmentEmbeddingT == (\"seg\" != \"noseg\")", "present.segmentIdsT == (\"seg\" == \"seg\")", "present.positionIdsT == (\"posids\" == \"posids\")", "present.embeddingSumT == (\"sum\" == \"sum\")", "present.maskIndexT", "not present.maskT"],
1683
  "passes": [
1684
  {
1685
  "id": "sum",
1686
  "name": "EmbedLayerNormalization.EmbeddingSum",
1687
  "shader": "embed-sum.wgsl.jinja",
1688
- "bindings": "embed_seg_posids_sum",
1689
- "dispatch": { "workgroups": "tokens" }
1690
  },
1691
  {
1692
  "id": "normalize",
1693
  "name": "EmbedLayerNormalization.Normalize",
1694
  "shader": "embed-normalize.wgsl.jinja",
1695
- "bindings": "normalizeSet",
1696
- "dispatch": { "workgroups": "tokens" }
1697
  },
1698
  {
1699
  "id": "maskIndex",
1700
  "name": "EmbedLayerNormalization.ZeroMaskIndex",
1701
  "shader": "embed-mask-index.wgsl.jinja",
1702
- "bindings": "zeroMaskIndexSet",
1703
- "dispatch": { "threads": "batchSize", "workgroupSize": "tunables.MASK_WORKGROUP_SIZE" }
 
 
 
 
1704
  }
1705
  ]
1706
  }
 
2
  "domain": "com.microsoft",
3
  "name": "EmbedLayerNormalization",
4
  "sinceVersion": 1,
5
+ "inputs": {
6
+ "inputIdsT": { "onnx": "input_ids", "dtype": "T1", "rank": 2, "storage": "int32" },
7
+ "segmentIdsT": { "onnx": "segment_ids", "dtype": "T1", "rank": 2, "optional": true, "storage": "int32" },
8
+ "wordEmbeddingT": { "onnx": "word_embedding", "dtype": "T", "rank": 2 },
9
+ "positionEmbeddingT": { "onnx": "position_embedding", "dtype": "T", "rank": 2 },
10
+ "segmentEmbeddingT": { "onnx": "segment_embedding", "dtype": "T", "rank": 2, "optional": true },
11
+ "gammaT": { "onnx": "gamma", "dtype": "T", "rank": 1 },
12
+ "betaT": { "onnx": "beta", "dtype": "T", "rank": 1 },
13
+ "maskT": { "onnx": "mask", "dtype": "T1", "rank": 2, "optional": true, "storage": "int32" },
14
+ "positionIdsT": { "onnx": "position_ids", "dtype": "T1", "rank": 2, "optional": true, "storage": "int32" }
15
+ },
16
+ "outputs": {
17
+ "outputT": {
18
+ "onnx": "output",
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
19
  "dtype": "T",
20
  "rank": 3,
21
+ "shape": "[dim(shapes.inputIdsT, 0), dim(shapes.inputIdsT, 1), hidden]"
 
22
  },
23
+ "maskIndexT": {
24
+ "onnx": "mask_index",
25
  "dtype": "T1",
26
  "rank": 1,
27
  "optional": true,
28
  "shape": "[dim(shapes.inputIdsT, 0)]",
29
+ "storage": "int32"
30
  },
31
+ "embeddingSumT": {
32
+ "onnx": "embedding_sum",
33
  "dtype": "T",
34
  "rank": 3,
35
  "optional": true,
36
+ "shape": "[dim(shapes.inputIdsT, 0), dim(shapes.inputIdsT, 1), hidden]"
 
37
  }
 
 
 
 
 
38
  },
39
+ "attributes": { "epsilon": { "default": 9.999999960041972e-13 }, "mask_index_type": {} },
40
  "attributeConstraints": { "mask_index_type": { "values": [0, 1] } },
41
  "typeConstraints": { "T": ["float32", "float16"], "T1": ["int32"] },
42
+ "tunables": { "WORKGROUP_SIZE": { "default": 128 }, "MASK_WORKGROUP_SIZE": { "default": 64 } },
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
43
  "derive": {
44
  "batchSize": "dim(shapes.inputIdsT, 0)",
45
  "sequenceLength": "dim(shapes.inputIdsT, 1)",
 
57
  "embeddingSumContract": "ranks.embeddingSumT == 3 and sameShape(shapes.embeddingSumT, shapes.outputT) and tensorDtypes.embeddingSumT == tensorDtypes.wordEmbeddingT if present.embeddingSumT else true",
58
  "maskIndexShapeOk": "ranks.maskIndexT == 1 and dim(shapes.maskIndexT, 0) == batchSize if present.maskIndexT else true",
59
  "embedContractOk": "epsilonOk and tableShapeOk and segmentContract and positionIdsContract and maskContract and maskIndexTypeOk and ioShapeOk and embeddingSumContract and maskIndexShapeOk and batchSize > 0 and sequenceLength > 0",
60
+ "dispatchFits": "tunables.WORKGROUP_SIZE <= device.limits.maxComputeInvocationsPerWorkgroup and tunables.MASK_WORKGROUP_SIZE <= device.limits.maxComputeInvocationsPerWorkgroup",
 
 
61
  "aScalar": "dtypes.T",
62
  "scalar": "dtypes.T",
 
 
 
63
  "epsilon": "epsilonValue",
64
  "workgroupSize": "tunables.WORKGROUP_SIZE",
65
  "maskWorkgroupSize": "tunables.MASK_WORKGROUP_SIZE",
 
69
  "hasSegment": "present.segmentEmbeddingT",
70
  "hasSegmentIds": "present.segmentIdsT",
71
  "hasPositionIds": "present.positionIdsT",
 
72
  "writeEmbeddingSum": "present.embeddingSumT",
73
  "hasMask": "present.maskT",
74
  "HIDDEN_LEN": "hidden"
75
  },
76
+ "when": ["embedContractOk", "dispatchFits"],
77
+ "bindings": {
78
+ "input_ids": { "arg": "inputIdsT", "buffer": "read-only-storage", "elementType": "i32" },
79
+ "word_embedding": { "arg": "wordEmbeddingT", "buffer": "read-only-storage", "elementType": "$aScalar" },
80
+ "position_embedding": { "arg": "positionEmbeddingT", "buffer": "read-only-storage", "elementType": "$aScalar" },
81
+ "output": { "arg": "outputT", "buffer": "storage", "elementType": "$aScalar" },
82
+ "params": { "buffer": "uniform", "struct": [{ "name": "tokens", "type": "u32", "value": "tokens" }] },
83
+ "embedding_sum": { "arg": "embeddingSumT", "buffer": "storage", "elementType": "$aScalar" },
84
+ "position_ids": { "arg": "positionIdsT", "buffer": "read-only-storage", "elementType": "i32" },
85
+ "segment_ids": { "arg": "segmentIdsT", "buffer": "read-only-storage", "elementType": "i32" },
86
+ "segment_embedding": { "arg": "segmentEmbeddingT", "buffer": "read-only-storage", "elementType": "$aScalar" },
87
+ "gamma": { "arg": "gammaT", "buffer": "read-only-storage", "elementType": "$aScalar", "length": "$HIDDEN_LEN" },
88
+ "beta": { "arg": "betaT", "buffer": "read-only-storage", "elementType": "$aScalar", "length": "$HIDDEN_LEN" },
89
+ "mask": { "arg": "maskT", "buffer": "read-only-storage", "elementType": "i32" },
90
+ "mask_index": { "arg": "maskIndexT", "buffer": "storage", "elementType": "i32" },
91
+ "params_2": {
92
+ "name": "params",
93
+ "buffer": "uniform",
94
+ "struct": [{ "name": "batch", "type": "u32", "value": "batchSize" }]
95
+ }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
96
  },
97
  "variants": [
98
  {
99
  "id": "noseg_nopos_nosum_nomask",
100
+ "when": ["not present.segmentEmbeddingT", "not present.positionIdsT", "not present.embeddingSumT", "not present.maskIndexT"],
101
  "passes": [
102
  {
103
  "id": "sum",
104
  "name": "EmbedLayerNormalization.EmbeddingSum",
105
  "shader": "embed-sum.wgsl.jinja",
106
+ "bindings": ["input_ids", "word_embedding", "position_embedding", "output", "params"],
107
+ "dispatch": { "x": "min(tokens, 65535)", "y": "ceilDiv(tokens, 65535)", "z": 1 }
108
  },
109
  {
110
  "id": "normalize",
111
  "name": "EmbedLayerNormalization.Normalize",
112
  "shader": "embed-normalize.wgsl.jinja",
113
+ "bindings": ["output", "gamma", "beta", "params"],
114
+ "dispatch": { "x": "min(tokens, 65535)", "y": "ceilDiv(tokens, 65535)", "z": 1 }
115
  }
116
  ]
117
  },
118
  {
119
  "id": "noseg_nopos_nosum_mask",
120
+ "when": ["not present.segmentEmbeddingT", "not present.positionIdsT", "not present.embeddingSumT", "present.maskIndexT", "present.maskT"],
121
  "passes": [
122
  {
123
  "id": "sum",
124
  "name": "EmbedLayerNormalization.EmbeddingSum",
125
  "shader": "embed-sum.wgsl.jinja",
126
+ "bindings": ["input_ids", "word_embedding", "position_embedding", "output", "params"],
127
+ "dispatch": { "x": "min(tokens, 65535)", "y": "ceilDiv(tokens, 65535)", "z": 1 }
128
  },
129
  {
130
  "id": "normalize",
131
  "name": "EmbedLayerNormalization.Normalize",
132
  "shader": "embed-normalize.wgsl.jinja",
133
+ "bindings": ["output", "gamma", "beta", "params"],
134
+ "dispatch": { "x": "min(tokens, 65535)", "y": "ceilDiv(tokens, 65535)", "z": 1 }
135
  },
136
  {
137
  "id": "maskIndex",
138
  "name": "EmbedLayerNormalization.MaskIndex",
139
  "shader": "embed-mask-index.wgsl.jinja",
140
+ "bindings": ["mask", "mask_index", "params_2"],
141
+ "dispatch": {
142
+ "x": "min(ceilDiv((batchSize), (tunables.MASK_WORKGROUP_SIZE)), 65535)",
143
+ "y": "ceilDiv(ceilDiv((batchSize), (tunables.MASK_WORKGROUP_SIZE)), 65535)",
144
+ "z": 1
145
+ }
146
  }
147
  ]
148
  },
149
  {
150
  "id": "noseg_nopos_sum_nomask",
151
+ "when": ["not present.segmentEmbeddingT", "not present.positionIdsT", "present.embeddingSumT", "not present.maskIndexT"],
152
  "passes": [
153
  {
154
  "id": "sum",
155
  "name": "EmbedLayerNormalization.EmbeddingSum",
156
  "shader": "embed-sum.wgsl.jinja",
157
+ "bindings": ["input_ids", "word_embedding", "position_embedding", "output", "embedding_sum", "params"],
158
+ "dispatch": { "x": "min(tokens, 65535)", "y": "ceilDiv(tokens, 65535)", "z": 1 }
159
  },
160
  {
161
  "id": "normalize",
162
  "name": "EmbedLayerNormalization.Normalize",
163
  "shader": "embed-normalize.wgsl.jinja",
164
+ "bindings": ["output", "gamma", "beta", "params"],
165
+ "dispatch": { "x": "min(tokens, 65535)", "y": "ceilDiv(tokens, 65535)", "z": 1 }
166
  }
167
  ]
168
  },
169
  {
170
  "id": "noseg_nopos_sum_mask",
171
+ "when": ["not present.segmentEmbeddingT", "not present.positionIdsT", "present.embeddingSumT", "present.maskIndexT", "present.maskT"],
172
  "passes": [
173
  {
174
  "id": "sum",
175
  "name": "EmbedLayerNormalization.EmbeddingSum",
176
  "shader": "embed-sum.wgsl.jinja",
177
+ "bindings": ["input_ids", "word_embedding", "position_embedding", "output", "embedding_sum", "params"],
178
+ "dispatch": { "x": "min(tokens, 65535)", "y": "ceilDiv(tokens, 65535)", "z": 1 }
179
  },
180
  {
181
  "id": "normalize",
182
  "name": "EmbedLayerNormalization.Normalize",
183
  "shader": "embed-normalize.wgsl.jinja",
184
+ "bindings": ["output", "gamma", "beta", "params"],
185
+ "dispatch": { "x": "min(tokens, 65535)", "y": "ceilDiv(tokens, 65535)", "z": 1 }
186
  },
187
  {
188
  "id": "maskIndex",
189
  "name": "EmbedLayerNormalization.MaskIndex",
190
  "shader": "embed-mask-index.wgsl.jinja",
191
+ "bindings": ["mask", "mask_index", "params_2"],
192
+ "dispatch": {
193
+ "x": "min(ceilDiv((batchSize), (tunables.MASK_WORKGROUP_SIZE)), 65535)",
194
+ "y": "ceilDiv(ceilDiv((batchSize), (tunables.MASK_WORKGROUP_SIZE)), 65535)",
195
+ "z": 1
196
+ }
197
  }
198
  ]
199
  },
200
  {
201
  "id": "noseg_posids_nosum_nomask",
202
+ "when": ["not present.segmentEmbeddingT", "present.positionIdsT", "not present.embeddingSumT", "not present.maskIndexT"],
203
  "passes": [
204
  {
205
  "id": "sum",
206
  "name": "EmbedLayerNormalization.EmbeddingSum",
207
  "shader": "embed-sum.wgsl.jinja",
208
+ "bindings": ["input_ids", "position_ids", "word_embedding", "position_embedding", "output", "params"],
209
+ "dispatch": { "x": "min(tokens, 65535)", "y": "ceilDiv(tokens, 65535)", "z": 1 }
210
  },
211
  {
212
  "id": "normalize",
213
  "name": "EmbedLayerNormalization.Normalize",
214
  "shader": "embed-normalize.wgsl.jinja",
215
+ "bindings": ["output", "gamma", "beta", "params"],
216
+ "dispatch": { "x": "min(tokens, 65535)", "y": "ceilDiv(tokens, 65535)", "z": 1 }
217
  }
218
  ]
219
  },
220
  {
221
  "id": "noseg_posids_nosum_mask",
222
+ "when": ["not present.segmentEmbeddingT", "present.positionIdsT", "not present.embeddingSumT", "present.maskIndexT", "present.maskT"],
223
  "passes": [
224
  {
225
  "id": "sum",
226
  "name": "EmbedLayerNormalization.EmbeddingSum",
227
  "shader": "embed-sum.wgsl.jinja",
228
+ "bindings": ["input_ids", "position_ids", "word_embedding", "position_embedding", "output", "params"],
229
+ "dispatch": { "x": "min(tokens, 65535)", "y": "ceilDiv(tokens, 65535)", "z": 1 }
230
  },
231
  {
232
  "id": "normalize",
233
  "name": "EmbedLayerNormalization.Normalize",
234
  "shader": "embed-normalize.wgsl.jinja",
235
+ "bindings": ["output", "gamma", "beta", "params"],
236
+ "dispatch": { "x": "min(tokens, 65535)", "y": "ceilDiv(tokens, 65535)", "z": 1 }
237
  },
238
  {
239
  "id": "maskIndex",
240
  "name": "EmbedLayerNormalization.MaskIndex",
241
  "shader": "embed-mask-index.wgsl.jinja",
242
+ "bindings": ["mask", "mask_index", "params_2"],
243
+ "dispatch": {
244
+ "x": "min(ceilDiv((batchSize), (tunables.MASK_WORKGROUP_SIZE)), 65535)",
245
+ "y": "ceilDiv(ceilDiv((batchSize), (tunables.MASK_WORKGROUP_SIZE)), 65535)",
246
+ "z": 1
247
+ }
248
  }
249
  ]
250
  },
251
  {
252
  "id": "noseg_posids_sum_nomask",
253
+ "when": ["not present.segmentEmbeddingT", "present.positionIdsT", "present.embeddingSumT", "not present.maskIndexT"],
254
  "passes": [
255
  {
256
  "id": "sum",
257
  "name": "EmbedLayerNormalization.EmbeddingSum",
258
  "shader": "embed-sum.wgsl.jinja",
259
+ "bindings": ["input_ids", "position_ids", "word_embedding", "position_embedding", "output", "embedding_sum", "params"],
260
+ "dispatch": { "x": "min(tokens, 65535)", "y": "ceilDiv(tokens, 65535)", "z": 1 }
261
  },
262
  {
263
  "id": "normalize",
264
  "name": "EmbedLayerNormalization.Normalize",
265
  "shader": "embed-normalize.wgsl.jinja",
266
+ "bindings": ["output", "gamma", "beta", "params"],
267
+ "dispatch": { "x": "min(tokens, 65535)", "y": "ceilDiv(tokens, 65535)", "z": 1 }
268
  }
269
  ]
270
  },
271
  {
272
  "id": "noseg_posids_sum_mask",
273
+ "when": ["not present.segmentEmbeddingT", "present.positionIdsT", "present.embeddingSumT", "present.maskIndexT", "present.maskT"],
274
  "passes": [
275
  {
276
  "id": "sum",
277
  "name": "EmbedLayerNormalization.EmbeddingSum",
278
  "shader": "embed-sum.wgsl.jinja",
279
+ "bindings": ["input_ids", "position_ids", "word_embedding", "position_embedding", "output", "embedding_sum", "params"],
280
+ "dispatch": { "x": "min(tokens, 65535)", "y": "ceilDiv(tokens, 65535)", "z": 1 }
281
  },
282
  {
283
  "id": "normalize",
284
  "name": "EmbedLayerNormalization.Normalize",
285
  "shader": "embed-normalize.wgsl.jinja",
286
+ "bindings": ["output", "gamma", "beta", "params"],
287
+ "dispatch": { "x": "min(tokens, 65535)", "y": "ceilDiv(tokens, 65535)", "z": 1 }
288
  },
289
  {
290
  "id": "maskIndex",
291
  "name": "EmbedLayerNormalization.MaskIndex",
292
  "shader": "embed-mask-index.wgsl.jinja",
293
+ "bindings": ["mask", "mask_index", "params_2"],
294
+ "dispatch": {
295
+ "x": "min(ceilDiv((batchSize), (tunables.MASK_WORKGROUP_SIZE)), 65535)",
296
+ "y": "ceilDiv(ceilDiv((batchSize), (tunables.MASK_WORKGROUP_SIZE)), 65535)",
297
+ "z": 1
298
+ }
299
  }
300
  ]
301
  },
302
  {
303
  "id": "seg_nopos_nosum_nomask",
304
+ "when": ["present.segmentEmbeddingT", "present.segmentIdsT", "not present.positionIdsT", "not present.embeddingSumT", "not present.maskIndexT"],
305
  "passes": [
306
  {
307
  "id": "sum",
308
  "name": "EmbedLayerNormalization.EmbeddingSum",
309
  "shader": "embed-sum.wgsl.jinja",
310
+ "bindings": ["input_ids", "segment_ids", "word_embedding", "position_embedding", "segment_embedding", "output", "params"],
311
+ "dispatch": { "x": "min(tokens, 65535)", "y": "ceilDiv(tokens, 65535)", "z": 1 }
312
  },
313
  {
314
  "id": "normalize",
315
  "name": "EmbedLayerNormalization.Normalize",
316
  "shader": "embed-normalize.wgsl.jinja",
317
+ "bindings": ["output", "gamma", "beta", "params"],
318
+ "dispatch": { "x": "min(tokens, 65535)", "y": "ceilDiv(tokens, 65535)", "z": 1 }
319
  }
320
  ]
321
  },
322
  {
323
  "id": "seg_nopos_nosum_mask",
324
+ "when": ["present.segmentEmbeddingT", "present.segmentIdsT", "not present.positionIdsT", "not present.embeddingSumT", "present.maskIndexT", "present.maskT"],
325
  "passes": [
326
  {
327
  "id": "sum",
328
  "name": "EmbedLayerNormalization.EmbeddingSum",
329
  "shader": "embed-sum.wgsl.jinja",
330
+ "bindings": ["input_ids", "segment_ids", "word_embedding", "position_embedding", "segment_embedding", "output", "params"],
331
+ "dispatch": { "x": "min(tokens, 65535)", "y": "ceilDiv(tokens, 65535)", "z": 1 }
332
  },
333
  {
334
  "id": "normalize",
335
  "name": "EmbedLayerNormalization.Normalize",
336
  "shader": "embed-normalize.wgsl.jinja",
337
+ "bindings": ["output", "gamma", "beta", "params"],
338
+ "dispatch": { "x": "min(tokens, 65535)", "y": "ceilDiv(tokens, 65535)", "z": 1 }
339
  },
340
  {
341
  "id": "maskIndex",
342
  "name": "EmbedLayerNormalization.MaskIndex",
343
  "shader": "embed-mask-index.wgsl.jinja",
344
+ "bindings": ["mask", "mask_index", "params_2"],
345
+ "dispatch": {
346
+ "x": "min(ceilDiv((batchSize), (tunables.MASK_WORKGROUP_SIZE)), 65535)",
347
+ "y": "ceilDiv(ceilDiv((batchSize), (tunables.MASK_WORKGROUP_SIZE)), 65535)",
348
+ "z": 1
349
+ }
350
  }
351
  ]
352
  },
353
  {
354
  "id": "seg_nopos_sum_nomask",
355
+ "when": ["present.segmentEmbeddingT", "present.segmentIdsT", "not present.positionIdsT", "present.embeddingSumT", "not present.maskIndexT"],
356
  "passes": [
357
  {
358
  "id": "sum",
359
  "name": "EmbedLayerNormalization.EmbeddingSum",
360
  "shader": "embed-sum.wgsl.jinja",
361
+ "bindings": ["input_ids", "segment_ids", "word_embedding", "position_embedding", "segment_embedding", "output", "embedding_sum", "params"],
362
+ "dispatch": { "x": "min(tokens, 65535)", "y": "ceilDiv(tokens, 65535)", "z": 1 }
363
  },
364
  {
365
  "id": "normalize",
366
  "name": "EmbedLayerNormalization.Normalize",
367
  "shader": "embed-normalize.wgsl.jinja",
368
+ "bindings": ["output", "gamma", "beta", "params"],
369
+ "dispatch": { "x": "min(tokens, 65535)", "y": "ceilDiv(tokens, 65535)", "z": 1 }
370
  }
371
  ]
372
  },
373
  {
374
  "id": "seg_nopos_sum_mask",
375
+ "when": ["present.segmentEmbeddingT", "present.segmentIdsT", "not present.positionIdsT", "present.embeddingSumT", "present.maskIndexT", "present.maskT"],
376
  "passes": [
377
  {
378
  "id": "sum",
379
  "name": "EmbedLayerNormalization.EmbeddingSum",
380
  "shader": "embed-sum.wgsl.jinja",
381
+ "bindings": ["input_ids", "segment_ids", "word_embedding", "position_embedding", "segment_embedding", "output", "embedding_sum", "params"],
382
+ "dispatch": { "x": "min(tokens, 65535)", "y": "ceilDiv(tokens, 65535)", "z": 1 }
383
  },
384
  {
385
  "id": "normalize",
386
  "name": "EmbedLayerNormalization.Normalize",
387
  "shader": "embed-normalize.wgsl.jinja",
388
+ "bindings": ["output", "gamma", "beta", "params"],
389
+ "dispatch": { "x": "min(tokens, 65535)", "y": "ceilDiv(tokens, 65535)", "z": 1 }
390
  },
391
  {
392
  "id": "maskIndex",
393
  "name": "EmbedLayerNormalization.MaskIndex",
394
  "shader": "embed-mask-index.wgsl.jinja",
395
+ "bindings": ["mask", "mask_index", "params_2"],
396
+ "dispatch": {
397
+ "x": "min(ceilDiv((batchSize), (tunables.MASK_WORKGROUP_SIZE)), 65535)",
398
+ "y": "ceilDiv(ceilDiv((batchSize), (tunables.MASK_WORKGROUP_SIZE)), 65535)",
399
+ "z": 1
400
+ }
401
  }
402
  ]
403
  },
404
  {
405
  "id": "seg_posids_nosum_nomask",
406
+ "when": ["present.segmentEmbeddingT", "present.segmentIdsT", "present.positionIdsT", "not present.embeddingSumT", "not present.maskIndexT"],
407
  "passes": [
408
  {
409
  "id": "sum",
410
  "name": "EmbedLayerNormalization.EmbeddingSum",
411
  "shader": "embed-sum.wgsl.jinja",
412
+ "bindings": ["input_ids", "segment_ids", "position_ids", "word_embedding", "position_embedding", "segment_embedding", "output", "params"],
413
+ "dispatch": { "x": "min(tokens, 65535)", "y": "ceilDiv(tokens, 65535)", "z": 1 }
414
  },
415
  {
416
  "id": "normalize",
417
  "name": "EmbedLayerNormalization.Normalize",
418
  "shader": "embed-normalize.wgsl.jinja",
419
+ "bindings": ["output", "gamma", "beta", "params"],
420
+ "dispatch": { "x": "min(tokens, 65535)", "y": "ceilDiv(tokens, 65535)", "z": 1 }
421
  }
422
  ]
423
  },
424
  {
425
  "id": "seg_posids_nosum_mask",
426
+ "when": ["present.segmentEmbeddingT", "present.segmentIdsT", "present.positionIdsT", "not present.embeddingSumT", "present.maskIndexT", "present.maskT"],
427
  "passes": [
428
  {
429
  "id": "sum",
430
  "name": "EmbedLayerNormalization.EmbeddingSum",
431
  "shader": "embed-sum.wgsl.jinja",
432
+ "bindings": ["input_ids", "segment_ids", "position_ids", "word_embedding", "position_embedding", "segment_embedding", "output", "params"],
433
+ "dispatch": { "x": "min(tokens, 65535)", "y": "ceilDiv(tokens, 65535)", "z": 1 }
434
  },
435
  {
436
  "id": "normalize",
437
  "name": "EmbedLayerNormalization.Normalize",
438
  "shader": "embed-normalize.wgsl.jinja",
439
+ "bindings": ["output", "gamma", "beta", "params"],
440
+ "dispatch": { "x": "min(tokens, 65535)", "y": "ceilDiv(tokens, 65535)", "z": 1 }
441
  },
442
  {
443
  "id": "maskIndex",
444
  "name": "EmbedLayerNormalization.MaskIndex",
445
  "shader": "embed-mask-index.wgsl.jinja",
446
+ "bindings": ["mask", "mask_index", "params_2"],
447
+ "dispatch": {
448
+ "x": "min(ceilDiv((batchSize), (tunables.MASK_WORKGROUP_SIZE)), 65535)",
449
+ "y": "ceilDiv(ceilDiv((batchSize), (tunables.MASK_WORKGROUP_SIZE)), 65535)",
450
+ "z": 1
451
+ }
452
  }
453
  ]
454
  },
455
  {
456
  "id": "seg_posids_sum_nomask",
457
+ "when": ["present.segmentEmbeddingT", "present.segmentIdsT", "present.positionIdsT", "present.embeddingSumT", "not present.maskIndexT"],
458
  "passes": [
459
  {
460
  "id": "sum",
461
  "name": "EmbedLayerNormalization.EmbeddingSum",
462
  "shader": "embed-sum.wgsl.jinja",
463
+ "bindings": ["input_ids", "segment_ids", "position_ids", "word_embedding", "position_embedding", "segment_embedding", "output", "embedding_sum", "params"],
464
+ "dispatch": { "x": "min(tokens, 65535)", "y": "ceilDiv(tokens, 65535)", "z": 1 }
465
  },
466
  {
467
  "id": "normalize",
468
  "name": "EmbedLayerNormalization.Normalize",
469
  "shader": "embed-normalize.wgsl.jinja",
470
+ "bindings": ["output", "gamma", "beta", "params"],
471
+ "dispatch": { "x": "min(tokens, 65535)", "y": "ceilDiv(tokens, 65535)", "z": 1 }
472
  }
473
  ]
474
  },
475
  {
476
  "id": "seg_posids_sum_mask",
477
+ "when": ["present.segmentEmbeddingT", "present.segmentIdsT", "present.positionIdsT", "present.embeddingSumT", "present.maskIndexT", "present.maskT"],
478
  "passes": [
479
  {
480
  "id": "sum",
481
  "name": "EmbedLayerNormalization.EmbeddingSum",
482
  "shader": "embed-sum.wgsl.jinja",
483
+ "bindings": ["input_ids", "segment_ids", "position_ids", "word_embedding", "position_embedding", "segment_embedding", "output", "embedding_sum", "params"],
484
+ "dispatch": { "x": "min(tokens, 65535)", "y": "ceilDiv(tokens, 65535)", "z": 1 }
485
  },
486
  {
487
  "id": "normalize",
488
  "name": "EmbedLayerNormalization.Normalize",
489
  "shader": "embed-normalize.wgsl.jinja",
490
+ "bindings": ["output", "gamma", "beta", "params"],
491
+ "dispatch": { "x": "min(tokens, 65535)", "y": "ceilDiv(tokens, 65535)", "z": 1 }
492
  },
493
  {
494
  "id": "maskIndex",
495
  "name": "EmbedLayerNormalization.MaskIndex",
496
  "shader": "embed-mask-index.wgsl.jinja",
497
+ "bindings": ["mask", "mask_index", "params_2"],
498
+ "dispatch": {
499
+ "x": "min(ceilDiv((batchSize), (tunables.MASK_WORKGROUP_SIZE)), 65535)",
500
+ "y": "ceilDiv(ceilDiv((batchSize), (tunables.MASK_WORKGROUP_SIZE)), 65535)",
501
+ "z": 1
502
+ }
503
  }
504
  ]
505
  },
506
  {
507
  "id": "segdefault_nopos_nosum_nomask",
508
+ "when": ["present.segmentEmbeddingT", "not present.segmentIdsT", "present.positionIdsT == (\"nopos\" == \"posids\")", "present.embeddingSumT == (\"nosum\" == \"sum\")", "not present.maskIndexT"],
509
  "passes": [
510
  {
511
  "id": "sum",
512
  "name": "EmbedLayerNormalization.EmbeddingSum",
513
  "shader": "embed-sum.wgsl.jinja",
514
+ "bindings": ["input_ids", "word_embedding", "position_embedding", "segment_embedding", "output", "params"],
515
+ "dispatch": { "x": "min(tokens, 65535)", "y": "ceilDiv(tokens, 65535)", "z": 1 }
516
  },
517
  {
518
  "id": "normalize",
519
  "name": "EmbedLayerNormalization.Normalize",
520
  "shader": "embed-normalize.wgsl.jinja",
521
+ "bindings": ["output", "gamma", "beta", "params"],
522
+ "dispatch": { "x": "min(tokens, 65535)", "y": "ceilDiv(tokens, 65535)", "z": 1 }
523
  }
524
  ]
525
  },
526
  {
527
  "id": "segdefault_nopos_nosum_mask",
528
+ "when": ["present.segmentEmbeddingT", "not present.segmentIdsT", "present.positionIdsT == (\"nopos\" == \"posids\")", "present.embeddingSumT == (\"nosum\" == \"sum\")", "present.maskIndexT", "present.maskT"],
529
  "passes": [
530
  {
531
  "id": "sum",
532
  "name": "EmbedLayerNormalization.EmbeddingSum",
533
  "shader": "embed-sum.wgsl.jinja",
534
+ "bindings": ["input_ids", "word_embedding", "position_embedding", "segment_embedding", "output", "params"],
535
+ "dispatch": { "x": "min(tokens, 65535)", "y": "ceilDiv(tokens, 65535)", "z": 1 }
536
  },
537
  {
538
  "id": "normalize",
539
  "name": "EmbedLayerNormalization.Normalize",
540
  "shader": "embed-normalize.wgsl.jinja",
541
+ "bindings": ["output", "gamma", "beta", "params"],
542
+ "dispatch": { "x": "min(tokens, 65535)", "y": "ceilDiv(tokens, 65535)", "z": 1 }
543
  },
544
  {
545
  "id": "maskIndex",
546
  "name": "EmbedLayerNormalization.MaskIndex",
547
  "shader": "embed-mask-index.wgsl.jinja",
548
+ "bindings": ["mask", "mask_index", "params_2"],
549
+ "dispatch": {
550
+ "x": "min(ceilDiv((batchSize), (tunables.MASK_WORKGROUP_SIZE)), 65535)",
551
+ "y": "ceilDiv(ceilDiv((batchSize), (tunables.MASK_WORKGROUP_SIZE)), 65535)",
552
+ "z": 1
553
+ }
554
  }
555
  ]
556
  },
557
  {
558
  "id": "segdefault_nopos_sum_nomask",
559
+ "when": ["present.segmentEmbeddingT", "not present.segmentIdsT", "present.positionIdsT == (\"nopos\" == \"posids\")", "present.embeddingSumT == (\"sum\" == \"sum\")", "not present.maskIndexT"],
560
  "passes": [
561
  {
562
  "id": "sum",
563
  "name": "EmbedLayerNormalization.EmbeddingSum",
564
  "shader": "embed-sum.wgsl.jinja",
565
+ "bindings": ["input_ids", "word_embedding", "position_embedding", "segment_embedding", "output", "embedding_sum", "params"],
566
+ "dispatch": { "x": "min(tokens, 65535)", "y": "ceilDiv(tokens, 65535)", "z": 1 }
567
  },
568
  {
569
  "id": "normalize",
570
  "name": "EmbedLayerNormalization.Normalize",
571
  "shader": "embed-normalize.wgsl.jinja",
572
+ "bindings": ["output", "gamma", "beta", "params"],
573
+ "dispatch": { "x": "min(tokens, 65535)", "y": "ceilDiv(tokens, 65535)", "z": 1 }
574
  }
575
  ]
576
  },
577
  {
578
  "id": "segdefault_nopos_sum_mask",
579
+ "when": ["present.segmentEmbeddingT", "not present.segmentIdsT", "present.positionIdsT == (\"nopos\" == \"posids\")", "present.embeddingSumT == (\"sum\" == \"sum\")", "present.maskIndexT", "present.maskT"],
580
  "passes": [
581
  {
582
  "id": "sum",
583
  "name": "EmbedLayerNormalization.EmbeddingSum",
584
  "shader": "embed-sum.wgsl.jinja",
585
+ "bindings": ["input_ids", "word_embedding", "position_embedding", "segment_embedding", "output", "embedding_sum", "params"],
586
+ "dispatch": { "x": "min(tokens, 65535)", "y": "ceilDiv(tokens, 65535)", "z": 1 }
587
  },
588
  {
589
  "id": "normalize",
590
  "name": "EmbedLayerNormalization.Normalize",
591
  "shader": "embed-normalize.wgsl.jinja",
592
+ "bindings": ["output", "gamma", "beta", "params"],
593
+ "dispatch": { "x": "min(tokens, 65535)", "y": "ceilDiv(tokens, 65535)", "z": 1 }
594
  },
595
  {
596
  "id": "maskIndex",
597
  "name": "EmbedLayerNormalization.MaskIndex",
598
  "shader": "embed-mask-index.wgsl.jinja",
599
+ "bindings": ["mask", "mask_index", "params_2"],
600
+ "dispatch": {
601
+ "x": "min(ceilDiv((batchSize), (tunables.MASK_WORKGROUP_SIZE)), 65535)",
602
+ "y": "ceilDiv(ceilDiv((batchSize), (tunables.MASK_WORKGROUP_SIZE)), 65535)",
603
+ "z": 1
604
+ }
605
  }
606
  ]
607
  },
608
  {
609
  "id": "segdefault_posids_nosum_nomask",
610
+ "when": ["present.segmentEmbeddingT", "not present.segmentIdsT", "present.positionIdsT == (\"posids\" == \"posids\")", "present.embeddingSumT == (\"nosum\" == \"sum\")", "not present.maskIndexT"],
611
  "passes": [
612
  {
613
  "id": "sum",
614
  "name": "EmbedLayerNormalization.EmbeddingSum",
615
  "shader": "embed-sum.wgsl.jinja",
616
+ "bindings": ["input_ids", "position_ids", "word_embedding", "position_embedding", "segment_embedding", "output", "params"],
617
+ "dispatch": { "x": "min(tokens, 65535)", "y": "ceilDiv(tokens, 65535)", "z": 1 }
618
  },
619
  {
620
  "id": "normalize",
621
  "name": "EmbedLayerNormalization.Normalize",
622
  "shader": "embed-normalize.wgsl.jinja",
623
+ "bindings": ["output", "gamma", "beta", "params"],
624
+ "dispatch": { "x": "min(tokens, 65535)", "y": "ceilDiv(tokens, 65535)", "z": 1 }
625
  }
626
  ]
627
  },
628
  {
629
  "id": "segdefault_posids_nosum_mask",
630
+ "when": ["present.segmentEmbeddingT", "not present.segmentIdsT", "present.positionIdsT == (\"posids\" == \"posids\")", "present.embeddingSumT == (\"nosum\" == \"sum\")", "present.maskIndexT", "present.maskT"],
631
  "passes": [
632
  {
633
  "id": "sum",
634
  "name": "EmbedLayerNormalization.EmbeddingSum",
635
  "shader": "embed-sum.wgsl.jinja",
636
+ "bindings": ["input_ids", "position_ids", "word_embedding", "position_embedding", "segment_embedding", "output", "params"],
637
+ "dispatch": { "x": "min(tokens, 65535)", "y": "ceilDiv(tokens, 65535)", "z": 1 }
638
  },
639
  {
640
  "id": "normalize",
641
  "name": "EmbedLayerNormalization.Normalize",
642
  "shader": "embed-normalize.wgsl.jinja",
643
+ "bindings": ["output", "gamma", "beta", "params"],
644
+ "dispatch": { "x": "min(tokens, 65535)", "y": "ceilDiv(tokens, 65535)", "z": 1 }
645
  },
646
  {
647
  "id": "maskIndex",
648
  "name": "EmbedLayerNormalization.MaskIndex",
649
  "shader": "embed-mask-index.wgsl.jinja",
650
+ "bindings": ["mask", "mask_index", "params_2"],
651
+ "dispatch": {
652
+ "x": "min(ceilDiv((batchSize), (tunables.MASK_WORKGROUP_SIZE)), 65535)",
653
+ "y": "ceilDiv(ceilDiv((batchSize), (tunables.MASK_WORKGROUP_SIZE)), 65535)",
654
+ "z": 1
655
+ }
656
  }
657
  ]
658
  },
659
  {
660
  "id": "segdefault_posids_sum_nomask",
661
+ "when": ["present.segmentEmbeddingT", "not present.segmentIdsT", "present.positionIdsT == (\"posids\" == \"posids\")", "present.embeddingSumT == (\"sum\" == \"sum\")", "not present.maskIndexT"],
662
  "passes": [
663
  {
664
  "id": "sum",
665
  "name": "EmbedLayerNormalization.EmbeddingSum",
666
  "shader": "embed-sum.wgsl.jinja",
667
+ "bindings": ["input_ids", "position_ids", "word_embedding", "position_embedding", "segment_embedding", "output", "embedding_sum", "params"],
668
+ "dispatch": { "x": "min(tokens, 65535)", "y": "ceilDiv(tokens, 65535)", "z": 1 }
669
  },
670
  {
671
  "id": "normalize",
672
  "name": "EmbedLayerNormalization.Normalize",
673
  "shader": "embed-normalize.wgsl.jinja",
674
+ "bindings": ["output", "gamma", "beta", "params"],
675
+ "dispatch": { "x": "min(tokens, 65535)", "y": "ceilDiv(tokens, 65535)", "z": 1 }
676
  }
677
  ]
678
  },
679
  {
680
  "id": "segdefault_posids_sum_mask",
681
+ "when": ["present.segmentEmbeddingT", "not present.segmentIdsT", "present.positionIdsT == (\"posids\" == \"posids\")", "present.embeddingSumT == (\"sum\" == \"sum\")", "present.maskIndexT", "present.maskT"],
682
  "passes": [
683
  {
684
  "id": "sum",
685
  "name": "EmbedLayerNormalization.EmbeddingSum",
686
  "shader": "embed-sum.wgsl.jinja",
687
+ "bindings": ["input_ids", "position_ids", "word_embedding", "position_embedding", "segment_embedding", "output", "embedding_sum", "params"],
688
+ "dispatch": { "x": "min(tokens, 65535)", "y": "ceilDiv(tokens, 65535)", "z": 1 }
689
  },
690
  {
691
  "id": "normalize",
692
  "name": "EmbedLayerNormalization.Normalize",
693
  "shader": "embed-normalize.wgsl.jinja",
694
+ "bindings": ["output", "gamma", "beta", "params"],
695
+ "dispatch": { "x": "min(tokens, 65535)", "y": "ceilDiv(tokens, 65535)", "z": 1 }
696
  },
697
  {
698
  "id": "maskIndex",
699
  "name": "EmbedLayerNormalization.MaskIndex",
700
  "shader": "embed-mask-index.wgsl.jinja",
701
+ "bindings": ["mask", "mask_index", "params_2"],
702
+ "dispatch": {
703
+ "x": "min(ceilDiv((batchSize), (tunables.MASK_WORKGROUP_SIZE)), 65535)",
704
+ "y": "ceilDiv(ceilDiv((batchSize), (tunables.MASK_WORKGROUP_SIZE)), 65535)",
705
+ "z": 1
706
+ }
707
  }
708
  ]
709
  },
710
  {
711
  "id": "noseg_nopos_nosum_mask_without_input",
712
+ "when": ["present.segmentEmbeddingT == (\"noseg\" != \"noseg\")", "present.segmentIdsT == (\"noseg\" == \"seg\")", "present.positionIdsT == (\"nopos\" == \"posids\")", "present.embeddingSumT == (\"nosum\" == \"sum\")", "present.maskIndexT", "not present.maskT"],
713
  "passes": [
714
  {
715
  "id": "sum",
716
  "name": "EmbedLayerNormalization.EmbeddingSum",
717
  "shader": "embed-sum.wgsl.jinja",
718
+ "bindings": ["input_ids", "word_embedding", "position_embedding", "output", "params"],
719
+ "dispatch": { "x": "min(tokens, 65535)", "y": "ceilDiv(tokens, 65535)", "z": 1 }
720
  },
721
  {
722
  "id": "normalize",
723
  "name": "EmbedLayerNormalization.Normalize",
724
  "shader": "embed-normalize.wgsl.jinja",
725
+ "bindings": ["output", "gamma", "beta", "params"],
726
+ "dispatch": { "x": "min(tokens, 65535)", "y": "ceilDiv(tokens, 65535)", "z": 1 }
727
  },
728
  {
729
  "id": "maskIndex",
730
  "name": "EmbedLayerNormalization.ZeroMaskIndex",
731
  "shader": "embed-mask-index.wgsl.jinja",
732
+ "bindings": ["mask_index", "params_2"],
733
+ "dispatch": {
734
+ "x": "min(ceilDiv((batchSize), (tunables.MASK_WORKGROUP_SIZE)), 65535)",
735
+ "y": "ceilDiv(ceilDiv((batchSize), (tunables.MASK_WORKGROUP_SIZE)), 65535)",
736
+ "z": 1
737
+ }
738
  }
739
  ]
740
  },
741
  {
742
  "id": "noseg_nopos_sum_mask_without_input",
743
+ "when": ["present.segmentEmbeddingT == (\"noseg\" != \"noseg\")", "present.segmentIdsT == (\"noseg\" == \"seg\")", "present.positionIdsT == (\"nopos\" == \"posids\")", "present.embeddingSumT == (\"sum\" == \"sum\")", "present.maskIndexT", "not present.maskT"],
744
  "passes": [
745
  {
746
  "id": "sum",
747
  "name": "EmbedLayerNormalization.EmbeddingSum",
748
  "shader": "embed-sum.wgsl.jinja",
749
+ "bindings": ["input_ids", "word_embedding", "position_embedding", "output", "embedding_sum", "params"],
750
+ "dispatch": { "x": "min(tokens, 65535)", "y": "ceilDiv(tokens, 65535)", "z": 1 }
751
  },
752
  {
753
  "id": "normalize",
754
  "name": "EmbedLayerNormalization.Normalize",
755
  "shader": "embed-normalize.wgsl.jinja",
756
+ "bindings": ["output", "gamma", "beta", "params"],
757
+ "dispatch": { "x": "min(tokens, 65535)", "y": "ceilDiv(tokens, 65535)", "z": 1 }
758
  },
759
  {
760
  "id": "maskIndex",
761
  "name": "EmbedLayerNormalization.ZeroMaskIndex",
762
  "shader": "embed-mask-index.wgsl.jinja",
763
+ "bindings": ["mask_index", "params_2"],
764
+ "dispatch": {
765
+ "x": "min(ceilDiv((batchSize), (tunables.MASK_WORKGROUP_SIZE)), 65535)",
766
+ "y": "ceilDiv(ceilDiv((batchSize), (tunables.MASK_WORKGROUP_SIZE)), 65535)",
767
+ "z": 1
768
+ }
769
  }
770
  ]
771
  },
772
  {
773
  "id": "noseg_posids_nosum_mask_without_input",
774
+ "when": ["present.segmentEmbeddingT == (\"noseg\" != \"noseg\")", "present.segmentIdsT == (\"noseg\" == \"seg\")", "present.positionIdsT == (\"posids\" == \"posids\")", "present.embeddingSumT == (\"nosum\" == \"sum\")", "present.maskIndexT", "not present.maskT"],
775
  "passes": [
776
  {
777
  "id": "sum",
778
  "name": "EmbedLayerNormalization.EmbeddingSum",
779
  "shader": "embed-sum.wgsl.jinja",
780
+ "bindings": ["input_ids", "position_ids", "word_embedding", "position_embedding", "output", "params"],
781
+ "dispatch": { "x": "min(tokens, 65535)", "y": "ceilDiv(tokens, 65535)", "z": 1 }
782
  },
783
  {
784
  "id": "normalize",
785
  "name": "EmbedLayerNormalization.Normalize",
786
  "shader": "embed-normalize.wgsl.jinja",
787
+ "bindings": ["output", "gamma", "beta", "params"],
788
+ "dispatch": { "x": "min(tokens, 65535)", "y": "ceilDiv(tokens, 65535)", "z": 1 }
789
  },
790
  {
791
  "id": "maskIndex",
792
  "name": "EmbedLayerNormalization.ZeroMaskIndex",
793
  "shader": "embed-mask-index.wgsl.jinja",
794
+ "bindings": ["mask_index", "params_2"],
795
+ "dispatch": {
796
+ "x": "min(ceilDiv((batchSize), (tunables.MASK_WORKGROUP_SIZE)), 65535)",
797
+ "y": "ceilDiv(ceilDiv((batchSize), (tunables.MASK_WORKGROUP_SIZE)), 65535)",
798
+ "z": 1
799
+ }
800
  }
801
  ]
802
  },
803
  {
804
  "id": "noseg_posids_sum_mask_without_input",
805
+ "when": ["present.segmentEmbeddingT == (\"noseg\" != \"noseg\")", "present.segmentIdsT == (\"noseg\" == \"seg\")", "present.positionIdsT == (\"posids\" == \"posids\")", "present.embeddingSumT == (\"sum\" == \"sum\")", "present.maskIndexT", "not present.maskT"],
806
  "passes": [
807
  {
808
  "id": "sum",
809
  "name": "EmbedLayerNormalization.EmbeddingSum",
810
  "shader": "embed-sum.wgsl.jinja",
811
+ "bindings": ["input_ids", "position_ids", "word_embedding", "position_embedding", "output", "embedding_sum", "params"],
812
+ "dispatch": { "x": "min(tokens, 65535)", "y": "ceilDiv(tokens, 65535)", "z": 1 }
813
  },
814
  {
815
  "id": "normalize",
816
  "name": "EmbedLayerNormalization.Normalize",
817
  "shader": "embed-normalize.wgsl.jinja",
818
+ "bindings": ["output", "gamma", "beta", "params"],
819
+ "dispatch": { "x": "min(tokens, 65535)", "y": "ceilDiv(tokens, 65535)", "z": 1 }
820
  },
821
  {
822
  "id": "maskIndex",
823
  "name": "EmbedLayerNormalization.ZeroMaskIndex",
824
  "shader": "embed-mask-index.wgsl.jinja",
825
+ "bindings": ["mask_index", "params_2"],
826
+ "dispatch": {
827
+ "x": "min(ceilDiv((batchSize), (tunables.MASK_WORKGROUP_SIZE)), 65535)",
828
+ "y": "ceilDiv(ceilDiv((batchSize), (tunables.MASK_WORKGROUP_SIZE)), 65535)",
829
+ "z": 1
830
+ }
831
  }
832
  ]
833
  },
834
  {
835
  "id": "segdefault_nopos_nosum_mask_without_input",
836
+ "when": ["present.segmentEmbeddingT == (\"segdefault\" != \"noseg\")", "present.segmentIdsT == (\"segdefault\" == \"seg\")", "present.positionIdsT == (\"nopos\" == \"posids\")", "present.embeddingSumT == (\"nosum\" == \"sum\")", "present.maskIndexT", "not present.maskT"],
837
  "passes": [
838
  {
839
  "id": "sum",
840
  "name": "EmbedLayerNormalization.EmbeddingSum",
841
  "shader": "embed-sum.wgsl.jinja",
842
+ "bindings": ["input_ids", "word_embedding", "position_embedding", "segment_embedding", "output", "params"],
843
+ "dispatch": { "x": "min(tokens, 65535)", "y": "ceilDiv(tokens, 65535)", "z": 1 }
844
  },
845
  {
846
  "id": "normalize",
847
  "name": "EmbedLayerNormalization.Normalize",
848
  "shader": "embed-normalize.wgsl.jinja",
849
+ "bindings": ["output", "gamma", "beta", "params"],
850
+ "dispatch": { "x": "min(tokens, 65535)", "y": "ceilDiv(tokens, 65535)", "z": 1 }
851
  },
852
  {
853
  "id": "maskIndex",
854
  "name": "EmbedLayerNormalization.ZeroMaskIndex",
855
  "shader": "embed-mask-index.wgsl.jinja",
856
+ "bindings": ["mask_index", "params_2"],
857
+ "dispatch": {
858
+ "x": "min(ceilDiv((batchSize), (tunables.MASK_WORKGROUP_SIZE)), 65535)",
859
+ "y": "ceilDiv(ceilDiv((batchSize), (tunables.MASK_WORKGROUP_SIZE)), 65535)",
860
+ "z": 1
861
+ }
862
  }
863
  ]
864
  },
865
  {
866
  "id": "segdefault_nopos_sum_mask_without_input",
867
+ "when": ["present.segmentEmbeddingT == (\"segdefault\" != \"noseg\")", "present.segmentIdsT == (\"segdefault\" == \"seg\")", "present.positionIdsT == (\"nopos\" == \"posids\")", "present.embeddingSumT == (\"sum\" == \"sum\")", "present.maskIndexT", "not present.maskT"],
868
  "passes": [
869
  {
870
  "id": "sum",
871
  "name": "EmbedLayerNormalization.EmbeddingSum",
872
  "shader": "embed-sum.wgsl.jinja",
873
+ "bindings": ["input_ids", "word_embedding", "position_embedding", "segment_embedding", "output", "embedding_sum", "params"],
874
+ "dispatch": { "x": "min(tokens, 65535)", "y": "ceilDiv(tokens, 65535)", "z": 1 }
875
  },
876
  {
877
  "id": "normalize",
878
  "name": "EmbedLayerNormalization.Normalize",
879
  "shader": "embed-normalize.wgsl.jinja",
880
+ "bindings": ["output", "gamma", "beta", "params"],
881
+ "dispatch": { "x": "min(tokens, 65535)", "y": "ceilDiv(tokens, 65535)", "z": 1 }
882
  },
883
  {
884
  "id": "maskIndex",
885
  "name": "EmbedLayerNormalization.ZeroMaskIndex",
886
  "shader": "embed-mask-index.wgsl.jinja",
887
+ "bindings": ["mask_index", "params_2"],
888
+ "dispatch": {
889
+ "x": "min(ceilDiv((batchSize), (tunables.MASK_WORKGROUP_SIZE)), 65535)",
890
+ "y": "ceilDiv(ceilDiv((batchSize), (tunables.MASK_WORKGROUP_SIZE)), 65535)",
891
+ "z": 1
892
+ }
893
  }
894
  ]
895
  },
896
  {
897
  "id": "segdefault_posids_nosum_mask_without_input",
898
+ "when": ["present.segmentEmbeddingT == (\"segdefault\" != \"noseg\")", "present.segmentIdsT == (\"segdefault\" == \"seg\")", "present.positionIdsT == (\"posids\" == \"posids\")", "present.embeddingSumT == (\"nosum\" == \"sum\")", "present.maskIndexT", "not present.maskT"],
899
  "passes": [
900
  {
901
  "id": "sum",
902
  "name": "EmbedLayerNormalization.EmbeddingSum",
903
  "shader": "embed-sum.wgsl.jinja",
904
+ "bindings": ["input_ids", "position_ids", "word_embedding", "position_embedding", "segment_embedding", "output", "params"],
905
+ "dispatch": { "x": "min(tokens, 65535)", "y": "ceilDiv(tokens, 65535)", "z": 1 }
906
  },
907
  {
908
  "id": "normalize",
909
  "name": "EmbedLayerNormalization.Normalize",
910
  "shader": "embed-normalize.wgsl.jinja",
911
+ "bindings": ["output", "gamma", "beta", "params"],
912
+ "dispatch": { "x": "min(tokens, 65535)", "y": "ceilDiv(tokens, 65535)", "z": 1 }
913
  },
914
  {
915
  "id": "maskIndex",
916
  "name": "EmbedLayerNormalization.ZeroMaskIndex",
917
  "shader": "embed-mask-index.wgsl.jinja",
918
+ "bindings": ["mask_index", "params_2"],
919
+ "dispatch": {
920
+ "x": "min(ceilDiv((batchSize), (tunables.MASK_WORKGROUP_SIZE)), 65535)",
921
+ "y": "ceilDiv(ceilDiv((batchSize), (tunables.MASK_WORKGROUP_SIZE)), 65535)",
922
+ "z": 1
923
+ }
924
  }
925
  ]
926
  },
927
  {
928
  "id": "segdefault_posids_sum_mask_without_input",
929
+ "when": ["present.segmentEmbeddingT == (\"segdefault\" != \"noseg\")", "present.segmentIdsT == (\"segdefault\" == \"seg\")", "present.positionIdsT == (\"posids\" == \"posids\")", "present.embeddingSumT == (\"sum\" == \"sum\")", "present.maskIndexT", "not present.maskT"],
930
  "passes": [
931
  {
932
  "id": "sum",
933
  "name": "EmbedLayerNormalization.EmbeddingSum",
934
  "shader": "embed-sum.wgsl.jinja",
935
+ "bindings": ["input_ids", "position_ids", "word_embedding", "position_embedding", "segment_embedding", "output", "embedding_sum", "params"],
936
+ "dispatch": { "x": "min(tokens, 65535)", "y": "ceilDiv(tokens, 65535)", "z": 1 }
937
  },
938
  {
939
  "id": "normalize",
940
  "name": "EmbedLayerNormalization.Normalize",
941
  "shader": "embed-normalize.wgsl.jinja",
942
+ "bindings": ["output", "gamma", "beta", "params"],
943
+ "dispatch": { "x": "min(tokens, 65535)", "y": "ceilDiv(tokens, 65535)", "z": 1 }
944
  },
945
  {
946
  "id": "maskIndex",
947
  "name": "EmbedLayerNormalization.ZeroMaskIndex",
948
  "shader": "embed-mask-index.wgsl.jinja",
949
+ "bindings": ["mask_index", "params_2"],
950
+ "dispatch": {
951
+ "x": "min(ceilDiv((batchSize), (tunables.MASK_WORKGROUP_SIZE)), 65535)",
952
+ "y": "ceilDiv(ceilDiv((batchSize), (tunables.MASK_WORKGROUP_SIZE)), 65535)",
953
+ "z": 1
954
+ }
955
  }
956
  ]
957
  },
958
  {
959
  "id": "seg_nopos_nosum_mask_without_input",
960
+ "when": ["present.segmentEmbeddingT == (\"seg\" != \"noseg\")", "present.segmentIdsT == (\"seg\" == \"seg\")", "present.positionIdsT == (\"nopos\" == \"posids\")", "present.embeddingSumT == (\"nosum\" == \"sum\")", "present.maskIndexT", "not present.maskT"],
961
  "passes": [
962
  {
963
  "id": "sum",
964
  "name": "EmbedLayerNormalization.EmbeddingSum",
965
  "shader": "embed-sum.wgsl.jinja",
966
+ "bindings": ["input_ids", "segment_ids", "word_embedding", "position_embedding", "segment_embedding", "output", "params"],
967
+ "dispatch": { "x": "min(tokens, 65535)", "y": "ceilDiv(tokens, 65535)", "z": 1 }
968
  },
969
  {
970
  "id": "normalize",
971
  "name": "EmbedLayerNormalization.Normalize",
972
  "shader": "embed-normalize.wgsl.jinja",
973
+ "bindings": ["output", "gamma", "beta", "params"],
974
+ "dispatch": { "x": "min(tokens, 65535)", "y": "ceilDiv(tokens, 65535)", "z": 1 }
975
  },
976
  {
977
  "id": "maskIndex",
978
  "name": "EmbedLayerNormalization.ZeroMaskIndex",
979
  "shader": "embed-mask-index.wgsl.jinja",
980
+ "bindings": ["mask_index", "params_2"],
981
+ "dispatch": {
982
+ "x": "min(ceilDiv((batchSize), (tunables.MASK_WORKGROUP_SIZE)), 65535)",
983
+ "y": "ceilDiv(ceilDiv((batchSize), (tunables.MASK_WORKGROUP_SIZE)), 65535)",
984
+ "z": 1
985
+ }
986
  }
987
  ]
988
  },
989
  {
990
  "id": "seg_nopos_sum_mask_without_input",
991
+ "when": ["present.segmentEmbeddingT == (\"seg\" != \"noseg\")", "present.segmentIdsT == (\"seg\" == \"seg\")", "present.positionIdsT == (\"nopos\" == \"posids\")", "present.embeddingSumT == (\"sum\" == \"sum\")", "present.maskIndexT", "not present.maskT"],
992
  "passes": [
993
  {
994
  "id": "sum",
995
  "name": "EmbedLayerNormalization.EmbeddingSum",
996
  "shader": "embed-sum.wgsl.jinja",
997
+ "bindings": ["input_ids", "segment_ids", "word_embedding", "position_embedding", "segment_embedding", "output", "embedding_sum", "params"],
998
+ "dispatch": { "x": "min(tokens, 65535)", "y": "ceilDiv(tokens, 65535)", "z": 1 }
999
  },
1000
  {
1001
  "id": "normalize",
1002
  "name": "EmbedLayerNormalization.Normalize",
1003
  "shader": "embed-normalize.wgsl.jinja",
1004
+ "bindings": ["output", "gamma", "beta", "params"],
1005
+ "dispatch": { "x": "min(tokens, 65535)", "y": "ceilDiv(tokens, 65535)", "z": 1 }
1006
  },
1007
  {
1008
  "id": "maskIndex",
1009
  "name": "EmbedLayerNormalization.ZeroMaskIndex",
1010
  "shader": "embed-mask-index.wgsl.jinja",
1011
+ "bindings": ["mask_index", "params_2"],
1012
+ "dispatch": {
1013
+ "x": "min(ceilDiv((batchSize), (tunables.MASK_WORKGROUP_SIZE)), 65535)",
1014
+ "y": "ceilDiv(ceilDiv((batchSize), (tunables.MASK_WORKGROUP_SIZE)), 65535)",
1015
+ "z": 1
1016
+ }
1017
  }
1018
  ]
1019
  },
1020
  {
1021
  "id": "seg_posids_nosum_mask_without_input",
1022
+ "when": ["present.segmentEmbeddingT == (\"seg\" != \"noseg\")", "present.segmentIdsT == (\"seg\" == \"seg\")", "present.positionIdsT == (\"posids\" == \"posids\")", "present.embeddingSumT == (\"nosum\" == \"sum\")", "present.maskIndexT", "not present.maskT"],
1023
  "passes": [
1024
  {
1025
  "id": "sum",
1026
  "name": "EmbedLayerNormalization.EmbeddingSum",
1027
  "shader": "embed-sum.wgsl.jinja",
1028
+ "bindings": ["input_ids", "segment_ids", "position_ids", "word_embedding", "position_embedding", "segment_embedding", "output", "params"],
1029
+ "dispatch": { "x": "min(tokens, 65535)", "y": "ceilDiv(tokens, 65535)", "z": 1 }
1030
  },
1031
  {
1032
  "id": "normalize",
1033
  "name": "EmbedLayerNormalization.Normalize",
1034
  "shader": "embed-normalize.wgsl.jinja",
1035
+ "bindings": ["output", "gamma", "beta", "params"],
1036
+ "dispatch": { "x": "min(tokens, 65535)", "y": "ceilDiv(tokens, 65535)", "z": 1 }
1037
  },
1038
  {
1039
  "id": "maskIndex",
1040
  "name": "EmbedLayerNormalization.ZeroMaskIndex",
1041
  "shader": "embed-mask-index.wgsl.jinja",
1042
+ "bindings": ["mask_index", "params_2"],
1043
+ "dispatch": {
1044
+ "x": "min(ceilDiv((batchSize), (tunables.MASK_WORKGROUP_SIZE)), 65535)",
1045
+ "y": "ceilDiv(ceilDiv((batchSize), (tunables.MASK_WORKGROUP_SIZE)), 65535)",
1046
+ "z": 1
1047
+ }
1048
  }
1049
  ]
1050
  },
1051
  {
1052
  "id": "seg_posids_sum_mask_without_input",
1053
+ "when": ["present.segmentEmbeddingT == (\"seg\" != \"noseg\")", "present.segmentIdsT == (\"seg\" == \"seg\")", "present.positionIdsT == (\"posids\" == \"posids\")", "present.embeddingSumT == (\"sum\" == \"sum\")", "present.maskIndexT", "not present.maskT"],
1054
  "passes": [
1055
  {
1056
  "id": "sum",
1057
  "name": "EmbedLayerNormalization.EmbeddingSum",
1058
  "shader": "embed-sum.wgsl.jinja",
1059
+ "bindings": ["input_ids", "segment_ids", "position_ids", "word_embedding", "position_embedding", "segment_embedding", "output", "embedding_sum", "params"],
1060
+ "dispatch": { "x": "min(tokens, 65535)", "y": "ceilDiv(tokens, 65535)", "z": 1 }
1061
  },
1062
  {
1063
  "id": "normalize",
1064
  "name": "EmbedLayerNormalization.Normalize",
1065
  "shader": "embed-normalize.wgsl.jinja",
1066
+ "bindings": ["output", "gamma", "beta", "params"],
1067
+ "dispatch": { "x": "min(tokens, 65535)", "y": "ceilDiv(tokens, 65535)", "z": 1 }
1068
  },
1069
  {
1070
  "id": "maskIndex",
1071
  "name": "EmbedLayerNormalization.ZeroMaskIndex",
1072
  "shader": "embed-mask-index.wgsl.jinja",
1073
+ "bindings": ["mask_index", "params_2"],
1074
+ "dispatch": {
1075
+ "x": "min(ceilDiv((batchSize), (tunables.MASK_WORKGROUP_SIZE)), 65535)",
1076
+ "y": "ceilDiv(ceilDiv((batchSize), (tunables.MASK_WORKGROUP_SIZE)), 65535)",
1077
+ "z": 1
1078
+ }
1079
  }
1080
  ]
1081
  }
build/webgpu/metadata.json CHANGED
@@ -1,20 +1,60 @@
1
  {
2
  "name": "com.microsoft.EmbedLayerNormalization",
3
- "id": "_com_microsoft_embedlayernormalization_webgpu_b297617",
4
  "version": 1,
5
  "license": "Apache-2.0",
6
  "backend": { "type": "webgpu" },
7
  "digest": {
8
  "algorithm": "sha256",
9
  "files": {
10
- "bench.json": "LyhXY2RrY86niUBQGOouS5wCSVNuVu0RylHfXPXwZRc=",
11
  "embed-mask-index.wgsl.jinja": "7wT7/LzdrOnanlTU5kmneEYpGb6D8v0H9/9mra8eF5Q=",
12
- "embed-normalize.wgsl.jinja": "YObvmdAvDuyx8f4pwTmVxphDSivMh4Y2oovmT7eGm1s=",
13
- "embed-sum.wgsl.jinja": "cCsjv9CmNWgQLtMOAvEQOveXEO6jpeX7NMD4PiaaIW0=",
14
- "manifest.json": "C/rakYKSOpdBjI3xKiqWRE18Dg002pKoEVcA/yRtprM=",
15
- "test.json": "UE2iD8tAA2HxgRcTihjDe6LYfamqEWUopaGGER7vNQc="
16
  }
17
  },
18
- "provenance": { "kernel": { "sha": "2e7068faf55e7f43df740015f6d1ee49391a41c5", "dirty": false } },
19
- "webgpu": { "manifestSpec": "1.0", "specialized": true, "opPath": "ops/com.microsoft.EmbedLayerNormalization" }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
20
  }
 
1
  {
2
  "name": "com.microsoft.EmbedLayerNormalization",
3
+ "id": "_com_microsoft_embedlayernormalization_webgpu_1487059",
4
  "version": 1,
5
  "license": "Apache-2.0",
6
  "backend": { "type": "webgpu" },
7
  "digest": {
8
  "algorithm": "sha256",
9
  "files": {
10
+ "bench.json": "Hs0qFEnXlwW07Hr/0rT+Bq7eqznmLpk7Zf1zpHE3qvw=",
11
  "embed-mask-index.wgsl.jinja": "7wT7/LzdrOnanlTU5kmneEYpGb6D8v0H9/9mra8eF5Q=",
12
+ "embed-normalize.wgsl.jinja": "U2vsL1A7Y88g0DgeHpCON1vrTL7Dzc9Z2+CUmAFtt+0=",
13
+ "embed-sum.wgsl.jinja": "RJVXdkHRkytYbkJ8wtcuZpB7TG/ubEOZPmIOYpOXMCw=",
14
+ "manifest.json": "ocqCMw8JDV5GTOF6rXRhscDQ+z2G9NjzZDfxlwAznP8=",
15
+ "test.json": "D+ZuT3RBcLxlldTtFpYDKm1J2fRt64z2CvSv0vP8wbk="
16
  }
17
  },
18
+ "provenance": { "kernel": { "sha": "91d990483a174128daf7673f3f37a7c890493ae1", "dirty": false } },
19
+ "webgpu": {
20
+ "manifestSpec": "2.0",
21
+ "variants": {
22
+ "noseg_nopos_nosum_nomask": ["embed-normalize.wgsl.jinja", "embed-sum.wgsl.jinja"],
23
+ "noseg_nopos_nosum_mask": ["embed-mask-index.wgsl.jinja", "embed-normalize.wgsl.jinja", "embed-sum.wgsl.jinja"],
24
+ "noseg_nopos_sum_nomask": ["embed-normalize.wgsl.jinja", "embed-sum.wgsl.jinja"],
25
+ "noseg_nopos_sum_mask": ["embed-mask-index.wgsl.jinja", "embed-normalize.wgsl.jinja", "embed-sum.wgsl.jinja"],
26
+ "noseg_posids_nosum_nomask": ["embed-normalize.wgsl.jinja", "embed-sum.wgsl.jinja"],
27
+ "noseg_posids_nosum_mask": ["embed-mask-index.wgsl.jinja", "embed-normalize.wgsl.jinja", "embed-sum.wgsl.jinja"],
28
+ "noseg_posids_sum_nomask": ["embed-normalize.wgsl.jinja", "embed-sum.wgsl.jinja"],
29
+ "noseg_posids_sum_mask": ["embed-mask-index.wgsl.jinja", "embed-normalize.wgsl.jinja", "embed-sum.wgsl.jinja"],
30
+ "seg_nopos_nosum_nomask": ["embed-normalize.wgsl.jinja", "embed-sum.wgsl.jinja"],
31
+ "seg_nopos_nosum_mask": ["embed-mask-index.wgsl.jinja", "embed-normalize.wgsl.jinja", "embed-sum.wgsl.jinja"],
32
+ "seg_nopos_sum_nomask": ["embed-normalize.wgsl.jinja", "embed-sum.wgsl.jinja"],
33
+ "seg_nopos_sum_mask": ["embed-mask-index.wgsl.jinja", "embed-normalize.wgsl.jinja", "embed-sum.wgsl.jinja"],
34
+ "seg_posids_nosum_nomask": ["embed-normalize.wgsl.jinja", "embed-sum.wgsl.jinja"],
35
+ "seg_posids_nosum_mask": ["embed-mask-index.wgsl.jinja", "embed-normalize.wgsl.jinja", "embed-sum.wgsl.jinja"],
36
+ "seg_posids_sum_nomask": ["embed-normalize.wgsl.jinja", "embed-sum.wgsl.jinja"],
37
+ "seg_posids_sum_mask": ["embed-mask-index.wgsl.jinja", "embed-normalize.wgsl.jinja", "embed-sum.wgsl.jinja"],
38
+ "segdefault_nopos_nosum_nomask": ["embed-normalize.wgsl.jinja", "embed-sum.wgsl.jinja"],
39
+ "segdefault_nopos_nosum_mask": ["embed-mask-index.wgsl.jinja", "embed-normalize.wgsl.jinja", "embed-sum.wgsl.jinja"],
40
+ "segdefault_nopos_sum_nomask": ["embed-normalize.wgsl.jinja", "embed-sum.wgsl.jinja"],
41
+ "segdefault_nopos_sum_mask": ["embed-mask-index.wgsl.jinja", "embed-normalize.wgsl.jinja", "embed-sum.wgsl.jinja"],
42
+ "segdefault_posids_nosum_nomask": ["embed-normalize.wgsl.jinja", "embed-sum.wgsl.jinja"],
43
+ "segdefault_posids_nosum_mask": ["embed-mask-index.wgsl.jinja", "embed-normalize.wgsl.jinja", "embed-sum.wgsl.jinja"],
44
+ "segdefault_posids_sum_nomask": ["embed-normalize.wgsl.jinja", "embed-sum.wgsl.jinja"],
45
+ "segdefault_posids_sum_mask": ["embed-mask-index.wgsl.jinja", "embed-normalize.wgsl.jinja", "embed-sum.wgsl.jinja"],
46
+ "noseg_nopos_nosum_mask_without_input": ["embed-mask-index.wgsl.jinja", "embed-normalize.wgsl.jinja", "embed-sum.wgsl.jinja"],
47
+ "noseg_nopos_sum_mask_without_input": ["embed-mask-index.wgsl.jinja", "embed-normalize.wgsl.jinja", "embed-sum.wgsl.jinja"],
48
+ "noseg_posids_nosum_mask_without_input": ["embed-mask-index.wgsl.jinja", "embed-normalize.wgsl.jinja", "embed-sum.wgsl.jinja"],
49
+ "noseg_posids_sum_mask_without_input": ["embed-mask-index.wgsl.jinja", "embed-normalize.wgsl.jinja", "embed-sum.wgsl.jinja"],
50
+ "segdefault_nopos_nosum_mask_without_input": ["embed-mask-index.wgsl.jinja", "embed-normalize.wgsl.jinja", "embed-sum.wgsl.jinja"],
51
+ "segdefault_nopos_sum_mask_without_input": ["embed-mask-index.wgsl.jinja", "embed-normalize.wgsl.jinja", "embed-sum.wgsl.jinja"],
52
+ "segdefault_posids_nosum_mask_without_input": ["embed-mask-index.wgsl.jinja", "embed-normalize.wgsl.jinja", "embed-sum.wgsl.jinja"],
53
+ "segdefault_posids_sum_mask_without_input": ["embed-mask-index.wgsl.jinja", "embed-normalize.wgsl.jinja", "embed-sum.wgsl.jinja"],
54
+ "seg_nopos_nosum_mask_without_input": ["embed-mask-index.wgsl.jinja", "embed-normalize.wgsl.jinja", "embed-sum.wgsl.jinja"],
55
+ "seg_nopos_sum_mask_without_input": ["embed-mask-index.wgsl.jinja", "embed-normalize.wgsl.jinja", "embed-sum.wgsl.jinja"],
56
+ "seg_posids_nosum_mask_without_input": ["embed-mask-index.wgsl.jinja", "embed-normalize.wgsl.jinja", "embed-sum.wgsl.jinja"],
57
+ "seg_posids_sum_mask_without_input": ["embed-mask-index.wgsl.jinja", "embed-normalize.wgsl.jinja", "embed-sum.wgsl.jinja"]
58
+ }
59
+ }
60
  }
build/webgpu/test.json CHANGED
@@ -1,5 +1,4 @@
1
  {
2
- "op": "com.microsoft.EmbedLayerNormalization",
3
  "cases": [
4
  {
5
  "name": "segment_embedding_without_segment_ids_uses_row_zero",
 
1
  {
 
2
  "cases": [
3
  {
4
  "name": "segment_embedding_without_segment_ids_uses_row_zero",