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/graph/hello.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 / graph / hello.om` 55 lines · 1272 bytes Raw Blame History 1 note SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 2 note Little-endian binary32 buffers. Byte views match the pinned bridge ABI. 3 fn hload a view uchar `4194304` i ulong to uint 4 o = mul i 4 5 v = ulong get a o 6 v = or v shl ulong get a add o 1 8 7 v = or v shl ulong get a add o 2 16 8 v = or v shl ulong get a add o 3 24 9 ret uint v 10 end 11 fn hstore a edit uchar `4194304` i ulong v uint to void 12 o = mul i 4 13 put a o uchar and v 255 14 put a add o 1 uchar and shr v 8 255 15 put a add o 2 uchar and shr v 16 255 16 put a add o 3 uchar shr v 24 17 end 18 fn hinit aa edit uchar `4194304` bb edit uchar `4194304` cc edit uchar `4194304` to ulong 19 for i ulong `1048576` 20 x = mul f32 i 0.25f32 21 y = div 1.0f32 f32 add 1 rem i 7 22 hstore aa i bitcast uint x 23 hstore bb i bitcast uint y 24 hstore cc i uint `4290838510` 25 end 26 ret 1 27 end 28 fn hello mode ulong aa edit uchar `4194304` bb edit uchar `4194304` cc edit uchar `4194304` out edit ulong 4 to ulong 29 if gt mode 1 30 ret 0 31 end 32 for j ulong 4 33 put out j 0 34 end 35 if eq mode 0 36 ret hinit aa bb cc 37 end 38 for i ulong `1048576` 39 x = bitcast f32 hload aa i 40 y = bitcast f32 hload bb i 41 want = bitcast uint add x y 42 got = hload cc i 43 if eq got `4290838510` 44 put out 1 add get out 1 1 45 end 46 if ne want got 47 if eq get out 0 0 48 put out 2 i 49 put out 3 ulong want 50 end 51 put out 0 add get out 0 1 52 end 53 end 54 ret 1 55 end