File size: 11,237 Bytes
30e6997
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
{
  "op": "ai.onnx.Transpose",
  "tunableSpace": {
    "WORKGROUP_SIZE": [64, 128, 256],
    "INNER_VEC4_ITEMS_PER_THREAD": [1, 2, 4, 8],
    "INNER_VEC4_MIN_THREADS": [16384, 65536, 262144]
  },
  "cases": [
    {
      "name": "transpose-f32-1024x1024",
      "preset": "smoke",
      "vars": { "rows": 1024, "cols": 1024 },
      "attrs": { "perm": [1, 0] },
      "inputs": { "x": { "shape": [1024, 1024], "dtype": "float32", "dist": "normal", "seed": 120, "scale": 0.2 } },
      "outputs": { "y": { "shape": [1024, 1024], "dtype": "float32" } },
      "bench": { "primary": true, "metrics": [{ "type": "bandwidth", "value": "args.rows * args.cols * 4 * 2" }] }
    },
    {
      "name": "transpose-f32-rank1-1m",
      "preset": "smoke",
      "vars": { "count": 1048576, "dtype": "float32" },
      "inputs": { "x": { "shape": [1048576], "dtype": "float32", "dist": "normal", "seed": 121, "scale": 0.2 } },
      "outputs": { "y": { "shape": [1048576], "dtype": "float32" } },
      "bench": { "metrics": [{ "type": "bandwidth", "value": "args.count * dtypeBytes(args.dtype) * 2" }] }
    },
    {
      "name": "transpose-tiled-f32-2048x2048",
      "preset": "smoke",
      "vars": { "rows": 2048, "cols": 2048, "dtype": "float32" },
      "attrs": { "perm": [1, 0] },
      "inputs": { "x": { "shape": [2048, 2048], "dtype": "float32", "dist": "normal", "seed": 122, "scale": 0.2 } },
      "outputs": { "y": { "shape": [2048, 2048], "dtype": "float32" } },
      "bench": { "metrics": [{ "type": "bandwidth", "value": "args.rows * args.cols * dtypeBytes(args.dtype) * 2" }] }
    },
    {
      "name": "transpose-tiled-f16-4096x1024",
      "preset": "smoke",
      "vars": { "rows": 4096, "cols": 1024, "dtype": "float16" },
      "attrs": { "perm": [1, 0] },
      "inputs": { "x": { "shape": [4096, 1024], "dtype": "float16", "dist": "normal", "seed": 123, "scale": 0.2 } },
      "outputs": { "y": { "shape": [1024, 4096], "dtype": "float16" } },
      "bench": { "metrics": [{ "type": "bandwidth", "value": "args.rows * args.cols * dtypeBytes(args.dtype) * 2" }] }
    },
    {
      "name": "transpose-batched-f32-8x512x256",
      "preset": "smoke",
      "vars": { "batch": 8, "rows": 512, "cols": 256, "dtype": "float32" },
      "attrs": { "perm": [0, 2, 1] },
      "inputs": { "x": { "shape": [8, 512, 256], "dtype": "float32", "dist": "normal", "seed": 124, "scale": 0.2 } },
      "outputs": { "y": { "shape": [8, 256, 512], "dtype": "float32" } },
      "bench": {
        "metrics": [{ "type": "bandwidth", "value": "args.batch * args.rows * args.cols * dtypeBytes(args.dtype) * 2" }]
      }
    },
    {
      "name": "transpose-inner-vec4-f32-8x64x32x128",
      "preset": "smoke",
      "vars": { "count": 2097152, "dtype": "float32" },
      "attrs": { "perm": [0, 2, 1, 3] },
      "inputs": { "x": { "shape": [8, 64, 32, 128], "dtype": "float32", "dist": "normal", "seed": 125, "scale": 0.2 } },
      "outputs": { "y": { "shape": [8, 32, 64, 128], "dtype": "float32" } },
      "bench": { "metrics": [{ "type": "bandwidth", "value": "args.count * dtypeBytes(args.dtype) * 2" }] }
    },
    {
      "name": "transpose-identity-f32-4m",
      "preset": "edge",
      "vars": { "count": 4194304, "dtype": "float32" },
      "attrs": { "perm": [0, 1] },
      "inputs": { "x": { "shape": [2048, 2048], "dtype": "float32", "dist": "normal", "seed": 126, "scale": 0.2 } },
      "outputs": { "y": { "shape": [2048, 2048], "dtype": "float32" } },
      "bench": { "metrics": [{ "type": "bandwidth", "value": "args.count * dtypeBytes(args.dtype) * 2" }] }
    },
    {
      "name": "transpose-scalar-f32-1024x1023",
      "preset": "edge",
      "vars": { "rows": 1024, "cols": 1023, "dtype": "float32" },
      "attrs": { "perm": [1, 0] },
      "inputs": { "x": { "shape": [1024, 1023], "dtype": "float32", "dist": "normal", "seed": 130, "scale": 0.2 } },
      "outputs": { "y": { "shape": [1023, 1024], "dtype": "float32" } },
      "bench": { "metrics": [{ "type": "bandwidth", "value": "args.rows * args.cols * dtypeBytes(args.dtype) * 2" }] }
    },
    {
      "name": "transpose-scalar-f32-768x50257-vocab",
      "preset": "edge",
      "vars": { "rows": 768, "cols": 50257, "dtype": "float32" },
      "attrs": { "perm": [1, 0] },
      "inputs": { "x": { "shape": [768, 50257], "dtype": "float32", "dist": "normal", "seed": 131, "scale": 0.2 } },
      "outputs": { "y": { "shape": [50257, 768], "dtype": "float32" } },
      "bench": { "metrics": [{ "type": "bandwidth", "value": "args.rows * args.cols * dtypeBytes(args.dtype) * 2" }] }
    },
    {
      "name": "transpose-scalar-f32-rank3-8x512x255",
      "preset": "edge",
      "vars": { "batch": 8, "rows": 512, "cols": 255, "dtype": "float32" },
      "attrs": { "perm": [0, 2, 1] },
      "inputs": { "x": { "shape": [8, 512, 255], "dtype": "float32", "dist": "normal", "seed": 132, "scale": 0.2 } },
      "outputs": { "y": { "shape": [8, 255, 512], "dtype": "float32" } },
      "bench": {
        "metrics": [{ "type": "bandwidth", "value": "args.batch * args.rows * args.cols * dtypeBytes(args.dtype) * 2" }]
      }
    },
    {
      "name": "transpose-tiled-i32-1024x1024",
      "preset": "edge",
      "vars": { "rows": 1024, "cols": 1024, "dtype": "int32" },
      "attrs": { "perm": [1, 0] },
      "inputs": {
        "x": { "shape": [1024, 1024], "dtype": "int32", "dist": "randint", "seed": 133, "min": -1000, "max": 1000 }
      },
      "outputs": { "y": { "shape": [1024, 1024], "dtype": "int32" } },
      "bench": { "metrics": [{ "type": "bandwidth", "value": "args.rows * args.cols * dtypeBytes(args.dtype) * 2" }] }
    },
    {
      "name": "transpose-scalar-f32-rank4-nhwc-to-nchw-8x64x96x96",
      "preset": "stress",
      "vars": { "n": 8, "h": 64, "w": 96, "c": 96, "dtype": "float32" },
      "attrs": { "perm": [0, 3, 1, 2] },
      "inputs": { "x": { "shape": [8, 64, 96, 96], "dtype": "float32", "dist": "normal", "seed": 140, "scale": 0.2 } },
      "outputs": { "y": { "shape": [8, 96, 64, 96], "dtype": "float32" } },
      "bench": {
        "metrics": [{ "type": "bandwidth", "value": "args.n * args.h * args.w * args.c * dtypeBytes(args.dtype) * 2" }]
      }
    },
    {
      "name": "transpose-scalar-f32-rank3-default-reverse-96x200x128",
      "preset": "stress",
      "vars": { "d0": 96, "d1": 200, "d2": 128, "dtype": "float32" },
      "inputs": { "x": { "shape": [96, 200, 128], "dtype": "float32", "dist": "normal", "seed": 141, "scale": 0.2 } },
      "outputs": { "y": { "shape": [128, 200, 96], "dtype": "float32" } },
      "bench": {
        "metrics": [{ "type": "bandwidth", "value": "args.d0 * args.d1 * args.d2 * dtypeBytes(args.dtype) * 2" }]
      }
    },
    {
      "name": "transpose-scalar-f32-rank5-ncdhw-to-ndhwc-volumetric",
      "preset": "stress",
      "vars": { "count": 8388608, "dtype": "float32" },
      "attrs": { "perm": [0, 2, 3, 4, 1] },
      "inputs": {
        "x": { "shape": [1, 64, 32, 64, 64], "dtype": "float32", "dist": "normal", "seed": 142, "scale": 0.2 }
      },
      "outputs": { "y": { "shape": [1, 32, 64, 64, 64], "dtype": "float32", "dist": "empty" } },
      "bench": { "metrics": [{ "type": "bandwidth", "value": "args.count * dtypeBytes(args.dtype) * 2" }] }
    },
    {
      "name": "transpose-scalar-f32-rank5-ndhwc-to-ncdhw-volumetric",
      "preset": "stress",
      "vars": { "count": 8388608, "dtype": "float32" },
      "attrs": { "perm": [0, 4, 1, 2, 3] },
      "inputs": {
        "x": { "shape": [1, 32, 64, 64, 64], "dtype": "float32", "dist": "normal", "seed": 143, "scale": 0.2 }
      },
      "outputs": { "y": { "shape": [1, 64, 32, 64, 64], "dtype": "float32", "dist": "empty" } },
      "bench": {
        "primary": true,
        "metrics": [{ "type": "bandwidth", "value": "args.count * dtypeBytes(args.dtype) * 2" }]
      }
    },
    {
      "name": "transpose-f32-rank4-nchw-to-nhwc-8x64x96x96",
      "preset": "stress",
      "vars": { "n": 8, "h": 64, "w": 96, "c": 96, "dtype": "float32" },
      "attrs": { "perm": [0, 2, 3, 1] },
      "inputs": { "x": { "shape": [8, 64, 96, 96], "dtype": "float32", "dist": "normal", "seed": 140, "scale": 0.2 } },
      "outputs": { "y": { "shape": [8, 96, 96, 64], "dtype": "float32" } },
      "bench": {
        "metrics": [{ "type": "bandwidth", "value": "args.n * args.h * args.w * args.c * dtypeBytes(args.dtype) * 2" }]
      }
    },
    {
      "name": "transpose-unitdim-memcpy-f32-4096x1024x1-perm201",
      "preset": "smoke",
      "vars": { "tokens": 4096, "hidden": 1024, "dtype": "float32" },
      "attrs": { "perm": [2, 0, 1] },
      "inputs": { "x": { "shape": [4096, 1024, 1], "dtype": "float32", "dist": "normal", "seed": 141, "scale": 0.2 } },
      "outputs": { "y": { "shape": [1, 4096, 1024], "dtype": "float32" } },
      "bench": {
        "metrics": [{ "type": "bandwidth", "value": "args.tokens * args.hidden * dtypeBytes(args.dtype) * 2" }]
      }
    },
    {
      "name": "transpose-inner-vec4-f32-dinov2-qkv-1814x3x6x64",
      "preset": "all",
      "provenance": {
        "source": "Depth Anything V2 Small backbone",
        "notes": "Depth Anything V2 Small's stacked q/k/v permute at 518x686, repeated once per DINOv2 layer. It exercises the inner-vec4 route at the model's 1814-row shape."
      },
      "vars": { "count": 2089728, "dtype": "float32" },
      "attrs": { "perm": [1, 2, 0, 3] },
      "inputs": { "x": { "shape": [1814, 3, 6, 64], "dtype": "float32", "dist": "normal", "seed": 9411, "scale": 0.2 } },
      "outputs": { "y": { "shape": [3, 6, 1814, 64], "dtype": "float32" } },
      "bench": { "metrics": [{ "type": "bandwidth", "value": "args.count * dtypeBytes(args.dtype) * 2" }] }
    },
    {
      "name": "transpose-f32-dpt-patchgrid-1813x384",
      "preset": "all",
      "provenance": {
        "source": "Depth Anything V2 Small neck reassemble",
        "notes": "Probe pair (a): the real 37x49 patch grid has 1813 rows and is not vec4-aligned. Together with pair (b), it verifies that extent parity does not determine whether the transpose is staged."
      },
      "vars": { "count": 696192, "dtype": "float32" },
      "attrs": { "perm": [1, 0] },
      "inputs": { "x": { "shape": [1813, 384], "dtype": "float32", "dist": "normal", "seed": 9441, "scale": 0.2 } },
      "outputs": { "y": { "shape": [384, 1813], "dtype": "float32" } },
      "bench": { "metrics": [{ "type": "bandwidth", "value": "args.count * dtypeBytes(args.dtype) * 2" }] }
    },
    {
      "name": "transpose-f32-dpt-patchgrid-1812x384-aligned",
      "preset": "all",
      "provenance": {
        "source": "Depth Anything V2 Small neck reassemble",
        "notes": "Probe pair (b): the same transpose one row shorter, making the row extent vec4-aligned. It is the aligned control for pair (a)."
      },
      "vars": { "count": 695808, "dtype": "float32" },
      "attrs": { "perm": [1, 0] },
      "inputs": { "x": { "shape": [1812, 384], "dtype": "float32", "dist": "normal", "seed": 9451, "scale": 0.2 } },
      "outputs": { "y": { "shape": [384, 1812], "dtype": "float32" } },
      "bench": { "metrics": [{ "type": "bandwidth", "value": "args.count * dtypeBytes(args.dtype) * 2" }] }
    }
  ]
}