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.
prefill: make scoped-check independent of argument evaluation order (x86 fix for #280)
mergeddf41debf690d824d #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:
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.
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-df41debf690d824dd4daaa3557c979d8212a6488e939fe2ce52ede4f
curl -fsSL https://interplane.io/drakestapleton/CUDApp/patches/df41debf690d824d.patch | git am