Xenova's picture
Xenova HF Staff
sync 2e7068faf55e
fe90e05 verified
Raw
History Blame
11.2 kB
{
"op": "com.microsoft.GemmFastGelu",
"cases": [
{
"name": "rank2_bias_f32",
"provenance": {
"notes": "A plain (M, K) x (K, N) with bias, both dimensions past one 64-wide tile so the kernel's tile loop and its bounds checks both run."
},
"inputs": {
"X": {
"dtype": "float32",
"shape": [96, 80],
"data": { "kind": "fillFloat32", "scale": 0.9, "sinStep": 0.18000000000000002, "cosStep": 0.32 }
},
"W": {
"dtype": "float32",
"shape": [80, 72],
"data": { "kind": "fillFloat32", "scale": 0.5, "sinStep": 0.12, "cosStep": 0.24000000000000002 }
},
"bias": {
"dtype": "float32",
"shape": [72],
"data": { "kind": "fillFloat32", "scale": 0.4, "sinStep": 0.3, "cosStep": 0.14 }
}
},
"outputs": { "Y": { "dtype": "float32", "shape": [96, 72], "tolerance": 0.00002, "relTolerance": 0.0002 } }
},
{
"name": "rank2_nobias_f32",
"provenance": { "notes": "The same shape without a bias, which takes the other binding set." },
"inputs": {
"X": {
"dtype": "float32",
"shape": [96, 80],
"data": { "kind": "fillFloat32", "scale": 0.9, "sinStep": 0.19, "cosStep": 0.33 }
},
"W": {
"dtype": "float32",
"shape": [80, 72],
"data": { "kind": "fillFloat32", "scale": 0.5, "sinStep": 0.13, "cosStep": 0.25 }
}
},
"outputs": { "Y": { "dtype": "float32", "shape": [96, 72], "tolerance": 0.00002, "relTolerance": 0.0002 } }
},
{
"name": "rank3_batched_bias_f32",
"provenance": {
"notes": "A rank-3 X: every leading axis is another row, so a (2, 48, 64) input is a 96-row product rather than a batched matmul."
},
"inputs": {
"X": {
"dtype": "float32",
"shape": [2, 48, 64],
"data": { "kind": "fillFloat32", "scale": 0.9, "sinStep": 0.2, "cosStep": 0.33999999999999997 }
},
"W": {
"dtype": "float32",
"shape": [64, 40],
"data": { "kind": "fillFloat32", "scale": 0.5, "sinStep": 0.14, "cosStep": 0.26 }
},
"bias": {
"dtype": "float32",
"shape": [40],
"data": { "kind": "fillFloat32", "scale": 0.4, "sinStep": 0.31999999999999995, "cosStep": 0.16 }
}
},
"outputs": { "Y": { "dtype": "float32", "shape": [2, 48, 40], "tolerance": 0.00002, "relTolerance": 0.0002 } }
},
{
"name": "rank4_batched_nobias_f32",
"provenance": {
"notes": "Rank 4, no bias -- the leading-axis collapse must not depend on how many axes there are."
},
"inputs": {
"X": {
"dtype": "float32",
"shape": [2, 3, 16, 32],
"data": { "kind": "fillFloat32", "scale": 0.9, "sinStep": 0.21000000000000002, "cosStep": 0.35 }
},
"W": {
"dtype": "float32",
"shape": [32, 24],
"data": { "kind": "fillFloat32", "scale": 0.5, "sinStep": 0.15, "cosStep": 0.27 }
}
},
"outputs": { "Y": { "dtype": "float32", "shape": [2, 3, 16, 24], "tolerance": 0.00002, "relTolerance": 0.0002 } }
},
{
"name": "small_unaligned_bias_f32",
"provenance": {
"notes": "M, K and N all smaller than one tile and none a multiple of the 4x4 micro-tile, so every bounds check is exercised."
},
"inputs": {
"X": {
"dtype": "float32",
"shape": [7, 13],
"data": { "kind": "fillFloat32", "scale": 0.9, "sinStep": 0.22000000000000003, "cosStep": 0.36 }
},
"W": {
"dtype": "float32",
"shape": [13, 11],
"data": { "kind": "fillFloat32", "scale": 0.5, "sinStep": 0.16, "cosStep": 0.28 }
},
"bias": {
"dtype": "float32",
"shape": [11],
"data": { "kind": "fillFloat32", "scale": 0.4, "sinStep": 0.33999999999999997, "cosStep": 0.18 }
}
},
"outputs": { "Y": { "dtype": "float32", "shape": [7, 11], "tolerance": 0.00002, "relTolerance": 0.0002 } }
},
{
"name": "single_row_bias_f32",
"provenance": { "notes": "One row: the GEMV shape, where the M tile is almost entirely padding." },
"inputs": {
"X": {
"dtype": "float32",
"shape": [1, 64],
"data": { "kind": "fillFloat32", "scale": 0.9, "sinStep": 0.23, "cosStep": 0.37 }
},
"W": {
"dtype": "float32",
"shape": [64, 48],
"data": {
"kind": "fillFloat32",
"scale": 0.5,
"sinStep": 0.16999999999999998,
"cosStep": 0.29000000000000004
}
},
"bias": {
"dtype": "float32",
"shape": [48],
"data": { "kind": "fillFloat32", "scale": 0.4, "sinStep": 0.35, "cosStep": 0.19 }
}
},
"outputs": { "Y": { "dtype": "float32", "shape": [1, 48], "tolerance": 0.00002, "relTolerance": 0.0002 } }
},
{
"name": "f16_rank3_bias",
"provenance": {
"notes": "float16 operands; the product accumulates in f32 and the activation runs before the single narrowing store."
},
"inputs": {
"X": {
"dtype": "float16",
"shape": [2, 32, 48],
"data": { "kind": "fillFloat32", "scale": 0.9, "sinStep": 0.24000000000000002, "cosStep": 0.38 }
},
"W": {
"dtype": "float16",
"shape": [48, 32],
"data": { "kind": "fillFloat32", "scale": 0.5, "sinStep": 0.18, "cosStep": 0.30000000000000004 }
},
"bias": {
"dtype": "float16",
"shape": [32],
"data": { "kind": "fillFloat32", "scale": 0.4, "sinStep": 0.36, "cosStep": 0.2 }
}
},
"outputs": { "Y": { "dtype": "float16", "shape": [2, 32, 32], "tolerance": 0.006, "relTolerance": 0.006 } }
},
{
"name": "f16_rank2_nobias",
"provenance": { "notes": "float16 without a bias." },
"inputs": {
"X": {
"dtype": "float16",
"shape": [48, 32],
"data": { "kind": "fillFloat32", "scale": 0.9, "sinStep": 0.25, "cosStep": 0.39 }
},
"W": {
"dtype": "float16",
"shape": [32, 24],
"data": { "kind": "fillFloat32", "scale": 0.5, "sinStep": 0.19, "cosStep": 0.31 }
}
},
"outputs": { "Y": { "dtype": "float16", "shape": [48, 24], "tolerance": 0.006, "relTolerance": 0.006 } }
},
{
"name": "pinned_rank2_bias",
"provenance": {
"notes": "Hand-computed from the schema's FastGelu definition -- 0.5x(1 + tanh(sqrt(2/pi)(x + 0.044715 x^3))) -- applied to a float64 product, independent of the port's tiling and of its shared gelu helper. The operands are large enough that FastGelu is well outside its near-linear region, so the pin is sensitive to the activation itself."
},
"inputs": {
"X": {
"dtype": "float32",
"shape": [5, 6],
"data": {
"kind": "values",
"values": [-0.568, 1.402, -1.744, 0.805, -0.684, -0.366, -1.898, -0.274, 0.008, -1.719, 0.344, 1.185, -0.865, 1.863, -0.792, 1.783, 0.703, -0.614, -1.244, 1.186, 1.21, -0.428, -0.236, 1.268, -1.492, -1.469, 0.673, 1.956, -1.883, -0.872]
}
},
"W": {
"dtype": "float32",
"shape": [6, 4],
"data": {
"kind": "values",
"values": [-0.362, -1.699, 1.664, -0.171, 0.412, -0.373, -1.421, 1.657, 1.194, -0.13, -1.707, -0.827, -0.156, -1.618, 1.339, -0.16, -1.723, 1.951, 0.603, 1.677, 1.217, 0.273, 1.35, 0.713]
}
},
"bias": {
"dtype": "float32",
"shape": [4],
"data": { "kind": "values", "values": [-0.818, 0.02, 0.585, 0.387] }
}
},
"outputs": {
"Y": {
"dtype": "float32",
"shape": [5, 4],
"data": {
"kind": "values",
"values": [-0.099208, -0.041387, 0.626313, 2.704125, 0.716692, 7.121855, -0.009083, 1.89771, -0.004677, -0.16984, -0.072533, 4.732758, 3.581808, 2.075684, -0.000021, 2.106721, 1.733585, -0.000052, -0.167767, -0.0]
},
"tolerance": 0.00002,
"relTolerance": 0.0002
}
}
},
{
"name": "sgmat_aligned_bias_f32",
"provenance": {
"notes": "M, K and N all meet the subgroup-matrix gate (M >= 32, K % 32 == 0, N % 64 == 0), so this is the fixture that selects sgmat_bias rather than the tiled kernel. Two row tiles and two column tiles past the 32x64 tile, so the tile loop runs and the fused gelu is checked on every store site."
},
"inputs": {
"X": {
"dtype": "float32",
"shape": [64, 64],
"data": { "kind": "fillFloat32", "scale": 0.7, "sinStep": 0.13, "cosStep": 0.29 }
},
"W": {
"dtype": "float32",
"shape": [64, 128],
"data": { "kind": "fillFloat32", "scale": 0.4, "sinStep": 0.21, "cosStep": 0.17 }
},
"bias": {
"dtype": "float32",
"shape": [128],
"data": { "kind": "fillFloat32", "scale": 0.3, "sinStep": 0.11, "cosStep": 0.37 }
}
},
"outputs": { "Y": { "dtype": "float32", "shape": [64, 128], "tolerance": 0.00002, "relTolerance": 0.0002 } }
},
{
"name": "sgmat_aligned_nobias_f32",
"provenance": {
"notes": "The no-bias arm of the same gate: sgmat renders its store without the bias term, which is a separate set of write sites from the bias arm."
},
"inputs": {
"X": {
"dtype": "float32",
"shape": [96, 96],
"data": { "kind": "fillFloat32", "scale": 0.7, "sinStep": 0.13, "cosStep": 0.29 }
},
"W": {
"dtype": "float32",
"shape": [96, 192],
"data": { "kind": "fillFloat32", "scale": 0.4, "sinStep": 0.21, "cosStep": 0.17 }
}
},
"outputs": { "Y": { "dtype": "float32", "shape": [96, 192], "tolerance": 0.00002, "relTolerance": 0.0002 } }
},
{
"name": "sgmat_aligned_bias_f16",
"provenance": {
"notes": "f16 operands drive the matrix units at their f16 component type while the accumulator and the fused gelu stay f32. The f16 gate admits M >= 2, so this also covers a row count under one tile."
},
"inputs": {
"X": {
"dtype": "float16",
"shape": [32, 64],
"data": { "kind": "fillFloat32", "scale": 0.7, "sinStep": 0.13, "cosStep": 0.29 }
},
"W": {
"dtype": "float16",
"shape": [64, 128],
"data": { "kind": "fillFloat32", "scale": 0.4, "sinStep": 0.21, "cosStep": 0.17 }
},
"bias": {
"dtype": "float16",
"shape": [128],
"data": { "kind": "fillFloat32", "scale": 0.3, "sinStep": 0.11, "cosStep": 0.37 }
}
},
"outputs": { "Y": { "dtype": "float16", "shape": [32, 128], "tolerance": 0.02, "relTolerance": 0.02 } }
}
]
}