diff --git a/.gitignore b/.gitignore index cec6cf5bd..245740692 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,5 @@ build/ +build/qual-runs/ *.o .claude/ .claude/ diff --git a/Makefile b/Makefile index 79f647ecc..dbbb665f8 100644 --- a/Makefile +++ b/Makefile @@ -1,13 +1,15 @@ CC ?= gcc -PHYSICS_DIR ?= /home/drakestapleton/workspace/physics +PHYSICS_DIR ?= ../physics OUT_DIR ?= build +PHYSICS_LOCK_CHECK ?= 1 CFLAGS ?= -std=gnu11 -Wall -Wextra -Werror -D_GNU_SOURCE -O2 -Isrc \ -I$(PHYSICS_DIR)/m16 -I$(PHYSICS_DIR)/nvrm \ -I$(PHYSICS_DIR)/third_party/nvidia-open-580.173.02/src/common/sdk/nvidia/inc \ -I$(PHYSICS_DIR)/third_party/nvidia-open-580.173.02/kernel-open/common/inc \ -I$(PHYSICS_DIR)/third_party/nvidia-open-580.173.02/kernel-open/nvidia-uvm \ - -I$(PHYSICS_DIR)/third_party/nvidia-open-580.173.02/src/nvidia/arch/nvalloc/unix/include + -I$(PHYSICS_DIR)/third_party/nvidia-open-580.173.02/src/nvidia/arch/nvalloc/unix/include \ + -DOMEGA_PHYSICS_DIR=\"$(PHYSICS_DIR)\" SRCS = src/sha256.c src/omega_canonical.c src/omega_validate.c src/omega_core.c src/omega_codec.c \ src/aarch64_encoder.c src/aarch64_decoder.c src/omega_realize.c src/omega_exec.c \ @@ -16,16 +18,35 @@ SRCS = src/sha256.c src/omega_canonical.c src/omega_validate.c src/omega_core.c src/omega_matvec.c src/omega_accelerator.c src/omega_accelerator_world.c \ src/omega_vector.c src/omega_blackwell_encoder.c src/omega_blackwell_qmd.c \ src/omega_blackwell_realize.c src/omega_blackwell_submit.c src/omega_blackwell_gates.c src/omega_blackwell_matmul.c src/omega_blackwell_codegen.c src/omega_world_gates.c \ + src/omega_evidence.c \ $(PHYSICS_DIR)/m16/m16_native.c $(PHYSICS_DIR)/nvrm/nvrm.c \ tools/omegatool.c OBJS = $(patsubst %.c,$(OUT_DIR)/%.o,$(notdir $(SRCS))) TARGET = $(OUT_DIR)/omegatool -.PHONY: all clean test-m19 test test-m5 test-m6 test-m7 test-m8 test-m9 test-m10 test-m11 test-m12 test-m13 test-m14 test-m15 test-m17 +.PHONY: all clean check-physics-lock test-m19 test test-m5 test-m6 test-m7 test-m8 test-m9 test-m10 test-m11 test-m12 test-m13 test-m14 test-m15 test-m17 all: $(TARGET) +check-physics-lock: + @if [ "$(PHYSICS_LOCK_CHECK)" != "0" ]; then \ + if [ ! -f physics.lock ]; then \ + echo "error: physics.lock not found at repo root" >&2; exit 1; \ + fi; \ + locked=$$(tr -d '[:space:]' < physics.lock); \ + actual=$$(git -C $(PHYSICS_DIR) rev-parse HEAD 2>/dev/null); \ + if [ -z "$$actual" ]; then \ + echo "error: could not read HEAD of PHYSICS_DIR=$(PHYSICS_DIR) (git -C $(PHYSICS_DIR) rev-parse HEAD failed)" >&2; \ + exit 1; \ + fi; \ + if [ "$$actual" != "$$locked" ]; then \ + echo "error: PHYSICS_DIR=$(PHYSICS_DIR) is at commit $$actual but physics.lock pins $$locked." >&2; \ + echo " Checkout the pinned physics commit, or override with PHYSICS_LOCK_CHECK=0." >&2; \ + exit 1; \ + fi; \ + fi + $(OUT_DIR): mkdir -p $(OUT_DIR) @@ -41,7 +62,7 @@ $(OUT_DIR)/nvrm.o: $(PHYSICS_DIR)/nvrm/nvrm.c | $(OUT_DIR) $(OUT_DIR)/omegatool.o: tools/omegatool.c | $(OUT_DIR) $(CC) $(CFLAGS) -c $< -o $@ -$(TARGET): $(OBJS) +$(TARGET): check-physics-lock $(OBJS) $(CC) $(CFLAGS) -o $@ $(OBJS) test: $(TARGET) diff --git a/physics.lock b/physics.lock new file mode 100644 index 000000000..a46476728 --- /dev/null +++ b/physics.lock @@ -0,0 +1 @@ +b64753d95bacb1114ba48decde48239f0c542e12 diff --git a/src/omega_blackwell_gates.c b/src/omega_blackwell_gates.c index 4f68cca45..9981eb090 100644 --- a/src/omega_blackwell_gates.c +++ b/src/omega_blackwell_gates.c @@ -8,7 +8,9 @@ #include "omega_blackwell_qmd.h" #include "omega_blackwell_realize.h" #include "omega_blackwell_submit.h" +#include "omega_accelerator_world.h" #include "sha256.h" +#include "omega_evidence.h" #include #include #include @@ -18,6 +20,11 @@ static int m17_gate_count = 0; static int m17_gate_passed = 0; +void omega_get_m17_gate_snapshot(int *count, int *passed) { + if (count) *count = m17_gate_count; + if (passed) *passed = m17_gate_passed; +} + static void report_m17_gate(const char *gate_name, bool pass, const char *detail) { m17_gate_count++; if (pass) { @@ -294,10 +301,11 @@ static bool test_m17_zero_libcuda_runtime(void) { } static bool test_m17_evidence_durability(void) { - int ret = system("mkdir -p evidence/m17_blackwell_vector"); - (void)ret; + char insn_path[1024], qmd_path[1024]; + if (omega_evidence_path("m17_blackwell_vector/vecadd_instructions.txt", insn_path, sizeof(insn_path)) != 0) return false; + if (omega_evidence_path("m17_blackwell_vector/qmd1_hexdump.txt", qmd_path, sizeof(qmd_path)) != 0) return false; - FILE *f_insn = fopen("evidence/m17_blackwell_vector/vecadd_instructions.txt", "w"); + FILE *f_insn = fopen(insn_path, "w"); if (!f_insn) return false; fprintf(f_insn, "=== OMEGA BLACKWELL SM_121 VECTOR ADD INSTRUCTION SEQUENCE ===\n"); fprintf(f_insn, "Total instructions: %d (512 bytes)\n", OMEGA_BW_VECADD_INSN_COUNT); @@ -320,7 +328,7 @@ static bool test_m17_evidence_durability(void) { }; uint32_t qmd1[OMEGA_BW_QMD_WORDS]; omega_blackwell_build_qmd1(qmd1, &cfg); - FILE *f_qmd = fopen("evidence/m17_blackwell_vector/qmd1_hexdump.txt", "w"); + FILE *f_qmd = fopen(qmd_path, "w"); if (!f_qmd) return false; fprintf(f_qmd, "=== OMEGA BLACKWELL QMD V5.0 HEX DUMP ===\n"); for (size_t i = 0; i < OMEGA_BW_QMD_WORDS; i++) { @@ -436,6 +444,11 @@ void run_demonstration_blackwell_vector(void) { static int m18_gate_count = 0; static int m18_gate_passed = 0; +void omega_get_m18_gate_snapshot(int *count, int *passed) { + if (count) *count = m18_gate_count; + if (passed) *passed = m18_gate_passed; +} + static void report_m18_gate(const char *gate_name, bool pass, const char *detail) { m18_gate_count++; if (pass) { @@ -1004,37 +1017,32 @@ static bool test_m18_gate18_receipt(void) { omega_blackwell_kernel_free(&k_f16); omega_blackwell_kernel_free(&k_bf16); - /* 2. Read git commits */ - char impl_commit[65] = "UNKNOWN"; - FILE *p_impl = popen("git rev-parse HEAD 2>/dev/null", "r"); - if (p_impl) { - char buf[65]; - if (fgets(buf, sizeof(buf), p_impl)) { - char *nl = strchr(buf, '\n'); - if (nl) *nl = 0; - if (strlen(buf) == 40) strncpy(impl_commit, buf, sizeof(impl_commit)); - } - pclose(p_impl); - } - - char m16_commit[65] = "UNKNOWN"; - FILE *p_m16 = popen("cd /home/drakestapleton/workspace/physics && git rev-parse HEAD 2>/dev/null", "r"); - if (p_m16) { - char buf[65]; - if (fgets(buf, sizeof(buf), p_m16)) { - char *nl = strchr(buf, '\n'); - if (nl) *nl = 0; - if (strlen(buf) == 40) strncpy(m16_commit, buf, sizeof(m16_commit)); + /* 2. Commit / physics identity: observed, not asserted. */ + char run_commit[41] = "UNKNOWN"; + if (!omega_evidence_run_commit(run_commit)) strcpy(run_commit, "UNKNOWN"); + bool tree_dirty = omega_evidence_tree_dirty(); + + char physics_commit[65] = "UNKNOWN"; + if (!omega_evidence_physics_commit(physics_commit, sizeof(physics_commit))) strcpy(physics_commit, "UNKNOWN"); + + /* 3. Observed hardware identity (live Nvrm fields, not a hard-coded sm_121). */ + OmegaEvidenceHardware hw; + memset(&hw, 0, sizeof(hw)); + hw.alias = "sm_121"; + { + OmegaAcceleratorWorld hw_world; + if (omega_world_init(&hw_world) == OMEGA_WORLD_OK) { + omega_evidence_hardware_from_nvrm(&hw_world.m16.rm, &hw); + omega_world_destroy(&hw_world); } - pclose(p_m16); } - /* 3. Binary SHA-256 */ + /* 4. Binary SHA-256 */ uint8_t bin_digest[32]; char bin_hex[65] = {0}; compute_file_sha256("build/omegatool", bin_digest, bin_hex); - /* 4. Generate evidence/SHA256SUMS */ + /* 5. Generate the SHA256SUMS manifest under the run-scoped evidence area. */ const char *manifest_files[] = { "src/omega_blackwell_matmul.h", "src/omega_blackwell_matmul.c", @@ -1051,7 +1059,10 @@ static bool test_m18_gate18_receipt(void) { }; size_t num_files = sizeof(manifest_files) / sizeof(manifest_files[0]); - FILE *f_sums = fopen("evidence/SHA256SUMS", "w"); + char sums_path[1024]; + if (omega_evidence_path("SHA256SUMS", sums_path, sizeof(sums_path)) != 0) return false; + + FILE *f_sums = fopen(sums_path, "w"); if (!f_sums) return false; for (size_t i = 0; i < num_files; i++) { uint8_t d[32]; @@ -1062,13 +1073,25 @@ static bool test_m18_gate18_receipt(void) { } fclose(f_sums); - /* 5. Compute manifest digest */ + /* 6. Compute manifest digest */ uint8_t manifest_digest[32]; char manifest_hex[65] = {0}; - if (!compute_file_sha256("evidence/SHA256SUMS", manifest_digest, manifest_hex)) return false; - - /* 6. Write evidence/omega_blackwell_matmul_stage2_receipt.json */ - FILE *f = fopen("evidence/omega_blackwell_matmul_stage2_receipt.json", "w"); + if (!compute_file_sha256(sums_path, manifest_digest, manifest_hex)) return false; + + /* 7. Derived (observed, not asserted) regression counts. Gate 17 of this + * suite (test_m18_gate17_regression) ran run_m17_gates() immediately + * before this gate executes; read back what it actually ran. */ + int m17_count = 0, m17_passed = 0; + omega_get_m17_gate_snapshot(&m17_count, &m17_passed); + int m18_count_so_far = 0, m18_passed_so_far = 0; + omega_get_m18_gate_snapshot(&m18_count_so_far, &m18_passed_so_far); + int total_gates_evaluated = m18_count_so_far + m17_count; + int cumulative_regression_passed = m17_passed; + + /* 8. Write the M18 receipt to the run-scoped evidence area. */ + char receipt_path[1024]; + if (omega_evidence_path("omega_blackwell_matmul_stage2_receipt.json", receipt_path, sizeof(receipt_path)) != 0) return false; + FILE *f = fopen(receipt_path, "w"); if (!f) return false; time_t now = time(NULL); @@ -1088,7 +1111,23 @@ static bool test_m18_gate18_receipt(void) { fprintf(f, " \"final_evidence_commit\": \"%s\",\n", "87349c01b6de3555f621b2c30141381863c09486"); fprintf(f, " \"architecture_ratification_commit\": \"%s\",\n", "9f1f13380f1ab39caa45438830c06bde7c2a0c11"); fprintf(f, " \"architecture_canonical_head\": \"%s\",\n", "f4d86c8587ef87f5fba9088daf638c4d563d0c0a"); - fprintf(f, " \"m16_authority_commit\": \"%s\",\n", m16_commit); + fprintf(f, " \"m16_authority_commit\": \"%s\",\n", physics_commit); + fprintf(f, " \"physics_commit\": \"%s\",\n", physics_commit); + fprintf(f, " \"run_commit\": \"%s\",\n", run_commit); + fprintf(f, " \"tree_dirty\": %s,\n", tree_dirty ? "true" : "false"); + { + const char *qual_record = getenv("OMEGA_QUAL_RECORD"); + bool recording = (qual_record != NULL && strcmp(qual_record, "1") == 0); + if (recording && !tree_dirty) { + fprintf(f, " \"candidate_git_commit\": \"%s\",\n", run_commit); + } + } + fprintf(f, " \"hardware\": {\n"); + fprintf(f, " \"compute_class\": \"0x%x\",\n", hw.compute_class); + fprintf(f, " \"rm_sm_version\": \"0x%x\",\n", hw.rm_sm_version); + fprintf(f, " \"gpu_uuid\": \"%s\",\n", hw.gpu_uuid_hex); + fprintf(f, " \"alias\": \"%s\"\n", hw.alias); + fprintf(f, " },\n"); fprintf(f, " \"fp16_spec_id\": \"%s\",\n", f16_spec_hex); fprintf(f, " \"fp16_code_sha256\": \"%s\",\n", f16_code_hex); fprintf(f, " \"fp16_realization_id\": \"%s\",\n", f16_real_hex); @@ -1112,10 +1151,11 @@ static bool test_m18_gate18_receipt(void) { fprintf(f, " \"zero_libcuda_linkage\": true,\n"); fprintf(f, " \"zero_cuda_symbols\": true,\n"); fprintf(f, " \"zero_libcuda_runtime\": true,\n"); - fprintf(f, " \"all_18_gates_passed\": true,\n"); - fprintf(f, " \"total_gates_evaluated\": 157,\n"); - fprintf(f, " \"cumulative_regression_passed\": 139,\n"); - fprintf(f, " \"m18_gates_passed\": 18,\n"); + fprintf(f, " \"all_18_gates_passed\": %s,\n", (m18_passed_so_far == m18_count_so_far) ? "true" : "false"); + fprintf(f, " \"total_gates_evaluated\": %d,\n", total_gates_evaluated); + fprintf(f, " \"cumulative_regression_passed\": %d,\n", cumulative_regression_passed); + fprintf(f, " \"m18_gates_passed\": %d,\n", m18_passed_so_far); + fprintf(f, " \"tests_executed\": [\"OMEGA_BW_MATMUL_REGRESSION_PASS(run_m17_gates)\"],\n"); fprintf(f, " \"qualification_timestamp\": \"%s\"\n", time_str); fprintf(f, "}\n"); fclose(f); @@ -1144,12 +1184,23 @@ int run_m18_gates(void) { report_m18_gate("OMEGA_BW_MATMUL_BOUNDARY_ANNIHILATION_PASS", test_m18_gate14_boundary_annihilation(), "Boundary and annihilation matrix tests (zero, identity, dynamic range, cancellation)"); report_m18_gate("OMEGA_BW_MATMUL_ZERO_LIBCUDA_PASS", test_m18_gate15_zero_libcuda(), "Zero foreign userspace runtime verification (linkage, symbols, maps)"); report_m18_gate("OMEGA_BW_MATMUL_CLEAN_CLONE_PASS", test_m18_gate16_clean_clone(), "Clean-clone isolated reproduction on DGX Spark"); - report_m18_gate("OMEGA_BW_MATMUL_REGRESSION_PASS", test_m18_gate17_regression(), "Cumulative regression parity: 139 / 139 prior milestone gates passing"); + { + bool regression_ok = test_m18_gate17_regression(); + int m17_count = 0, m17_passed = 0; + omega_get_m17_gate_snapshot(&m17_count, &m17_passed); + char detail[96]; + snprintf(detail, sizeof(detail), "Cumulative regression parity: %d / %d prior milestone gates passing", m17_passed, m17_count); + report_m18_gate("OMEGA_BW_MATMUL_REGRESSION_PASS", regression_ok, detail); + } report_m18_gate("OMEGA_BW_MATMUL_RECEIPT_PASS", test_m18_gate18_receipt(), "Milestone 18 qualification receipt and cryptographic manifest generated"); printf("================================================================================\n"); printf(" STAGE 2 / FULL QUALIFICATION: %d / %d M18 GATES PASSED\n", m18_gate_passed, m18_gate_count); - printf(" TOTAL GATES EVALUATED: 157 (18 M18 Gates + 139 Prior Regression Gates)\n"); + { + int m17_count = 0, m17_passed = 0; + omega_get_m17_gate_snapshot(&m17_count, &m17_passed); + printf(" TOTAL GATES EVALUATED: %d (%d M18 Gates + %d Prior Regression Gates)\n", m18_gate_count + m17_count, m18_gate_count, m17_count); + } printf("================================================================================\n"); return (m18_gate_passed == m18_gate_count) ? 0 : 1; } diff --git a/src/omega_evidence.c b/src/omega_evidence.c new file mode 100644 index 000000000..ec98e9a73 --- /dev/null +++ b/src/omega_evidence.c @@ -0,0 +1,143 @@ +#include "omega_evidence.h" +#include +#include +#include +#include +#include +#include + +static bool trim_line(char *buf) { + size_t len = strlen(buf); + while (len > 0 && (buf[len - 1] == '\n' || buf[len - 1] == '\r' || buf[len - 1] == ' ')) { + buf[--len] = '\0'; + } + return len > 0; +} + +static bool popen_read_line(const char *cmd, char *out, size_t n) { + FILE *p = popen(cmd, "r"); + if (!p) return false; + char buf[256] = {0}; + bool got = (fgets(buf, sizeof(buf), p) != NULL); + pclose(p); + if (!got || !trim_line(buf)) return false; + if (strlen(buf) >= n) return false; + strcpy(out, buf); + return true; +} + +/* ---- run_id -------------------------------------------------------------- */ + +static char g_run_id[96] = {0}; +static bool g_run_id_ready = false; + +const char *omega_evidence_run_id(void) { + if (!g_run_id_ready) { + time_t now = time(NULL); + struct tm tm_info; + gmtime_r(&now, &tm_info); + char ts[32]; + strftime(ts, sizeof(ts), "%Y%m%dT%H%M%SZ", &tm_info); + + char sha[64]; + if (!popen_read_line("git rev-parse --short=12 HEAD 2>/dev/null", sha, sizeof(sha))) { + snprintf(sha, sizeof(sha), "unknown"); + } + snprintf(g_run_id, sizeof(g_run_id), "%s-%s", ts, sha); + g_run_id_ready = true; + } + return g_run_id; +} + +/* ---- evidence path --------------------------------------------------- */ + +static void mkdir_p_for_file(const char *filepath) { + char tmp[1024]; + snprintf(tmp, sizeof(tmp), "%s", filepath); + for (char *p = tmp + 1; *p; p++) { + if (*p == '/') { + *p = '\0'; + mkdir(tmp, 0755); + *p = '/'; + } + } +} + +static bool path_exists(const char *p) { + struct stat st; + return stat(p, &st) == 0; +} + +int omega_evidence_path(const char *relpath, char *out, size_t n) { + if (!relpath || !out || n == 0) return -1; + + const char *run_id = omega_evidence_run_id(); + char candidate[1024]; + + const char *record = getenv("OMEGA_QUAL_RECORD"); + bool recording = (record != NULL && strcmp(record, "1") == 0); + + if (recording) { + int len = snprintf(candidate, sizeof(candidate), "evidence/runs/%s/%s", run_id, relpath); + if (len < 0 || (size_t)len >= sizeof(candidate)) return -1; + if (path_exists(candidate)) { + fprintf(stderr, "omega_evidence_path: refusing to overwrite existing recorded evidence: %s\n", candidate); + return -1; + } + } else { + int len = snprintf(candidate, sizeof(candidate), "build/qual-runs/%s/%s", run_id, relpath); + if (len < 0 || (size_t)len >= sizeof(candidate)) return -1; + } + + mkdir_p_for_file(candidate); + + if (strlen(candidate) >= n) return -1; + strcpy(out, candidate); + return 0; +} + +/* ---- commit identity --------------------------------------------------- */ + +bool omega_evidence_run_commit(char out[41]) { + char sha[64]; + if (!popen_read_line("git rev-parse HEAD 2>/dev/null", sha, sizeof(sha))) return false; + if (strlen(sha) != 40) return false; + memcpy(out, sha, 41); + return true; +} + +bool omega_evidence_tree_dirty(void) { + FILE *p = popen("git status --porcelain -- src spec tools Makefile 2>/dev/null", "r"); + if (!p) return true; /* fail safe: unknown treated as dirty */ + char buf[256]; + bool any = (fgets(buf, sizeof(buf), p) != NULL); + pclose(p); + return any; +} + +bool omega_evidence_physics_commit(char *out, size_t n) { + FILE *f = fopen("physics.lock", "r"); + if (!f) return false; + char buf[256] = {0}; + bool got = (fgets(buf, sizeof(buf), f) != NULL); + fclose(f); + if (!got || !trim_line(buf)) return false; + if (strlen(buf) >= n) return false; + strcpy(out, buf); + return true; +} + +/* ---- hardware identity --------------------------------------------------- */ + +void omega_evidence_hardware_from_nvrm(const Nvrm *rm, OmegaEvidenceHardware *out) { + if (!out) return; + memset(out, 0, sizeof(*out)); + out->alias = "sm_121"; + if (!rm) return; + out->compute_class = rm->compute_class; + out->rm_sm_version = rm->sm_version; + for (int i = 0; i < 16; i++) { + snprintf(&out->gpu_uuid_hex[i * 2], 3, "%02x", rm->gpu_uuid[i]); + } + out->gpu_uuid_hex[32] = '\0'; +} diff --git a/src/omega_evidence.h b/src/omega_evidence.h new file mode 100644 index 000000000..4c036c7c4 --- /dev/null +++ b/src/omega_evidence.h @@ -0,0 +1,102 @@ +/* + * omega_evidence.h -- immutable run-evidence plumbing shared by every gate suite. + * + * Problem this closes: gate suites used to fopen() straight into the + * committed evidence/ tree, silently rewriting evidence that had already + * been reviewed and merged, and receipts asserted literal pass counts + * instead of reporting what actually ran. This header gives every gate + * suite: + * + * (a) omega_evidence_path() -- a namespaced, run-scoped output path + * that never collides with (or overwrites) a legacy evidence/ file. + * (b) accessor functions for every suite's gate counters, plus callable + * entry points for the M4..M15 suites (previously inlined in + * tools/omegatool.c) so a regression gate can actually execute them + * and sum real counts instead of asserting a literal. + * (c) git commit identity (run_commit / tree_dirty) so a receipt cannot + * misrepresent the commit it ran on as "the qualified candidate". + * (d) observed hardware identity (compute_class / sm_version / uuid) + * read from a live Nvrm handle instead of a hard-coded "sm_121". + */ +#ifndef OMEGA_EVIDENCE_H +#define OMEGA_EVIDENCE_H + +#include +#include +#include "nvrm.h" + +/* ---- (a) run-scoped, non-clobbering evidence paths -------------------- */ + +/* + * Resolve `relpath` to a run-scoped output path and create any parent + * directories needed to write it. + * + * - Default: "build/qual-runs//". + * - If the environment variable OMEGA_QUAL_RECORD=1: "evidence/runs//". + * In this mode, if a file already exists at that path, the call is + * refused (returns -1) rather than overwriting it. + * - This function never returns a legacy "evidence/" path + * (i.e. never a path that collides with a previously committed, + * reviewed evidence file). + * + * `run_id` is computed once per process as UTC yyyymmddThhmmssZ + "-" + + * the short HEAD sha, and is stable for the lifetime of the process. + * + * Returns 0 on success (out/n filled with a NUL-terminated path), -1 on + * failure or refusal. + */ +int omega_evidence_path(const char *relpath, char *out, size_t n); + +/* The run_id used by omega_evidence_path(), computed lazily on first use. */ +const char *omega_evidence_run_id(void); + +/* ---- (c) commit identity ------------------------------------------------ */ + +/* HEAD sha of the working tree the current process is running from. */ +bool omega_evidence_run_commit(char out[41]); + +/* True if `git status --porcelain -- src spec tools Makefile` is non-empty. */ +bool omega_evidence_tree_dirty(void); + +/* Reads physics.lock at the repo root; trims whitespace/newline. Returns + * false if the file cannot be read. */ +bool omega_evidence_physics_commit(char *out, size_t n); + +/* ---- (d) observed hardware identity ------------------------------------- */ + +typedef struct { + unsigned compute_class; /* raw Nvrm.compute_class */ + unsigned rm_sm_version; /* raw Nvrm.sm_version */ + char gpu_uuid_hex[33]; /* Nvrm.gpu_uuid[16], hex-encoded */ + const char *alias; /* human alias only, e.g. "sm_121" -- never the bound identity */ +} OmegaEvidenceHardware; + +void omega_evidence_hardware_from_nvrm(const Nvrm *rm, OmegaEvidenceHardware *out); + +/* ---- (b) per-suite gate counters & callable suite entry points --------- */ + +/* M4..M15 used to be inlined directly in tools/omegatool.c's main(). They + * are now callable functions so a regression gate can invoke them and read + * back how many gates each suite actually ran/passed. All twelve share one + * counter pair internally (matching the previous inlined behavior); read + * the snapshot immediately after each call, before invoking the next. */ +int omega_run_m4_gates(void); +int omega_run_m5_gates(void); +int omega_run_m6_gates(void); +int omega_run_m7_gates(void); +int omega_run_m8_gates(void); +int omega_run_m9_gates(void); +int omega_run_m10_gates(void); +int omega_run_m11_gates(void); +int omega_run_m12_gates(void); +int omega_run_m13_gates(void); +int omega_run_m14_gates(void); +int omega_run_m15_gates(void); +void omega_get_gate_snapshot(int *count, int *passed); + +/* M17/M18/M19 already track their own static counters; these expose them. */ +void omega_get_m17_gate_snapshot(int *count, int *passed); +void omega_get_m18_gate_snapshot(int *count, int *passed); +void omega_get_m19_gate_snapshot(int *count, int *passed); + +#endif /* OMEGA_EVIDENCE_H */ diff --git a/src/omega_world_gates.c b/src/omega_world_gates.c index 5a18ee8a7..d761e96f5 100644 --- a/src/omega_world_gates.c +++ b/src/omega_world_gates.c @@ -9,6 +9,7 @@ #include "omega_blackwell_submit.h" #include "omega_vector.h" #include "sha256.h" +#include "omega_evidence.h" #include #include #include @@ -24,6 +25,14 @@ static long m19_sustained_rss_delta = -1; static uint8_t m19_sustained_digest[32]; static char m19_candidate_commit[41] = {0}; +/* Measured (not asserted) fault-recovery observations from gate 12; each + * stays false until the gate that measures it actually runs and observes + * the condition. */ +static bool m19_fault_channel_scoped_handled = false; +static bool m19_fault_channel_generation_advanced = false; +static bool m19_fault_vas_preserved = false; +static bool m19_fault_zero_device_reset = false; + /* Resolve the full 40-hex revision of a working tree via git. */ static bool m19_git_head(const char *repo_dir, char out[41]) { char cmd[512]; @@ -73,6 +82,11 @@ static bool compute_file_sha256(const char *path, uint8_t digest[32], char hex[6 return true; } +void omega_get_m19_gate_snapshot(int *count, int *passed) { + if (count) *count = m19_gate_count; + if (passed) *passed = m19_gate_passed; +} + static void report_m19_gate(const char *gate_name, bool pass, const char *detail) { m19_gate_count++; if (pass) { @@ -1546,6 +1560,13 @@ static bool test_m19_gate12_fault_recovery(void) { return false; } + /* Every condition below was already checked above; record what was + * actually observed for the receipt instead of asserting it there. */ + m19_fault_channel_scoped_handled = true; + m19_fault_channel_generation_advanced = (world.channel_generation == orig_gen + 1); + m19_fault_vas_preserved = (world.m16.rm.root == root && world.m16.rm.device == device && world.m16.rm.vaspace == vaspace); + m19_fault_zero_device_reset = true; /* no device-reset path was invoked on this route */ + omega_world_destroy(&world); return true; } @@ -1644,12 +1665,29 @@ static bool test_m19_gate16_clean_clone(void) { char checkout[512]; int cl = snprintf(checkout, sizeof(checkout), "%s/checkout", clone); if (cl < 0 || (size_t)cl >= sizeof(checkout)) return false; - char command[2048]; + + /* Resolve the PHYSICS_DIR this process was built/run with, as an + * absolute path, so the nested build (running from a different cwd) + * finds the same pinned physics checkout instead of silently falling + * back to the Makefile's default. */ + char physics_dir_resolved[4096]; + { + const char *pd = getenv("PHYSICS_DIR"); +#ifdef OMEGA_PHYSICS_DIR + if (!pd || pd[0] == '\0') pd = OMEGA_PHYSICS_DIR; +#endif + if (!pd || pd[0] == '\0') pd = "../physics"; + if (!realpath(pd, physics_dir_resolved)) { + snprintf(physics_dir_resolved, sizeof(physics_dir_resolved), "%s", pd); + } + } + + char command[4608]; int len = snprintf(command, sizeof(command), "git clone --quiet --no-hardlinks . %s && cd %s && " - "make clean >/dev/null 2>&1 && make -j >/dev/null 2>&1 && " + "make clean >/dev/null 2>&1 && make -j PHYSICS_DIR=%s >/dev/null 2>&1 && " "OMEGA_IN_CLEAN_CLONE=1 ./build/omegatool --run-m19-gates >%s/qualification.log 2>&1", - checkout, checkout, clone); + checkout, checkout, physics_dir_resolved, clone); if (len < 0 || (size_t)len >= sizeof(command)) return false; if (system(command) != 0) return false; @@ -1662,9 +1700,38 @@ static bool test_m19_gate16_clean_clone(void) { return true; } -/* Gate 17: OMEGA_ACCEL_RESIDENT_REGRESSION_PASS */ +/* Gate 17: OMEGA_ACCEL_RESIDENT_REGRESSION_PASS + * + * Previously this only called run_m18_gates(), which itself only chains + * run_m17_gates() as ITS regression gate -- so a receipt claiming "157 + * prior gates passing" was only ever backed by 36 gates actually + * executing (18 M17 + 18 M18). Actually execute every prior suite (M4, + * M5..M15, M17, M18) and sum what really ran. */ +static int m19_regression_total = 0; +static int m19_regression_passed = 0; + static bool test_m19_gate17_regression(void) { - return (run_m18_gates() == 0); + int total = 0, passed = 0, c = 0, p = 0; + + (void)omega_run_m4_gates(); omega_get_gate_snapshot(&c, &p); total += c; passed += p; + (void)omega_run_m5_gates(); omega_get_gate_snapshot(&c, &p); total += c; passed += p; + (void)omega_run_m6_gates(); omega_get_gate_snapshot(&c, &p); total += c; passed += p; + (void)omega_run_m7_gates(); omega_get_gate_snapshot(&c, &p); total += c; passed += p; + (void)omega_run_m8_gates(); omega_get_gate_snapshot(&c, &p); total += c; passed += p; + (void)omega_run_m9_gates(); omega_get_gate_snapshot(&c, &p); total += c; passed += p; + (void)omega_run_m10_gates(); omega_get_gate_snapshot(&c, &p); total += c; passed += p; + (void)omega_run_m11_gates(); omega_get_gate_snapshot(&c, &p); total += c; passed += p; + (void)omega_run_m12_gates(); omega_get_gate_snapshot(&c, &p); total += c; passed += p; + (void)omega_run_m13_gates(); omega_get_gate_snapshot(&c, &p); total += c; passed += p; + (void)omega_run_m14_gates(); omega_get_gate_snapshot(&c, &p); total += c; passed += p; + (void)omega_run_m15_gates(); omega_get_gate_snapshot(&c, &p); total += c; passed += p; + (void)run_m17_gates(); omega_get_m17_gate_snapshot(&c, &p); total += c; passed += p; + (void)run_m18_gates(); omega_get_m18_gate_snapshot(&c, &p); total += c; passed += p; + + m19_regression_total = total; + m19_regression_passed = passed; + + return (passed == total); } /* Gate 18: OMEGA_ACCEL_RESIDENT_RECEIPT_PASS */ @@ -1689,7 +1756,10 @@ static bool test_m19_gate18_receipt(void) { }; size_t num_files = sizeof(manifest_files) / sizeof(manifest_files[0]); - FILE *mf = fopen("evidence/m19_corpus_digests.txt", "w"); + char digests_path[1024]; + if (omega_evidence_path("m19_corpus_digests.txt", digests_path, sizeof(digests_path)) != 0) return false; + + FILE *mf = fopen(digests_path, "w"); if (!mf) return false; for (size_t i = 0; i < num_files; i++) { @@ -1705,7 +1775,7 @@ static bool test_m19_gate18_receipt(void) { uint8_t manifest_digest[32]; char manifest_hex[65] = {0}; - if (!compute_file_sha256("evidence/m19_corpus_digests.txt", manifest_digest, manifest_hex)) return false; + if (!compute_file_sha256(digests_path, manifest_digest, manifest_hex)) return false; uint8_t bin_digest[32]; char bin_hex[65] = {0}; @@ -1716,7 +1786,29 @@ static bool test_m19_gate18_receipt(void) { sprintf(&rolling_digest_hex[i * 2], "%02x", m19_sustained_digest[i]); } - FILE *f = fopen("evidence/omega_accelerator_world_qualification_receipt.json", "w"); + /* Commit / physics identity: observed, not asserted. */ + char run_commit[41] = "UNKNOWN"; + if (!omega_evidence_run_commit(run_commit)) strcpy(run_commit, "UNKNOWN"); + bool tree_dirty = omega_evidence_tree_dirty(); + + char physics_commit[65] = "UNKNOWN"; + if (!omega_evidence_physics_commit(physics_commit, sizeof(physics_commit))) strcpy(physics_commit, "UNKNOWN"); + + /* Observed hardware identity (live Nvrm fields, not a hard-coded sm_121). */ + OmegaEvidenceHardware hw; + memset(&hw, 0, sizeof(hw)); + hw.alias = "sm_121"; + { + OmegaAcceleratorWorld hw_world; + if (omega_world_init(&hw_world) == OMEGA_WORLD_OK) { + omega_evidence_hardware_from_nvrm(&hw_world.m16.rm, &hw); + omega_world_destroy(&hw_world); + } + } + + char receipt_path[1024]; + if (omega_evidence_path("omega_accelerator_world_qualification_receipt.json", receipt_path, sizeof(receipt_path)) != 0) return false; + FILE *f = fopen(receipt_path, "w"); if (!f) return false; time_t now = time(NULL); @@ -1731,7 +1823,22 @@ static bool test_m19_gate18_receipt(void) { fprintf(f, " \"target_hardware\": \"NVIDIA DGX Spark (Grace Blackwell GB10, sm_121, 128 GiB unified LPDDR5x RAM)\",\n"); fprintf(f, " \"substrate\": \"M16 Native Libcuda-Free Channel\",\n"); fprintf(f, " \"status\": \"SILICON_QUALIFIED\",\n"); - fprintf(f, " \"candidate_git_commit\": \"%s\",\n", m19_candidate_commit); + fprintf(f, " \"run_commit\": \"%s\",\n", run_commit); + fprintf(f, " \"tree_dirty\": %s,\n", tree_dirty ? "true" : "false"); + fprintf(f, " \"physics_commit\": \"%s\",\n", physics_commit); + { + const char *qual_record = getenv("OMEGA_QUAL_RECORD"); + bool recording = (qual_record != NULL && strcmp(qual_record, "1") == 0); + if (recording && !tree_dirty) { + fprintf(f, " \"candidate_git_commit\": \"%s\",\n", run_commit); + } + } + fprintf(f, " \"hardware\": {\n"); + fprintf(f, " \"compute_class\": \"0x%x\",\n", hw.compute_class); + fprintf(f, " \"rm_sm_version\": \"0x%x\",\n", hw.rm_sm_version); + fprintf(f, " \"gpu_uuid\": \"%s\",\n", hw.gpu_uuid_hex); + fprintf(f, " \"alias\": \"%s\"\n", hw.alias); + fprintf(f, " },\n"); fprintf(f, " \"binary_sha256\": \"%s\",\n", bin_hex); fprintf(f, " \"manifest_sha256\": \"%s\",\n", manifest_hex); fprintf(f, " \"rolling_state_digest\": \"%s\",\n", rolling_digest_hex); @@ -1747,31 +1854,32 @@ static bool test_m19_gate18_receipt(void) { fprintf(f, " \"registry_address_authority\": true\n"); fprintf(f, " },\n"); fprintf(f, " \"queue_topology\": {\n"); - fprintf(f, " \"discovered_ring_capacity\": %u,\n", m19_ring_capacity ? m19_ring_capacity : 1024); - fprintf(f, " \"stress_multi_wrap_dispatches\": %u,\n", m19_wrap_dispatches ? m19_wrap_dispatches : 3072); - fprintf(f, " \"ring_wrap_factor\": 3.0,\n"); + fprintf(f, " \"discovered_ring_capacity\": %u,\n", m19_ring_capacity); + fprintf(f, " \"stress_multi_wrap_dispatches\": %u,\n", m19_wrap_dispatches); + fprintf(f, " \"ring_wrap_factor\": %.6f,\n", m19_ring_capacity ? ((double)m19_wrap_dispatches / (double)m19_ring_capacity) : 0.0); fprintf(f, " \"gpfifo_flow_control_verified\": true,\n"); fprintf(f, " \"monotonic_sequence_numbers\": true\n"); fprintf(f, " },\n"); fprintf(f, " \"sustained_workload\": {\n"); - fprintf(f, " \"sustained_dispatches\": %u,\n", m19_sustained_dispatches ? m19_sustained_dispatches : 1000); - fprintf(f, " \"cycles\": 250,\n"); + fprintf(f, " \"sustained_dispatches\": %u,\n", m19_sustained_dispatches); + fprintf(f, " \"cycles\": %u,\n", m19_sustained_dispatches / 4); fprintf(f, " \"classes\": [\"VecAdd\", \"INT32_MatMul\", \"FP16_Tensor_MMA\", \"BF16_Tensor_MMA\"],\n"); fprintf(f, " \"oracle_parity_verified\": true,\n"); fprintf(f, " \"parity_error_count\": 0\n"); fprintf(f, " },\n"); fprintf(f, " \"fault_recovery\": {\n"); - fprintf(f, " \"channel_scoped_fault_handled\": true,\n"); - fprintf(f, " \"channel_generation_advanced\": true,\n"); - fprintf(f, " \"persistent_vas_preserved\": true,\n"); - fprintf(f, " \"zero_device_reset\": true\n"); + fprintf(f, " \"channel_scoped_fault_handled\": %s,\n", m19_fault_channel_scoped_handled ? "true" : "false"); + fprintf(f, " \"channel_generation_advanced\": %s,\n", m19_fault_channel_generation_advanced ? "true" : "false"); + fprintf(f, " \"persistent_vas_preserved\": %s,\n", m19_fault_vas_preserved ? "true" : "false"); + fprintf(f, " \"zero_device_reset\": %s\n", m19_fault_zero_device_reset ? "true" : "false"); fprintf(f, " },\n"); fprintf(f, " \"zero_libcuda_linkage\": true,\n"); fprintf(f, " \"zero_cuda_symbols\": true,\n"); fprintf(f, " \"zero_libcuda_runtime\": true,\n"); - fprintf(f, " \"m19_gates_passed\": 18,\n"); - fprintf(f, " \"cumulative_regression_passed\": 157,\n"); - fprintf(f, " \"total_gates_evaluated\": 175,\n"); + fprintf(f, " \"m19_gates_passed\": %d,\n", m19_gate_passed); + fprintf(f, " \"cumulative_regression_passed\": %d,\n", m19_regression_passed); + fprintf(f, " \"total_gates_evaluated\": %d,\n", m19_gate_count + m19_regression_total); + fprintf(f, " \"tests_executed\": [\"M4\", \"M5\", \"M6\", \"M7\", \"M8\", \"M9\", \"M10\", \"M11\", \"M12\", \"M13\", \"M14\", \"M15\", \"M17\", \"M18\", \"M19\"],\n"); fprintf(f, " \"canonical_gates\": [\n"); fprintf(f, " \"OMEGA_ACCEL_RESIDENT_WORLD_CREATE_PASS\",\n"); fprintf(f, " \"OMEGA_ACCEL_RESIDENT_CONTEXT_REUSE_PASS\",\n"); @@ -1821,12 +1929,17 @@ int run_m19_gates(void) { report_m19_gate("OMEGA_ACCEL_RESIDENT_STATE_DIGEST_PASS", test_m19_gate14_state_digest(), "Deterministic rolling SHA-256 state digest verifying execution integrity"); report_m19_gate("OMEGA_ACCEL_RESIDENT_ZERO_LIBCUDA_PASS", test_m19_gate15_zero_libcuda(), "Zero foreign userspace runtime verification (linkage, symbols, maps)"); report_m19_gate("OMEGA_ACCEL_RESIDENT_CLEAN_CLONE_PASS", test_m19_gate16_clean_clone(), "Clean-clone isolated reproduction on DGX Spark silicon from scratch"); - report_m19_gate("OMEGA_ACCEL_RESIDENT_REGRESSION_PASS", test_m19_gate17_regression(), "Cumulative regression parity: 157 / 157 prior milestone gates passing"); + { + bool regression_ok = test_m19_gate17_regression(); + char detail[96]; + snprintf(detail, sizeof(detail), "Cumulative regression parity: %d / %d prior milestone gates passing", m19_regression_passed, m19_regression_total); + report_m19_gate("OMEGA_ACCEL_RESIDENT_REGRESSION_PASS", regression_ok, detail); + } report_m19_gate("OMEGA_ACCEL_RESIDENT_RECEIPT_PASS", test_m19_gate18_receipt(), "Milestone 19 qualification receipt & cryptographic manifest generation"); printf("================================================================================\n"); printf(" STAGE 1 / PERSISTENT WORLD QUALIFICATION: %d / %d M19 GATES PASSED\n", m19_gate_passed, m19_gate_count); - printf(" TOTAL GATES EVALUATED: %d (18 M19 Gates + 157 Prior Regression Gates)\n", m19_gate_passed + 157); + printf(" TOTAL GATES EVALUATED: %d (%d M19 Gates + %d Prior Regression Gates)\n", m19_gate_passed + m19_regression_total, m19_gate_count, m19_regression_total); printf("================================================================================\n"); return (m19_gate_passed == m19_gate_count) ? 0 : 1; diff --git a/tools/omegatool.c b/tools/omegatool.c index 18acbc5a6..0e6643667 100644 --- a/tools/omegatool.c +++ b/tools/omegatool.c @@ -22,6 +22,7 @@ #include "omega_blackwell_gates.h" #include "omega_world_gates.h" #include "omega_blackwell_codegen.h" +#include "omega_evidence.h" #include #include #include @@ -30,6 +31,11 @@ static int gate_count = 0; static int gate_passed = 0; +void omega_get_gate_snapshot(int *count, int *passed) { + if (count) *count = gate_count; + if (passed) *passed = gate_passed; +} + static void report_gate(const char *gate_name, bool pass, const char *detail) { gate_count++; if (pass) { @@ -3481,6 +3487,259 @@ static void run_demonstration_accelerator(void) { printf("================================================================================\n"); } +int omega_run_m4_gates(void) { + printf("================================================================================\n"); + printf(" AIEN OMEGA SUBSTRATE — MILESTONE 4: OMEGA_SEMANTICS QUALIFICATION GATES\n"); + printf("================================================================================\n"); + gate_count = 0; gate_passed = 0; + report_gate("OMEGA_OBJECT_MODEL_PASS", test_object_model(), "11 first-class categories instantiated and typed"); + report_gate("OMEGA_TYPE_SYSTEM_PASS", test_type_system(), "Bounded widths enforced, invalid widths refused"); + report_gate("OMEGA_GRAPH_VALIDATION_PASS", test_graph_validation(), "DAG validation and dangling reference refusal"); + report_gate("OMEGA_CANONICAL_ENCODING_PASS", test_canonical_encoding(), "OMG0 wire header and lexicographical attribute sorting"); + report_gate("OMEGA_SEMANTIC_ID_DETERMINISM_PASS", test_semantic_id_determinism(), "Cross-allocation bit-for-bit SHA-256 identity"); + report_gate("OMEGA_REPRESENTATION_INDEPENDENCE_PASS", test_representation_independence(NULL), "4 independent representations collapse to identical ID"); + report_gate("OMEGA_SEMANTIC_DIFFERENCE_PASS", test_semantic_difference(), "ADD -> SUB produces distinct SEMANTIC_ID"); + report_gate("OMEGA_RELATION_PASS", test_relation_canonicalization(), "Relation ordering independence confirmed"); + report_gate("OMEGA_CONSTRAINT_PASS", test_constraint_canonicalization(), "Constraint ordering independence confirmed"); + report_gate("OMEGA_PURE_EFFECT_SEPARATION_PASS", test_pure_effect_separation(), "Pure computation decoupled from physical effect tokens"); + report_gate("OMEGA_MALFORMED_OBJECT_REFUSAL_PASS", test_malformed_refusal(), "Structural cycles and corrupt wire packets rejected"); + report_gate("OMEGA_CROSS_BUILD_DETERMINISM_PASS", test_cross_build_determinism(), "Known-answer test evaluation matches specification"); + printf("================================================================================\n"); + printf(" TOTAL GATES: %d | PASSED: %d | FAILED: %d\n", gate_count, gate_passed, gate_count - gate_passed); + printf("================================================================================\n"); + return (gate_passed == gate_count) ? 0 : 1; +} + +int omega_run_m5_gates(void) { + printf("================================================================================\n"); + printf(" AIEN OMEGA SUBSTRATE — MILESTONE 5: OMEGA_AARCH64 QUALIFICATION GATES\n"); + printf("================================================================================\n"); + gate_count = 0; gate_passed = 0; + report_gate("OMEGA_AARCH64_PROFILE_PASS", test_m5_profile(), "AArch64 bare-metal target profile and registers valid"); + report_gate("OMEGA_AARCH64_ENCODER_PASS", test_m5_encoder(), "Direct instruction encoder synthesized expected machine words"); + report_gate("OMEGA_AARCH64_DECODER_SEAM_PASS", test_m5_decoder_seam(), "Independent decoder Seam 1 validated instructions and refused corrupt opcode"); + report_gate("OMEGA_AARCH64_LOWERING_PASS", test_m5_lowering(), "G_S pure operations lowered to AArch64 code buffer"); + report_gate("OMEGA_AARCH64_REALIZATION_ID_PASS", test_m5_realization_id(), "REALIZATION_ID deterministically binds machine code to SEMANTIC_ID"); + report_gate("OMEGA_AARCH64_NATIVE_EXECUTION_PASS", test_m5_native_execution(), "Native in-memory execution observed result 15 matches semantic evaluation"); + report_gate("OMEGA_AARCH64_QEMU_EXECUTION_PASS", test_m5_qemu_execution(), "Bare-metal QEMU execution observed result 15 on PL011 UART"); + report_gate("OMEGA_AARCH64_ADVERSARIAL_MUTATION_PASS", test_m5_adversarial_mutation(), "Single-bit machine code mutation detected and refused fail-closed"); + report_gate("OMEGA_AARCH64_CROSS_BUILD_DETERMINISM_PASS", test_m5_cross_build_determinism(), "Byte-for-byte deterministic realization across runs"); + printf("================================================================================\n"); + printf(" TOTAL GATES: %d | PASSED: %d | FAILED: %d\n", gate_count, gate_passed, gate_count - gate_passed); + printf("================================================================================\n"); + return (gate_passed == gate_count) ? 0 : 1; +} + +int omega_run_m6_gates(void) { + printf("================================================================================\n"); + printf(" AIEN OMEGA SUBSTRATE — MILESTONE 6: OMEGA_SELF_HOST QUALIFICATION GATES\n"); + printf("================================================================================\n"); + gate_count = 0; gate_passed = 0; + report_gate("OMEGA_SELF_HOST_GRAPH_PASS", test_m6_graph(), "Semantic compiler graph G_C constructed and validated"); + report_gate("OMEGA_SELF_HOST_C1_EMISSION_PASS", test_m6_c1_emission(), "Reference lowering C0(G_C) -> C1 emitted machine bytes"); + report_gate("OMEGA_SELF_HOST_DECODER_SEAM_PASS", test_m6_decoder_seam(), "Independent decoder verified all C1 instructions"); + report_gate("OMEGA_SELF_HOST_C2_REPRODUCTION_PASS", test_m6_c2_reproduction(), "Native compiler C1(G_C) -> C2 emitted machine bytes"); + report_gate("OMEGA_SELF_HOST_C3_REPRODUCTION_PASS", test_m6_c3_reproduction(), "Native compiler C2(G_C) -> C3 emitted machine bytes"); + report_gate("OMEGA_SELF_HOST_FIXED_POINT_PASS", test_m6_fixed_point(), "Exact bit-for-bit identity C1 == C2 == C3 verified"); + report_gate("OMEGA_SELF_HOST_REALIZATION_ID_PASS", test_m6_realization_id(), "REALIZATION_ID matching across C1, C2, and C3"); + report_gate("OMEGA_SELF_HOST_M5_PARITY_PASS", test_m6_m5_parity(), "Reproduced compiler reproduces exact M5 machine code bytes"); + report_gate("OMEGA_SELF_HOST_NATIVE_EXECUTION_PASS", test_m6_native_execution(), "Reproduced compiler output executes natively to 15"); + report_gate("OMEGA_SELF_HOST_ADVERSARIAL_MUTATION_PASS", test_m6_adversarial_mutation(), "Single-bit mutations in G_C wire or C1 refused fail-closed"); + printf("================================================================================\n"); + printf(" TOTAL GATES: %d | PASSED: %d | FAILED: %d\n", gate_count, gate_passed, gate_count - gate_passed); + printf("================================================================================\n"); + return (gate_passed == gate_count) ? 0 : 1; +} + +int omega_run_m7_gates(void) { + printf("================================================================================\n"); + printf(" AIEN OMEGA SUBSTRATE — MILESTONE 7: OMEGA_VERIFY QUALIFICATION GATES\n"); + printf("================================================================================\n"); + gate_count = 0; gate_passed = 0; + report_gate("OMEGA_VERIFY_V0_TYPE_PASS", test_m7_v0_type(), "V0 accepted well-typed graph and rejected ill-typed graph"); + report_gate("OMEGA_VERIFY_V0_DAG_PASS", test_m7_v0_dag(), "V0 rejected graph with dangling reference"); + report_gate("OMEGA_VERIFY_V0_CODE_BOUNDS_PASS", test_m7_v0_code_bounds(), "V0 enforced 4-byte alignment and buffer length bounds"); + report_gate("OMEGA_VERIFY_V0_INSN_DECODE_PASS", test_m7_v0_insn_decode(), "V0 validated instruction opcodes and refused illegal instruction"); + report_gate("OMEGA_VERIFY_V0_TERMINAL_RET_PASS", test_m7_v0_terminal_ret(), "V0 rejected non-terminating / non-RET execution buffer"); + report_gate("OMEGA_VERIFY_V1_DIFFERENTIAL_PASS", test_m7_v1_differential(), "V1 confirmed exact bit-for-bit parity across test corpus"); + report_gate("OMEGA_VERIFY_V1_DIVERGENCE_REFUSAL_PASS", test_m7_v1_divergence_refusal(), "V1 detected and refused mutated realization divergence"); + report_gate("OMEGA_VERIFY_V2_COMMUTATIVITY_PASS", test_m7_v2_commutativity(), "V2 proved commutativity on declared commutative ops"); + report_gate("OMEGA_VERIFY_V2_IDENTITY_PASS", test_m7_v2_identity(), "V2 proved identity elements on ADD, MUL, AND, OR"); + report_gate("OMEGA_VERIFY_V2_OVERFLOW_PASS", test_m7_v2_overflow(), "V2 validated modular overflow wrapping semantics"); + printf("================================================================================\n"); + printf(" TOTAL GATES: %d | PASSED: %d | FAILED: %d\n", gate_count, gate_passed, gate_count - gate_passed); + printf("================================================================================\n"); + return (gate_passed == gate_count) ? 0 : 1; +} + +int omega_run_m8_gates(void) { + printf("================================================================================\n"); + printf(" AIEN OMEGA SUBSTRATE — MILESTONE 8: OMEGA_PROGRAM_CORE QUALIFICATION GATES\n"); + printf("================================================================================\n"); + gate_count = 0; gate_passed = 0; + report_gate("OMEGA_PROGRAM_OBJECT_PASS", test_m8_program_object(), "OMEGA_PROGRAM created with contracts, cost, and realization"); + report_gate("OMEGA_PROGRAM_CONTRACT_VALIDATION_PASS", test_m8_contract_validation(), "Contract validation enforced, invalid types rejected"); + report_gate("OMEGA_PROGRAM_COMPOSITION_PASS", test_m8_composition(), "Algebraic composition C = A o B with contract propagation"); + report_gate("OMEGA_PROGRAM_TYPE_MISMATCH_REFUSAL_PASS", test_m8_type_mismatch_refusal(), "Incompatible composition refused fail-closed"); + report_gate("OMEGA_PROGRAM_COST_ACCOUNTING_PASS", test_m8_cost_accounting(), "Composite cost monotonically verified (insns, latency)"); + report_gate("OMEGA_PROGRAM_REALIZATION_PASS", test_m8_realization(), "Composite program lowered to native AArch64 machine bytes"); + report_gate("OMEGA_PROGRAM_V0_STRUCTURAL_PASS", test_m8_v0_structural(), "Composite program passes M7 V0 structural verification"); + report_gate("OMEGA_PROGRAM_V1_DIFFERENTIAL_PASS", test_m8_v1_differential(), "Composite program passes M7 V1 differential evaluation (2x+1)"); + report_gate("OMEGA_PROGRAM_V2_PROPERTY_PASS", test_m8_v2_property(), "Composite program passes M7 V2 property verification"); + report_gate("OMEGA_PROGRAM_SYNTHESIS_TASK_PASS", test_m8_synthesis_task(), "SYNTHESIS_TASK evaluation harness ready for M9 search"); + printf("================================================================================\n"); + printf(" TOTAL GATES: %d | PASSED: %d | FAILED: %d\n", gate_count, gate_passed, gate_count - gate_passed); + printf("================================================================================\n"); + return (gate_passed == gate_count) ? 0 : 1; +} + +int omega_run_m9_gates(void) { + printf("================================================================================\n"); + printf(" AIEN OMEGA SUBSTRATE — MILESTONE 9: OMEGA_SYNTHESIS_V0 QUALIFICATION GATES\n"); + printf("================================================================================\n"); + gate_count = 0; gate_passed = 0; + report_gate("OMEGA_SYNTHESIS_PRIMITIVES_PASS", test_m9_primitives(), "Base primitive program bank constructed and verified"); + report_gate("OMEGA_SYNTHESIS_SEARCH_ORDERING_PASS", test_m9_search_ordering(), "Deterministic search generates multi-level candidates"); + report_gate("OMEGA_SYNTHESIS_TYPE_PRUNING_PASS", test_m9_type_pruning(), "Incompatible typed candidates pruned fail-closed"); + report_gate("OMEGA_SYNTHESIS_EQUIV_PRUNING_PASS", test_m9_equiv_pruning(), "Observational equivalence table detects duplicate functions"); + report_gate("OMEGA_SYNTHESIS_V0_STRUCTURAL_PASS", test_m9_v0_structural(), "Synthesized candidate passes M7 V0 structural verification"); + report_gate("OMEGA_SYNTHESIS_V1_IO_FILTERING_PASS", test_m9_v1_io_filtering(), "Non-conforming candidate rejected by test suite filter"); + report_gate("OMEGA_SYNTHESIS_V2_PROPERTY_PASS", test_m9_v2_property(), "Synthesized candidate passes M7 V2 property verification"); + report_gate("OMEGA_SYNTHESIS_TARGET_AFFINE_PASS", test_m9_target_affine(), "Synthesized 2x + 1 passes holdout tests on native hardware"); + report_gate("OMEGA_SYNTHESIS_TARGET_COMPOSED_PASS", test_m9_target_composed(), "Synthesized 3x - 2 passes holdout tests on native hardware"); + report_gate("OMEGA_SYNTHESIS_RECEIPT_PASS", test_m9_receipt(), "Cryptographic identity binding Task, Program, and Realization"); + printf("================================================================================\n"); + printf(" TOTAL GATES: %d | PASSED: %d | FAILED: %d\n", gate_count, gate_passed, gate_count - gate_passed); + printf("================================================================================\n"); + return (gate_passed == gate_count) ? 0 : 1; +} + +int omega_run_m10_gates(void) { + printf("================================================================================\n"); + printf(" AIEN OMEGA SUBSTRATE — MILESTONE 10: OMEGA_LIBRARY_V1 QUALIFICATION GATES\n"); + printf("================================================================================\n"); + gate_count = 0; gate_passed = 0; + report_gate("OMEGA_LIBRARY_INIT_PASS", test_m10_init(), "Catalog initialization and capacity management"); + report_gate("OMEGA_LIBRARY_INSERT_PASS", test_m10_insert(), "Content-addressed program insertion and state digest update"); + report_gate("OMEGA_LIBRARY_INDEXING_PASS", test_m10_lookup_id(), "Retrieval by SEMANTIC_ID, REALIZATION_ID, and name"); + report_gate("OMEGA_LIBRARY_QUERY_PASS", test_m10_lookup_type(), "Semantic type query filtering (U64 -> U64)"); + report_gate("OMEGA_LIBRARY_DEP_DAG_PASS", test_m10_dependency_dag(), "Direct and transitive dependency DAG tracking"); + report_gate("OMEGA_LIBRARY_IMMUTABILITY_PASS", test_m10_immutability(), "Version advancement and cryptographic digest evolution"); + report_gate("OMEGA_LIBRARY_UNVERIFIED_REFUSAL_PASS", test_m10_unverified_refusal(), "Unverified program insertion rejected fail-closed"); + report_gate("OMEGA_LIBRARY_DUPLICATE_REFUSAL_PASS", test_m10_duplicate_refusal(), "Duplicate SEMANTIC_ID insertion rejected fail-closed"); + report_gate("OMEGA_LIBRARY_SYNTHESIS_REUSE_PASS", test_m10_synthesis_reuse(), "Synthesis engine discovering composite by reusing verified library component"); + report_gate("OMEGA_LIBRARY_RECEIPT_PASS", test_m10_receipt(), "Cryptographic state digest and provenance accounting"); + printf("================================================================================\n"); + printf(" TOTAL GATES: %d | PASSED: %d | FAILED: %d\n", gate_count, gate_passed, gate_count - gate_passed); + printf("================================================================================\n"); + return (gate_passed == gate_count) ? 0 : 1; +} + +int omega_run_m11_gates(void) { + printf("================================================================================\n"); + printf(" AIEN OMEGA SUBSTRATE — MILESTONE 11: OMEGA_LIBRARY_DISCOVERY QUALIFICATION GATES\n"); + printf("================================================================================\n"); + gate_count = 0; gate_passed = 0; + report_gate("OMEGA_DISCOVERY_CORPUS_MINING_PASS", test_m11_corpus_mining(), "Common sub-expression slices mined across corpus"); + report_gate("OMEGA_DISCOVERY_NONTRIVIAL_PASS", test_m11_nontrivial(), "Candidate abstraction is non-trivial and composite"); + report_gate("OMEGA_DISCOVERY_COMPRESSION_PASS", test_m11_compression(), "Positive description length reduction and instruction savings across corpus"); + report_gate("OMEGA_DISCOVERY_SEMANTIC_PRESERVATION_PASS", test_m11_semantic_preservation(), "Behavioral equivalence strictly preserved after program refactoring"); + report_gate("OMEGA_DISCOVERY_V0_STRUCTURAL_PASS", test_m11_v0_structural(), "M7 V0 structural verification passed on discovered abstraction"); + report_gate("OMEGA_DISCOVERY_V1_DIFFERENTIAL_PASS", test_m11_v1_differential(), "M7 V1 differential evaluation passed on native hardware"); + report_gate("OMEGA_DISCOVERY_V2_PROPERTY_PASS", test_m11_v2_property(), "M7 V2 property verification passed on discovered abstraction"); + report_gate("OMEGA_DISCOVERY_LIBRARY_ADMISSION_PASS", test_m11_library_admission(), "Discovered abstraction admitted into OmegaLibrary catalog"); + report_gate("OMEGA_DISCOVERY_SEARCH_ACCELERATION_PASS", test_m11_search_acceleration(), "Held-out synthesis task solved with reduced search candidates"); + report_gate("OMEGA_DISCOVERY_RECEIPT_PASS", test_m11_receipt(), "Full cryptographic evidence receipt accounting for discovery and acceleration"); + printf("================================================================================\n"); + printf(" TOTAL GATES: %d | PASSED: %d | FAILED: %d\n", gate_count, gate_passed, gate_count - gate_passed); + printf("================================================================================\n"); + return (gate_passed == gate_count) ? 0 : 1; +} + +int omega_run_m12_gates(void) { + printf("================================================================================\n"); + printf(" AIEN OMEGA SUBSTRATE — MILESTONE 12: OMEGA_LIVING_MATVEC QUALIFICATION GATES\n"); + printf("================================================================================\n"); + gate_count = 0; gate_passed = 0; + report_gate("OMEGA_MATVEC_SEMANTIC_SPEC_PASS", test_m12_semantic_spec(), "Pure mathematical MatVec specification instantiated with canonical SemanticId"); + report_gate("OMEGA_MATVEC_MULTI_REALIZATION_PASS", test_m12_multi_realization(), "Synthesis engine generates 3 distinct machine-code realizations"); + report_gate("OMEGA_MATVEC_TRIPLE_ID_PASS", test_m12_triple_id(), "Cryptographic triple identity binding SEMANTIC_ID, MACHINE_ID, and code bytes"); + report_gate("OMEGA_MATVEC_V0_STRUCTURAL_PASS", test_m12_v0_structural(), "M7 V0 structural verification passed on all realizations with mutation refusal"); + report_gate("OMEGA_MATVEC_V1_NUMERICAL_PARITY_PASS", test_m12_v1_numerical_parity(), "Exact bit-for-bit numerical parity against mathematical Oracle across dimensions"); + report_gate("OMEGA_MATVEC_REGIME_INFLECTION_PASS", test_m12_regime_inflection(), "Empirical benchmark measures execution latency across small and medium regimes"); + report_gate("OMEGA_MATVEC_ADAPTIVE_DISPATCH_PASS", test_m12_adaptive_dispatch(), "Living kernel dynamically adapts and dispatches optimal realization"); + report_gate("OMEGA_MATVEC_SPEEDUP_PASS", test_m12_speedup(), "Multi-accumulator unrolled schedule achieves measured hardware speedup"); + report_gate("OMEGA_MATVEC_ZERO_TOOLCHAIN_PASS", test_m12_zero_toolchain(), "All realizations emitted via direct AArch64 machine byte encoders without foreign toolchain"); + report_gate("OMEGA_MATVEC_RECEIPT_PASS", test_m12_receipt(), "Full qualification receipt generated and verified"); + printf("================================================================================\n"); + printf(" TOTAL GATES: %d | PASSED: %d | FAILED: %d\n", gate_count, gate_passed, gate_count - gate_passed); + printf("================================================================================\n"); + return (gate_passed == gate_count) ? 0 : 1; +} + +int omega_run_m13_gates(void) { + printf("================================================================================\n"); + printf(" AIEN OMEGA SUBSTRATE — MILESTONE 13: OMEGA_MACHINE_GRAPH QUALIFICATION GATES\n"); + printf("================================================================================\n"); + gate_count = 0; gate_passed = 0; + report_gate("OMEGA_MACHINE_INIT_PASS", test_m13_init(), "Machine graph initialized with profile and name"); + report_gate("OMEGA_MACHINE_PIPELINE_PASS", test_m13_pipeline(), "Execution pipeline, issue width, and compute units modeled"); + report_gate("OMEGA_MACHINE_REGISTER_FILE_PASS", test_m13_register_file(), "Register file capacities (GPR, Vector) validated"); + report_gate("OMEGA_MACHINE_MEMORY_HIERARCHY_PASS", test_m13_memory_hierarchy(), "Multi-tier cache hierarchy (L1I, L1D, L2, L3) and DRAM modeled"); + report_gate("OMEGA_MACHINE_PHYSICS_INGRESS_PASS", test_m13_physics_ingress(), "Physical machine descriptor ingested and bound to Physics seal"); + report_gate("OMEGA_MACHINE_CANONICAL_ID_PASS", test_m13_canonical_id(), "Deterministic MACHINE_ID bit-for-bit identity verified"); + report_gate("OMEGA_MACHINE_TOPOLOGY_DIFFERENCE_PASS", test_m13_topology_difference(), "Distinct machine topologies yield distinct MACHINE_IDs"); + report_gate("OMEGA_MACHINE_CYCLE_PREVENTION_PASS", test_m13_cycle_prevention(), "Topological cache ordering and line size validation enforced fail-closed"); + report_gate("OMEGA_MACHINE_COST_EVALUATION_PASS", test_m13_cost_evaluation(), "Latency estimation grounded in physical execution unit latencies"); + report_gate("OMEGA_MACHINE_RECEIPT_PASS", test_m13_receipt(), "Physical machine graph certified with Physics authority accounting"); + printf("================================================================================\n"); + printf(" TOTAL GATES: %d | PASSED: %d | FAILED: %d\n", gate_count, gate_passed, gate_count - gate_passed); + printf("================================================================================\n"); + return (gate_passed == gate_count) ? 0 : 1; +} + +int omega_run_m14_gates(void) { + printf("================================================================================\n"); + printf(" AIEN OMEGA SUBSTRATE — MILESTONE 14: OMEGA_REALIZATION_SYNTHESIS QUALIFICATION GATES\n"); + printf("================================================================================\n"); + gate_count = 0; gate_passed = 0; + report_gate("OMEGA_REAL_SYNTH_INIT_PASS", test_m14_init(), "Realization synthesis task initialization and configuration"); + report_gate("OMEGA_REAL_SYNTH_TRIPLE_ID_PASS", test_m14_triple_id(), "Cryptographic triple identity incorporates SEMANTIC_ID, MACHINE_ID, and code bytes"); + report_gate("OMEGA_REAL_SYNTH_SCHEDULE_OPT_PASS", test_m14_schedule_opt(), "Machine-aware instruction schedules differ between DGX Spark and QEMU virt"); + report_gate("OMEGA_REAL_SYNTH_DGX_SPARK_PASS", test_m14_dgx_spark(), "Synthesis specialized for DGX Spark Grace Neoverse V2 4-wide dispatch"); + report_gate("OMEGA_REAL_SYNTH_QEMU_VIRT_PASS", test_m14_qemu_virt(), "Synthesis specialized for QEMU virt generic AArch64 baseline"); + report_gate("OMEGA_REAL_SYNTH_SEMANTIC_PARITY_PASS", test_m14_semantic_parity(), "Native execution of synthesized realization matches semantic evaluation"); + report_gate("OMEGA_REAL_SYNTH_V0_STRUCTURAL_PASS", test_m14_v0_structural(), "M7 V0 structural verification passed on synthesized realization"); + report_gate("OMEGA_REAL_SYNTH_V1_DIFFERENTIAL_PASS", test_m14_v1_differential(), "M7 V1 differential evaluation passed across holdout test inputs"); + report_gate("OMEGA_REAL_SYNTH_V2_PROPERTY_PASS", test_m14_v2_property(), "M7 V2 property verification passed on synthesized realization"); + report_gate("OMEGA_REAL_SYNTH_RECEIPT_PASS", test_m14_receipt(), "Full qualification receipt generated and verified"); + printf("================================================================================\n"); + printf(" TOTAL GATES: %d | PASSED: %d | FAILED: %d\n", gate_count, gate_passed, gate_count - gate_passed); + printf("================================================================================\n"); + return (gate_passed == gate_count) ? 0 : 1; +} + +int omega_run_m15_gates(void) { + printf("================================================================================\n"); + printf(" AIEN OMEGA SUBSTRATE — MILESTONE 15: PHYSICS_ACCELERATOR_LINK GATES\n"); + printf("================================================================================\n"); + gate_count = 0; gate_passed = 0; + report_gate("PHYSICS_ACCEL_MEM_BOUNDS_PASS", test_m15_mem_bounds(), "Coherent DRAM boundaries and kernel isolation"); + report_gate("PHYSICS_ACCEL_SMMU_TRANSLATION_PASS", test_m15_smmu_translation(), "SMMUv3 Stage 1 IOVA-to-PA translation mapping"); + report_gate("PHYSICS_ACCEL_DMA_SANDBOX_PASS", test_m15_dma_sandbox(), "Unmapped and permission violation DMA sandboxing"); + report_gate("PHYSICS_ACCEL_QUEUE_AUTHORITY_PASS", test_m15_queue_authority(), "Bounded queue authority and doorbell mediation"); + report_gate("PHYSICS_ACCEL_DEVICE_LIFECYCLE_PASS", test_m15_device_lifecycle(), "Deterministic monotonic device lifecycle transitions"); + report_gate("PHYSICS_ACCEL_RESET_RECOVERY_PASS", test_m15_reset_recovery(), "Fault isolation and non-disruptive device reset"); + report_gate("PHYSICS_ACCEL_RECEIPT_CHAIN_PASS", test_m15_receipt_chain(), "Immutable 192B receipt with rolling SHA-256 seal chain"); + report_gate("PHYSICS_ACCEL_OMEGA_INGRESS_PASS", test_m15_omega_ingress(), "Omega mediated intent ingress and capability gating"); + report_gate("PHYSICS_ACCEL_ZERO_TOOLCHAIN_PASS", test_m15_zero_toolchain(), "Zero foreign toolchain (0 LLVM, 0 Python, 0 inline asm)"); + report_gate("PHYSICS_ACCEL_RECEIPT_PASS", test_m15_receipt(), "Qualification receipt generation and audit verification"); + printf("================================================================================\n"); + printf(" TOTAL GATES: %d | PASSED: %d | FAILED: %d\n", gate_count, gate_passed, gate_count - gate_passed); + printf("================================================================================\n"); + return (gate_passed == gate_count) ? 0 : 1; +} + int main(int argc, char **argv) { if (argc < 2) { printf("Usage: %s [--run-gates | --run-m5-gates | --run-m6-gates | --run-m7-gates | --run-m8-gates | --run-m9-gates | --run-m10-gates | --run-m11-gates | --run-m12-gates | --run-m13-gates | --run-m14-gates | --demonstrate-arithmetic | --demonstrate-physics | --demonstrate-realization | --demonstrate-self-host | --demonstrate-verify | --demonstrate-program | --demonstrate-synthesis | --demonstrate-library | --demonstrate-discovery | --demonstrate-living-matvec | --demonstrate-machine | --demonstrate-realization-synthesis | --dump-test-vectors ]\n", argv[0]); @@ -3488,67 +3747,15 @@ int main(int argc, char **argv) { } if (strcmp(argv[1], "--run-gates") == 0) { - printf("================================================================================\n"); - printf(" AIEN OMEGA SUBSTRATE — MILESTONE 4: OMEGA_SEMANTICS QUALIFICATION GATES\n"); - printf("================================================================================\n"); - gate_count = 0; gate_passed = 0; - report_gate("OMEGA_OBJECT_MODEL_PASS", test_object_model(), "11 first-class categories instantiated and typed"); - report_gate("OMEGA_TYPE_SYSTEM_PASS", test_type_system(), "Bounded widths enforced, invalid widths refused"); - report_gate("OMEGA_GRAPH_VALIDATION_PASS", test_graph_validation(), "DAG validation and dangling reference refusal"); - report_gate("OMEGA_CANONICAL_ENCODING_PASS", test_canonical_encoding(), "OMG0 wire header and lexicographical attribute sorting"); - report_gate("OMEGA_SEMANTIC_ID_DETERMINISM_PASS", test_semantic_id_determinism(), "Cross-allocation bit-for-bit SHA-256 identity"); - report_gate("OMEGA_REPRESENTATION_INDEPENDENCE_PASS", test_representation_independence(NULL), "4 independent representations collapse to identical ID"); - report_gate("OMEGA_SEMANTIC_DIFFERENCE_PASS", test_semantic_difference(), "ADD -> SUB produces distinct SEMANTIC_ID"); - report_gate("OMEGA_RELATION_PASS", test_relation_canonicalization(), "Relation ordering independence confirmed"); - report_gate("OMEGA_CONSTRAINT_PASS", test_constraint_canonicalization(), "Constraint ordering independence confirmed"); - report_gate("OMEGA_PURE_EFFECT_SEPARATION_PASS", test_pure_effect_separation(), "Pure computation decoupled from physical effect tokens"); - report_gate("OMEGA_MALFORMED_OBJECT_REFUSAL_PASS", test_malformed_refusal(), "Structural cycles and corrupt wire packets rejected"); - report_gate("OMEGA_CROSS_BUILD_DETERMINISM_PASS", test_cross_build_determinism(), "Known-answer test evaluation matches specification"); - printf("================================================================================\n"); - printf(" TOTAL GATES: %d | PASSED: %d | FAILED: %d\n", gate_count, gate_passed, gate_count - gate_passed); - printf("================================================================================\n"); - return (gate_passed == gate_count) ? 0 : 1; + return omega_run_m4_gates(); } if (strcmp(argv[1], "--run-m5-gates") == 0) { - printf("================================================================================\n"); - printf(" AIEN OMEGA SUBSTRATE — MILESTONE 5: OMEGA_AARCH64 QUALIFICATION GATES\n"); - printf("================================================================================\n"); - gate_count = 0; gate_passed = 0; - report_gate("OMEGA_AARCH64_PROFILE_PASS", test_m5_profile(), "AArch64 bare-metal target profile and registers valid"); - report_gate("OMEGA_AARCH64_ENCODER_PASS", test_m5_encoder(), "Direct instruction encoder synthesized expected machine words"); - report_gate("OMEGA_AARCH64_DECODER_SEAM_PASS", test_m5_decoder_seam(), "Independent decoder Seam 1 validated instructions and refused corrupt opcode"); - report_gate("OMEGA_AARCH64_LOWERING_PASS", test_m5_lowering(), "G_S pure operations lowered to AArch64 code buffer"); - report_gate("OMEGA_AARCH64_REALIZATION_ID_PASS", test_m5_realization_id(), "REALIZATION_ID deterministically binds machine code to SEMANTIC_ID"); - report_gate("OMEGA_AARCH64_NATIVE_EXECUTION_PASS", test_m5_native_execution(), "Native in-memory execution observed result 15 matches semantic evaluation"); - report_gate("OMEGA_AARCH64_QEMU_EXECUTION_PASS", test_m5_qemu_execution(), "Bare-metal QEMU execution observed result 15 on PL011 UART"); - report_gate("OMEGA_AARCH64_ADVERSARIAL_MUTATION_PASS", test_m5_adversarial_mutation(), "Single-bit machine code mutation detected and refused fail-closed"); - report_gate("OMEGA_AARCH64_CROSS_BUILD_DETERMINISM_PASS", test_m5_cross_build_determinism(), "Byte-for-byte deterministic realization across runs"); - printf("================================================================================\n"); - printf(" TOTAL GATES: %d | PASSED: %d | FAILED: %d\n", gate_count, gate_passed, gate_count - gate_passed); - printf("================================================================================\n"); - return (gate_passed == gate_count) ? 0 : 1; + return omega_run_m5_gates(); } if (strcmp(argv[1], "--run-m6-gates") == 0) { - printf("================================================================================\n"); - printf(" AIEN OMEGA SUBSTRATE — MILESTONE 6: OMEGA_SELF_HOST QUALIFICATION GATES\n"); - printf("================================================================================\n"); - gate_count = 0; gate_passed = 0; - report_gate("OMEGA_SELF_HOST_GRAPH_PASS", test_m6_graph(), "Semantic compiler graph G_C constructed and validated"); - report_gate("OMEGA_SELF_HOST_C1_EMISSION_PASS", test_m6_c1_emission(), "Reference lowering C0(G_C) -> C1 emitted machine bytes"); - report_gate("OMEGA_SELF_HOST_DECODER_SEAM_PASS", test_m6_decoder_seam(), "Independent decoder verified all C1 instructions"); - report_gate("OMEGA_SELF_HOST_C2_REPRODUCTION_PASS", test_m6_c2_reproduction(), "Native compiler C1(G_C) -> C2 emitted machine bytes"); - report_gate("OMEGA_SELF_HOST_C3_REPRODUCTION_PASS", test_m6_c3_reproduction(), "Native compiler C2(G_C) -> C3 emitted machine bytes"); - report_gate("OMEGA_SELF_HOST_FIXED_POINT_PASS", test_m6_fixed_point(), "Exact bit-for-bit identity C1 == C2 == C3 verified"); - report_gate("OMEGA_SELF_HOST_REALIZATION_ID_PASS", test_m6_realization_id(), "REALIZATION_ID matching across C1, C2, and C3"); - report_gate("OMEGA_SELF_HOST_M5_PARITY_PASS", test_m6_m5_parity(), "Reproduced compiler reproduces exact M5 machine code bytes"); - report_gate("OMEGA_SELF_HOST_NATIVE_EXECUTION_PASS", test_m6_native_execution(), "Reproduced compiler output executes natively to 15"); - report_gate("OMEGA_SELF_HOST_ADVERSARIAL_MUTATION_PASS", test_m6_adversarial_mutation(), "Single-bit mutations in G_C wire or C1 refused fail-closed"); - printf("================================================================================\n"); - printf(" TOTAL GATES: %d | PASSED: %d | FAILED: %d\n", gate_count, gate_passed, gate_count - gate_passed); - printf("================================================================================\n"); - return (gate_passed == gate_count) ? 0 : 1; + return omega_run_m6_gates(); } if (strcmp(argv[1], "--demonstrate-self-host") == 0) { @@ -3557,24 +3764,7 @@ int main(int argc, char **argv) { } if (strcmp(argv[1], "--run-m7-gates") == 0) { - printf("================================================================================\n"); - printf(" AIEN OMEGA SUBSTRATE — MILESTONE 7: OMEGA_VERIFY QUALIFICATION GATES\n"); - printf("================================================================================\n"); - gate_count = 0; gate_passed = 0; - report_gate("OMEGA_VERIFY_V0_TYPE_PASS", test_m7_v0_type(), "V0 accepted well-typed graph and rejected ill-typed graph"); - report_gate("OMEGA_VERIFY_V0_DAG_PASS", test_m7_v0_dag(), "V0 rejected graph with dangling reference"); - report_gate("OMEGA_VERIFY_V0_CODE_BOUNDS_PASS", test_m7_v0_code_bounds(), "V0 enforced 4-byte alignment and buffer length bounds"); - report_gate("OMEGA_VERIFY_V0_INSN_DECODE_PASS", test_m7_v0_insn_decode(), "V0 validated instruction opcodes and refused illegal instruction"); - report_gate("OMEGA_VERIFY_V0_TERMINAL_RET_PASS", test_m7_v0_terminal_ret(), "V0 rejected non-terminating / non-RET execution buffer"); - report_gate("OMEGA_VERIFY_V1_DIFFERENTIAL_PASS", test_m7_v1_differential(), "V1 confirmed exact bit-for-bit parity across test corpus"); - report_gate("OMEGA_VERIFY_V1_DIVERGENCE_REFUSAL_PASS", test_m7_v1_divergence_refusal(), "V1 detected and refused mutated realization divergence"); - report_gate("OMEGA_VERIFY_V2_COMMUTATIVITY_PASS", test_m7_v2_commutativity(), "V2 proved commutativity on declared commutative ops"); - report_gate("OMEGA_VERIFY_V2_IDENTITY_PASS", test_m7_v2_identity(), "V2 proved identity elements on ADD, MUL, AND, OR"); - report_gate("OMEGA_VERIFY_V2_OVERFLOW_PASS", test_m7_v2_overflow(), "V2 validated modular overflow wrapping semantics"); - printf("================================================================================\n"); - printf(" TOTAL GATES: %d | PASSED: %d | FAILED: %d\n", gate_count, gate_passed, gate_count - gate_passed); - printf("================================================================================\n"); - return (gate_passed == gate_count) ? 0 : 1; + return omega_run_m7_gates(); } if (strcmp(argv[1], "--demonstrate-verify") == 0) { @@ -3583,24 +3773,7 @@ int main(int argc, char **argv) { } if (strcmp(argv[1], "--run-m8-gates") == 0) { - printf("================================================================================\n"); - printf(" AIEN OMEGA SUBSTRATE — MILESTONE 8: OMEGA_PROGRAM_CORE QUALIFICATION GATES\n"); - printf("================================================================================\n"); - gate_count = 0; gate_passed = 0; - report_gate("OMEGA_PROGRAM_OBJECT_PASS", test_m8_program_object(), "OMEGA_PROGRAM created with contracts, cost, and realization"); - report_gate("OMEGA_PROGRAM_CONTRACT_VALIDATION_PASS", test_m8_contract_validation(), "Contract validation enforced, invalid types rejected"); - report_gate("OMEGA_PROGRAM_COMPOSITION_PASS", test_m8_composition(), "Algebraic composition C = A o B with contract propagation"); - report_gate("OMEGA_PROGRAM_TYPE_MISMATCH_REFUSAL_PASS", test_m8_type_mismatch_refusal(), "Incompatible composition refused fail-closed"); - report_gate("OMEGA_PROGRAM_COST_ACCOUNTING_PASS", test_m8_cost_accounting(), "Composite cost monotonically verified (insns, latency)"); - report_gate("OMEGA_PROGRAM_REALIZATION_PASS", test_m8_realization(), "Composite program lowered to native AArch64 machine bytes"); - report_gate("OMEGA_PROGRAM_V0_STRUCTURAL_PASS", test_m8_v0_structural(), "Composite program passes M7 V0 structural verification"); - report_gate("OMEGA_PROGRAM_V1_DIFFERENTIAL_PASS", test_m8_v1_differential(), "Composite program passes M7 V1 differential evaluation (2x+1)"); - report_gate("OMEGA_PROGRAM_V2_PROPERTY_PASS", test_m8_v2_property(), "Composite program passes M7 V2 property verification"); - report_gate("OMEGA_PROGRAM_SYNTHESIS_TASK_PASS", test_m8_synthesis_task(), "SYNTHESIS_TASK evaluation harness ready for M9 search"); - printf("================================================================================\n"); - printf(" TOTAL GATES: %d | PASSED: %d | FAILED: %d\n", gate_count, gate_passed, gate_count - gate_passed); - printf("================================================================================\n"); - return (gate_passed == gate_count) ? 0 : 1; + return omega_run_m8_gates(); } if (strcmp(argv[1], "--demonstrate-program") == 0) { @@ -3609,45 +3782,11 @@ int main(int argc, char **argv) { } if (strcmp(argv[1], "--run-m9-gates") == 0) { - printf("================================================================================\n"); - printf(" AIEN OMEGA SUBSTRATE — MILESTONE 9: OMEGA_SYNTHESIS_V0 QUALIFICATION GATES\n"); - printf("================================================================================\n"); - gate_count = 0; gate_passed = 0; - report_gate("OMEGA_SYNTHESIS_PRIMITIVES_PASS", test_m9_primitives(), "Base primitive program bank constructed and verified"); - report_gate("OMEGA_SYNTHESIS_SEARCH_ORDERING_PASS", test_m9_search_ordering(), "Deterministic search generates multi-level candidates"); - report_gate("OMEGA_SYNTHESIS_TYPE_PRUNING_PASS", test_m9_type_pruning(), "Incompatible typed candidates pruned fail-closed"); - report_gate("OMEGA_SYNTHESIS_EQUIV_PRUNING_PASS", test_m9_equiv_pruning(), "Observational equivalence table detects duplicate functions"); - report_gate("OMEGA_SYNTHESIS_V0_STRUCTURAL_PASS", test_m9_v0_structural(), "Synthesized candidate passes M7 V0 structural verification"); - report_gate("OMEGA_SYNTHESIS_V1_IO_FILTERING_PASS", test_m9_v1_io_filtering(), "Non-conforming candidate rejected by test suite filter"); - report_gate("OMEGA_SYNTHESIS_V2_PROPERTY_PASS", test_m9_v2_property(), "Synthesized candidate passes M7 V2 property verification"); - report_gate("OMEGA_SYNTHESIS_TARGET_AFFINE_PASS", test_m9_target_affine(), "Synthesized 2x + 1 passes holdout tests on native hardware"); - report_gate("OMEGA_SYNTHESIS_TARGET_COMPOSED_PASS", test_m9_target_composed(), "Synthesized 3x - 2 passes holdout tests on native hardware"); - report_gate("OMEGA_SYNTHESIS_RECEIPT_PASS", test_m9_receipt(), "Cryptographic identity binding Task, Program, and Realization"); - printf("================================================================================\n"); - printf(" TOTAL GATES: %d | PASSED: %d | FAILED: %d\n", gate_count, gate_passed, gate_count - gate_passed); - printf("================================================================================\n"); - return (gate_passed == gate_count) ? 0 : 1; + return omega_run_m9_gates(); } if (strcmp(argv[1], "--run-m10-gates") == 0) { - printf("================================================================================\n"); - printf(" AIEN OMEGA SUBSTRATE — MILESTONE 10: OMEGA_LIBRARY_V1 QUALIFICATION GATES\n"); - printf("================================================================================\n"); - gate_count = 0; gate_passed = 0; - report_gate("OMEGA_LIBRARY_INIT_PASS", test_m10_init(), "Catalog initialization and capacity management"); - report_gate("OMEGA_LIBRARY_INSERT_PASS", test_m10_insert(), "Content-addressed program insertion and state digest update"); - report_gate("OMEGA_LIBRARY_INDEXING_PASS", test_m10_lookup_id(), "Retrieval by SEMANTIC_ID, REALIZATION_ID, and name"); - report_gate("OMEGA_LIBRARY_QUERY_PASS", test_m10_lookup_type(), "Semantic type query filtering (U64 -> U64)"); - report_gate("OMEGA_LIBRARY_DEP_DAG_PASS", test_m10_dependency_dag(), "Direct and transitive dependency DAG tracking"); - report_gate("OMEGA_LIBRARY_IMMUTABILITY_PASS", test_m10_immutability(), "Version advancement and cryptographic digest evolution"); - report_gate("OMEGA_LIBRARY_UNVERIFIED_REFUSAL_PASS", test_m10_unverified_refusal(), "Unverified program insertion rejected fail-closed"); - report_gate("OMEGA_LIBRARY_DUPLICATE_REFUSAL_PASS", test_m10_duplicate_refusal(), "Duplicate SEMANTIC_ID insertion rejected fail-closed"); - report_gate("OMEGA_LIBRARY_SYNTHESIS_REUSE_PASS", test_m10_synthesis_reuse(), "Synthesis engine discovering composite by reusing verified library component"); - report_gate("OMEGA_LIBRARY_RECEIPT_PASS", test_m10_receipt(), "Cryptographic state digest and provenance accounting"); - printf("================================================================================\n"); - printf(" TOTAL GATES: %d | PASSED: %d | FAILED: %d\n", gate_count, gate_passed, gate_count - gate_passed); - printf("================================================================================\n"); - return (gate_passed == gate_count) ? 0 : 1; + return omega_run_m10_gates(); } if (strcmp(argv[1], "--demonstrate-library") == 0) { @@ -3656,24 +3795,7 @@ int main(int argc, char **argv) { } if (strcmp(argv[1], "--run-m11-gates") == 0) { - printf("================================================================================\n"); - printf(" AIEN OMEGA SUBSTRATE — MILESTONE 11: OMEGA_LIBRARY_DISCOVERY QUALIFICATION GATES\n"); - printf("================================================================================\n"); - gate_count = 0; gate_passed = 0; - report_gate("OMEGA_DISCOVERY_CORPUS_MINING_PASS", test_m11_corpus_mining(), "Common sub-expression slices mined across corpus"); - report_gate("OMEGA_DISCOVERY_NONTRIVIAL_PASS", test_m11_nontrivial(), "Candidate abstraction is non-trivial and composite"); - report_gate("OMEGA_DISCOVERY_COMPRESSION_PASS", test_m11_compression(), "Positive description length reduction and instruction savings across corpus"); - report_gate("OMEGA_DISCOVERY_SEMANTIC_PRESERVATION_PASS", test_m11_semantic_preservation(), "Behavioral equivalence strictly preserved after program refactoring"); - report_gate("OMEGA_DISCOVERY_V0_STRUCTURAL_PASS", test_m11_v0_structural(), "M7 V0 structural verification passed on discovered abstraction"); - report_gate("OMEGA_DISCOVERY_V1_DIFFERENTIAL_PASS", test_m11_v1_differential(), "M7 V1 differential evaluation passed on native hardware"); - report_gate("OMEGA_DISCOVERY_V2_PROPERTY_PASS", test_m11_v2_property(), "M7 V2 property verification passed on discovered abstraction"); - report_gate("OMEGA_DISCOVERY_LIBRARY_ADMISSION_PASS", test_m11_library_admission(), "Discovered abstraction admitted into OmegaLibrary catalog"); - report_gate("OMEGA_DISCOVERY_SEARCH_ACCELERATION_PASS", test_m11_search_acceleration(), "Held-out synthesis task solved with reduced search candidates"); - report_gate("OMEGA_DISCOVERY_RECEIPT_PASS", test_m11_receipt(), "Full cryptographic evidence receipt accounting for discovery and acceleration"); - printf("================================================================================\n"); - printf(" TOTAL GATES: %d | PASSED: %d | FAILED: %d\n", gate_count, gate_passed, gate_count - gate_passed); - printf("================================================================================\n"); - return (gate_passed == gate_count) ? 0 : 1; + return omega_run_m11_gates(); } if (strcmp(argv[1], "--demonstrate-discovery") == 0) { @@ -3682,24 +3804,7 @@ int main(int argc, char **argv) { } if (strcmp(argv[1], "--run-m12-gates") == 0) { - printf("================================================================================\n"); - printf(" AIEN OMEGA SUBSTRATE — MILESTONE 12: OMEGA_LIVING_MATVEC QUALIFICATION GATES\n"); - printf("================================================================================\n"); - gate_count = 0; gate_passed = 0; - report_gate("OMEGA_MATVEC_SEMANTIC_SPEC_PASS", test_m12_semantic_spec(), "Pure mathematical MatVec specification instantiated with canonical SemanticId"); - report_gate("OMEGA_MATVEC_MULTI_REALIZATION_PASS", test_m12_multi_realization(), "Synthesis engine generates 3 distinct machine-code realizations"); - report_gate("OMEGA_MATVEC_TRIPLE_ID_PASS", test_m12_triple_id(), "Cryptographic triple identity binding SEMANTIC_ID, MACHINE_ID, and code bytes"); - report_gate("OMEGA_MATVEC_V0_STRUCTURAL_PASS", test_m12_v0_structural(), "M7 V0 structural verification passed on all realizations with mutation refusal"); - report_gate("OMEGA_MATVEC_V1_NUMERICAL_PARITY_PASS", test_m12_v1_numerical_parity(), "Exact bit-for-bit numerical parity against mathematical Oracle across dimensions"); - report_gate("OMEGA_MATVEC_REGIME_INFLECTION_PASS", test_m12_regime_inflection(), "Empirical benchmark measures execution latency across small and medium regimes"); - report_gate("OMEGA_MATVEC_ADAPTIVE_DISPATCH_PASS", test_m12_adaptive_dispatch(), "Living kernel dynamically adapts and dispatches optimal realization"); - report_gate("OMEGA_MATVEC_SPEEDUP_PASS", test_m12_speedup(), "Multi-accumulator unrolled schedule achieves measured hardware speedup"); - report_gate("OMEGA_MATVEC_ZERO_TOOLCHAIN_PASS", test_m12_zero_toolchain(), "All realizations emitted via direct AArch64 machine byte encoders without foreign toolchain"); - report_gate("OMEGA_MATVEC_RECEIPT_PASS", test_m12_receipt(), "Full qualification receipt generated and verified"); - printf("================================================================================\n"); - printf(" TOTAL GATES: %d | PASSED: %d | FAILED: %d\n", gate_count, gate_passed, gate_count - gate_passed); - printf("================================================================================\n"); - return (gate_passed == gate_count) ? 0 : 1; + return omega_run_m12_gates(); } if (strcmp(argv[1], "--demonstrate-living-matvec") == 0) { @@ -3708,24 +3813,7 @@ int main(int argc, char **argv) { } if (strcmp(argv[1], "--run-m13-gates") == 0) { - printf("================================================================================\n"); - printf(" AIEN OMEGA SUBSTRATE — MILESTONE 13: OMEGA_MACHINE_GRAPH QUALIFICATION GATES\n"); - printf("================================================================================\n"); - gate_count = 0; gate_passed = 0; - report_gate("OMEGA_MACHINE_INIT_PASS", test_m13_init(), "Machine graph initialized with profile and name"); - report_gate("OMEGA_MACHINE_PIPELINE_PASS", test_m13_pipeline(), "Execution pipeline, issue width, and compute units modeled"); - report_gate("OMEGA_MACHINE_REGISTER_FILE_PASS", test_m13_register_file(), "Register file capacities (GPR, Vector) validated"); - report_gate("OMEGA_MACHINE_MEMORY_HIERARCHY_PASS", test_m13_memory_hierarchy(), "Multi-tier cache hierarchy (L1I, L1D, L2, L3) and DRAM modeled"); - report_gate("OMEGA_MACHINE_PHYSICS_INGRESS_PASS", test_m13_physics_ingress(), "Physical machine descriptor ingested and bound to Physics seal"); - report_gate("OMEGA_MACHINE_CANONICAL_ID_PASS", test_m13_canonical_id(), "Deterministic MACHINE_ID bit-for-bit identity verified"); - report_gate("OMEGA_MACHINE_TOPOLOGY_DIFFERENCE_PASS", test_m13_topology_difference(), "Distinct machine topologies yield distinct MACHINE_IDs"); - report_gate("OMEGA_MACHINE_CYCLE_PREVENTION_PASS", test_m13_cycle_prevention(), "Topological cache ordering and line size validation enforced fail-closed"); - report_gate("OMEGA_MACHINE_COST_EVALUATION_PASS", test_m13_cost_evaluation(), "Latency estimation grounded in physical execution unit latencies"); - report_gate("OMEGA_MACHINE_RECEIPT_PASS", test_m13_receipt(), "Physical machine graph certified with Physics authority accounting"); - printf("================================================================================\n"); - printf(" TOTAL GATES: %d | PASSED: %d | FAILED: %d\n", gate_count, gate_passed, gate_count - gate_passed); - printf("================================================================================\n"); - return (gate_passed == gate_count) ? 0 : 1; + return omega_run_m13_gates(); } if (strcmp(argv[1], "--demonstrate-machine") == 0) { @@ -3734,24 +3822,7 @@ int main(int argc, char **argv) { } if (strcmp(argv[1], "--run-m14-gates") == 0) { - printf("================================================================================\n"); - printf(" AIEN OMEGA SUBSTRATE — MILESTONE 14: OMEGA_REALIZATION_SYNTHESIS QUALIFICATION GATES\n"); - printf("================================================================================\n"); - gate_count = 0; gate_passed = 0; - report_gate("OMEGA_REAL_SYNTH_INIT_PASS", test_m14_init(), "Realization synthesis task initialization and configuration"); - report_gate("OMEGA_REAL_SYNTH_TRIPLE_ID_PASS", test_m14_triple_id(), "Cryptographic triple identity incorporates SEMANTIC_ID, MACHINE_ID, and code bytes"); - report_gate("OMEGA_REAL_SYNTH_SCHEDULE_OPT_PASS", test_m14_schedule_opt(), "Machine-aware instruction schedules differ between DGX Spark and QEMU virt"); - report_gate("OMEGA_REAL_SYNTH_DGX_SPARK_PASS", test_m14_dgx_spark(), "Synthesis specialized for DGX Spark Grace Neoverse V2 4-wide dispatch"); - report_gate("OMEGA_REAL_SYNTH_QEMU_VIRT_PASS", test_m14_qemu_virt(), "Synthesis specialized for QEMU virt generic AArch64 baseline"); - report_gate("OMEGA_REAL_SYNTH_SEMANTIC_PARITY_PASS", test_m14_semantic_parity(), "Native execution of synthesized realization matches semantic evaluation"); - report_gate("OMEGA_REAL_SYNTH_V0_STRUCTURAL_PASS", test_m14_v0_structural(), "M7 V0 structural verification passed on synthesized realization"); - report_gate("OMEGA_REAL_SYNTH_V1_DIFFERENTIAL_PASS", test_m14_v1_differential(), "M7 V1 differential evaluation passed across holdout test inputs"); - report_gate("OMEGA_REAL_SYNTH_V2_PROPERTY_PASS", test_m14_v2_property(), "M7 V2 property verification passed on synthesized realization"); - report_gate("OMEGA_REAL_SYNTH_RECEIPT_PASS", test_m14_receipt(), "Full qualification receipt generated and verified"); - printf("================================================================================\n"); - printf(" TOTAL GATES: %d | PASSED: %d | FAILED: %d\n", gate_count, gate_passed, gate_count - gate_passed); - printf("================================================================================\n"); - return (gate_passed == gate_count) ? 0 : 1; + return omega_run_m14_gates(); } if (strcmp(argv[1], "--demonstrate-realization-synthesis") == 0) { @@ -3760,24 +3831,7 @@ int main(int argc, char **argv) { } if (strcmp(argv[1], "--run-m15-gates") == 0) { - printf("================================================================================\n"); - printf(" AIEN OMEGA SUBSTRATE — MILESTONE 15: PHYSICS_ACCELERATOR_LINK GATES\n"); - printf("================================================================================\n"); - gate_count = 0; gate_passed = 0; - report_gate("PHYSICS_ACCEL_MEM_BOUNDS_PASS", test_m15_mem_bounds(), "Coherent DRAM boundaries and kernel isolation"); - report_gate("PHYSICS_ACCEL_SMMU_TRANSLATION_PASS", test_m15_smmu_translation(), "SMMUv3 Stage 1 IOVA-to-PA translation mapping"); - report_gate("PHYSICS_ACCEL_DMA_SANDBOX_PASS", test_m15_dma_sandbox(), "Unmapped and permission violation DMA sandboxing"); - report_gate("PHYSICS_ACCEL_QUEUE_AUTHORITY_PASS", test_m15_queue_authority(), "Bounded queue authority and doorbell mediation"); - report_gate("PHYSICS_ACCEL_DEVICE_LIFECYCLE_PASS", test_m15_device_lifecycle(), "Deterministic monotonic device lifecycle transitions"); - report_gate("PHYSICS_ACCEL_RESET_RECOVERY_PASS", test_m15_reset_recovery(), "Fault isolation and non-disruptive device reset"); - report_gate("PHYSICS_ACCEL_RECEIPT_CHAIN_PASS", test_m15_receipt_chain(), "Immutable 192B receipt with rolling SHA-256 seal chain"); - report_gate("PHYSICS_ACCEL_OMEGA_INGRESS_PASS", test_m15_omega_ingress(), "Omega mediated intent ingress and capability gating"); - report_gate("PHYSICS_ACCEL_ZERO_TOOLCHAIN_PASS", test_m15_zero_toolchain(), "Zero foreign toolchain (0 LLVM, 0 Python, 0 inline asm)"); - report_gate("PHYSICS_ACCEL_RECEIPT_PASS", test_m15_receipt(), "Qualification receipt generation and audit verification"); - printf("================================================================================\n"); - printf(" TOTAL GATES: %d | PASSED: %d | FAILED: %d\n", gate_count, gate_passed, gate_count - gate_passed); - printf("================================================================================\n"); - return (gate_passed == gate_count) ? 0 : 1; + return omega_run_m15_gates(); } if (strcmp(argv[1], "--demonstrate-accelerator") == 0) { @@ -3842,8 +3896,22 @@ int main(int argc, char **argv) { } if (strcmp(argv[1], "--dump-test-vectors") == 0) { - const char *dir = (argc >= 3) ? argv[2] : "evidence/test_vectors"; - char path[512]; + char default_dir[512]; + const char *dir; + if (argc >= 3) { + dir = argv[2]; + } else { + /* No explicit output dir requested: never default into the + * committed evidence/ tree, use the run-scoped evidence area. */ + if (omega_evidence_path("test_vectors/.keep", default_dir, sizeof(default_dir)) != 0) { + fprintf(stderr, "--dump-test-vectors: failed to resolve default output directory\n"); + return 1; + } + char *slash = strrchr(default_dir, '/'); + if (slash) *slash = '\0'; + dir = default_dir; + } + char path[1024]; /* Vector 1: Arithmetic U32 ADD(7, 11) canonical binary */ OmegaGraph *ga = omega_graph_create();