interplane.Get Omega
Read in your language

omega-mv

Omega: a language for verified programs, semantic identity and machine realization. Seed-born work and existing implementations have distinct provenance.

Brought by drakestapleton

branch main Branches Tags History

omega-mv / gpu / nvidia / om / api / attn_scalar.om

34 lines · 662 bytes Raw Blame History
1note SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
2note Decode uses the kernel's raw rounding for nonfinite values, unlike gx_f2bf NaN quieting.
3fn av_drnd u uint to uint
4if gx_fin u
5ret gx_f2bf u
6end
7ret shr add add u 32767 and shr u 16 1 16
8end
9fn av_perm i uint r uint to uint
10p = div r 2
11if lt i 128
12if lt i p
13ret i
14end
15ret add r sub i p
16end
17j = sub i 128
18if lt j p
19ret add p j
20end
21ret i
22end
23fn av_permf s view f32 256 d edit f32 256 r uint to ulong
24for i ulong 256
25put d i get s ulong av_perm uint i r
26end
27ret 0
28end
29fn av_permb s view ushort 256 d edit ushort 256 r uint to ulong
30for i ulong 256
31put d i get s ulong av_perm uint i r
32end
33ret 0
34end