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/native/abft/lib.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 / native / abft / lib.om` 83 lines · 1629 bytes Raw Blame History 1 note SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 2 note native/abft shared words: buffered stdout, decimal output, splitmix64 streams, FNV-1a digests, 3 note bf16/f32 decoding. See docs/abft/CONTRACT.md. 4 global ob uchar 65536 5 global obn ulong 1 6 global rs ulong 4 7 fn now to ulong 8 ret ulong monons 9 end 10 fn oflush to void 11 n = get obn 0 12 if gt n 0 13 w = write 1 ob 0 n 14 if lt w 0 15 trap 8 16 end 17 put obn 0 0 18 end 19 end 20 fn ochar c uchar to void 21 n = get obn 0 22 if ge n 65000 23 oflush 24 n = get obn 0 25 end 26 put ob n c 27 put obn 0 add n 1 28 end 29 fn odig v ulong to void 30 if ge v 10 31 odig div v 10 32 end 33 ochar uchar add 48 rem v 10 34 end 35 fn onum v ulong to void 36 ochar 32 37 odig v 38 end 39 fn osig v long to void 40 ochar 32 41 if lt v 0 42 ochar 45 43 odig ulong neg v 44 else 45 odig ulong v 46 end 47 end 48 fn onl to void 49 ochar 10 50 end 51 note splitmix64 (Steele, Lea, Flood 2014). Stream 0 input generator, 1 evaluator nonce stream, 52 note 2 candidate schedule, 3 candidate fault placement. Streams never share state. 53 fn rseed k ulong v ulong to void 54 put rs k v 55 end 56 fn rnext k ulong to ulong 57 s = add get rs k `11400714819323198485` 58 put rs k s 59 z = mul xor s shr s 30 `13787848793156543929` 60 z = mul xor z shr z 27 `10723151780598845931` 61 ret xor z shr z 31 62 end 63 fn rbelow k ulong n ulong to ulong 64 ret rem rnext k n 65 end 66 note FNV-1a 64 over the low 32 bits of each word, little-endian byte order. 67 fn fnvw h ulong v ulong to ulong 68 x = h 69 for i ulong 4 70 x = xor x and shr v mul i 8 255 71 x = mul x `1099511628211` 72 end 73 ret x 74 end 75 fn bf v ulong to f64 76 ret f64 bitcast f32 uint shl and v 65535 16 77 end 78 fn f3 v ulong to f64 79 ret f64 bitcast f32 uint and v `4294967295` 80 end 81 fn fbits x f32 to ulong 82 ret ulong bitcast uint x 83 end