diff --git a/docs/device-trace/.crumb b/docs/device-trace/.crumb new file mode 100644 index 00000000..ac7989fa --- /dev/null +++ b/docs/device-trace/.crumb @@ -0,0 +1 @@ +{"schema_version":"1.0.0","name":"device-trace","purpose":"Proposed bounded trace wire contract and reproduction instructions for the host reference in native/blackwell/trace.om.","invariants":["Host and oracle evidence is not GPU qualification.","The existing qualified vector emitter and launcher remain unchanged.","Wire IDs require an external exact provenance manifest."]} diff --git a/docs/device-trace/CONTRACT.md b/docs/device-trace/CONTRACT.md new file mode 100644 index 00000000..fc7754e8 --- /dev/null +++ b/docs/device-trace/CONTRACT.md @@ -0,0 +1,135 @@ +# Device trace wire contract v1, host reference only + +## Status and ownership + +PROPOSED wire contract for CUDApp #82 and Omega #778. The handwritten +`native/blackwell/trace.om` is a bounded host reference and codec, not a GPU +producer. It does not emit SASS, allocate a device buffer or read a device +clock. The semantic fixtures and compiler source have run through an external +reference interpreter. Native ELF execution and all device behavior are +NOT_RUN. See REPRODUCE.md for pins, commands and limitations. +The existing `vector.om`, `launch.om` and `context.om` are unchanged. + +This first slice uses one fixed producer, lane 0 of one selected warp in one +selected CTA. The existing VECTOR_1D launch has 64 threads per CTA, at most +1,048,576 logical threads. CTA is 0..16383 and warp is 0..1. It is not an +all-thread view. The source contains no atomics, spin loops or barriers. + +## Bytes and identities + +All integers are unsigned little-endian. Header and record are each 64 bytes. +Capacity is 0..64. The exact transport extent is 64 + 64*capacity, at most4160 +bytes. This is a chosen bound, not a hardware limit. No implicit alignment, +padding, pointers, strings, tensor data or prompt text are serialized. + +Header offsets: + +| Byte | Width | Field | +| --- | --- | --- | +| 0 | 4 | Magic bytes `OMGT` (1413958991) | +| 4 | 4 | Version 1 | +| 8 | 4 | Exact transport extent | +| 12 | 4 | Capacity | +| 16 | 4 | Written prefix length | +| 20 | 4 | Dropped selected valid events, saturating at 4294967295 | +| 24 | 4 | Status: 0 recording, 1 complete, 2 partial, 3 failed | +| 28 | 4 | Clock domain 1: raw device globaltimer low32, units UNKNOWN | +| 32 | 8 | Nonzero generation ID | +| 40 | 8 | Nonzero kernel ID | +| 48 | 4 | Selected CTA | +| 52 | 4 | Selected warp | +| 56 | 4 | Nonzero manifest ID | +| 60 | 4 | Loss saturation flag: 0 exact, 1 further loss was clipped | + +Each retained record, at64 + 64*sequence: + +| Byte | Width | Field | +| --- | --- | --- | +| 0 | 4 | Nonzero numeric site ID | +| 4 | 4 | Kind: 1 mark, 2 begin, 3 end | +| 8 | 4 | Retained producer sequence, starting 0 | +| 12 | 4 | Raw low32 stamp | +| 16 | 8 | Generation ID | +| 24 | 8 | Kernel ID | +| 32 | 4 | CTA | +| 36 | 4 | Warp | +| 40 | 4 | Lane, always 0 in v1 | +| 44 | 4 | Explicit numeric payload, default 0 | +| 48 | 16 | Reserved zero | + +All unused slots are zero. An exported capture carries the exact configured +extent, not only the written prefix. The final partial record is never valid. + +IDs are lookup keys, not hashes or proof. The offline manifest must bind them +without collision within the run to full source, compiler, generated-code, +launch-descriptor and configuration digests, plus site location/name/kind. +A consumer must possess that exact manifest and expected generation/kernel +before calling `gtvalidate`. After structural validation, the #778 consumer +must resolve every nonzero site ID and reject unknown sites or site/kind +mismatches. The codec does not perform that lookup. It checks matching numeric +generation/kernel/manifest keys, not the external manifest's truth. + +## Native host reference API + +Concatenate the module and a unit with `fn main`. Its globals are private to +one host process and one capture, not reentrant or thread-safe. This is an +explicit reference for a future GPU producer, not host timestamps disguised +as GPU execution. + +- `gtinit(gen ulong, kernel ulong, manifest uint, cap uint, cta uint, warp uint)` + returns bool. It validates all bounds before calculating extent, zeros all + storage and initializes the capture. Any refusal deactivates the producer; + previously serialized bytes are not a newly accepted capture. +- `gtappend(gen ulong, site uint, kind uint, who uint, stamp uint, payload uint)` + takes at most six parameters, as required by the pinned seeded compiler. + `who` is the existing logical thread index, CTA*64 + thread. It returns 0 + recorded, 1 filtered, 2 capacity exhausted, -1 inactive, -2 stale generation, + or -3 invalid event/identity. Invalid or filtered events are not losses. +- `gtextent()` returns the configured byte extent after a successful init. +- `gtfinish(status uint)` accepts 1..3 once and deactivates the producer. + Status 1 must only be selected by a future launcher after its existing + completion and visibility protocol succeeds. The reference cannot prove + completion itself. Timeout/fault does not authorize recycling live storage. +- `gtvalidate(bytes ulong, gen ulong, kernel ulong, manifest uint)` validates + `gtbytes` against the actual supplied byte count and expected provenance. + It refuses malformed headers, overflow-sized extents, unknown versions, + noncanonical unused bytes, invalid selection, inconsistent loss, and records + whose sequence, kind, identity or reserved bytes disagree. +- `gtput32/64`, `gtget32/64`, `gtrowvalid` and `gtstate` are internal helpers. + Only `gtvalidate` accepts untrusted lengths. A caller must not mutate the + producer state. Tests mutate it only to reach the saturation boundary. + +The producer retains a prefix. When full, it changes only loss accounting. +It never wraps onto existing records, waits for space or vetoes application +work. A zero-capacity capture is valid and loses every selected valid event. + +## Clock and ordering, deliberately not interpreted + +Clock 1 names the intended source, not a qualified opcode. Test stamps are +synthetic. The historical S2R special-register value 0x52 is only migration +reference. The new timer encoding, scheduling and selected-lane stores still +need independent word/control checks and an admitted sm_121 hardware receipt. + +There is no conversion to nanoseconds, cycles, wall time or CPU time here. +There is no 64-bit timer, cross-SM comparison, cross-kernel ordering or claim +that issuing asynchronous work means it completed. A begin near 2^32 followed +by a small end is preserved exactly, not silently converted to a duration. +A low32 delta alone cannot distinguish multiple wraps. A later consumer must +have independently established capture-duration bounds in the same clock +before interpreting any interval, otherwise timing is unavailable. + +Sequence gives order only for this single producer. Nested ranges are out of +scope. A structurally valid unmatched end, missing end, partial capture or +loss remains incomplete; `gtvalidate` is not a range-completeness validator. +Omega #778 owns symbol resolution, pairing and presentation. + +## Next device slice, still required + +Keep tracing absent from default unit composition. Default generated kernel +bytes, allocations, arguments and completion work must remain identical. +Before adding an enabled branch, prove the timer/store/control encodings, +register/predicate liveness and resource counts against the existing emitter. +Then add separately owned trace storage, initialization and readback only +following the already qualified completion/cache path. Do not insert a new +barrier merely to make a plot appear orderly. GB10 correctness, overflow, +canaries, mutants, repeated runs and paired off/on perturbation remain open. diff --git a/docs/device-trace/PLAN.md b/docs/device-trace/PLAN.md new file mode 100644 index 00000000..26bf09cb --- /dev/null +++ b/docs/device-trace/PLAN.md @@ -0,0 +1,24 @@ +# Bounded trace contract first slice + +Issue: https://github.com/aien-dev/CUDApp/issues/82 +Consumer: https://github.com/aien-dev/omega-mv/issues/778 +Base: a520cd30e54c3b0ddd553ee3ccb3f5e673345cd6 + +1. Freeze a small little-endian wire layout and one-producer selection policy. + The builder's choice is fixed slots instead of a shared atomic ring. This + avoids contention, cross-thread ordering claims and any new GPU barrier. +2. Write native Omega tests before the codec. Cover capacity, loss, selection, + malformed inputs, stale provenance, truncated buffers and disabled bytes. +3. Implement the bounded host reference and codec in native Omega. Preserve + the existing vector emitter and launcher unchanged. Do not emit an + unqualified timer instruction or claim this is already a device producer. +4. Run available independent host checks and record their exact limits. Run + the native tests only through a verified pinned AArch64 compiler. This + x86_64 environment cannot execute that path, so it is NOT_RUN here. +5. Obtain independent review. The next implementation step is the existing + emitter's timer, selected-lane stores and buffer ownership, with golden + opcode/control tests followed by a separately authorized GB10 receipt. + +The low32 historical timer is not a coherent64 clock. No duration, units, +CPU correlation or cross-SM order is inferred from this slice. Native tests +are supplied for later execution; an external audit is not their substitute. diff --git a/docs/device-trace/REPRODUCE.md b/docs/device-trace/REPRODUCE.md new file mode 100644 index 00000000..0f80d915 --- /dev/null +++ b/docs/device-trace/REPRODUCE.md @@ -0,0 +1,143 @@ +# Reproduce the bounded host reference + +This is preparation for CUDApp #82, not its completion. All stamps in these +fixtures are synthetic. No command below opens a GPU. Do not run a chip test +without the maintainer's separate GPU admission. + +## Pins + +- CUDApp base: `a520cd30e54c3b0ddd553ee3ccb3f5e673345cd6`. +- Compiler source: `omega-mv@55f9b0af47de70a3d06357985cf99ae3e45c016f`, + path `seed/omc/omc.om`, SHA256 + `2e35db7d6c2066fb4a20d19b8a9579c44caca9c9937b0594a89422010b673637`. +- Expected seeded compiler: `seed/out/omc`, SHA256 + `734f0a39319fbfa930bcc62cb30dbf06d47d78e126372b74f5baf478e6126b61`. +- External oracle: `omega-mv@190130b71d0a59b93f01c515218a5509b149a145`, + path `tools/omega_ref/omega_ref.c`, SHA256 + `52e747096c1d978103432460a2978b21a604cc5d3e961bbe4b253fcc7636290e`. + +These are explicit historical source pins. They do not silently track later +OM-2 releases or change any compiler/Bridge ABI. The oracle is a pre-existing +C test referee, outside the delivered native implementation. It is not a +new production dependency, a native executor or a device qualification path. + +## Compose the three units + +From the CUDApp checkout, with an empty disposable `out` directory: + +```sh +cat native/blackwell/trace.om tests/device-trace/contract-test.om > out/contract.om +cat native/blackwell/trace.om tests/device-trace/golden-test.om > out/golden.om +cat native/blackwell/vector.om tests/device-trace/disabled-test.om > out/disabled.om +``` + +The contract test prints `DEVICE_TRACE_CONTRACT_PASS` and exits 0 on success. +The golden unit emits exactly 192 bytes, equal to the hex in `golden.hex`. +The disabled unit emits the existing 512-byte vector kernel, SHA256 +`39f3dfdfc529a75a8274a27900acf4e7382b7f280a211e0412c51609f44b62a1`. +This checks the existing emitter only. No enabled GPU trace emitter exists. + +## Externally interpreted compiler and semantic oracle (x86_64 host) + +Obtain both pinned source files in a separate oracle workspace. Verify the +hashes above before compiling. This command matches the existing referee's +build flags, without the machine-specific `quiet-build` wrapper: + +```sh +cc -O2 -g -std=gnu11 -Wall -Wextra -Werror -o omega_ref omega_ref.c -lpthread +./omega_ref check omc.om +./omega_ref run omc.om < omc.om > omc-from-ref.elf 2> self.err +``` + +Require exit 0 and empty stderr for both calls. The measured self-output +SHA256 was the exact expected seeded compiler digest `734f0a39...6b61` above. +That byte identity does not turn the referee into a trusted native runtime. + +For each composed unit: + +```sh +./omega_ref check out/contract.om +./omega_ref run out/contract.om > out/contract.stdout 2> out/contract.stderr +./omega_ref run omc.om < out/contract.om > out/contract.elf 2> out/contract.compile.stderr +``` + +Record each exit separately. Repeat for `golden` and `disabled`. Semantic +execution uses the external interpreter; compilation executes the pinned +Omega compiler source through that interpreter. The emitted executables are +AArch64, not run by these commands. A nonzero compile must never be followed +by execution of its partial output. + +Compare `golden.stdout` byte-for-byte with the decoded `golden.hex`, and check +`disabled.stdout` against the full digest above. Do not count file creation or +a matching byte count alone as a pass. + +## Mutants (private copies only) + +For each one-line replacement below, compose the mutated module with +`contract-test.om`. Require oracle `check` exit 0, oracle `run` exit 1 with +`DEVICE_TRACE_CONTRACT_FAIL` on stderr, and interpreted compiler exit 0. +Never mutate the committed implementation for a test run. + +| Original | Replacement | +| --- | --- | +| `if or or gt cap 64 ge cta` | `if or or gt cap 65 ge cta` | +| `if ge n get gtstate 3` | `if gt n get gtstate 3` | +| `mul get gtstate 5 32` | `mul get gtstate 5 31` | +| `if ne gen get gtstate 0` | `if eq gen get gtstate 0` | +| `gtput32 60 1` | `gtput32 60 0` | +| `gtput32 add off 8 uint n` | `gtput32 add off 8 uint add n 1` | +| `for j ulong 16` | `for j ulong 0` | +| `for i ulong sub bytes off` | `for i ulong 0` | +| First `put gtstate 6 0` in `gtinit` | `put gtstate 6 1` | +| `if and ne gtget32 20 0 ne n cap` | `if and ne gtget32 20 0 gt n cap` | +| `if and eq gtget32 60 1 ne gtget32 20 4294967295` | `if and eq gtget32 60 2 ne gtget32 20 4294967295` | +| `if ne gtget64 add off 16 gtget64 32` | `if ne gtget64 add off 16 gtget64 add off 16` | + +Without the module, `contract-test.om` is refused by both the oracle checker +and externally interpreted compiler with error 3 at the first `gtinit` call. +This absence check was run after implementation, not a pre-implementation +native red/green run. Native TDD execution remains unestablished. + +## Native execution, still NOT_RUN + +On an authorized Linux AArch64 host, verify the exact compiler digest first. +Compile each composed unit with that compiler, then execute only successful +outputs. Repeat the exact-byte and mutant comparisons above. Record unit and +ELF hashes, status, stdout and stderr. This is a host test, still not GB10. +The full CUDApp `make test` suite must also run in a complete checkout. + +The local connector-materialized partial snapshot could not run `make test`: +make exited 2 because `tests/gpu_matmul_api_test.c` was absent. No target or +threshold was skipped or weakened. The native seed/compiler gates, native +ELF execution, full repository suite and all GPU gates are NOT_RUN. + +## Independent arithmetic check + +The golden was independently encoded with Wolfram Language using +`Reverse[IntegerDigits[value,256,width]]` for each field in contract order. +An independent `struct.pack` check matched those 192 bytes. The resulting +byte SHA256 is `88a3de3f88a0d59852704a97d2c9f859f87b57ee9efd0f2509aa95ace1adcab6`. +Wolfram also checked the finite store-extent property: + +```text +And@@Flatten[Table[64+64*n+63 < 64+64*c,{c,1,64},{n,0,c-1}]] -> True +``` + +This is MODELED arithmetic, not a measured device memory-safety result. + +## Current compiler compatibility, separate receipt + +A later check used `omega-mv@7505b3a3e3cf5ee46933e3a89a021b4289037983`, +without changing the historical pins or receipt above. Its +`seed/omc/omc.om` SHA256 is +`c792b401193d8477d38965d6ddb0fd0cb8fd5ac24fcb92fae9af52037a765f1c`. +Executed through the same unchanged external oracle, its self-output matches +`499236398aabc652e2dae27fe4bdc4c5db3d3726314356e0dbef23e3345803ec`, +the pinned commit's `seed/out/omc.sha256`. + +All three unmodified units and all twelve semantic mutants compile with +exit 0 and empty compiler stderr under this newer compiler source. The three +positive ELF files are byte-identical to the earlier compiler's outputs. +This is compatibility of these units only, not a full compiler qualification +or execution of those AArch64 files. See the additive +`evidence/device-trace/current-compiler-7505b3a/receipt.json` receipt. diff --git a/evidence/device-trace/current-compiler-7505b3a/receipt.json b/evidence/device-trace/current-compiler-7505b3a/receipt.json new file mode 100644 index 00000000..2fdeb302 --- /dev/null +++ b/evidence/device-trace/current-compiler-7505b3a/receipt.json @@ -0,0 +1,138 @@ +{ + "schema": "cudapp-device-trace-current-compiler-v1", + "measured_at": "2026-10-25T23:35:20Z", + "code_commit": "0efa7fc018ecbf2a10d7ac2dbbfb153128436276", + "measured_branch_head": "f6ba12f16268b59179337378307e077498adcfbd", + "compiler_repository": "https://github.com/aien-dev/omega-mv", + "compiler_commit": "7505b3a3e3cf5ee46933e3a89a021b4289037983", + "compiler_path": "seed/omc/omc.om", + "compiler_source_sha256": "c792b401193d8477d38965d6ddb0fd0cb8fd5ac24fcb92fae9af52037a765f1c", + "expected_compiler_sha256": "499236398aabc652e2dae27fe4bdc4c5db3d3726314356e0dbef23e3345803ec", + "oracle_commit": "190130b71d0a59b93f01c515218a5509b149a145", + "oracle_source_sha256": "52e747096c1d978103432460a2978b21a604cc5d3e961bbe4b253fcc7636290e", + "self_output_command": "./omega_ref run omc-current.om < omc-current.om > omc-current-self.elf 2> omc-current-self.err", + "self_output_exit": 0, + "self_output_stderr_bytes": 0, + "self_output_sha256": "499236398aabc652e2dae27fe4bdc4c5db3d3726314356e0dbef23e3345803ec", + "positive_units": { + "contract": { + "unit_sha256": "99a509601b6a8c28613e7c30e4ad21e1b325a4784f6ffeda2976fa22441c2e37", + "command": "./omega_ref run omc-current.om < contract.om > contract.current.elf 2> contract.current.err", + "compiler_exit": 0, + "stderr_bytes": 0, + "elf_sha256": "45126fa63a93eccfa9572b27462bd7da538e25fff9958d817c405010dc2335fd", + "matches_prior_compiler_elf": true + }, + "golden": { + "unit_sha256": "64cf6f2d92d84950dd4dca59539a01e5eae2dede47ba1be096278cb435f0e07f", + "command": "./omega_ref run omc-current.om < golden.om > golden.current.elf 2> golden.current.err", + "compiler_exit": 0, + "stderr_bytes": 0, + "elf_sha256": "dfabec3ebb1dd5a9576e788b543e4ad86dd8304d9767198a5f81edd6273eda8e", + "matches_prior_compiler_elf": true + }, + "disabled": { + "unit_sha256": "cf516ae2ed0c32acc4b06a9c94eb13674b7795390c9c6e7714909cc8ac473873", + "command": "./omega_ref run omc-current.om < disabled.om > disabled.current.elf 2> disabled.current.err", + "compiler_exit": 0, + "stderr_bytes": 0, + "elf_sha256": "e36b6223740bdd859c2e5d5443a562391481d9c07dfb6a13c5bfea73cbbbee1b", + "matches_prior_compiler_elf": true + } + }, + "mutant_compilation": [ + { + "name": "mutant-capacity", + "compiler_exit": 0, + "stderr_bytes": 0, + "unit_sha256": "fee221d58fb51acf46145bb29f89ad3dac7c76433521e2b568b25cd5b69b44c3", + "elf_sha256": "4af91ad02a8b7e928c3d1a7c2eb8f945b594cfc5e24763d5789147499c7732f0" + }, + { + "name": "mutant-failed_init", + "compiler_exit": 0, + "stderr_bytes": 0, + "unit_sha256": "84da9f601e6928cc3c6991e5fe59d1ab0f523945aa03d28748b18abbaa600896", + "elf_sha256": "b592dec333abb35b268b777fcece24f141548b132693cc96498bba808c49dab3" + }, + { + "name": "mutant-flag_consistency", + "compiler_exit": 0, + "stderr_bytes": 0, + "unit_sha256": "1399d04d31bcabf5410b507eeef6bfbd2366f4a41e4f393c04dd77c6506a2348", + "elf_sha256": "84ee7ad7e8aae82aabb9636b3c7980418cacd0ef0b3f43fba2b45136934072cb" + }, + { + "name": "mutant-loss_full", + "compiler_exit": 0, + "stderr_bytes": 0, + "unit_sha256": "f3990b4cbcd113ad8aedc640a9689e1e8d50870fd3732a94aa55e5d08b839ccb", + "elf_sha256": "c1eb6dfa8bfc10d1551b7c0c3fe82c0a330c29abb0ad363f75d6b842aa102e99" + }, + { + "name": "mutant-overflow", + "compiler_exit": 0, + "stderr_bytes": 0, + "unit_sha256": "4a77413b4e4ec5e6275cda5d8547320dc25d823cee7dee011304df8e13412dfc", + "elf_sha256": "3b55816764c445fa98122737dbe247037254d33f954d398d6321a505549e5c3f" + }, + { + "name": "mutant-record_provenance", + "compiler_exit": 0, + "stderr_bytes": 0, + "unit_sha256": "d8ef0c6a2e5a6b426d75e5dd809260fb80ad84edc0bcabbf5dd17362ed50a4be", + "elf_sha256": "47c14e6487ecbaa0eafa5e93fe7423f09b493d9da58efad54f05de9ae8fad6dd" + }, + { + "name": "mutant-reserved", + "compiler_exit": 0, + "stderr_bytes": 0, + "unit_sha256": "7af24520c23f3318ac7bcec469fa205f7dc786fe077cb2338cb3642b35ba2490", + "elf_sha256": "4343b492a9c9f28a100c282762ec8ea35d6ca1186df1af519c64be27830ca2b6" + }, + { + "name": "mutant-saturation_flag", + "compiler_exit": 0, + "stderr_bytes": 0, + "unit_sha256": "0123c3603a036769c4cf8288df9cd2ad0e84faa550a275d5e3c34d423a79067e", + "elf_sha256": "db830f22e02bff7a70d95099bdbad9e7cd22463f0fbcf39450f6f22f91bd8f5b" + }, + { + "name": "mutant-selection", + "compiler_exit": 0, + "stderr_bytes": 0, + "unit_sha256": "c7a4155e7d5b676bad02bb0d28393ae7cb6dc256c325026662b5cb73fa574ca3", + "elf_sha256": "6a4af24b401bfa809dc83358c2b27a339e9e918352c03ba10336d727736305d8" + }, + { + "name": "mutant-sequence", + "compiler_exit": 0, + "stderr_bytes": 0, + "unit_sha256": "b3fc7b18f869ae173602d5994d811fb7738f66f4a69148d3dabd48a4e36bdb53", + "elf_sha256": "bc3d7be3c0ab31aa6bc89dd066df0e90aa8d3f8369a42202617d338b566dab9c" + }, + { + "name": "mutant-stale", + "compiler_exit": 0, + "stderr_bytes": 0, + "unit_sha256": "06e1418930d53f557b1270d2121660a2e9b2d038c87ba5d5165f0263f60817b6", + "elf_sha256": "91ee22a429a5ea2f05c1b1fa0ae798ec6a44e9e71b2caf44729b337222c638de" + }, + { + "name": "mutant-unused", + "compiler_exit": 0, + "stderr_bytes": 0, + "unit_sha256": "8062a6c9329520b29f7773d64210645b428aa42357108f32accf9c4f5252dca3", + "elf_sha256": "bdcce7734f6e269735f7deab68e0aa69150780af68024e350ec35d26e89e3148" + } + ], + "result": "PASS for externally interpreted compiler acceptance and exact-byte positive-output compatibility", + "not_run": [ + "Native AArch64 compiler execution", + "Native AArch64 generated ELF execution", + "Full compiler qualification", + "Full CUDApp repository suite", + "All GPU execution and performance" + ], + "history": "Additive compatibility receipt. Does not modify or supersede the earlier measured source receipt." +} diff --git a/evidence/device-trace/host-reference-20261025/receipt.json b/evidence/device-trace/host-reference-20261025/receipt.json new file mode 100644 index 00000000..8e64f6e5 --- /dev/null +++ b/evidence/device-trace/host-reference-20261025/receipt.json @@ -0,0 +1,236 @@ +{ + "schema": "cudapp-device-trace-host-reference-v1", + "measured_at": "2026-10-25T23:32:06Z", + "source_commit": "0efa7fc018ecbf2a10d7ac2dbbfb153128436276", + "base_commit": "a520cd30e54c3b0ddd553ee3ccb3f5e673345cd6", + "source_sha256": { + "native/blackwell/trace.om": "bcc9414f5cb147bf8553cb3553680e054bd1efb58da4378be796b74844023637", + "tests/device-trace/.crumb": "de51832ed9b7d3ddd3c194183b31c72938d7c939127e65a826f9d094bdacc91f", + "tests/device-trace/contract-test.om": "d99a078097835089e078899caf86f5e6f707f106d7098c52f5d86babce16f08f", + "tests/device-trace/disabled-test.om": "2608a07b8a1c8a391576382e89e07a1bda408ae756f241dd050f766a653584cc", + "tests/device-trace/golden-test.om": "9243e5bb92704e526c1464f14c85cb785c0bf988f333ba5ddfdc243da739d75b", + "tests/device-trace/golden.hex": "cb3461ecba07527bdbfeb68a886604da4228f0e93c6d471b79c016faa57b4359", + "docs/device-trace/.crumb": "d8b6a32b421fdfed0c19104c625cee536c1aa217198d6286d0904ea805a416c3", + "docs/device-trace/CONTRACT.md": "320a847cb90c4620df488c8d3028e9beb76c57053322df966b21c7c7bf268232", + "docs/device-trace/PLAN.md": "b62c0300ad2568d7fb6fc35d80247c45045e8c7fc4211f0234a3e27f0fcb72ab", + "docs/device-trace/REPRODUCE.md": "4fd453c41982f23e4f1a074bb0615dafe6c683992c730420a92a3e2308db9734" + }, + "remote_readback": "All 10 committed files read back and matched the measured local content exactly", + "platform": { + "os": "Linux", + "architecture": "x86_64" + }, + "scope": "External oracle semantics and pinned compiler source executed under that oracle. No native AArch64 ELF or GPU execution.", + "oracle": { + "repository": "https://github.com/aien-dev/omega-mv", + "commit": "190130b71d0a59b93f01c515218a5509b149a145", + "path": "tools/omega_ref/omega_ref.c", + "source_sha256": "52e747096c1d978103432460a2978b21a604cc5d3e961bbe4b253fcc7636290e", + "binary_sha256": "81106113f7d031f709098cddb6f89f301a6f9d25ed0179d2e5ec36c75749c4f2", + "build_command": "cc -O2 -g -std=gnu11 -Wall -Wextra -Werror -o omega_ref omega_ref.c -lpthread", + "build_exit": 0, + "status": "Existing external test referee, outside delivered implementation" + }, + "compiler": { + "repository": "https://github.com/aien-dev/omega-mv", + "commit": "55f9b0af47de70a3d06357985cf99ae3e45c016f", + "path": "seed/omc/omc.om", + "source_sha256": "2e35db7d6c2066fb4a20d19b8a9579c44caca9c9937b0594a89422010b673637", + "self_output_command": "./omega_ref run omc.om < omc.om > omc-from-ref.elf", + "self_output_exit": 0, + "self_output_sha256": "734f0a39319fbfa930bcc62cb30dbf06d47d78e126372b74f5baf478e6126b61", + "expected_compiler_sha256": "734f0a39319fbfa930bcc62cb30dbf06d47d78e126372b74f5baf478e6126b61", + "self_output_matches_expected": true, + "claim": "Pinned compiler source executed through external reference interpreter, not native compiler execution" + }, + "semantic_oracle": [ + { + "name": "contract", + "check_exit": 0, + "run_exit": 0, + "source_sha256": "99a509601b6a8c28613e7c30e4ad21e1b325a4784f6ffeda2976fa22441c2e37", + "stdout_sha256": "04de2116bdff2843b5aa87cc4e551b96a7d470f9c3244f8ec0bb03294441a71c" + }, + { + "name": "golden", + "check_exit": 0, + "run_exit": 0, + "source_sha256": "64cf6f2d92d84950dd4dca59539a01e5eae2dede47ba1be096278cb435f0e07f", + "stdout_sha256": "88a3de3f88a0d59852704a97d2c9f859f87b57ee9efd0f2509aa95ace1adcab6" + }, + { + "name": "disabled", + "check_exit": 0, + "run_exit": 0, + "source_sha256": "cf516ae2ed0c32acc4b06a9c94eb13674b7795390c9c6e7714909cc8ac473873", + "stdout_sha256": "39f3dfdfc529a75a8274a27900acf4e7382b7f280a211e0412c51609f44b62a1" + }, + { + "name": "mutant-capacity", + "check_exit": 0, + "run_exit": 1, + "source_sha256": "fee221d58fb51acf46145bb29f89ad3dac7c76433521e2b568b25cd5b69b44c3", + "stdout_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + }, + { + "name": "mutant-overflow", + "check_exit": 0, + "run_exit": 1, + "source_sha256": "4a77413b4e4ec5e6275cda5d8547320dc25d823cee7dee011304df8e13412dfc", + "stdout_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + }, + { + "name": "mutant-selection", + "check_exit": 0, + "run_exit": 1, + "source_sha256": "c7a4155e7d5b676bad02bb0d28393ae7cb6dc256c325026662b5cb73fa574ca3", + "stdout_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + }, + { + "name": "mutant-stale", + "check_exit": 0, + "run_exit": 1, + "source_sha256": "06e1418930d53f557b1270d2121660a2e9b2d038c87ba5d5165f0263f60817b6", + "stdout_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + }, + { + "name": "mutant-saturation_flag", + "check_exit": 0, + "run_exit": 1, + "source_sha256": "0123c3603a036769c4cf8288df9cd2ad0e84faa550a275d5e3c34d423a79067e", + "stdout_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + }, + { + "name": "mutant-sequence", + "check_exit": 0, + "run_exit": 1, + "source_sha256": "b3fc7b18f869ae173602d5994d811fb7738f66f4a69148d3dabd48a4e36bdb53", + "stdout_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + }, + { + "name": "mutant-reserved", + "check_exit": 0, + "run_exit": 1, + "source_sha256": "7af24520c23f3318ac7bcec469fa205f7dc786fe077cb2338cb3642b35ba2490", + "stdout_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + }, + { + "name": "mutant-unused", + "check_exit": 0, + "run_exit": 1, + "source_sha256": "8062a6c9329520b29f7773d64210645b428aa42357108f32accf9c4f5252dca3", + "stdout_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + }, + { + "name": "mutant-failed_init", + "check_exit": 0, + "run_exit": 1, + "source_sha256": "84da9f601e6928cc3c6991e5fe59d1ab0f523945aa03d28748b18abbaa600896", + "stdout_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + }, + { + "name": "mutant-loss_full", + "check_exit": 0, + "run_exit": 1, + "source_sha256": "f3990b4cbcd113ad8aedc640a9689e1e8d50870fd3732a94aa55e5d08b839ccb", + "stdout_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + }, + { + "name": "mutant-flag_consistency", + "check_exit": 0, + "run_exit": 1, + "source_sha256": "1399d04d31bcabf5410b507eeef6bfbd2366f4a41e4f393c04dd77c6506a2348", + "stdout_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + }, + { + "name": "mutant-record_provenance", + "check_exit": 0, + "run_exit": 1, + "source_sha256": "d8ef0c6a2e5a6b426d75e5dd809260fb80ad84edc0bcabbf5dd17362ed50a4be", + "stdout_sha256": "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" + } + ], + "interpreted_compilation": { + "contract": { + "command": "./omega_ref run omc.om < contract.om > contract.elf", + "exit": 0, + "stderr_bytes": 0, + "elf_sha256": "45126fa63a93eccfa9572b27462bd7da538e25fff9958d817c405010dc2335fd", + "elf_architecture": "AArch64", + "native_execution": "NOT_RUN" + }, + "golden": { + "command": "./omega_ref run omc.om < golden.om > golden.elf", + "exit": 0, + "stderr_bytes": 0, + "elf_sha256": "dfabec3ebb1dd5a9576e788b543e4ad86dd8304d9767198a5f81edd6273eda8e", + "elf_architecture": "AArch64", + "native_execution": "NOT_RUN" + }, + "disabled": { + "command": "./omega_ref run omc.om < disabled.om > disabled.elf", + "exit": 0, + "stderr_bytes": 0, + "elf_sha256": "e36b6223740bdd859c2e5d5443a562391481d9c07dfb6a13c5bfea73cbbbee1b", + "elf_architecture": "AArch64", + "native_execution": "NOT_RUN" + } + }, + "golden_comparison": { + "result": "PASS", + "bytes": 192, + "sha256": "88a3de3f88a0d59852704a97d2c9f859f87b57ee9efd0f2509aa95ace1adcab6", + "independent_reference": "Wolfram little-endian field encoding, checked independently with struct.pack" + }, + "disabled_existing_emitter": { + "result": "PASS under external oracle", + "bytes": 512, + "sha256": "39f3dfdfc529a75a8274a27900acf4e7382b7f280a211e0412c51609f44b62a1", + "expected_sha256": "39f3dfdfc529a75a8274a27900acf4e7382b7f280a211e0412c51609f44b62a1", + "limit": "No enabled trace emitter is implemented. Does not establish off/on device parity." + }, + "negative_controls": { + "semantic_mutants": 12, + "all_interpreted_compiler_exits": 0, + "all_oracle_run_exits": 1, + "all_stderr": "DEVICE_TRACE_CONTRACT_FAIL\n", + "absent_implementation": { + "oracle_check_exit": 3, + "interpreted_compiler_exit": 3, + "diagnostic": "omc: line 12: error 3", + "timing": "Post-implementation absence control, not pre-implementation native red/green evidence" + } + }, + "full_repository_suite": { + "command": "make test", + "exit": 2, + "result": "NOT_RUN", + "reason": "Connector-materialized partial snapshot: No rule to make target 'tests/gpu_matmul_api_test.c', needed by 'build/gpu_matmul_api_test'." + }, + "initial_invalid_audit": { + "result": "INVALID_SETUP", + "detail": "External mutation harness initially matched capacity text twice. Narrowed to the unique gtinit guard. No product test or threshold changed." + }, + "review": { + "kind": "Independent read-only source review", + "result": "No evident source-level bounds/selection/prefix-retention defect; no native or hardware qualification", + "addressed": [ + "Clarified external manifest site/kind validation ownership", + "Added exact saturation transition and consistency/unused-slot/failed-init controls", + "Added pinned golden and disabled byte-comparison instructions" + ] + }, + "not_run": [ + "Native AArch64 compiler execution", + "Native AArch64 test ELF execution", + "Full CUDApp make test suite", + "Native seed/compiler qualification gates", + "Crumb tool validation (tool unavailable)", + "GPU producer implementation", + "GPU timer/store/control qualification", + "GPU output and canary parity", + "GPU overflow/mutation/repeated-run controls", + "Paired tracing off/on overhead measurements" + ], + "guides": "No existing Omega Harness language, compiler, bridge or gate behavior changed. This new wire format is documented locally and handed to Omega #778." +} diff --git a/native/blackwell/trace.om b/native/blackwell/trace.om new file mode 100644 index 00000000..a60b9a7b --- /dev/null +++ b/native/blackwell/trace.om @@ -0,0 +1,215 @@ +note SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +note CUDApp82 bounded HOST reference and wire codec. This does not execute on a GPU. +note Contract: docs/device-trace/CONTRACT.md. No timer instruction is emitted here. +global gtbytes uchar 4160 +global gtstate ulong 9 +fn gtput32 off ulong v uint to void +for i ulong 4 +put gtbytes add off i uchar and shr v mul i 8 255 +end +end +fn gtput64 off ulong v ulong to void +for i ulong 8 +put gtbytes add off i uchar and shr v mul i 8 255 +end +end +fn gtget32 off ulong to uint +v = uint 0 +for i ulong 4 +v = or v shl uint get gtbytes add off i mul i 8 +end +ret v +end +fn gtget64 off ulong to ulong +v = ulong 0 +for i ulong 8 +v = or v shl ulong get gtbytes add off i mul i 8 +end +ret v +end +fn gtextent to ulong +ret add 64 mul get gtstate 3 64 +end +fn gtinit gen ulong kernel ulong manifest uint cap uint cta uint warp uint to bool +note Refusal invalidates the producer before inspecting a new configuration. +put gtstate 6 0 +if or or eq gen 0 eq kernel 0 eq manifest 0 +ret false +end +if or or gt cap 64 ge cta 16384 ge warp 2 +ret false +end +for i ulong 4160 +put gtbytes i 0 +end +put gtstate 0 gen +put gtstate 1 kernel +put gtstate 2 ulong manifest +put gtstate 3 ulong cap +put gtstate 4 ulong cta +put gtstate 5 ulong warp +put gtstate 7 0 +put gtstate 8 0 +gtput32 0 1413958991 +gtput32 4 1 +gtput32 8 uint gtextent +gtput32 12 cap +gtput32 28 1 +gtput64 32 gen +gtput64 40 kernel +gtput32 48 cta +gtput32 52 warp +gtput32 56 manifest +put gtstate 6 1 +ret true +end +fn gtappend gen ulong site uint kind uint who uint stamp uint payload uint to long +note who is the logical VECTOR_1D thread index: CTA times64 plus thread. +if ne get gtstate 6 1 +ret neg long 1 +end +if ne gen get gtstate 0 +ret neg long 2 +end +if or or eq site 0 lt kind 1 gt kind 3 +ret neg long 3 +end +if ge who 1048576 +ret neg long 3 +end +if ne ulong div who 64 get gtstate 4 +ret 1 +end +if ne ulong rem who 64 mul get gtstate 5 32 +ret 1 +end +n = get gtstate 8 +if ge n get gtstate 3 +d = get gtstate 7 +if lt d 4294967295 +d = add d 1 +else +gtput32 60 1 +end +put gtstate 7 d +gtput32 20 uint d +ret 2 +end +note cap is at most64 and n is below cap, so the last store is below4160. +off = add 64 mul n 64 +gtput32 off site +gtput32 add off 4 kind +gtput32 add off 8 uint n +gtput32 add off 12 stamp +gtput64 add off 16 gen +gtput64 add off 24 get gtstate 1 +gtput32 add off 32 uint get gtstate 4 +gtput32 add off 36 uint get gtstate 5 +gtput32 add off 40 0 +gtput32 add off 44 payload +put gtstate 8 add n 1 +gtput32 16 uint add n 1 +ret 0 +end +fn gtfinish status uint to bool +if or or ne get gtstate 6 1 lt status 1 gt status 3 +ret false +end +gtput32 24 status +put gtstate 6 0 +ret true +end +fn gtrowvalid row ulong to bool +off = add 64 mul row 64 +if eq gtget32 off 0 +ret false +end +kind = gtget32 add off 4 +if or lt kind 1 gt kind 3 +ret false +end +if ne ulong gtget32 add off 8 row +ret false +end +if ne gtget64 add off 16 gtget64 32 +ret false +end +if ne gtget64 add off 24 gtget64 40 +ret false +end +if ne gtget32 add off 32 gtget32 48 +ret false +end +if ne gtget32 add off 36 gtget32 52 +ret false +end +if ne gtget32 add off 40 0 +ret false +end +for j ulong 16 +if ne get gtbytes add add off 48 j 0 +ret false +end +end +ret true +end +fn gtvalidate bytes ulong gen ulong kernel ulong manifest uint to bool +note bytes is the actual read count, not an advertised header extent. +if or lt bytes 64 gt bytes 4160 +ret false +end +if or ne gtget32 0 1413958991 ne gtget32 4 1 +ret false +end +cap = ulong gtget32 12 +if gt cap 64 +ret false +end +if ne bytes add 64 mul cap 64 +ret false +end +if ne ulong gtget32 8 bytes +ret false +end +n = ulong gtget32 16 +if gt n cap +ret false +end +if and ne gtget32 20 0 ne n cap +ret false +end +if or gt gtget32 24 3 ne gtget32 28 1 +ret false +end +if or or eq gen 0 eq kernel 0 eq manifest 0 +ret false +end +if or ne gtget64 32 gen ne gtget64 40 kernel +ret false +end +if ne gtget32 56 manifest +ret false +end +if or ge gtget32 48 16384 ge gtget32 52 2 +ret false +end +if gt gtget32 60 1 +ret false +end +if and eq gtget32 60 1 ne gtget32 20 4294967295 +ret false +end +for i ulong n +if not gtrowvalid i +ret false +end +end +note Unused slots are canonical zero. No hidden records after the written prefix. +off = add 64 mul n 64 +for i ulong sub bytes off +if ne get gtbytes add off i 0 +ret false +end +end +ret true +end diff --git a/tests/device-trace/.crumb b/tests/device-trace/.crumb new file mode 100644 index 00000000..b9cc610c --- /dev/null +++ b/tests/device-trace/.crumb @@ -0,0 +1 @@ +{"schema_version":"1.0.0","name":"device-trace","purpose":"Handwritten Omega host-reference tests and independent golden bytes for the proposed device trace contract.","invariants":["All stamps are synthetic.","Only run AArch64 outputs after a successful compile with the verified pin.","Do not open a GPU or claim device qualification from these fixtures."]} diff --git a/tests/device-trace/contract-test.om b/tests/device-trace/contract-test.om new file mode 100644 index 00000000..ffc09f4e --- /dev/null +++ b/tests/device-trace/contract-test.om @@ -0,0 +1,154 @@ +note SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +note Native host tests for the bounded trace codec. Synthetic stamps, not GPU evidence. +text gtpass "DEVICE_TRACE_CONTRACT_PASS\n" +text gtfail "DEVICE_TRACE_CONTRACT_FAIL\n" +fn gtcheck yes bool to void +if not yes +w = write 2 gtfail 0 len gtfail +exit int 1 +end +end +fn gtfixture cap uint to void +gtcheck gtinit 7 11 13 cap 3 1 +end +fn gtbad32 off ulong value uint to void +old = gtget32 off +gtput32 off value +gtcheck not gtvalidate 192 7 11 13 +gtput32 off old +gtcheck gtvalidate 192 7 11 13 +end +fn main to int +note Rejected configuration must leave the reference producer inactive. +gtcheck not gtinit 0 11 13 2 3 1 +gtcheck eq gtappend 7 17 1 224 100 0 neg long 1 +gtcheck not gtinit 7 0 13 2 3 1 +gtcheck not gtinit 7 11 0 2 3 1 +gtcheck not gtinit 7 11 13 65 3 1 +gtcheck not gtinit 7 11 13 2 16384 1 +gtcheck not gtinit 7 11 13 2 3 2 +note Zero capacity still records a selected producer's diagnostic loss. +gtfixture 0 +gtcheck eq gtextent 64 +gtcheck eq gtappend 7 17 1 224 100 0 long 2 +gtcheck eq gtget32 16 0 +gtcheck eq gtget32 20 1 +gtcheck gtvalidate 64 7 11 13 +gtfixture 2 +gtcheck eq gtextent 192 +gtcheck eq gtappend 7 17 1 add mul uint 2 64 32 100 0 long 1 +gtcheck eq gtappend 7 17 1 mul uint 3 64 100 0 long 1 +gtcheck eq gtappend 7 17 1 add mul uint 3 64 33 100 0 long 1 +gtcheck eq gtappend 8 17 1 224 100 0 neg long 2 +gtcheck eq gtappend 7 0 1 224 100 0 neg long 3 +gtcheck eq gtappend 7 17 0 224 100 0 neg long 3 +gtcheck eq gtappend 7 17 4 224 100 0 neg long 3 +gtcheck eq gtappend 7 17 1 1048576 100 0 neg long 3 +gtcheck eq gtappend 7 17 1 4294967295 100 0 neg long 3 +gtcheck eq gtget32 16 0 +gtcheck eq gtget32 20 0 +note Begin/end use exact site identity, sequence and raw low32 values. +gtcheck eq gtappend 7 17 2 224 4294967295 19 long 0 +gtcheck eq gtappend 7 17 3 224 0 23 long 0 +gtcheck eq gtget32 64 17 +gtcheck eq gtget32 68 2 +gtcheck eq gtget32 72 0 +gtcheck eq gtget32 76 4294967295 +gtcheck eq gtget64 80 7 +gtcheck eq gtget64 88 11 +gtcheck eq gtget32 96 3 +gtcheck eq gtget32 100 1 +gtcheck eq gtget32 104 0 +gtcheck eq gtget32 108 19 +gtcheck eq gtget32 128 17 +gtcheck eq gtget32 132 3 +gtcheck eq gtget32 136 1 +gtcheck eq gtget32 140 0 +gtcheck eq gtget32 172 23 +gtcheck gtvalidate 192 7 11 13 +note Overflow is a dropped suffix, never an overwrite of the retained prefix. +gtcheck eq gtappend 7 29 1 224 200 0 long 2 +gtcheck eq gtget32 16 2 +gtcheck eq gtget32 20 1 +gtcheck eq gtget32 64 17 +put gtstate 7 4294967294 +gtcheck eq gtappend 7 29 1 224 200 0 long 2 +gtcheck eq gtget32 20 4294967295 +gtcheck eq gtget32 60 0 +gtcheck eq gtappend 7 29 1 224 200 0 long 2 +gtcheck eq gtget32 20 4294967295 +gtcheck eq gtget32 60 1 +note Completion state is explicit and forbids further producer writes. +gtcheck gtfinish 2 +gtcheck eq gtget32 24 2 +gtcheck eq gtappend 7 17 1 224 100 0 neg long 1 +gtcheck not gtfinish 1 +gtcheck gtvalidate 192 7 11 13 +note Wrong identity, exact extent, version, sequence, reserved and lane are rejected. +gtbad32 0 0 +gtbad32 8 191 +gtbad32 12 65 +gtbad32 16 3 +gtbad32 24 4 +gtbad32 28 2 +gtbad32 48 16384 +gtbad32 52 2 +gtbad32 60 2 +gtbad32 64 0 +gtbad32 68 4 +gtbad32 80 8 +gtbad32 88 12 +gtbad32 96 2 +gtbad32 100 0 +gtcheck not gtvalidate 191 7 11 13 +gtcheck not gtvalidate 193 7 11 13 +gtcheck not gtvalidate 18446744073709551615 7 11 13 +gtcheck not gtvalidate 192 8 11 13 +gtcheck not gtvalidate 192 7 12 13 +gtcheck not gtvalidate 192 7 11 14 +put gtbytes 4 2 +gtcheck not gtvalidate 192 7 11 13 +put gtbytes 4 1 +put gtbytes 72 1 +gtcheck not gtvalidate 192 7 11 13 +put gtbytes 72 0 +put gtbytes 112 1 +gtcheck not gtvalidate 192 7 11 13 +put gtbytes 112 0 +put gtbytes 104 1 +gtcheck not gtvalidate 192 7 11 13 +put gtbytes 104 0 +gtcheck gtvalidate 192 7 11 13 +note All64 slots, final byte, and unused slots remain within the fixed allocation. +gtfixture 64 +for i uint 64 +gtcheck eq gtappend 7 add i 1 1 224 i 0 long 0 +end +gtcheck eq gtextent 4160 +gtcheck gtvalidate 4160 7 11 13 +gtcheck eq gtappend 7 1 1 224 65 0 long 2 +gtcheck gtfinish 1 +gtcheck gtvalidate 4160 7 11 13 +gtfixture 2 +gtcheck eq gtappend 7 17 3 224 9 0 long 0 +gtcheck gtfinish 3 +note Unmatched end is structurally valid but remains an incomplete range for #778. +gtcheck gtvalidate 192 7 11 13 +gtcheck not gtfinish 4 +gtbad32 20 1 +gtbad32 60 1 +put gtbytes 128 1 +gtcheck not gtvalidate 192 7 11 13 +put gtbytes 128 0 +gtcheck gtvalidate 192 7 11 13 +gtfixture 2 +gtcheck not gtinit 7 11 13 65 3 1 +gtcheck eq gtappend 7 17 1 224 100 0 neg long 1 +gtcheck gtinit 18446744073709551615 18446744073709551615 4294967295 1 16383 1 +gtcheck eq gtappend 18446744073709551615 4294967295 1 1048544 4294967295 4294967295 long 0 +gtcheck gtvalidate 128 18446744073709551615 18446744073709551615 4294967295 +if ne write 1 gtpass 0 len gtpass long len gtpass +ret 2 +end +ret 0 +end diff --git a/tests/device-trace/disabled-test.om b/tests/device-trace/disabled-test.om new file mode 100644 index 00000000..2f8c3c61 --- /dev/null +++ b/tests/device-trace/disabled-test.om @@ -0,0 +1,12 @@ +note SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +note Compose with vector.om only. Emit the unmodified default program for exact-byte comparison. +fn main to int +gbvec +if ne get gblen 0 512 +ret 1 +end +if ne write 1 gbcode 0 get gblen 0 512 +ret 2 +end +ret 0 +end diff --git a/tests/device-trace/golden-test.om b/tests/device-trace/golden-test.om new file mode 100644 index 00000000..5e919a37 --- /dev/null +++ b/tests/device-trace/golden-test.om @@ -0,0 +1,23 @@ +note SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception +note Compose with trace.om. Emit a synthetic complete capture for golden-byte comparison. +fn main to int +if not gtinit 7 11 13 2 3 1 +ret 1 +end +if ne gtappend 7 17 2 224 4294967295 19 0 +ret 2 +end +if ne gtappend 7 17 3 224 0 23 0 +ret 3 +end +if not gtfinish 1 +ret 4 +end +if not gtvalidate 192 7 11 13 +ret 5 +end +if ne write 1 gtbytes 0 192 192 +ret 6 +end +ret 0 +end diff --git a/tests/device-trace/golden.hex b/tests/device-trace/golden.hex new file mode 100644 index 00000000..f1c2282f --- /dev/null +++ b/tests/device-trace/golden.hex @@ -0,0 +1 @@ +4f4d475401000000c0000000020000000200000000000000010000000100000007000000000000000b0000000000000003000000010000000d00000000000000110000000200000000000000ffffffff07000000000000000b0000000000000003000000010000000000000013000000000000000000000000000000000000001100000003000000010000000000000007000000000000000b000000000000000300000001000000000000001700000000000000000000000000000000000000