File size: 15,691 Bytes
2a3f031
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
{
  "op": "com.microsoft.LinearAttention",
  "tunableSpace": {
    "dvGroups": [2, 4, 8],
    "tileV": [4, 8, 16],
    "gatedTileV": [2, 4, 8],
    "chunkSize": [16, 32],
    "chunkTileV": [16, 32]
  },
  "cases": [
    {
      "name": "linear-attention-f32-zero-32x4x16x16",
      "preset": "smoke",
      "vars": { "batch": 1, "seq": 32, "qHeads": 4, "kvHeads": 2, "dk": 16, "dv": 16 },
      "attrs": { "q_num_heads": 4, "kv_num_heads": 2, "update_rule": "linear", "scale": 0.25 },
      "inputs": {
        "queryT": { "shape": [1, 32, 64], "dtype": "float32", "dist": "normal", "seed": 201, "scale": 0.2 },
        "keyT": { "shape": [1, 32, 32], "dtype": "float32", "dist": "normal", "seed": 202, "scale": 0.2 },
        "valueT": { "shape": [1, 32, 32], "dtype": "float32", "dist": "normal", "seed": 203, "scale": 0.2 }
      },
      "outputs": {
        "outputT": { "shape": [1, 32, 64], "dtype": "float32" },
        "presentStateT": { "shape": [1, 2, 16, 16], "dtype": "float32" }
      },
      "bench": {
        "primary": true,
        "metrics": [
          { "type": "gflops", "value": "2 * args.batch * args.seq * (args.qHeads + args.kvHeads) * args.dk * args.dv" }
        ]
      }
    },
    {
      "name": "linear-attention-f32-state-32x4x16x16",
      "preset": "smoke",
      "vars": { "batch": 1, "seq": 32, "qHeads": 4, "kvHeads": 2, "dk": 16, "dv": 16 },
      "attrs": { "q_num_heads": 4, "kv_num_heads": 2, "update_rule": "gated_delta", "scale": 0.25 },
      "inputs": {
        "queryT": { "shape": [1, 32, 64], "dtype": "float32", "dist": "normal", "seed": 202, "scale": 0.2 },
        "keyT": { "shape": [1, 32, 32], "dtype": "float32", "dist": "normal", "seed": 203, "scale": 0.2 },
        "valueT": { "shape": [1, 32, 32], "dtype": "float32", "dist": "normal", "seed": 204, "scale": 0.2 },
        "pastStateT": { "shape": [1, 2, 16, 16], "dtype": "float32", "dist": "normal", "seed": 205, "scale": 0.1 },
        "decayT": { "shape": [1, 32, 32], "dtype": "float32", "dist": "normal", "seed": 206, "scale": 0.1 },
        "betaT": { "shape": [1, 32, 2], "dtype": "float32", "dist": "normal", "seed": 207, "scale": 0.1 }
      },
      "outputs": {
        "outputT": { "shape": [1, 32, 64], "dtype": "float32" },
        "presentStateT": { "shape": [1, 2, 16, 16], "dtype": "float32" }
      },
      "bench": {
        "primary": true,
        "metrics": [
          {
            "type": "gflops",
            "value": "2 * args.batch * args.seq * (args.qHeads + 2 * args.kvHeads) * args.dk * args.dv"
          }
        ]
      }
    },
    {
      "name": "linear-attention-f32-linear-state-32x4x16x16",
      "preset": "smoke",
      "vars": { "batch": 1, "seq": 32, "qHeads": 4, "kvHeads": 2, "dk": 16, "dv": 16 },
      "attrs": { "q_num_heads": 4, "kv_num_heads": 2, "update_rule": "linear", "scale": 0.25 },
      "inputs": {
        "queryT": { "shape": [1, 32, 64], "dtype": "float32", "dist": "normal", "seed": 208, "scale": 0.2 },
        "keyT": { "shape": [1, 32, 32], "dtype": "float32", "dist": "normal", "seed": 209, "scale": 0.2 },
        "valueT": { "shape": [1, 32, 32], "dtype": "float32", "dist": "normal", "seed": 210, "scale": 0.2 },
        "pastStateT": { "shape": [1, 2, 16, 16], "dtype": "float32", "dist": "normal", "seed": 211, "scale": 0.1 }
      },
      "outputs": {
        "outputT": { "shape": [1, 32, 64], "dtype": "float32" },
        "presentStateT": { "shape": [1, 2, 16, 16], "dtype": "float32" }
      },
      "bench": {
        "metrics": [
          { "type": "gflops", "value": "2 * args.batch * args.seq * (args.qHeads + args.kvHeads) * args.dk * args.dv" }
        ]
      }
    },
    {
      "name": "linear-attention-linear-state-scalar-f16-seq1536-pathology",
      "preset": "stress",
      "provenance": {
        "source": "authored for branch coverage",
        "notes": "Long-sequence supplied-state case at head_dim_k 16. It exercises the recurrent small-dk route's serial token recurrence and distinguishes it from the chunked prefill decomposition."
      },
      "vars": { "batch": 4, "seq": 1536, "qHeads": 4, "kvHeads": 2, "dk": 16, "dv": 16 },
      "attrs": { "q_num_heads": 4, "kv_num_heads": 2, "update_rule": "linear", "scale": 0.25 },
      "inputs": {
        "queryT": { "shape": [4, 1536, 64], "dtype": "float16", "dist": "normal", "seed": 314, "scale": 0.2 },
        "keyT": { "shape": [4, 1536, 32], "dtype": "float16", "dist": "normal", "seed": 315, "scale": 0.2 },
        "valueT": { "shape": [4, 1536, 32], "dtype": "float16", "dist": "normal", "seed": 316, "scale": 0.2 },
        "pastStateT": { "shape": [4, 2, 16, 16], "dtype": "float16", "dist": "normal", "seed": 317, "scale": 0.1 }
      },
      "outputs": {
        "outputT": { "shape": [4, 1536, 64], "dtype": "float16" },
        "presentStateT": { "shape": [4, 2, 16, 16], "dtype": "float16" }
      },
      "bench": {
        "primary": true,
        "metrics": [
          { "type": "gflops", "value": "2 * args.batch * args.seq * (args.qHeads + args.kvHeads) * args.dk * args.dv" }
        ]
      }
    },
    {
      "name": "linear-attention-gated_delta-scalar-headdimk6-seq1536-stress",
      "preset": "stress",
      "vars": { "batch": 8, "seq": 1536, "qHeads": 4, "kvHeads": 4, "dk": 6, "dv": 12 },
      "attrs": { "q_num_heads": 4, "kv_num_heads": 4, "update_rule": "gated_delta", "scale": 0.25 },
      "inputs": {
        "queryT": { "shape": [8, 1536, 24], "dtype": "float32", "dist": "normal", "seed": 301, "scale": 0.2 },
        "keyT": { "shape": [8, 1536, 24], "dtype": "float32", "dist": "normal", "seed": 302, "scale": 0.2 },
        "valueT": { "shape": [8, 1536, 48], "dtype": "float32", "dist": "normal", "seed": 303, "scale": 0.2 },
        "pastStateT": { "shape": [8, 4, 6, 12], "dtype": "float32", "dist": "normal", "seed": 304, "scale": 0.1 },
        "decayT": { "shape": [8, 1536, 4], "dtype": "float32", "dist": "normal", "seed": 305, "scale": 0.1 },
        "betaT": { "shape": [8, 1536, 4], "dtype": "float32", "dist": "normal", "seed": 306, "scale": 0.1 }
      },
      "outputs": {
        "outputT": { "shape": [8, 1536, 48], "dtype": "float32" },
        "presentStateT": { "shape": [8, 4, 6, 12], "dtype": "float32" }
      },
      "bench": {
        "primary": true,
        "metrics": [
          {
            "type": "gflops",
            "value": "2 * args.batch * args.seq * (args.qHeads + 2 * args.kvHeads) * args.dk * args.dv"
          }
        ]
      }
    },
    {
      "name": "linear-attention-linear-scalar-f16-seq1536-stress",
      "preset": "stress",
      "vars": { "batch": 4, "seq": 1536, "qHeads": 4, "kvHeads": 2, "dk": 16, "dv": 16 },
      "attrs": { "q_num_heads": 4, "kv_num_heads": 2, "update_rule": "linear", "scale": 0.25 },
      "inputs": {
        "queryT": { "shape": [4, 1536, 64], "dtype": "float16", "dist": "normal", "seed": 311, "scale": 0.2 },
        "keyT": { "shape": [4, 1536, 32], "dtype": "float16", "dist": "normal", "seed": 312, "scale": 0.2 },
        "valueT": { "shape": [4, 1536, 32], "dtype": "float16", "dist": "normal", "seed": 313, "scale": 0.2 }
      },
      "outputs": {
        "outputT": { "shape": [4, 1536, 64], "dtype": "float16" },
        "presentStateT": { "shape": [4, 2, 16, 16], "dtype": "float16" }
      },
      "bench": {
        "primary": true,
        "metrics": [
          { "type": "gflops", "value": "2 * args.batch * args.seq * (args.qHeads + args.kvHeads) * args.dk * args.dv" }
        ]
      },
      "provenance": {
        "source": "authored for branch coverage",
        "notes": "Zero-state sibling of the supplied-state long-sequence case, covering the same branch and shape without an entry state."
      }
    },
    {
      "name": "linear-attention-gated-delta-f32-bonsai-m16-h48-kv16-dk128-dv128",
      "preset": "stress",
      "vars": { "batch": 1, "seq": 16, "qHeads": 48, "kvHeads": 16, "dk": 128, "dv": 128 },
      "attrs": { "q_num_heads": 48, "kv_num_heads": 16, "update_rule": "gated_delta", "scale": 0.08838834764831845 },
      "inputs": {
        "queryT": { "shape": [1, 16, 6144], "dtype": "float32", "dist": "normal", "seed": 320, "scale": 0.05 },
        "keyT": { "shape": [1, 16, 2048], "dtype": "float32", "dist": "normal", "seed": 321, "scale": 0.05 },
        "valueT": { "shape": [1, 16, 2048], "dtype": "float32", "dist": "normal", "seed": 322, "scale": 0.05 },
        "pastStateT": { "shape": [1, 16, 128, 128], "dtype": "float32", "dist": "normal", "seed": 323, "scale": 0.02 },
        "decayT": { "shape": [1, 16, 16], "dtype": "float32", "dist": "normal", "seed": 324, "scale": 0.08 },
        "betaT": { "shape": [1, 16, 16], "dtype": "float32", "dist": "normal", "seed": 325, "scale": 0.08 }
      },
      "outputs": {
        "outputT": { "shape": [1, 16, 6144], "dtype": "float32", "dist": "empty" },
        "presentStateT": { "shape": [1, 16, 128, 128], "dtype": "float32", "dist": "empty" }
      },
      "bench": {
        "primary": true,
        "metrics": [
          {
            "type": "gflops",
            "value": "2 * args.batch * args.seq * (args.qHeads + 2 * args.kvHeads) * args.dk * args.dv"
          }
        ]
      }
    },
    {
      "name": "linear-attention-gated-delta-f16-bonsai-m16-h48-kv16-dk128-dv128",
      "preset": "stress",
      "vars": { "batch": 1, "seq": 16, "qHeads": 48, "kvHeads": 16, "dk": 128, "dv": 128 },
      "attrs": { "q_num_heads": 48, "kv_num_heads": 16, "update_rule": "gated_delta", "scale": 0.08838834764831845 },
      "inputs": {
        "queryT": { "shape": [1, 16, 6144], "dtype": "float16", "dist": "normal", "seed": 326, "scale": 0.05 },
        "keyT": { "shape": [1, 16, 2048], "dtype": "float16", "dist": "normal", "seed": 327, "scale": 0.05 },
        "valueT": { "shape": [1, 16, 2048], "dtype": "float16", "dist": "normal", "seed": 328, "scale": 0.05 },
        "pastStateT": { "shape": [1, 16, 128, 128], "dtype": "float16", "dist": "normal", "seed": 329, "scale": 0.02 },
        "decayT": { "shape": [1, 16, 16], "dtype": "float16", "dist": "normal", "seed": 330, "scale": 0.08 },
        "betaT": { "shape": [1, 16, 16], "dtype": "float16", "dist": "normal", "seed": 331, "scale": 0.08 }
      },
      "outputs": {
        "outputT": { "shape": [1, 16, 6144], "dtype": "float16", "dist": "empty" },
        "presentStateT": { "shape": [1, 16, 128, 128], "dtype": "float16", "dist": "empty" }
      },
      "bench": {
        "primary": true,
        "metrics": [
          {
            "type": "gflops",
            "value": "2 * args.batch * args.seq * (args.qHeads + 2 * args.kvHeads) * args.dk * args.dv"
          }
        ]
      }
    },
    {
      "name": "linear-attention-qwen3next-decode-s1",
      "preset": "model",
      "provenance": {
        "notes": "Qwen3-Next class defaults (linear_num_value_heads 32, linear_num_key_heads 16, linear_key_head_dim 128, linear_value_head_dim 128) at a decode step, where the recurrence carries the whole cost."
      },
      "vars": { "batch": 1, "seq": 1, "qHeads": 32, "kvHeads": 16, "dk": 128, "dv": 128 },
      "attrs": {
        "q_num_heads": 32,
        "kv_num_heads": 16,
        "update_rule": "gated_delta",
        "scale": 0.08838834764831843,
        "chunk_size": 64
      },
      "inputs": {
        "queryT": { "shape": [1, 1, 4096], "dtype": "float32", "dist": "normal", "seed": 8100, "scale": 0.3 },
        "keyT": { "shape": [1, 1, 2048], "dtype": "float32", "dist": "normal", "seed": 8101, "scale": 0.3 },
        "valueT": { "shape": [1, 1, 2048], "dtype": "float32", "dist": "normal", "seed": 8102, "scale": 0.3 },
        "pastStateT": { "shape": [1, 16, 128, 128], "dtype": "float32", "dist": "normal", "seed": 8103, "scale": 0.1 },
        "decayT": { "shape": [1, 1, 2048], "dtype": "float32", "dist": "uniform", "seed": 8104, "min": 0.9, "max": 1 },
        "betaT": { "shape": [1, 1, 16], "dtype": "float32", "dist": "uniform", "seed": 8105, "min": 0.1, "max": 0.9 }
      },
      "outputs": {
        "outputT": { "shape": [1, 1, 4096], "dtype": "float32" },
        "presentStateT": { "shape": [1, 16, 128, 128], "dtype": "float32" }
      },
      "bench": {
        "metrics": [
          {
            "type": "gflops",
            "value": "2 * args.batch * args.seq * (args.qHeads + 2 * args.kvHeads) * args.dk * args.dv"
          }
        ]
      }
    },
    {
      "name": "linear-attention-qwen3next-prefill-s512",
      "preset": "model",
      "provenance": { "notes": "Qwen3-Next class defaults over a 512-token prefill chunk." },
      "vars": { "batch": 1, "seq": 512, "qHeads": 32, "kvHeads": 16, "dk": 128, "dv": 128 },
      "attrs": {
        "q_num_heads": 32,
        "kv_num_heads": 16,
        "update_rule": "gated_delta",
        "scale": 0.08838834764831843,
        "chunk_size": 64
      },
      "inputs": {
        "queryT": { "shape": [1, 512, 4096], "dtype": "float32", "dist": "normal", "seed": 8200, "scale": 0.3 },
        "keyT": { "shape": [1, 512, 2048], "dtype": "float32", "dist": "normal", "seed": 8201, "scale": 0.3 },
        "valueT": { "shape": [1, 512, 2048], "dtype": "float32", "dist": "normal", "seed": 8202, "scale": 0.3 },
        "pastStateT": { "shape": [1, 16, 128, 128], "dtype": "float32", "dist": "normal", "seed": 8203, "scale": 0.1 },
        "decayT": { "shape": [1, 512, 2048], "dtype": "float32", "dist": "uniform", "seed": 8204, "min": 0.9, "max": 1 },
        "betaT": { "shape": [1, 512, 16], "dtype": "float32", "dist": "uniform", "seed": 8205, "min": 0.1, "max": 0.9 }
      },
      "outputs": {
        "outputT": { "shape": [1, 512, 4096], "dtype": "float32" },
        "presentStateT": { "shape": [1, 16, 128, 128], "dtype": "float32" }
      },
      "bench": {
        "metrics": [
          {
            "type": "gflops",
            "value": "2 * args.batch * args.seq * (args.qHeads + 2 * args.kvHeads) * args.dk * args.dv"
          }
        ]
      }
    },
    {
      "name": "linear-attention-qwen3next-prefill-s2048",
      "preset": "model",
      "provenance": {
        "notes": "Qwen3-Next class defaults over a 2048-token prefill chunk, eight chunk_size 64 blocks per workgroup pass."
      },
      "vars": { "batch": 1, "seq": 2048, "qHeads": 32, "kvHeads": 16, "dk": 128, "dv": 128 },
      "attrs": {
        "q_num_heads": 32,
        "kv_num_heads": 16,
        "update_rule": "gated_delta",
        "scale": 0.08838834764831843,
        "chunk_size": 64
      },
      "inputs": {
        "queryT": { "shape": [1, 2048, 4096], "dtype": "float32", "dist": "normal", "seed": 8300, "scale": 0.3 },
        "keyT": { "shape": [1, 2048, 2048], "dtype": "float32", "dist": "normal", "seed": 8301, "scale": 0.3 },
        "valueT": { "shape": [1, 2048, 2048], "dtype": "float32", "dist": "normal", "seed": 8302, "scale": 0.3 },
        "pastStateT": { "shape": [1, 16, 128, 128], "dtype": "float32", "dist": "normal", "seed": 8303, "scale": 0.1 },
        "decayT": {
          "shape": [1, 2048, 2048],
          "dtype": "float32",
          "dist": "uniform",
          "seed": 8304,
          "min": 0.9,
          "max": 1
        },
        "betaT": { "shape": [1, 2048, 16], "dtype": "float32", "dist": "uniform", "seed": 8305, "min": 0.1, "max": 0.9 }
      },
      "outputs": {
        "outputT": { "shape": [1, 2048, 4096], "dtype": "float32" },
        "presentStateT": { "shape": [1, 16, 128, 128], "dtype": "float32" }
      },
      "bench": {
        "metrics": [
          {
            "type": "gflops",
            "value": "2 * args.batch * args.seq * (args.qHeads + 2 * args.kvHeads) * args.dk * args.dv"
          }
        ]
      }
    }
  ]
}