Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/CUDApp/patches/98e189f72b51b8f8 # CUDApp CUDA++: AIEN’s GPU machine-code toolchain, runtime and driver client for NVIDIA GPUs without the CUDA toolkit. Hardware coverage and driver replacement limits are explicit. Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers ## Use seeded Omega for NVRM allocation and M16 marker decisions open `98e189f72b51b8f8` opened 2026-11-20 by `z6MktvMGgxSZ19NQ...` 2 commits · 4 files · 7176 bytes. Base `a4ffab1d55b4019b4349e03a23b55844122a20f1` . Applied head `531a7b26714da57c586a979c58624c6578884a63`: the last commit this forge's own `git am` made on the base. It is in no repository; the owner applies the patch by hand. ``` Route hosted NVRM page alignment and M16 serial comparison through existing seeded Omega units. Covers zero-timeout final samples, wrap and half-range boundaries. On Spark GB10 with driver 580.173.02, spark-window run ../m16_requalify passed the withheld and rung doorbell controls at source commit 2ec7a97c. bwrap --bind / / --dev /dev make -j2 test-om-eng-diff test-om-eng-red returned 0. The 44,584 records matched, all 28 operations ran, and the planted error diverged at record 136. The full AArch64 host suite is in progress. ``` ### Apply it ``` git checkout -b patch-98e189f72b51b8f8 a4ffab1d55b4019b4349e03a23b55844122a20f1 curl -fsSL https://interplane.io/drakestapleton/CUDApp/patches/98e189f72b51b8f8.patch | git am ``` Raw patch (mbox) · Diff ### Signature The author's key `did:key:z6MktvMGgxSZ19NQkrvXG6aRzjbFA1yBa2KJmmA9pSTJCiEZ` signed this statement with `ssh-keygen -Y sign -n interplane-patch`; the forge checked the signature before it kept the patch. The lines are: format, repository, base, SHA-256 of the mbox, SHA-256 of the title, a line feed and the description. ``` interplane-patch 1 drakestapleton/CUDApp a4ffab1d55b4019b4349e03a23b55844122a20f1 f4bb8e6a8573fb25f8889397451d2fa906cfd61b65a712522fefbcd95978f9e2 7680870070b730b26b15392169ef6b1be380e8eb9379ee52638f758ef0786522 ``` ``` -----BEGIN SSH SIGNATURE----- U1NIU0lHAAAAAQAAADMAAAALc3NoLWVkMjU1MTkAAAAg1vQ1KtWtuW5PISxEahQt4AgcBw syuwQ4l2Qd7RBTSZ4AAAAQaW50ZXJwbGFuZS1wYXRjaAAAAAAAAAAGc2hhNTEyAAAAUwAA AAtzc2gtZWQyNTUxOQAAAEAeDDZAUsu05LtM/hLfINR0Kym2ZZI+Gb1KAMn25Fw9DvOTgd 0yeaOI+mR0OgrRC125bJ37HFor5yfuNp/m9ggC -----END SSH SIGNATURE----- ``` ### Changes ``` diff --git a/evidence/native-marker-alignment/spark.ee14526843358d1c0c641e5d26c3b157c273e91d791df1e1204b1543afc33be7.txt b/evidence/native-marker-alignment/spark.ee14526843358d1c0c641e5d26c3b157c273e91d791df1e1204b1543afc33be7.txt new file mode 100644 index 0000000000000000000000000000000000000000..a1060bb39291c7033fbd9edeec4f3f8969a13dfe --- /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 diff --git a/m16/m16_native.c b/m16/m16_native.c index 21a9bf4e7fcf0f6590eb73105cd82c220ad2f918..e9155bf144a8186269156242819e76d91c399645 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 c74dfa05c9377fbffb099e6fb505a0debcf2b95d..93f117d600c9f216b93082948ba3e98933a7a844 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 2f6c75d5b8dd9cea82b16575d4aed1275563e8c9..8b6965beb2763a2e7f981f9f0ae5b0e58616c601 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); ```