interplane.Get Omega
Read in your language

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

branch main Branches Tags History

CUDApp / om / gemmex / x3.om

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