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/df41debf690d824d # 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 ## prefill: make scoped-check independent of argument evaluation order (x86 fix for #280) merged `df41debf690d824d` #374 · opened 2026-11-07 08:09 UTC · closed 2026-11-15 14:36 UTC · merged 2026-11-15 14:36 UTC Imported from GitHub aien-dev/CUDApp#374, by drakestapleton Base `d4daaa3557c979d8212a6488e939fe2ce52ede4f` · Head `9bbae83bccd1f1968bd2e34f10a4502d60210a58` Merged on GitHub as `45e41c72852ee148047be95f5c480ee4897feda1`; reachable from main `21d8de285f713adf09e0d6ba6db2b37139d0674e` (observed 2026-11-18T16:38:18Z) drakestapleton wrote on 2026-11-07 08:09 UTC ## Fix the x86 `test-prefill-scoped` failure on #280 (`integ/omega-cuda-stack` @ `d4daaa35`) This PR is stacked on #280. Its base branch, `integ/omega-cuda-stack`, belongs to owner card t_`f61d4d28` on the aien-hive board, which is currently blocked. That card has been told about this fix. This PR changes only `om/prefill-shape/scoped-check.c` and its `.crumb`. ### Failure From x86 job log `128292427030` (x86-host-tests). The same failure appears in `128292481913` (native-x86-host): ``` /home/runner/work/CUDApp/CUDApp/build/prefill-scoped-check scoped call reached its own kernel key scoped call reached its own kernel key scoped call reached its own kernel key scoped qgemm isolation: FAIL make: *** [mk/prefill-shape.mk:34: test-prefill-scoped] Error 1 ``` ### Root cause `scoped-check.c:37` called `scoped()` and read the `opened` and `keyed` counters it changes, all as arguments of one `so_all(...)` call: ``` check(so_all(so_eq(scoped(rt,group), TOO_LARGE), so_eq(opened,1), so_eq(keyed,1)), "..."); ``` C leaves the order of evaluating function arguments unspecified. I compiled the file at `d4daaa35` to assembly with `-std=gnu11 -O2 -D_GNU_SOURCE -Isrc -S`: - x86_64-linux-gnu-gcc 13: in `main`, it stores 0 to `keyed` and `opened`, loads `opened` and calls `omega_so_oracles`. Only after that does it call `omega_gpu_pf_qgemm_scoped`. The counters are read as 0, so the check fails on x86. - aarch64 cc 13.3: it calls `omega_gpu_pf_qgemm_scoped` (`bl`) before the oracle calls that read the counters, so the check passes on arm. Line 54 had the same shape. It happened to pass because the expected counters there are 0. ### Fix Each return code is now computed in its own statement (`int src=scoped(rt,group);` and `int brc=scoped(8,6);`) before `check()` runs. In the x86 `-S` output of the patched file, `call omega_gpu_pf_qgemm_scoped@PLT` now comes before the `opened(%rip)` and `keyed(%rip)` loads. ### Scan for the same pattern I checked two sets of sites: - every `so_all`/`so_any` site in `om/` and `tools/`; - every line in the `__wrap_` tests that reads a counter (the `om/` checks, `tests/dagsim`, `tests/gpu_*`, `tests/native_artifact_manifest_test.c`, `tests/test_model_graphs_*`, `tests/test_omega_gpu_platform_linux.c` and `tools/own30b_decode_profile.c`). No other instance exists. Every other site either reads its counters in a separate statement or uses `&&`/`||`, which fix the order. ### Directive label This is a minimal migration fix to an existing C test. Its `.om` successor is scoped-check as an `.om` test under `om/prefill-shape`, tracked under DRA-154. ### Evidence - `crumb compile .` rewrote `om/prefill-shape`, and `crumb verify .` reports `OK: 92 crumbs current`. - arm `make test-prefill-scoped` (core 18): see the comment below. - x86: shown by the x86-host-tests and native-x86-host jobs on this PR's head. Until they pass, x86 is NOT_RUN. Agent: D8Finish366 (omp subagent of omp-queen-spark) drakestapleton wrote on 2026-11-07 08:10 UTC arm evidence on spark, core 18, at `9bbae83b`: `make test-prefill-scoped` exited 0. The mutant lines were `ignore_scoped_options: caught`, `leak_options_to_global: caught` and `wrong_tile_height: caught`. `build/prefill-scoped-check` printed `scoped qgemm isolation: PASS` with rc=0. x86 is NOT_RUN until the x86-host-tests and native-x86-host jobs on this head finish. ### Apply it ``` git checkout -b patch-df41debf690d824d d4daaa3557c979d8212a6488e939fe2ce52ede4f curl -fsSL https://interplane.io/drakestapleton/CUDApp/patches/df41debf690d824d.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 374 9bbae83bccd1f1968bd2e34f10a4502d60210a58 ``` ``` {"kind":"github-import","owner":"aien-dev","repo":"CUDApp","number":374,"url":"https://github.com/aien-dev/CUDApp/pull/374","export_sha256":"0aafd51b77ff5776d6baaf9b88b48c8b36a6e27c8d829ae8ded561b71712b17a","imported_utc":"2026-11-18T16:38:18Z"} ``` ### Changes ``` diff --git a/om/prefill-shape/.crumb b/om/prefill-shape/.crumb index 0ab8d560..17648801 100644 --- a/om/prefill-shape/.crumb +++ b/om/prefill-shape/.crumb @@ -3,14 +3,14 @@ "generated": { "children": [], "children_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", - "compiled_at": "2026-11-06T12:54:44Z", + "compiled_at": "2026-11-07T08:08:03Z", "compiler": "crumb-compile/1", - "digest": "sha256:27423bc28e80b9b7a73f29238db49e7610b8049a123a663e4d21ab11c1de575a", + "digest": "sha256:0c17d933eeb407f349271c4cd0c419b6adc64b8917b19c1dc955dddb6cdb4761", "evidence_files": 0, "evidence_root": "sha256:e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855", "files": 29, - "generated_at_commit": "b7a56718ba8b3695af27779816536451e5bbb412", - "source_tree": "sha256:65fe631f3c501685256b473f1802bb6a1ff4701e4ccc417e8de6435baf245901" + "generated_at_commit": "d4daaa3557c979d8212a6488e939fe2ce52ede4f", + "source_tree": "sha256:9bf0b0fc1865dbc051da09fe70668526102597f31e1b8dd172deee223c06533f" } }, "layer": "native-policy", diff --git a/om/prefill-shape/scoped-check.c b/om/prefill-shape/scoped-check.c index 5c1108ac..5004108c 100644 --- a/om/prefill-shape/scoped-check.c +++ b/om/prefill-shape/scoped-check.c @@ -34,7 +34,8 @@ int main(void) { for(unsigned i=0;i<3;i++) { unsigned rt=(unsigned)so_call(41,so_eq(i,1),8,4,0),group=(unsigned)so_call(41,so_eq(i,1),4,0,0); expect(rt,8,group,0); - check(so_all(so_eq((uint64_t)(int64_t)scoped(rt,group),(uint64_t)(int64_t)OMEGA_GPU_PF_TOO_LARGE),so_eq(opened,1),so_eq(keyed,1)),"scoped call reached its own kernel key"); + int src=scoped(rt,group); + check(so_all(so_eq((uint64_t)(int64_t)src,(uint64_t)(int64_t)OMEGA_GPU_PF_TOO_LARGE),so_eq(opened,1),so_eq(keyed,1)),"scoped call reached its own kernel key"); expect(2,4,1,1); int rc=omega_gpu_pf_qgemm(256,128,OMEGA_GPU_PF_PLAIN,16,1,0,32,48,64,NULL); check(so_all(so_eq((uint64_t)(int64_t)rc,(uint64_t)(int64_t)OMEGA_GPU_PF_TOO_LARGE),so_eq(opened,1),so_eq(keyed,1)),"legacy settings unchanged after scoped call"); @@ -51,7 +52,8 @@ int main(void) { check(so_eq(omega_gpu_pf_qgemm_reading_option(0,0),UINT32_MAX),"zero reading rows refused"); check(so_eq(omega_gpu_pf_qgemm_reading_option(64,4),UINT32_MAX),"unknown reading option refused"); expect(8,8,6,0); - check(so_all(so_eq((uint64_t)(int64_t)scoped(8,6),(uint64_t)(int64_t)OMEGA_GPU_PF_BAD_ARGS),so_eq(opened,0),so_eq(keyed,0)),"invalid options refused before device access"); + int brc=scoped(8,6); + check(so_all(so_eq((uint64_t)(int64_t)brc,(uint64_t)(int64_t)OMEGA_GPU_PF_BAD_ARGS),so_eq(opened,0),so_eq(keyed,0)),"invalid options refused before device access"); omega_gpu_pf_qgemm_set_shape(0,0,0);omega_gpu_pf_qgemm_set_group(0);omega_gpu_pf_qgemm_test_set_mutant(0); printf("scoped qgemm isolation: %s\n",failed?"FAIL":"PASS");return failed?1:0; } ```