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 / amp_qmd.om
| 1 | note SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 2 | note Ampere policy and QMD ABI words over amp_runtime (om/encoder/amp_runtime.om, composed before this file). |
| 3 | note src/omega_ampere_qmd.c only forwards pointers; this unit owns the amp_runtime m layout, the acceptance |
| 4 | note test and the narrowing of the 64 zero-extended QMD words to little-endian uint32 bytes. |
| 5 | note op 0 policy: a is the caller m vector, passed to amp_runtime unchanged and without a metadata copy. |
| 6 | note op 1 build: a[0..8] = code,cbank,semaphore,threadsX,threadsY,gridX,gridY,registers,sharedBytes, |
| 7 | note which become amp_runtime op 3 m[1..9]. a[9..15] are ignored. |
| 8 | note q receives 64 little-endian uint32 words (256 bytes) only when amp_runtime accepts. |
| 9 | note Return 1 accepted, 0 refused (unknown op included). |
| 10 | fn amp_qle q edit uchar 256 o ulong v ulong to void |
| 11 | put q o uchar and v 255 |
| 12 | put q add o 1 uchar and shr v 8 255 |
| 13 | put q add o 2 uchar and shr v 16 255 |
| 14 | put q add o 3 uchar and shr v 24 255 |
| 15 | end |
| 16 | fn amp_qpolicy a view ulong 16 q edit uchar 256 to ulong |
| 17 | w = new ulong 64 0 |
| 18 | if ne amp_runtime a w 1 |
| 19 | ret 0 |
| 20 | end |
| 21 | for i ulong 64 |
| 22 | amp_qle q mul i 4 get w i |
| 23 | end |
| 24 | ret 1 |
| 25 | end |
| 26 | fn amp_qmd op ulong a view ulong 16 q edit uchar 256 to ulong |
| 27 | if eq op 0 |
| 28 | ret amp_qpolicy a q |
| 29 | end |
| 30 | if ne op 1 |
| 31 | ret 0 |
| 32 | end |
| 33 | m = new ulong 16 0 |
| 34 | put m 0 3 |
| 35 | for i ulong 9 |
| 36 | put m add i 1 get a i |
| 37 | end |
| 38 | ret amp_qpolicy m q |
| 39 | end |