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/ldgmmio.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 / ldgmmio.om` 134 lines ยท 3608 bytes Raw Blame History 1 note SPDX-License-Identifier: Apache-2.0 2 note gpu/nvidia/checks/ldgmmio.om: the Omega port of CUDApp tests/bw_ldg_mmio_test.c. Composed after 3 note gpu/nvidia/om/encoder/bw_enc_sm121.om (bw_enc_sm121), gpu/nvidia/om/disasm/sm121_dis.om (sm121_dis) and 4 note gpu/nvidia/checks/lib.om; run with gpu/nvidia/checks/ldgmmio.tsv. Rows, tab separated, lowercase hex for 5 note the words, decimal otherwise: 6 note e OP W0 W1 W2 W3 TYPE ORDER EVICT CONTRACT RC TEXT the test's instruction with op OP 7 note w W2 TYPE ORDER EVICT CONTRACT RC TEXT LDG_MMIO's instruction with word 2 replaced by W2 8 note The test's instruction: dst 4, src1 8, no src2 or src3, ureg 2, imm 0, control 0 (the op's default), each 9 note virtual register on the physical register of its own number. The check encodes it with bw_enc_sm121 and 10 note requires the C encoder's four words; reads NAK's memory fields of the word (Mesa NAK sm70_encode.rs 11 note set_mem_access, sm_80+: type bits 73..75, order bits 77..80, eviction bits 84..86) and requires the C's 12 note values; computes the test's LDG_MMIO contract (32-bit, normal eviction, an order neither weak 0 nor 13 note constant 4; CONTRACT 1 when broken) and requires the C's answer; and decodes the word with sm121_dis, 14 note requiring the C decoder's text and its answer RC (1 when no form matched, the text is then ?? 0x). 15 text t_name "LDGMMIO" 16 const NONE ulong `18446744073709551615` 17 fn cname to void 18 for i ulong len t_name bound 64 19 ckoc ulong get t_name i 20 end 21 end 22 fn lmx i ulong to ulong 23 n = cklen i 24 if or eq n 0 gt n 8 25 ckbad 26 end 27 v = ulong 0 28 for j ulong n bound 8 29 v = or shl v 4 cknib ckch i j 30 end 31 ret v 32 end 33 note bits [at, at + n) of the 128-bit word ww (four 32-bit words); every field read lies inside one word 34 fn lmf ww view ulong 4 at ulong n ulong to ulong 35 ret and shr get ww shr at 5 and at 31 sub shl ulong 1 n 1 36 end 37 note 1 when ww breaks the LDG_MMIO contract (mmio_contract of the test) 38 fn lmbad ww view ulong 4 to ulong 39 o = lmf ww 77 4 40 if ne lmf ww 73 3 4 41 ret 1 42 end 43 if ne lmf ww 84 3 1 44 ret 1 45 end 46 if or eq o 0 eq o 4 47 ret 1 48 end 49 ret 0 50 end 51 note encode op with the test's operands into ww; false when the encoder refuses 52 fn lmenc op ulong ww edit ulong 4 to bool 53 ins = new ulong 8192 0 54 phys = new ulong 288 0 55 code = new uchar 16384 0 56 for i ulong 256 57 put phys i i 58 end 59 for i ulong 32 60 put phys add 256 i i 61 end 62 put ins 0 op 63 put ins 1 4 64 put ins 2 8 65 put ins 3 NONE 66 put ins 4 NONE 67 put ins 5 2 68 if ne bw_enc_sm121 view ins view phys 1 0 edit code 16 69 ret false 70 end 71 for k ulong 4 72 v = ulong 0 73 for j ulong 4 74 v = or v shl ulong get code add mul k 4 j mul j 8 75 end 76 put ww k v 77 end 78 ret true 79 end 80 note fields, contract and decoding of ww against the row's fields from f on: TYPE ORDER EVICT CONTRACT RC TEXT 81 fn lmrest ww view ulong 4 f ulong to bool 82 if or ne cknum f lmf ww 73 3 ne cknum add f 1 lmf ww 77 4 83 ret false 84 end 85 if or ne cknum add f 2 lmf ww 84 3 ne cknum add f 3 lmbad ww 86 ret false 87 end 88 o = new uchar 256 0 89 r = sm121_dis or get ww 0 shl get ww 1 32 or get ww 2 shl get ww 3 32 0 edit o 90 if ne cknum add f 4 and shr r 16 1 91 ret false 92 end 93 t = add f 5 94 n = and r 65535 95 if or ne and shr r 18 1 0 ne n cklen t 96 ret false 97 end 98 for j ulong n bound 256 99 if ne ulong get o j ckch t j 100 ret false 101 end 102 end 103 ret true 104 end 105 fn crow to bool 106 k = ckch 0 0 107 ww = new ulong 4 0 108 if eq k 101 109 if or ne ckcnt 12 ne cklen 0 1 110 ckbad 111 end 112 if not lmenc cknum 1 edit ww 113 ret false 114 end 115 for i ulong 4 116 if ne get ww i lmx add i 2 117 ret false 118 end 119 end 120 ret lmrest view ww 6 121 end 122 if eq k 119 123 if or ne ckcnt 8 ne cklen 0 1 124 ckbad 125 end 126 if not lmenc 21 edit ww 127 ret false 128 end 129 put ww 2 lmx 1 130 ret lmrest view ww 2 131 end 132 ckbad 133 ret false 134 end