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/seed/sm121/vecadd.s2 # 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 / seed / sm121 / vecadd.s2` 156 lines ยท 3107 bytes Raw Blame History 1 ; vecadd.s2 -- the chip-proven GB10 vector add (out[i] = a[i] + b[i], 32-bit), written by hand in asm2's 2 ; language with the names of sm121.tbl. Four lines per GPU instruction (its four 32-bit words). 3 ; The referee is src/omega_blackwell_encoder.c VECADD_INSTRUCTIONS (the words the existing launcher runs); 4 ; gate6.sh requires asm2's bytes to equal omega_blackwell_encode_vecadd's bytes. 5 ; Launcher contract (src/omega_blackwell_engine.c, VECTOR_1D): c[0x0][0x358] memory descriptor, 6 ; 0x360 block size, 0x37c stack top, 0x380 a, 0x388 b, 0x390 out, 0x398 n. 7 ; LDC R1, c[0x0][0x37c] (offset 0x37c / 4 = 223) 8 ldc.0 1 9 ldc.1 223 10 ldc.2 11 ldc.3 12 ; S2R R9, SR_CTAID.X (special register 0x25) 13 s2r.0 9 14 s2r.1 15 s2r.2 0x25 16 s2r.3 17 ; LDCU UR4, c[0x0][0x360] (0x360 / 8 = 108) 18 ldcu.0 4 19 ldcu.1 108 20 ldcu.2 21 ldcu.3 22 ; S2R R0, SR_TID.X (special register 0x21) 23 s2r.0 0 24 s2r.1 25 s2r.2 0x21 26 s2r.3 27 ; LDCU UR5, c[0x0][0x398] (0x398 / 8 = 115) 28 ldcu.0 5 29 ldcu.1 115 30 ldcu.2 31 ctl 0x000e6200 32 ; IMAD R9, R9, UR4, R0 i = block * blocksize + thread 33 imad.u.0 9 9 34 imad.u.1 4 35 imad.u.2 0 36 imad.u.3 37 ; ISETP.GE.U32.AND P0, PT, R9, UR5, PT 38 isetp.ge.u.0 0 9 39 isetp.ge.u.1 5 40 isetp.ge.u.2 41 isetp.ge.u.3 42 ; @P0 EXIT threads past n stop 43 exit.p0.0 44 z.1 45 exit.2 46 exit.3 47 ; LDC.64 R2, c[0x0][0x380] a (0x380 / 4 = 224) 48 ldc.64.0 2 49 ldc.64.1 224 50 ldc.64.2 51 ldc.64.3 52 ; LDCU.64 UR4, c[0x0][0x358] memory descriptor (0x358 / 8 = 107) 53 ldcu.64.0 4 54 ldcu.64.1 107 55 ldcu.64.2 56 ldcu.64.3 57 ; LDC.64 R4, c[0x0][0x388] b (226) 58 ldc.64.0 4 59 ldc.64.1 226 60 ldc.64.2 61 ctl 0x000eb000 62 ; LDC.64 R6, c[0x0][0x390] out (228) 63 ldc.64.0 6 64 ldc.64.1 228 65 ldc.64.2 66 ctl 0x000ee200 67 ; IMAD.WIDE.U32 R2, R9, 0x4, R2 &a[i] 68 imad.wide.0 2 9 69 imad.wide.1 4 70 imad.wide.2 2 71 imad.wide.3 72 ; LDG.E R2, desc[UR4][R2.64] 73 ldg.0 2 2 74 ldg.1 4 75 ldg.2 76 ctl 0x002f2200 77 ; IMAD.WIDE.U32 R4, R9, 0x4, R4 &b[i] 78 imad.wide.0 4 9 79 imad.wide.1 4 80 imad.wide.2 4 81 ctl 0x004fcc00 82 ; LDG.E R5, desc[UR4][R4.64] 83 ldg.0 5 4 84 ldg.1 4 85 ldg.2 86 ldg.3 87 ; IMAD.WIDE.U32 R6, R9, 0x4, R6 &out[i] 88 imad.wide.0 6 9 89 imad.wide.1 4 90 imad.wide.2 6 91 ctl 0x008fe200 92 ; IADD3 R9, PT, PT, R2, R5, RZ a + b 93 iadd3.0 9 2 94 r.1 5 95 iadd3.2 96 iadd3.3 97 ; STG.E desc[UR4][R6.64], R9 out[i] = a + b 98 stg.0 6 99 stg.1 9 0 100 stg.2 4 101 stg.3 102 ; EXIT 103 exit.0 104 z.1 105 exit.2 106 exit.3 107 ; BRA to itself (never reached; stops a runaway warp): distance 0, so d = -1: low bits 63, rest -1 108 bra.0 7 63 109 bra.1 -1 110 bra.back.2 111 bra.self.3 112 ; padding to 32 instructions with NOP (11 of them) 113 nop.0 114 nop.1 115 nop.2 116 nop.3 117 nop.0 118 nop.1 119 nop.2 120 nop.3 121 nop.0 122 nop.1 123 nop.2 124 nop.3 125 nop.0 126 nop.1 127 nop.2 128 nop.3 129 nop.0 130 nop.1 131 nop.2 132 nop.3 133 nop.0 134 nop.1 135 nop.2 136 nop.3 137 nop.0 138 nop.1 139 nop.2 140 nop.3 141 nop.0 142 nop.1 143 nop.2 144 nop.3 145 nop.0 146 nop.1 147 nop.2 148 nop.3 149 nop.0 150 nop.1 151 nop.2 152 nop.3 153 nop.0 154 nop.1 155 nop.2 156 nop.3