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
omega-mv / gpu / nvidia / om / encoder / bw_spec_native.om
| 1 | note SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 2 | note Function-mode host probe. Concatenate bw_enc_sm121 and bw_spec_sm121 first. |
| 3 | note Mode 0 must return 0; mode 1 corrupts an expected operand byte and returns 1; |
| 4 | note mode 2 returns the real raw SHFL range refusal E_RANGE, never a setup error. |
| 5 | fn np_eq a view ulong 4 b view ulong 4 to bool |
| 6 | for i ulong 4 |
| 7 | if ne get a i get b i |
| 8 | ret false |
| 9 | end |
| 10 | end |
| 11 | ret true |
| 12 | end |
| 13 | fn sp_native_probe mode ulong to ulong |
| 14 | state = new ulong 3001 0 |
| 15 | fresh = new ulong 3001 0 |
| 16 | o = new ulong 16 0 |
| 17 | dec = new ulong 16 0 |
| 18 | w = new ulong 4 4294967295 |
| 19 | ref = new ulong 4 0 |
| 20 | if ne sp_dec state w dec E_NOMAT |
| 21 | ret 10 |
| 22 | end |
| 23 | if ne get state 3000 1 |
| 24 | ret 11 |
| 25 | end |
| 26 | if eq mode 2 |
| 27 | put o 0 42 |
| 28 | put o 6 32 |
| 29 | ret sp_enc state o w |
| 30 | end |
| 31 | note Warmed table mutation must survive cached initialization and change semantics. |
| 32 | put o 0 1 |
| 33 | put o 1 5 |
| 34 | if ne enc1 o ref E_OK |
| 35 | ret 12 |
| 36 | end |
| 37 | shift = get state 57 |
| 38 | put state 57 add shift 1 |
| 39 | status = sp_enc state o w |
| 40 | put state 57 shift |
| 41 | if ne status E_OK |
| 42 | ret 13 |
| 43 | end |
| 44 | if np_eq w ref |
| 45 | ret 14 |
| 46 | end |
| 47 | if ne sp_dec state w dec E_OK |
| 48 | ret 15 |
| 49 | end |
| 50 | if eq get dec 1 get o 1 |
| 51 | ret 16 |
| 52 | end |
| 53 | note Another zero-filled owner must retain canonical bytes independently. |
| 54 | if ne get fresh 3000 0 |
| 55 | ret 17 |
| 56 | end |
| 57 | if ne sp_enc fresh o w E_OK |
| 58 | ret 18 |
| 59 | end |
| 60 | if not np_eq w ref |
| 61 | ret 19 |
| 62 | end |
| 63 | note RRU full GPR destination and explicit uniform-source flags survive native calls. |
| 64 | put o 0 8 |
| 65 | put o 1 32 |
| 66 | put o 2 1 |
| 67 | put o 4 3 |
| 68 | put o 5 2 |
| 69 | put o 8 1 |
| 70 | put o 12 1 |
| 71 | put o 14 1 |
| 72 | if ne enc1 o ref E_OK |
| 73 | ret 20 |
| 74 | end |
| 75 | if ne sp_enc state o w E_OK |
| 76 | ret 21 |
| 77 | end |
| 78 | if eq mode 1 |
| 79 | put ref 0 xor get ref 0 65536 |
| 80 | end |
| 81 | if not np_eq w ref |
| 82 | ret 1 |
| 83 | end |
| 84 | if ne sp_dec state w dec E_OK |
| 85 | ret 22 |
| 86 | end |
| 87 | if or ne get dec 1 32 ne get dec 5 2 |
| 88 | ret 23 |
| 89 | end |
| 90 | if or ne get dec 8 1 ne get dec 14 1 |
| 91 | ret 24 |
| 92 | end |
| 93 | ret 0 |
| 94 | end |