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/softmax/omega.om # 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 / softmax / omega.om` 42 lines ยท 679 bytes Raw Blame History 1 note softmax over rows of x[R][D] in f32: e = exp(x - max) via oal_expf rounded to f32, y = e / sum e 2 global kr ulong 1 3 global kd ulong 1 4 fn smrow o ulong d ulong to void 5 m = get fa o 6 for k ulong d 7 m = fmax m get fa add o k 8 end 9 s = 0.0f32 10 for k ulong d 11 e = f32 oal_expf f64 sub get fa add o k m 12 put fo add o k e 13 s = add s e 14 end 15 for k ulong d 16 put fo add o k div get fo add o k s 17 end 18 end 19 fn kern to void 20 d = get kd 0 21 for i ulong get kr 0 22 smrow mul i d d 23 end 24 end 25 fn main to int 26 oal_begin 27 put kr 0 ulong oal_p 0 28 put kd 0 ulong oal_p 1 29 a = oal_fa 0 30 w = oal_warm 31 for i ulong add w oal_reps 32 t0 = monons 33 kern 34 t1 = monons 35 if ge i w 36 oal_tick sub t1 t0 37 end 38 end 39 oal_so 0 a 40 oal_end 41 ret 0 42 end