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
omega-mv / gpu / nvidia / om / numeric / no_bf16.om
| 1 | note SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 2 | note Integer-only freestanding binary32 to bf16 RNE; preserve quiet NaN payload. |
| 3 | note WolframLanguageEvaluator: FromDigits[#,16]& /@ {"7f800000","007fffff","0040","7fff"} |
| 4 | note -> {2139095040,8388607,64,32767}. |
| 5 | fn no_bf16 raw ulong to ulong |
| 6 | u = uint raw |
| 7 | if eq and u 2139095040 2139095040 |
| 8 | if ne and u 8388607 0 |
| 9 | ret ulong or shr u 16 64 |
| 10 | end |
| 11 | end |
| 12 | u = add add u 32767 and shr u 16 1 |
| 13 | ret ulong shr u 16 |
| 14 | end |