openaccel-lab
aien-dev/openaccel-lab
Brought by drakestapleton
openaccel-lab / controls / gemm_offbyone / workload.json
| 1 | { |
| 2 | "name": "gemm_offbyone", |
| 3 | "family": "tile-matmul", |
| 4 | "summary": "CONTROL: tmatmul16 with the k loop stopping at 15 of 16 terms in every entrant", |
| 5 | "provenance": "control for tmatmul16 (Apache-2.0); authored for OpenAccel Lab (Apache-2.0); the shape follows the tile kernels of aien-dev/omega-mv PR #869 (unmerged, head 6d08fd9c, seed/kflow/specs/tmatmul16.spec and seed/kflow/sm121/tmatmul16.s2)", |
| 6 | "params": { |
| 7 | "TILES": 64 |
| 8 | }, |
| 9 | "cases": [ |
| 10 | {}, |
| 11 | { |
| 12 | "TILES": 1 |
| 13 | }, |
| 14 | { |
| 15 | "TILES": 3 |
| 16 | } |
| 17 | ], |
| 18 | "shrink": { |
| 19 | "TILES": { |
| 20 | "min": 1 |
| 21 | } |
| 22 | }, |
| 23 | "inputs": [ |
| 24 | { |
| 25 | "name": "a", |
| 26 | "dtype": "f32", |
| 27 | "shape": [ |
| 28 | "TILES", |
| 29 | 16, |
| 30 | 16 |
| 31 | ], |
| 32 | "gen": { |
| 33 | "kind": "grid", |
| 34 | "klo": -1024, |
| 35 | "khi": 1024, |
| 36 | "shift": 10 |
| 37 | } |
| 38 | }, |
| 39 | { |
| 40 | "name": "b", |
| 41 | "dtype": "f32", |
| 42 | "shape": [ |
| 43 | "TILES", |
| 44 | 16, |
| 45 | 16 |
| 46 | ], |
| 47 | "gen": { |
| 48 | "kind": "grid", |
| 49 | "klo": -1024, |
| 50 | "khi": 1024, |
| 51 | "shift": 10 |
| 52 | } |
| 53 | } |
| 54 | ], |
| 55 | "outputs": [ |
| 56 | { |
| 57 | "name": "c", |
| 58 | "dtype": "f32", |
| 59 | "shape": [ |
| 60 | "TILES", |
| 61 | 16, |
| 62 | 16 |
| 63 | ] |
| 64 | } |
| 65 | ], |
| 66 | "tolerance": { |
| 67 | "c": { |
| 68 | "kind": "bound", |
| 69 | "rtol": "gamma(15)", |
| 70 | "atol": 0.0, |
| 71 | "why": "Inputs are k*2^-10 with |k|<=1024, so every value is exact in f16 and in f32, every product a*b is an integer multiple of 2^-20 with |a*b|<=1 and is exact in f32, and with or without FMA a length-16 dot product starting from 0 takes at most 15 rounded additions (the first product enters exactly). Higham Thm 3.1/3.5 for any summation order with round-to-nearest (u=2^-24): |d-ref| <= gamma(15)*sum_k |a_ik b_kj|; reference.py passes that sum as scale. WolframLanguageEvaluator: u=2^-24; gam[n_]:=n u/(1-n u); N[gam[15],12] -> 8.94070470992e-7 (PR #869 quotes gamma_15 = 1.78814254071e-6 with u=2^-23 to allow any rounding mode; every entrant here rounds to nearest, so u=2^-24). On this grid the bound is not the binding fact: every partial sum is an integer multiple of 2^-20 of magnitude <= 16*2^20 = 2^24 (WolframLanguageEvaluator: 16*1024*1024==2^24 -> True), hence exact in f32, so a correct entrant's observed error is 0; the bound is what the contract guarantees for general f16 tiles. One dropped k term changes an element by |a_ik b_kj| up to 1, far above the bound, so gemm_offbyone fails." |
| 72 | } |
| 73 | }, |
| 74 | "timing": { |
| 75 | "warmup": 1, |
| 76 | "repeats": 5 |
| 77 | }, |
| 78 | "backends": { |
| 79 | "omega": { |
| 80 | "src": "omega.om" |
| 81 | }, |
| 82 | "opencl": { |
| 83 | "src": "kernel.cl", |
| 84 | "launches": [ |
| 85 | { |
| 86 | "kernel": "tmatmul16", |
| 87 | "global": [ |
| 88 | "TILES*256" |
| 89 | ], |
| 90 | "local": [ |
| 91 | 256 |
| 92 | ], |
| 93 | "args": [ |
| 94 | "a", |
| 95 | "b", |
| 96 | "c", |
| 97 | "TILES" |
| 98 | ] |
| 99 | } |
| 100 | ] |
| 101 | }, |
| 102 | "triton": { |
| 103 | "src": "triton_kernel.py" |
| 104 | }, |
| 105 | "cuda": { |
| 106 | "src": "kernel.cu" |
| 107 | } |
| 108 | }, |
| 109 | "expect": "fail", |
| 110 | "reference_from": "tmatmul16" |
| 111 | } |