interplane.Get Omega
Read in your language

omega-helix

This project has not described itself yet.

Brought by drakestapleton

branch main Branches Tags History

omega-helix / native / apu_fabric_nogpu.om

121 lines · 2913 bytes Raw Blame History
1note SPDX-License-Identifier: AGPL-3.0-only
2note native/apu_fabric_nogpu.om: CPU producer backend for Linux multi-core apuweave (aarch64 & x86linux).
3
4fn apu_be_open to ulong
5ret 0
6end
7
8fn apu_be_close to void
9end
10
11fn apu_load_pref_win1 pbase ulong wi ulong dst_b ulong to void
12sh = get apu_shmh 0
13tt = get og 1
14src_w = mul wi mul tt 8
15for t ulong tt bound 512
16 o = add pbase add src_w mul t 8
17 put obx add dst_b t mapget sh o 4
18 put oby add dst_b t mapget sh add o 4 4
19end
20end
21
22fn apu_load_pref_windows ps ulong w_start ulong nw ulong b0 ulong to void
23tt = get og 1
24pbase = add apu_pref_base ps APU_SLOT_HDR
25for w ulong nw bound 32
26 apu_load_pref_win1 pbase add w_start w mul add b0 w tt
27end
28end
29
30fn apu_cpu_store_zr wb ulong row ulong zo ulong to void
31sh = get apu_shmh 0
32d = get og 2
33r = long 0
34for j ulong d bound 2048
35 off = mul add mul row d j 4
36 dst = add add wb get apu_shm 4 off
37 val = ulong bitcast uint f32 get oa add zo j
38 r = mapset sh dst 4 val
39 dst = add add wb get apu_shm 5 off
40 val = ulong bitcast uint f32 get sp2_rvec j
41 r = mapset sh dst 4 val
42end
43end
44
45fn apu_cpu_train_tok wb ulong row ulong t ulong to void
46zo = add get og 17 mul t get og 2
47yt = get oby t
48surp = sp2_tok_grad zo yt
49apu_cpu_store_zr wb row zo
50sh = get apu_shmh 0
51dst = add add wb get apu_shm 6 mul row 4
52val = ulong bitcast uint f32 surp
53r = mapset sh dst 4 val
54dst = add add wb get apu_shm 7 mul row 4
55r = mapset sh dst 4 yt
56end
57
58fn apu_cpu_train_win ps ulong w ulong wb ulong to void
59tt = get og 1
60apu_load_pref_windows ps w 1 0
61dl = ofwd 0
62for t ulong tt bound 512
63 apu_cpu_train_tok wb add mul w tt t t
64end
65end
66
67fn apu_cpu_held_copy base ulong zo2 ulong d ulong to void
68sh = get apu_shmh 0
69r = long 0
70for j2 ulong d bound 2048
71 val = ulong bitcast uint f32 get oa add zo2 j2
72 r = mapset sh add base mul j2 4 4 val
73end
74end
75
76fn apu_cpu_held_tok wb ulong row2 ulong t2 ulong to void
77d = get og 2
78base = add add wb get apu_shm 8 mul mul row2 d 4
79apu_cpu_held_copy base add get og 17 mul t2 d d
80sh = get apu_shmh 0
81yb = add add wb get apu_shm 9 mul row2 4
82yt = get oby t2
83r = mapset sh yb 4 yt
84end
85
86fn apu_cpu_held_win ps ulong nw ulong wh ulong wb ulong to void
87tt = get og 1
88apu_load_pref_windows ps add nw wh 1 0
89dl2 = ofwd 0
90for t2 ulong tt bound 512
91 apu_cpu_held_tok wb add mul wh tt t2 t2
92end
93end
94
95fn apu_cpu_run_one idx ulong to void
96shrd = get apu_bsh idx
97ps = get apu_bps idx
98wb = apu_work_base get apu_bws idx
99nw = get apu_bnw idx
100nh = get apu_bnh idx
101for w ulong nw bound 32
102 apu_cpu_train_win ps w wb
103end
104for wh ulong nh bound 4
105 apu_cpu_held_win ps nw wh wb
106end
107sh = get apu_shmh 0
108tt = get og 1
109r7 = mapset sh wb 8 shrd
110r8 = mapset sh add wb 8 8 get apu_sids shrd
111r9 = mapset sh add wb 16 8 mul nw tt
112r10 = mapset sh add wb 24 8 mul nh tt
113r11 = mapset sh add wb 32 8 bitcast ulong 1.0f64
114cpufence
115end
116
117fn apu_be_run_batch k ulong to void
118for idx ulong k bound 16
119 apu_cpu_run_one idx
120end
121end