omega-gpu-driver
aien-dev/omega-gpu-driver
Brought by drakestapleton
omega-gpu-driver / gsp / irqcmd.om
| 1 | note SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
| 2 | note Next host milestone: immutable model command consumption with once-only exact-sequence ACK. |
| 3 | note iqcommand acceptance/iqcack consumption NEVER claims MMU/TLB completion or a physical RPC ID. |
| 4 | global iqchold ulong 1 |
| 5 | global iqcitem uchar 40 |
| 6 | fn iqcget word ulong to ulong |
| 7 | if gt word 4 |
| 8 | ret 0 |
| 9 | end |
| 10 | v = ulong 0 |
| 11 | for i ulong 8 |
| 12 | v = or v shl ulong get iqcitem add mul word 8 i mul i 8 |
| 13 | end |
| 14 | ret v |
| 15 | end |
| 16 | fn iqctake to long |
| 17 | if ne get iqcmode 0 1 |
| 18 | ret -95 |
| 19 | end |
| 20 | if or ne get iqcstate 0 1 ne get iqchold 0 0 |
| 21 | ret -4 |
| 22 | end |
| 23 | if eq get iqccons 0 get iqcprod 0 |
| 24 | ret 0 |
| 25 | end |
| 26 | o = mul rem get iqccons 0 8 40 |
| 27 | for i ulong 40 |
| 28 | put iqcitem i get iqcmd add o i |
| 29 | end |
| 30 | put iqchold 0 1 |
| 31 | ret 1 |
| 32 | end |
| 33 | fn iqcack seq ulong to long |
| 34 | if ne get iqcmode 0 1 |
| 35 | ret -95 |
| 36 | end |
| 37 | if or ne get iqcstate 0 1 ne get iqchold 0 1 |
| 38 | ret -4 |
| 39 | end |
| 40 | if or eq seq 0 ne seq iqcget 1 |
| 41 | ret -4 |
| 42 | end |
| 43 | put iqchold 0 0 |
| 44 | put iqccons 0 add get iqccons 0 1 |
| 45 | ret 0 |
| 46 | end |
| 47 | fn iqcrevoke to long |
| 48 | if ne get iqcmode 0 1 |
| 49 | ret -95 |
| 50 | end |
| 51 | if ne get iqcstate 0 1 |
| 52 | ret -4 |
| 53 | end |
| 54 | put iqcstate 0 2 |
| 55 | put iqchold 0 0 |
| 56 | note No consumer publication on cancellation; queued/unacknowledged records are retained. |
| 57 | ret 0 |
| 58 | end |