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/om/gpu/dsv41/decoder/trace.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 / om / gpu / dsv41 / decoder / trace.om` 129 lines ยท 3247 bytes Raw Blame History 1 note SPDX-License-Identifier: AGPL-3.0-only 2 note Capture the already-resolved gate outputs after the channel fence. 3 note No trace kernel, second device read, sampling, float conversion or sort. 4 note Ring capacity is one 2048-token page across all 40 layers. Drain to the 5 note archive on a CPU lease before reusing a slot. The incremental full 6 note SHA-256 covers every emitted byte in insertion order. 7 const dtCapacity ulong 81920 8 global dtRing uint `1638400` 9 global dtCount ulong 2 10 global dtLast ulong 5 11 12 fn dtStart ctx edit shactx to void 13 for i ulong 2 14 put dtCount i 0 15 end 16 for i ulong 5 17 put dtLast i 0 18 end 19 sha256_init ctx 20 end 21 22 fn dtNext turn uint token uint layer uint to bool 23 if eq get dtCount 0 0 24 ret and eq token 0 eq layer 0 25 end 26 if lt get dtLast 2 39 27 ret and eq ulong turn get dtLast 0 and eq ulong token get dtLast 1 eq ulong layer add get dtLast 2 1 28 end 29 if ne layer 0 30 ret false 31 end 32 if eq ulong turn get dtLast 0 33 ret eq ulong token add get dtLast 1 1 34 end 35 ret and eq ulong turn add get dtLast 0 1 eq token 0 36 end 37 38 fn dtRoute okids view uint 6 weights view uint 6 to bool 39 for i ulong 6 40 if or ge get okids i 384 gt get weights i 0x3fc00000 41 ret false 42 end 43 for j ulong i bound 6 44 if eq get okids i get okids j 45 ret false 46 end 47 end 48 end 49 ret true 50 end 51 52 fn dtAppend coord view uint 3 ids view uint 6 weights view uint 6 times view ulong 2 to bool 53 if or ne get ar_compute_kind 0 1 ne get ar_compute_pid 0 long getpid 54 ret false 55 end 56 if or ne get dtLast 4 0 ge sub get dtCount 0 get dtCount 1 dtCapacity 57 ret false 58 end 59 if not dtNext get coord 0 get coord 1 get coord 2 60 ret false 61 end 62 if or lt get times 0 get dtLast 3 lt get times 1 get times 0 63 ret false 64 end 65 if not dtRoute ids weights 66 ret false 67 end 68 base = mul rem get dtCount 0 dtCapacity 20 69 for i ulong 3 70 put dtRing add base i get coord i 71 put dtLast i ulong get coord i 72 end 73 put dtRing add base 3 0 74 for i ulong 6 75 put dtRing add add base 4 i get ids i 76 put dtRing add add base 10 i get weights i 77 end 78 for i ulong 2 79 off = add add base 16 mul i 2 80 put dtRing off uint and get times i 0xffffffff 81 put dtRing add off 1 uint shr get times i 32 82 end 83 put dtLast 3 get times 1 84 put dtCount 0 add get dtCount 0 1 85 ret true 86 end 87 88 fn dtDrain fd int ctx edit shactx to bool 89 if or ne get ar_compute_kind 0 1 ne get ar_compute_pid 0 long getpid 90 ret false 91 end 92 if ne get dtLast 4 0 93 ret false 94 end 95 buf = new uchar 80 0 96 while lt get dtCount 1 get dtCount 0 97 base = mul rem get dtCount 1 dtCapacity 20 98 for i ulong 20 99 diPut buf mul i 4 4 ulong get dtRing add base i 100 end 101 used = ulong 0 102 while lt used 80 103 n = write fd buf used sub 80 used 104 if eq n -4 105 continue 106 end 107 if le n 0 108 put dtLast 4 1 109 ret false 110 end 111 used = add used ulong n 112 end 113 sha256_update ctx buf 114 put dtCount 1 add get dtCount 1 1 115 end 116 ret true 117 end 118 119 fn dtFinish fd int ctx edit shactx digest out uchar 32 to bool 120 if or eq get dtCount 0 0 ne get dtLast 2 39 121 ret false 122 end 123 if not dtDrain fd ctx 124 ret false 125 end 126 sha256_final ctx digest 127 put dtLast 4 2 128 ret true 129 end