CUDA++: AIEN’s GPU machine-code toolchain, runtime and driver client for NVIDIA GPUs without the CUDA toolkit. Hardware coverage and driver replacement limits are explicit.
fix(native): repair trace emitter addresses and checked-wrapper refusals
merged3798dc26260ab0ce #85 · opened 2026-10-26 01:23 UTC · closed 2026-10-26 03:37 UTC · merged 2026-10-26 03:37 UTC
Imported from GitHub aien-dev/CUDApp#85, by drakestapleton
Base 60d6c57fc6821accce0027d65dd239355beeb543 · Head 687307103f5108fd8f73fe9e6feeb5b53255dcaf
Merged on GitHub as 68e1634ef21d81261606ff62b0197336771e9eb9; not reachable from main 21d8de285f713adf09e0d6ba6db2b37139d0674e (observed 2026-11-18T16:38:29Z)
drakestapleton wrote on 2026-10-26 01:23 UTC
Host-only repair for #84; not ready for GPU use
This draft targets feat/device-trace-emitter, not main, so the existing emitter owner can review/adopt the repair without their branch being overwritten. Base rechecked as 60d6c57fc6821accce0027d65dd239355beeb543; no visible correction or duplicate repair was present.
Evidence first
Four host-reference units pass, including the original 25 checks and three new independent semantic regressions.
The final address, flag, and complete-kernel tests fail against the original #84 source with statuses 3, 1, and 1.
Ten compiler-accepted mutations are rejected: pointer multiplication, flag-gate weakenings, EXIT-scan omissions/predicate mistakes, high/signed store offsets, and branch-displacement corruption.
Independent review reran the four final units and all ten mutants.
The real Omega compiler source accepts all original test units. The frozen external oracle predates const, so semantic runs use an explicitly labeled literal-constant projection. Original and projected units compile to byte-identical AArch64 ELFs. Those ELFs were not executed.
Offline nvdisasm 13.0.39 accepts the 640-byte stream and confirms the intended address forms. The binary and listing remain outside the repository.
Exact pins, commands, hashes, initial test gaps, and limitations are in the receipt and reproduction notes. Reviewed local tip 7076d6240fc52984815890de6005d8d99d014755 and published head 687307103f5108fd8f73fe9e6feeb5b53255dcaf have identical full tree f8f29dcacc5540d84c220d32610bd21084ca570a; connector publication changes commit metadata.
Changes
Replace erroneous base-low multiplication with the repository's existing MOV plus IMAD.WIDE.U32 form, computing the full-width base plus record offset. Marker length and branch displacement stay unchanged.
Require gtchecks == 1 for every nonzero enable value.
Reject the repository's EXIT encoding for all predicates before output mutation (error 5). Exercise the actual gbvec kernel as a negative control, including enable values 2 and maximum ulong.
Document the supported boundary: prepared straight-line body fragments, initialised/preserved R0 = TID.X, exactly one CTA, and explicit register clobbers/fallthrough requirements. This is not a general complete-kernel or CFG verifier.
Disabled output remains byte-identical under the existing capacity/alignment checks.
Known blockers and limits
The historical expected.sass is stale and the existing golden runner does not pass for this repair. It describes the old address bug. AGENTS.md forbids committing NVIDIA-tool listings, conflicting with the inherited runner's update mode. The golden/runner was not bypassed or silently rewritten; owner resolution is still required.
New semantic tests have documented standalone native commands but are not yet integrated into make test or the existing runner.
Full make test was attempted before and after the repair. Both exit 2 building build/omega_blackwell_engine.o: the x86 assembler rejects existing AArch64 ds instructions at lines 393 and 558. This is not a passing full suite.
Native AArch64 execution, GB10 execution/scheduling, QMD/launch wiring, off/on output equivalence and overhead, clock qualification, and chip repeatability are NOT_RUN.
Runtime overflow/drop accounting, partial capture, capacity 0/1 capture, and begin/end ranges remain unimplemented. Disabled capacity zero remains refused.
No changes to vector/launch/context code, qualification/admission gates, historical receipts, credentials, or trust configuration. No hardware use, merge, deployment, overhead, or CUDA-performance claim. Keep draft pending owner review and the missing native/integration work.
Exact-head CI follow-up
At 2026-10-26 01:25 UTC, head 687307103f5108fd8f73fe9e6feeb5b53255dcaf had no check runs, check suites, status checks, or Actions runs scheduled. CI is NOT_RUN, not successful. The target feat/device-trace-emitter is unprotected and not the default branch. This is consistent with GitHub's default-setup trigger rules, which cover PRs targeting default/protected branches; the repository's administrator-only setup details were not verified. No base, protection, or CI configuration was changed to manufacture a check result.
Apply it
git checkout -b patch-3798dc26260ab0ce60d6c57fc6821accce0027d65dd239355beeb543
curl -fsSL https://interplane.io/drakestapleton/CUDApp/patches/3798dc26260ab0ce.patch | git am
diff --git a/evidence/device-trace/emitter-safety-host-20261026/REPRODUCE.md b/evidence/device-trace/emitter-safety-host-20261026/REPRODUCE.md
new file mode 100644
index 00000000..f64b3643
--- /dev/null
+++ b/evidence/device-trace/emitter-safety-host-20261026/REPRODUCE.md
@@ -0,0 +1,111 @@
+# Local host-only repair evidence
+
+Read `receipt.json` for exact source, compiler, oracle, output hashes, statuses,
+negative controls, and unverified boundaries. Its source commit is a local
+isolated commit; file hashes identify the tested bytes independently of later
+publication metadata. No native AArch64 or GPU output was executed.
+
+The native commands for an appropriate AArch64 host are in
+`tests/device-trace/README-safety.md`. The existing disassembler runner is not
+green: its inherited golden describes the old pointer bug. No gate was bypassed
+and no NVIDIA-tool listing was committed to conceal that mismatch.
+
+## External oracle setup
+
+Obtain the existing `tools/omega_ref/omega_ref.c` from Omega commit
+`190130b71d0a59b93f01c515218a5509b149a145` in a separate test workspace. Check
+its SHA256 against the receipt before compiling it:
+
+```sh
+cc -O2 -g -std=gnu11 -Wall -Wextra -Werror -o omega_ref omega_ref.c -lpthread
+```
+
+Obtain the compiler source `seed/omc/omc.om` at the separate compiler revision
+in the receipt. Confirm both source and independently recorded seeded binary
+digests. The measured self-output command was:
+
+```sh
+./omega_ref check omc.om
+./omega_ref run omc.om < omc.om > compiler-self.elf 2> compiler-self.stderr
+sha256sum compiler-self.elf
+```
+
+It exited zero with empty stderr and matched the independently recorded
+`499236398aabc652e2dae27fe4bdc4c5db3d3726314356e0dbef23e3345803ec` digest.
+This is compiler-source execution by an external referee, not native compiler
+execution or seed-chain qualification.
+
+## Original versus projected units
+
+Compose the four original units as documented in the test README. The frozen
+oracle predates `const` and refuses the unmodified emitter with error 16.
+For semantic tests only, a separate copy was projected mechanically:
+
+1. Collect `const NAME ulong VALUE` lines. The emitter contains only decimal
+ unsigned-long literal constants and has no shadowed constant names.
+2. Remove those declaration lines.
+3. In non-`note` lines, replace whole `NAME` tokens with `ulong VALUE`. Preserve
+ all other text. Do not change the original units.
+
+For each original `unit.om` and its `unit.projected.om`:
+
+```sh
+./omega_ref check unit.projected.om
+./omega_ref run unit.projected.om > unit.stdout 2> unit.stderr
+./omega_ref run omc.om < unit.om > unit.elf 2> unit.compile.stderr
+./omega_ref run omc.om < unit.projected.om > projected.elf 2> projected.compile.stderr
+cmp unit.elf projected.elf
+```
+
+All final checks/runs/compiles exited zero with empty stderr, and every `cmp`
+matched. The four original and projected ELF hashes are recorded separately.
+They are AArch64 outputs and were **not executed**. Semantic execution claims
+refer only to the explicitly projected unit under the external oracle.
+
+## Red tests and mutation controls
+
+Before production changes, the original emitter test passed while the new
+address, guard, and whole-kernel tests failed with statuses 3, 1, and 1. After
+test refinements, repeat the same composition against the exact original PR84
+source from `git show 60d6c57fc6821accce0027d65dd239355beeb543:native/blackwell/trace-emit.om`.
+The compiler accepted those final red units, and they still failed 3, 1, and 1.
+
+Apply each mutation in a disposable source copy, never in the working tree.
+The receipt lists the expected failing test and its measured status:
+
+- Restore multiply-base-low plus high-copy address instructions.
+- Restore the original `on == 1 && checks == 0` gate.
+- Accept any nonzero `checks` instead of requiring exactly 1.
+- Skip the body refusal entirely.
+- Apply the body refusal only to `on == 1`.
+- Compare predicate bits as part of EXIT instead of masking them.
+- Set bit 16 or the sign bit of a store's signed 24-bit byte offset.
+- Set the branch high displacement word, or its upper encoded bits.
+
+All ten mutated units were accepted by the compiler and reference checker,
+but failed their semantic tests. Independent review repeated the four final
+unit runs and all ten mutation runs. Two initial test gaps and compiler
+register-pressure corrections are preserved in the receipt, not hidden.
+
+## External decode and full-suite boundary
+
+A dump unit calls `gtewrap 1 2` with an empty body and writes `gbout` to stdout.
+Its original and projected forms compiled to identical ELF bytes. The projected
+oracle run produced the GPU words, decoded offline with:
+
+```sh
+nvdisasm --binary SM121 words.bin > decoded.sass
+diff -u tests/device-trace/expected.sass decoded.sass
+```
+
+The disassembler exited zero. The diff exited one: only the two address
+instructions per marker changed, as intended. The downloadable official tool
+archive and all local output hashes are in the receipt. Those binaries and
+listings stay outside the repository.
+
+`make test` was attempted on both the base and repaired source. Both failed
+building `build/omega_blackwell_engine.o`, because the x86 assembler rejects
+the existing AArch64 `ds` instructions. No host suite success is claimed.
+The instruction scheduler, GB10 memory effects, launch geometry, visibility,
+overhead, and runtime overflow still require their separate authorized native
+and hardware work. No hardware authorization was requested or inferred.
diff --git a/evidence/device-trace/emitter-safety-host-20261026/receipt.json b/evidence/device-trace/emitter-safety-host-20261026/receipt.json
new file mode 100644
index 00000000..87ff9cc6
--- /dev/null
+++ b/evidence/device-trace/emitter-safety-host-20261026/receipt.json
@@ -0,0 +1,354 @@
+{
+ "schema": "cudapp.device-trace.emitter-safety-receipt.v1",
+ "date_utc": "2026-10-26",
+ "status": "LOCAL_HOST_ONLY_REPAIR; NOT_READY_FOR_GPU; HISTORICAL_GOLDEN_STALE",
+ "repository": "https://github.com/aien-dev/CUDApp",
+ "base_commit": "60d6c57fc6821accce0027d65dd239355beeb543",
+ "source_commit": "617c4905108c3895fce917c4b5e89403ef1d7325",
+ "platform": "Linux x86_64",
+ "source_sha256": {
+ "native/blackwell/trace-emit.om": "032925efb802f4ff6222245eb5bd6b1ba7ce4264f24ee04ece468717322789d9",
+ "tests/device-trace/address-test.om": "f58627bb65bd8255de76746dd1734f68d5773b6378b7a59d5a630a31afd0473d",
+ "tests/device-trace/guard-test.om": "2748a40d54dc8dfa1e2cd2717f04f626806aae1d3e5ce3668c78486fe6e1b582",
+ "tests/device-trace/body-test.om": "8dd759f8b77388f74dbb0f8a729251f47a4e5b6f65371ffc721ac2c607d88f79",
+ "tests/device-trace/README-safety.md": "3e83078722cabe8f0c22b05502de5e87926a5e96273425d0af6cda0b5428bb8a"
+ },
+ "implementation": [
+ "Replace multiply-base-low plus high-copy with existing MOV offset plus IMAD.WIDE.U32 base-pair add. Marker instruction count and branch displacement unchanged.",
+ "Require gtchecks exactly 1 for every nonzero enable value.",
+ "Reject input EXIT instructions independent of predicate before output mutation. Enabled input remains a prepared single-CTA linear fragment with explicit register and fallthrough preconditions, not a general complete-kernel wrapper."
+ ],
+ "oracle": {
+ "role": "Existing frozen external test referee, not product code, native execution, or part of the seed chain.",
+ "repository": "https://github.com/aien-dev/omega-mv",
+ "commit": "190130b71d0a59b93f01c515218a5509b149a145",
+ "source_path": "tools/omega_ref/omega_ref.c",
+ "source_sha256": "52e747096c1d978103432460a2978b21a604cc5d3e961bbe4b253fcc7636290e",
+ "binary_sha256": "81106113f7d031f709098cddb6f89f301a6f9d25ed0179d2e5ec36c75749c4f2",
+ "const_limitation": "Unmodified PR84 source is refused with error16 at first const declaration. Semantic runs use an explicitly recorded test-only literal-constant projection; they are NOT runs of the unmodified source.",
+ "projection": "Remove const NAME ulong VALUE declarations and replace NAME tokens in non-note lines by ulong VALUE. No other statement is changed. For each final unit the real Omega compiler, itself executed by the referee, accepts both original and projected sources with empty stderr and produces byte-identical AArch64 ELFs. These ELFs are never executed."
+ },
+ "compiler": {
+ "repository": "https://github.com/aien-dev/omega-mv",
+ "source_revision": "7505b3a3e3cf5ee46933e3a89a021b4289037983",
+ "source_path": "seed/omc/omc.om",
+ "source_sha256": "c792b401193d8477d38965d6ddb0fd0cb8fd5ac24fcb92fae9af52037a765f1c",
+ "independently_expected_seeded_binary_sha256": "499236398aabc652e2dae27fe4bdc4c5db3d3726314356e0dbef23e3345803ec",
+ "referee_self_output_sha256": "499236398aabc652e2dae27fe4bdc4c5db3d3726314356e0dbef23e3345803ec",
+ "check_exit": 0,
+ "self_compile_exit": 0,
+ "self_compile_stderr_bytes": 0,
+ "identity_note": "This compiler pin differs from PR84 historical receipt c99eda...; no claim to have rerun that compiler binary."
+ },
+ "red_final_tests_against_base": [
+ {
+ "test": "address",
+ "run_exit": 3,
+ "compile_exit": 0,
+ "stderr": ""
+ },
+ {
+ "test": "guard",
+ "run_exit": 1,
+ "compile_exit": 0,
+ "stderr": ""
+ },
+ {
+ "test": "body",
+ "run_exit": 1,
+ "compile_exit": 0,
+ "stderr": ""
+ }
+ ],
+ "final_semantic_tests": [
+ {
+ "stage": "final",
+ "test": "emitter",
+ "source_sha256": "be6b9e79c90d7099431153690b46ef8e300a55f29f01e4ecf1ad7d2daf68507f",
+ "projection_sha256": "0afc1de7a9209fc5bf81856745ca89787604255df5591fc25e87ea2feee1c334",
+ "check_exit": 0,
+ "run_exit": 0
+ },
+ {
+ "stage": "final",
+ "test": "address",
+ "source_sha256": "5951907eea227b908bc3f53193293f708f1a116b2838279d50ead37e810b2118",
+ "projection_sha256": "13515cef845c65ae896258f42fc3c999bb79a39bdc1e77b14e4d4f934319f3b2",
+ "check_exit": 0,
+ "run_exit": 0
+ },
+ {
+ "stage": "final",
+ "test": "guard",
+ "source_sha256": "1137c36c1241f65b588beb4d163fecaf83f9a3c0368f727cbca08b095e1098b3",
+ "projection_sha256": "f471673a130f4a3bc0faf2ac3620d70da4e24bfaf5d5d4dbe40a6d7937a2eb70",
+ "check_exit": 0,
+ "run_exit": 0
+ },
+ {
+ "stage": "final",
+ "test": "body",
+ "source_sha256": "2bdae5f2e4a441397b3ebdfa7fd22789b6c97d59b67dc60b57f6bd635722c9af",
+ "projection_sha256": "2452e3783763e663f892d2800ee236469f2ae11320764de7979a868e14a7e2ce",
+ "check_exit": 0,
+ "run_exit": 0
+ }
+ ],
+ "final_original_and_projected_compiles": [
+ {
+ "stage": "final",
+ "test": "emitter",
+ "original": {
+ "compile_exit": 0,
+ "stderr": "",
+ "elf_sha256": "dc5773073ff4dbcd4895df0db0557470461af802526d1e5e5f4147e093d1304b"
+ },
+ ".projected": {
+ "compile_exit": 0,
+ "stderr": "",
+ "elf_sha256": "dc5773073ff4dbcd4895df0db0557470461af802526d1e5e5f4147e093d1304b"
+ },
+ "identical_elves": true
+ },
+ {
+ "stage": "final",
+ "test": "address",
+ "original": {
+ "compile_exit": 0,
+ "stderr": "",
+ "elf_sha256": "dac4ab5784c85a4cd92862183e837687cd0b2a6e6164dcb0476b6b06fa9f4d38"
+ },
+ ".projected": {
+ "compile_exit": 0,
+ "stderr": "",
+ "elf_sha256": "dac4ab5784c85a4cd92862183e837687cd0b2a6e6164dcb0476b6b06fa9f4d38"
+ },
+ "identical_elves": true
+ },
+ {
+ "stage": "final",
+ "test": "guard",
+ "original": {
+ "compile_exit": 0,
+ "stderr": "",
+ "elf_sha256": "68423524f52c03da9916749b4d78c24995983dbb818ddc56bd0a7c1c23a588d9"
+ },
+ ".projected": {
+ "compile_exit": 0,
+ "stderr": "",
+ "elf_sha256": "68423524f52c03da9916749b4d78c24995983dbb818ddc56bd0a7c1c23a588d9"
+ },
+ "identical_elves": true
+ },
+ {
+ "stage": "final",
+ "test": "body",
+ "original": {
+ "compile_exit": 0,
+ "stderr": "",
+ "elf_sha256": "a793ed62dc31e333682167bb0f2020062d84900479e0d9d883b7eaa8de499fe9"
+ },
+ ".projected": {
+ "compile_exit": 0,
+ "stderr": "",
+ "elf_sha256": "a793ed62dc31e333682167bb0f2020062d84900479e0d9d883b7eaa8de499fe9"
+ },
+ "identical_elves": true
+ }
+ ],
+ "mutations": [
+ {
+ "name": "body_only_canonical_enable",
+ "test": "body",
+ "check_exit": 0,
+ "run_exit": 1,
+ "compile_exit": 0,
+ "source_sha256": "25a86704992c4e86c5ca891fd4f68eed05fcfdd97dd2889bb5870647791b5b10"
+ },
+ {
+ "name": "store_high_offset",
+ "test": "address",
+ "check_exit": 0,
+ "run_exit": 3,
+ "compile_exit": 0,
+ "source_sha256": "f6721d018c1e54c03d09b3f103b22aa1dbc5334b24d4f5899ae78dd4fcdb0e7f"
+ },
+ {
+ "name": "store_negative_offset",
+ "test": "address",
+ "check_exit": 0,
+ "run_exit": 3,
+ "compile_exit": 0,
+ "source_sha256": "e0e15ef09b57ce2120ef0ef05afdc966a58ed90ec3c184d0e56c1d05e9d7d239"
+ },
+ {
+ "name": "original_pointer",
+ "test": "address",
+ "check_exit": 0,
+ "run_exit": 3,
+ "compile_exit": 0,
+ "source_sha256": "4dd903ee8b3c90878d2d7f755515871cf13fef3f7dda370238fe4293f677f228"
+ },
+ {
+ "name": "original_flag",
+ "test": "guard",
+ "check_exit": 0,
+ "run_exit": 1,
+ "compile_exit": 0,
+ "source_sha256": "dd9506f9f8d57fec62b85bc368d9a216361761cd4bd923255d178b2a4f40c658"
+ },
+ {
+ "name": "checks_nonzero",
+ "test": "guard",
+ "check_exit": 0,
+ "run_exit": 1,
+ "compile_exit": 0,
+ "source_sha256": "bdd6f3f505d4fe65717fe087ab5b66a346bc1601c05ae13d8ce5267a39df6164"
+ },
+ {
+ "name": "skip_body_refusal",
+ "test": "body",
+ "check_exit": 0,
+ "run_exit": 1,
+ "compile_exit": 0,
+ "source_sha256": "fe8847689136224eb62e9077b198ad4d26e9e1d0de1aed7251c953efe779d464"
+ },
+ {
+ "name": "predicate_sensitive_exit",
+ "test": "body",
+ "check_exit": 0,
+ "run_exit": 5,
+ "compile_exit": 0,
+ "source_sha256": "ab87b48e3a80edf1c66fed0b3ffc93dee1cdbd1939c1bd90f15cbdb97cb71667"
+ },
+ {
+ "name": "branch_high_word",
+ "test": "address",
+ "check_exit": 0,
+ "run_exit": 9,
+ "compile_exit": 0,
+ "source_sha256": "a692e48a7fe47e16310fa2b3a259c9913e018772f5c2710114c52612be31e607"
+ },
+ {
+ "name": "branch_upper_bits",
+ "test": "address",
+ "check_exit": 0,
+ "run_exit": 10,
+ "compile_exit": 0,
+ "source_sha256": "2ecc7daabe2f750614b346656ca262da6333bd618f283a8f4f492350b0470519"
+ }
+ ],
+ "corrected_test_gaps": [
+ "The first address model masked only16 offset bits; a high-offset mutant survived with exit0. Independent review identified signed24-bit STG offsets. Final test decodes all24 bits and refuses negative offsets; both high and sign-bit mutants now fail3.",
+ "The first body test used only enable1; an on==1-only body-scan mutant survived with exit0. Final test exercises enable1,2,and maximum ulong for gbvec and all16 EXIT predicate fields; mutant now fails1.",
+ "Initial long expressions exceeded compiler register budget (error12); split test helpers and opcode extraction, then all final original and projected units compile with exit0 and empty stderr."
+ ],
+ "external_decode": {
+ "tool": "NVIDIA nvdisasm13.0.39, host-only outside delivered closure",
+ "official_manifest_url": "https://developer.download.nvidia.com/compute/cuda/redist/redistrib_13.0.0.json",
+ "archive_sha256": "1862b4a54ae2b6c58b2b662de964308a2b01489ca7d19a83d5db46af36d1908c",
+ "binary_sha256": "cfc2fa33538928f78c1c75fd5e25e275d71cd5746fee57d41c98b207d35cc008",
+ "command": "nvdisasm --binary SM121 words.bin",
+ "exit": 0,
+ "words_bytes": 640,
+ "instruction_count": 40,
+ "words_sha256": "539ac68e0150e91e3e7da425b0ec7dd8cc8bbe782a6c7e39372bad79568133dc",
+ "decode_sha256": "21e4fb6864c78ca612fb3f0d4ee50fda7dae2def40044cbffa38e24ffe323140",
+ "semantics": "Two address pairs decode as MOV R6 with offsets64/128 followed by IMAD.WIDE.U32 R8,R6,1,R4. Branches still land after their respective20-instruction blocks.",
+ "comparison_to_historical_golden_exit": 1,
+ "historical_golden_status": "STALE: expected.sass applies only to original base. Four address instruction lines differ. The original runner cannot pass its golden comparison for the repair.",
+ "publication_boundary": "No NVIDIA binary, generated GPU binary, or disassembler listing is added. AGENTS.md forbids NVIDIA-tool listings; inherited runner update mode conflicts with that rule. Owner resolution required; no comparison was bypassed."
+ },
+ "whole_repository": {
+ "command": "make test",
+ "baseline_exit": 2,
+ "source_commit_exit": 2,
+ "failure": "Build stops at Makefile:39 build/omega_blackwell_engine.o. x86 assembler rejects AArch64 ds instructions at src/omega_blackwell_engine.c:558 and:393.",
+ "host_test_suite": "NOT_RUN because build fails; not a green suite.",
+ "final_log_sha256": "99f4bbeaf88b4000be8d7fcee3dd6fb172ec3c72da2d6f0e341d240acc7a48f9"
+ },
+ "independent_review": {
+ "result": "No remaining defect found within stated local repair scope. Reviewer independently reran four semantic units and all ten mutants.",
+ "limits": "Review is not hardware or native execution evidence."
+ },
+ "wolfram_modeled_queries": [
+ {
+ "query": "Table[{s,4294971392+64 s,4294967296+Mod[4096*64 s,2^32]},{s,1,2}]",
+ "result": [
+ [
+ 1,
+ 4294971456,
+ 4295229440
+ ],
+ [
+ 2,
+ 4294971520,
+ 4295491584
+ ]
+ ],
+ "units": "byte addresses; modeled, not hardware"
+ },
+ {
+ "query": "Table[{b,b+64,b+128},{b,{4294971392,8589934528,4096}}]",
+ "result": [
+ [
+ 4294971392,
+ 4294971456,
+ 4294971520
+ ],
+ [
+ 8589934528,
+ 8589934592,
+ 8589934656
+ ],
+ [
+ 4096,
+ 4160,
+ 4224
+ ]
+ ],
+ "units": "byte addresses; modeled, not hardware"
+ },
+ {
+ "query": "{2^24-1,2^23,BitShiftLeft[1,24],BitShiftLeft[1,31],FromDigits[\"04087824\",16],FromDigits[\"05097824\",16]}",
+ "result": [
+ 16777215,
+ 8388608,
+ 16777216,
+ 2147483648,
+ 67663908,
+ 84506660
+ ],
+ "units": "encoding constants; modeled"
+ },
+ {
+ "query": "And@@Table[Mod[BitOr[16^^94d,BitShiftLeft[p,12]],4096]==2381,{p,0,15}]",
+ "result": true,
+ "units": "predicate-insensitive EXIT identity; modeled"
+ }
+ ],
+ "not_run": [
+ "Native AArch64 test execution",
+ "Native seed birth/full native suite",
+ "GB10 timer/store execution and instruction scheduling qualification",
+ "QMD/launch wiring",
+ "Paired off/on output equivalence and overhead",
+ "Chip overflow/drop accounting and repeatability",
+ "Clock qualification"
+ ],
+ "remaining_scope": [
+ "R0 TID.X initialisation/preservation and single-CTA launch remain caller preconditions, not verified launch integration.",
+ "Only EXIT is scanned; unsupported branch/call/return paths are not CFG-verified.",
+ "Runtime overflow, drops, partial capture, capacity0/1 capture and begin/end ranges remain unimplemented.",
+ "New semantic tests are documented standalone, not wired into existing runner or make test.",
+ "Disabled capacity0 remains refused by existing gtinit behavior."
+ ],
+ "unchanged": [
+ "Existing launch/vector/context code",
+ "Existing qualification/admission gates",
+ "Historical receipts and golden",
+ "main and remote branches",
+ "Credentials and trust configuration"
+ ],
+ "guides": "Local README-safety.md documents this API boundary and tests. No Omega language/compiler/Bridge/general-harness guide changed because those interfaces and pins were not changed."
+}
diff --git a/native/blackwell/trace-emit.om b/native/blackwell/trace-emit.om
index a5d1ef19..ae1a51ba 100644
--- a/native/blackwell/trace-emit.om
+++ b/native/blackwell/trace-emit.om
@@ -2,7 +2,12 @@ note SPDX-License-Identifier: AGPL-3.0-only
note Device-side trace emitter for CUDApp #82, first slice. Handwritten seeded Omega.
note It emits the instruction words for one selected producer (thread 0 of the launched CTA)
note that records two bounded mark records around one synchronous region, and returns the
-note input kernel words unchanged when tracing is disabled.
+note input words unchanged when tracing is disabled. Enabled input is a prepared linear body
+note fragment, not a complete kernel: the caller must initialise and preserve R0 = TID.X,
+note launch exactly one CTA, and allow both markers to fall through. Branches, calls, returns
+note and early exits are unsupported. EXIT instructions are explicitly refused, but the
+note scanner is not a general control-flow verifier. Markers clobber P0, R2, R4:R13 and UR4:UR5;
+note the caller must account for those live-register effects at both insertion points.
note
note Wire layout is PR #83 docs/device-trace/CONTRACT.md v1: 64-byte header, 64-byte records,
note kinds 1 mark / 2 begin / 3 end, clock domain 1 = raw device GLOBALTIMER low 32 bits with
@@ -14,13 +19,13 @@ note Register numbers are physical and fixed by this emitter: R0 tid, R2 stamp,
note base, R6 scratch, R8:R9 record address, R10:R11 generation, R12:R13 kernel; the global
note memory descriptor is loaded into UR4. Encodings are ported from the repository's own
note encoder, src/omega_blackwell_codegen.c encode_single_insn (S2R 0x7919, ISETP.GE 0x780c,
-note BRA 0x947, LDC64 0xff007b82, LDCU64 0xff0077ac, MOV imm 0x7802, IMAD imm 0x7824,
+note BRA 0x947, LDC64 0xff007b82, LDCU64 0xff0077ac, MOV imm 0x7802, IMAD.WIDE 0x7825,
note STG.E 0x7986), and each emitted stream is decoded by nvdisasm 13.0 as an outside oracle.
note
-note Declared constraints of this slice: offsets are added to the low 32 bits of the trace base
-note with no carry propagation, so the host buffer must not cross a 4 GiB boundary at any record
-note offset; the enabled path is refused unless the host has run the instruction checks and set
-note gtchecks to 1.
+note Record offsets use full-width base addition via the existing IMAD.WIDE.U32 form.
+note The host must supply a valid nonwrapping allocated extent. The enabled path is refused
+note unless gtchecks is exactly 1. This flag is a precondition, not evidence that arbitrary
+note input words, launch geometry, memory visibility or hardware execution have been checked.
const TRBAS ulong 1024
const TRGEN ulong 1040
@@ -38,7 +43,7 @@ const R_ISET ulong 30732
const R_LDC ulong 4278221698
const R_LDCU ulong 4278220716
const R_MOVI ulong 30722
-const R_IMAD ulong 30756
+const R_IMADW ulong 30757
const R_STG ulong 31110
const SR_TID ulong 33
const SR_CLK ulong 82
@@ -94,13 +99,11 @@ note LDCU.64 URd:URd+1, c[0x0][off] -- the global memory descriptor.
gtquad uint or R_LDCU shl dst 16 uint and shl off 5 16776960 uint 134220288 uint 945664
end
-fn gtadd dst ulong src ulong imm ulong to void
-note IMAD Rd, Ra, imm, RZ -- multiply by imm and add RZ.
-gtquad uint or or R_IMAD shl dst 16 shl src 24 uint imm uint 126747391 uint 2083328
-end
-
-fn gtcop dst ulong src ulong to void
-gtadd dst src 1
+fn gtaddr off ulong to void
+note MOV R6, off; IMAD.WIDE.U32 R8:R9, R6, 1, R4:R5 computes base + offset with carry.
+note Existing encoding: src/omega_blackwell_codegen.c BW_IR_IMAD_WIDE; vector.om address pairs.
+gtmov 6 off
+gtquad uint or or R_IMADW shl ulong 8 16 shl ulong 6 24 uint 1 uint 126746628 uint 2083840
end
fn gtbrak to void
@@ -109,7 +112,7 @@ gtquad uint or R_BRA shl ulong 18 18 uint 0 uint 58720256 uint 1042944
end
fn gtmark site ulong seq ulong to void
-note One bounded mark record at 64 + 64*site. Field offsets are contract v1.
+note One bounded mark record at 64*site (sites 1 and 2). Field offsets are contract v1.
gtsel
gtbrak
gtldu 4 TRDSK
@@ -117,8 +120,7 @@ gts2r 2 SR_CLK
gtldc 4 TRBAS
gtldc 10 TRGEN
gtldc 12 TRKRN
-gtadd 8 4 mul site 64
-gtcop 9 5
+gtaddr mul site 64
gtmov 6 site
gtstg 8 6 0
gtmov 6 KINDMK
@@ -154,7 +156,7 @@ end
fn gtwrap on ulong to void
note Disabled: the output is the input byte for byte; no prologue, no store, no allocation.
-note Enabled: mark(site 1), the caller's kernel words verbatim, mark(site 2).
+note Enabled: mark(site 1), the caller's prepared body fragment, mark(site 2).
put gboutlen 0 0
if eq on 0
for i ulong get gbinlen 0
@@ -171,16 +173,37 @@ end
gtmark SITE2 1
end
+fn gtbody to bool
+note Reject complete-kernel EXIT regardless of its predicate field (bits 12..15).
+note This recognises the repository's EXIT encoding, not every control-flow instruction.
+for i ulong div get gbinlen 0 16
+p = mul i 16
+lo = ulong get gbin p
+hi = ulong and get gbin add p 1 15
+op = or lo shl hi 8
+if eq op 2381
+put gterr 0 5
+ret false
+end
+end
+ret true
+end
+
fn gtewrap on ulong cap ulong to bool
note Checked entry point: refuse before emitting anything, then wrap.
if not gtinit cap
ret false
end
-if and eq on 1 eq get gtchecks 0 0
+if and ne on 0 ne get gtchecks 0 1
note Enabled needs the instruction and control-flow checks to have passed.
put gterr 0 4
ret false
end
+if ne on 0
+if not gtbody
+ret false
+end
+end
gtwrap on
ret true
end
diff --git a/tests/device-trace/README-safety.md b/tests/device-trace/README-safety.md
new file mode 100644
index 00000000..51ee470c
--- /dev/null
+++ b/tests/device-trace/README-safety.md
@@ -0,0 +1,84 @@
+# Emitter safety regressions
+
+These are host tests for the low-level emitter, not hardware qualification.
+They do not establish that a complete kernel can be instrumented safely.
+
+## Supported input
+
+Enabled input is a prepared, straight-line body fragment. The caller must
+initialise and preserve `R0 = TID.X`, launch exactly one CTA, and account for
+the markers' `P0`, `R2`, `R4:R13`, and `UR4:UR5` clobbers. Both insertion points
+must be reached by fallthrough. Branches, calls, returns, and early exits are
+unsupported. The wrapper rejects the repository's `EXIT` encoding, regardless
+of predicate, with error 5 before writing output. That scan is not a general
+control-flow verifier. In particular, do not pass the complete `gbvec` kernel.
+
+All nonzero enable values require `gtchecks == 1`. That is an explicit caller
+precondition, not proof of launch geometry, memory visibility, scheduling, or
+GPU safety. Disabled input remains byte-identical after the existing capacity
+and instruction-alignment checks. Disabled capacity zero is still refused.
+
+## Independent semantic tests
+
+- `address-test.om` decodes the address pair and models each store's effective
+ address inside a guarded capture extent. It checks ordinary and low-half-carry
+ cases, untouched header/reserved bytes/canaries, signed 24-bit store offsets,
+ and the branch predicate and complete relative displacement. It does not use
+ `expected.sass` or the emitter's address helpers as its oracle. This limited
+ arithmetic model does not validate GPU instruction scheduling or scoreboards.
+- `guard-test.om` exercises enable/check values 0, 1, 2 and maximum unsigned
+ 64-bit value. Refusal must preserve every output byte and its prior length.
+- `body-test.om` uses the actual `gbvec` kernel as a negative control, checks
+ disabled byte identity, and refuses every predicate variant of `EXIT` for
+ enable values 1, 2 and maximum unsigned 64-bit value.
+
+On Linux AArch64, using an independently verified seeded compiler:
+
+```sh
+test "$(uname -m)" = aarch64 || exit 69
+: "${OMEGA_COMPILER:?set the verified seeded compiler path}"
+sha256sum "$OMEGA_COMPILER"
+mkdir -p build/emitter-safety-native
+for name in emitter address guard body; do
+ unit=build/emitter-safety-native/$name
+ if [ "$name" = body ]; then
+ cat native/blackwell/vector.om native/blackwell/trace-emit.om \
+ tests/device-trace/body-test.om > "$unit.om"
+ else
+ cat native/blackwell/trace-emit.om \
+ "tests/device-trace/$name-test.om" > "$unit.om"
+ fi
+ "$OMEGA_COMPILER" < "$unit.om" > "$unit.elf" 2> "$unit.compile.stderr" || exit
+ test ! -s "$unit.compile.stderr" || exit 1
+ chmod +x "$unit.elf"
+ "$unit.elf" || exit
+done
+```
+
+All four units must exit zero. The original emitter test prints its individual
+checks. The three new tests are silent on success and return a named assertion
+status in their source on failure. These tests are not yet integrated into
+`make test` or the historical disassembler runner.
+
+## Historical golden is not current
+
+`expected.sass` and `evidence/device-trace/emitter-host-20261026/receipt.json`
+describe the original PR84 head `60d6c57fc6821accce0027d65dd239355beeb543`.
+They contain the erroneous multiply-based address formation. They are not
+passing evidence for this repair, and the old `run-emitter-checks.sh` golden
+comparison does not pass for the repaired output.
+
+The repair was decoded separately with an external host-only disassembler.
+The tool, output listing, and generated GPU words are not added to the repository.
+`AGENTS.md` forbids NVIDIA-tool listings in the repository, whereas the inherited
+runner offers to overwrite one. This conflict remains for the owner to resolve;
+do not bypass the comparison or regenerate the listing here to claim a pass.
+
+## Remaining limits
+
+Native AArch64 execution and the full native suite, GB10 execution, QMD/launch
+wiring, paired off/on overhead, clock qualification, and chip repeatability
+remain unverified by these host models. Runtime overflow/drop accounting,
+capacity zero/one capture, and begin/end ranges are not implemented by this
+fixed two-mark slice. No default-on mode, driver changes, or hardware authority
+are introduced.
diff --git a/tests/device-trace/address-test.om b/tests/device-trace/address-test.om
new file mode 100644
index 00000000..82cd433d
--- /dev/null
+++ b/tests/device-trace/address-test.om
@@ -0,0 +1,175 @@
+note SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+note Host-only semantic regression, not a GPU emulator or hardware receipt.
+note Compose after trace-emit.om. Decode the two address instructions independently of
+note the emitter helpers/golden, then model each STG effective address in a guarded extent.
+note Restoring the original base-low multiplication must fail, even if a golden is updated.
+
+global Aregs ulong 256
+global Amem uchar 256
+
+fn aword byteoff ulong to ulong
+v = ulong 0
+for j ulong 4
+v = or v shl ulong get gbout add byteoff j mul j 8
+end
+ret v
+end
+
+fn ainsn pos ulong to bool
+w = aword pos
+op = and w 65535
+dst = and shr w 16 255
+src = shr w 24
+imm = aword add pos 4
+rc = and aword add pos 8 255
+if eq op 30722
+put Aregs dst imm
+ret true
+end
+if eq op 30756
+v = add mul get Aregs src imm get Aregs rc
+put Aregs dst and v 4294967295
+ret true
+end
+if eq op 30757
+base = get Aregs rc
+if ne rc 255
+base = or base shl get Aregs add rc 1 32
+end
+v = add mul get Aregs src imm base
+put Aregs dst and v 4294967295
+put Aregs add dst 1 shr v 32
+ret true
+end
+ret false
+end
+
+fn astore p ulong base ulong to bool
+w = aword p
+breg = shr w 24
+off = aword add p 4
+note STG.E has a signed 24-bit byte offset. This marker uses only nonnegative offsets.
+off = and shr off 8 16777215
+if ge off 8388608
+ret false
+end
+dst = get Aregs breg
+dst = or dst shl get Aregs add breg 1 32
+dst = add dst off
+if lt dst base
+ret false
+end
+rel = sub dst base
+if gt rel 188
+ret false
+end
+for j ulong 4
+put Amem add add rel j 32 90
+end
+ret true
+end
+
+fn amark start ulong base ulong want ulong to bool
+for i ulong 256
+put Aregs i 0
+end
+put Aregs 4 and base 4294967295
+put Aregs 5 shr base 32
+ok = ainsn add start 112
+if not ok
+ret false
+end
+ok = ainsn add start 128
+if not ok
+ret false
+end
+addr = or get Aregs 8 shl get Aregs 9 32
+if ne addr want
+ret false
+end
+stores = ulong 0
+for i ulong 20
+p = add start mul i 16
+w = aword p
+if eq and w 65535 31110
+ok = astore p base
+if not ok
+ret false
+end
+stores = add stores 1
+end
+end
+ret eq stores 8
+end
+
+fn aextent base ulong first ulong second ulong to bool
+for i ulong 256
+put Amem i 165
+end
+ok = amark 0 base first
+if not ok
+ret false
+end
+ok = amark 320 base second
+if not ok
+ret false
+end
+note The header, unused record bytes, and both 32-byte canaries remain untouched.
+for i ulong 256
+touched = or and ge i 96 lt i 128 and ge i 160 lt i 192
+want = uchar 165
+if touched
+want = uchar 90
+end
+if ne get Amem i want
+ret false
+end
+end
+ret true
+end
+
+fn main to int
+put gbinlen 0 0
+put gtchecks 0 1
+ok = gtewrap 1 2
+if not ok
+ret 1
+end
+if ne get gboutlen 0 640
+ret 2
+end
+ok = aextent 429497139242949714564294971520
+if not ok
+ret 3
+end
+note Low-half carry must not wrap the pointer into an unrelated allocation.
+ok = aextent 858993452885899345928589934656
+if not ok
+ret 4
+end
+ok = aextent 4096 4160 4224
+if not ok
+ret 5
+end
+note Predicate-insensitive branch opcode, @P0, rel18: index1 +1 +18 =20.
+for i ulong 2
+p = add mul i 320 16
+w = aword p
+if ne and w 4095 2375
+ret 6
+end
+if ne and shr w 12 15 0
+ret 7
+end
+if ne shr w 18 18
+ret 8
+end
+if ne aword add p 4 0
+ret 9
+end
+if ne aword add p 8 58720256
+ret 10
+end
+end
+ret 0
+end
diff --git a/tests/device-trace/body-test.om b/tests/device-trace/body-test.om
new file mode 100644
index 00000000..3116b3f7
--- /dev/null
+++ b/tests/device-trace/body-test.om
@@ -0,0 +1,84 @@
+note SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+note Compose after vector.om and trace-emit.om. Complete kernels are not body fragments.
+note Refusing EXIT must ignore its predicate: even an apparently inactive exit is unsupported.
+
+fn bsentinel to void
+for i ulong 8192
+put gbout i 165
+end
+put gboutlen 0 7
+end
+
+fn brefused on ulong to bool
+ok = gtewrap on 2
+if ok
+ret false
+end
+if ne get gterr 0 5
+ret false
+end
+if ne get gboutlen 0 7
+ret false
+end
+for i ulong 8192
+if ne get gbout i 165
+ret false
+end
+end
+ret true
+end
+
+fn ballflags to bool
+for i ulong 3
+on = add i 1
+if eq i 2
+on = ulong 18446744073709551615
+end
+bsentinel
+ok = brefused on
+if not ok
+ret false
+end
+end
+ret true
+end
+
+fn main to int
+put gtchecks 0 1
+gbvec
+for i ulong get gblen 0
+put gbin i get gbcode i
+end
+put gbinlen 0 get gblen 0
+ok = ballflags
+if not ok
+ret 1
+end
+note Disabled wrapping of an actual whole kernel remains byte-identical.
+ok = gtewrap 0 2
+if not ok
+ret 2
+end
+if ne get gboutlen 0 get gbinlen 0
+ret 3
+end
+for i ulong get gbinlen 0
+if ne get gbout i get gbin i
+ret 4
+end
+end
+note Every predicate field, including PT, P0 and inverted predicates.
+put gbinlen 0 16
+for p ulong 16
+for i ulong 16
+put gbin i 0
+end
+put gbin 0 77
+put gbin 1 uchar or 9 shl p 4
+ok = ballflags
+if not ok
+ret 5
+end
+end
+ret 0
+end
diff --git a/tests/device-trace/guard-test.om b/tests/device-trace/guard-test.om
new file mode 100644
index 00000000..f51b9dbf
--- /dev/null
+++ b/tests/device-trace/guard-test.om
@@ -0,0 +1,56 @@
+note SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+note Compose after trace-emit.om. Noncanonical enable/check values cannot bypass refusal.
+note Refusal preserves every output byte and its old length, not only a chosen prefix.
+
+fn gprepare to void
+for i ulong 8192
+put gbout i 165
+end
+put gboutlen 0 7
+put gbinlen 0 0
+end
+
+fn gunchanged to bool
+if ne get gboutlen 0 7
+ret false
+end
+for i ulong 8192
+if ne get gbout i 165
+ret false
+end
+end
+ret true
+end
+
+fn main to int
+vals = new ulong 4 0
+put vals 1 1
+put vals 2 2
+put vals 3 18446744073709551615
+for i ulong 4
+for j ulong 4
+gprepare
+on = get vals i
+checks = get vals j
+put gtchecks 0 checks
+ok = gtewrap on 2
+if and ne on 0 ne checks 1
+if ok
+ret 1
+end
+if ne get gterr 0 4
+ret 2
+end
+same = gunchanged
+if not same
+ret 3
+end
+else
+if not ok
+ret 4
+end
+end
+end
+end
+ret 0
+end