ai.onnx.Softmax / build /webgpu /bench.json
Xenova's picture
Xenova HF Staff
sync 6fdf6301e2bb
1986f90 verified
Raw History Blame
16.2 kB
{
"tunableSpace": { "WORKGROUP_SIZE": [64, 128, 256] },
"cases": [
{
"name": "softmax-f32-256x1024",
"preset": "smoke",
"vars": { "dtype": "float32", "rows": 256, "cols": 1024 },
"attrs": { "axis": 1 },
"inputs": { "x": { "shape": [256, 1024], "dtype": "float32", "dist": "normal", "seed": 107, "scale": 2 } },
"outputs": { "y": { "shape": [256, 1024], "dtype": "float32" } },
"bench": {
"primary": true,
"metrics": [{ "type": "bandwidth", "value": "args.rows * args.cols * dtypeBytes(args.dtype) * 2" }]
}
},
{
"name": "softmax-f32-4096x128-max-negative",
"preset": "smoke",
"vars": { "dtype": "float32", "rows": 4096, "cols": 128 },
"attrs": { "axis": 1 },
"inputs": {
"x": { "shape": [4096, 128], "dtype": "float32", "dist": "constant", "value": -3.4028234663852886e+38 }
},
"outputs": { "y": { "shape": [4096, 128], "dtype": "float32" } },
"bench": { "metrics": [{ "type": "bandwidth", "value": "args.rows * args.cols * dtypeBytes(args.dtype) * 2" }] }
},
{
"name": "softmax-f32-1024x2048",
"preset": "stress",
"vars": { "dtype": "float32", "rows": 1024, "cols": 2048 },
"attrs": { "axis": 1 },
"inputs": { "x": { "shape": [1024, 2048], "dtype": "float32", "dist": "normal", "seed": 108, "scale": 2 } },
"outputs": { "y": { "shape": [1024, 2048], "dtype": "float32" } },
"bench": { "metrics": [{ "type": "bandwidth", "value": "args.rows * args.cols * dtypeBytes(args.dtype) * 2" }] }
},
{
"name": "gemma4-decode-logits-1x262144",
"preset": "model",
"vars": { "dtype": "float32", "rows": 1, "cols": 262144 },
"attrs": { "axis": 1 },
"inputs": { "x": { "shape": [1, 262144], "dtype": "float32", "dist": "normal", "seed": 380, "scale": 4 } },
"outputs": { "y": { "shape": [1, 262144], "dtype": "float32" } },
"bench": { "metrics": [{ "type": "bandwidth", "value": "args.rows * args.cols * dtypeBytes(args.dtype) * 2" }] }
},
{
"name": "llama-prefill-attn-scores-16384x512",
"preset": "model",
"vars": { "dtype": "float32", "rows": 16384, "cols": 512 },
"attrs": { "axis": 1 },
"inputs": { "x": { "shape": [16384, 512], "dtype": "float32", "dist": "normal", "seed": 381, "scale": 2 } },
"outputs": { "y": { "shape": [16384, 512], "dtype": "float32" } },
"bench": { "metrics": [{ "type": "bandwidth", "value": "args.rows * args.cols * dtypeBytes(args.dtype) * 2" }] }
},
{
"name": "softmax-f32-8192x1023-odd-cols",
"preset": "stress",
"vars": { "dtype": "float32", "rows": 8192, "cols": 1023 },
"attrs": { "axis": 1 },
"inputs": { "x": { "shape": [8192, 1023], "dtype": "float32", "dist": "normal", "seed": 109, "scale": 2 } },
"outputs": { "y": { "shape": [8192, 1023], "dtype": "float32" } },
"bench": { "metrics": [{ "type": "bandwidth", "value": "args.rows * args.cols * dtypeBytes(args.dtype) * 2" }] }
},
{
"name": "llama-prefill-attn-scores-16384x512-f16",
"preset": "model",
"vars": { "dtype": "float16", "rows": 16384, "cols": 512 },
"attrs": { "axis": 1 },
"inputs": { "x": { "shape": [16384, 512], "dtype": "float16", "dist": "normal", "seed": 382, "scale": 2 } },
"outputs": { "y": { "shape": [16384, 512], "dtype": "float16" } },
"bench": { "metrics": [{ "type": "bandwidth", "value": "args.rows * args.cols * dtypeBytes(args.dtype) * 2" }] }
},
{
"name": "softmax-f32-2048x8192",
"preset": "stress",
"vars": { "dtype": "float32", "rows": 2048, "cols": 8192 },
"attrs": { "axis": 1 },
"inputs": { "x": { "shape": [2048, 8192], "dtype": "float32", "dist": "normal", "seed": 410, "scale": 2 } },
"outputs": { "y": { "shape": [2048, 8192], "dtype": "float32" } },
"bench": { "metrics": [{ "type": "bandwidth", "value": "args.rows * args.cols * dtypeBytes(args.dtype) * 2" }] }
},
{
"name": "softmax-f32-2048x8191-odd-cols",
"preset": "stress",
"vars": { "dtype": "float32", "rows": 2048, "cols": 8191 },
"attrs": { "axis": 1 },
"inputs": { "x": { "shape": [2048, 8191], "dtype": "float32", "dist": "normal", "seed": 411, "scale": 2 } },
"outputs": { "y": { "shape": [2048, 8191], "dtype": "float32" } },
"bench": { "metrics": [{ "type": "bandwidth", "value": "args.rows * args.cols * dtypeBytes(args.dtype) * 2" }] }
},
{
"name": "softmax-strided-rank3-16x2048x128-axis1",
"preset": "stress",
"vars": { "dtype": "float32", "outer": 16, "axisDim": 2048, "inner": 128 },
"attrs": { "axis": 1 },
"inputs": { "x": { "shape": [16, 2048, 128], "dtype": "float32", "dist": "normal", "seed": 412, "scale": 2 } },
"outputs": { "y": { "shape": [16, 2048, 128], "dtype": "float32" } },
"bench": {
"metrics": [
{ "type": "bandwidth", "value": "args.outer * args.axisDim * args.inner * dtypeBytes(args.dtype) * 2" }
]
}
},
{
"name": "softmax-f16-2048x8192",
"preset": "stress",
"vars": { "dtype": "float16", "rows": 2048, "cols": 8192 },
"attrs": { "axis": 1 },
"inputs": { "x": { "shape": [2048, 8192], "dtype": "float16", "dist": "normal", "seed": 413, "scale": 2 } },
"outputs": { "y": { "shape": [2048, 8192], "dtype": "float16" } },
"bench": { "metrics": [{ "type": "bandwidth", "value": "args.rows * args.cols * dtypeBytes(args.dtype) * 2" }] }
},
{
"name": "softmax-f32-packed-rows-131072x32-control",
"preset": "stress",
"vars": { "dtype": "float32", "rows": 131072, "cols": 32 },
"attrs": { "axis": 1 },
"inputs": { "x": { "shape": [131072, 32], "dtype": "float32", "dist": "normal", "seed": 700, "scale": 2 } },
"outputs": { "y": { "shape": [131072, 32], "dtype": "float32", "dist": "empty" } },
"bench": { "metrics": [{ "type": "bandwidth", "value": "args.rows * args.cols * dtypeBytes(args.dtype) * 2" }] }
},
{
"name": "softmax-f32-nosg-2097152x32-stable3pass-launchbound",
"preset": "stress",
"vars": { "dtype": "float32", "rows": 2097152, "cols": 32 },
"attrs": { "axis": 1 },
"inputs": { "x": { "shape": [2097152, 32], "dtype": "float32", "dist": "normal", "seed": 701, "scale": 2 } },
"outputs": { "y": { "shape": [2097152, 32], "dtype": "float32", "dist": "empty" } },
"bench": { "metrics": [{ "type": "bandwidth", "value": "args.rows * args.cols * dtypeBytes(args.dtype) * 2" }] }
},
{
"name": "softmax-f16-strided-rank3-256x2048x130-axis1-uncoalesced",
"preset": "stress",
"vars": { "dtype": "float16", "outer": 256, "axisDim": 2048, "inner": 130 },
"attrs": { "axis": 1 },
"inputs": { "x": { "shape": [256, 2048, 130], "dtype": "float16", "dist": "normal", "seed": 702, "scale": 2 } },
"outputs": { "y": { "shape": [256, 2048, 130], "dtype": "float16", "dist": "empty" } },
"bench": {
"metrics": [
{ "type": "bandwidth", "value": "args.outer * args.axisDim * args.inner * dtypeBytes(args.dtype) * 2" }
]
}
},
{
"name": "softmax-f32-strided-rank3-256x2048x130-axis1-inner-not-mod4",
"preset": "stress",
"vars": { "dtype": "float32", "outer": 256, "axisDim": 2048, "inner": 130 },
"attrs": { "axis": 1 },
"inputs": { "x": { "shape": [256, 2048, 130], "dtype": "float32", "dist": "normal", "seed": 703, "scale": 2 } },
"outputs": { "y": { "shape": [256, 2048, 130], "dtype": "float32", "dist": "empty" } },
"bench": {
"metrics": [
{ "type": "bandwidth", "value": "args.outer * args.axisDim * args.inner * dtypeBytes(args.dtype) * 2" }
]
}
},
{
"name": "softmax-f32-64x262144-longrow-rows",
"preset": "smoke",
"vars": { "dtype": "float32", "rows": 2048, "cols": 8192 },
"attrs": { "axis": 1 },
"inputs": { "x": { "shape": [64, 262144], "dtype": "float32", "dist": "normal", "seed": 410, "scale": 2 } },
"outputs": { "y": { "shape": [64, 262144], "dtype": "float32" } },
"bench": { "metrics": [{ "type": "bandwidth", "value": "args.rows * args.cols * dtypeBytes(args.dtype) * 2" }] }
},
{
"name": "softmax-f32-131072x33-online-row-pathology",
"preset": "stress",
"provenance": {
"notes": "One column past the packed-rows ceiling (<= 32 columns): 33 columns leave online_packed_rows_vec4_nosg for online_wg at one workgroup per row, about 32x the workgroup count of the same-bytes control softmax-f32-packed-rows-131072x32-control for a single added column."
},
"vars": { "dtype": "float32", "rows": 131072, "cols": 33 },
"attrs": { "axis": 1 },
"inputs": { "x": { "shape": [131072, 33], "dtype": "float32", "dist": "normal", "seed": 720, "scale": 2 } },
"outputs": { "y": { "shape": [131072, 33], "dtype": "float32", "dist": "empty" } },
"bench": { "metrics": [{ "type": "bandwidth", "value": "args.rows * args.cols * dtypeBytes(args.dtype) * 2" }] }
},
{
"name": "softmax-f32-131072x64-subgroup-rows-control",
"preset": "stress",
"provenance": {
"notes": "Measures softmax over 131,072 rows of 64 columns (a multiple of four); its 33-column sibling in this file has the same row count but moves half the bytes, so compare per element rather than per case."
},
"vars": { "dtype": "float32", "rows": 131072, "cols": 64 },
"attrs": { "axis": 1 },
"inputs": { "x": { "shape": [131072, 64], "dtype": "float32", "dist": "normal", "seed": 721, "scale": 2 } },
"outputs": { "y": { "shape": [131072, 64], "dtype": "float32", "dist": "empty" } },
"bench": { "metrics": [{ "type": "bandwidth", "value": "args.rows * args.cols * dtypeBytes(args.dtype) * 2" }] }
},
{
"name": "softmax-f32-64x50257-vocab-odd-pathology",
"preset": "stress",
"provenance": {
"notes": "GPT-2 vocabulary width 50,257 is not divisible by four, so it exercises scalar online workgroup Softmax. `softmax-f32-64x50260-vocab-control` provides the nearby vector-aligned control."
},
"vars": { "dtype": "float32", "rows": 64, "cols": 50257 },
"attrs": { "axis": 1 },
"inputs": { "x": { "shape": [64, 50257], "dtype": "float32", "dist": "normal", "seed": 722, "scale": 4 } },
"outputs": { "y": { "shape": [64, 50257], "dtype": "float32", "dist": "empty" } },
"bench": { "metrics": [{ "type": "bandwidth", "value": "args.rows * args.cols * dtypeBytes(args.dtype) * 2" }] }
},
{
"name": "softmax-f32-64x50260-vocab-control",
"preset": "stress",
"provenance": {
"notes": "The next multiple-of-four vocabulary width above the paired 50,257-column case, with nearly the same input bytes."
},
"vars": { "dtype": "float32", "rows": 64, "cols": 50260 },
"attrs": { "axis": 1 },
"inputs": { "x": { "shape": [64, 50260], "dtype": "float32", "dist": "normal", "seed": 723, "scale": 4 } },
"outputs": { "y": { "shape": [64, 50260], "dtype": "float32", "dist": "empty" } },
"bench": { "metrics": [{ "type": "bandwidth", "value": "args.rows * args.cols * dtypeBytes(args.dtype) * 2" }] }
},
{
"name": "softmax-f32-4096x197-vit-tokens-pathology",
"preset": "stress",
"provenance": {
"notes": "ViT-B/16 token count (196 patches + CLS) as the softmax row width, batched to ~0.8M elements: 197 % 4 != 0 rejects both the subgroup-per-row vec4 route and online_wg_vec4, leaving online_wg scalar. Control: softmax-f32-4096x200-vit-tokens-control."
},
"vars": { "dtype": "float32", "rows": 4096, "cols": 197 },
"attrs": { "axis": 1 },
"inputs": { "x": { "shape": [4096, 197], "dtype": "float32", "dist": "normal", "seed": 724, "scale": 2 } },
"outputs": { "y": { "shape": [4096, 197], "dtype": "float32", "dist": "empty" } },
"bench": { "metrics": [{ "type": "bandwidth", "value": "args.rows * args.cols * dtypeBytes(args.dtype) * 2" }] }
},
{
"name": "softmax-f32-4096x200-vit-tokens-control",
"preset": "stress",
"provenance": {
"notes": "A 200-column control for the paired 197-column ViT token case; the width changes input size by about 1.5%. Both subgroup and portable tiers must normalize every row."
},
"vars": { "dtype": "float32", "rows": 4096, "cols": 200 },
"attrs": { "axis": 1 },
"inputs": { "x": { "shape": [4096, 200], "dtype": "float32", "dist": "normal", "seed": 725, "scale": 2 } },
"outputs": { "y": { "shape": [4096, 200], "dtype": "float32", "dist": "empty" } },
"bench": { "metrics": [{ "type": "bandwidth", "value": "args.rows * args.cols * dtypeBytes(args.dtype) * 2" }] }
},
{
"name": "softmax-f32-131072x21-narrow-unaligned-classes",
"preset": "stress",
"vars": { "dtype": "float32", "rows": 131072, "cols": 32 },
"attrs": { "axis": 1 },
"inputs": { "x": { "shape": [131072, 21], "dtype": "float32", "dist": "normal", "seed": 700, "scale": 2 } },
"outputs": { "y": { "shape": [131072, 21], "dtype": "float32", "dist": "empty" } },
"bench": { "metrics": [{ "type": "bandwidth", "value": "args.rows * args.cols * dtypeBytes(args.dtype) * 2" }] },
"provenance": {
"notes": "A segmentation head with 131,072 rows and 21 unaligned classes exercises the narrow scalar-row geometry."
}
},
{
"name": "online_stream_axis31_f16",
"attrs": { "axis": 1 },
"inputs": { "x": { "dtype": "float16", "shape": [2, 31, 8], "dist": "normal", "seed": 913, "scale": 2 } },
"outputs": { "y": { "dtype": "float16", "shape": [2, 31, 8] } },
"bench": { "metrics": [{ "type": "bandwidth", "value": "numel(shapes.x) * 4" }] }
},
{
"name": "online_stream_axis32_f16",
"attrs": { "axis": 1 },
"inputs": { "x": { "dtype": "float16", "shape": [2, 32, 8], "dist": "normal", "seed": 913, "scale": 2 } },
"outputs": { "y": { "dtype": "float16", "shape": [2, 32, 8] } },
"bench": { "metrics": [{ "type": "bandwidth", "value": "numel(shapes.x) * 4" }] }
},
{
"name": "online_stream_axis33_f16",
"attrs": { "axis": 1 },
"inputs": { "x": { "dtype": "float16", "shape": [2, 33, 8], "dist": "normal", "seed": 913, "scale": 2 } },
"outputs": { "y": { "dtype": "float16", "shape": [2, 33, 8] } },
"bench": { "metrics": [{ "type": "bandwidth", "value": "numel(shapes.x) * 4" }] }
},
{
"name": "online_stream_axis64_f16",
"attrs": { "axis": 1 },
"inputs": { "x": { "dtype": "float16", "shape": [2, 64, 8], "dist": "normal", "seed": 913, "scale": 2 } },
"outputs": { "y": { "dtype": "float16", "shape": [2, 64, 8] } },
"bench": { "metrics": [{ "type": "bandwidth", "value": "numel(shapes.x) * 4" }] }
},
{
"name": "online_stream_axis65_f16",
"attrs": { "axis": 1 },
"inputs": { "x": { "dtype": "float16", "shape": [2, 65, 8], "dist": "normal", "seed": 913, "scale": 2 } },
"outputs": { "y": { "dtype": "float16", "shape": [2, 65, 8] } },
"bench": { "metrics": [{ "type": "bandwidth", "value": "numel(shapes.x) * 4" }] }
},
{
"name": "online_stream_columns_tail_f16",
"attrs": { "axis": 1 },
"inputs": { "x": { "dtype": "float16", "shape": [129, 67, 130], "dist": "normal", "seed": 913, "scale": 2 } },
"outputs": { "y": { "dtype": "float16", "shape": [129, 67, 130] } },
"bench": { "metrics": [{ "type": "bandwidth", "value": "numel(shapes.x) * 4" }] }
},
{
"name": "online_stream_four_way_tail_f16",
"attrs": { "axis": 1 },
"inputs": { "x": { "dtype": "float16", "shape": [2, 129, 8], "dist": "normal", "seed": 913, "scale": 2 } },
"outputs": { "y": { "dtype": "float16", "shape": [2, 129, 8] } },
"bench": { "metrics": [{ "type": "bandwidth", "value": "numel(shapes.x) * 4" }] },
"tunables": { "STRIDED_ONLINE_STREAMS": 4 }
}
]
}