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/driver/gsp/dispatch.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 / driver / gsp / dispatch.om` 203 lines ยท 5040 bytes Raw Blame History 1 note gsp/dispatch.om: connects validated GSP_RUN_CPU_SEQUENCER (0x1002) event in bstate 11 2 note to sqrun (gsp/seq.om) and bseqdone (gsp/boot.om). 3 note Sources: 4 note open-gpu-kernel-modules-580.173.02: 5 note src/nvidia/src/kernel/gpu/gsp/kernel_gsp.c:432-443 (_kgspRpcRunCpuSequencer) 6 note src/nvidia/src/kernel/gpu/gsp/kernel_gsp.c:5297-5432 (kgspExecuteSequencerBuffer_IMPL) 7 note src/nvidia/src/kernel/gpu/gsp/arch/ampere/kernel_gsp_ga102.c:136-200 (kgspExecuteSequencerCommand_GA102) 8 note src/nvidia/arch/nvalloc/common/inc/rmgspseq.h:78-101, 203-219 9 note src/nvidia/generated/g_rpc-structures.h:1535-1544 (rpc_run_cpu_sequencer_v17_00) 10 note Reference: 11 note omega-driver-reference native/kernel/gpu/gsp_seq.{h,c} 12 note Contracts: 13 note - Host-model opcode/payload/core permission checks finish before simulated effects. 14 note - These checks do not validate device register alignment, actual BAR span or permissions. 15 note - Every non-simulator mode refuses the entire dispatch (SQENOC) after token checks, 16 note before unpack/effects, until a typed MMIO lease/span and typed core binding exist. 17 note - Host flags cannot authorize hardware; unsupported actions never simulate success. 18 note - Stale token or generation returns DSPEORD (-10) without quarantine and without side effects. 19 note - Execution or prevalidation failures invoke bseqdone gen tok false, entering quarantine (state 12). 20 note - Successful execution writes back updated regSaveArea to bsevent and invokes bseqdone gen tok true. 21 const DSPOK long 0 22 const DSPEORD long -10 23 const DSPEPKT long -13 24 const DSPMRST ulong 1 25 const DSPMSTR ulong 2 26 const DSPMHLT ulong 4 27 const DSPMRSM ulong 8 28 const DSPMALL ulong 15 29 global dspperm ulong 1 30 global dspops ulong 1 31 global dspcore ulong 1 32 global dspstat long 1 33 global dspwb uchar 64 34 global dspwl ulong 1 35 text dspwt "empty buffer|cmdIndex not inside the buffer|unknown opcode|opcode overruns cmdIndex|poll timed out|save index out of range|core opcode with no core callback|core opcode failed|nwords over 16384|delay sleep failed|poll budget over 999998|stale token or invalid state|remote error quarantined|packet shape truncated|" 36 fn dspu32 o ulong to ulong 37 v = ulong 0 38 for i ulong 4 39 v = or v shl ulong get bsevent add o i mul i 8 40 end 41 ret v 42 end 43 fn dspp32 o ulong v ulong to void 44 for i ulong 4 45 put bsevent add o i uchar and shr v mul i 8 255 46 end 47 end 48 fn dspunpk nw ulong to void 49 for i ulong nw 50 put sqbuf i uint dspu32 add 120 mul i 4 51 end 52 end 53 note Host model flags (dspperm/sqcore) authorize host simulation only. 54 note Whole hardware dispatch requires typed MMIO lease/span and engine-specific core capabilities. 55 note dspseq refuses non-simulator modes before unpack; these permission bits are host-model only. 56 fn dspcperm op ulong to bool 57 if eq get sqcore 0 0 58 ret false 59 end 60 if or lt op SQCRST gt op SQCRES 61 ret false 62 end 63 shf = sub op SQCRST 64 bit = shl ulong 1 shf 65 ret ne and get dspperm 0 bit 0 66 end 67 note Caller dspseq already refused empty, over-capacity and out-of-range cmdIndex before dspunpk; 68 note sqrun refuses an over-limit poll budget before its first effect. 69 fn dspprev nw ulong ci ulong to long 70 put dspops 0 0 71 put dspcore 0 0 72 i = ulong 0 73 while lt i ci bound 999999 74 op = sqw i 75 i = add i 1 76 n = sqpay op 77 if eq n M32 78 ret SQEOP 79 end 80 if gt add i n ci 81 ret SQEOVR 82 end 83 if eq op SQSTO 84 k = sqw add i 1 85 if ge k SQSAVE 86 ret SQESAVE 87 end 88 end 89 if and ge op SQCRST le op SQCRES 90 shf = sub op SQCRST 91 bit = shl ulong 1 shf 92 put dspops 0 or get dspops 0 bit 93 put dspcore 0 add get dspcore 0 1 94 if not dspcperm op 95 ret SQENOC 96 end 97 end 98 i = add i n 99 end 100 ret 0 101 end 102 fn dspseq gen ulong tok ulong to long 103 if ne get bstate 0 11 104 ret DSPEORD 105 end 106 if ne gen get bgen 0 107 ret DSPEORD 108 end 109 if ne tok get btoken 0 110 ret DSPEORD 111 end 112 if and ne get gspmode 0 0 ne get gspmode 0 2 113 z = bseqdone gen tok false 114 put dspstat 0 SQENOC 115 ret SQENOC 116 end 117 nw = dspu32 80 118 ci = dspu32 84 119 if lt get bselen 0 add 120 mul nw 4 120 z = bseqdone gen tok false 121 put dspstat 0 DSPEPKT 122 ret DSPEPKT 123 end 124 if eq nw 0 125 z = bseqdone gen tok false 126 put dspstat 0 SQEEMP 127 ret SQEEMP 128 end 129 if gt nw SQMAX 130 z = bseqdone gen tok false 131 put dspstat 0 SQECAP 132 ret SQECAP 133 end 134 if ge ci nw 135 z = bseqdone gen tok false 136 put dspstat 0 SQEIDX 137 ret SQEIDX 138 end 139 dspunpk nw 140 r = dspprev nw ci 141 if ne r 0 142 z = bseqdone gen tok false 143 put dspstat 0 r 144 ret r 145 end 146 for k ulong SQSAVE 147 put sqsave k dspu32 add 88 mul k 4 148 end 149 r = sqrun nw ci 150 if ne r 0 151 z = bseqdone gen tok false 152 put dspstat 0 r 153 ret r 154 end 155 for k ulong SQSAVE 156 dspp32 add 88 mul k 4 get sqsave k 157 end 158 d = bseqdone gen tok true 159 put dspstat 0 d 160 ret d 161 end 162 fn dspauto to long 163 ret dspseq get bgen 0 get btoken 0 164 end 165 fn dspinit to void 166 put dspstat 0 0 167 put dspops 0 0 168 put dspcore 0 0 169 put dspperm 0 0 170 end 171 fn dspperms m ulong to void 172 put dspperm 0 m 173 end 174 fn dspwhy e long to void 175 put dspwl 0 0 176 if ge e 0 177 ret 178 end 179 k = ulong sub 0 add e 1 180 if eq e DSPEORD 181 k = 11 182 end 183 if eq e -12 184 k = 12 185 end 186 if eq e DSPEPKT 187 k = 13 188 end 189 w = ulong 0 190 o = ulong 0 191 for j ulong len dspwt 192 c = get dspwt j 193 if eq c 124 194 w = add w 1 195 else 196 if eq w k 197 put dspwb o c 198 o = add o 1 199 end 200 end 201 end 202 put dspwl 0 o 203 end