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/omega-mv/blob/main/gpu/nvidia/checks/sm121dis.om # omega-mv Omega: a language for verified programs, semantic identity and machine realization. Seed-born work and existing implementations have distinct provenance. Brought by drakestapleton Sign in to star 1 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `omega-mv / gpu / nvidia / checks / sm121dis.om` 123 lines ยท 2682 bytes Raw Blame History 1 note SPDX-License-Identifier: Apache-2.0 2 note gpu/nvidia/checks/sm121dis.om: the Omega port of CUDApp tests/sm121_dis_diff_test.c. Composed after 3 note gpu/nvidia/om/disasm/sm121_dis.om and gpu/nvidia/checks/lib.om; run with gpu/nvidia/checks/sm121dis.tsv. 4 note Rows (numbers in lowercase hex): 5 note g LO HI TEXT a golden word: sm121_dis must print TEXT (what nvdisasm 13.0.85 -b SM121 printed for 6 note it), and the same word with bit 16 flipped (the old test's corrupted-word control) must not 7 note w LO HI PC RC TEXT one word of the old test's differential stream (per form of the C table, random, IMAD 8 note immediates, the IMAD.SHL powers of two), with the status RC (0 decoded, -1 no form, 9 note -2 did not fit; TEXT - then) and the text the retained C decoder c_sm121_disasm gave 10 note The result word of sm121_dis is read as the C binding reads it: bits 0..15 the text length, 16 no form 11 note matched (-1), 18 the text did not fit, or a length of 256 or more (-2). Bit 17 (EXIT) must be set exactly 12 note when the opcode bits are 0x94d, as the binding requires. 13 text t_name "SM121DIS" 14 fn cname to void 15 for i ulong len t_name bound 64 16 ckoc ulong get t_name i 17 end 18 end 19 fn dhx i ulong to ulong 20 n = cklen i 21 if or eq n 0 gt n 16 22 ckbad 23 end 24 v = ulong 0 25 for j ulong n bound 16 26 v = or shl v 4 cknib ckch i j 27 end 28 ret v 29 end 30 note field i as 0, -1 or -2: the code 0, 1 or 2 31 fn drc i ulong to ulong 32 n = cklen i 33 if and eq n 1 eq ckch i 0 48 34 ret 0 35 end 36 if ne n 2 37 ckbad 38 end 39 if ne ckch i 0 45 40 ckbad 41 end 42 c = ckch i 1 43 if or lt c 49 gt c 50 44 ckbad 45 end 46 ret sub c 48 47 end 48 note the status code of a result word r 49 fn dst r ulong to ulong 50 n = and r 65535 51 if or ne and shr r 18 1 0 ge n 256 52 ret 2 53 end 54 ret and shr r 16 1 55 end 56 fn dtext o view uchar 256 r ulong i ulong to bool 57 n = and r 65535 58 if ge n 256 59 ret false 60 end 61 if ne cklen i n 62 ret false 63 end 64 for j ulong n bound 256 65 if ne ulong get o j ckch i j 66 ret false 67 end 68 end 69 ret true 70 end 71 fn dgold lo ulong hi ulong to bool 72 o = new uchar 256 0 73 r = sm121_dis lo hi 0 edit o 74 if ne dst r 0 75 ret false 76 end 77 if not dtext view o r 3 78 ret false 79 end 80 r = sm121_dis xor lo 65536 hi 0 edit o 81 if eq dst r 0 82 if dtext view o r 3 83 ret false 84 end 85 end 86 ret true 87 end 88 fn dword lo ulong hi ulong pc ulong rc ulong to bool 89 o = new uchar 256 0 90 r = sm121_dis lo hi pc edit o 91 if ne dst r rc 92 ret false 93 end 94 x = and shr r 17 1 95 e = ulong 0 96 if eq and lo 4095 2381 97 e = 1 98 end 99 if ne x e 100 ret false 101 end 102 if eq rc 2 103 ret true 104 end 105 ret dtext view o r 5 106 end 107 fn crow to bool 108 k = ckch 0 0 109 nc = ckcnt 110 if eq k 103 111 if ne nc 4 112 ckbad 113 end 114 ret dgold dhx 1 dhx 2 115 end 116 if ne k 119 117 ckbad 118 end 119 if ne nc 6 120 ckbad 121 end 122 ret dword dhx 1 dhx 2 dhx 3 drc 4 123 end