From 2ec7a97ca59677722c21b9e9dfffeee0b902200a Mon Sep 17 00:00:00 2001 From: Drake Stapleton <213298340+drakestapleton@users.noreply.github.com> Date: Fri, 20 Nov 2026 06:42:48 -0600 Subject: [PATCH 1/2] Use seeded Omega for allocation alignment and marker ordering --- m16/m16_native.c | 14 ++++++++++++-- nvrm/nvrm.c | 3 ++- tests/om_eng_diff_test.c | 16 ++++++++++++++++ 3 files changed, 30 insertions(+), 3 deletions(-) diff --git a/m16/m16_native.c b/m16/m16_native.c index 21a9bf4e..e9155bf1 100644 --- a/m16/m16_native.c +++ b/m16/m16_native.c @@ -113,17 +113,27 @@ int m16_native_wait_marker(volatile uint32_t *marker, uint32_t expected, uint64_ return m16_native_wait_marker_ge(marker, expected, timeout_ms); } +static int marker_reached(uint32_t observed, uint32_t target) { + if (eng_on()) { + uint64_t in[2] = {observed, target}, w[16]; + if (eng_ask(ENG_OP_SEQGE, in, 2, w) != 0) return -1; + return w[0] == 1; + } + return (int32_t)(observed - target) >= 0; +} + int m16_native_wait_marker_ge(volatile uint32_t *marker, uint32_t target, uint64_t timeout_ms) { if (!marker) return -1; uint64_t duration, end; if (__builtin_mul_overflow(timeout_ms, 1000000ull, &duration) || __builtin_add_overflow(now_ns(), duration, &end)) end = UINT64_MAX; while (now_ns() < end) { - if ((int32_t)(*marker - target) >= 0) return 0; + int reached = marker_reached(*marker, target); + if (reached != 0) return reached == 1 ? 0 : -1; usleep(50); nvrm_cpu_relax(); } - return ((int32_t)(*marker - target) >= 0) ? 0 : -1; + return marker_reached(*marker, target) == 1 ? 0 : -1; } int m16_native_close(M16NativeContext *ctx) { diff --git a/nvrm/nvrm.c b/nvrm/nvrm.c index c74dfa05..93f117d6 100644 --- a/nvrm/nvrm.c +++ b/nvrm/nvrm.c @@ -996,7 +996,8 @@ int nvrm_vram_info(Nvrm *rm, uint64_t *free_bytes, uint64_t *total_bytes) { static int alloc_with_cacheability(Nvrm *rm, uint64_t size, NvrmMem *out, uint32_t gpu_cacheable, int local) { if (!rm || !out || !size || rm->faulted || size > SIZE_MAX - 0xfffULL) return rm ? fail(rm, "invalid or overflowed allocation size") : -1; - size = (size + 0xfff) & ~0xfffull; + size = nvrm_policy_palign(size, 0x1000); + if (!size) return fail(rm, "invalid or overflowed allocation size"); if (rm->live_count >= NVRM_MAX_LIVE) return fail(rm, "live allocation table full (%d)", NVRM_MAX_LIVE); uint64_t va = va_take(rm, size, 0x1000); if (!va) return fail(rm, "GPU VA exhausted: this client's VA slot is full (the next slot belongs to another client) or the VA overflowed"); diff --git a/tests/om_eng_diff_test.c b/tests/om_eng_diff_test.c index 2f6c75d5..8b6965be 100644 --- a/tests/om_eng_diff_test.c +++ b/tests/om_eng_diff_test.c @@ -711,6 +711,22 @@ int main(int argc, char **argv) { if (omega_gpu_platform_linux_test_set_meminfo(g_meminfo) != 0) return 2; omega_gpu_engine_set_backend(&g_be); omega_gpu_engine_test_set_clock(eng_now); + /* A zero timeout still samples the marker. Check the public wrapper and + * both sides of the serial half-range through the production binding. */ + static const struct { uint32_t observed, target; int expected; } markers[] = { + {7, 7, 0}, {0, UINT32_MAX, 0}, {UINT32_MAX, 0, -1}, + {0x7fffffffu, 0, 0}, {0x80000000u, 0, -1} + }; + uint64_t before = g_opn[ENG_OP_SEQGE]; + for (size_t j = 0; j < sizeof markers / sizeof markers[0]; j++) { + volatile uint32_t marker = markers[j].observed; + if (m16_native_wait_marker(&marker, markers[j].target, 0) != markers[j].expected) + return 1; + } + if (eng_on() && g_opn[ENG_OP_SEQGE] == before) { + fputs("M16 marker wait bypassed Omega serial ordering\n", stderr); + return 1; + } int i; for (i = 0; i < 3000; i++) trace_engine(); for (i = 0; i < 2000; i++) trace_wait(0); From 542f4377bdc2e1086b2c48b00488dbe4a7b7ac7e Mon Sep 17 00:00:00 2001 From: Drake Stapleton <213298340+drakestapleton@users.noreply.github.com> Date: Fri, 20 Nov 2026 06:44:46 -0600 Subject: [PATCH 2/2] Record Spark allocation and marker qualification --- ...c3b157c273e91d791df1e1204b1543afc33be7.txt | 41 +++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 evidence/native-marker-alignment/spark.ee14526843358d1c0c641e5d26c3b157c273e91d791df1e1204b1543afc33be7.txt diff --git a/evidence/native-marker-alignment/spark.ee14526843358d1c0c641e5d26c3b157c273e91d791df1e1204b1543afc33be7.txt b/evidence/native-marker-alignment/spark.ee14526843358d1c0c641e5d26c3b157c273e91d791df1e1204b1543afc33be7.txt new file mode 100644 index 00000000..a1060bb3 --- /dev/null +++ b/evidence/native-marker-alignment/spark.ee14526843358d1c0c641e5d26c3b157c273e91d791df1e1204b1543afc33be7.txt @@ -0,0 +1,41 @@ +CUDApp native allocation and marker ordering + +2ec7a97ca59677722c21b9e9dfffeee0b902200a +20261120T124316Z-694d94 +name, driver_version +NVIDIA GB10, 580.173.02 +7eb0c4140ae75318ce1e5c2b1611f768fb2b87e4e5834deeded423a0cf1868a4 m16_requalify + +Build from the repository root + gcc -O2 -Wall -Wextra -Werror \ + -DCUDAPP_MIGRATION_PENDING_C_NVRM="${CUDAPP_MIGRATION_PENDING_C_NVRM:-0}" \ + -DCUDAPP_MIGRATION_PENDING_C_NVRM_ALLOC="${CUDAPP_MIGRATION_PENDING_C_NVRM_ALLOC:-0}" \ + -I./src -I./nvrm -I./m16 \ + -I./third_party/nvidia-open-580.173.02/src/common/sdk/nvidia/inc \ + -I./third_party/nvidia-open-580.173.02/kernel-open/common/inc \ + -I./third_party/nvidia-open-580.173.02/kernel-open/nvidia-uvm \ + -I./third_party/nvidia-open-580.173.02/src/nvidia/arch/nvalloc/unix/include \ + nvrm/nvrm.c m16/m16_native.c m16/m16_requalify.c \ + -I./src src/omega_ampere_qmd.c src/omega_gpu_chip.c src/cudapp_om_amp_runtime.c src/cudapp_om_amp_qmd.c src/cudapp_om_eng.c src/cudapp_om_chip_admit.c src/cudapp_om_chip_enum.c src/cudapp_om_nvrm_*.c src/cudapp_om_fixture_text.c -o m16/m16_requalify + +Hardware command (binary moved outside the checkout before execution) +spark-window run ../m16_requalify +Exit 0. Selected output follows. +[OBSERVED] Marker after 100ms without doorbell: 0x00000000 (expected 0x00000000) +NEGATIVE_CONTROL_PASS: Marker strictly remained 0x00000000 while doorbell was withheld. +[OBSERVED] Marker after doorbell rung: 0x16c0ffee (expected 0x16c0ffee) +POSITIVE_CONTROL_PASS: Marker successfully updated to 0x16c0ffee upon doorbell store. +NO_LIBCUDA_PASS: Zero libcuda / libcudart mappings present in live process. +CAUSALITY_VERIFICATION_PASS: Doorbell causality strictly confirmed. +M16_REQUALIFICATION_PASS: Milestone 16 native execution verified. + +Host command +bwrap --bind / / --dev /dev make -j2 test-om-eng-diff test-om-eng-red +Exit 0. Selected output follows. +om build: 44584 records, 110767 unit calls, all 28 ops reached +C build: 44584 records, 0 unit calls +PASS om eng diff: 44584 records identical (om vs C) +om build: 44584 records, 110770 unit calls, all 28 ops reached +C build: 44584 records, 0 unit calls +FAIL om eng diff: record 136 differs +PASS red: flipped unit answer detected