interplane.Get Omega
Read in your language

CUDApp

CUDA++: AIEN’s GPU machine-code toolchain, runtime and driver client for NVIDIA GPUs without the CUDA toolkit. Hardware coverage and driver replacement limits are explicit.

Brought by drakestapleton

GitHub aien-dev/CUDApp#179 (code only)

closed derived 59d898f45cd5068f #179

Imported from GitHub aien-dev/CUDApp#179 (code only)

GitHub's metadata for this pull request is unavailable: its state is DERIVED from the commits (merged: the head is reachable from this project's main; open: GitHub kept a merge ref; else closed).

Base b348277e4383ab1f37f45bb702ea7d4fb4363782 · Head 809b9a9cec57dc5a0c4fe3934c576fa78278a0e3

Fetch it

A git bundle of the pull request's head, 6950 bytes.

curl -fsSL https://interplane.io/drakestapleton/CUDApp/patches/59d898f45cd5068f.bundle -o 59d898f45cd5068f.bundle
git fetch 59d898f45cd5068f.bundle refs/pull/179/head

Raw bundle · Diff

Provenance

This proposal is imported from GitHub; it is not signed by its author. Its import statement and source record:

github-import 1
aien-dev/CUDApp
179
809b9a9cec57dc5a0c4fe3934c576fa78278a0e3
{"kind":"github-import","owner":"aien-dev","repo":"CUDApp","number":179,"url":"https://github.com/aien-dev/CUDApp/pull/179","export_sha256":"967c79e26a893657b5cdaa45efd442be5dbd2ecfe68e25f9a8c1b5da4d60d452","imported_utc":"2026-11-18T16:38:53Z","metadata":"unavailable","state_derived":true}

Changes

diff --git a/evidence/CMDLIST-LIFETIME/2026-10-28-host.md b/evidence/CMDLIST-LIFETIME/2026-10-28-host.md
new file mode 100644
index 00000000..a5fbff26
--- /dev/null
+++ b/evidence/CMDLIST-LIFETIME/2026-10-28-host.md
@@ -0,0 +1,97 @@
+<!-- SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception -->
+# Command-list creation lifetime, host receipt
+
+Date: 2026-10-28 UTC. PR: [#174](https://github.com/aien-dev/CUDApp/pull/174).
+
+Status: MEASURED host regression red before correction, green after correction.
+Not a real-threading, GPU, submission-completion or hardware qualification receipt.
+No original receipt was changed.
+
+## Source identities
+
+- Base: c6977b4906229fe83f41103b7eff65b64a0986d6.
+- Test-only red head: 3a3cd76f738967a133007da66807986431e91564.
+- Red tested merge: 504197eec17f154502361af8cc32d361a9ce5f45.
+- Red head/tested tree: 1d3c026117436bc6ab56eca0f2be76a0bd451b61.
+- Corrected green head: 05be6d98211d7fdc043d173da8f661bbb51e0138.
+- Green tested merge: 6112ba2128676b403cee6ba8bc7856d724e6032b.
+- Green head/tested/local staged tree: b33ee55c8c1c9b9780e3028f9e84e5a1a400c524.
+
+Corrected source SHA-256:
+- src/omega_gpu_cmdlist.c: 54382d74a46109f8aeb0f8d57f8388f78a1007aab8de57fe23540d3504c13e8a.
+- tests/test_omega_gpu_session_platform.c: 34d6d8f7f0c18075f5a819079be0c38e5903c654ae5ea279df6c990f07aa7441.
+
+This filing commit changes only this receipt. The evidence above stays bound to
+the stated source commit, not relabeled as execution of a later commit.
+
+## Executed command and environment
+
+Both public CI jobs execute the existing `make test` aggregate.
+GitHub-hosted Linux AArch64, image `ubuntu-24.04-arm`.
+Green image version: 20261025.165.1.
+Green compiler: gcc (Ubuntu 13.3.0-6ubuntu2~24.04.1) 13.3.0.
+
+Existing pinned tools, unchanged by this repair:
+- Omega e5b32567a7aff3ce594e3254a622a846a6cd190b.
+- omc SHA-256 2c82480596bbdc50cda9626866209ef662d5834f278f839ff4ce0250c495029f.
+- Bridge 0c4cb9ff980af278890b231b994eaede4dc7621c.
+
+The fixture links the fake platform and real session/command-list code, not the
+Linux device platform. No GPU is opened. A one-shot fake-lock contender runs
+actual close or recovery before granting the creation lock. It does not mutate
+lifetime counters directly.
+
+## Red before correction
+
+[Raw job log](https://github.com/aien-dev/CUDApp/actions/runs/40746597320/job/123021914410),
+completed 18:49:38 UTC.
+
+Production code was unchanged. Both creation cases failed exactly the real
+owner/add usability assertions; the later-close refusal control passed:
+
+```
+FAIL CMDLIST_CREATE_AFTER_LOCK_PRECEDING_CLOSE_IS_USABLE
+FAIL CMDLIST_CREATE_AFTER_LOCK_PRECEDING_RECOVERY_IS_USABLE
+PASS CMDLIST_CLOSE_AFTER_CREATE_STILL_REFUSES_STALE_LIST
+test_omega_gpu_session_platform: 24 passed, 2 failed
+make: *** [mk/omega-gpu-engine.mk:227: test-gpu-native-runtime] Error 1
+```
+
+This is the expected regression failure, not a complete aggregate PASS.
+
+## Green after correction
+
+[Raw job log](https://github.com/aien-dev/CUDApp/actions/runs/40749378141/job/123031642436),
+completed 19:11:11 UTC.
+
+Only the two existing epoch/recovery captures moved into the locked successful
+creation block, with an explanatory comment. The tests were unchanged.
+
+```
+PASS CMDLIST_CREATE_AFTER_LOCK_PRECEDING_CLOSE_IS_USABLE
+PASS CMDLIST_CREATE_AFTER_LOCK_PRECEDING_RECOVERY_IS_USABLE
+PASS CMDLIST_CLOSE_AFTER_CREATE_STILL_REFUSES_STALE_LIST
+test_omega_gpu_session_platform: 26 passed, 0 failed
+CUDA++ HOST TESTS PASS (52 targets)
+```
+
+Make exited zero. All 14 visible check rows across 9 workflow runs succeeded on
+this head. This count is not a claim about uninspected branch-protection rules.
+Zero-CUDA controls, generated-unit byte regeneration and all seven portable
+receipt checks also passed in the aggregate.
+
+## Local limits and review
+
+On the separate Linux x86_64 review executor, strict source/fixture syntax checks
+and `git diff --check` passed. Both final-tree `make test` and `make -j2 all`
+exited 2 at existing ARM `dsb` assembly in engine/submit code. No local native
+execution PASS is claimed and no shim or test gate was weakened.
+
+An independent read-only agent reviewed both the test-only diff and the minimal
+production correction. It found no blocker; its review was source-only, not an
+additional execution receipt. The negative later-close control still verifies
+stale-list refusal. Failure cleanup and public interfaces are unchanged.
+
+No hardware/model/service operation, merge, deployment, settings or qualification
+authority change was performed. Connector-created commits are unsigned and have
+no DCO certification. Maintainer review and signing policy remain separate.
diff --git a/src/omega_gpu_cmdlist.c b/src/omega_gpu_cmdlist.c
index bc5caf51..6fadab9d 100644
--- a/src/omega_gpu_cmdlist.c
+++ b/src/omega_gpu_cmdlist.c
@@ -175,8 +175,6 @@ int omega_gpu_cmdlist_create(uint32_t cap, OmegaGpuCmdList **out) {
     OmegaGpuCmdList *cl = omega_gpu_host_calloc(1, sizeof *cl);
     if (!cl) return -1;
     cl->cap = cap;
-    cl->gen = omega_gpu_session_recoveries();
-    cl->epoch = omega_gpu_session_epoch();
     cl->record_generation = next_record_generation(0);
     if (!cl->record_generation) { omega_gpu_host_free(cl); return -1; }
     cl->words_cap = RING_WORDS;
@@ -195,6 +193,9 @@ int omega_gpu_cmdlist_create(uint32_t cap, OmegaGpuCmdList **out) {
         rc = -1;
     if (rc == 0 && build_nop(cl) != 0) { omega_gpu_session_set_error("cmdlist create: nop kernel"); rc = -1; }
     if (rc == 0) {
+        /* Bind lifetime to the locked session that allocated these buffers. */
+        cl->gen = omega_gpu_session_recoveries();
+        cl->epoch = omega_gpu_session_epoch();
         memset(cl->scratch.cpu, 0, 0x4000);
         if (omega_gpu_session_sync_to_gpu(&cl->scratch) != 0) rc = -1;
     }
diff --git a/tests/device-trace/.crumb b/tests/device-trace/.crumb
index 07c43ab8..9d64c2ec 100644
--- a/tests/device-trace/.crumb
+++ b/tests/device-trace/.crumb
@@ -3,14 +3,14 @@
     "generated": {
       "children": [],
       "children_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
-      "compiled_at": "2026-10-27T04:08:34Z",
+      "compiled_at": "2026-10-29T02:02:25Z",
       "compiler": "crumb-compile/1",
-      "digest": "sha256:1bba3fb571a195355e1a3958c9e025fb16f14ec330b7e218cc4f7dc5b5aadbff",
+      "digest": "sha256:74aa46b27c4f1dc9dadcae12a340dff3d133c437b35adff11436c08adee3c6b4",
       "evidence_files": 0,
       "evidence_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
-      "files": 10,
-      "generated_at_commit": "75e23ae20425ca6539960bb62f2bf3fcc8d676a8",
-      "source_tree": "sha256:1641f2b1757798a14705225dd58ff5c2af3cab7f28b30e14dd781af24def3fe0"
+      "files": 11,
+      "generated_at_commit": "c10b283de2b066c277feaba75bbc436bc36ea2ec",
+      "source_tree": "sha256:86a7e359e9b24d3adcee74e7725be204cf823aaaa5b31ba2b90908f9166016ff"
     }
   },
   "invariants": [
diff --git a/tests/moe/.crumb b/tests/moe/.crumb
index 6dfd3dae..afa95484 100644
--- a/tests/moe/.crumb
+++ b/tests/moe/.crumb
@@ -3,14 +3,14 @@
     "generated": {
       "children": [],
       "children_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
-      "compiled_at": "2026-10-28T12:16:22Z",
+      "compiled_at": "2026-10-29T02:02:50Z",
       "compiler": "crumb-compile/1",
-      "digest": "sha256:f5236b5fc39629c6c5052d69fcb7de066ab1a5f2d9c28e63d36510fa919db75b",
+      "digest": "sha256:a530bb9ed36c79924ea6964f0a16a2a5c9d31a74601e9ee9d592305604916335",
       "evidence_files": 0,
       "evidence_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855",
       "files": 6,
-      "generated_at_commit": "018fd1a7ef819e6f21775c637be27100c3fe7562",
-      "source_tree": "sha256:1a7bfa66193411b2203408935a354bc6c1a98c55eb3a43df28e8a284c07aecf1"
+      "generated_at_commit": "3c08b264e0c4931dbdc494b0d635edf7c912250f",
+      "source_tree": "sha256:14e853877be4db965553f24e27ebf7f757c4200f8b08a9109e0062aba054ab90"
     }
   },
   "name": "moevf",
diff --git a/tests/moe/run.sh b/tests/moe/run.sh
index fdcc6bf0..83e9ad8b 100755
--- a/tests/moe/run.sh
+++ b/tests/moe/run.sh
@@ -12,7 +12,8 @@ ROOT=$(CDPATH= cd -- "$(dirname "$0")/../.." && pwd)
 T=$(mktemp -d)
 trap 'rm -rf "$T"' EXIT HUP INT TERM
 OMEGA_UNITS="om/moe/moe_plan.om om/moe/moe_group.om om/moe/moe_ids32.om om/moe/moe_maps32.om om/moe/moe_segs32.om om/moe/moe_windows.om tests/moe/moe_verify.om" OMEGA_UNITS_DEST="$T" sh "$ROOT/om/units.sh"
-${CC:-cc} -std=c11 -O2 -Wall -Wextra -Werror -ffunction-sections -fdata-sections -I"$ROOT/src" -c "$ROOT/tests/moe/incumbent.c" -o "$T/incumbent.o"
+# The included canonical graph uses the same GNU/POSIX interfaces as the main build.
+${CC:-cc} -std=gnu11 -O2 -Wall -Wextra -Werror -ffunction-sections -fdata-sections -I"$ROOT/src" -c "$ROOT/tests/moe/incumbent.c" -o "$T/incumbent.o"
 ${CC:-cc} -std=c11 -O2 -Wall -Wextra -Werror -I"$T" "$ROOT/tests/moe/caller.c" "$T/cudapp_om_units.c" "$T/incumbent.o" -Wl,--gc-sections -o "$T/moe-test"
 "$T/moe-test"
 cat "$QUANT_ROOT/om/quant/quant.om" "$COMPOSE_ROOT/om/components/realize.om" "$CACHE_ROOT/om/cache/digest.om" "$CACHE_ROOT/om/cache/residency.om" "$PIPELINE_ROOT/om/pipeline/select.om" "$PIPELINE_ROOT/om/pipeline/graph.om" "$ROOT/om/moe/moe_group.om" "$ROOT/om/moe/moe_admit.om" "$PIPELINE_ROOT/tests/pipeline/fixture.om" "$ROOT/tests/moe/admit-caller.om" > "$T/admit.om"
diff --git a/tests/test_omega_gpu_session_platform.c b/tests/test_omega_gpu_session_platform.c
index 16dfd683..ebbf7be4 100644
--- a/tests/test_omega_gpu_session_platform.c
+++ b/tests/test_omega_gpu_session_platform.c
@@ -54,6 +54,7 @@ static struct {
     uint64_t ns;
     unsigned allocs, frees, free_refusals, submits, polls, retires, syncs, irq_calls, dev_opens, dev_closes;
     unsigned locks_held;
+    void (*before_lock)(void); /* one contender completes before the fake lock is granted */
     unsigned cached_requests; /* buffers asked GPU-cached (must stay 0) */
     unsigned allocs_unlocked; /* allocations without the session lock (must stay 0) */
     int fail_open;
@@ -63,7 +64,15 @@ static struct {
 static uint64_t f_now_ns(void *c) { (void)c; fk.ns += 1000u; return fk.ns; }
 static uint64_t f_now_ms(void *c) { return f_now_ns(c) / 1000000u; }
 static int f_wait(void *c, uint64_t ms) { (void)c; fk.ns += ms * 1000000u; return 0; }
-static int f_lock(void *c, uint32_t id) { (void)c; if (id != OMEGA_GPU_SESSION_LOCK_ID) return OMEGA_GPU_PLAT_REFUSED_ARGS; fk.locks_held++; return 0; }
+static int f_lock(void *c, uint32_t id) {
+    (void)c;
+    if (id != OMEGA_GPU_SESSION_LOCK_ID) return OMEGA_GPU_PLAT_REFUSED_ARGS;
+    void (*before_lock)(void) = fk.before_lock;
+    fk.before_lock = NULL;
+    if (before_lock) before_lock();
+    fk.locks_held++;
+    return 0;
+}
 static int f_unlock(void *c, uint32_t id) { (void)c; if (id != OMEGA_GPU_SESSION_LOCK_ID || !fk.locks_held) return OMEGA_GPU_PLAT_REFUSED_ARGS; fk.locks_held--; return 0; }
 static const char *f_diag(void *c) { (void)c; return fk.fail_open ? "fake device: no GB10 here" : ""; }
 
@@ -624,6 +633,62 @@ static void c_fmt_matches_snprintf(void) {
 #ifdef OMEGA_NATIVE_RUNTIME_TEST
 #include "native_runtime_controls.h"
 
+static void recover_before_cmdlist_lock(void) {
+    omega_gpu_session_note_module_latch();
+    EXPECT(omega_gpu_session_recover() == 0);
+}
+
+static void cmdlist_create_lifetime(void (*before_lock)(void)) {
+    fk_reset();
+    EXPECT(install() == 0);
+    omega_gpu_session_lock();
+    EXPECT(omega_gpu_session_open() != NULL);
+    const uint64_t previous_epoch = omega_gpu_session_epoch();
+    omega_gpu_session_unlock();
+
+    /* Model a close/recovery winning the lock immediately before create.
+     * The hook runs real session teardown, not a fabricated epoch value. */
+    fk.before_lock = before_lock;
+    OmegaGpuCmdList *cl = NULL;
+    EXPECT(omega_gpu_cmdlist_create(1, &cl) == 0);
+    if (!cl) return;
+    EXPECT(fk.before_lock == NULL);
+    EXPECT(fk.dev_closes == 1 && fk.dev_opens == 2);
+    EXPECT(omega_gpu_session_epoch() != previous_epoch);
+    omega_gpu_session_lock();
+    OmegaGpuCmdListOwner owner;
+    EXPECT(omega_gpu_cmdlist_owner(cl, &owner) == 0);
+    OmegaGpuLaunch launch = launch_desc(100);
+    EXPECT(omega_gpu_cmdlist_add(cl, &launch) == 0);
+    omega_gpu_session_unlock();
+    omega_gpu_cmdlist_free(cl);
+    omega_gpu_session_close();
+}
+
+static void c_cmdlist_create_after_close(void) {
+    cmdlist_create_lifetime(omega_gpu_session_close);
+}
+
+static void c_cmdlist_create_after_recovery(void) {
+    cmdlist_create_lifetime(recover_before_cmdlist_lock);
+}
+
+static void c_cmdlist_close_after_create_stale(void) {
+    fk_reset();
+    EXPECT(install() == 0);
+    OmegaGpuCmdList *cl = NULL;
+    EXPECT(omega_gpu_cmdlist_create(1, &cl) == 0);
+    if (!cl) return;
+    omega_gpu_session_close();
+    omega_gpu_session_lock();
+    OmegaGpuCmdListOwner owner;
+    EXPECT(omega_gpu_cmdlist_owner(cl, &owner) != 0);
+    OmegaGpuLaunch launch = launch_desc(100);
+    EXPECT(omega_gpu_cmdlist_add(cl, &launch) != 0);
+    omega_gpu_session_unlock();
+    omega_gpu_cmdlist_free(cl);
+}
+
 static void native_pair_visibility(unsigned missing) {
     fk_reset();
     g_caps.max_queues = 2;
@@ -662,6 +727,9 @@ static void c_native_pair_missing_b(void) { native_pair_visibility(2); }
 typedef struct { const char *id; void (*fn)(void); } Case;
 static const Case CASES[] = {
 #ifdef OMEGA_NATIVE_RUNTIME_TEST
+    {"CMDLIST_CREATE_AFTER_LOCK_PRECEDING_CLOSE_IS_USABLE", c_cmdlist_create_after_close},
+    {"CMDLIST_CREATE_AFTER_LOCK_PRECEDING_RECOVERY_IS_USABLE", c_cmdlist_create_after_recovery},
+    {"CMDLIST_CLOSE_AFTER_CREATE_STILL_REFUSES_STALE_LIST", c_cmdlist_close_after_create_stale},
     {"NATIVE_SYNTHETIC_QUANT_COMPOSE_ENCODE_CACHE_SELECT_RECORD", c_native_chain},
     {"NATIVE_TIMEOUT_RETAINS_CODE_UNTIL_CONFIRMED_TEARDOWN", c_native_timeout_refs},
     {"NATIVE_NORMAL_CLOSE_INVALIDATES_EXACT_LEASE", c_native_close_epoch},