openaccel-lab
aien-dev/openaccel-lab
Brought by drakestapleton
openaccel-lab / workloads / scan_i32 / workload.json
| 1 | { |
| 2 | "name": "scan_i32", |
| 3 | "family": "scan", |
| 4 | "summary": "y[i] = x[0] + ... + x[i] (inclusive prefix sum) over n i32 elements; OpenCL/CUDA scan 256-wide blocks in local memory, scan the block sums in one block, then add each block's offset", |
| 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": "i32", "shape": ["n"], "gen": {"kind": "int", "lo": -9, "hi": 9}} |
| 22 | ], |
| 23 | "outputs": [ |
| 24 | {"name": "y", "dtype": "i32", "shape": ["n"]} |
| 25 | ], |
| 26 | "scratch": [ |
| 27 | {"name": "bsum", "dtype": "i32", "shape": ["nb"]} |
| 28 | ], |
| 29 | "tolerance": { |
| 30 | "y": { |
| 31 | "kind": "int", |
| 32 | "atol": 0, |
| 33 | "why": "integer additions are exact: |x_i| <= 9, so every prefix is at most 9*n in magnitude, far inside i32 for the cases run" |
| 34 | } |
| 35 | }, |
| 36 | "timing": {"warmup": 1, "repeats": 5}, |
| 37 | "backends": { |
| 38 | "omega": {"src": "omega.om"}, |
| 39 | "opencl": { |
| 40 | "src": "kernel.cl", |
| 41 | "launches": [ |
| 42 | {"kernel": "scan_blk", "global": ["nb * 256"], "local": [256], "args": ["x", "y", "bsum", "n", "local:i32:256"]}, |
| 43 | {"kernel": "scan_sums", "global": [256], "local": [256], "args": ["bsum", "nb", "local:i32:256"]}, |
| 44 | {"kernel": "scan_add", "global": ["nb * 256"], "local": [256], "args": ["y", "bsum", "n"]} |
| 45 | ] |
| 46 | }, |
| 47 | "triton": {"src": "triton_kernel.py"}, |
| 48 | "cuda": {"src": "kernel.cu"} |
| 49 | } |
| 50 | } |