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_submit.h

111 lines · 5097 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_BLACKWELL_SUBMIT_H
18#define OMEGA_BLACKWELL_SUBMIT_H
19
20#include "omega_types.h"
21#include "omega_vector.h"
22#include "omega_blackwell_realize.h"
23#include "omega_blackwell_matmul.h"
24#include <stdbool.h>
25#include <stddef.h>
26#include <stdint.h>
27
28#define OMEGA_BW_MARKER_COMPLETION_PAYLOAD 0x44444444U
29#define OMEGA_BW_MARKER2_PAYLOAD 0x46464646u /* C3 second release, after the L2 flush */
30/* Shader-cache invalidate, emitted as the first compute method of every launch that
31 * uploads kernel code (cut 1b finding: the SM instruction cache is not coherent with
32 * host writes; after a kernel-cache slot was evicted and its code address reused, the
33 * chip ran stale instructions). Method and bits from NVIDIA open-gpu-doc
34 * classes/compute/clcec0.h (BLACKWELL_COMPUTE_B): NVCEC0_INVALIDATE_SHADER_CACHES 0x021c,
35 * _INSTRUCTION 0:0, _DATA 4:4, _CONSTANT 12:12. The shipped driver tree's clcec0.h is a
36 * 30-line class-id stub and does not list the method; chip-proven by receipt
37 * FB1-CUT1B-4345406 (18/18 parity after the fix). Emit: nvrm_mthd(1, MTHD, 1), ALL. */
38#define OMEGA_BW_MTHD_INVALIDATE_SHADER_CACHES 0x021cu
39#define OMEGA_BW_INVALIDATE_SHADER_CACHES_ALL ((1u << 0) | (1u << 4) | (1u << 12))
40#define OMEGA_BW_SEMAPHORE_INTERMEDIATE_INIT 5U
41#define OMEGA_BW_SEMAPHORE_INTERMEDIATE_DONE 6U
42
43typedef struct {
44 char target_chip[64];
45 uint32_t sm_architecture;
46 uint32_t element_count;
47 uint64_t launch_timestamp_ns;
48 uint64_t completion_timestamp_ns;
49 uint64_t elapsed_ns;
50 uint32_t completion_marker;
51 uint32_t intermediate_semaphore;
52 bool parity_verified;
53 bool zero_libcuda_linkage;
54 bool zero_cuda_symbols;
55 bool zero_libcuda_runtime;
56} OmegaBlackwellVectorExecution;
57
58typedef struct {
59 char target_chip[64];
60 uint32_t sm_architecture;
61 uint32_t m, k, n;
62 uint64_t launch_timestamp_ns;
63 uint64_t completion_timestamp_ns;
64 uint64_t elapsed_ns;
65 uint32_t completion_marker;
66 uint32_t intermediate_semaphore;
67 bool parity_verified;
68 size_t mismatch_count;
69 bool zero_libcuda_linkage;
70 bool zero_cuda_symbols;
71 bool zero_libcuda_runtime;
72} OmegaBlackwellMatMulExecution;
73
74/* Execute vector addition on physical GB10 silicon. Since cut A3b1 (DRAFT, chip-unproven) the
75 * device sequence runs through omega_gpu_execute with the Blackwell backend in
76 * src/omega_blackwell_engine.c; this wrapper keeps the host oracle and the result fields. */
77int omega_blackwell_execute_vector(const OmegaVectorSpec *spec,
78 const OmegaBlackwellRealization *real,
79 const uint32_t *h_a,
80 const uint32_t *h_b,
81 uint32_t *h_c_out,
82 OmegaBlackwellVectorExecution *exec_info);
83
84/* Execute dynamic matrix multiplication on physical GB10 silicon through frozen M16 native submission */
85/* Execute dynamic tensor matrix multiplication on physical GB10 silicon through frozen M16 native submission */
86int omega_blackwell_execute_matmul_tensor(const OmegaMatMulSpec *spec,
87 const OmegaBlackwellKernel *kernel,
88 const void *h_a,
89 const void *h_b,
90 float *h_c_out,
91 OmegaBlackwellMatMulExecution *exec_info,
92 float *out_max_abs_err,
93 float *out_max_rel_err);
94
95int omega_blackwell_execute_matmul(const OmegaMatMulSpec *spec,
96 const OmegaBlackwellKernel *kernel,
97 const uint32_t *h_a,
98 const uint32_t *h_b,
99 uint32_t *h_c_out,
100 OmegaBlackwellMatMulExecution *exec_info);
101
102/* Validate that omegatool binary has zero dynamic linkage to libcuda.so or libcudart.so */
103int omega_blackwell_verify_zero_libcuda_linkage(const char *binary_path);
104
105/* Validate that omegatool binary has zero undefined symbols starting with cu or cuda */
106int omega_blackwell_verify_zero_cuda_symbols(const char *binary_path);
107
108/* Validate that current running process has zero mapped regions of libcuda */
109int omega_blackwell_verify_zero_libcuda_runtime(void);
110
111#endif /* OMEGA_BLACKWELL_SUBMIT_H */