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 / om / gpu / dsv41 / decoder / lease.om
| 1 | note SPDX-License-Identifier: AGPL-3.0-only |
| 2 | note CPU=1 and GPU=2. Caller fences and retires the channel before releasing |
| 3 | note GPU ownership. A faulted or outstanding GPU submission retains ownership. |
| 4 | fn deAcquire h edit zonehdr owner uint to bool |
| 5 | if or ne get h owner 0 or lt owner 1 gt owner 2 |
| 6 | ret false |
| 7 | end |
| 8 | if not ar_claim_compute ulong owner |
| 9 | ret false |
| 10 | end |
| 11 | if not slab_acquire_lease h owner |
| 12 | ar_drop_compute |
| 13 | ret false |
| 14 | end |
| 15 | ret true |
| 16 | end |
| 17 | |
| 18 | fn deRelease h edit zonehdr owner uint outstanding ulong faulted bool to bool |
| 19 | if or ne get ar_compute_pid 0 long getpid ne get ar_compute_kind 0 ulong owner |
| 20 | ret false |
| 21 | end |
| 22 | if or faulted ne outstanding 0 |
| 23 | ret false |
| 24 | end |
| 25 | if not slab_release_lease h owner |
| 26 | ret false |
| 27 | end |
| 28 | ar_drop_compute |
| 29 | ret true |
| 30 | end |