ggml-omega
aien-dev/ggml-omega
Brought by drakestapleton
ggml-omega / kernels / bfs.om
| 1 | note bfs_@T@: f32 -> two bf16 planes by truncation (the first two planes of CUDApp gemm_ex's bf16x3 split): |
| 2 | note h = the top 16 bits of x, l = the top 16 bits of f32(x - f32(h)); for finite x, x - (h + l) < 2^-16 |x|. |
| 3 | fn bfs_@T@ s view f32 @T@ h edit ushort @T@ l edit ushort @T@ to void |
| 4 | for i ulong @T@ |
| 5 | x = get s i |
| 6 | u = bitcast uint x |
| 7 | r = sub x bitcast f32 and u 4294901760 |
| 8 | put h i ushort shr u 16 |
| 9 | put l i ushort shr bitcast uint r 16 |
| 10 | end |
| 11 | end |