interplane.Get Omega
Read in your language

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

branch main Branches Tags History

omega-mv / src / omega_blackwell_engine.h

77 lines · 3841 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/*
18 * Omega GPU Engine, Blackwell GB10 backend (cut A3b1).
19 *
20 * This module is ONLY the device side of the engine. The public entry point is
21 * omega_gpu_execute in src/omega_gpu_engine.c (the A3a core); this file supplies
22 * the backend function table that the core drives (OmegaGpuBackend, declared in
23 * src/omega_gpu_engine.h). It does not define any job, result or execute type.
24 *
25 * Origin: the device sequence (open, channel, allocations, descriptor and QMD
26 * build, pushbuffer, submit, waits, copy-out, close) was seeded from the first
27 * cut by GPT-6 Astra (branch fix/omega-gpu-engine-first-cut, commit 21392ee,
28 * src/omega_blackwell_engine.c) and from omega_blackwell_execute_vector as it
29 * stood at 676f16f. See docs/numeric/OMEGA_GPU_ENGINE.md, section Origin.
30 *
31 * Usage:
32 * omega_gpu_engine_set_backend(omega_blackwell_engine_backend());
33 * rc = omega_gpu_execute(&job, &result);
34 * Only the VECTOR_1D layout (two inputs, one output, 64 threads per block) is
35 * supported. One run at a time: the backend keeps one process-wide context and
36 * a second open while a run is active is refused as DEVICE_OPEN.
37 *
38 * Observed values on success: the core only copies driver diagnostics on a
39 * failure, and the core frees and closes the device (which unmaps the marker
40 * and semaphore memory) before it returns. So the backend snapshots what it saw
41 * inside its own wait callbacks, and omega_blackwell_engine_run_info returns
42 * that snapshot after a run. The vector wrapper in omega_blackwell_submit.c
43 * uses it to fill completion_marker, intermediate_semaphore and the timestamps.
44 *
45 * STATUS: DRAFT. Host NOT_RUN, chip NOT_RUN. Nothing here has been compiled or
46 * executed by its author.
47 */
48#ifndef OMEGA_BLACKWELL_ENGINE_H
49#define OMEGA_BLACKWELL_ENGINE_H
50
51#include "omega_gpu_engine.h"
52
53#include <stdint.h>
54
55/* What the backend observed during the most recent run (valid after the run). */
56typedef struct {
57 uint64_t launch_ns; /* CLOCK_MONOTONIC, just before the pushbuffer submit; 0 if never submitted */
58 uint64_t marker_done_ns; /* CLOCK_MONOTONIC, just after the first marker wait succeeded; 0 if it did not */
59 uint32_t marker; /* first marker word as observed by the wait (0x44444444 on success) */
60 uint32_t marker2; /* second marker word as observed (0x46464646 on success, 0 with NO_C3) */
61 uint32_t semaphore; /* QMD release semaphore word as observed (6 on success) */
62} OmegaBlackwellEngineRunInfo;
63
64/* The process-wide Blackwell backend table. Never NULL. The ctx inside it is
65 * the backend's static context; callers must not touch it. */
66const OmegaGpuBackend *omega_blackwell_engine_backend(void);
67
68/* The device and channel stay open between jobs (omega-mv#575). This closes them
69 * when no run is active; returns 0 (closed or nothing open), -1 when a run is
70 * active or retained. OMEGA_GPU_ENGINE_NO_PERSIST=1 restores one open per job. */
71int omega_blackwell_engine_shutdown(void);
72int omega_blackwell_engine_device_is_open(void);
73
74/* Copies the snapshot of the most recent run into *out. Reset at every open. */
75void omega_blackwell_engine_run_info(OmegaBlackwellEngineRunInfo *out);
76
77#endif