openaccel-lab
aien-dev/openaccel-lab
Brought by drakestapleton
openaccel-lab / controls / softmax_unstable / workload.json
| 1 | { |
| 2 | "name": "softmax_unstable", |
| 3 | "family": "row-reduction-transcendental", |
| 4 | "summary": "CONTROL: row softmax with the max subtraction omitted in every entrant (y = exp(x) / sum(exp(x))); inputs in [80,100] overflow f32 exp (e^100 = 2.69e43 > f32 max 3.40e38), so every entrant must fail against the stable softmax reference", |
| 5 | "provenance": "authored for OpenAccel Lab (Apache-2.0)", |
| 6 | "params": { |
| 7 | "R": 24, |
| 8 | "D": 200 |
| 9 | }, |
| 10 | "cases": [ |
| 11 | {}, |
| 12 | { |
| 13 | "R": 4, |
| 14 | "D": 7 |
| 15 | }, |
| 16 | { |
| 17 | "R": 5, |
| 18 | "D": 1023 |
| 19 | } |
| 20 | ], |
| 21 | "shrink": { |
| 22 | "R": { |
| 23 | "min": 1 |
| 24 | }, |
| 25 | "D": { |
| 26 | "min": 1 |
| 27 | } |
| 28 | }, |
| 29 | "inputs": [ |
| 30 | { |
| 31 | "name": "x", |
| 32 | "dtype": "f32", |
| 33 | "shape": [ |
| 34 | "R", |
| 35 | "D" |
| 36 | ], |
| 37 | "gen": { |
| 38 | "kind": "uniform", |
| 39 | "lo": 80.0, |
| 40 | "hi": 100.0 |
| 41 | } |
| 42 | } |
| 43 | ], |
| 44 | "outputs": [ |
| 45 | { |
| 46 | "name": "y", |
| 47 | "dtype": "f32", |
| 48 | "shape": [ |
| 49 | "R", |
| 50 | "D" |
| 51 | ] |
| 52 | } |
| 53 | ], |
| 54 | "tolerance": { |
| 55 | "y": { |
| 56 | "kind": "bound", |
| 57 | "rtol": 1.0, |
| 58 | "atol": 0.0, |
| 59 | "why": "same contract as workloads/softmax (reference_from softmax). Expected to fail: without the max subtraction exp overflows f32 for x > ln(f32 max) (WolframLanguageEvaluator: Log[(2-2^-23) 2^127] -> 88.7228; Exp[100] -> 2.6881e43 > (2-2^-23)2^127 = 3.4028e38), so row sums are +inf and the outputs NaN or 0." |
| 60 | } |
| 61 | }, |
| 62 | "timing": { |
| 63 | "warmup": 1, |
| 64 | "repeats": 5 |
| 65 | }, |
| 66 | "backends": { |
| 67 | "omega": { |
| 68 | "src": "omega.om" |
| 69 | }, |
| 70 | "opencl": { |
| 71 | "src": "kernel.cl", |
| 72 | "launches": [ |
| 73 | { |
| 74 | "kernel": "softmax", |
| 75 | "global": [ |
| 76 | "R*64" |
| 77 | ], |
| 78 | "local": [ |
| 79 | "64" |
| 80 | ], |
| 81 | "args": [ |
| 82 | "x", |
| 83 | "y", |
| 84 | "D", |
| 85 | "local:f32:64" |
| 86 | ] |
| 87 | } |
| 88 | ] |
| 89 | }, |
| 90 | "triton": { |
| 91 | "src": "triton_kernel.py" |
| 92 | }, |
| 93 | "cuda": { |
| 94 | "src": "kernel.cu" |
| 95 | } |
| 96 | }, |
| 97 | "expect": "fail", |
| 98 | "reference_from": "softmax" |
| 99 | } |