Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/omega-mv/blob/main/src/omega_numeric_native.h # 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 Sign in to star 1 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `omega-mv / src / omega_numeric_native.h` 61 lines ยท 2410 bytes Raw Blame History 1 /* SPDX-License-Identifier: Apache-2.0 2 * Copyright 2026 Drake Stapleton (AIEN / aien-dev) 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 #ifndef OMEGA_NUMERIC_NATIVE_H 18 #define OMEGA_NUMERIC_NATIVE_H 19 20 #include "omega_numeric_lifecycle.h" 21 #include "m16_native.h" 22 #include 23 #include 24 25 /* Numeric launchers must use these wrappers together. The pinned M16 submit 26 * returns failure before ringing the doorbell, so a submit failure can close. 27 * Once submitted, a failed wait proves neither completion nor cancellation. */ 28 static inline int omega_numeric_native_open(M16NativeContext *ctx) { 29 memset(ctx, 0, sizeof *ctx); 30 if (omega_numeric_native_acquire() != 0) { 31 snprintf(ctx->rm.err, sizeof ctx->rm.err, 32 "numeric GPU owner busy or completion uncertain; submission refused"); 33 return -1; 34 } 35 int rc = m16_native_open(ctx); 36 if (rc != 0) omega_numeric_native_release(); 37 return rc; 38 } 39 40 static inline int omega_numeric_native_close(M16NativeContext *ctx) { 41 if (omega_numeric_native_uncertain()) return -1; 42 int rc = m16_native_close(ctx); 43 if (rc != 0) omega_numeric_native_poison(); 44 else omega_numeric_native_release(); 45 return rc; 46 } 47 48 static inline int omega_numeric_native_wait(volatile uint32_t *word, 49 uint32_t want, uint64_t timeout_ms) { 50 int rc = m16_native_wait_marker(word, want, timeout_ms); 51 /* M16's wait uses a monotonic >= comparison. These are fixed payloads, 52 * not sequence counters: a different word must never authorize readback. */ 53 if (rc == 0 && (!word || *word != want)) rc = -1; 54 if (rc != 0) { 55 omega_numeric_native_poison(); 56 fprintf(stderr, "GB10_COMPLETION_UNCERTAIN: numeric resources retained; " 57 "further numeric device work refused in this process\n"); 58 } 59 return rc; 60 } 61 #endif