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 @@ + +# 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/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},