openaccel-lab
aien-dev/openaccel-lab
Brought by drakestapleton
openaccel-lab / workloads / silu / workload.json
| 1 | { |
| 2 | "name": "silu", |
| 3 | "family": "elementwise-transcendental", |
| 4 | "summary": "y[i] = x[i] * sigmoid(x[i]) = x[i] / (1 + exp(-x[i])) over n f32 elements", |
| 5 | "provenance": "authored for OpenAccel Lab (Apache-2.0)", |
| 6 | "params": { |
| 7 | "n": 100003 |
| 8 | }, |
| 9 | "cases": [ |
| 10 | {}, |
| 11 | { |
| 12 | "n": 1 |
| 13 | }, |
| 14 | { |
| 15 | "n": 4097 |
| 16 | } |
| 17 | ], |
| 18 | "shrink": { |
| 19 | "n": { |
| 20 | "min": 1 |
| 21 | } |
| 22 | }, |
| 23 | "inputs": [ |
| 24 | { |
| 25 | "name": "x", |
| 26 | "dtype": "f32", |
| 27 | "shape": [ |
| 28 | "n" |
| 29 | ], |
| 30 | "gen": { |
| 31 | "kind": "uniform", |
| 32 | "lo": -16.0, |
| 33 | "hi": 16.0 |
| 34 | } |
| 35 | } |
| 36 | ], |
| 37 | "outputs": [ |
| 38 | { |
| 39 | "name": "y", |
| 40 | "dtype": "f32", |
| 41 | "shape": [ |
| 42 | "n" |
| 43 | ] |
| 44 | } |
| 45 | ], |
| 46 | "tolerance": { |
| 47 | "y": { |
| 48 | "kind": "bound", |
| 49 | "rtol": "gamma(8)", |
| 50 | "atol": 0.0, |
| 51 | "why": "y = x / (1 + E), E = exp(-x) computed in f32 (negation exact). exp budget: OpenCL exp <= 3 ulp (OpenCL C 3.0 s7.4), CUDA expf <= 2 ulp; 1 ulp <= 2u relative, so 3 ulp <= 6u (WolframLanguageEvaluator: 3*2^-23/2^-24 -> 6). Since E/(1+E) < 1, the relative error of 1+E is at most that of E, <= 6u <= gamma(6); the add and the divide add one rounding each, so by Higham Lemma 3.3 y = x/(1+e^-x) * (1+theta_8), |theta_8| <= gamma(8) (WolframLanguageEvaluator: 8u/(1-8u), u=2^-24 -> 4.768e-7). Omega computes exp in binary64 and rounds once (<= u + binary64 error). Inputs in [-16,16] keep E and y normal in f32." |
| 52 | } |
| 53 | }, |
| 54 | "timing": { |
| 55 | "warmup": 1, |
| 56 | "repeats": 5 |
| 57 | }, |
| 58 | "backends": { |
| 59 | "omega": { |
| 60 | "src": "omega.om" |
| 61 | }, |
| 62 | "opencl": { |
| 63 | "src": "kernel.cl", |
| 64 | "launches": [ |
| 65 | { |
| 66 | "kernel": "silu", |
| 67 | "global": [ |
| 68 | "n" |
| 69 | ], |
| 70 | "local": null, |
| 71 | "args": [ |
| 72 | "x", |
| 73 | "y", |
| 74 | "n" |
| 75 | ] |
| 76 | } |
| 77 | ] |
| 78 | }, |
| 79 | "triton": { |
| 80 | "src": "triton_kernel.py" |
| 81 | }, |
| 82 | "cuda": { |
| 83 | "src": "kernel.cu" |
| 84 | } |
| 85 | } |
| 86 | } |