interplane.Get Omega
Read in your language

openaccel-lab

aien-dev/openaccel-lab

Brought by drakestapleton

branch main Branches Tags History

openaccel-lab / workloads / attn_scores / workload.json

109 lines · 1971 bytes Raw Blame History
1{
2 "name": "attn_scores",
3 "family": "attention",
4 "summary": "causal attention scores S[i][j] = 0.125 * sum_c Q[i][c] K[j][c] for j <= i, S[i][j] = -1e30f for j > i; Q, K are T x Dh with Dh = 64 so 1/sqrt(Dh) = 0.125 is exact",
5 "provenance": "authored for OpenAccel Lab (Apache-2.0)",
6 "params": {
7 "T": 48,
8 "Dh": 64
9 },
10 "cases": [
11 {},
12 {
13 "T": 1
14 },
15 {
16 "T": 17
17 }
18 ],
19 "shrink": {
20 "T": {
21 "min": 1
22 },
23 "Dh": {
24 "min": 64,
25 "multiple_of": 64
26 }
27 },
28 "inputs": [
29 {
30 "name": "q",
31 "dtype": "f32",
32 "shape": [
33 "T",
34 "Dh"
35 ],
36 "gen": {
37 "kind": "normal4",
38 "mean": 0.0,
39 "std": 1.0
40 }
41 },
42 {
43 "name": "k",
44 "dtype": "f32",
45 "shape": [
46 "T",
47 "Dh"
48 ],
49 "gen": {
50 "kind": "normal4",
51 "mean": 0.0,
52 "std": 1.0
53 }
54 }
55 ],
56 "outputs": [
57 {
58 "name": "s",
59 "dtype": "f32",
60 "shape": [
61 "T",
62 "T"
63 ]
64 }
65 ],
66 "tolerance": {
67 "s": {
68 "kind": "bound",
69 "rtol": "gamma(Dh)",
70 "atol": 0,
71 "why": "unmasked entry: a length-Dh dot product in any order, with or without FMA, is within gamma(Dh) * sum_c |q_c k_c| of the exact value (Higham Thm 3.1/3.5); the scale 0.125 = 2^-3 is exact both before and after the sum, so reference.py passes 0.125 * sum_c |q_c k_c| as the scale. WolframLanguageEvaluator: u=2^-24; g[n_]:=n u/(1-n u); N[g[64],10] -> 3.814711818*10^-6. Masked entry (j > i): scale 0 and atol 0, so it must equal float32(-1e30) exactly. A dropped term moves an entry by |q_c k_c|, far above 3.8e-6 of the row sum."
72 }
73 },
74 "timing": {
75 "warmup": 2,
76 "repeats": 10
77 },
78 "backends": {
79 "omega": {
80 "src": "omega.om"
81 },
82 "opencl": {
83 "src": "kernel.cl",
84 "launches": [
85 {
86 "kernel": "attn_scores",
87 "global": [
88 "T",
89 "T"
90 ],
91 "local": null,
92 "args": [
93 "q",
94 "k",
95 "s",
96 "T",
97 "Dh"
98 ]
99 }
100 ]
101 },
102 "triton": {
103 "src": "triton_kernel.py"
104 },
105 "cuda": {
106 "src": "kernel.cu"
107 }
108 }
109}