From f818a897abeb1dfe6564d70bc198b75c6fccfe93 Mon Sep 17 00:00:00 2001 From: Drake Stapleton Date: Tue, 27 Oct 2026 03:07:30 -0500 Subject: [PATCH] fix: make chip helper validation fail closed Reject zero/invalid C4 run counts; acquire the L136 GB10 lock and propagate the first child failure. Add host-only dummy regressions without changing runtime C, existing gates, or hardware qualification. Published snapshot of local dd0ec80e1c6c4d1ddb84938a9dedc27815dc05c5; full tree equality verified. Source 742c453c4a62f1c47e97a1d3a802e278218d8cc8 was independently reviewed; host test receipt is included. --- .github/workflows/c4-streams.yml | 4 +- evidence/chip-helper-host-20261027/README.md | 78 ++++++++++ .../chip-helper-host-20261027/baseline.log | 76 +++++++++ .../chip-helper-host-20261027/make-test.log | 26 ++++ .../chip-helper-host-20261027/repaired.log | 14 ++ tests/test_chip_helpers.py | 144 ++++++++++++++++++ tools/c4_streams_chip.sh | 9 +- tools/l136_channel_gates.sh | 49 +++--- 8 files changed, 381 insertions(+), 19 deletions(-) create mode 100644 evidence/chip-helper-host-20261027/README.md create mode 100644 evidence/chip-helper-host-20261027/baseline.log create mode 100644 evidence/chip-helper-host-20261027/make-test.log create mode 100644 evidence/chip-helper-host-20261027/repaired.log create mode 100644 tests/test_chip_helpers.py diff --git a/.github/workflows/c4-streams.yml b/.github/workflows/c4-streams.yml index a3198cd3..8ee6a791 100644 --- a/.github/workflows/c4-streams.yml +++ b/.github/workflows/c4-streams.yml @@ -4,7 +4,7 @@ name: c4-streams on: pull_request: - paths: ['src/omega_gpu_cmdlist.*', 'src/omega_gpu_session.*', 'src/omega_gpu_platform_linux.*', 'nvrm/**', 'tests/gpu_streams_test.c', 'tests/gpu_isolation_test.c', 'tests/test_omega_gpu_session_platform.c', 'Makefile', 'mk/**', 'tools/c4_streams_chip.sh', '.github/workflows/c4-streams.yml'] + paths: ['src/omega_gpu_cmdlist.*', 'src/omega_gpu_session.*', 'src/omega_gpu_platform_linux.*', 'nvrm/**', 'tests/gpu_streams_test.c', 'tests/gpu_isolation_test.c', 'tests/test_omega_gpu_session_platform.c', 'tests/test_chip_helpers.py', 'Makefile', 'mk/**', 'tools/c4_streams_chip.sh', 'tools/l136_channel_gates.sh', '.github/workflows/c4-streams.yml'] workflow_dispatch: permissions: contents: read @@ -15,6 +15,8 @@ jobs: - uses: actions/checkout@v4 with: ref: ${{ github.event.pull_request.head.sha || github.sha }} + - name: Host-only helper regressions (dummy processes) + run: python3 tests/test_chip_helpers.py -v - run: make -j4 build/gpu_streams_test build/gpu_isolation_test - run: ./build/gpu_streams_test --host-only - run: ./build/gpu_streams_test --sim diff --git a/evidence/chip-helper-host-20261027/README.md b/evidence/chip-helper-host-20261027/README.md new file mode 100644 index 00000000..20d3daa8 --- /dev/null +++ b/evidence/chip-helper-host-20261027/README.md @@ -0,0 +1,78 @@ +# Chip-helper host-only repair: 2026-10-27 + +## Identity and scope + +- Baseline: `9841bb3a5dfbde1c7bf7741fd2fceb916962c8cb` (merged #113). +- Tested local source commit: `742c453c4a62f1c47e97a1d3a802e278218d8cc8`. +- Tested source tree: `71ccf551d494dd70b744feecc66c3214850067fc`. +- Machine: Linux 6.18.55, x86_64; Python 3.12.14; GCC 14.2.0. +- Only shell orchestration, its host tests, and CI wiring changed. No C or + Omega runtime implementation, instruction encoding, or hardware result changed. +- Existing C4 chip receipts remain immutable. This is not GPU qualification. + +## Reproduction and results + +Every executable child in the regression suite is a temporary dummy script. +Each lock is an isolated temporary file. Contention uses real Linux `flock`; +a test-only PATH shim makes the production wait nonblocking, without changing +production locking or opening the GB10 lock. No GPU device was opened. + +1. Copy the two baseline helper blobs with `git show + 9841bb3a5dfbde1c7bf7741fd2fceb916962c8cb:tools/` into a temporary + `tools/` directory, then run `CUDAPP_CHIP_HELPER_ROOT= + python3 tests/test_chip_helpers.py -v`. + **Expected FAIL**, exit 1: 9 tests, 7 failing assertions/subtests + (`baseline.log`). These expose zero/empty counts, missing locking, + contention admission, and suppressed early/late child failures. +2. At the tested source commit, `python3 tests/test_chip_helpers.py -v`: + **PASS**, exit 0, 9 tests (`repaired.log`). Positive controls keep the + default 10 runs, requested count, complete 11-command success path, + channel environment, failure rejection, and missing-verdict rejection. +3. `sh -n tools/c4_streams_chip.sh tools/l136_channel_gates.sh`: + **PASS**, exit 0. `git diff --check`: **PASS**, exit 0. +4. Python AST parse and PyYAML parse of the changed test/workflow: + **PASS**, exit 0. +5. `make test`: **FAIL**, exit 2, before running the full suite + (`make-test.log`). The x86 assembler rejects existing ARM `dsb sy` + instructions at `src/omega_blackwell_engine.c:558` and `:393` (diagnostic: number + of operands mismatch for `ds`). This file's blob is unchanged from baseline: + `bc053f133613d3dd22930f9eb461a426f397e3d3`. + Native ARM64 exact-head CI is still required; no C workaround or gate + bypass was used. +6. Separate `make test-native-artifact`, `make zero-cuda-gate`, + `build/hello_gpu --sim`, and `make doctor`: **NOT RUN locally**; + full build is blocked as above. Existing PR CI covers its normal host + and simulator tiers without altering their gates. +7. GB10 tests: **NOT RUN**. No authorized hardware window was requested. + +Logs are captured output, with the local checkout prefix replaced by +`` in Python tracebacks and trailing whitespace removed from the +baseline log. These formatting changes do not alter verdicts. + +## Independent review and ownership + +A separate reviewer reported no findings and independently ran all 9 tests, +shell syntax and whitespace checks. Additional dummy checks confirmed a +missing first executable propagates 127 without launching a child or writing +`done`, and an existing lock retains its contents and is held for all children. + +Reviewed combined patch SHA-256: +`7360405df7ed6c08fd405a393eebb68ea5a70119773f312af783678da6ca0a79`. +The hash input was the tracked binary diff against baseline followed by +`git diff --binary --no-index -- /dev/null tests/test_chip_helpers.py` before +staging the new test. No source edits followed review. + +All 15 open PR file lists were rechecked; none touched these four source +paths. Coordination with C4Streams / TrainCarry2 is recorded on +[#113](https://github.com/aien-dev/CUDApp/pull/113#issuecomment-6436534499). +The .om successor in #115 and C5 work in #119 retain their existing owners. + +## Publication audit + +`bash tools/extract/audit-selftest.sh`: **PASS**, 15 planted / 15 found. +Delta audit: 8 blobs, 0 binaries, 0 secret hits; 2 private-pattern hits, both +the reserved fixture address described below. +Only new/changed publication files are audited for this patch; historical +receipts are unchanged. The fixture identity `test@example.invalid` is a +reserved dummy address, not personal data. Publication uses exact blob/tree +comparison; any API-vs-local commit identity mapping is stated in the PR. diff --git a/evidence/chip-helper-host-20261027/baseline.log b/evidence/chip-helper-host-20261027/baseline.log new file mode 100644 index 00000000..6303bfa4 --- /dev/null +++ b/evidence/chip-helper-host-20261027/baseline.log @@ -0,0 +1,76 @@ +test_c4_keeps_the_default_count_when_omitted (__main__.ChipHelperTests.test_c4_keeps_the_default_count_when_omitted) ... ok +test_c4_refuses_malformed_or_unrepresentable_counts (__main__.ChipHelperTests.test_c4_refuses_malformed_or_unrepresentable_counts) ... + test_c4_refuses_malformed_or_unrepresentable_counts (__main__.ChipHelperTests.test_c4_refuses_malformed_or_unrepresentable_counts) (count='') ... FAIL + test_c4_refuses_malformed_or_unrepresentable_counts (__main__.ChipHelperTests.test_c4_refuses_malformed_or_unrepresentable_counts) (count='00') ... FAIL +test_c4_refuses_zero_without_running_a_child (__main__.ChipHelperTests.test_c4_refuses_zero_without_running_a_child) ... FAIL +test_c4_rejects_child_failure_and_missing_verdict (__main__.ChipHelperTests.test_c4_rejects_child_failure_and_missing_verdict) ... ok +test_c4_runs_the_requested_number_under_the_lock (__main__.ChipHelperTests.test_c4_runs_the_requested_number_under_the_lock) ... ok +test_contended_lock_prevents_any_child (__main__.ChipHelperTests.test_contended_lock_prevents_any_child) ... + test_contended_lock_prevents_any_child (__main__.ChipHelperTests.test_contended_lock_prevents_any_child) (helper='l136_channel_gates.sh') ... FAIL +test_l136_holds_the_lock_for_every_child (__main__.ChipHelperTests.test_l136_holds_the_lock_for_every_child) ... FAIL +test_l136_propagates_a_late_channel_child_failure (__main__.ChipHelperTests.test_l136_propagates_a_late_channel_child_failure) ... FAIL +test_l136_records_failure_and_stops_with_the_child_status (__main__.ChipHelperTests.test_l136_records_failure_and_stops_with_the_child_status) ... FAIL + +====================================================================== +FAIL: test_c4_refuses_malformed_or_unrepresentable_counts (__main__.ChipHelperTests.test_c4_refuses_malformed_or_unrepresentable_counts) (count='') +---------------------------------------------------------------------- +Traceback (most recent call last): + File "/tests/test_chip_helpers.py", line 77, in test_c4_refuses_malformed_or_unrepresentable_counts + self.assertNotEqual(result.returncode, 0, result.stdout + result.stderr) +AssertionError: 0 == 0 : runs passing: 10 of 10 + + +====================================================================== +FAIL: test_c4_refuses_malformed_or_unrepresentable_counts (__main__.ChipHelperTests.test_c4_refuses_malformed_or_unrepresentable_counts) (count='00') +---------------------------------------------------------------------- +Traceback (most recent call last): + File "/tests/test_chip_helpers.py", line 77, in test_c4_refuses_malformed_or_unrepresentable_counts + self.assertNotEqual(result.returncode, 0, result.stdout + result.stderr) +AssertionError: 0 == 0 : runs passing: 0 of 00 + + +====================================================================== +FAIL: test_c4_refuses_zero_without_running_a_child (__main__.ChipHelperTests.test_c4_refuses_zero_without_running_a_child) +---------------------------------------------------------------------- +Traceback (most recent call last): + File "/tests/test_chip_helpers.py", line 69, in test_c4_refuses_zero_without_running_a_child + self.assertNotEqual(result.returncode, 0, result.stdout + result.stderr) +AssertionError: 0 == 0 : runs passing: 0 of 0 + + +====================================================================== +FAIL: test_contended_lock_prevents_any_child (__main__.ChipHelperTests.test_contended_lock_prevents_any_child) (helper='l136_channel_gates.sh') +---------------------------------------------------------------------- +Traceback (most recent call last): + File "/tests/test_chip_helpers.py", line 139, in test_contended_lock_prevents_any_child + self.assertNotEqual(result.returncode, 0, result.stdout + result.stderr) +AssertionError: 0 == 0 : + +====================================================================== +FAIL: test_l136_holds_the_lock_for_every_child (__main__.ChipHelperTests.test_l136_holds_the_lock_for_every_child) +---------------------------------------------------------------------- +Traceback (most recent call last): + File "/tests/test_chip_helpers.py", line 101, in test_l136_holds_the_lock_for_every_child + self.assertTrue(all(line.endswith(" locked") for line in self.invocations()), +AssertionError: False is not true : ['gpu_q38_graph_test unset unlocked', 'gpu_q38_graph_test unset unlocked', 'gpu_q38_graph_test unset unlocked', 'gpu_q38_graph_test unset unlocked', 'gpu_cmdlist_test unset unlocked', 'gpu_cmdlist_test unset unlocked', 'gpu_decode_graph_test unset unlocked', 'gpu_decode_graph_test unset unlocked', 'gpu_q38_channels_test unset unlocked', 'gpu_q38_channels_test 2 unlocked', 'gpu_q38_graph_test 2 unlocked'] + +====================================================================== +FAIL: test_l136_propagates_a_late_channel_child_failure (__main__.ChipHelperTests.test_l136_propagates_a_late_channel_child_failure) +---------------------------------------------------------------------- +Traceback (most recent call last): + File "/tests/test_chip_helpers.py", line 116, in test_l136_propagates_a_late_channel_child_failure + self.assertEqual(result.returncode, 37, result.stdout + result.stderr) +AssertionError: 0 != 37 : + +====================================================================== +FAIL: test_l136_records_failure_and_stops_with_the_child_status (__main__.ChipHelperTests.test_l136_records_failure_and_stops_with_the_child_status) +---------------------------------------------------------------------- +Traceback (most recent call last): + File "/tests/test_chip_helpers.py", line 108, in test_l136_records_failure_and_stops_with_the_child_status + self.assertEqual(result.returncode, 37, result.stdout + result.stderr) +AssertionError: 0 != 37 : + +---------------------------------------------------------------------- +Ran 9 tests in 1.554s + +FAILED (failures=7) diff --git a/evidence/chip-helper-host-20261027/make-test.log b/evidence/chip-helper-host-20261027/make-test.log new file mode 100644 index 00000000..19ef304b --- /dev/null +++ b/evidence/chip-helper-host-20261027/make-test.log @@ -0,0 +1,26 @@ +mkdir -p build +cc -std=gnu11 -Wall -Wextra -Werror -MMD -MP -D_GNU_SOURCE -O2 -Isrc -I./m16 -I./nvrm -I./third_party/nvidia-open-580.173.02/src/common/sdk/nvidia/inc -I./third_party/nvidia-open-580.173.02/kernel-open/common/inc -I./third_party/nvidia-open-580.173.02/kernel-open/nvidia-uvm -I./third_party/nvidia-open-580.173.02/src/nvidia/arch/nvalloc/unix/include -c src/omega_blackwell_codegen.c -o build/omega_blackwell_codegen.o +cc -std=gnu11 -Wall -Wextra -Werror -MMD -MP -D_GNU_SOURCE -O2 -Isrc -I./m16 -I./nvrm -I./third_party/nvidia-open-580.173.02/src/common/sdk/nvidia/inc -I./third_party/nvidia-open-580.173.02/kernel-open/common/inc -I./third_party/nvidia-open-580.173.02/kernel-open/nvidia-uvm -I./third_party/nvidia-open-580.173.02/src/nvidia/arch/nvalloc/unix/include -c src/omega_blackwell_codegen_attn.c -o build/omega_blackwell_codegen_attn.o +cc -std=gnu11 -Wall -Wextra -Werror -MMD -MP -D_GNU_SOURCE -O2 -Isrc -I./m16 -I./nvrm -I./third_party/nvidia-open-580.173.02/src/common/sdk/nvidia/inc -I./third_party/nvidia-open-580.173.02/kernel-open/common/inc -I./third_party/nvidia-open-580.173.02/kernel-open/nvidia-uvm -I./third_party/nvidia-open-580.173.02/src/nvidia/arch/nvalloc/unix/include -c src/omega_blackwell_codegen_attn256.c -o build/omega_blackwell_codegen_attn256.o +cc -std=gnu11 -Wall -Wextra -Werror -MMD -MP -D_GNU_SOURCE -O2 -Isrc -I./m16 -I./nvrm -I./third_party/nvidia-open-580.173.02/src/common/sdk/nvidia/inc -I./third_party/nvidia-open-580.173.02/kernel-open/common/inc -I./third_party/nvidia-open-580.173.02/kernel-open/nvidia-uvm -I./third_party/nvidia-open-580.173.02/src/nvidia/arch/nvalloc/unix/include -c src/omega_blackwell_codegen_bf16.c -o build/omega_blackwell_codegen_bf16.o +cc -std=gnu11 -Wall -Wextra -Werror -MMD -MP -D_GNU_SOURCE -O2 -Isrc -I./m16 -I./nvrm -I./third_party/nvidia-open-580.173.02/src/common/sdk/nvidia/inc -I./third_party/nvidia-open-580.173.02/kernel-open/common/inc -I./third_party/nvidia-open-580.173.02/kernel-open/nvidia-uvm -I./third_party/nvidia-open-580.173.02/src/nvidia/arch/nvalloc/unix/include -c src/omega_blackwell_codegen_dec.c -o build/omega_blackwell_codegen_dec.o +cc -std=gnu11 -Wall -Wextra -Werror -MMD -MP -D_GNU_SOURCE -O2 -Isrc -I./m16 -I./nvrm -I./third_party/nvidia-open-580.173.02/src/common/sdk/nvidia/inc -I./third_party/nvidia-open-580.173.02/kernel-open/common/inc -I./third_party/nvidia-open-580.173.02/kernel-open/nvidia-uvm -I./third_party/nvidia-open-580.173.02/src/nvidia/arch/nvalloc/unix/include -c src/omega_blackwell_codegen_gdn.c -o build/omega_blackwell_codegen_gdn.o +cc -std=gnu11 -Wall -Wextra -Werror -MMD -MP -D_GNU_SOURCE -O2 -Isrc -I./m16 -I./nvrm -I./third_party/nvidia-open-580.173.02/src/common/sdk/nvidia/inc -I./third_party/nvidia-open-580.173.02/kernel-open/common/inc -I./third_party/nvidia-open-580.173.02/kernel-open/nvidia-uvm -I./third_party/nvidia-open-580.173.02/src/nvidia/arch/nvalloc/unix/include -c src/omega_blackwell_codegen_gemm.c -o build/omega_blackwell_codegen_gemm.o +cc -std=gnu11 -Wall -Wextra -Werror -MMD -MP -D_GNU_SOURCE -O2 -Isrc -I./m16 -I./nvrm -I./third_party/nvidia-open-580.173.02/src/common/sdk/nvidia/inc -I./third_party/nvidia-open-580.173.02/kernel-open/common/inc -I./third_party/nvidia-open-580.173.02/kernel-open/nvidia-uvm -I./third_party/nvidia-open-580.173.02/src/nvidia/arch/nvalloc/unix/include -c src/omega_blackwell_codegen_moe.c -o build/omega_blackwell_codegen_moe.o +cc -std=gnu11 -Wall -Wextra -Werror -MMD -MP -D_GNU_SOURCE -O2 -Isrc -I./m16 -I./nvrm -I./third_party/nvidia-open-580.173.02/src/common/sdk/nvidia/inc -I./third_party/nvidia-open-580.173.02/kernel-open/common/inc -I./third_party/nvidia-open-580.173.02/kernel-open/nvidia-uvm -I./third_party/nvidia-open-580.173.02/src/nvidia/arch/nvalloc/unix/include -c src/omega_blackwell_codegen_moe2.c -o build/omega_blackwell_codegen_moe2.o +cc -std=gnu11 -Wall -Wextra -Werror -MMD -MP -D_GNU_SOURCE -O2 -Isrc -I./m16 -I./nvrm -I./third_party/nvidia-open-580.173.02/src/common/sdk/nvidia/inc -I./third_party/nvidia-open-580.173.02/kernel-open/common/inc -I./third_party/nvidia-open-580.173.02/kernel-open/nvidia-uvm -I./third_party/nvidia-open-580.173.02/src/nvidia/arch/nvalloc/unix/include -c src/omega_blackwell_codegen_pattn.c -o build/omega_blackwell_codegen_pattn.o +cc -std=gnu11 -Wall -Wextra -Werror -MMD -MP -D_GNU_SOURCE -O2 -Isrc -I./m16 -I./nvrm -I./third_party/nvidia-open-580.173.02/src/common/sdk/nvidia/inc -I./third_party/nvidia-open-580.173.02/kernel-open/common/inc -I./third_party/nvidia-open-580.173.02/kernel-open/nvidia-uvm -I./third_party/nvidia-open-580.173.02/src/nvidia/arch/nvalloc/unix/include -c src/omega_blackwell_codegen_pattn256.c -o build/omega_blackwell_codegen_pattn256.o +cc -std=gnu11 -Wall -Wextra -Werror -MMD -MP -D_GNU_SOURCE -O2 -Isrc -I./m16 -I./nvrm -I./third_party/nvidia-open-580.173.02/src/common/sdk/nvidia/inc -I./third_party/nvidia-open-580.173.02/kernel-open/common/inc -I./third_party/nvidia-open-580.173.02/kernel-open/nvidia-uvm -I./third_party/nvidia-open-580.173.02/src/nvidia/arch/nvalloc/unix/include -c src/omega_blackwell_codegen_pf.c -o build/omega_blackwell_codegen_pf.o +cc -std=gnu11 -Wall -Wextra -Werror -MMD -MP -D_GNU_SOURCE -O2 -Isrc -I./m16 -I./nvrm -I./third_party/nvidia-open-580.173.02/src/common/sdk/nvidia/inc -I./third_party/nvidia-open-580.173.02/kernel-open/common/inc -I./third_party/nvidia-open-580.173.02/kernel-open/nvidia-uvm -I./third_party/nvidia-open-580.173.02/src/nvidia/arch/nvalloc/unix/include -c src/omega_blackwell_codegen_pfhost.c -o build/omega_blackwell_codegen_pfhost.o +cc -std=gnu11 -Wall -Wextra -Werror -MMD -MP -D_GNU_SOURCE -O2 -Isrc -I./m16 -I./nvrm -I./third_party/nvidia-open-580.173.02/src/common/sdk/nvidia/inc -I./third_party/nvidia-open-580.173.02/kernel-open/common/inc -I./third_party/nvidia-open-580.173.02/kernel-open/nvidia-uvm -I./third_party/nvidia-open-580.173.02/src/nvidia/arch/nvalloc/unix/include -c src/omega_blackwell_codegen_qg.c -o build/omega_blackwell_codegen_qg.o +cc -std=gnu11 -Wall -Wextra -Werror -MMD -MP -D_GNU_SOURCE -O2 -Isrc -I./m16 -I./nvrm -I./third_party/nvidia-open-580.173.02/src/common/sdk/nvidia/inc -I./third_party/nvidia-open-580.173.02/kernel-open/common/inc -I./third_party/nvidia-open-580.173.02/kernel-open/nvidia-uvm -I./third_party/nvidia-open-580.173.02/src/nvidia/arch/nvalloc/unix/include -c src/omega_blackwell_codegen_qmma.c -o build/omega_blackwell_codegen_qmma.o +cc -std=gnu11 -Wall -Wextra -Werror -MMD -MP -D_GNU_SOURCE -O2 -Isrc -I./m16 -I./nvrm -I./third_party/nvidia-open-580.173.02/src/common/sdk/nvidia/inc -I./third_party/nvidia-open-580.173.02/kernel-open/common/inc -I./third_party/nvidia-open-580.173.02/kernel-open/nvidia-uvm -I./third_party/nvidia-open-580.173.02/src/nvidia/arch/nvalloc/unix/include -c src/omega_blackwell_codegen_router.c -o build/omega_blackwell_codegen_router.o +cc -std=gnu11 -Wall -Wextra -Werror -MMD -MP -D_GNU_SOURCE -O2 -Isrc -I./m16 -I./nvrm -I./third_party/nvidia-open-580.173.02/src/common/sdk/nvidia/inc -I./third_party/nvidia-open-580.173.02/kernel-open/common/inc -I./third_party/nvidia-open-580.173.02/kernel-open/nvidia-uvm -I./third_party/nvidia-open-580.173.02/src/nvidia/arch/nvalloc/unix/include -c src/omega_blackwell_codegen_tc.c -o build/omega_blackwell_codegen_tc.o +cc -std=gnu11 -Wall -Wextra -Werror -MMD -MP -D_GNU_SOURCE -O2 -Isrc -I./m16 -I./nvrm -I./third_party/nvidia-open-580.173.02/src/common/sdk/nvidia/inc -I./third_party/nvidia-open-580.173.02/kernel-open/common/inc -I./third_party/nvidia-open-580.173.02/kernel-open/nvidia-uvm -I./third_party/nvidia-open-580.173.02/src/nvidia/arch/nvalloc/unix/include -c src/omega_blackwell_codegen_tc2.c -o build/omega_blackwell_codegen_tc2.o +cc -std=gnu11 -Wall -Wextra -Werror -MMD -MP -D_GNU_SOURCE -O2 -Isrc -I./m16 -I./nvrm -I./third_party/nvidia-open-580.173.02/src/common/sdk/nvidia/inc -I./third_party/nvidia-open-580.173.02/kernel-open/common/inc -I./third_party/nvidia-open-580.173.02/kernel-open/nvidia-uvm -I./third_party/nvidia-open-580.173.02/src/nvidia/arch/nvalloc/unix/include -c src/omega_blackwell_codegen_tern.c -o build/omega_blackwell_codegen_tern.o +cc -std=gnu11 -Wall -Wextra -Werror -MMD -MP -D_GNU_SOURCE -O2 -Isrc -I./m16 -I./nvrm -I./third_party/nvidia-open-580.173.02/src/common/sdk/nvidia/inc -I./third_party/nvidia-open-580.173.02/kernel-open/common/inc -I./third_party/nvidia-open-580.173.02/kernel-open/nvidia-uvm -I./third_party/nvidia-open-580.173.02/src/nvidia/arch/nvalloc/unix/include -c src/omega_blackwell_encoder.c -o build/omega_blackwell_encoder.o +cc -std=gnu11 -Wall -Wextra -Werror -MMD -MP -D_GNU_SOURCE -O2 -Isrc -I./m16 -I./nvrm -I./third_party/nvidia-open-580.173.02/src/common/sdk/nvidia/inc -I./third_party/nvidia-open-580.173.02/kernel-open/common/inc -I./third_party/nvidia-open-580.173.02/kernel-open/nvidia-uvm -I./third_party/nvidia-open-580.173.02/src/nvidia/arch/nvalloc/unix/include -c src/omega_blackwell_engine.c -o build/omega_blackwell_engine.o +src/omega_blackwell_engine.c: Assembler messages: +src/omega_blackwell_engine.c:558: Error: number of operands mismatch for `ds' +src/omega_blackwell_engine.c:393: Error: number of operands mismatch for `ds' +make: *** [Makefile:40: build/omega_blackwell_engine.o] Error 1 diff --git a/evidence/chip-helper-host-20261027/repaired.log b/evidence/chip-helper-host-20261027/repaired.log new file mode 100644 index 00000000..bd372653 --- /dev/null +++ b/evidence/chip-helper-host-20261027/repaired.log @@ -0,0 +1,14 @@ +test_c4_keeps_the_default_count_when_omitted (__main__.ChipHelperTests.test_c4_keeps_the_default_count_when_omitted) ... ok +test_c4_refuses_malformed_or_unrepresentable_counts (__main__.ChipHelperTests.test_c4_refuses_malformed_or_unrepresentable_counts) ... ok +test_c4_refuses_zero_without_running_a_child (__main__.ChipHelperTests.test_c4_refuses_zero_without_running_a_child) ... ok +test_c4_rejects_child_failure_and_missing_verdict (__main__.ChipHelperTests.test_c4_rejects_child_failure_and_missing_verdict) ... ok +test_c4_runs_the_requested_number_under_the_lock (__main__.ChipHelperTests.test_c4_runs_the_requested_number_under_the_lock) ... ok +test_contended_lock_prevents_any_child (__main__.ChipHelperTests.test_contended_lock_prevents_any_child) ... ok +test_l136_holds_the_lock_for_every_child (__main__.ChipHelperTests.test_l136_holds_the_lock_for_every_child) ... ok +test_l136_propagates_a_late_channel_child_failure (__main__.ChipHelperTests.test_l136_propagates_a_late_channel_child_failure) ... ok +test_l136_records_failure_and_stops_with_the_child_status (__main__.ChipHelperTests.test_l136_records_failure_and_stops_with_the_child_status) ... ok + +---------------------------------------------------------------------- +Ran 9 tests in 0.678s + +OK diff --git a/tests/test_chip_helpers.py b/tests/test_chip_helpers.py new file mode 100644 index 00000000..9434949f --- /dev/null +++ b/tests/test_chip_helpers.py @@ -0,0 +1,144 @@ +#!/usr/bin/env python3 +# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +"""Host-only chip-helper checks: every child is a dummy, every lock is temporary.""" +import fcntl +import os +from pathlib import Path +import shutil +import subprocess +import tempfile +import unittest + + +ROOT = Path(os.environ.get("CUDAPP_CHIP_HELPER_ROOT", Path(__file__).resolve().parents[1])) + + +class ChipHelperTests(unittest.TestCase): + def setUp(self): + self.tmp = tempfile.TemporaryDirectory(prefix="cudapp-chip-helpers-") + self.addCleanup(self.tmp.cleanup) + self.work = Path(self.tmp.name) + self.calls = self.work / "calls" + self.lock = self.work / "lock" + self.out = self.work / "evidence" + self.out.mkdir() + self.home = self.work / "home" + repo = self.home / "workspace/omega-gpu-channels" + base = self.home / "workspace/omega-gpu-channels-base/build" + (repo / "build").mkdir(parents=True) + base.mkdir(parents=True) + subprocess.run(["git", "init", "-q", str(repo)], check=True) + subprocess.run(["git", "-C", str(repo), "-c", "user.name=Test", "-c", + "user.email=test@example.invalid", "commit", "--allow-empty", + "-qm", "host fixture"], check=True) + self.env = dict(os.environ, HOME=str(self.home), LOCK=str(self.lock), + CALLS=str(self.calls), REAL_FLOCK=shutil.which("flock") or "", + CHILD_MODE="pass", AIEN_OMEGA_GPU_CHANNELS="unexpected") + self.assertTrue(self.env["REAL_FLOCK"], "flock is required") + dummy = '''#!/bin/sh +held=locked +if "$REAL_FLOCK" -n "$LOCK" true; then held=unlocked; fi +printf '%s %s %s\\n' "$(basename "$0")" "${AIEN_OMEGA_GPU_CHANNELS-unset}" "$held" >> "$CALLS" +case "$CHILD_MODE" in + fail) echo 'dummy child failure'; exit 37 ;; + late) if [ "${AIEN_OMEGA_GPU_CHANNELS-unset}" = 2 ]; then + echo 'dummy child failure'; exit 37 + fi ;; + silent) echo 'dummy child without a verdict'; exit 0 ;; + pass) echo 'C4 streams chip: PASS (dummy host test, not GPU evidence)' ;; +esac +''' + for folder in (repo / "build", base): + for name in ("gpu_streams_test", "gpu_q38_graph_test", "gpu_cmdlist_test", + "gpu_decode_graph_test", "gpu_q38_channels_test"): + path = folder / name + path.write_text(dummy) + path.chmod(0o755) + self.env["BIN"] = str(repo / "build/gpu_streams_test") + + def run_helper(self, name, *args, **env): + return subprocess.run(["sh", str(ROOT / "tools" / name), str(self.out), *args], + env=dict(self.env, **env), text=True, capture_output=True, + timeout=15) + + def invocations(self): + return self.calls.read_text().splitlines() if self.calls.exists() else [] + + def test_c4_refuses_zero_without_running_a_child(self): + result = self.run_helper("c4_streams_chip.sh", "0") + self.assertNotEqual(result.returncode, 0, result.stdout + result.stderr) + self.assertEqual(self.invocations(), []) + + def test_c4_refuses_malformed_or_unrepresentable_counts(self): + for count in ("", "00", "-1", "abc", "1.5", "999999999999999999999999999"): + with self.subTest(count=count): + self.calls.unlink(missing_ok=True) + result = self.run_helper("c4_streams_chip.sh", count) + self.assertNotEqual(result.returncode, 0, result.stdout + result.stderr) + self.assertEqual(self.invocations(), []) + + def test_c4_runs_the_requested_number_under_the_lock(self): + result = self.run_helper("c4_streams_chip.sh", "2") + self.assertEqual(result.returncode, 0, result.stdout + result.stderr) + self.assertEqual(self.invocations(), ["gpu_streams_test unexpected locked"] * 2) + self.assertIn("runs passing: 2 of 2", (self.out / "summary.txt").read_text()) + + def test_c4_keeps_the_default_count_when_omitted(self): + result = self.run_helper("c4_streams_chip.sh") + self.assertEqual(result.returncode, 0, result.stdout + result.stderr) + self.assertEqual(len(self.invocations()), 10) + + def test_c4_rejects_child_failure_and_missing_verdict(self): + for mode in ("fail", "silent"): + with self.subTest(mode=mode): + result = self.run_helper("c4_streams_chip.sh", "1", CHILD_MODE=mode) + self.assertNotEqual(result.returncode, 0, result.stdout + result.stderr) + + def test_l136_holds_the_lock_for_every_child(self): + result = self.run_helper("l136_channel_gates.sh") + self.assertEqual(result.returncode, 0, result.stdout + result.stderr) + self.assertEqual(len(self.invocations()), 11) + self.assertTrue(all(line.endswith(" locked") for line in self.invocations()), + self.invocations()) + self.assertEqual([line.split()[1] for line in self.invocations()], + ["unset"] * 9 + ["2", "2"]) + + def test_l136_records_failure_and_stops_with_the_child_status(self): + result = self.run_helper("l136_channel_gates.sh", CHILD_MODE="fail") + self.assertEqual(result.returncode, 37, result.stdout + result.stderr) + self.assertEqual(len(self.invocations()), 1) + summary = (self.out / "summary.txt").read_text() + self.assertIn("g1-base-q38-l4 rc=37 dummy child failure", summary) + self.assertNotIn("done", summary) + + def test_l136_propagates_a_late_channel_child_failure(self): + result = self.run_helper("l136_channel_gates.sh", CHILD_MODE="late") + self.assertEqual(result.returncode, 37, result.stdout + result.stderr) + self.assertEqual(len(self.invocations()), 10) + summary = (self.out / "summary.txt").read_text() + self.assertIn("g2-l4 rc=37 dummy child failure", summary) + self.assertNotIn("done", summary) + + def test_contended_lock_prevents_any_child(self): + # Keep real flock semantics; shorten only the wait to make contention + # deterministic without waiting for the production wait budget. + shimdir = self.work / "bin" + shimdir.mkdir() + shim = shimdir / "flock" + shim.write_text('''#!/bin/sh +if [ "$1" = -w ]; then shift; shift; exec "$REAL_FLOCK" -n "$@"; fi +exec "$REAL_FLOCK" "$@" +''') + shim.chmod(0o755) + with self.lock.open("a") as holder: + fcntl.flock(holder, fcntl.LOCK_EX | fcntl.LOCK_NB) + for name in ("c4_streams_chip.sh", "l136_channel_gates.sh"): + with self.subTest(helper=name): + result = self.run_helper(name, *(["1"] if name.startswith("c4") else []), + PATH=str(shimdir) + os.pathsep + os.environ["PATH"]) + self.assertNotEqual(result.returncode, 0, result.stdout + result.stderr) + self.assertEqual(self.invocations(), []) + + +if __name__ == "__main__": + unittest.main() diff --git a/tools/c4_streams_chip.sh b/tools/c4_streams_chip.sh index 9085d503..e0ed6258 100755 --- a/tools/c4_streams_chip.sh +++ b/tools/c4_streams_chip.sh @@ -11,7 +11,14 @@ # Writes OUTDIR/run-NN.log (load average before, exit code after) and OUTDIR/summary.txt. Exit 0 only when all N passed. set -eu OUT=${1:?usage: tools/c4_streams_chip.sh OUTDIR [N]} -N=${2:-10} +N=${2-10} +case "$N" in + ''|*[!0-9]*) echo 'N must be a positive decimal integer' >&2; exit 2 ;; +esac +[ "$N" -gt 0 ] 2>/dev/null || { + echo 'N must be a positive decimal integer in the shell integer range' >&2 + exit 2 +} BIN=${BIN:-build/gpu_streams_test} LOCK=${LOCK:-/tmp/aien-gb10.lock} [ -x "$BIN" ] || { echo "NOT_RUN: $BIN is not built" >&2; exit 2; } diff --git a/tools/l136_channel_gates.sh b/tools/l136_channel_gates.sh index 3d465cfa..a949ebee 100755 --- a/tools/l136_channel_gates.sh +++ b/tools/l136_channel_gates.sh @@ -1,23 +1,38 @@ #!/bin/sh -# L136 correctness gates on the chip (GB10 lock only). $1 = evidence dir (absolute). -E=$1; N=$HOME/workspace/omega-gpu-channels/build; B=$HOME/workspace/omega-gpu-channels-base/build -cd $HOME/workspace/omega-gpu-channels || exit 1 -{ date -u; git rev-parse HEAD; uname -r; grep MemAvailable /proc/meminfo; cat /proc/loadavg; } > $E/device.txt -run() { name=$1; shift; "$@" > $E/$name.log 2>&1; echo "$name rc=$? $(tail -1 $E/$name.log)" >> $E/summary.txt; } +# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +# L136 correctness gates on the chip. $1 = existing evidence dir (absolute). +# Takes the GB10 lock itself for the set; do not wrap in another hold of the lock. +# Record the first failed child and stop with its exit status. +set -eu +E=${1:?usage: tools/l136_channel_gates.sh EVIDENCE_DIR} +N=$HOME/workspace/omega-gpu-channels/build +B=$HOME/workspace/omega-gpu-channels-base/build +LOCK=${LOCK:-/tmp/aien-gb10.lock} +cd "$HOME/workspace/omega-gpu-channels" || exit 1 +if [ -e "$LOCK" ]; then exec 9<"$LOCK"; else exec 9>>"$LOCK"; fi +flock -w 900 9 || { echo 'NOT_RUN: GB10 lock busy for 900 s' >&2; exit 2; } +{ date -u; git rev-parse HEAD; uname -r; grep MemAvailable /proc/meminfo; cat /proc/loadavg; } > "$E/device.txt" +run() { + name=$1; shift + rc=0 + "$@" > "$E/$name.log" 2>&1 || rc=$? + printf '%s rc=%s %s\n' "$name" "$rc" "$(tail -1 "$E/$name.log")" >> "$E/summary.txt" + return "$rc" +} unset AIEN_OMEGA_GPU_CHANNELS # G1: one channel, the new build against the base build (0010f7d3 on physics 6d7cf0d4), same arguments -run g1-base-q38-l4 $B/gpu_q38_graph_test --layers 4 --mask 0x8 --reps 3 -run g1-new-q38-l4 $N/gpu_q38_graph_test --layers 4 --mask 0x8 --reps 3 -run g1-base-q38-l2 $B/gpu_q38_graph_test --reps 3 -run g1-new-q38-l2 $N/gpu_q38_graph_test --reps 3 -run g1-base-cmdlist $B/gpu_cmdlist_test -run g1-new-cmdlist $N/gpu_cmdlist_test -run g1-base-dgraph $B/gpu_decode_graph_test -run g1-new-dgraph $N/gpu_decode_graph_test +run g1-base-q38-l4 "$B/gpu_q38_graph_test" --layers 4 --mask 0x8 --reps 3 +run g1-new-q38-l4 "$N/gpu_q38_graph_test" --layers 4 --mask 0x8 --reps 3 +run g1-base-q38-l2 "$B/gpu_q38_graph_test" --reps 3 +run g1-new-q38-l2 "$N/gpu_q38_graph_test" --reps 3 +run g1-base-cmdlist "$B/gpu_cmdlist_test" +run g1-new-cmdlist "$N/gpu_cmdlist_test" +run g1-base-dgraph "$B/gpu_decode_graph_test" +run g1-new-dgraph "$N/gpu_decode_graph_test" # refusal: no AIEN_OMEGA_GPU_CHANNELS, the pair is refused by name, the serial path decodes -run refusal $N/gpu_q38_channels_test --layers 4 --steps 2 --block 0 --refusal +run refusal "$N/gpu_q38_channels_test" --layers 4 --steps 2 --block 0 --refusal # G2 small: two channels, 4 layers, 16 steps + 16-step blocks -AIEN_OMEGA_GPU_CHANNELS=2 run g2-l4 $N/gpu_q38_channels_test --layers 4 --steps 16 --block 16 +AIEN_OMEGA_GPU_CHANNELS=2 run g2-l4 "$N/gpu_q38_channels_test" --layers 4 --steps 16 --block 16 # two-channel device: the one-channel tests still pass on queue 0 -AIEN_OMEGA_GPU_CHANNELS=2 run g1-ch2-q38-l4 $N/gpu_q38_graph_test --layers 4 --mask 0x8 --reps 3 -echo done >> $E/summary.txt +AIEN_OMEGA_GPU_CHANNELS=2 run g1-ch2-q38-l4 "$N/gpu_q38_graph_test" --layers 4 --mask 0x8 --reps 3 +echo done >> "$E/summary.txt"