openaccel-lab
aien-dev/openaccel-lab
Brought by drakestapleton
openaccel-lab / workloads / rope / workload.json
| 1 | { |
| 2 | "name": "rope", |
| 3 | "family": "elementwise-rotation", |
| 4 | "summary": "rotary embedding, half-split pairing: x is T x H x Dh (Dh even), h = Dh/2; for i < h, x1 = x[t,j,i], x2 = x[t,j,i+h], c = cos[t,i], s = sin[t,i]: y[t,j,i] = x1 c - x2 s, y[t,j,i+h] = x1 s + x2 c", |
| 5 | "provenance": "authored for OpenAccel Lab (Apache-2.0); the rotation is the GPT-NeoX/LLaMA half-split form. The cos and sin tables are inputs generated independently uniform in [-1,1]: the workload checks the rotation arithmetic only, table semantics (theta base 10000, positions 0..T-1) are out of scope because not every entrant has cos/sin.", |
| 6 | "params": { |
| 7 | "T": 16, |
| 8 | "H": 4, |
| 9 | "Dh": 64 |
| 10 | }, |
| 11 | "derived": { |
| 12 | "h": "Dh // 2" |
| 13 | }, |
| 14 | "cases": [ |
| 15 | {}, |
| 16 | { |
| 17 | "T": 1, |
| 18 | "H": 1, |
| 19 | "Dh": 2 |
| 20 | }, |
| 21 | { |
| 22 | "T": 7, |
| 23 | "H": 5, |
| 24 | "Dh": 34 |
| 25 | } |
| 26 | ], |
| 27 | "shrink": { |
| 28 | "T": { |
| 29 | "min": 1 |
| 30 | }, |
| 31 | "H": { |
| 32 | "min": 1 |
| 33 | }, |
| 34 | "Dh": { |
| 35 | "min": 2, |
| 36 | "multiple_of": 2 |
| 37 | } |
| 38 | }, |
| 39 | "inputs": [ |
| 40 | { |
| 41 | "name": "x", |
| 42 | "dtype": "f32", |
| 43 | "shape": [ |
| 44 | "T", |
| 45 | "H", |
| 46 | "Dh" |
| 47 | ], |
| 48 | "gen": { |
| 49 | "kind": "normal4", |
| 50 | "mean": 0.0, |
| 51 | "std": 2.0 |
| 52 | } |
| 53 | }, |
| 54 | { |
| 55 | "name": "cos", |
| 56 | "dtype": "f32", |
| 57 | "shape": [ |
| 58 | "T", |
| 59 | "h" |
| 60 | ], |
| 61 | "gen": { |
| 62 | "kind": "uniform", |
| 63 | "lo": -1.0, |
| 64 | "hi": 1.0 |
| 65 | } |
| 66 | }, |
| 67 | { |
| 68 | "name": "sin", |
| 69 | "dtype": "f32", |
| 70 | "shape": [ |
| 71 | "T", |
| 72 | "h" |
| 73 | ], |
| 74 | "gen": { |
| 75 | "kind": "uniform", |
| 76 | "lo": -1.0, |
| 77 | "hi": 1.0 |
| 78 | } |
| 79 | } |
| 80 | ], |
| 81 | "outputs": [ |
| 82 | { |
| 83 | "name": "y", |
| 84 | "dtype": "f32", |
| 85 | "shape": [ |
| 86 | "T", |
| 87 | "H", |
| 88 | "Dh" |
| 89 | ] |
| 90 | } |
| 91 | ], |
| 92 | "tolerance": { |
| 93 | "y": { |
| 94 | "kind": "bound", |
| 95 | "rtol": "gamma(2)", |
| 96 | "atol": 0.0, |
| 97 | "why": "each output is a length-2 dot product (x1 c - x2 s or x1 s + x2 c) of exact f32 inputs; with or without fused multiply-add and in either order it is within gamma(2) * (|x1 c| + |x2 s|) (Higham Thm 3.1/3.5), and reference.py passes that sum as the scale (WolframLanguageEvaluator: 2u/(1-2u), u=2^-24 -> 1.192e-7)." |
| 98 | } |
| 99 | }, |
| 100 | "timing": { |
| 101 | "warmup": 1, |
| 102 | "repeats": 5 |
| 103 | }, |
| 104 | "backends": { |
| 105 | "omega": { |
| 106 | "src": "omega.om" |
| 107 | }, |
| 108 | "opencl": { |
| 109 | "src": "kernel.cl", |
| 110 | "launches": [ |
| 111 | { |
| 112 | "kernel": "rope", |
| 113 | "global": [ |
| 114 | "T*H*h" |
| 115 | ], |
| 116 | "local": null, |
| 117 | "args": [ |
| 118 | "x", |
| 119 | "cos", |
| 120 | "sin", |
| 121 | "y", |
| 122 | "T*H*h", |
| 123 | "h", |
| 124 | "H" |
| 125 | ] |
| 126 | } |
| 127 | ] |
| 128 | }, |
| 129 | "triton": { |
| 130 | "src": "triton_kernel.py" |
| 131 | }, |
| 132 | "cuda": { |
| 133 | "src": "kernel.cu" |
| 134 | } |
| 135 | } |
| 136 | } |