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 / pipeline / seal_reuse.om
| 1 | note SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 2 | note Private command-list memo. Zero-initialized cache is owned by the caller under the session lock. |
| 3 | note No authority is cached: exact normalized bytes must match before their prior SHA256 is reused. |
| 4 | note Cache0 valid,1 argument count,32..63 digest,64..1855 normalized image. Other cells unused. |
| 5 | note Ownership, epoch, revision, admission, and submit-time intent checks still run separately. |
| 6 | fn native_mcreseal bank view uchar 1024 qmd view uchar 1024 n ulong cache edit uchar 2048 out edit uchar 32 to long |
| 7 | mc_clear edit out |
| 8 | if or eq n 0 gt n 32 |
| 9 | ret -1 |
| 10 | end |
| 11 | b = new uchar 16384 0 |
| 12 | off = add ulong 896 mul n 4 |
| 13 | for i ulong off |
| 14 | put b i get bank i |
| 15 | end |
| 16 | for i ulong 384 |
| 17 | v = get qmd i |
| 18 | if or and ge i 40 lt i 44 and ge i 48 lt i 52 |
| 19 | v = 0 |
| 20 | end |
| 21 | put b add off i v |
| 22 | end |
| 23 | off = add off 384 |
| 24 | for i ulong 384 |
| 25 | put b add off i get qmd add 512 i |
| 26 | end |
| 27 | size = add off 384 |
| 28 | same = and eq get cache 0 1 eq ulong get cache 1 n |
| 29 | for i ulong size |
| 30 | if ne get b i get cache add 64 i |
| 31 | same = false |
| 32 | end |
| 33 | end |
| 34 | if same |
| 35 | for i ulong 32 |
| 36 | put out i get cache add 32 i |
| 37 | end |
| 38 | ret 0 |
| 39 | end |
| 40 | put cache 0 0 |
| 41 | if ne kc_codesha b size edit out 0 |
| 42 | mc_clear edit out |
| 43 | ret -1 |
| 44 | end |
| 45 | for i ulong size |
| 46 | put cache add 64 i get b i |
| 47 | end |
| 48 | for i ulong 32 |
| 49 | put cache add 32 i get out i |
| 50 | end |
| 51 | put cache 1 uchar n |
| 52 | put cache 0 1 |
| 53 | ret 0 |
| 54 | end |