interplane.Get Omega
Read in your language

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

branch main Branches Tags History

omega-mv / gpu / nvidia / om / encoder / amp_qmd.om

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