interplane.Get Omega
Read in your language

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

fix: report drift differences accurately and fail closed on setup errors

merged 5bf750924fb5e534 #133 · opened 2026-10-27 05:39 UTC · closed 2026-10-29 01:53 UTC · merged 2026-10-29 01:53 UTC

Imported from GitHub aien-dev/CUDApp#133, by drakestapleton

Labels: ready-to-merge

Base d7f330a8a5fc5b6d83e2403549455aa661fe67ff · Head 31540d5e3d3b3e6ba875df0ea18f13e38ef01fda

Merged on GitHub as b348277e4383ab1f37f45bb702ea7d4fb4363782; reachable from main 21d8de285f713adf09e0d6ba6db2b37139d0674e (observed 2026-11-18T16:38:28Z)

drakestapleton wrote on 2026-10-27 05:39 UTC

Evidence first

Follow-up to #122 and the reproduced finding.

  • make test-drift: PASS, including unchanged blob-gate checks and error/negative controls.
  • The same regression test against main's original drift.sh / map.sh: FAIL, as expected.
  • Bash syntax and diff-whitespace checks: PASS.
  • Independent local review: no remaining must-fix finding in this scoped shell repair; the carry onto current main was separately checked to preserve its existing host targets.
  • Receipts: evidence/DRIFT-GATE-20261027. PUBLICATION.md maps the locally tested commit to the identical published source tree.

What was wrong

  1. diff | grep | grep -q under pipefail treats normal diff exit 1 as a failed condition. Real code differences were reported as licence-header-only; larger diffs could also produce broken pipes.
  2. Direct mode could continue after map/baseline-read failures and print PASS, including an invalid ref reporting -1 GPU paths. The existing workflow self-test already rejected an invalid ref at its initial map call; this is not a claim that that CI path was bypassed.

Bounded repair

  • Check blob reads and consume the entire diff; accept normal diff status 1 and reject setup/error statuses.
  • Validate the baseline and propagate comparison/setup failures as NOT_RUN, exit 2, including self-test controls.
  • Add real local-Git regression fixtures and test-drift to the existing host manifest.
  • Keep map.sh, the blob-based drift predicate, C/runtime code, workflows and hardware behavior unchanged.

The retained header-word classification is a textual diagnostic heuristic, not a legal licensing or semantic-harmlessness determination. Header-like blob changes still fail the original drift predicate.

Validation boundary

Local make test reaches the pre-existing AArch64 assembly errors in src/omega_blackwell_engine.c:558 and :393 on x86_64 after the new shell regressions pass. No gate was skipped or relaxed; the supported-ARM CI run has now passed on this PR's exact source tree: CUDA++ HOST TESTS PASS (40 targets), 2026-10-27 05:50:40 UTC. All ten reported head checks succeeded. See the final CI receipt for the head and synthetic-merge tree identities. No GPU/device, service, account or deployment operation was performed.

Ready for review, not a claim of merge or GPU qualification.

drakestapleton wrote on 2026-10-27 05:40 UTC

All ten reported checks are now SUCCESS for head f79938b69857ed0b9f6cb8005712ce188f52b4e4.

  • Full ARM host CI, run 40456531312: raw job log ends with CUDA++ HOST TESTS PASS (40 targets) at 2026-10-27 05:50:40 UTC; job completed successfully at 05:50:41.
  • Drift run 40456531180: 154 differ (90 licence-header only, 64 code), both required red controls caught, and unchanged blob gate PASS against Omega e5b32567a7af. The classification labels remain the documented textual heuristic.
  • Library build, runtime-api, hello-sim, SBOM and reported CodeQL checks succeeded.

GitHub tested synthetic merge 32723235afa350bd48cb947e863b7c6851d0231e; it and the PR head have the identical tree 4414875558667c3259e79c1a55f7302111cbee9e. Thus the supported-ARM CI closes the local x86-only full-suite limitation for this tested source tree.

The PR is non-draft and ready for maintainer review. No merge, auto-merge, deployment or GPU/device qualification was performed.

Fetch it

A git bundle of the pull request's head, 11151 bytes.

curl -fsSL https://interplane.io/drakestapleton/CUDApp/patches/5bf750924fb5e534.bundle -o 5bf750924fb5e534.bundle
git fetch 5bf750924fb5e534.bundle refs/pull/133/head

Raw bundle · 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
133
31540d5e3d3b3e6ba875df0ea18f13e38ef01fda
{"kind":"github-import","owner":"aien-dev","repo":"CUDApp","number":133,"url":"https://github.com/aien-dev/CUDApp/pull/133","export_sha256":"0aafd51b77ff5776d6baaf9b88b48c8b36a6e27c8d829ae8ded561b71712b17a","imported_utc":"2026-11-18T16:38:28Z"}

Changes

diff --git a/Makefile b/Makefile
index 2a177185..d2d9663e 100644
--- a/Makefile
+++ b/Makefile
@@ -326,7 +326,7 @@ $(GPU_L2_REUSE_TEST): tests/gpu_l2_reuse_test.c src/omega_gpu_fp8_api.h src/omeg
 	$(CC) $(CFLAGS) -ffp-contract=off -o $@ tests/gpu_l2_reuse_test.c $(OUT_DIR)/libomega_gpu.a -lpthread -lm
 
 # Every host-only check: no GPU, no device opened. The chip gates are listed in README.md.
-HOST_TESTS = test-gpu-matmul-api test-gpu-elementwise test-gpu-reconv test-gpu-attention test-gpu-moe-window \
+HOST_TESTS = test-drift test-gpu-matmul-api test-gpu-elementwise test-gpu-reconv test-gpu-attention test-gpu-moe-window \
 	test-gpu-fp8 test-gpu-decode-attn test-gpu-router test-gpu-bf16-gemv test-gpu-fp8gemm test-gpu-tern-sched test-gpu-gpr-boundary \
 	test-gpu-cmdlist test-gpu-decode-graph test-gpu-code-alloc test-gpu-engine-compile test-gpu-engine \
 	test-gpu-engine-mutants test-gpu-engine-backend-compile test-gpu-engine-prod-build test-gpu-engine-sim \
@@ -338,6 +338,10 @@ HOST_TESTS = test-gpu-matmul-api test-gpu-elementwise test-gpu-reconv test-gpu-a
 test: $(HOST_TESTS)
 	@echo "CUDA++ HOST TESTS PASS ($(words $(HOST_TESTS)) targets)"
 
+.PHONY: test-drift
+test-drift:
+	bash tools/extract/test-drift.sh
+
 # Original Git blobs are read-only verification oracles, not a replacement receipt authority.
 .PHONY: test-portable-receipts
 test-portable-receipts: test-om-units tests/portable_receipts.om tests/portable_receipts.tsv om/cache/digest.om
diff --git a/evidence/DRIFT-GATE-20261027/PUBLICATION.md b/evidence/DRIFT-GATE-20261027/PUBLICATION.md
new file mode 100644
index 00000000..6a35b832
--- /dev/null
+++ b/evidence/DRIFT-GATE-20261027/PUBLICATION.md
@@ -0,0 +1,17 @@
+# Publication identity
+
+The logs and README retain the local tested source commit `54fac045b90f441d627240de8fb3156cf9997ea7` exactly as recorded.
+
+The same source tree was published through the connected GitHub Git-object API as commit `1579322ff5c211b1c437d7de5e9554ac2a6ffed4`. Both commits have the identical Git tree:
+
+`160d8ef1c19f987904fb55c5127d16ce8fd5a5c2`
+
+Both use base `67f3135ef88d8f520dfc15a2b2bc3264f53f0d6a`. Their commit metadata differs; the tested source bytes do not. The subsequent receipt commit adds only this evidence directory. PR CI must be read against its exact tested commit, not inferred from these local shell results.
+
+Reviewed file SHA-256 identities:
+
+```text
+7a5ea66030528772834e5932410bbe908687ffc9c5a4bc1504b147dda1470adc  Makefile
+a745d16cffee7ca8d254fade96a3d878b9515c04c6d6819f48cbe85760248190  tools/extract/drift.sh
+bca639635564fb0a97e3fc515078d76533dca8af76e6a158df8e158f0e1fc0bc  tools/extract/test-drift.sh
+```
diff --git a/evidence/DRIFT-GATE-20261027/README.md b/evidence/DRIFT-GATE-20261027/README.md
new file mode 100644
index 00000000..f2c19add
--- /dev/null
+++ b/evidence/DRIFT-GATE-20261027/README.md
@@ -0,0 +1,38 @@
+# Drift diagnostic and setup-error regression receipt
+
+Date: 2026-10-27 UTC. Host-only shell tooling, no device access.
+
+- Source commit: `54fac045b90f441d627240de8fb3156cf9997ea7`.
+- Base: `67f3135ef88d8f520dfc15a2b2bc3264f53f0d6a`.
+- Related change: CUDApp #122.
+- Machine class: Linux x86_64, GCC 14.2.0. This is not a GB10 or whole-host-suite qualification.
+
+## What was reproduced
+
+The old classifier pipes `diff` through `grep` under `pipefail`. Normal `diff` status 1 makes the condition false even when code changed. An early-exiting `grep -q` can also produce broken pipes. The diagnostic then reports code differences as licence-header-only. The blob-based drift decision is separate.
+
+Direct mode also ignored failures while building or comparing the map. A nonexistent Omega ref, or a directory used as BASELINE, could print PASS after an error. The existing workflow self-test already rejected an invalid ref at its initial map call; no workflow bypass is claimed.
+
+The repair checks blob reads, preserves normal diff status 1, consumes the whole diff, rejects invalid baseline input, and propagates setup failures as NOT_RUN with exit 2. The blob predicate and `map.sh` are unchanged. The retained header-word classifier is a textual heuristic, not a legal licensing or semantic-harmlessness determination.
+
+## MEASURED results
+
+- `regression.log`: `make test-drift`, exit 0, final `DRIFT REGRESSION TESTS PASS`.
+- `original-regression.log`: the same test script with the base commit's unmodified `drift.sh` and `map.sh` in an isolated fixture, exit 1. It exposes the classification and error-handling failures before the repair.
+- `host-attempt.log`: `make test`, exit 2 at unchanged AArch64 assembly in `src/omega_blackwell_engine.c:558` and `:393` on x86_64, after the new drift tests pass. No instruction substitution, skipped gate, or full-suite PASS claim.
+- `bash -n tools/extract/drift.sh tools/extract/test-drift.sh` and `git diff --check`: exit 0.
+
+Fixtures cover code-only, header-like-only, mixed, identical, large and binary differences; unchanged blob gating; built-in negative controls; invalid refs; baseline directory/read failures; missing blobs; diff errors; and one-time setup errors in each self-test control. All repositories are temporary local fixtures. No remote, account, driver, service, or GPU is touched by these tests.
+
+An independent local review found no remaining must-fix issue in the scoped repair. The Makefile carry onto the named base was separately reviewed to retain its existing host targets and add only `test-drift`.
+
+## Re-run
+
+```sh
+make test-drift
+bash -n tools/extract/drift.sh tools/extract/test-drift.sh
+git diff --check
+make test
+```
+
+The supported ARM host CI result must be evaluated separately on the PR's exact tested tree. Existing historical receipts were not modified.
diff --git a/evidence/DRIFT-GATE-20261027/SHA256SUMS b/evidence/DRIFT-GATE-20261027/SHA256SUMS
new file mode 100644
index 00000000..3a1254dc
--- /dev/null
+++ b/evidence/DRIFT-GATE-20261027/SHA256SUMS
@@ -0,0 +1,5 @@
+f3c48852968dbabb78b8045a84d3c793496786c724e4ac971f39f7131f5d37e5  README.md
+665b92bb390d7cc834f57e0170818ac805d24b4fc40c7db1e8182ed1a347bdb8  PUBLICATION.md
+2b91e97c434267431f866a66ced2f9592028ef65fcd321cc4ae2a3da4738c1ac  host-attempt.log
+824616b8275829e7ae716a60b70ad48e66b60ddc319a8a267bdad6563c8457f0  original-regression.log
+58c5f310f0e8fc0fc8a74a90491dbf126465b45016ed3848b960e047922ebe6a  regression.log
diff --git a/evidence/DRIFT-GATE-20261027/host-attempt.log b/evidence/DRIFT-GATE-20261027/host-attempt.log
new file mode 100644
index 00000000..f7e0b979
--- /dev/null
+++ b/evidence/DRIFT-GATE-20261027/host-attempt.log
@@ -0,0 +1,145 @@
+source_commit=54fac045b90f441d627240de8fb3156cf9997ea7
+command=make test
+Linux x86_64
+cc (Debian 14.2.0-19) 14.2.0
+bash tools/extract/test-drift.sh
+=== code classification at baseline (exit 0, expected 0) ===
+DIVERGENCE: 1 shared, 0 same, 1 differ (0 licence-header only, 1 code); 0 cudapp-only, 0 omega-only
+DRIFT-GATE: PASS (1 GPU paths, omega adfe9767c3e8, none moved away from CUDA++ since the baseline)
+PASS: code classification at baseline
+=== code blob gate (exit 1, expected 1) ===
+DRIFT	src/omega_gpu_case.c	differs	af31bb5a4f0ffbf774b821f31926a4db3b038383
+DIVERGENCE: 1 shared, 0 same, 1 differ (0 licence-header only, 1 code); 0 cudapp-only, 0 omega-only
+DRIFT-GATE: FAIL (1 of 1 GPU paths changed in omega adfe9767c3e8 and not in CUDA++)
+PASS: code blob gate
+=== header classification at baseline (exit 0, expected 0) ===
+DIVERGENCE: 1 shared, 0 same, 1 differ (1 licence-header only, 0 code); 0 cudapp-only, 0 omega-only
+DRIFT-GATE: PASS (1 GPU paths, omega 3ea63dfb837d, none moved away from CUDA++ since the baseline)
+PASS: header classification at baseline
+=== header blob gate (exit 1, expected 1) ===
+DRIFT	src/omega_gpu_case.c	differs	2f88238630d9fd6a4c438013745aedc1550f5081
+DIVERGENCE: 1 shared, 0 same, 1 differ (1 licence-header only, 0 code); 0 cudapp-only, 0 omega-only
+DRIFT-GATE: FAIL (1 of 1 GPU paths changed in omega 3ea63dfb837d and not in CUDA++)
+PASS: header blob gate
+=== mixed classification at baseline (exit 0, expected 0) ===
+DIVERGENCE: 1 shared, 0 same, 1 differ (0 licence-header only, 1 code); 0 cudapp-only, 0 omega-only
+DRIFT-GATE: PASS (1 GPU paths, omega 1b8c3fabd8a5, none moved away from CUDA++ since the baseline)
+PASS: mixed classification at baseline
+=== mixed blob gate (exit 1, expected 1) ===
+DRIFT	src/omega_gpu_case.c	differs	2f88238630d9fd6a4c438013745aedc1550f5081
+DIVERGENCE: 1 shared, 0 same, 1 differ (0 licence-header only, 1 code); 0 cudapp-only, 0 omega-only
+DRIFT-GATE: FAIL (1 of 1 GPU paths changed in omega 1b8c3fabd8a5 and not in CUDA++)
+PASS: mixed blob gate
+=== identical classification at baseline (exit 0, expected 0) ===
+DIVERGENCE: 1 shared, 1 same, 0 differ (0 licence-header only, 0 code); 0 cudapp-only, 0 omega-only
+DRIFT-GATE: PASS (1 GPU paths, omega 785a67892ccc, none moved away from CUDA++ since the baseline)
+PASS: identical classification at baseline
+=== identical blob gate (exit 0, expected 0) ===
+DIVERGENCE: 1 shared, 1 same, 0 differ (0 licence-header only, 0 code); 0 cudapp-only, 0 omega-only
+DRIFT-GATE: PASS (1 GPU paths, omega 785a67892ccc, none moved away from CUDA++ since the baseline)
+PASS: identical blob gate
+=== large classification at baseline (exit 0, expected 0) ===
+DIVERGENCE: 1 shared, 0 same, 1 differ (0 licence-header only, 1 code); 0 cudapp-only, 0 omega-only
+DRIFT-GATE: PASS (1 GPU paths, omega 3bc591d23b79, none moved away from CUDA++ since the baseline)
+PASS: large classification at baseline
+=== large blob gate (exit 1, expected 1) ===
+DRIFT	src/omega_gpu_case.c	differs	57f675cc176344229de1fd23ce49c67b50b4a2ef
+DIVERGENCE: 1 shared, 0 same, 1 differ (0 licence-header only, 1 code); 0 cudapp-only, 0 omega-only
+DRIFT-GATE: FAIL (1 of 1 GPU paths changed in omega 3bc591d23b79 and not in CUDA++)
+PASS: large blob gate
+=== binary classification at baseline (exit 0, expected 0) ===
+DIVERGENCE: 1 shared, 0 same, 1 differ (0 licence-header only, 1 code); 0 cudapp-only, 0 omega-only
+DRIFT-GATE: PASS (1 GPU paths, omega e2abc1188b7b, none moved away from CUDA++ since the baseline)
+PASS: binary classification at baseline
+=== binary blob gate (exit 1, expected 1) ===
+DRIFT	src/omega_gpu_case.c	differs	1d5e8a9f97214c0a726e2762d65c08ce9339ab1a
+DIVERGENCE: 1 shared, 0 same, 1 differ (0 licence-header only, 1 code); 0 cudapp-only, 0 omega-only
+DRIFT-GATE: FAIL (1 of 1 GPU paths changed in omega e2abc1188b7b and not in CUDA++)
+PASS: binary blob gate
+=== built-in negative controls (exit 0, expected 0) ===
+control 1: red as required (src/omega_gpu_case.c)
+control 2: red as required (src/omega_gpu_same.c edited in a scratch Omega commit)
+real check:
+DIVERGENCE: 2 shared, 1 same, 1 differ (0 licence-header only, 1 code); 0 cudapp-only, 0 omega-only
+DRIFT-GATE: PASS (2 GPU paths, omega 83f4251157e5, none moved away from CUDA++ since the baseline)
+SELF-TEST: PASS (both controls red, real check green)
+PASS: built-in negative controls
+=== invalid ref in direct mode (exit 2, expected 2) ===
+fatal: Needed a single revision
+DRIFT-GATE: NOT_RUN (map failed)
+PASS: invalid ref in direct mode
+=== invalid ref in self-test mode (exit 2, expected 2) ===
+fatal: Needed a single revision
+DRIFT-GATE: NOT_RUN (map failed)
+PASS: invalid ref in self-test mode
+=== baseline is a directory (exit 2, expected 2) ===
+DRIFT-GATE: NOT_RUN (baseline /tmp/tmp.KvXY84u1pi/baseline-directory is not a readable nonempty file)
+PASS: baseline is a directory
+=== baseline is unreadable (exit 2, expected 2) ===
+DRIFT-GATE: NOT_RUN (baseline /tmp/tmp.KvXY84u1pi/baseline is not a readable nonempty file)
+PASS: baseline is unreadable
+=== baseline comparison read error (exit 2, expected 2) ===
+injected awk read error
+DRIFT-GATE: NOT_RUN (baseline comparison failed)
+PASS: baseline comparison read error
+=== missing blob (exit 2, expected 2) ===
+fatal: git cat-file af31bb5a4f0ffbf774b821f31926a4db3b038383: bad file
+DRIFT-GATE: NOT_RUN (summary failed)
+PASS: missing blob
+=== missing blob (exit 2, expected 2) ===
+fatal: git cat-file 2721fea320e0429c40f26e27b873ef11f778eda5: bad file
+DRIFT-GATE: NOT_RUN (summary failed)
+PASS: missing blob
+=== diff error (exit 2, expected 2) ===
+injected diff error
+summary: expected differing blobs for src/omega_gpu_case.c, diff returned 2
+DRIFT-GATE: NOT_RUN (summary failed)
+PASS: diff error
+=== diff error in self-test mode (exit 2, expected 2) ===
+injected diff error
+summary: expected differing blobs for src/omega_gpu_case.c, diff returned 2
+DRIFT	src/omega_gpu_case.c	differs	af31bb5a4f0ffbf774b821f31926a4db3b038383
+DRIFT-GATE: NOT_RUN (summary failed)
+PASS: diff error in self-test mode
+=== diff reports identical for distinct blobs (exit 2, expected 2) ===
+summary: expected differing blobs for src/omega_gpu_case.c, diff returned 0
+DRIFT-GATE: NOT_RUN (summary failed)
+PASS: diff reports identical for distinct blobs
+=== one-time diff error in control 1 (exit 2, expected 2) ===
+injected one-time diff error
+summary: expected differing blobs for src/omega_gpu_case.c, diff returned 2
+DRIFT	src/omega_gpu_case.c	differs	af31bb5a4f0ffbf774b821f31926a4db3b038383
+DRIFT-GATE: NOT_RUN (summary failed)
+PASS: one-time diff error in control 1
+=== one-time diff error in control 2 (exit 2, expected 2) ===
+control 1: red as required (src/omega_gpu_case.c)
+injected one-time diff error
+summary: expected differing blobs for src/omega_gpu_case.c, diff returned 2
+DRIFT	src/omega_gpu_same.c	differs	4d2b7f7850fa3bfa95740f2668a893b707e59eb4
+DRIFT-GATE: NOT_RUN (summary failed)
+PASS: one-time diff error in control 2
+DRIFT REGRESSION TESTS PASS
+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_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_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_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
+exit=2
diff --git a/evidence/DRIFT-GATE-20261027/original-regression.log b/evidence/DRIFT-GATE-20261027/original-regression.log
new file mode 100644
index 00000000..c26ec186
--- /dev/null
+++ b/evidence/DRIFT-GATE-20261027/original-regression.log
@@ -0,0 +1,143 @@
+production_source=67f3135ef88d8f520dfc15a2b2bc3264f53f0d6a:tools/extract/drift.sh
+test_source=54fac045b90f441d627240de8fb3156cf9997ea7:tools/extract/test-drift.sh
+command=bash test-drift.sh (original drift/map scripts in isolated fixture)
+=== code classification at baseline (exit 0, expected 0) ===
+DIVERGENCE: 1 shared, 0 same, 1 differ (1 licence-header only, 0 code); 0 cudapp-only, 0 omega-only
+DRIFT-GATE: PASS (1 GPU paths, omega 7964183fddbe, none moved away from CUDA++ since the baseline)
+FAIL: code classification at baseline
+=== code blob gate (exit 1, expected 1) ===
+DRIFT	src/omega_gpu_case.c	differs	af31bb5a4f0ffbf774b821f31926a4db3b038383
+DIVERGENCE: 1 shared, 0 same, 1 differ (1 licence-header only, 0 code); 0 cudapp-only, 0 omega-only
+DRIFT-GATE: FAIL (1 of 1 GPU paths changed in omega 7964183fddbe and not in CUDA++)
+FAIL: code blob gate
+=== header classification at baseline (exit 0, expected 0) ===
+DIVERGENCE: 1 shared, 0 same, 1 differ (1 licence-header only, 0 code); 0 cudapp-only, 0 omega-only
+DRIFT-GATE: PASS (1 GPU paths, omega 4bcde41408b1, none moved away from CUDA++ since the baseline)
+PASS: header classification at baseline
+=== header blob gate (exit 1, expected 1) ===
+DRIFT	src/omega_gpu_case.c	differs	2f88238630d9fd6a4c438013745aedc1550f5081
+DIVERGENCE: 1 shared, 0 same, 1 differ (1 licence-header only, 0 code); 0 cudapp-only, 0 omega-only
+DRIFT-GATE: FAIL (1 of 1 GPU paths changed in omega 4bcde41408b1 and not in CUDA++)
+PASS: header blob gate
+=== mixed classification at baseline (exit 0, expected 0) ===
+DIVERGENCE: 1 shared, 0 same, 1 differ (1 licence-header only, 0 code); 0 cudapp-only, 0 omega-only
+DRIFT-GATE: PASS (1 GPU paths, omega 4bcde41408b1, none moved away from CUDA++ since the baseline)
+FAIL: mixed classification at baseline
+=== mixed blob gate (exit 1, expected 1) ===
+DRIFT	src/omega_gpu_case.c	differs	2f88238630d9fd6a4c438013745aedc1550f5081
+DIVERGENCE: 1 shared, 0 same, 1 differ (1 licence-header only, 0 code); 0 cudapp-only, 0 omega-only
+DRIFT-GATE: FAIL (1 of 1 GPU paths changed in omega 4bcde41408b1 and not in CUDA++)
+FAIL: mixed blob gate
+=== identical classification at baseline (exit 0, expected 0) ===
+DIVERGENCE: 1 shared, 1 same, 0 differ (0 licence-header only, 0 code); 0 cudapp-only, 0 omega-only
+DRIFT-GATE: PASS (1 GPU paths, omega 46e4d695dcba, none moved away from CUDA++ since the baseline)
+PASS: identical classification at baseline
+=== identical blob gate (exit 0, expected 0) ===
+DIVERGENCE: 1 shared, 1 same, 0 differ (0 licence-header only, 0 code); 0 cudapp-only, 0 omega-only
+DRIFT-GATE: PASS (1 GPU paths, omega 46e4d695dcba, none moved away from CUDA++ since the baseline)
+PASS: identical blob gate
+=== large classification at baseline (exit 0, expected 0) ===
+grep: write error: Broken pipe
+diff: standard output: Broken pipe
+DIVERGENCE: 1 shared, 0 same, 1 differ (1 licence-header only, 0 code); 0 cudapp-only, 0 omega-only
+DRIFT-GATE: PASS (1 GPU paths, omega 7cbae68b4341, none moved away from CUDA++ since the baseline)
+FAIL: large classification at baseline
+=== large blob gate (exit 1, expected 1) ===
+DRIFT	src/omega_gpu_case.c	differs	57f675cc176344229de1fd23ce49c67b50b4a2ef
+grep: write error: Broken pipe
+diff: standard output: Broken pipe
+DIVERGENCE: 1 shared, 0 same, 1 differ (1 licence-header only, 0 code); 0 cudapp-only, 0 omega-only
+DRIFT-GATE: FAIL (1 of 1 GPU paths changed in omega 7cbae68b4341 and not in CUDA++)
+FAIL: large blob gate
+=== binary classification at baseline (exit 0, expected 0) ===
+DIVERGENCE: 1 shared, 0 same, 1 differ (1 licence-header only, 0 code); 0 cudapp-only, 0 omega-only
+DRIFT-GATE: PASS (1 GPU paths, omega 41ecffcfc459, none moved away from CUDA++ since the baseline)
+FAIL: binary classification at baseline
+=== binary blob gate (exit 1, expected 1) ===
+DRIFT	src/omega_gpu_case.c	differs	1d5e8a9f97214c0a726e2762d65c08ce9339ab1a
+DIVERGENCE: 1 shared, 0 same, 1 differ (1 licence-header only, 0 code); 0 cudapp-only, 0 omega-only
+DRIFT-GATE: FAIL (1 of 1 GPU paths changed in omega 41ecffcfc459 and not in CUDA++)
+FAIL: binary blob gate
+=== built-in negative controls (exit 0, expected 0) ===
+control 1: red as required (src/omega_gpu_case.c)
+control 2: red as required (src/omega_gpu_same.c edited in a scratch Omega commit)
+real check:
+DIVERGENCE: 2 shared, 1 same, 1 differ (1 licence-header only, 0 code); 0 cudapp-only, 0 omega-only
+DRIFT-GATE: PASS (2 GPU paths, omega 797167745d95, none moved away from CUDA++ since the baseline)
+SELF-TEST: PASS (both controls red, real check green)
+PASS: built-in negative controls
+=== invalid ref in direct mode (exit 0, expected 2) ===
+fatal: Needed a single revision
+DIVERGENCE: 0 shared, 0 same, 0 differ (0 licence-header only, 0 code); 0 cudapp-only, 0 omega-only
+fatal: Needed a single revision
+DRIFT-GATE: PASS (-1 GPU paths, omega , none moved away from CUDA++ since the baseline)
+FAIL: invalid ref in direct mode
+=== invalid ref in self-test mode (exit 128, expected 2) ===
+fatal: Needed a single revision
+FAIL: invalid ref in self-test mode
+=== baseline is a directory (exit 0, expected 2) ===
+awk: cannot open "/tmp/tmp.TfUhbT482U/baseline-directory" (Is a directory)
+DIVERGENCE: 2 shared, 1 same, 1 differ (1 licence-header only, 0 code); 0 cudapp-only, 0 omega-only
+DRIFT-GATE: PASS (2 GPU paths, omega 797167745d95, none moved away from CUDA++ since the baseline)
+FAIL: baseline is a directory
+=== baseline is unreadable (exit 0, expected 2) ===
+awk: cannot open "/tmp/tmp.TfUhbT482U/baseline" (Permission denied)
+DIVERGENCE: 2 shared, 1 same, 1 differ (1 licence-header only, 0 code); 0 cudapp-only, 0 omega-only
+DRIFT-GATE: PASS (2 GPU paths, omega 797167745d95, none moved away from CUDA++ since the baseline)
+FAIL: baseline is unreadable
+=== baseline comparison read error (exit 0, expected 2) ===
+injected awk read error
+DIVERGENCE: 2 shared, 1 same, 1 differ (1 licence-header only, 0 code); 0 cudapp-only, 0 omega-only
+DRIFT-GATE: PASS (2 GPU paths, omega 797167745d95, none moved away from CUDA++ since the baseline)
+FAIL: baseline comparison read error
+=== missing blob (exit 0, expected 2) ===
+fatal: Not a valid object name af31bb5a4f0ffbf774b821f31926a4db3b038383
+DIVERGENCE: 2 shared, 1 same, 1 differ (1 licence-header only, 0 code); 0 cudapp-only, 0 omega-only
+DRIFT-GATE: PASS (2 GPU paths, omega 797167745d95, none moved away from CUDA++ since the baseline)
+FAIL: missing blob
+=== missing blob (exit 0, expected 2) ===
+fatal: Not a valid object name 2721fea320e0429c40f26e27b873ef11f778eda5
+DIVERGENCE: 2 shared, 1 same, 1 differ (1 licence-header only, 0 code); 0 cudapp-only, 0 omega-only
+DRIFT-GATE: PASS (2 GPU paths, omega 797167745d95, none moved away from CUDA++ since the baseline)
+FAIL: missing blob
+=== diff error (exit 0, expected 2) ===
+injected diff error
+DIVERGENCE: 2 shared, 1 same, 1 differ (1 licence-header only, 0 code); 0 cudapp-only, 0 omega-only
+DRIFT-GATE: PASS (2 GPU paths, omega 797167745d95, none moved away from CUDA++ since the baseline)
+FAIL: diff error
+=== diff error in self-test mode (exit 0, expected 2) ===
+injected diff error
+control 1: red as required (src/omega_gpu_case.c)
+injected diff error
+injected diff error
+control 2: red as required (src/omega_gpu_same.c edited in a scratch Omega commit)
+real check:
+injected diff error
+DIVERGENCE: 2 shared, 1 same, 1 differ (1 licence-header only, 0 code); 0 cudapp-only, 0 omega-only
+DRIFT-GATE: PASS (2 GPU paths, omega 797167745d95, none moved away from CUDA++ since the baseline)
+SELF-TEST: PASS (both controls red, real check green)
+FAIL: diff error in self-test mode
+=== diff reports identical for distinct blobs (exit 0, expected 2) ===
+DIVERGENCE: 2 shared, 1 same, 1 differ (1 licence-header only, 0 code); 0 cudapp-only, 0 omega-only
+DRIFT-GATE: PASS (2 GPU paths, omega 797167745d95, none moved away from CUDA++ since the baseline)
+FAIL: diff reports identical for distinct blobs
+=== one-time diff error in control 1 (exit 0, expected 2) ===
+injected one-time diff error
+control 1: red as required (src/omega_gpu_case.c)
+control 2: red as required (src/omega_gpu_same.c edited in a scratch Omega commit)
+real check:
+DIVERGENCE: 2 shared, 1 same, 1 differ (1 licence-header only, 0 code); 0 cudapp-only, 0 omega-only
+DRIFT-GATE: PASS (2 GPU paths, omega 797167745d95, none moved away from CUDA++ since the baseline)
+SELF-TEST: PASS (both controls red, real check green)
+FAIL: one-time diff error in control 1
+=== one-time diff error in control 2 (exit 0, expected 2) ===
+control 1: red as required (src/omega_gpu_case.c)
+injected one-time diff error
+control 2: red as required (src/omega_gpu_same.c edited in a scratch Omega commit)
+real check:
+DIVERGENCE: 2 shared, 1 same, 1 differ (1 licence-header only, 0 code); 0 cudapp-only, 0 omega-only
+DRIFT-GATE: PASS (2 GPU paths, omega 797167745d95, none moved away from CUDA++ since the baseline)
+SELF-TEST: PASS (both controls red, real check green)
+FAIL: one-time diff error in control 2
+DRIFT REGRESSION TESTS FAIL
+exit=1
diff --git a/evidence/DRIFT-GATE-20261027/regression.log b/evidence/DRIFT-GATE-20261027/regression.log
new file mode 100644
index 00000000..7ebccd0b
--- /dev/null
+++ b/evidence/DRIFT-GATE-20261027/regression.log
@@ -0,0 +1,123 @@
+source_commit=54fac045b90f441d627240de8fb3156cf9997ea7
+base_commit=67f3135ef88d8f520dfc15a2b2bc3264f53f0d6a
+command=make test-drift
+Linux x86_64
+GNU bash, version 5.2.37(1)-release (x86_64-pc-linux-gnu)
+bash tools/extract/test-drift.sh
+=== code classification at baseline (exit 0, expected 0) ===
+DIVERGENCE: 1 shared, 0 same, 1 differ (0 licence-header only, 1 code); 0 cudapp-only, 0 omega-only
+DRIFT-GATE: PASS (1 GPU paths, omega d365c776c611, none moved away from CUDA++ since the baseline)
+PASS: code classification at baseline
+=== code blob gate (exit 1, expected 1) ===
+DRIFT	src/omega_gpu_case.c	differs	af31bb5a4f0ffbf774b821f31926a4db3b038383
+DIVERGENCE: 1 shared, 0 same, 1 differ (0 licence-header only, 1 code); 0 cudapp-only, 0 omega-only
+DRIFT-GATE: FAIL (1 of 1 GPU paths changed in omega d365c776c611 and not in CUDA++)
+PASS: code blob gate
+=== header classification at baseline (exit 0, expected 0) ===
+DIVERGENCE: 1 shared, 0 same, 1 differ (1 licence-header only, 0 code); 0 cudapp-only, 0 omega-only
+DRIFT-GATE: PASS (1 GPU paths, omega 38a2a7630699, none moved away from CUDA++ since the baseline)
+PASS: header classification at baseline
+=== header blob gate (exit 1, expected 1) ===
+DRIFT	src/omega_gpu_case.c	differs	2f88238630d9fd6a4c438013745aedc1550f5081
+DIVERGENCE: 1 shared, 0 same, 1 differ (1 licence-header only, 0 code); 0 cudapp-only, 0 omega-only
+DRIFT-GATE: FAIL (1 of 1 GPU paths changed in omega 38a2a7630699 and not in CUDA++)
+PASS: header blob gate
+=== mixed classification at baseline (exit 0, expected 0) ===
+DIVERGENCE: 1 shared, 0 same, 1 differ (0 licence-header only, 1 code); 0 cudapp-only, 0 omega-only
+DRIFT-GATE: PASS (1 GPU paths, omega 9e1e0919ca58, none moved away from CUDA++ since the baseline)
+PASS: mixed classification at baseline
+=== mixed blob gate (exit 1, expected 1) ===
+DRIFT	src/omega_gpu_case.c	differs	2f88238630d9fd6a4c438013745aedc1550f5081
+DIVERGENCE: 1 shared, 0 same, 1 differ (0 licence-header only, 1 code); 0 cudapp-only, 0 omega-only
+DRIFT-GATE: FAIL (1 of 1 GPU paths changed in omega 9e1e0919ca58 and not in CUDA++)
+PASS: mixed blob gate
+=== identical classification at baseline (exit 0, expected 0) ===
+DIVERGENCE: 1 shared, 1 same, 0 differ (0 licence-header only, 0 code); 0 cudapp-only, 0 omega-only
+DRIFT-GATE: PASS (1 GPU paths, omega 3223cfcfb143, none moved away from CUDA++ since the baseline)
+PASS: identical classification at baseline
+=== identical blob gate (exit 0, expected 0) ===
+DIVERGENCE: 1 shared, 1 same, 0 differ (0 licence-header only, 0 code); 0 cudapp-only, 0 omega-only
+DRIFT-GATE: PASS (1 GPU paths, omega 3223cfcfb143, none moved away from CUDA++ since the baseline)
+PASS: identical blob gate
+=== large classification at baseline (exit 0, expected 0) ===
+DIVERGENCE: 1 shared, 0 same, 1 differ (0 licence-header only, 1 code); 0 cudapp-only, 0 omega-only
+DRIFT-GATE: PASS (1 GPU paths, omega b9c403710f93, none moved away from CUDA++ since the baseline)
+PASS: large classification at baseline
+=== large blob gate (exit 1, expected 1) ===
+DRIFT	src/omega_gpu_case.c	differs	57f675cc176344229de1fd23ce49c67b50b4a2ef
+DIVERGENCE: 1 shared, 0 same, 1 differ (0 licence-header only, 1 code); 0 cudapp-only, 0 omega-only
+DRIFT-GATE: FAIL (1 of 1 GPU paths changed in omega b9c403710f93 and not in CUDA++)
+PASS: large blob gate
+=== binary classification at baseline (exit 0, expected 0) ===
+DIVERGENCE: 1 shared, 0 same, 1 differ (0 licence-header only, 1 code); 0 cudapp-only, 0 omega-only
+DRIFT-GATE: PASS (1 GPU paths, omega 2cc46cacf1eb, none moved away from CUDA++ since the baseline)
+PASS: binary classification at baseline
+=== binary blob gate (exit 1, expected 1) ===
+DRIFT	src/omega_gpu_case.c	differs	1d5e8a9f97214c0a726e2762d65c08ce9339ab1a
+DIVERGENCE: 1 shared, 0 same, 1 differ (0 licence-header only, 1 code); 0 cudapp-only, 0 omega-only
+DRIFT-GATE: FAIL (1 of 1 GPU paths changed in omega 2cc46cacf1eb and not in CUDA++)
+PASS: binary blob gate
+=== built-in negative controls (exit 0, expected 0) ===
+control 1: red as required (src/omega_gpu_case.c)
+control 2: red as required (src/omega_gpu_same.c edited in a scratch Omega commit)
+real check:
+DIVERGENCE: 2 shared, 1 same, 1 differ (0 licence-header only, 1 code); 0 cudapp-only, 0 omega-only
+DRIFT-GATE: PASS (2 GPU paths, omega 9b35c231d03a, none moved away from CUDA++ since the baseline)
+SELF-TEST: PASS (both controls red, real check green)
+PASS: built-in negative controls
+=== invalid ref in direct mode (exit 2, expected 2) ===
+fatal: Needed a single revision
+DRIFT-GATE: NOT_RUN (map failed)
+PASS: invalid ref in direct mode
+=== invalid ref in self-test mode (exit 2, expected 2) ===
+fatal: Needed a single revision
+DRIFT-GATE: NOT_RUN (map failed)
+PASS: invalid ref in self-test mode
+=== baseline is a directory (exit 2, expected 2) ===
+DRIFT-GATE: NOT_RUN (baseline /tmp/tmp.CoJW5651Mz/baseline-directory is not a readable nonempty file)
+PASS: baseline is a directory
+=== baseline is unreadable (exit 2, expected 2) ===
+DRIFT-GATE: NOT_RUN (baseline /tmp/tmp.CoJW5651Mz/baseline is not a readable nonempty file)
+PASS: baseline is unreadable
+=== baseline comparison read error (exit 2, expected 2) ===
+injected awk read error
+DRIFT-GATE: NOT_RUN (baseline comparison failed)
+PASS: baseline comparison read error
+=== missing blob (exit 2, expected 2) ===
+fatal: git cat-file af31bb5a4f0ffbf774b821f31926a4db3b038383: bad file
+DRIFT-GATE: NOT_RUN (summary failed)
+PASS: missing blob
+=== missing blob (exit 2, expected 2) ===
+fatal: git cat-file 2721fea320e0429c40f26e27b873ef11f778eda5: bad file
+DRIFT-GATE: NOT_RUN (summary failed)
+PASS: missing blob
+=== diff error (exit 2, expected 2) ===
+injected diff error
+summary: expected differing blobs for src/omega_gpu_case.c, diff returned 2
+DRIFT-GATE: NOT_RUN (summary failed)
+PASS: diff error
+=== diff error in self-test mode (exit 2, expected 2) ===
+injected diff error
+summary: expected differing blobs for src/omega_gpu_case.c, diff returned 2
+DRIFT	src/omega_gpu_case.c	differs	af31bb5a4f0ffbf774b821f31926a4db3b038383
+DRIFT-GATE: NOT_RUN (summary failed)
+PASS: diff error in self-test mode
+=== diff reports identical for distinct blobs (exit 2, expected 2) ===
+summary: expected differing blobs for src/omega_gpu_case.c, diff returned 0
+DRIFT-GATE: NOT_RUN (summary failed)
+PASS: diff reports identical for distinct blobs
+=== one-time diff error in control 1 (exit 2, expected 2) ===
+injected one-time diff error
+summary: expected differing blobs for src/omega_gpu_case.c, diff returned 2
+DRIFT	src/omega_gpu_case.c	differs	af31bb5a4f0ffbf774b821f31926a4db3b038383
+DRIFT-GATE: NOT_RUN (summary failed)
+PASS: one-time diff error in control 1
+=== one-time diff error in control 2 (exit 2, expected 2) ===
+control 1: red as required (src/omega_gpu_case.c)
+injected one-time diff error
+summary: expected differing blobs for src/omega_gpu_case.c, diff returned 2
+DRIFT	src/omega_gpu_same.c	differs	4d2b7f7850fa3bfa95740f2668a893b707e59eb4
+DRIFT-GATE: NOT_RUN (summary failed)
+PASS: one-time diff error in control 2
+DRIFT REGRESSION TESTS PASS
+exit=0
diff --git a/tools/extract/drift.sh b/tools/extract/drift.sh
index b3c62299..3f1be91f 100755
--- a/tools/extract/drift.sh
+++ b/tools/extract/drift.sh
@@ -31,7 +31,7 @@ if [[ ${1:-} == --self-test ]]; then selftest=1; shift; fi
 omega=${1:?omega dir}; oref=${2:?omega ref}
 here=$(cd "$(dirname "$0")" && pwd)
 baseline=${3:-$here/drift-baseline.tsv}
-[[ -s $baseline ]] || { echo "DRIFT-GATE: NOT_RUN (baseline $baseline missing)"; exit 2; }
+[[ -f $baseline && -r $baseline && -s $baseline ]] || { echo "DRIFT-GATE: NOT_RUN (baseline $baseline is not a readable nonempty file)"; exit 2; }
 
 scratch=$(mktemp -d); trap 'rm -rf "$scratch"' EXIT
 cudapp=$(git -C "$here" rev-parse --show-toplevel)
@@ -39,28 +39,41 @@ cudapp=$(git -C "$here" rev-parse --show-toplevel)
 # summary MAP OMEGA_DIR: one DIVERGENCE line. Shared = path present in both repos. A `differs` file is
 # header-only when every changed line is a licence-header line (the SPDX/Apache boilerplate).
 summary() {
-    local map=$1 dir=$2 hdr=0 code=0 op cp st ob cb
+    local map=$1 dir=$2 hdr=0 code=0 op cp st ob cb rc kind
     while IFS=$'\t' read -r op cp st ob cb; do
         [[ $st == differs ]] || continue
-        if diff <(git -C "$dir" cat-file -p "$ob") <(git -C "$cudapp" cat-file -p "$cb") | grep '^[<>]' \
-            | grep -qviE 'SPDX|copyright|licen[cs]e|apache|LLVM|applicable law|AS IS|you may not use|obtain a copy|distributed under|WITHOUT WARRANTIES|limitations under|^[<>] *(//|#|/?\*|\*/)? *$'
-        then code=$((code + 1)); else hdr=$((hdr + 1)); fi
-    done < <(tail -n +2 "$map")
+        # Process substitutions hide cat-file failures. Materialize both blobs and
+        # the whole diff: status 1 means different, not a pipeline failure, and no
+        # early-exit consumer can give diff a broken pipe.
+        git -C "$dir" cat-file blob "$ob" > "$scratch/omega-blob" || return 2
+        git -C "$cudapp" cat-file blob "$cb" > "$scratch/cudapp-blob" || return 2
+        rc=0
+        diff "$scratch/omega-blob" "$scratch/cudapp-blob" > "$scratch/changes" || rc=$?
+        if [[ $rc -ne 1 ]]; then
+            echo "summary: expected differing blobs for $op, diff returned $rc" >&2
+            return 2
+        fi
+        kind=$(awk '/^[<>]/ { changed=1
+                if (tolower($0) !~ /spdx|copyright|licen[cs]e|apache|llvm|applicable law|as is|you may not use|obtain a copy|distributed under|without warranties|limitations under|^[<>] *(\/\/|#|\/?\*|\*\/)? *$/) code=1 }
+            END { print (changed && !code ? "header" : "code") }' "$scratch/changes") || return 2
+        if [[ $kind == code ]]; then code=$((code + 1)); else hdr=$((hdr + 1)); fi
+    done < "$map"
     awk -F'\t' -v hdr="$hdr" -v code="$code" 'FNR > 1 { n[$3]++ }
         END { sh = n["same"] + n["differs"]
               printf "DIVERGENCE: %d shared, %d same, %d differ (%d licence-header only, %d code); %d cudapp-only, %d omega-only\n",
                      sh, n["same"], n["differs"], hdr, code, n["cudapp-only"], n["omega-only"] }' "$map"
 }
-# check OMEGA_DIR OMEGA_REF BASELINE: prints DRIFT lines and the verdict; returns 0 PASS / 1 FAIL.
+# check OMEGA_DIR OMEGA_REF BASELINE: returns 0 PASS / 1 FAIL / 2 broken setup.
 check() {
     local dir=$1 ref=$2 base=$3 map=$scratch/map.$RANDOM
-    "$here/map.sh" "$dir" "$ref" HEAD > "$map"
+    "$here/map.sh" "$dir" "$ref" HEAD > "$map" || { echo "DRIFT-GATE: NOT_RUN (map failed)"; return 2; }
     awk -F'\t' 'NR==FNR { if ($1 !~ /^#/) b[$1]=$2; next }
         FNR==1 { next }
         $4 != "-" && ($3 == "differs" || $3 == "omega-only") && b[$1] != $4 {
-            printf "DRIFT\t%s\t%s\t%s\n", $1, $3, $4 }' "$base" "$map" > "$map.drift"
+            printf "DRIFT\t%s\t%s\t%s\n", $1, $3, $4 }' "$base" "$map" > "$map.drift" \
+        || { echo "DRIFT-GATE: NOT_RUN (baseline comparison failed)"; return 2; }
     cat "$map.drift"
-    summary "$map" "$dir"
+    summary "$map" "$dir" || { echo "DRIFT-GATE: NOT_RUN (summary failed)"; return 2; }
     local n rows
     n=$(wc -l < "$map.drift"); rows=$(($(wc -l < "$map") - 1))
     if [[ $n -eq 0 ]]; then
@@ -72,11 +85,11 @@ check() {
 }
 
 if [[ $selftest -eq 0 ]]; then
-    check "$omega" "$oref" "$baseline" && exit 0 || exit 1
+    if check "$omega" "$oref" "$baseline"; then exit 0; else exit $?; fi
 fi
 
 fail=0
-"$here/map.sh" "$omega" "$oref" HEAD > "$scratch/now"
+"$here/map.sh" "$omega" "$oref" HEAD > "$scratch/now" || { echo "DRIFT-GATE: NOT_RUN (map failed)"; exit 2; }
 
 # Control 1: baseline blob of one cutover-time `differs` path replaced.
 victim=$(awk -F'\t' 'NR==FNR { if ($1 !~ /^#/) b[$1]=$2; next } FNR>1 && $3=="differs" && b[$1]==$4 { print $1; exit }' \
@@ -84,7 +97,8 @@ victim=$(awk -F'\t' 'NR==FNR { if ($1 !~ /^#/) b[$1]=$2; next } FNR>1 && $3=="di
 if [[ -z $victim ]]; then echo "control 1: NOT_RUN (no differs path recorded in the baseline)"; fail=1
 else
     awk -F'\t' -v OFS='\t' -v v="$victim" '$1==v { $2="0000000000000000000000000000000000000000" } 1' "$baseline" > "$scratch/base1"
-    out=$(check "$omega" "$oref" "$scratch/base1" || true)
+    rc=0; out=$(check "$omega" "$oref" "$scratch/base1") || rc=$?
+    if [[ $rc -eq 2 ]]; then echo "$out"; exit 2; fi
     if grep -qxF "DRIFT	$victim	differs	$(awk -F'\t' -v v="$victim" '$1==v {print $4}' "$scratch/now")" <<< "$out" \
         && grep -q '^DRIFT-GATE: FAIL' <<< "$out"; then echo "control 1: red as required ($victim)"
     else echo "control 1: BROKEN, gate stayed green with a tampered baseline for $victim"; echo "$out"; fail=1; fi
@@ -100,13 +114,14 @@ else
     git -C "$scratch/om" checkout -q --detach "$(git -C "$omega" rev-parse "$oref^{commit}")"
     echo "/* drift.sh self-test edit */" >> "$scratch/om/$target"
     git -C "$scratch/om" -c user.name=drift-selftest -c user.email=drift@selftest.invalid commit -q -am "drift self-test"
-    out=$(check "$scratch/om" HEAD "$baseline" || true)
+    rc=0; out=$(check "$scratch/om" HEAD "$baseline") || rc=$?
+    if [[ $rc -eq 2 ]]; then echo "$out"; exit 2; fi
     if [[ $(grep -c '^DRIFT	' <<< "$out" || true) -ge 1 ]] && grep -q "^DRIFT	$target	differs	" <<< "$out" \
         && grep -q '^DRIFT-GATE: FAIL' <<< "$out"; then echo "control 2: red as required ($target edited in a scratch Omega commit)"
     else echo "control 2: BROKEN, gate stayed green after an Omega edit to $target"; echo "$out"; fail=1; fi
 fi
 
 echo "real check:"
-check "$omega" "$oref" "$baseline" || fail=1
+check "$omega" "$oref" "$baseline" || { rc=$?; [[ $rc -ne 2 ]] || exit 2; fail=1; }
 [[ $fail -eq 0 ]] && echo "SELF-TEST: PASS (both controls red, real check green)" || echo "SELF-TEST: FAIL"
 exit "$fail"
diff --git a/tools/extract/test-drift.sh b/tools/extract/test-drift.sh
new file mode 100644
index 00000000..abf6ffdd
--- /dev/null
+++ b/tools/extract/test-drift.sh
@@ -0,0 +1,170 @@
+#!/usr/bin/env bash
+# SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+# Host-only regressions for drift.sh. Uses local git repositories, no remote or device.
+set -euo pipefail
+export LC_ALL=C
+here=$(cd "$(dirname "$0")" && pwd)
+scratch=$(mktemp -d); trap 'rm -rf "$scratch"' EXIT
+export GIT_CONFIG_NOSYSTEM=1 GIT_CONFIG_GLOBAL=/dev/null
+export GIT_AUTHOR_NAME=drift-test GIT_AUTHOR_EMAIL=drift@test.invalid
+export GIT_COMMITTER_NAME=$GIT_AUTHOR_NAME GIT_COMMITTER_EMAIL=$GIT_AUTHOR_EMAIL
+fail=0
+
+fixture() {
+    local name=$1
+    c=$scratch/$name/cudapp; o=$scratch/$name/omega
+    mkdir -p "$c/tools/extract" "$c/src" "$o/src"
+    git init -q "$c"; git init -q "$o"
+    cp "$here/drift.sh" "$here/map.sh" "$c/tools/extract/"
+    for file in filemap.tsv shared.txt extra-paths.txt physics-paths.txt; do
+        printf '# fixture\n' > "$c/tools/extract/$file"
+    done
+}
+commit_pair() {
+    git -C "$c" add .; git -C "$c" commit -qm fixture
+    git -C "$o" add .; git -C "$o" commit -qm fixture
+    base=$scratch/baseline
+    git -C "$o" ls-tree -r HEAD src | awk '{print $4 "\t" $3}' > "$base"
+}
+run() {
+    local name=$1 want_rc=$2 want_summary=$3; shift 3
+    local rc=0 out=$scratch/output
+    "$@" > "$out" 2>&1 || rc=$?
+    echo "=== $name (exit $rc, expected $want_rc) ==="
+    cat "$out"
+    if [[ $rc -ne $want_rc ]] || ! grep -qxF "$want_summary" "$out"; then
+        echo "FAIL: $name"; fail=1
+    elif [[ $want_rc -eq 2 ]] && grep -qE '^(DIVERGENCE:|DRIFT-GATE: PASS|SELF-TEST: PASS)' "$out"; then
+        echo "FAIL: $name printed a success summary after a setup error"; fail=1
+    else echo "PASS: $name"; fi
+}
+
+# Each case has one shared path, with literal expected counts. Header-like words
+# retain the existing diagnostic heuristic; they do not bypass the blob gate.
+for kind in code header mixed identical large binary; do
+    fixture "$kind"
+    case $kind in
+        code)
+            printf 'int value = 1;\n' > "$o/src/omega_gpu_case.c"
+            printf 'int value = 2;\n' > "$c/src/omega_gpu_case.c" ;;
+        header)
+            printf '// SPDX-License-Identifier: MIT\nint value = 1;\n' > "$o/src/omega_gpu_case.c"
+            printf '// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception\nint value = 1;\n' > "$c/src/omega_gpu_case.c" ;;
+        mixed)
+            printf '// SPDX-License-Identifier: MIT\nint value = 1;\n' > "$o/src/omega_gpu_case.c"
+            printf '// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception\nint value = 2;\n' > "$c/src/omega_gpu_case.c" ;;
+        identical)
+            printf 'int value = 1;\n' > "$o/src/omega_gpu_case.c"
+            cp "$o/src/omega_gpu_case.c" "$c/src/omega_gpu_case.c" ;;
+        large)
+            awk 'BEGIN {for(i=0;i<20000;i++) print "int value_" i " = 1;"}' > "$o/src/omega_gpu_case.c"
+            awk 'BEGIN {for(i=0;i<20000;i++) print "int value_" i " = 2;"}' > "$c/src/omega_gpu_case.c" ;;
+        binary)
+            printf 'value\0one\n' > "$o/src/omega_gpu_case.c"
+            printf 'value\0two\n' > "$c/src/omega_gpu_case.c" ;;
+    esac
+    commit_pair
+    case $kind in
+        identical) summary='DIVERGENCE: 1 shared, 1 same, 0 differ (0 licence-header only, 0 code); 0 cudapp-only, 0 omega-only' ;;
+        header) summary='DIVERGENCE: 1 shared, 0 same, 1 differ (1 licence-header only, 0 code); 0 cudapp-only, 0 omega-only' ;;
+        *) summary='DIVERGENCE: 1 shared, 0 same, 1 differ (0 licence-header only, 1 code); 0 cudapp-only, 0 omega-only' ;;
+    esac
+    run "$kind classification at baseline" 0 "$summary" bash "$c/tools/extract/drift.sh" "$o" HEAD "$base"
+    # A changed baseline must still reject a header-only blob difference.
+    printf 'src/omega_gpu_case.c\t0000000000000000000000000000000000000000\n' > "$base"
+    rc=1; [[ $kind != identical ]] || rc=0
+    run "$kind blob gate" "$rc" "$summary" bash "$c/tools/extract/drift.sh" "$o" HEAD "$base"
+done
+
+fixture controls
+printf 'int value = 1;\n' > "$o/src/omega_gpu_case.c"
+printf 'int value = 2;\n' > "$c/src/omega_gpu_case.c"
+printf 'int same = 1;\n' > "$o/src/omega_gpu_same.c"
+cp "$o/src/omega_gpu_same.c" "$c/src/omega_gpu_same.c"
+commit_pair
+run 'built-in negative controls' 0 'SELF-TEST: PASS (both controls red, real check green)' \
+    bash "$c/tools/extract/drift.sh" --self-test "$o" HEAD "$base"
+run 'invalid ref in direct mode' 2 'DRIFT-GATE: NOT_RUN (map failed)' \
+    bash "$c/tools/extract/drift.sh" "$o" invalid-ref "$base"
+run 'invalid ref in self-test mode' 2 'DRIFT-GATE: NOT_RUN (map failed)' \
+    bash "$c/tools/extract/drift.sh" --self-test "$o" invalid-ref "$base"
+
+# A directory can satisfy -s. It is not a readable baseline file; awk failure
+# must never be interpreted as no drift. Reject unreadable files as well.
+mkdir "$scratch/baseline-directory"
+printf 'not a baseline\n' > "$scratch/baseline-directory/entry"
+run 'baseline is a directory' 2 "DRIFT-GATE: NOT_RUN (baseline $scratch/baseline-directory is not a readable nonempty file)" \
+    bash "$c/tools/extract/drift.sh" "$o" HEAD "$scratch/baseline-directory"
+chmod 000 "$base"
+if cat "$base" > /dev/null 2>&1; then
+    # Root/CAP_DAC_OVERRIDE may still read mode 000. That is a usable baseline,
+    # not an unreadable-file fixture. Check real readability independently.
+    run 'mode-000 baseline remains readable' 0 'DIVERGENCE: 2 shared, 1 same, 1 differ (0 licence-header only, 1 code); 0 cudapp-only, 0 omega-only' \
+        bash "$c/tools/extract/drift.sh" "$o" HEAD "$base"
+else
+    run 'baseline is unreadable' 2 "DRIFT-GATE: NOT_RUN (baseline $base is not a readable nonempty file)" \
+        bash "$c/tools/extract/drift.sh" "$o" HEAD "$base"
+fi
+chmod 600 "$base"
+
+# Also propagate a read failure after the baseline's initial validation.
+mkdir "$scratch/awk-bin"
+cat > "$scratch/awk-bin/awk" <<'EOF'
+#!/usr/bin/env bash
+for arg in "$@"; do
+    if [[ $arg == "$DRIFT_TEST_BASELINE" ]]; then echo 'injected awk read error' >&2; exit 2; fi
+done
+exec "$DRIFT_TEST_REAL_AWK" "$@"
+EOF
+chmod +x "$scratch/awk-bin/awk"
+run 'baseline comparison read error' 2 'DRIFT-GATE: NOT_RUN (baseline comparison failed)' \
+    env PATH="$scratch/awk-bin:$PATH" DRIFT_TEST_BASELINE="$base" DRIFT_TEST_REAL_AWK="$(command -v awk)" \
+    bash "$c/tools/extract/drift.sh" "$o" HEAD "$base"
+
+# ls-tree can still map a missing blob. Reading its content must fail closed,
+# not masquerade as a licence-header-only difference via process substitution.
+for repo in "$o" "$c"; do
+    blob=$(git -C "$repo" rev-parse HEAD:src/omega_gpu_case.c)
+    object=$repo/.git/objects/${blob:0:2}/${blob:2}
+    mv "$object" "$scratch/saved-blob"
+    run 'missing blob' 2 'DRIFT-GATE: NOT_RUN (summary failed)' \
+        bash "$c/tools/extract/drift.sh" "$o" HEAD "$base"
+    mv "$scratch/saved-blob" "$object"
+done
+
+# Deterministic diff I/O-error injection at the external command boundary.
+# All git mapping and blob extraction remain real.
+mkdir "$scratch/bin"
+printf '#!/usr/bin/env bash\necho "injected diff error" >&2\nexit 2\n' > "$scratch/bin/diff"
+chmod +x "$scratch/bin/diff"
+run 'diff error' 2 'DRIFT-GATE: NOT_RUN (summary failed)' \
+    env PATH="$scratch/bin:$PATH" bash "$c/tools/extract/drift.sh" "$o" HEAD "$base"
+run 'diff error in self-test mode' 2 'DRIFT-GATE: NOT_RUN (summary failed)' \
+    env PATH="$scratch/bin:$PATH" bash "$c/tools/extract/drift.sh" --self-test "$o" HEAD "$base"
+
+# A map row labelled differs must not silently accept an empty diff as a header.
+# Identical real blobs are covered above: map.sh labels them same and skips diff.
+printf '#!/usr/bin/env bash\nexit 0\n' > "$scratch/bin/diff"
+run 'diff reports identical for distinct blobs' 2 'DRIFT-GATE: NOT_RUN (summary failed)' \
+    env PATH="$scratch/bin:$PATH" bash "$c/tools/extract/drift.sh" "$o" HEAD "$base"
+
+# A setup error in either negative control must retain status 2 even when the
+# later real check would succeed. Do not swallow it with `check ... || true`.
+cat > "$scratch/bin/diff" <<'EOF'
+#!/usr/bin/env bash
+set -eu
+n=0
+if [[ -f $DRIFT_TEST_DIFF_COUNT ]]; then read -r n < "$DRIFT_TEST_DIFF_COUNT"; fi
+n=$((n + 1)); echo "$n" > "$DRIFT_TEST_DIFF_COUNT"
+if [[ $n -eq $DRIFT_TEST_DIFF_FAIL_AT ]]; then echo 'injected one-time diff error' >&2; exit 2; fi
+exec "$DRIFT_TEST_REAL_DIFF" "$@"
+EOF
+for control in 1 2; do
+    run "one-time diff error in control $control" 2 'DRIFT-GATE: NOT_RUN (summary failed)' \
+        env PATH="$scratch/bin:$PATH" DRIFT_TEST_DIFF_COUNT="$scratch/count-$control" \
+        DRIFT_TEST_DIFF_FAIL_AT="$control" DRIFT_TEST_REAL_DIFF="$(command -v diff)" \
+        bash "$c/tools/extract/drift.sh" --self-test "$o" HEAD "$base"
+done
+
+if [[ $fail -eq 0 ]]; then echo 'DRIFT REGRESSION TESTS PASS'; else echo 'DRIFT REGRESSION TESTS FAIL'; fi
+exit "$fail"