interplane.Get Omega
Read in your language

ggml-omega

aien-dev/ggml-omega

Brought by drakestapleton

branch main Branches Tags History

ggml-omega / kernels / dq8.om

28 lines · 705 bytes Raw Blame History
1note dq8_@B@: q8_0 dot over @B@ blocks of 34 bytes (f16 scale d, 32 signed bytes q) against f32 x:
2note acc (f64 bits) + sum over blocks of f64(d * sum_j f32(q_j)*x_j); fin 1 returns the f32 total.
3fn q8s u uchar to f32
4q = long u
5if ge q 128
6q = sub q 256
7end
8ret f32 q
9end
10fn q8d w view uchar @W@ o ulong to f32
11ret h2f ushort or ulong get w o shl ulong get w add o 1 8
12end
13fn dq8_@B@ acc ulong w view uchar @W@ x view f32 @X@ fin ulong to ulong
14s = bitcast f64 acc
15for b ulong @B@
16o = mul b 34
17xo = mul b 32
18bs = f32 0.0
19for j ulong 32
20bs = add bs mul q8s get w add add o 2 j get x add xo j
21end
22s = add s f64 mul q8d view w o bs
23end
24if eq fin 1
25ret ulong bitcast uint f32 s
26end
27ret bitcast ulong s
28end