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/CUDApp/blob/main/om/gemmex/fp8.om # CUDApp CUDA++: AIEN’s GPU machine-code toolchain, runtime and driver client for NVIDIA GPUs without the CUDA toolkit. Hardware coverage and driver replacement limits are explicit. 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 `CUDApp / om / gemmex / fp8.om` 52 lines · 1457 bytes Raw Blame History 1 note SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 2 note The dequantization of one weight-row run of omega_gpu_gemm_ex_fp8_block_rows (CUDApp#144, 3 note src/omega_gpu_gemm_ex.c l.467-476): d[c] = f32(((f64 e4m3 w[c]) * (f64 sr[cb])) * scale_mul), one rounding, 4 note cb = (c0 + c) / block ((cb + 1) % kb under mutant 5). 5 note q: 0 cn (<= 16383), 1 c0, 2 block, 3 kb, 4 scale_mul f64 bits, 5 mutant, 6 sbase = c0 / block, 7 sr[0] bits; 6 note s[i] = sr[sbase + i] as binary32 bits and d[c] binary32 (the C shell copies min(16384, kb - sbase) entries). 7 note Gives 0, or 1 for a block outside s. The block and its scale are found once per block, not per element. 8 9 note the scale bits of block cb, or 1 << 32 when the block lies outside s 10 fn gx_fsv q view ulong 8 s view uint 16384 cb ulong to ulong 11 sb = get q 6 12 if eq get q 5 5 13 cb = rem add cb 1 get q 3 14 end 15 if ge cb sb 16 if ge sub cb sb 16384 17 ret shl ulong 1 32 18 end 19 ret ulong get s sub cb sb 20 end 21 if ne cb 0 22 ret shl ulong 1 32 23 end 24 ret get q 7 25 end 26 27 fn gemm_ex_fp8 q view ulong 8 w view uchar 65536 s view uint 16384 d edit f32 16384 to ulong 28 if eq get q 0 0 29 ret 0 30 end 31 bl = get q 2 32 cb = div get q 1 bl 33 r = rem get q 1 bl 34 sv = gx_fsv view q view s cb 35 m = bitcast f64 get q 4 36 for c ulong get q 0 37 if gt sv `4294967295` 38 ret 1 39 end 40 x = f64 gx_e4m3 uint get w c 41 x = mul x f64 bitcast f32 uint sv 42 x = mul x m 43 put d c f32 x 44 r = add r 1 45 if eq r bl 46 r = ulong 0 47 cb = add cb 1 48 sv = gx_fsv view q view s cb 49 end 50 end 51 ret 0 52 end