File size: 6,979 Bytes
b5d19c4 | 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 | {
"op": "com.microsoft.GatedAdd",
"cases": [
{
"name": "rank3_rows_f32",
"inputs": {
"X": {
"dtype": "float32",
"shape": [2, 3, 8],
"data": { "kind": "fillFloat32", "sinStep": 0.13, "cosStep": 0.29 }
},
"Y": {
"dtype": "float32",
"shape": [2, 3, 8],
"data": { "kind": "fillFloat32", "sinStep": 0.31, "cosStep": 0.07 }
},
"gate": {
"dtype": "float32",
"shape": [2, 3, 1],
"data": { "kind": "fillFloat32", "sinStep": 0.41, "cosStep": 0.17, "offset": 0.75 }
}
},
"outputs": {
"output": { "dtype": "float32", "shape": [2, 3, 8], "tolerance": 0.000001, "relTolerance": 0.000001 }
}
},
{
"name": "rank2_channels_odd_f32",
"inputs": {
"X": {
"dtype": "float32",
"shape": [5, 7],
"data": { "kind": "fillFloat32", "sinStep": 0.19, "cosStep": 0.23 }
},
"Y": {
"dtype": "float32",
"shape": [5, 7],
"data": { "kind": "fillFloat32", "sinStep": 0.37, "cosStep": 0.11 }
},
"gate": {
"dtype": "float32",
"shape": [5, 1],
"data": { "kind": "fillFloat32", "sinStep": 0.53, "cosStep": 0.29, "offset": -1.25 }
}
},
"outputs": { "output": { "dtype": "float32", "shape": [5, 7], "tolerance": 0.000001, "relTolerance": 0.000001 } }
},
{
"name": "rank2_channels_not_vec4_aligned_f32",
"inputs": {
"X": {
"dtype": "float32",
"shape": [4, 6],
"data": { "kind": "fillFloat32", "sinStep": 0.17, "cosStep": 0.43 }
},
"Y": {
"dtype": "float32",
"shape": [4, 6],
"data": { "kind": "fillFloat32", "sinStep": 0.61, "cosStep": 0.13 }
},
"gate": { "dtype": "float32", "shape": [4, 1], "data": { "kind": "values", "values": [2.0, -3.0, 0.5, 7.0] } }
},
"outputs": { "output": { "dtype": "float32", "shape": [4, 6], "tolerance": 0.000001, "relTolerance": 0.000001 } }
},
{
"name": "rank1_single_row_f32",
"inputs": {
"X": { "dtype": "float32", "shape": [16], "data": { "kind": "fillFloat32", "sinStep": 0.27, "cosStep": 0.09 } },
"Y": { "dtype": "float32", "shape": [16], "data": { "kind": "fillFloat32", "sinStep": 0.47, "cosStep": 0.21 } },
"gate": { "dtype": "float32", "shape": [1], "data": { "kind": "values", "values": [-1.75] } }
},
"outputs": { "output": { "dtype": "float32", "shape": [16], "tolerance": 0.000001, "relTolerance": 0.000001 } }
},
{
"name": "rank4_rows_f32",
"inputs": {
"X": {
"dtype": "float32",
"shape": [2, 2, 3, 4],
"data": { "kind": "fillFloat32", "sinStep": 0.11, "cosStep": 0.37 }
},
"Y": {
"dtype": "float32",
"shape": [2, 2, 3, 4],
"data": { "kind": "fillFloat32", "sinStep": 0.23, "cosStep": 0.59 }
},
"gate": {
"dtype": "float32",
"shape": [2, 2, 3, 1],
"data": { "kind": "fillFloat32", "sinStep": 0.71, "cosStep": 0.19, "offset": 1.5 }
}
},
"outputs": {
"output": { "dtype": "float32", "shape": [2, 2, 3, 4], "tolerance": 0.000001, "relTolerance": 0.000001 }
}
},
{
"name": "gate_broadcast_rows_pinned",
"provenance": {
"notes": "Hand-computed from the schema formula output = X + round_to_T(Y * gate); every value is exact in float32, so the expectation is independent of the reference."
},
"inputs": {
"X": {
"dtype": "float32",
"shape": [2, 3],
"data": { "kind": "values", "values": [1.0, 2.0, 3.0, 4.0, 5.0, 6.0] }
},
"Y": {
"dtype": "float32",
"shape": [2, 3],
"data": { "kind": "values", "values": [0.5, -1.0, 2.0, 10.0, -0.25, 0.125] }
},
"gate": { "dtype": "float32", "shape": [2, 1], "data": { "kind": "values", "values": [2.0, -0.5] } }
},
"outputs": {
"output": {
"dtype": "float32",
"shape": [2, 3],
"data": { "kind": "values", "values": [2.0, 0.0, 7.0, -1.0, 5.125, 5.9375] }
}
}
},
{
"name": "f16_product_rounds_to_type_pinned",
"provenance": {
"notes": "Pins the round_to_T rule that separates this op from a wider-precision fused multiply-add. Row 0 uses gate = 1 + 2^-10, so Y = 1025 gives a real product of 1026.0009765625 that float16 rounds to 1026.0; X = -1026 then cancels it exactly to 0. A kernel that let the product stay unrounded -- by contracting the multiply into the add -- would return 2^-10 there instead. Every other value is exact in float16, so the whole expectation is hand-computable."
},
"inputs": {
"X": {
"dtype": "float16",
"shape": [2, 4],
"data": { "kind": "values", "values": [-1026.0, -1000.0, 0.5, -8.0, 0.5, -1.0, 0.25, 3.0] }
},
"Y": {
"dtype": "float16",
"shape": [2, 4],
"data": { "kind": "values", "values": [1025.0, 1024.0, 512.0, 8.0, 1.0, 2.0, 3.0, 4.0] }
},
"gate": { "dtype": "float16", "shape": [2, 1], "data": { "kind": "values", "values": [1.0009765625, 2.0] } }
},
"outputs": {
"output": {
"dtype": "float16",
"shape": [2, 4],
"data": { "kind": "values", "values": [0.0, 25.0, 513.0, 0.0078125, 2.5, 3.0, 6.25, 11.0] },
"tolerance": 0.0005
}
}
},
{
"name": "f16_rows",
"inputs": {
"X": {
"dtype": "float16",
"shape": [3, 16],
"data": { "kind": "fillFloat32", "sinStep": 0.13, "cosStep": 0.29, "offset": 1.25 }
},
"Y": {
"dtype": "float16",
"shape": [3, 16],
"data": { "kind": "fillFloat32", "sinStep": 0.31, "cosStep": 0.07, "offset": -0.75 }
},
"gate": { "dtype": "float16", "shape": [3, 1], "data": { "kind": "values", "values": [1.5, -0.5, 2.25] } }
},
"outputs": { "output": { "dtype": "float16", "shape": [3, 16], "tolerance": 0.0005, "relTolerance": 0.002 } }
},
{
"name": "f16_channels_odd",
"inputs": {
"X": {
"dtype": "float16",
"shape": [4, 5],
"data": { "kind": "fillFloat32", "sinStep": 0.43, "cosStep": 0.17, "offset": -1.5 }
},
"Y": {
"dtype": "float16",
"shape": [4, 5],
"data": { "kind": "fillFloat32", "sinStep": 0.19, "cosStep": 0.53, "offset": 0.875 }
},
"gate": { "dtype": "float16", "shape": [4, 1], "data": { "kind": "values", "values": [0.75, -1.25, 3.0, 0.5] } }
},
"outputs": { "output": { "dtype": "float16", "shape": [4, 5], "tolerance": 0.0005, "relTolerance": 0.002 } }
}
]
}
|