interplane.Get Omega
Read in your language

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

branch main Branches Tags History

CUDApp / src / omega_blackwell_engine.h

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