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/cul1.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 / cul1.om` 112 lines · 2286 bytes Raw Blame History 1 note SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 2 note CUL1 two-sided randomized checksum (Freivalds) for the registered GEMM family (op 3). 3 note Concatenate after native/learn53/task.om; task.om is unchanged and keval stays the exact oracle. 4 note kabft n c seed: kvalid refusals pass through unchanged; 69 for a non-GEMM op; 65 bad length; 5 note 1 canary/padding/residual mismatch; 0 pass. seed is the evaluator nonce; ko never chooses it. 6 note Miss bound (Wolfram, docs/abft/CONTRACT.md section 4): a single wrong element is always detected; 7 note an error pattern whose 2-adic valuation is v is missed with probability <= 2^(v-31) per side, 8 note and a rectangle of 2^31 is always missed (keval still detects it). 9 global kr ulong 64 10 global kq2 ulong 64 11 global ks ulong 1 12 fn ksm to ulong 13 s = add get ks 0 `11400714819323198485` 14 put ks 0 s 15 z = mul xor s shr s 30 `13787848793156543929` 16 z = mul xor z shr z 27 `10723151780598845931` 17 ret or and xor z shr z 31 `4294967295` 1 18 end 19 fn kca i ulong k ulong to ulong 20 ret kw add 24 add mul i kw 8 k 21 end 22 fn kcb k ulong j ulong to ulong 23 ret kw add add 24 kw 11 add mul k kw 9 j 24 end 25 fn kcx i ulong j ulong to ulong 26 ret kc add 1 add mul i kw 10 j 27 end 28 fn kright to bool 29 for j ulong kw 6 30 put kr j ksm 31 end 32 for k ulong kw 7 33 y = ulong 0 34 for j ulong kw 6 35 y = add y mul kcb k j get kr j 36 end 37 put kq2 k y 38 end 39 for i ulong kw 5 40 z = ulong 0 41 for k ulong kw 7 42 z = add z mul kca i k get kq2 k 43 end 44 w = ulong 0 45 for j ulong kw 6 46 w = add w mul kcx i j get kr j 47 end 48 if ne and xor z w `4294967295` 0 49 ret false 50 end 51 end 52 ret true 53 end 54 fn kleft to bool 55 for i ulong kw 5 56 put kr i ksm 57 end 58 for k ulong kw 7 59 x = ulong 0 60 for i ulong kw 5 61 x = add x mul get kr i kca i k 62 end 63 put kq2 k x 64 end 65 for j ulong kw 6 66 z = ulong 0 67 for k ulong kw 7 68 z = add z mul get kq2 k kcb k j 69 end 70 w = ulong 0 71 for i ulong kw 5 72 w = add w mul get kr i kcx i j 73 end 74 if ne and xor z w `4294967295` 0 75 ret false 76 end 77 end 78 ret true 79 end 80 fn kabft n ulong c ulong seed ulong to int 81 status = kvalid n 82 if ne status 0 83 ret status 84 end 85 if ne kw 2 3 86 ret 69 87 end 88 if ne c mul 4 add kw 13 2 89 ret 65 90 end 91 if ne kc 0 `2779096485` 92 ret 1 93 end 94 if ne kc add kw 13 1 `2779096485` 95 ret 1 96 end 97 for p ulong kw 13 98 if ge rem p kw 10 kw 6 99 if ne kc add p 1 `2779096485` 100 ret 1 101 end 102 end 103 end 104 put ks 0 seed 105 if not kright 106 ret 1 107 end 108 if not kleft 109 ret 1 110 end 111 ret 0 112 end