interplane.Get Omega
Read in your language

openaccel-lab

aien-dev/openaccel-lab

Brought by drakestapleton

branch main Branches Tags History

openaccel-lab / workloads / reduce_sum / workload.json

50 lines · 1641 bytes Raw Blame History
1{
2 "name": "reduce_sum",
3 "family": "reduction",
4 "summary": "y[0] = sum of 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": "x", "dtype": "f32", "shape": ["n"], "gen": {"kind": "uniform", "lo": -1.0, "hi": 1.0}}
22 ],
23 "outputs": [
24 {"name": "y", "dtype": "f32", "shape": [1]}
25 ],
26 "scratch": [
27 {"name": "part", "dtype": "f32", "shape": ["nb"]}
28 ],
29 "tolerance": {
30 "y": {
31 "kind": "bound",
32 "rtol": "gamma(n)",
33 "atol": 0,
34 "why": "Recursive summation of n terms in any order (sequential, tree, blocked) is within gamma(n-1)*sum|x_i| of the exact sum (Higham ASNA 2nd ed. eq. 4.4); gamma(n) is used, scale sum|x_i| from reference.py. Padding adds exact zeros. At the default n: WolframLanguageEvaluator: u=2^-24; g[n_]:=n u/(1-n u); N[g[100003],10] -> 0.005996385607; N[g[257],10] -> 0.00001531862836. Control reduce_drop_last checks that one missing element fails."
35 }
36 },
37 "timing": {"warmup": 1, "repeats": 5},
38 "backends": {
39 "omega": {"src": "omega.om"},
40 "opencl": {
41 "src": "kernel.cl",
42 "launches": [
43 {"kernel": "rsum_part", "global": ["nb * 256"], "local": [256], "args": ["x", "part", "n", "local:f32:256"]},
44 {"kernel": "rsum_fin", "global": [256], "local": [256], "args": ["part", "y", "nb", "local:f32:256"]}
45 ]
46 },
47 "triton": {"src": "triton_kernel.py"},
48 "cuda": {"src": "kernel.cu"}
49 }
50}