openaccel-lab
aien-dev/openaccel-lab
Brought by drakestapleton
openaccel-lab / workloads / dot / workload.json
| 1 | { |
| 2 | "name": "dot", |
| 3 | "family": "reduction", |
| 4 | "summary": "y[0] = sum a[i]*b[i] over n f32 elements; OpenCL/CUDA reduce in a 256-wide local tree per block, then one block reduces the block partials", |
| 5 | "provenance": "authored for OpenAccel Lab (Apache-2.0)", |
| 6 | "params": { |
| 7 | "n": 100003 |
| 8 | }, |
| 9 | "derived": { |
| 10 | "nb": "(n + 255) // 256" |
| 11 | }, |
| 12 | "cases": [ |
| 13 | {}, |
| 14 | {"n": 1}, |
| 15 | {"n": 257} |
| 16 | ], |
| 17 | "shrink": { |
| 18 | "n": {"min": 1} |
| 19 | }, |
| 20 | "inputs": [ |
| 21 | {"name": "a", "dtype": "f32", "shape": ["n"], "gen": {"kind": "uniform", "lo": -2.0, "hi": 2.0}}, |
| 22 | {"name": "b", "dtype": "f32", "shape": ["n"], "gen": {"kind": "normal4", "std": 1.0}} |
| 23 | ], |
| 24 | "outputs": [ |
| 25 | {"name": "y", "dtype": "f32", "shape": [1]} |
| 26 | ], |
| 27 | "scratch": [ |
| 28 | {"name": "part", "dtype": "f32", "shape": ["nb"]} |
| 29 | ], |
| 30 | "tolerance": { |
| 31 | "y": { |
| 32 | "kind": "bound", |
| 33 | "rtol": "gamma(n)", |
| 34 | "atol": 0, |
| 35 | "why": "A dot product of length n in any summation order, with or without fused multiply-add, is within gamma(n)*sum|a_i b_i| of the exact value (Higham ASNA 2nd ed. eq. 3.5 and section 3.1); scale sum|a_i b_i| from reference.py. Padding adds exact zeros. WolframLanguageEvaluator: u=2^-24; g[n_]:=n u/(1-n u); N[g[100003],10] -> 0.005996385607; N[g[257],10] -> 0.00001531862836" |
| 36 | } |
| 37 | }, |
| 38 | "timing": {"warmup": 1, "repeats": 5}, |
| 39 | "backends": { |
| 40 | "omega": {"src": "omega.om"}, |
| 41 | "opencl": { |
| 42 | "src": "kernel.cl", |
| 43 | "launches": [ |
| 44 | {"kernel": "dot_part", "global": ["nb * 256"], "local": [256], "args": ["a", "b", "part", "n", "local:f32:256"]}, |
| 45 | {"kernel": "dot_fin", "global": [256], "local": [256], "args": ["part", "y", "nb", "local:f32:256"]} |
| 46 | ] |
| 47 | }, |
| 48 | "triton": {"src": "triton_kernel.py"}, |
| 49 | "cuda": {"src": "kernel.cu"} |
| 50 | } |
| 51 | } |