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/apiviews/gdnut.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 / apiviews / gdnut.om` 91 lines · 2328 bytes Raw Blame History 1 om2 2 note SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 3 note Unpack per-head slots back to reference tail [3][conv]. 4 note First writer is s>=256 or h rem (vh/16) == 0. Later copies must match bits. 5 note Returns the mismatch count. 0 agrees. 384 is OMEGA_GDN_SLOTS. 6 note WolframLanguageEvaluator: {2^14 - 1, 2^17 - 1} -> {16383, 131071}. 7 note Pack is ch 14 bits, base 17 bits, conv from bit 31. vh<=48 stays inside. 8 note Row meta is hh 6 bits, vh 6 bits, conv from bit 12. 9 fn av_ch hh ulong ss ulong vh ulong to ulong 10 hk = div hh div vh 16 11 if lt ss 128 12 ret add mul hk 128 ss 13 end 14 if lt ss 256 15 ret add 2048 add mul hk 128 sub ss 128 16 end 17 ret add 4096 add mul hh 128 sub ss 256 18 end 19 fn av_base hh ulong ss ulong to ulong 20 ret mul add mul hh 384 ss 4 21 end 22 fn av_pk ch ulong base ulong conv ulong to ulong 23 ret add add ch shl base 14 shl conv 31 24 end 25 fn av_slot hh ulong ss ulong vh ulong conv ulong to ulong 26 ret av_pk av_ch hh ss vh av_base hh ss conv 27 end 28 fn av_wr tail edit f32 * dev view f32 * pk ulong to ulong 29 ch = and pk 16383 30 base = and shr pk 14 131071 31 conv = shr pk 31 32 put tail ch get dev base 33 put tail add ch conv get dev add base 1 34 put tail add ch mul conv 2 get dev add base 2 35 ret 0 36 end 37 fn av_cmp tail view f32 * dev view f32 * pk ulong to ulong 38 ch = and pk 16383 39 base = and shr pk 14 131071 40 conv = shr pk 31 41 bad = ulong 0 42 if ne bitcast uint get tail ch bitcast uint get dev base 43 bad = add bad 1 44 end 45 if ne bitcast uint get tail add ch conv bitcast uint get dev add base 1 46 bad = add bad 1 47 end 48 if ne bitcast uint get tail add ch mul conv 2 bitcast uint get dev add base 2 49 bad = add bad 1 50 end 51 ret bad 52 end 53 fn av_row dev view f32 * tail edit f32 * meta ulong to ulong 54 hh = and meta 63 55 vh = and shr meta 6 63 56 conv = shr meta 12 57 bad = ulong 0 58 step = ulong 0 59 for ss ulong 384 60 slot = av_slot hh ss vh conv 61 if ge ss 256 62 step = av_wr tail dev slot 63 else 64 if eq rem hh div vh 16 0 65 step = av_wr tail dev slot 66 else 67 bad = add bad av_cmp tail dev slot 68 end 69 end 70 end 71 ret bad 72 end 73 fn av_meta hh ulong vh ulong conv ulong to ulong 74 ret add add hh shl vh 6 shl conv 12 75 end 76 fn av_gdnut dev view f32 * tail edit f32 * vh ulong conv ulong to ulong 77 if eq div vh 16 0 78 ret 1 79 end 80 if ne len dev mul mul vh 384 4 81 ret 1 82 end 83 if ne len tail mul conv 3 84 ret 1 85 end 86 bad = ulong 0 87 for hh ulong vh 88 bad = add bad av_row dev tail av_meta hh vh conv 89 end 90 ret bad 91 end