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.
fix: preserve grid A/B failure status and clarify seed/OSC IR boundary
mergedab3887f530136bed #152 · opened 2026-10-27 20:10 UTC · closed 2026-10-29 01:33 UTC · merged 2026-10-29 01:33 UTC
Imported from GitHub aien-dev/CUDApp#152, by drakestapleton
Labels: ready-to-merge
Base 5b91c6a66595a0d876831107d6a7c8a4872f7d54 · Head 16a605617345b99625db2db5b9572ec8cae1b2b3
Merged on GitHub as 4553b4f0f0b5f7778b361d1285d7f3aff91796e9; reachable from main 21d8de285f713adf09e0d6ba6db2b37139d0674e (observed 2026-11-18T16:38:27Z)
drakestapleton wrote on 2026-10-27 20:10 UTC
Evidence
Head 16a605617345b99625db2db5b9572ec8cae1b2b3, based on main 5b91c6a66595a0d876831107d6a7c8a4872f7d54. Published tree 3ee68a40f2bff60dd841bb1045c3196ab994326d exactly matches the independently reviewed local tree.
Local isolated main-dispatch/parser probe: baseline empty list printed PASS and returned 0; the new regression failed. Patched probe passes all five invalid lists; a stubbed early setup failure preserves exit 1. This is host-only extracted-source coverage with nondelegating stubs, not the full executable.
sh -n tests/grid_ab_exit_test.sh and git diff --check: PASS.
Full local make test: exit 2 on x86_64, unchanged AArch64 assembler instructions at src/omega_blackwell_engine.c:393,558 (number of operands mismatch for ds). Real executable verification awaits ARM64 CI, where this regression is included in the existing test-gpu-fp8 host target.
Independent review: no blocking findings. Invalid test lists stop before command-list creation; session spin configuration only stores a setting.
Repair
grid_ab returns 2 for malformed lists and 1 for an early setup error, before CHECK necessarily increments g_failed. Main discarded that return, printed PASS and returned 0. Preserve its nonzero status after session cleanup and do not print a false PASS.
Also clarify that E3 (omega-mv#883) describes OSC IRv7, not the seed omc SPIR-V path used by #138. No capability upgraded.
Refs #137 and #138. No overlap with #148's output-file changes. No kernel, public API, historical receipt, gate weakening, GPU experiment, merge or deployment. Valid benchmark receipts are unchanged. Review-ready means ready for maintainer review, not qualified or authorized to merge.
Exact-head CI follow-up
All 14 observed check runs completed successfully at head 16a605617345b99625db2db5b9572ec8cae1b2b3, including CodeQL and the ARM64 host suite. CI run 40575725652, host job 122441511281, finished the suite at 2026-10-27 20:23:37 UTC with CUDA++ HOST TESTS PASS (49 targets).
The job checked out synthetic merge c2ffe00939711c880b6aa733511e19b66f2899b3. Its complete tree is 3ee68a40f2bff60dd841bb1045c3196ab994326d, byte-identical to this reviewed PR head. The new invalid-list regression is a mandatory recipe in test-gpu-fp8, included in the successful suite. CI retains only the last 20 make-log lines, so the individual regression PASS line is not retained in the public job log; the successful full make target and inspected recipe establish integration coverage, not a separately retained per-case receipt.
These are host/simulator and binding checks. No GB10 run, merge, deployment or qualification was performed.
Apply it
git checkout -b patch-ab3887f530136bed5b91c6a66595a0d876831107d6a7c8a4872f7d54
curl -fsSL https://interplane.io/drakestapleton/CUDApp/patches/ab3887f530136bed.patch | git am
diff --git a/Makefile b/Makefile
index e3b39121..30e883d9 100644
--- a/Makefile
+++ b/Makefile
@@ -184,6 +184,7 @@ GPU_FP8_TEST = $(OUT_DIR)/gpu_fp8_api_test
$(GPU_FP8_TEST): tests/gpu_fp8_api_test.c tests/bw_warp_sim.h src/omega_gpu_fp8_api.h src/omega_blackwell_codegen_moe.h $(OUT_DIR)/libomega_gpu.a
$(CC) $(CFLAGS) -ffp-contract=off -Itests -o $@ tests/gpu_fp8_api_test.c $(OUT_DIR)/libomega_gpu.a -lpthread -lm
test-gpu-fp8: $(GPU_FP8_TEST)
+ sh tests/grid_ab_exit_test.sh ./$(GPU_FP8_TEST)
./$(GPU_FP8_TEST) --host-only
./$(GPU_FP8_TEST) --sim
diff --git a/docs/ARCHITECTURE.md b/docs/ARCHITECTURE.md
index b3575901..788f16e5 100644
--- a/docs/ARCHITECTURE.md
+++ b/docs/ARCHITECTURE.md
@@ -98,7 +98,7 @@ moves. All of it is seeded Omega except one migration-pending C launcher.
|---|---|---|
| Target table, one row per GPU family; `make doctor OMC=…` prints it | `backend/targets.om` (`targets doctor`) | IMPLEMENTED. GB10 (sm_121) SUPPORTED; every other GPU row PLANNED, hardware NOT_RUN; PoCL and lavapipe rows are HOST-ONLY (not a GPU) |
| Code-object loader checks for `ob_code_load` | `backend/targets.om` (`targets load FORMAT FILE [ENTRY or gfx]`) | IMPLEMENTED: SPIR-V header, instruction stream, capability/addressing/memory model per environment, entry point; HSACO ELF64, HSA OSABI with code object v4/v5, EM_AMDGPU, e_flags mach, PT_NOTE NT_AMDGPU_METADATA msgpack (`amdhsa.target`, `amdhsa.version`, `amdhsa.kernels`); SM121_RAW shape. MSL_SOURCE and AARCH64 refused (PLANNED), CUBIN refused (reserved) |
-| SPIR-V builder: FP32 vadd and FP32 16-term sum (`fsum16`), OpenCL and Vulkan forms, plus planted-wrong mutants | `backend/spirv/emit.om` | IMPLEMENTED; every module passes `spirv-val`. Hand-built words because omc IR mode has no floats yet (E3, omega-mv#883) |
+| SPIR-V builder: FP32 vadd and FP32 16-term sum (`fsum16`), OpenCL and Vulkan forms, plus planted-wrong mutants | `backend/spirv/emit.om` | IMPLEMENTED; every module passes `spirv-val`. Hand-built words because the pinned seed omc IR mode lacks the needed floating-point operations. E3 (omega-mv#883) tracks OSC IRv7, a separate compiler path; it does not by itself enable this seed SPIR-V path |
| Host reference and bit compare | `backend/spirv/conform.om` | IMPLEMENTED; vadd reference digest equals `hello_gpu --sim` output digest |
| Launcher that hands a module to PoCL (CPU) or Mesa lavapipe (CPU) | `tools/multitarget/spirv-host.c` | migration-pending C, `CUDAPP_MIGRATION_PENDING_SPIRV_HOST` default OFF; reason: no checked shared-library call (E2, omega-mv#888); successors `backend/opencl/host.om`, `backend/vulkan/host.om` |
| gfx1151 vadd code object | `backend/amd/vadd-gfx1151.s` | ORACLE fixture assembled by `llvm-mc` + `ld.lld` to test the loader (see §6); not a first-party encoder |
diff --git a/evidence/GRID-AB-EXIT-20261027/README.md b/evidence/GRID-AB-EXIT-20261027/README.md
new file mode 100644
index 00000000..c08a2870
--- /dev/null
+++ b/evidence/GRID-AB-EXIT-20261027/README.md
@@ -0,0 +1,30 @@
+# Grid A/B exit status repair
+
+Base: `5b91c6a66595a0d876831107d6a7c8a4872f7d54`.
+
+The caller discarded `grid_ab`'s return value. Invalid lists returned 2
+before any CHECK, but main printed PASS and exited 0. Main now closes the
+session and preserves that nonzero status, without printing PASS.
+
+`sh tests/grid_ab_exit_test.sh ./build/gpu_fp8_api_test` checks empty,
+malformed, single-arm and malformed-later-arm lists. These inputs return
+before command-list creation. This regression runs in `make test` through
+`test-gpu-fp8`. It never intentionally opens a device.
+
+Local x86_64 validation:
+
+- An isolated probe compiled the unchanged main dispatcher and grid parser
+ from the source, with nondelegating stubs for dependencies. Baseline
+ empty-list output was `0 checks, 0 failed: PASS`, exit 0. The regression
+ failed as expected. With the patched dispatcher all invalid-list cases
+ passed. This is dispatcher coverage, not execution of the full binary.
+- `sh -n tests/grid_ab_exit_test.sh` and `git diff --check`: PASS.
+- `make test`: exit 2. The unchanged AArch64 instructions in
+ `src/omega_blackwell_engine.c:393,558` fail on this x86_64 assembler
+ (`number of operands mismatch for ds`). Full local suite NOT_RUN past
+ that compile failure. ARM64 CI is required for the real binary.
+- GPU execution, benchmark reruns, deployment and qualification: NOT_RUN.
+
+No kernel, runtime API or historical measurement changed. The separate
+documentation correction distinguishes seed omc IR from OSC IRv7 as
+specified in omega-mv issue 883; it does not upgrade either capability.
diff --git a/tests/gpu_fp8_api_test.c b/tests/gpu_fp8_api_test.c
index 21eb1adf..301437b3 100644
--- a/tests/gpu_fp8_api_test.c
+++ b/tests/gpu_fp8_api_test.c
@@ -1292,8 +1292,10 @@ int main(int argc, char **argv) {
if (budget) omega_gpu_fp8_set_cta_budget(budget);
if (depth_set) { omega_gpu_fp8_set_depth(1, depth); g_depth_forced = 1; }
(void)omega_gpu_session_set_spin_us(spin);
- if (grid_arms) grid_ab(grid_arms, reps ? reps : 1, seed); else chip_run(out_path, reps ? reps : 1);
+ int grid_rc = 0;
+ if (grid_arms) grid_rc = grid_ab(grid_arms, reps ? reps : 1, seed); else chip_run(out_path, reps ? reps : 1);
omega_gpu_session_close();
+ if (grid_rc) return grid_rc;
}
printf("gpu_fp8_api_test: %d checks, %d failed: %s\n", g_checks, g_failed, g_failed ? "FAIL" : "PASS");
return g_failed ? 1 : 0;
diff --git a/tests/grid_ab_exit_test.sh b/tests/grid_ab_exit_test.sh
new file mode 100644
index 00000000..9fd07f8b
--- /dev/null
+++ b/tests/grid_ab_exit_test.sh
@@ -0,0 +1,22 @@
+#!/bin/sh
+# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+# Invalid lists stop before command-list creation. No device is opened.
+set -eu
+binary=${1:?usage: grid_ab_exit_test.sh BINARY}
+tmp=$(mktemp -d)
+trap 'rm -rf "$tmp"' EXIT HUP INT TERM
+for arms in '' 'bad' '0:0' '0:0,bad' '0:0x,0:0'; do
+ rc=0
+ "$binary" --grid-ab "$arms" >"$tmp/output" 2>&1 || rc=$?
+ if [ "$rc" -ne 2 ]; then
+ cat "$tmp/output"
+ echo "FAIL: invalid grid list '$arms' returned $rc, expected 2" >&2
+ exit 1
+ fi
+ if grep -q ': PASS' "$tmp/output"; then
+ cat "$tmp/output"
+ echo 'FAIL: rejected grid list printed PASS' >&2
+ exit 1
+ fi
+done
+echo 'grid-ab invalid-list exit checks: PASS'