File size: 18,808 Bytes
87e48ce | 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 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 | {
"op": "com.microsoft.BiasSoftmax",
"cases": [
{
"name": "inner_broadcast_consecutive_row_groups",
"provenance": {
"source": "onnxruntime/contrib_ops/cuda/math/bias_softmax_impl.cu",
"notes": "Distinguishes ORT's flattened inner-broadcast row grouping from both outer mode and NumPy right-aligned broadcasting."
},
"attrs": { "axis": -1, "is_inner_broadcast": 1 },
"inputs": {
"data": { "dtype": "float32", "shape": [2, 3, 2], "data": { "kind": "constant", "value": 0.0 } },
"bias": { "dtype": "float32", "shape": [2, 2], "data": { "kind": "values", "values": [0.0, 2.0, 2.0, 0.0] } }
},
"outputs": {
"output": {
"dtype": "float32",
"shape": [2, 3, 2],
"tolerance": 0.000001,
"relTolerance": 0.000001,
"data": {
"kind": "values",
"values": [0.119202922022, 0.880797077978, 0.119202922022, 0.880797077978, 0.119202922022, 0.880797077978, 0.880797077978, 0.119202922022, 0.880797077978, 0.119202922022, 0.880797077978, 0.119202922022]
}
}
}
},
{
"name": "outer_broadcast_cycles_bias_rows",
"provenance": {
"source": "onnxruntime/contrib_ops/cuda/math/bias_softmax_impl.cu",
"notes": "Uses the same non-NumPy-broadcastable shapes as the inner case and pins ORT's cyclic outer-broadcast row selection."
},
"attrs": { "axis": -1, "is_inner_broadcast": 0 },
"inputs": {
"data": { "dtype": "float32", "shape": [2, 3, 2], "data": { "kind": "constant", "value": 0.0 } },
"bias": { "dtype": "float32", "shape": [2, 2], "data": { "kind": "values", "values": [0.0, 2.0, 2.0, 0.0] } }
},
"outputs": {
"output": {
"dtype": "float32",
"shape": [2, 3, 2],
"tolerance": 0.000001,
"relTolerance": 0.000001,
"data": {
"kind": "values",
"values": [0.119202922022, 0.880797077978, 0.880797077978, 0.119202922022, 0.119202922022, 0.880797077978, 0.880797077978, 0.119202922022, 0.119202922022, 0.880797077978, 0.880797077978, 0.119202922022]
}
}
}
},
{
"name": "ort_inner_broadcast_full_suffix_softmax",
"provenance": {
"source": "onnxruntime/test/contrib_ops/bias_softmax_op_test.cc",
"test": "BiasSoftmaxTest.InnerBroadcastFullBiasBatch",
"notes": "Small deterministic projection of ORT's suffix softmax semantics."
},
"attrs": { "axis": 1, "is_inner_broadcast": 1 },
"inputs": {
"data": { "dtype": "float32", "shape": [1, 2, 2], "data": { "kind": "values", "values": [0.0, 0.0, 0.0, 0.0] } },
"bias": { "dtype": "float32", "shape": [1, 2, 2], "data": { "kind": "values", "values": [0.0, 1.0, 2.0, 3.0] } }
},
"outputs": {
"output": {
"dtype": "float32",
"shape": [1, 2, 2],
"tolerance": 0.000001,
"relTolerance": 0.000001,
"data": { "kind": "values", "values": [0.03205860328, 0.087144318742, 0.23688281809, 0.643914259888] }
}
}
},
{
"name": "ort_inner_broadcast_empty_bias_batch",
"provenance": {
"source": "onnxruntime/test/contrib_ops/bias_softmax_op_test.cc",
"test": "BiasSoftmaxTest.InnerBroadcastEmptyBiasBatch",
"notes": "Compact deterministic projection where one bias batch broadcasts across two input batches."
},
"attrs": { "axis": 1, "is_inner_broadcast": 1 },
"inputs": {
"data": {
"dtype": "float32",
"shape": [2, 2, 2],
"data": { "kind": "values", "values": [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0] }
},
"bias": { "dtype": "float32", "shape": [1, 2, 2], "data": { "kind": "values", "values": [0.0, 1.0, 2.0, 3.0] } }
},
"outputs": {
"output": {
"dtype": "float32",
"shape": [2, 2, 2],
"tolerance": 0.000001,
"relTolerance": 0.000001,
"data": {
"kind": "values",
"values": [0.03205860328, 0.087144318742, 0.23688281809, 0.643914259888, 0.03205860328, 0.087144318742, 0.23688281809, 0.643914259888]
}
}
}
},
{
"name": "ort_inner_broadcast_negative_axis",
"provenance": {
"source": "onnxruntime/test/contrib_ops/bias_softmax_op_test.cc",
"test": "BiasSoftmaxTest.InnerBroadcastNegativeAxis",
"notes": "Small deterministic projection of ORT's negative-axis inner broadcast pattern."
},
"attrs": { "axis": -2, "is_inner_broadcast": 1 },
"inputs": {
"data": {
"dtype": "float32",
"shape": [2, 2, 2],
"data": { "kind": "values", "values": [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0] }
},
"bias": { "dtype": "float32", "shape": [1, 2, 2], "data": { "kind": "values", "values": [0.0, 1.0, 2.0, 3.0] } }
},
"outputs": {
"output": {
"dtype": "float32",
"shape": [2, 2, 2],
"tolerance": 0.000001,
"relTolerance": 0.000001,
"data": {
"kind": "values",
"values": [0.03205860328, 0.087144318742, 0.23688281809, 0.643914259888, 0.03205860328, 0.087144318742, 0.23688281809, 0.643914259888]
}
}
}
},
{
"name": "ort_outer_broadcast_negative_axis",
"provenance": {
"source": "onnxruntime/test/contrib_ops/bias_softmax_op_test.cc",
"test": "BiasSoftmaxTest.OuterBroadcastNegativeAxis",
"notes": "Small deterministic projection of ORT's negative-axis outer broadcast pattern."
},
"attrs": { "axis": -1, "is_inner_broadcast": 0 },
"inputs": {
"data": {
"dtype": "float32",
"shape": [2, 2, 3],
"data": { "kind": "values", "values": [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0] }
},
"bias": {
"dtype": "float32",
"shape": [2, 3],
"data": { "kind": "values", "values": [0.0, 1.0, 2.0, 2.0, 1.0, 0.0] }
}
},
"outputs": {
"output": {
"dtype": "float32",
"shape": [2, 2, 3],
"tolerance": 0.000001,
"relTolerance": 0.000001,
"data": {
"kind": "values",
"values": [0.09003057317, 0.244728471055, 0.665240955775, 0.665240955775, 0.244728471055, 0.09003057317, 0.09003057317, 0.244728471055, 0.665240955775, 0.665240955775, 0.244728471055, 0.09003057317]
}
}
}
},
{
"name": "ort_outer_broadcast_full_bias_batch",
"provenance": {
"source": "onnxruntime/test/contrib_ops/bias_softmax_op_test.cc",
"test": "BiasSoftmaxTest.OuterBroadcastFullBiasBatch",
"notes": "Compact deterministic projection where every input batch has its own full bias row."
},
"attrs": { "axis": -1, "is_inner_broadcast": 0 },
"inputs": {
"data": {
"dtype": "float32",
"shape": [2, 2, 3],
"data": { "kind": "values", "values": [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0] }
},
"bias": {
"dtype": "float32",
"shape": [2, 2, 3],
"data": { "kind": "values", "values": [0.0, 1.0, 2.0, 2.0, 1.0, 0.0, -1.0, 0.0, 1.0, 1.0, 0.0, -1.0] }
}
},
"outputs": {
"output": {
"dtype": "float32",
"shape": [2, 2, 3],
"tolerance": 0.000001,
"relTolerance": 0.000001,
"data": {
"kind": "values",
"values": [0.09003057317, 0.244728471055, 0.665240955775, 0.665240955775, 0.244728471055, 0.09003057317, 0.09003057317, 0.244728471055, 0.665240955775, 0.665240955775, 0.244728471055, 0.09003057317]
}
}
}
},
{
"name": "f32_large_gap_subnormal_tail_gpu_gap",
"skipGpu": {
"category": "permanent",
"reason": "Portable WGSL floating-point semantics do not guarantee preservation of the subnormal values required by this fixture. Backend evidence: WebGPU/Metal flushes subnormals to zero in f32; the 87.5-point logit gap makes the tail probability subnormal, which collapses to zero instead of ORT's positive subnormal value."
},
"provenance": {
"source": "onnxruntime/test/contrib_ops/bias_softmax_op_test.cc",
"test": "BiasSoftmaxTest.InnerBroadcastFullBiasBatch",
"notes": "BiasSoftmax is a suffix softmax over data+bias; an 87.5-point gap leaves a valid positive subnormal probability tail in ORT CPU."
},
"attrs": { "axis": 1, "is_inner_broadcast": 1 },
"inputs": {
"data": { "dtype": "float32", "shape": [1, 2], "data": { "kind": "values", "values": [0.0, -87.5] } },
"bias": { "dtype": "float32", "shape": [1, 2], "data": { "kind": "values", "values": [0.0, 0.0] } }
},
"outputs": {
"output": {
"dtype": "float32",
"shape": [1, 2],
"tolerance": 2e-45,
"relTolerance": 0,
"data": { "kind": "values", "values": [1.0, 9.982351397596697e-39] }
}
}
},
{
"name": "ort_outer_broadcast_empty_bias_batch",
"provenance": {
"source": "onnxruntime/test/contrib_ops/bias_softmax_op_test.cc",
"test": "BiasSoftmaxTest.OuterBroadcastEmptyBiasBatch",
"notes": "Compact deterministic projection where one outer-broadcast bias row is reused for every input batch."
},
"attrs": { "axis": -1, "is_inner_broadcast": 0 },
"inputs": {
"data": {
"dtype": "float32",
"shape": [2, 2, 3],
"data": { "kind": "values", "values": [0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0] }
},
"bias": { "dtype": "float32", "shape": [1, 3], "data": { "kind": "values", "values": [0.0, 1.0, 2.0] } }
},
"outputs": {
"output": {
"dtype": "float32",
"shape": [2, 2, 3],
"tolerance": 0.000001,
"relTolerance": 0.000001,
"data": {
"kind": "values",
"values": [0.09003057317, 0.244728471055, 0.665240955775, 0.09003057317, 0.244728471055, 0.665240955775, 0.09003057317, 0.244728471055, 0.665240955775, 0.09003057317, 0.244728471055, 0.665240955775]
}
}
}
},
{
"name": "empty_zero_dim",
"attrs": { "axis": 1, "is_inner_broadcast": 1 },
"inputs": {
"data": { "dtype": "float32", "shape": [0, 2, 2], "data": { "kind": "values", "values": [] } },
"bias": { "dtype": "float32", "shape": [0, 2, 2], "data": { "kind": "values", "values": [] } }
},
"outputs": { "output": { "dtype": "float32", "shape": [0, 2, 2], "tolerance": 0 } }
},
{
"name": "f16_default_axis_two_element_row",
"attrs": { "is_inner_broadcast": 1 },
"inputs": {
"data": { "dtype": "float16", "shape": [1, 2], "data": { "kind": "values", "values": [0.0, 0.0] } },
"bias": { "dtype": "float16", "shape": [1, 2], "data": { "kind": "values", "values": [0.0, 0.0] } }
},
"outputs": {
"output": {
"dtype": "float16",
"shape": [1, 2],
"tolerance": 0,
"data": { "kind": "values", "values": [0.5, 0.5] }
}
}
},
{
"name": "dispatch_cliff_rows_65537",
"provenance": {
"notes": "65,537 short rows cross the per-dimension workgroup limit. The selected packed route keeps the dispatch small and grid-strides; an all-variant run also retains coverage of the generic kernel's 2D-folded row reconstruction."
},
"attrs": { "axis": 1, "is_inner_broadcast": 0 },
"inputs": {
"data": {
"dtype": "float32",
"shape": [65537, 4],
"data": { "kind": "cycle", "values": [0.1, 0.2, 0.3, 0.4, 0.5] }
},
"bias": { "dtype": "float32", "shape": [65537, 4], "data": { "kind": "constant", "value": 0.0 } }
},
"outputs": { "output": { "dtype": "float32", "shape": [65537, 4], "tolerance": 0.0001 } }
},
{
"name": "fully_masked_row_neg_inf_bias",
"provenance": {
"notes": "Fully additive-masked softmax row (bias = -Infinity over the whole suffix block). GPU (FLT_MAX-init online softmax), the TS reference, ai.onnx.Softmax, and ORT's WebGPU EP all emit 0 for a fully-masked row (a NaN would poison attention). Pinned to 0."
},
"attrs": { "axis": 1, "is_inner_broadcast": 0 },
"inputs": {
"data": { "dtype": "float32", "shape": [1, 4], "data": { "kind": "values", "values": [0.0, 0.0, 0.0, 0.0] } },
"bias": {
"dtype": "float32",
"shape": [1, 4],
"data": { "kind": "values", "values": ["-Infinity", "-Infinity", "-Infinity", "-Infinity"] }
}
},
"outputs": {
"output": {
"dtype": "float32",
"shape": [1, 4],
"tolerance": 0.000001,
"data": { "kind": "values", "values": [0.0, 0.0, 0.0, 0.0] }
}
}
},
{
"name": "axis0_full_reduce_single_block",
"provenance": {
"notes": "axis=0 => outer(data,0)=1 => one softmax block over the whole tensor (batchCount=1, blockSize=numel). ORT requires one complete flattened bias row, so bias has the full [4,6] shape."
},
"attrs": { "axis": 0, "is_inner_broadcast": 0 },
"inputs": {
"data": { "dtype": "float32", "shape": [4, 6], "data": { "kind": "linspace", "start": -3.0, "end": 3.0 } },
"bias": {
"dtype": "float32",
"shape": [4, 6],
"data": {
"kind": "values",
"values": [0.5, -0.5, 1.0, -1.0, 0.25, -0.25, 0.5, -0.5, 1.0, -1.0, 0.25, -0.25, 0.5, -0.5, 1.0, -1.0, 0.25, -0.25, 0.5, -0.5, 1.0, -1.0, 0.25, -0.25]
}
}
},
"outputs": { "output": { "dtype": "float32", "shape": [4, 6], "tolerance": 0.000001, "relTolerance": 0.000001 } }
},
{
"name": "bias_fold_skip_middle_dim_axis1",
"provenance": {
"notes": "bias [1,3,4] broadcast over batch axis of data [2,3,4], axis=1 (suffix softmax over 3*4=12). Exercises the compiled bias_index() fold when a size-1 bias axis is skipped and the reduction spans multiple axes. Truth from the TS reference."
},
"attrs": { "axis": 1, "is_inner_broadcast": 0 },
"inputs": {
"data": { "dtype": "float32", "shape": [2, 3, 4], "data": { "kind": "linspace", "start": -2.0, "end": 2.0 } },
"bias": { "dtype": "float32", "shape": [1, 3, 4], "data": { "kind": "linspace", "start": -1.0, "end": 1.0 } }
},
"outputs": {
"output": { "dtype": "float32", "shape": [2, 3, 4], "tolerance": 0.000001, "relTolerance": 0.000001 }
}
},
{
"name": "many_two_element_rows_axis1",
"provenance": {
"notes": "Compact companion for bench case biassoftmax-f32-launchbound-262144x2-axis1: many tiny softmax rows stress the scalar-row fallback and folded dispatch accounting."
},
"attrs": { "axis": 1, "is_inner_broadcast": 0 },
"inputs": {
"data": {
"dtype": "float32",
"shape": [4096, 2],
"data": { "kind": "fillFloat32", "scale": 0.25, "sinStep": 0.17, "cosStep": 0.31 }
},
"bias": { "dtype": "float32", "shape": [1, 2], "data": { "kind": "values", "values": [0.125, -0.25] } }
},
"outputs": {
"output": { "dtype": "float32", "shape": [4096, 2], "tolerance": 0.000001, "relTolerance": 0.000001 }
}
},
{
"name": "longrow_split_inner_broadcast_axis1_4x65536_groups2",
"provenance": {
"notes": "A long split row with consecutive inner-broadcast groups checks that each group reads the correct bias row across the full reduction."
},
"attrs": { "axis": 1, "is_inner_broadcast": 1 },
"inputs": {
"data": {
"dtype": "float32",
"shape": [4, 65536],
"data": { "kind": "fillFloat32", "scale": 0.5, "sinStep": 0.0017, "cosStep": 0.0031 }
},
"bias": {
"dtype": "float32",
"shape": [2, 65536],
"data": { "kind": "fillFloat32", "scale": 0.25, "sinStep": 0.0011, "cosStep": 0.0023 }
}
},
"outputs": {
"output": { "dtype": "float32", "shape": [4, 65536], "tolerance": 0.000001, "relTolerance": 0.00001 }
}
},
{
"name": "longrow_split_f16_axis1_4x65536_groups2",
"provenance": {
"notes": "Exercises float16 storage on the split long-row path over 65536 elements. A -30-to-0 ramp concentrates probability mass so normal float16 outputs and underflowing tail zeros coexist, while the row statistics remain in float32 scratch."
},
"attrs": { "axis": 1, "is_inner_broadcast": 1 },
"inputs": {
"data": { "dtype": "float16", "shape": [4, 65536], "data": { "kind": "linspace", "start": -30.0, "end": 0.0 } },
"bias": { "dtype": "float16", "shape": [2, 65536], "data": { "kind": "constant", "value": 0.0 } }
},
"outputs": { "output": { "dtype": "float16", "shape": [4, 65536], "tolerance": 1e-7, "relTolerance": 0.01 } }
},
{
"name": "attn_rows_axis2_4x64x256",
"provenance": {
"notes": "Compact companion for bench case biassoftmax-f32-attn-32x512x512, preserving the attention-score layout with a broadcast bias over many axis-2 softmax rows."
},
"attrs": { "axis": 2, "is_inner_broadcast": 0 },
"inputs": {
"data": {
"dtype": "float32",
"shape": [4, 64, 256],
"data": { "kind": "fillFloat32", "scale": 0.5, "sinStep": 0.017, "cosStep": 0.031 }
},
"bias": {
"dtype": "float32",
"shape": [1, 64, 256],
"data": { "kind": "fillFloat32", "scale": 0.25, "sinStep": 0.011, "cosStep": 0.023 }
}
},
"outputs": {
"output": { "dtype": "float32", "shape": [4, 64, 256], "tolerance": 0.000001, "relTolerance": 0.000001 }
}
},
{
"name": "rank8_inner_broadcast_full_suffix_softmax",
"attrs": { "axis": 1, "is_inner_broadcast": 1 },
"inputs": {
"data": {
"dtype": "float32",
"shape": [1, 2, 1, 2, 1, 2, 2, 2],
"data": { "kind": "fillFloat32", "sinStep": 0.13, "cosStep": 0.27 }
},
"bias": {
"dtype": "float32",
"shape": [1, 2, 1, 2, 1, 2, 2, 2],
"data": { "kind": "fillFloat32", "sinStep": 0.19, "cosStep": 0.11 }
}
},
"outputs": { "output": { "dtype": "float32", "shape": [1, 2, 1, 2, 1, 2, 2, 2], "tolerance": 0.000002 } }
}
]
}
|