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/x3.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 / x3.om` 50 lines · 1644 bytes Raw Blame History 1 note SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 2 note The bf16x3 planes of one gathered run of the general GEMM (CUDApp#144, src/omega_gpu_gemm_ex.c run_part, ops 5 and 3 note 6 of the row unit's numbering): n stored elements of type t, read as words from w, split into three bf16 parts 4 note (gx_split), become nine planes of round16(n) bf16 elements; plane q of element kk is the 2-byte element q * kp + kk of 5 note d, four to a little-endian word, zero past n. Plane q takes part (tt >> 4q) & 15, tt the nibble table of op 5 (A') 6 note or op 6 (B'): Wolfram FromDigits of the C TA/TB reversed, TA {2,2,1,2,1,0,1,0,0} `16851234`, TB {2,1,2,0,1,2,0,1,0} 7 note `270598674`. Gives the elements written, 9 * kp. 8 9 note p with the 16 bits v in lane kk & 3 10 fn gx_lane p ulong v ulong kk ulong to ulong 11 ret or p shl and v 65535 mul and kk 3 16 12 end 13 14 note word g of every plane q whose part is r: v 15 fn gx_xput tt ulong d edit ulong 8192 kp4 ulong g ulong r ulong v ulong to void 16 for q ulong 9 17 if eq and shr tt mul q 4 15 r 18 put d add mul q kp4 g v 19 end 20 end 21 end 22 23 fn gemm_ex_x3 op ulong t ulong n ulong w view ulong 8192 d edit ulong 8192 to ulong 24 tt = ulong `16851234` 25 if eq op 6 26 tt = ulong `270598674` 27 end 28 kp = mul shr add n 15 4 16 29 p0 = ulong 0 30 p1 = ulong 0 31 p2 = ulong 0 32 for kk ulong kp 33 s = ulong 0 34 if lt kk n 35 s = gx_split bitcast uint gx_ldf t gx_wel view w kk gx_es t 36 end 37 p0 = gx_lane p0 s kk 38 p1 = gx_lane p1 shr s 16 kk 39 p2 = gx_lane p2 shr s 32 kk 40 if eq and kk 3 3 41 gx_xput tt edit d shr kp 2 shr kk 2 0 p0 42 gx_xput tt edit d shr kp 2 shr kk 2 1 p1 43 gx_xput tt edit d shr kp 2 shr kk 2 2 p2 44 p0 = ulong 0 45 p1 = ulong 0 46 p2 = ulong 0 47 end 48 end 49 ret mul 9 kp 50 end