Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/openaccel-lab/blob/main/workloads/tsoftmax16/workload.json # openaccel-lab aien-dev/openaccel-lab Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `openaccel-lab / workloads / tsoftmax16 / workload.json` 90 lines ยท 2625 bytes Raw Blame History 1 { 2 "name": "tsoftmax16", 3 "family": "tile-softmax", 4 "summary": "row softmax over TILES tiles of 16 rows x 32 f32 columns, max-subtracted", 5 "provenance": "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/tsoftmax.spec and seed/kflow/sm121/tsoftmax.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": "x", 26 "dtype": "f32", 27 "shape": [ 28 "TILES", 29 16, 30 32 31 ], 32 "gen": { 33 "kind": "uniform", 34 "lo": 60.0, 35 "hi": 100.0 36 } 37 } 38 ], 39 "outputs": [ 40 { 41 "name": "y", 42 "dtype": "f32", 43 "shape": [ 44 "TILES", 45 16, 46 32 47 ] 48 } 49 ], 50 "tolerance": { 51 "y": { 52 "kind": "bound", 53 "rtol": "(1+6*u)*(1+5*u)/((1-6*u)*(1-gamma(31)))-1", 54 "atol": 0.0, 55 "why": "Inputs lie in [60,100], so for any x and row max m, m/2 <= x <= m and x-m is exact in f32 (Sterbenz; WolframLanguageEvaluator: 100/60<2 -> True), |x-m| <= 40. Per element y = e/s with e = exp(x-m) within 3 ulp (OpenCL C 3.0 sec 7.4; covers CUDA expf 2 ulp, glibc expf, numpy float32 exp and the Omega binary64 exp rounded to f32), i.e. relative eps_e = 3*2^-23 = 6u; s = sum of 32 positive terms in any order within gamma(31) relative (Higham Thm 3.1, u=2^-24); the divide within 2.5 ulp (OpenCL single-precision x/y), i.e. 5u. Hence |y-ref| <= ((1+6u)(1+5u)/((1-6u)(1-gamma(31)))-1)*|ref|. WolframLanguageEvaluator: u=2^-24; gam[n_]:=n u/(1-n u); rt=(1+3*2^-23)(1+5/2*2^-23)/((1-3*2^-23)(1-gam[31]))-1; N[{gam[31],rt,rt/2^-23},12] -> {1.`84774740220e`-6, 2.`86103211881e`-6, 24.`0000769201`}. This re-derives PR #869's softmax bound (2.`29976200922e`-6, one warp butterfly of 5 additions and ex2.approx/rcp.approx) for 31 additions in any order and per-backend exp and divide accuracy. Outputs stay normal: WolframLanguageEvaluator: N[Exp[-40]/32 > 2^-126] -> True. Without max subtraction exp(x) overflows for x > 88.72 (WolframLanguageEvaluator: N[Log[(2-2^-23)*2^127],12] -> 88.`7228390521`), giving inf/NaN; one dropped column changes the row sum by e^(x-m)/s, above the bound in some row." 56 } 57 }, 58 "timing": { 59 "warmup": 1, 60 "repeats": 5 61 }, 62 "backends": { 63 "omega": { 64 "src": "omega.om" 65 }, 66 "opencl": { 67 "src": "kernel.cl", 68 "launches": [ 69 { 70 "kernel": "tsoftmax16", 71 "global": [ 72 "TILES*16" 73 ], 74 "local": null, 75 "args": [ 76 "x", 77 "y", 78 "TILES" 79 ] 80 } 81 ] 82 }, 83 "triton": { 84 "src": "triton_kernel.py" 85 }, 86 "cuda": { 87 "src": "kernel.cu" 88 } 89 } 90 }