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 / native / shader-pilot / export.om
| 1 | note SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 2 | note Offline stdout exporter: exactly [CUL1 catalog ID, selector], then EOF. |
| 3 | note Selector1 emits the task; selector2 emits the unchanged vector code. |
| 4 | global spin uchar 3 |
| 5 | fn main to int |
| 6 | pos = ulong 0 |
| 7 | done = false |
| 8 | while not done bound 4 |
| 9 | r = read 0 spin pos sub 3 pos |
| 10 | if lt r 0 |
| 11 | ret 74 |
| 12 | end |
| 13 | if eq r 0 |
| 14 | done = true |
| 15 | else |
| 16 | pos = add pos ulong r |
| 17 | if eq pos 3 |
| 18 | ret 65 |
| 19 | end |
| 20 | end |
| 21 | end |
| 22 | if ne pos 2 |
| 23 | ret 65 |
| 24 | end |
| 25 | mode = get spin 1 |
| 26 | if and ne mode 1 ne mode 2 |
| 27 | ret 77 |
| 28 | end |
| 29 | n = spload ulong get spin 0 |
| 30 | if eq n 0 |
| 31 | ret 77 |
| 32 | end |
| 33 | if eq mode 2 |
| 34 | n = 512 |
| 35 | end |
| 36 | pos = 0 |
| 37 | while lt pos n bound 513 |
| 38 | w = long 0 |
| 39 | if eq mode 1 |
| 40 | w = write 1 kt pos sub n pos |
| 41 | else |
| 42 | w = write 1 gbcode pos sub n pos |
| 43 | end |
| 44 | if le w 0 |
| 45 | ret 74 |
| 46 | end |
| 47 | pos = add pos ulong w |
| 48 | end |
| 49 | ret 0 |
| 50 | end |