openaccel-lab
aien-dev/openaccel-lab
Brought by drakestapleton
openaccel-lab / controls / reduce_drop_last / workload.json
| 1 | { |
| 2 | "name": "reduce_drop_last", |
| 3 | "family": "reduction", |
| 4 | "summary": "CONTROL for reduce_sum: every entrant sums only x[0..n-2], skipping the last element; judged by the reduce_sum reference and bound, it must fail", |
| 5 | "provenance": "authored for OpenAccel Lab (Apache-2.0); deliberately wrong copy of workloads/reduce_sum", |
| 6 | "expect": "fail", |
| 7 | "reference_from": "reduce_sum", |
| 8 | "params": { |
| 9 | "n": 2003 |
| 10 | }, |
| 11 | "derived": { |
| 12 | "nb": "(n + 255) // 256" |
| 13 | }, |
| 14 | "cases": [ |
| 15 | {}, |
| 16 | {"n": 1}, |
| 17 | {"n": 257} |
| 18 | ], |
| 19 | "shrink": { |
| 20 | "n": {"min": 1} |
| 21 | }, |
| 22 | "inputs": [ |
| 23 | {"name": "x", "dtype": "f32", "shape": ["n"], "gen": {"kind": "uniform", "lo": 0.5, "hi": 1.0}} |
| 24 | ], |
| 25 | "outputs": [ |
| 26 | {"name": "y", "dtype": "f32", "shape": [1]} |
| 27 | ], |
| 28 | "scratch": [ |
| 29 | {"name": "part", "dtype": "f32", "shape": ["nb"]} |
| 30 | ], |
| 31 | "tolerance": { |
| 32 | "y": { |
| 33 | "kind": "bound", |
| 34 | "rtol": "gamma(n)", |
| 35 | "atol": 0, |
| 36 | "why": "reduce_sum's contract. Inputs lie in [0.5, 1), so the bound gamma(n)*sum|x_i| < gamma(n)*n while the dropped element is >= 0.5 and the summation error is far below it: WolframLanguageEvaluator: u=2^-24; g[n_]:=n u/(1-n u); N[g[2003]*2003,10] -> 0.2391629245; N[g[257]*257,10] -> 0.003936887490; n = 1 drops the only element (y = 0 against x[0] >= 0.5). At reduce_sum's n = 100003 a single element of [-1, 1] sits under the bound (N[g[100003]*100003/2,10] -> 299.8282749), so the control uses n = 2003." |
| 37 | } |
| 38 | }, |
| 39 | "timing": {"warmup": 1, "repeats": 5}, |
| 40 | "backends": { |
| 41 | "omega": {"src": "omega.om"}, |
| 42 | "opencl": { |
| 43 | "src": "kernel.cl", |
| 44 | "launches": [ |
| 45 | {"kernel": "rsum_part", "global": ["nb * 256"], "local": [256], "args": ["x", "part", "n", "local:f32:256"]}, |
| 46 | {"kernel": "rsum_fin", "global": [256], "local": [256], "args": ["part", "y", "nb", "local:f32:256"]} |
| 47 | ] |
| 48 | }, |
| 49 | "triton": {"src": "triton_kernel.py"}, |
| 50 | "cuda": {"src": "kernel.cu"} |
| 51 | } |
| 52 | } |