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/f129b35ca048cade # 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 ## fix(runtime): snapshot command-list lifetime under the session lock closed `f129b35ca048cade` #174 · opened 2026-10-28 18:35 UTC · closed 2026-10-29 02:18 UTC Imported from GitHub aien-dev/CUDApp#174, by drakestapleton Base `c6977b4906229fe83f41103b7eff65b64a0986d6` · Head `8cd1c912e8c7a68b7adcca75c6f71d1652401a54` drakestapleton wrote on 2026-10-28 18:35 UTC ## Executed red-before evidence Base: `c6977b4906229fe83f41103b7eff65b64a0986d6` (#169). Regression-only head `3a3cd76f738967a133007da66807986431e91564` left production unchanged. Its tested synthetic merge `504197eec17f154502361af8cc32d361a9ce5f45` has the identical tree `1d3c026117436bc6ab56eca0f2be76a0bd451b61`. Existing GitHub-hosted ARM `make test` job `123021914410` completed with the intended failure at 18:49:38 UTC: - Both new close-before-lock and recovery-before-lock cases failed exactly the real `omega_gpu_cmdlist_owner` and `omega_gpu_cmdlist_add` usability assertions. - The later-close stale-list refusal control passed. - Native suite: 24 passed, 2 failed. Make failed at `test-gpu-native-runtime`; this is not a full-suite PASS. ## Minimal correction, executed green-after evidence Corrected source head: `05be6d98211d7fdc043d173da8f661bbb51e0138`. The second commit moves only the two existing epoch/recovery-generation captures into the existing successful-create block while the session lock is held. It does not replace policy or add a production test hook. History is preserved. A permitted normal close or recovery could finish between the old pre-lock capture and acquisition; creation then allocated on the reopened session but returned an immediately stale list. `docs/runtime/API.md` says these calls self-lock and must be called without that lock. The new captures bind to the session that allocated the buffers. A genuinely later close still invalidates the list. Independent read-only review found no blocker in the tests or correction, including failure cleanup. Hosted ARM CI on the corrected source is now GREEN: job `123031642436` completed at 19:11:11 UTC with all three new controls passing, native fixture 26 passed, 0 failed, and CUDA++ HOST TESTS PASS (52 targets). All 14 visible checks and 9 workflows succeeded. The tested synthetic merge `6112ba2128676b403cee6ba8bc7856d724e6032b` has the exact corrected-source tree. Current filing head: `8cd1c912e8c7a68b7adcca75c6f71d1652401a54` adds only the required source-bound host receipt . It does not relabel earlier runs as execution of this filing commit. Its own complete CI is now GREEN too: job `123044991607` completed at 19:34:32 UTC, again with native fixture 26/0 and the 52-target aggregate. All 14 visible checks and 9 workflows succeeded. Tested synthetic merge `c12dfcd4055d0356370fa2189106fc5296659604` and the filing head share tree `7a19c14162ec6dd84fec9904a9ad78daa8873e98`. Code and tests remain unchanged from the first green source. ## Local checks and limits On Linux x86_64, strict `gcc -std=gnu11 -O2 -Wall -Wextra -Werror -Isrc -fsyntax-only src/omega_gpu_cmdlist.c`, both native-enabled and ordinary fixture syntax checks, and `git diff --check` exit 0. Final-tree local `make test` and `make -j2 all` both exit 2 at existing ARM `dsb` assembly in the engine/submit sources. No unsupported architecture shim or gate weakening is used. Functional red/green evidence is from the separately identified hosted ARM runner, not local execution. The committed receipt preserves both outcomes, exact source hashes and the raw workflow links. The existing fake-platform regression models a lock contender that executes real close/recovery before granting the creation lock. It checks owner/add usability and stale refusal, not actual multithreaded scheduling, submission completion or GB10 qualification. No GPU is opened by the fixture. ## Ownership and scope Claim: https://github.com/aien-dev/CUDApp/pull/169#issuecomment-`6477307591` . No overlapping epoch repair was found. Main/NativeIntegrate retains integration ownership. Component capacity #173 and MMIO #172 are separate owner work and are untouched. No public API, generated unit, encoder, artifact authority, qualification or production-activation change. No device, model, service, merge, deployment, settings or webhook operation. Connector commits are unsigned and have no DCO certification; maintainer signing gates remain intact. Keep draft for maintainer disposition and signing policy. These host results do not satisfy any separate required hardware qualification or authorize merge/activation. ### Apply it ``` git checkout -b patch-f129b35ca048cade c6977b4906229fe83f41103b7eff65b64a0986d6 curl -fsSL https://interplane.io/drakestapleton/CUDApp/patches/f129b35ca048cade.patch | git am ``` Raw patch (mbox) · 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 174 8cd1c912e8c7a68b7adcca75c6f71d1652401a54 ``` ``` {"kind":"github-import","owner":"aien-dev","repo":"CUDApp","number":174,"url":"https://github.com/aien-dev/CUDApp/pull/174","export_sha256":"0aafd51b77ff5776d6baaf9b88b48c8b36a6e27c8d829ae8ded561b71712b17a","imported_utc":"2026-11-18T16:38:27Z"} ``` ### 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 @@ + +# 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}, ```