CUDApp
CUDA++: AIEN’s GPU machine-code toolchain, runtime and driver client for NVIDIA GPUs without the CUDA toolkit. Hardware coverage and driver replacement limits are explicit.
Brought by drakestapleton
CUDApp / docs / speculation / SERVICE.md
| 1 | # Persistent native policy process |
| 2 | |
| 3 | `native/speculation/service.om` connects the existing policy to a persistent |
| 4 | stdin/stdout process. It is handwritten Omega, including framing, lifecycle |
| 5 | validation and timing. The native model engine must own and acknowledge all |
| 6 | physical prefill, verification, rollback and token-consumption operations. |
| 7 | |
| 8 | This is a real Linux AArch64 process interface, tested by a second native Omega |
| 9 | process through two pipes. It is not a model adapter or an AienOS device gate. |
| 10 | |
| 11 | ## Qualified compiler profile |
| 12 | |
| 13 | This entrypoint uses the existing native-host compiler from Omega commit |
| 14 | `f0499f415571bdd7496b6de391096915e78f7556`, independently reconstructed through |
| 15 | its existing seed chain. Compiler SHA-256: |
| 16 | |
| 17 | ``` |
| 18 | e5d60db892c8f21cc8c9128af26d8bded0e96d7f92946f5a549397c43a872649 |
| 19 | ``` |
| 20 | |
| 21 | Its published native-host gate covers file, process, pipe, clock and socket |
| 22 | operations. This is a distinct profile from the baseline compiler used for the |
| 23 | original pure components; no union with another compiler profile is assumed. |
| 24 | The dependency is qualified here without editing another owner's compiler. |
| 25 | |
| 26 | For a reconstruction, export the exact pinned seed and original fixture paths, |
| 27 | including their Git file index, and run its existing `seed/host/check.sh`. |
| 28 | Require nine positive groups, 41 negative controls and **70** original fixtures. |
| 29 | A partial source export can misleadingly print a passing comparison of zero |
| 30 | fixtures; zero does not qualify this dependency. |
| 31 | |
| 32 | Compile these ordered units with that compiler: |
| 33 | |
| 34 | - Worker: `native/speculation/policy.om`, `native/speculation/service.om`. |
| 35 | - Native test client: `native/speculation/policy.om`, |
| 36 | `tests/speculation/support.om`, `tests/speculation/service-test.om`. |
| 37 | |
| 38 | Run the test client with the worker executable's absolute path as its sole |
| 39 | argument. The client starts only that host worker, exercises both pipes, and |
| 40 | reaps it. Existing shell tools coordinate development reconstruction only; |
| 41 | the delivered worker invokes no shell, foreign helper or model runtime. |
| 42 | |
| 43 | ## Wire format |
| 44 | |
| 45 | All fields are unsigned 64-bit little-endian words. Requests have five header |
| 46 | words: magic `827343699` (SCP1), version `1`, operation, sequence, body length in |
| 47 | words. Sequences start at one and advance after each framed response, including |
| 48 | semantic refusals. Header and body reads tolerate partial reads and EINTR. |
| 49 | |
| 50 | Responses have seven header words: magic, version, operation, sequence, status, |
| 51 | body length in words, elapsed policy nanoseconds. Timing starts after the full |
| 52 | request arrives and ends before the response is written. The engine must also |
| 53 | measure total round-trip overhead, including transport, and include that cost |
| 54 | in the round. The elapsed field alone is not full adaptation overhead. |
| 55 | |
| 56 | | Operation | Request body | Successful response body | |
| 57 | | --- | --- | --- | |
| 58 | | 1 initialize | 64 identity words, 6 profile words, 77 cost-row words, 31 prior words | Empty | |
| 59 | | 2 begin | warm flag, require-device flag, sampling mode | Empty | |
| 60 | | 3 select | context, remaining output, memory budget, epoch, mode, fixed length | Five decision words from CONTRACT.md | |
| 61 | | 4 observe | accepted drafts, emitted tokens, full elapsed microseconds, EOS, complete | Emitted, consumed, pending-token, done counters | |
| 62 | | 5 consume | Empty; caller acknowledges consumption by the real model owner | Empty | |
| 63 | | 6 cancel | Empty; caller owns actual rollback and cancellation | Empty | |
| 64 | | 7 end | Empty; request must be complete with no active round | Empty | |
| 65 | | 8 exit | Empty; no request may be active | Empty, then process exit 0 | |
| 66 | |
| 67 | Initialize is accepted once per process. Begin requires initialization or a |
| 68 | previously ended/cancelled request. Warm begin retains the policy's learned |
| 69 | statistics under its original identity rules. Reconfiguration requires a new |
| 70 | process. The process performs no shared learning with other instances. |
| 71 | |
| 72 | Semantic errors return the policy's status and no payload. Broken framing, |
| 73 | unknown operations, bad versions/sequences or incomplete frames terminate the |
| 74 | process without a response for that frame. EOF is clean only between requests; |
| 75 | EOF during an active request exits 75. One process accepts at most one million |
| 76 | commands. There is no automatic fallback after process or protocol failure. |
| 77 | The model caller must abort the affected trial and preserve its failure record. |
| 78 | |
| 79 | The process itself does not discover code/model hashes or authenticate a device. |
| 80 | Supplied identities and acknowledgements must be derived from the real owner; |
| 81 | their presence on the wire cannot prove that the model executed correctly. |
| 82 | |
| 83 | ## Exact existing-engine attachment point |
| 84 | |
| 85 | The inspected 27B engine is sovereign-core `speed2/specdecode` at |
| 86 | `68fa1683874899eb0b6b4ab68bb2b9b19fcbcbb1`. Its existing |
| 87 | `qwen38_omega/spec.rs::decode_rounds` takes one fixed `k` for the request. |
| 88 | It has no external per-round budget callback. Its server reads `AIEN_Q38_SPEC_K` |
| 89 | when loading, and its `qwen38_spec suite` parses the entire plan before loading. |
| 90 | Those interfaces cannot implement adaptive per-round sizing merely by changing |
| 91 | command arguments between calls. This source supports chains up to eight drafts; |
| 92 | 16 and 31 must remain explicitly unsupported until independently qualified. |
| 93 | |
| 94 | A narrow engine connection would call select before drafting, use the returned |
| 95 | budget, preserve existing MTP/verification/complete-state ownership, and report |
| 96 | observe only after actual commit or rollback. It must handle natural EOS, |
| 97 | cancellation and output exhaustion before reporting the exact emitted/consumed |
| 98 | prefix, then acknowledge any correction token at its real consumption boundary. |
| 99 | Native timing must cover draft, verify, commit, host, policy/transport and setup. |
| 100 | First-divergence checks remain mandatory; this interface adds no numerical waiver. |
| 101 | |
| 102 | The user confirmed strict Omega implementation and authorized extending Omega's |
| 103 | compiler and runtime to supply this connection. Native device access, mapped |
| 104 | memory and the full model/state attachment remain prerequisites. The existing |
| 105 | Rust engine remains a reference for behavior. No model launch or hardware trial |
| 106 | is delivered by this policy-service component. |
| 107 | A strictly Omega attachment instead depends on the existing native ABI/runtime |
| 108 | owner. The presence of native host facilities does not establish that ABI. |