diff --git a/evidence/w4-711/SHA256SUMS b/evidence/w4-711/SHA256SUMS new file mode 100644 index 00000000..125e69da --- /dev/null +++ b/evidence/w4-711/SHA256SUMS @@ -0,0 +1,12 @@ +1f7bdcd70bdd9396036352d4f0e04757ee1421e6e2641835bde8fa39701e3343 author-controls.json +e6f95bc7f0320bcce032d6bb6a1c382c7ac21eaa4b93260b720418ee8f98420b author.stdout +c3301c47f26ca63a2c6bd21286fec7a8ed2e2a276cffabe0ab5ca32579d562df batch-results.txt +fb3c25c0559fc36705c5b54cc68a25932d55b273c9814de82135951196e9dab1 batch-review.txt +aff0088097f5b52f7fe5147cd8a22cfebf9991d4e7540d646f7d751cfdd54ec0 differential.txt +89f822db7d858ebb37f632e2120be24d420e4315772e672987340bb8626d3c51 independent-controls.json +c58a217be99b85042ca8441000ee265f5aa38af1ed12e32c6b91c2844c81cb95 independent.stdout +bf647258df4bb909fd69ac3707bb990b32301c16a087094c4f37d56d14296719 model-fixture.json +c8b52b9f0cf42cb71582a62a9a48288b72f1862a62822a23175fa3ca523fc258 preflight.txt +8c91efd6208a5c227e825fb042c0c93627858f325041037d75144962e573c9e9 receipt.json +a39f2e1d1a878f3a6c323707d6e26732d38bfa3b18acef17bfc47f6bfd6ecd13 reference-host.stdout +09b09cf900b1d0c26435a75a876b917fcaf1621649ab606b9bef3e7bb6a0a3cf review.txt diff --git a/evidence/w4-711/author-controls.json b/evidence/w4-711/author-controls.json new file mode 100644 index 00000000..4b4aee0a --- /dev/null +++ b/evidence/w4-711/author-controls.json @@ -0,0 +1,42 @@ +[ + { + "name": "tie", + "from": "if eq and i 1 0", + "to": "if ne and i 1 0", + "compile": 0, + "exit": 1, + "stdout": "1219868\n97921\n" + }, + { + "name": "nibble", + "from": "shl code mul and c 1 4", + "to": "shl code mul xor and c 1 1 4", + "compile": 0, + "exit": 1, + "stdout": "1219868\n48\n" + }, + { + "name": "scale", + "from": "bexp = and shr scale 7 255", + "to": "bexp = ulong 127", + "compile": 0, + "exit": 1, + "stdout": "1219868\n332495\n" + }, + { + "name": "best", + "from": "if lt get qerr 1 get qerr 0", + "to": "if gt get qerr 1 get qerr 0", + "compile": 0, + "exit": 1, + "stdout": "1219868\n1\n" + }, + { + "name": "nan", + "from": "if eq mag 127", + "to": "if ne mag mag", + "compile": 0, + "exit": 1, + "stdout": "1219868\n6896\n" + } +] \ No newline at end of file diff --git a/evidence/w4-711/author.stdout b/evidence/w4-711/author.stdout new file mode 100644 index 00000000..576662ed --- /dev/null +++ b/evidence/w4-711/author.stdout @@ -0,0 +1,2 @@ +1219868 +0 diff --git a/evidence/w4-711/batch-results.txt b/evidence/w4-711/batch-results.txt new file mode 100644 index 00000000..5b46dd4f --- /dev/null +++ b/evidence/w4-711/batch-results.txt @@ -0,0 +1,50 @@ +regular_stream=0 +regular_verifier=0 +split_34_stream=0 +split_34_verifier=0 +split_35_stream=0 +split_35_verifier=0 +split_17919_stream=0 +split_17919_verifier=0 +split_17920_stream=0 +split_17920_verifier=0 +tail_stream=65 +tail_verifier=0 +closed_input=74 +closed_output=74 +empty=0 +bytewise_pipeline=0 0 0 0 +tail_1_stream=65 verifier=0 +tail_2_stream=65 verifier=0 +tail_3_stream=65 verifier=0 +tail_4_stream=65 verifier=0 +tail_5_stream=65 verifier=0 +tail_6_stream=65 verifier=0 +tail_7_stream=65 verifier=0 +tail_8_stream=65 verifier=0 +tail_9_stream=65 verifier=0 +tail_10_stream=65 verifier=0 +tail_11_stream=65 verifier=0 +tail_12_stream=65 verifier=0 +tail_13_stream=65 verifier=0 +tail_14_stream=65 verifier=0 +tail_15_stream=65 verifier=0 +tail_16_stream=65 verifier=0 +tail_17_stream=65 verifier=0 +tail_18_stream=65 verifier=0 +tail_19_stream=65 verifier=0 +tail_20_stream=65 verifier=0 +tail_21_stream=65 verifier=0 +tail_22_stream=65 verifier=0 +tail_23_stream=65 verifier=0 +tail_24_stream=65 verifier=0 +tail_25_stream=65 verifier=0 +tail_26_stream=65 verifier=0 +tail_27_stream=65 verifier=0 +tail_28_stream=65 verifier=0 +tail_29_stream=65 verifier=0 +tail_30_stream=65 verifier=0 +tail_31_stream=65 verifier=0 +tail_32_stream=65 verifier=0 +tail_33_stream=65 verifier=0 +tail_34_stream=65 verifier=0 diff --git a/evidence/w4-711/batch-review.txt b/evidence/w4-711/batch-review.txt new file mode 100644 index 00000000..2523ffda --- /dev/null +++ b/evidence/w4-711/batch-review.txt @@ -0,0 +1,57 @@ +Independent Core #711 stream batching delta review, 2026-10-23 + +PASS: no blocking findings. Product files were not modified. +Reviewed stream SHA256: +428476e53c4adac077f0b7cd634bd1e04e171a0959ef965632b974c6d732e676 +Unchanged pack SHA256: +724fc1476a29655a087b7385e7a7a47410028ea0ede9dcfd84e39a6dab5e16db +Live product stream hash rechecked after testing, matching frozen copy. +Same pinned compiler as preceding independent review. Native compilation +of concatenated pack+stream, generator, and verifier succeeded. + +Independent native fixture and checker extended from 128 to 1536 records. +Each run spans three full 512-record batches: 53,760 request bytes and +30,720 expected response bytes. Expected bytes are computed in the separate +checker without invoking packer helpers. Four kinds cycle throughout: +positive scale, negative scale, signed-zero group, and invalid FP8 NaN. +All three packing policies cycle, including valid records after invalid +ones. Invalid records produce cleared output and status 76; subsequent +records recover correctly, including across batch boundaries. + +Executed checks, all expected results observed: +- Regular-file input, 1536 responses: stream 0, verifier 0. +- Input split at 34, 35, 17919, and 17920 bytes: stream 0, verifier 0 each. + Traces show these exact initial read sizes, followed by successful + processing and output checks. The 17919 case exercises moving 34 trailing + bytes after processing 511 complete groups. +- Byte-at-a-time native generator piped through stream and native verifier: + all four pipeline stages exit 0. +- Every truncated tail length 1..34 appended after all 1536 complete records: + stream exits 65, verifier still accepts all prior 1536 responses and EOF. +- Closed input descriptor: 74, zero output bytes. +- Closed output descriptor: 74. +- Empty input: 0, zero output bytes. +Evidence: results.txt, split-*.trace, fixture.om, reply.om, all.om, +compiler logs, request/response artifacts and SHA256SUMS. + +Bounds and behavior review +have is always 0..34 between iterations. Read capacity is 17920-have, +so total never exceeds 17920 and frames never exceeds 512. frame accesses +at most request[17919] and reply[10239]. Tail-copy source starts at +35*frames and remains strictly below total; destination is 0..33. +If frames is zero, copying reads/writes identical indexes, preserving the +partial group. Otherwise source starts above destination, so forward copy +is safe. Every complete group is emitted before the next read, preserving +completed responses on trailing EOF or later input errors. +Writes loop until all available response bytes are sent; returned errors +and zero writes cause 74. Partial write return values were source-reviewed, +not fault-injected. Broken-pipe signals remain outside the returned-error +check, as documented in the preceding review. +No new packer behavior or arithmetic changed in this delta. The preceding +4,381,347-check independent packer result remains applicable to the same hash. + +Limits +This is native diagnostic group transport validation, not model serving, +checkpoint-format integration, inference speed measurement, or GPU evidence. +The parent separately reports an executed pinned legacy-C comparison; this +review does not count or independently certify that parent's experiment. diff --git a/evidence/w4-711/compiler-correction/README.md b/evidence/w4-711/compiler-correction/README.md new file mode 100644 index 00000000..184cded2 --- /dev/null +++ b/evidence/w4-711/compiler-correction/README.md @@ -0,0 +1,25 @@ +# Corrected compiler compatibility + +The exact proposed compiler from Omega PR676 head +`1dffceaeb0dd26fb69ea64d367a49a9950c25a62` was consumed from its committed +`seed/out/omc` blob, not from the owner's changing working directory. Its SHA256 +is `9f48f66a9ee9f6a166df615a7ab9c48bf5b06ac2ba544ac51e52e9a3d290a6c4`. +Functional source is `078455c9c1862b9145ef892dfba68676204a38da`. The owner's +combined seed reconstruction and branch-safety qualification are recorded in +that PR's `evidence/NATIVE-MAPPING/branch-correction/`; this consumer check +does not claim to repeat the entire compiler bootstrap or independent review. + +All listed programs were freshly compiled from the ordered source units in +receipt.json, using the exact compiler above through quiet-build timeout30. +Each produced executable is byte-identical to the previously tested binary. +The listed test replays were executed again in fresh private directories, +with a30-second timeout (10seconds for the classifier). Expected INVALID65 +is a rejection test, not a process failure counted as a caught control. + +Reconstruct by concatenating each build's source_files in listed order, feed +the result to the pinned compiler on stdin, and require exit0 before executing +its stdout artifact. Compare its SHA256 to both recorded binary digests. +Original qualification/reproduction remains in the parent evidence folders. +No historical receipt was rewritten. Production source and executable digests +are unchanged. GPU, full-model execution, hardware timings and repository +merge gates were not rerun or waived. The compiler remains proposed work. diff --git a/evidence/w4-711/compiler-correction/receipt.json b/evidence/w4-711/compiler-correction/receipt.json new file mode 100644 index 00000000..ad960109 --- /dev/null +++ b/evidence/w4-711/compiler-correction/receipt.json @@ -0,0 +1,81 @@ +{ + "compiler_pr": 676, + "compiler_head": "1dffceaeb0dd26fb69ea64d367a49a9950c25a62", + "compiler_source": "078455c9c1862b9145ef892dfba68676204a38da", + "compiler_sha256": "9f48f66a9ee9f6a166df615a7ab9c48bf5b06ac2ba544ac51e52e9a3d290a6c4", + "builds": [ + { + "name": "w4-author", + "repository": "sc-native-w4-711", + "source_files": [ + { + "path": "native/w4/resident.om", + "sha256": "c08d54c939675a4beca757943ba9872480cc0bbff64c3d90c288027f73c92bd5" + }, + { + "path": "native/w4/resident-test.om", + "sha256": "205a9fd5cc637ffbef2c0df37b52dcf990eb1a391f5aa690a4bd7a19d7d14f49" + } + ], + "source_sha256": "42368ca832ac0c42fb2ea51ac01e08244673001dd5aa404078caa14e04d60291", + "compile_exit": 0, + "binary_sha256": "6056c2aba7e8428caa0fc4ae8e694b8d12ce3e408ca727581fc8565919087dd5", + "previous_binary_sha256": "6056c2aba7e8428caa0fc4ae8e694b8d12ce3e408ca727581fc8565919087dd5", + "identical": true + }, + { + "name": "w4-independent", + "repository": "sc-native-w4-711", + "source_files": [ + { + "path": "native/w4/resident.om", + "sha256": "c08d54c939675a4beca757943ba9872480cc0bbff64c3d90c288027f73c92bd5" + }, + { + "path": "native/w4/review/resident-independent.om", + "sha256": "3f1eb3639de28edc8c1a54536e836101b81dbca4fc72f34ad1098a7631dd3bf4" + } + ], + "source_sha256": "19795711a5db7b9cd5416975ad38308af4193568601712a1cd81f7e4b87a0afc", + "compile_exit": 0, + "binary_sha256": "582f72c50922f6ea7a110075a3005e3edfeaffa5230b0161536bd7a685ba852b", + "previous_binary_sha256": "582f72c50922f6ea7a110075a3005e3edfeaffa5230b0161536bd7a685ba852b", + "identical": true + }, + { + "name": "w4-projection", + "repository": "sc-native-w4-711", + "source_files": [ + { + "path": "native/w4/resident.om", + "sha256": "c08d54c939675a4beca757943ba9872480cc0bbff64c3d90c288027f73c92bd5" + }, + { + "path": "native/w4/review/resident-projection.om", + "sha256": "a3f4d9119f3ed95fe6b3e30a102a2415535d95441206bd71477e56103fc5f01c" + } + ], + "source_sha256": "573a084c0693bc8b51c0bd1775bbed70c36b53af2b5e1de0e0fe7005d6d52b95", + "compile_exit": 0, + "binary_sha256": "b0f4be684a4a56ce93e636d309c2d7371f991994ead05f965f266059272d14e0", + "previous_binary_sha256": "b0f4be684a4a56ce93e636d309c2d7371f991994ead05f965f266059272d14e0", + "identical": true + } + ], + "replays": [ + { + "name": "w4-author", + "status": 0, + "signal": null, + "stdout": "8715\n0" + }, + { + "name": "w4-independent", + "status": 0, + "signal": null, + "stdout": "296271\n0" + } + ], + "gpu": false, + "full_model": false +} diff --git a/evidence/w4-711/differential.txt b/evidence/w4-711/differential.txt new file mode 100644 index 00000000..27274f4c --- /dev/null +++ b/evidence/w4-711/differential.txt @@ -0,0 +1,51 @@ +Executed development reference experiment, 2026-10-23 + +Original reference: omega-mv 8655007f0f09d454b47b75fb3d83bc80e8f6d4da +Physics lock: 6d7cf0d4d8eb2cda7b512100ff6058e25dbb3ddf +Build: make -j2 PHYSICS_DIR= OUT_DIR= + /gpu_w4_api_test +Build exit 0. --host-only: exit 0, 399 checks, 0 failed. +No GPU option or live service was exercised. + +Model: qwen3.8-27b-fp8 revision 017b9c7af6b5689d5dd426a76e0bc077eb5ca20a +File: layers-0.safetensors +Tensor: model.language_model.layers.0.mlp.gate_proj.weight +Shape: [17408,5120], data offsets [205604928,294733888], dtype F8_E4M3 +Scale tensor: corresponding weight_scale_inv, BF16, shape [136,40], + data offsets [1100608,1111488] +Region: first 128 rows, first 128 columns (16384 FP8 bytes), first BF16 scale. +Offsets are relative to the safetensors data section. Read its u64LE header +length, then JSON header, then seek each row at dataStart+205604928+row*5120. +Read 128 bytes per row. Read two scale bytes at dataStart+1100608. +Sample/header identities and scale value are recorded in model-fixture.json. +Developer Node byte extraction performed no conversion arithmetic. +Native fixture.om framed the sample into 512 groups for each of rules 0,1,2. +Native stream.om converted it and reply.om collected packed bytes and scales. + +Existing reference conversion was invoked in GDB on its own child process, +stopped at main before host tests, using allocated buffers restored from +the same extracted sample. No new C source was written. Exact function type: +int (*)(unsigned int,unsigned int,const unsigned char*,const unsigned short*, + unsigned int,unsigned int,int,unsigned char*,unsigned char*,void*) +omega_gpu_w4_from_fp8_rule(128,128,weights,scale,0,128,rule,packed,E,0) +OCP_RC=0, FIT_RC=0, BEST_RC=0. Reference 8192 packed bytes followed by +512 scale bytes compared exactly to native output for each rule. +Current buffered stream output also matched the earlier per-record stream. +All comparisons were repeated after final source freeze and returned 0. + +SHA256 of 8704-byte native AND reference outputs: +OCP 0208a53c2b10b493cc4bbe10a0f925a36891a5e457c48869591f1742305ee139 +FIT ca90eb09fe09ef5ce333e1028f957c201ed08b7f94fa509b31d1ccb8afe49a0e +BEST 80a2c951da729f3234c3a16ac67bed085c7fa7c70bc2a0e0684fd21356470bd9 + +Failed exploratory attempts, not counted as passing evidence: +- First reference build refused a different physics checkout at its lock gate. + Retried using a clean worktree at the exact required commit, without override. +- First debugger call lacked the full function type and faulted its own child. + Retried with the explicit ten-argument function pointer above. +- Initial native authoring builds exposed reserved-name, register-pressure and + untyped-literal errors, corrected before all reported successful executions. + +Limits: one real block, not whole-checkpoint parity or model quality. The +reference remains historical C, not a native runtime dependency. Model bytes, +generated binaries and machine-specific debugger paths are not published. diff --git a/evidence/w4-711/independent-controls.json b/evidence/w4-711/independent-controls.json new file mode 100644 index 00000000..9f5f9fd8 --- /dev/null +++ b/evidence/w4-711/independent-controls.json @@ -0,0 +1,26 @@ +[ + { + "name": "tie", + "from": "if eq and i 1 0", + "to": "if ne and i 1 0", + "compile": 0, + "exit": 1, + "output": "4381347\n5899\n" + }, + { + "name": "best", + "from": "if lt get qerr 1 get qerr 0", + "to": "if gt get qerr 1 get qerr 0", + "compile": 0, + "exit": 1, + "output": "4381347\n263995\n" + }, + { + "name": "order", + "from": "shl code mul and c 1 4", + "to": "shl code mul xor and c 1 1 4", + "compile": 0, + "exit": 1, + "output": "4381347\n1867304\n" + } +] diff --git a/evidence/w4-711/independent.stdout b/evidence/w4-711/independent.stdout new file mode 100644 index 00000000..e82f78a2 --- /dev/null +++ b/evidence/w4-711/independent.stdout @@ -0,0 +1,2 @@ +4381347 +0 diff --git a/evidence/w4-711/model-fixture.json b/evidence/w4-711/model-fixture.json new file mode 100644 index 00000000..a514e4f9 --- /dev/null +++ b/evidence/w4-711/model-fixture.json @@ -0,0 +1,10 @@ +{ + "model_revision": "017b9c7af6b5689d5dd426a76e0bc077eb5ca20a", + "file": "layers-0.safetensors", + "tensor": "model.language_model.layers.0.mlp.gate_proj.weight", + "region": "rows0..127, columns0..127", + "header_sha256": "f10e6204808d68452bb2b9584988d965ee3dea86aa04fa21c7e2a12df9641736", + "weights_sha256": "6d474cf829c920055f6667e961838854d8aa6c37208e9ab8c91af16fc3f40a65", + "scale_sha256": "1f4b5a345914ecb197b43a5abadf1c07b109b0cbd8b4df16ef4356a2f242090b", + "scale_u16": 14595 +} \ No newline at end of file diff --git a/evidence/w4-711/native-gate/README.md b/evidence/w4-711/native-gate/README.md new file mode 100644 index 00000000..561ca8db --- /dev/null +++ b/evidence/w4-711/native-gate/README.md @@ -0,0 +1,36 @@ +# Native W4 automatic qualification + +The existing gate entry `tests/gates/run.sh native-w4` compiled and ran all +15 native groups, exit0. Exact stdout is retained in entry.log. It uses the +immutable Omega compiler commit and source/executable digests recorded in +native/w4/compiler.lock and compiler.sha256. This is an explicit proposed +compiler dependency, not merged default-branch capability. + +Executed under quiet-build on the AArch64 host, with a private target: + + CARGO_TARGET_DIR=/home/drakestapleton/workspace/targets/L793-w4-gate tests/gates/run.sh native-w4 + +No GPU, model service, hardware judge, or performance measurement ran. +The repository's existing shell pin/build dispatch and native Om supervisor +are the test execution path. No new Rust, C or Python implementation was added. + +Independent reproduction compiled the same gate bytes and passed15groups. +All six controls refused: reused scratch91; wrong child exit, signal, actual +30-second deadline, altered numeric test stdout and compiler failure99. +Raw summarized results and review scope are in controls.txt and review.txt. +The review's copied manifest predates the supported inline-observation syntax +correction; the actual runner below parses and executes the corrected manifest. +A separate private wrapper copy with an incorrect compiler digest exits3 before +building/running any test. Its diagnostic is retained in digest-refusal.log. + +The actual existing aien-test runner passed SC-NATIVE-W4 at committed source +1d24d97e7cac46f0d7dbd1b588261b5b173cc745. runner.json records exit0, +w4_groups15, no cache reuse, and a clean tree before and after. The immutable +unmerged compiler dependency was explicitly materialized by the existing pin +mechanism; this is host component evidence, not signed release qualification. +The runner itself is the retained Rust aien-test tool, not new implementation. + +The actual planner at the same source and canonical base27b0d670 reports no +unmapped paths. It still returns BLOCKED_OPERATOR PIPELINE_CONFIG_CHANGED. +Configuration review, compiler dependency integration and the other selected +repository gates remain required. No source exemption or waiver was added. diff --git a/evidence/w4-711/native-gate/controls.txt b/evidence/w4-711/native-gate/controls.txt new file mode 100644 index 00000000..bf4a40c0 --- /dev/null +++ b/evidence/w4-711/native-gate/controls.txt @@ -0,0 +1,7 @@ +normal=0 +repeat=91 +wrongexit=99 +signal=99 +badstdout=99 +badcompile=99 +timeout=99 diff --git a/evidence/w4-711/native-gate/digest-refusal.log b/evidence/w4-711/native-gate/digest-refusal.log new file mode 100644 index 00000000..b2803b7c --- /dev/null +++ b/evidence/w4-711/native-gate/digest-refusal.log @@ -0,0 +1,4 @@ +AIEN-OBS pin_omega_w4_native "1dffceaeb0dd26fb69ea64d367a49a9950c25a62" +seed/out/omc: FAILED +seed/omc/omc.om: OK +sha256sum: WARNING: 1 computed checksum did NOT match diff --git a/evidence/w4-711/native-gate/entry.log b/evidence/w4-711/native-gate/entry.log new file mode 100644 index 00000000..fc1da054 --- /dev/null +++ b/evidence/w4-711/native-gate/entry.log @@ -0,0 +1,89 @@ +AIEN-OBS pin_omega_w4_native "1dffceaeb0dd26fb69ea64d367a49a9950c25a62" +seed/out/omc: OK +seed/omc/omc.om: OK +/home/drakestapleton/workspace/targets/L793-w4-gate/aien-pins/omega-w4-native/seed/out/omc < build/w4-native-gate/1001 > build/w4-native-gate/1002 2> build/w4-native-gate/501002 +exit=0 expected=0 +build/w4-native-gate/1002 < /dev/null > build/w4-native-gate/1003 2> build/w4-native-gate/501003 +exit=0 expected=0 +/home/drakestapleton/workspace/targets/L793-w4-gate/aien-pins/omega-w4-native/seed/out/omc < build/w4-native-gate/1004 > build/w4-native-gate/1005 2> build/w4-native-gate/501005 +exit=0 expected=0 +build/w4-native-gate/1005 < /dev/null > build/w4-native-gate/1006 2> build/w4-native-gate/501006 +exit=0 expected=0 +/home/drakestapleton/workspace/targets/L793-w4-gate/aien-pins/omega-w4-native/seed/out/omc < build/w4-native-gate/1007 > build/w4-native-gate/1008 2> build/w4-native-gate/501008 +exit=0 expected=0 +build/w4-native-gate/1008 < /dev/null > build/w4-native-gate/1009 2> build/w4-native-gate/501009 +exit=0 expected=0 +/home/drakestapleton/workspace/targets/L793-w4-gate/aien-pins/omega-w4-native/seed/out/omc < build/w4-native-gate/1010 > build/w4-native-gate/1011 2> build/w4-native-gate/501011 +exit=0 expected=0 +build/w4-native-gate/1011 < /dev/null > build/w4-native-gate/1012 2> build/w4-native-gate/501012 +exit=0 expected=0 +/home/drakestapleton/workspace/targets/L793-w4-gate/aien-pins/omega-w4-native/seed/out/omc < build/w4-native-gate/1013 > build/w4-native-gate/1014 2> build/w4-native-gate/501014 +exit=0 expected=0 +/home/drakestapleton/workspace/targets/L793-w4-gate/aien-pins/omega-w4-native/seed/out/omc < native/w4/review/fixture.om > build/w4-native-gate/1015 2> build/w4-native-gate/501015 +exit=0 expected=0 +/home/drakestapleton/workspace/targets/L793-w4-gate/aien-pins/omega-w4-native/seed/out/omc < native/w4/review/reply.om > build/w4-native-gate/1016 2> build/w4-native-gate/501016 +exit=0 expected=0 +build/w4-native-gate/1015 < build/w4-native-gate/1017 > build/w4-native-gate/1018 2> build/w4-native-gate/501018 +exit=0 expected=0 +build/w4-native-gate/1014 < build/w4-native-gate/1018 > build/w4-native-gate/1019 2> build/w4-native-gate/501019 +exit=0 expected=0 +build/w4-native-gate/1016 < build/w4-native-gate/1019 > build/w4-native-gate/1020 2> build/w4-native-gate/501020 +exit=0 expected=0 +build/w4-native-gate/1015 < build/w4-native-gate/1021 > build/w4-native-gate/1022 2> build/w4-native-gate/501022 +exit=0 expected=0 +build/w4-native-gate/1014 < build/w4-native-gate/1022 > build/w4-native-gate/1023 2> build/w4-native-gate/501023 +exit=65 expected=65 +/home/drakestapleton/workspace/targets/L793-w4-gate/aien-pins/omega-w4-native/seed/out/omc < build/w4-native-gate/1024 > build/w4-native-gate/1025 2> build/w4-native-gate/501025 +exit=0 expected=0 +/home/drakestapleton/workspace/targets/L793-w4-gate/aien-pins/omega-w4-native/seed/out/omc < native/w4/review/tensor-fixture.om > build/w4-native-gate/1026 2> build/w4-native-gate/501026 +exit=0 expected=0 +/home/drakestapleton/workspace/targets/L793-w4-gate/aien-pins/omega-w4-native/seed/out/omc < native/w4/review/tensor-scale-fixture.om > build/w4-native-gate/1027 2> build/w4-native-gate/501027 +exit=0 expected=0 +build/w4-native-gate/1026 0 < /dev/null > build/w4-native-gate/1028 2> build/w4-native-gate/501028 +exit=0 expected=0 +build/w4-native-gate/1026 1 < /dev/null > build/w4-native-gate/1029 2> build/w4-native-gate/501029 +exit=0 expected=0 +build/w4-native-gate/1026 2 < /dev/null > build/w4-native-gate/1030 2> build/w4-native-gate/501030 +exit=0 expected=0 +build/w4-native-gate/1026 3 < /dev/null > build/w4-native-gate/1031 2> build/w4-native-gate/501031 +exit=0 expected=0 +build/w4-native-gate/1025 build/w4-native-gate/1028 build/w4-native-gate/1029 build/w4-native-gate/1032 build/w4-native-gate/1033 256 256 0 < /dev/null > build/w4-native-gate/1034 2> build/w4-native-gate/501034 +exit=0 expected=0 +build/w4-native-gate/1025 build/w4-native-gate/1028 build/w4-native-gate/1029 build/w4-native-gate/1035 build/w4-native-gate/1036 256 256 1 < /dev/null > build/w4-native-gate/1037 2> build/w4-native-gate/501037 +exit=0 expected=0 +build/w4-native-gate/1025 build/w4-native-gate/1028 build/w4-native-gate/1029 build/w4-native-gate/1038 build/w4-native-gate/1039 256 256 2 < /dev/null > build/w4-native-gate/1040 2> build/w4-native-gate/501040 +exit=0 expected=0 +build/w4-native-gate/1026 4 < /dev/null > build/w4-native-gate/1041 2> build/w4-native-gate/501041 +exit=0 expected=0 +build/w4-native-gate/1025 build/w4-native-gate/1041 build/w4-native-gate/1029 build/w4-native-gate/1042 build/w4-native-gate/1043 256 256 0 < /dev/null > build/w4-native-gate/1044 2> build/w4-native-gate/501044 +exit=76 expected=76 +build/w4-native-gate/1027 5 < /dev/null > build/w4-native-gate/1045 2> build/w4-native-gate/501045 +exit=0 expected=0 +build/w4-native-gate/1025 build/w4-native-gate/1028 build/w4-native-gate/1045 build/w4-native-gate/1046 build/w4-native-gate/1047 256 256 0 < /dev/null > build/w4-native-gate/1048 2> build/w4-native-gate/501048 +exit=76 expected=76 +build/w4-native-gate/1025 build/w4-native-gate/1028 build/w4-native-gate/1029 build/w4-native-gate/1049 build/w4-native-gate/1031 256 256 0 < /dev/null > build/w4-native-gate/1050 2> build/w4-native-gate/501050 +exit=74 expected=74 +build/w4-native-gate/1026 3 < /dev/null > build/w4-native-gate/1051 2> build/w4-native-gate/501051 +exit=0 expected=0 +/home/drakestapleton/workspace/targets/L793-w4-gate/aien-pins/omega-w4-native/seed/out/omc < native/w4/review/resident-stale.om > build/w4-native-gate/1052 2> build/w4-native-gate/501052 +exit=0 expected=0 +build/w4-native-gate/1052 < /dev/null > build/w4-native-gate/1053 2> build/w4-native-gate/501053 +exit=103 expected=103 +/home/drakestapleton/workspace/targets/L793-w4-gate/aien-pins/omega-w4-native/seed/out/omc < build/w4-native-gate/1054 > build/w4-native-gate/1055 2> build/w4-native-gate/501055 +exit=0 expected=0 +build/w4-native-gate/1055 < /dev/null > build/w4-native-gate/1056 2> build/w4-native-gate/501056 +exit=64 expected=64 +/home/drakestapleton/workspace/targets/L793-w4-gate/aien-pins/omega-w4-native/seed/out/omc < native/w4/fixture.om > build/w4-native-gate/1057 2> build/w4-native-gate/501057 +exit=0 expected=0 +/home/drakestapleton/workspace/targets/L793-w4-gate/aien-pins/omega-w4-native/seed/out/omc < build/w4-native-gate/1058 > build/w4-native-gate/1059 2> build/w4-native-gate/501059 +exit=0 expected=0 +/home/drakestapleton/workspace/targets/L793-w4-gate/aien-pins/omega-w4-native/seed/out/omc < native/w4/reply.om > build/w4-native-gate/1060 2> build/w4-native-gate/501060 +exit=0 expected=0 +build/w4-native-gate/1057 < build/w4-native-gate/1061 > build/w4-native-gate/1062 2> build/w4-native-gate/501062 +exit=0 expected=0 +build/w4-native-gate/1059 < build/w4-native-gate/1062 > build/w4-native-gate/1063 2> build/w4-native-gate/501063 +exit=0 expected=0 +build/w4-native-gate/1060 < build/w4-native-gate/1063 > build/w4-native-gate/1064 2> build/w4-native-gate/501064 +exit=0 expected=0 +AIEN-OBS w4_groups 15 +W4_NATIVE_GATE: PASS diff --git a/evidence/w4-711/native-gate/plan.txt b/evidence/w4-711/native-gate/plan.txt new file mode 100644 index 00000000..1ec471b1 --- /dev/null +++ b/evidence/w4-711/native-gate/plan.txt @@ -0,0 +1,106 @@ +AIEN PLAN +Repository: aien-sovereign-core +Base: 27b0d670dc996fc7bd4b4570da37bd231816eb28 +Head: 1d24d97e7cac46f0d7dbd1b588261b5b173cc745 +Changed files: 59 + evidence/w4-711/SHA256SUMS + evidence/w4-711/author-controls.json + evidence/w4-711/author.stdout + evidence/w4-711/batch-results.txt + evidence/w4-711/batch-review.txt + evidence/w4-711/compiler-correction/README.md + evidence/w4-711/compiler-correction/receipt.json + evidence/w4-711/differential.txt + evidence/w4-711/independent-controls.json + evidence/w4-711/independent.stdout + evidence/w4-711/model-fixture.json + evidence/w4-711/native-gate/README.md + evidence/w4-711/native-gate/entry.log + evidence/w4-711/preflight.txt + evidence/w4-711/receipt.json + evidence/w4-711/reference-host.stdout + evidence/w4-711/resident/SHA256SUMS + evidence/w4-711/resident/author.stdout + evidence/w4-711/resident/controls-results.txt + evidence/w4-711/resident/controls.json + evidence/w4-711/resident/independent.stdout + evidence/w4-711/resident/projection.txt + evidence/w4-711/resident/receipt.json + evidence/w4-711/resident/review.txt + evidence/w4-711/review.txt + evidence/w4-711/tensor/SHA256SUMS + evidence/w4-711/tensor/author.stdout + evidence/w4-711/tensor/checks.txt + evidence/w4-711/tensor/development-commands.txt + evidence/w4-711/tensor/differential.txt + evidence/w4-711/tensor/extra-checks.txt + evidence/w4-711/tensor/independent.stdout + evidence/w4-711/tensor/model-source.json + evidence/w4-711/tensor/mutant.txt + evidence/w4-711/tensor/receipt.json + evidence/w4-711/tensor/review.txt + native/w4/README.md + native/w4/compiler.lock + native/w4/compiler.sha256 + native/w4/fixture.om + native/w4/gate-child.om + native/w4/gate.om + native/w4/pack.om + native/w4/reply.om + native/w4/resident-test.om + native/w4/resident.om + native/w4/review/fixture.om + native/w4/review/probes.om + native/w4/review/reply.om + native/w4/review/resident-independent.om + native/w4/review/resident-projection.om + native/w4/review/resident-stale.om + native/w4/review/tensor-fixture.om + native/w4/review/tensor-scale-fixture.om + native/w4/stream.om + native/w4/tensor.om + native/w4/tests.om + tests/gates/run.sh + tests/gates/sc-native-w4.gate +Pins: native/w4/compiler.lock +Graph digest: f9100d8b9c9cb2d64322047c97d229bc2c560bf0de974f1487df4402feba1774 +Required: + (none) +Cached: + (none) +Needs Spark: + (none) +Needs GB10: + (none) +Advisory: + (none) +Blocked: + CRUMB-VERIFY pool=host exactness=EXACT check=7d1e69f651e1 because=always PIPELINE_CONFIG_CHANGED + SC-AGENT-PREFLIGHT pool=host exactness=EXACT check=0a6bdb5a7e27 because=tests/gates/run.sh PIPELINE_CONFIG_CHANGED + SC-AIEN-VERIFY-TESTS pool=host exactness=EXACT check=e9dd2b9276aa because=tests/gates/run.sh PIPELINE_CONFIG_CHANGED + SC-ANTI-SLOP pool=host exactness=EXACT check=65d33b2efa63 because=always PIPELINE_CONFIG_CHANGED + SC-CHECK pool=host exactness=EXACT check=d555882d4233 because=tests/gates/run.sh PIPELINE_CONFIG_CHANGED + SC-CLIPPY pool=host exactness=EXACT check=3ad06b0b07d5 because=tests/gates/run.sh PIPELINE_CONFIG_CHANGED + SC-CRB1 pool=host exactness=EXACT check=98907de0cb93 because=tests/gates/run.sh PIPELINE_CONFIG_CHANGED + SC-FMT pool=host exactness=EXACT check=1575c8601239 because=tests/gates/run.sh PIPELINE_CONFIG_CHANGED + SC-INQUISITOR pool=host exactness=EXACT check=2f294cc3f4a8 because=always PIPELINE_CONFIG_CHANGED + SC-INSTALL pool=host exactness=EXACT check=c573727532c8 because=tests/gates/run.sh PIPELINE_CONFIG_CHANGED + SC-KV-PROPS pool=host exactness=EXACT check=fcf22c92a1d3 because=tests/gates/run.sh PIPELINE_CONFIG_CHANGED + SC-LINKED-COMPOSE pool=host exactness=EXACT check=9fc8e2b6c6c3 because=tests/gates/run.sh PIPELINE_CONFIG_CHANGED + SC-MIRI pool=host exactness=EXACT check=3a2d812c3e4d because=tests/gates/run.sh PIPELINE_CONFIG_CHANGED + SC-NATIVE-IDENTITY pool=host exactness=EXACT check=7f37ddb0e4c2 because=tests/gates/run.sh PIPELINE_CONFIG_CHANGED + SC-NATIVE-W4 pool=host exactness=EXACT check=562886a639fe because=evidence/w4-711/SHA256SUMS PIPELINE_CONFIG_CHANGED + SC-PINS-SELFTEST pool=host exactness=EXACT check=95207cd376b4 because=tests/gates/run.sh PIPELINE_CONFIG_CHANGED + SC-PREFLIGHT-GUARD pool=host exactness=EXACT check=4e26b5f379fc because=tests/gates/run.sh PIPELINE_CONFIG_CHANGED + SC-RELEASE-DRY-RUN pool=host exactness=EXACT check=7390547cddeb because=tests/gates/run.sh PIPELINE_CONFIG_CHANGED + SC-RELEASE-GATE-NEGATIVES pool=host exactness=EXACT check=dfbe9a7f25d7 because=tests/gates/run.sh PIPELINE_CONFIG_CHANGED + SC-SCORING-V5 pool=host exactness=EXACT check=6332503d7200 because=tests/gates/run.sh PIPELINE_CONFIG_CHANGED + SC-STRICT-MODE pool=host exactness=EXACT check=f78c06592ec7 because=tests/gates/run.sh PIPELINE_CONFIG_CHANGED + SC-TEST pool=host exactness=EXACT check=b73301d9bd28 because=tests/gates/run.sh PIPELINE_CONFIG_CHANGED + SC-TRN1 pool=host exactness=EXACT check=ac696e0cd959 because=tests/gates/run.sh PIPELINE_CONFIG_CHANGED + SC-VERIFY-CLOSURE pool=host exactness=EXACT check=eee075bea757 because=tests/gates/run.sh PIPELINE_CONFIG_CHANGED + SC-ZERO-CUDA pool=host exactness=EXACT check=29a58c169b5b because=always PIPELINE_CONFIG_CHANGED + SC-ZERO-DISK-SECRETS pool=host exactness=EXACT check=2852f7681556 because=always PIPELINE_CONFIG_CHANGED +UNMAPPED: + (none) +Plan verdict: BLOCKED_OPERATOR PIPELINE_CONFIG_CHANGED diff --git a/evidence/w4-711/native-gate/review.txt b/evidence/w4-711/native-gate/review.txt new file mode 100644 index 00000000..76fb63c9 --- /dev/null +++ b/evidence/w4-711/native-gate/review.txt @@ -0,0 +1,86 @@ +Independent W4 automatic gate verification, 2026-10-23 +PASS:15 qualification groups reproduced. Six negative/control invocations +refuse as required. No blocking finding in the bounded supervisor review. +No owner-tree edits or PR changes. + +Identities +Compiler /tmp/L793-corrected-compiler/omc SHA256: +9f48f66a9ee9f6a166df615a7ab9c48bf5b06ac2ba544ac51e52e9a3d290a6c4 +Compiler pin1dffceaeb0dd26fb69ea64d367a49a9950c25a62. +Gate source SHA256: +8d4788f83d45cba0b5b3db15fac2f43b278e6764a9631b947cb9d98c84f47280 +Independently built gate binary SHA256: +0d8f759666f339ce0d18c7f997c5950b83dad965fc6cd9ad500b0d00335b821f +Gate child SHA256: +459a60da8e660ee1f433a9679bb41467074fda45997e5168e23e92ebad0d570b +Compiler lock SHA256: +3b70520aa9d047e2d8b3074e1101ccf8fde5a93bb06232e6c0edba89c99c29ef +Compiler checksum-file SHA256: +db5f815ceba1a3c9514900c89491510a02934a73236b75cc07fd24ceedf76200 +Manifest SHA256: +69e39d19029e4283a0c83b9b1121629be2fd7302ceb0a446f4faf8b6252ed61c +Runner SHA256: +2f9cd0b3f15b4f7d5672a679d97a81fa9e1953aee227d98101cc2046d1204bc4 +Live gate source hash checked after runs, matching reviewed copy. + +Execution evidence +root:exit0, AIEN-OBS w4_groups15 and W4_NATIVE_GATE: PASS. +root repeated without removing scratch:exit91, no PASS. +wrongexit optional argument0:child exit7 versus required0; gate99. +signal optional argument1:child wait signal9; gate99. +timeout optional argument2:30-second deadline, SIGKILL, child reaped with +wait signal9; gate99. External40-second timeout did not cause this result. +badstdout:private tests.om changed printed check count to1219869 from +1219868 while test exits0 and reports zero failures. Gate99 catches the +exact stdout mismatch. Evidence:badstdout/build/w4-native-gate/1003. +badcompile:invalid source appended to private pack.om; compiler16 versus +expected0; gate99. Compiler diagnostic retained in child stderr file. +None of the five fresh negative controls prints gate PASS. results.txt +summarizes all seven invocation statuses; per-case stdout/stderr retained. + +Supervisor review +Run opens exclusive scratch output/error files, uses packed native argv +rather than a shell, redirects child descriptors, checks wait status and +expected exit, and then checks exact result bytes or content as applicable. +Signals and deadline failures terminate qualification before any PASS. +Each child has30-second monotonic deadline, kill-and-reap path. Exclusive +scratch creation prevents accidental reuse and mixing old evidence. +Compilation requires successful exit and ELF header before execute-bit +permission. Gate counts successful groups and requires exactly15 before +emitting the observation/PASS. Packer/resident suites validate exact count +and failure lines; stream/tensor outputs receive bytewise verification. +Failure cases check absent newly created outputs and retained prior files. +No weakening of prior numerical tests was found in the supervisor glue. + +Static runner/manifest review +native-w4 pins the separate compiler revision, verifies binary and compiler +source checksums, requires executable compiler, copies W4 sources to a fresh +private stage, bounds gate compilation, then invokes the native gate there. +Manifest requires host, exit0, w4_groups15, PASS, with5-minute overall limit. +The wrapper's pin-cache and broader gate service were not executed by this +review; tests directly invoke the qualified compiler in private scratch. + +Commands +Workspace:/tmp/L793-w4-gate-review. For each case, copied native/w4 into +CASE/native/w4 and created empty CASE/build. No product files modified. + /tmp/L793-corrected-compiler/omc < gate.om > gate.elf 2> compile.log + chmod 700 gate.elf +From root: + timeout --kill-after=2 120 ../gate.elf /tmp/L793-corrected-compiler/omc +Repeat same invocation in same root for scratch refusal91. +From fresh wrongexit/signal/timeout, append0/1/2 respectively, using an +external40-second safety bound. Actual native deadline is30seconds. +Private badstdout replacement: + number get tests 0 -> number add get tests 0 1 +Private badcompile appended line: + this is deliberately invalid omega source +Run each with no optional argument and capture stdout/stderr/status. +SHA256SUMS covers native copies, logs, outputs and compiled artifacts. + +Limits +Host-only native validation. No GPU, model-speed evidence, serving, network +fetch, owner-tree edits, compiler changes, publication, Python or new C/Rust. +No fault injection of waitpid/clock/kill failures; normal wrong-exit, signal, +actual deadline, compile failure and output corruption paths were executed. +This is a bounded gate integration review, not requalification of every +compiler/runtime facility or execution of the entire repository gate system. diff --git a/evidence/w4-711/native-gate/runner.json b/evidence/w4-711/native-gate/runner.json new file mode 100644 index 00000000..bf84acfa --- /dev/null +++ b/evidence/w4-711/native-gate/runner.json @@ -0,0 +1 @@ +{"core":{"binary_sha256":"2f9cd0b3f15b4f7d5672a679d97a81fa9e1953aee227d98101cc2046d1204bc4","build_inputs_digest":"ababafece3da83ef1bdea9cd74799b9727c646c3b3bff54c92dd0c56e7298eb7","checks":[],"commit":"1d24d97e7cac46f0d7dbd1b588261b5b173cc745","commit_unchanged_after":true,"dependencies":[],"derived_verdict":"PASS","env":{"LANG":"C.UTF-8","LC_ALL":"C.UTF-8"},"exit_status":0,"gate":"SC-NATIVE-W4","machine":{"arch":"aarch64","cpu_count":20,"cpu_model":"","gb10_present":true,"kernel_release":"7.0.0-1019-nvidia","mem_total_kib":127598528,"qemu_available":true},"machine_digest":"55574213acb2724f71f4d71cf01ba40d745451e4246c1fbef4fa1d1e97acaf1d","manifest_digest":"c56b8d732034c6af90e882d03146fca160727bfbbc0a62490994f4c00201661d","mutants":[],"observations":[{"name":"pin_omega_w4_native","value":"1dffceaeb0dd26fb69ea64d367a49a9950c25a62"},{"name":"w4_groups","value":15}],"owner":"aien-sovereign-core","pins":[],"reason":"","rules":[{"held":true,"rule":"w4_groups == 15"}],"stderr_sha256":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855","stdout_sha256":"b2e2cac001ee704b277cbbd65a1cc9a6401d8c10e97435819cad82e85cb24e6b","tree_clean_after":true,"tree_clean_before":true},"schema":"aien-test/EvidenceReceiptV1","volatile":{"cache":{"key":"9ef1a956e03afd3326cd0eb61e5e20857d1d0eb1b0c566f0fa0bf87c0be1840a","mode":"disabled","reused":false,"reused_from":null},"duration_ms":1464,"finished_utc":"2026-10-24T01:10:38Z","gpu_held_ms":null,"gpu_wait":null,"pool":"host","pool_wait_ms":0,"runner":{"impl":"rust","name":"aien-test","version":"0.1.0"},"started_utc":"2026-10-24T01:10:36Z","timeout_exceeded":false}} diff --git a/evidence/w4-711/preflight.txt b/evidence/w4-711/preflight.txt new file mode 100644 index 00000000..962e8ba3 --- /dev/null +++ b/evidence/w4-711/preflight.txt @@ -0,0 +1,10 @@ +Repository gate remains FAIL, not waived. +This branch and L790 were based on core main d691a4dc. L790 ran: +quiet-build timeout 180 bash scripts/agent-preflight.sh +Exit 1: browser_mirror::tests::stub_page_screenshot_and_eval failed with +WebSocket read Resource temporarily unavailable (os error 11). +Eight dependency advisories were also reported. The new native files do +not modify those Rust tests or dependency locks. No unchanged broad retry +was used to turn that result green. See L790 branch evidence/state-reuse-718 +for the receipt. This branch passes native checks and git diff --check only; +a passing full repository gate remains required before merge. diff --git a/evidence/w4-711/receipt.json b/evidence/w4-711/receipt.json new file mode 100644 index 00000000..ddf873cf --- /dev/null +++ b/evidence/w4-711/receipt.json @@ -0,0 +1,53 @@ +{ + "date": "2026-10-23", + "issue": "aien-dev/aien-sovereign-core-mv#711", + "ledger": "L791", + "status": "partial_native_host_component", + "source_commit": "b906d3e32c805e3a21853bc9afffce9e9ec29129", + "compiler_sha256": "191b776ef98821597c3e30655da6d680a9b66edbc9ceaca3c39c61ea6df098e9", + "source_hashes": { + "native/w4/README.md": "696a0a9b33316745df1722d17b8fcb919d983c5b9b7b55ad65649426a5c68af7", + "native/w4/fixture.om": "8c8fed697975e02eba69d0645027eaa056609539c814cee5b4ed870f4ec54158", + "native/w4/pack.om": "724fc1476a29655a087b7385e7a7a47410028ea0ede9dcfd84e39a6dab5e16db", + "native/w4/reply.om": "e6209e057879863a741cf142834d1f315d262dec32ec67ea6eb09d5964c75dc1", + "native/w4/review/fixture.om": "da68085266054c754fbf8ef4117f4033b1e0fa736ff0c14c552bca212492ac43", + "native/w4/review/probes.om": "b8d5768eb1018e093a2b2a7cd20a5cf15a80e6156838448fea0c10f81b8b5401", + "native/w4/review/reply.om": "086ccf027abce799ad68f90533ff23874efcc0fe45bbc2abed4ee5cda0be3f5b", + "native/w4/stream.om": "428476e53c4adac077f0b7cd634bd1e04e171a0959ef965632b974c6d732e676", + "native/w4/tests.om": "2b6f2aa739d73bd502ae6873624458d522a5415c5ff4bcae9fcb5b2bb21a7ab5" + }, + "author": { + "checks": 1219868, + "failures": 0, + "compiled_defects_detected": 5 + }, + "independent": { + "checks": 4381347, + "failures": 0, + "compiled_defects_detected": 3, + "parent_rebuilt": true + }, + "transport": { + "records": 1536, + "fragment_boundaries": [ + 34, + 35, + 17919, + 17920 + ], + "truncated_tail_lengths": 34, + "partial_write_fault_injection": false + }, + "reference": { + "host_checks": 399, + "failures": 0, + "real_block_groups": 512, + "rules": 3, + "bytes_per_rule": 8704, + "comparison": "exact" + }, + "repository_gate": "FAIL inherited same-base preflight; not waived", + "gpu_executed": false, + "full_model_executed": false, + "issue_closed": false +} diff --git a/evidence/w4-711/reference-host.stdout b/evidence/w4-711/reference-host.stdout new file mode 100644 index 00000000..3046d22c --- /dev/null +++ b/evidence/w4-711/reference-host.stdout @@ -0,0 +1,151 @@ + codegen k 5120 lb 8 rows 1 sched 0 coal 0: 160 insns, 49 GPRs + codegen k 5120 lb 8 rows 1 sched 0 coal 1: 190 insns, 59 GPRs + codegen k 5120 lb 8 rows 1 sched 1 coal 0: 160 insns, 57 GPRs + codegen k 5120 lb 8 rows 1 sched 1 coal 1: 190 insns, 67 GPRs + codegen k 5120 lb 8 rows 2 sched 0 coal 0: 261 insns, 53 GPRs + codegen k 5120 lb 8 rows 2 sched 0 coal 1: 291 insns, 63 GPRs + codegen k 5120 lb 8 rows 2 sched 1 coal 0: 261 insns, 61 GPRs + codegen k 5120 lb 8 rows 2 sched 1 coal 1: 291 insns, 71 GPRs + codegen k 5120 lb 8 rows 4 sched 0 coal 0: 463 insns, 63 GPRs + codegen k 5120 lb 8 rows 4 sched 0 coal 0: 463 insns, 63 GPRs + codegen k 5120 lb 8 rows 4 sched 1 coal 0: 463 insns, 69 GPRs + codegen k 5120 lb 8 rows 4 sched 1 coal 0: 463 insns, 69 GPRs + codegen k 5120 lb 8 rows 8 sched 0 coal 0: 867 insns, 83 GPRs + codegen k 5120 lb 8 rows 8 sched 0 coal 0: 867 insns, 83 GPRs + codegen k 5120 lb 8 rows 8 sched 1 coal 0: 867 insns, 85 GPRs + codegen k 5120 lb 8 rows 8 sched 1 coal 0: 867 insns, 85 GPRs + codegen k 5120 lb 16 rows 1 sched 0 coal 0: 244 insns, 68 GPRs + codegen k 5120 lb 16 rows 1 sched 0 coal 1: 274 insns, 77 GPRs + codegen k 5120 lb 16 rows 1 sched 1 coal 0: 244 insns, 75 GPRs + codegen k 5120 lb 16 rows 1 sched 1 coal 1: 274 insns, 85 GPRs + codegen k 5120 lb 16 rows 2 sched 0 coal 0: 425 insns, 73 GPRs + codegen k 5120 lb 16 rows 2 sched 0 coal 1: 455 insns, 84 GPRs + codegen k 5120 lb 16 rows 2 sched 1 coal 0: 425 insns, 81 GPRs + codegen k 5120 lb 16 rows 2 sched 1 coal 1: 455 insns, 91 GPRs + codegen k 5120 lb 16 rows 4 sched 0 coal 0: 787 insns, 88 GPRs + codegen k 5120 lb 16 rows 4 sched 0 coal 0: 787 insns, 88 GPRs + codegen k 5120 lb 16 rows 4 sched 1 coal 0: 787 insns, 93 GPRs + codegen k 5120 lb 16 rows 4 sched 1 coal 0: 787 insns, 93 GPRs + codegen k 6144 lb 8 rows 1 sched 0 coal 0: 160 insns, 49 GPRs + codegen k 6144 lb 8 rows 1 sched 0 coal 1: 190 insns, 59 GPRs + codegen k 6144 lb 8 rows 1 sched 1 coal 0: 160 insns, 57 GPRs + codegen k 6144 lb 8 rows 1 sched 1 coal 1: 190 insns, 67 GPRs + codegen k 6144 lb 8 rows 2 sched 0 coal 0: 261 insns, 53 GPRs + codegen k 6144 lb 8 rows 2 sched 0 coal 1: 291 insns, 63 GPRs + codegen k 6144 lb 8 rows 2 sched 1 coal 0: 261 insns, 61 GPRs + codegen k 6144 lb 8 rows 2 sched 1 coal 1: 291 insns, 71 GPRs + codegen k 6144 lb 8 rows 4 sched 0 coal 0: 463 insns, 63 GPRs + codegen k 6144 lb 8 rows 4 sched 0 coal 0: 463 insns, 63 GPRs + codegen k 6144 lb 8 rows 4 sched 1 coal 0: 463 insns, 69 GPRs + codegen k 6144 lb 8 rows 4 sched 1 coal 0: 463 insns, 69 GPRs + codegen k 6144 lb 8 rows 8 sched 0 coal 0: 867 insns, 83 GPRs + codegen k 6144 lb 8 rows 8 sched 0 coal 0: 867 insns, 83 GPRs + codegen k 6144 lb 8 rows 8 sched 1 coal 0: 867 insns, 85 GPRs + codegen k 6144 lb 8 rows 8 sched 1 coal 0: 867 insns, 85 GPRs + codegen k 6144 lb 16 rows 1 sched 0 coal 0: 244 insns, 68 GPRs + codegen k 6144 lb 16 rows 1 sched 0 coal 1: 274 insns, 77 GPRs + codegen k 6144 lb 16 rows 1 sched 1 coal 0: 244 insns, 75 GPRs + codegen k 6144 lb 16 rows 1 sched 1 coal 1: 274 insns, 85 GPRs + codegen k 6144 lb 16 rows 2 sched 0 coal 0: 425 insns, 73 GPRs + codegen k 6144 lb 16 rows 2 sched 0 coal 1: 455 insns, 84 GPRs + codegen k 6144 lb 16 rows 2 sched 1 coal 0: 425 insns, 81 GPRs + codegen k 6144 lb 16 rows 2 sched 1 coal 1: 455 insns, 91 GPRs + codegen k 6144 lb 16 rows 4 sched 0 coal 0: 787 insns, 88 GPRs + codegen k 6144 lb 16 rows 4 sched 0 coal 0: 787 insns, 88 GPRs + codegen k 6144 lb 16 rows 4 sched 1 coal 0: 787 insns, 93 GPRs + codegen k 6144 lb 16 rows 4 sched 1 coal 0: 787 insns, 93 GPRs + codegen k 17408 lb 8 rows 1 sched 0 coal 0: 160 insns, 49 GPRs + codegen k 17408 lb 8 rows 1 sched 0 coal 1: 190 insns, 59 GPRs + codegen k 17408 lb 8 rows 1 sched 1 coal 0: 160 insns, 57 GPRs + codegen k 17408 lb 8 rows 1 sched 1 coal 1: 190 insns, 67 GPRs + codegen k 17408 lb 8 rows 2 sched 0 coal 0: 261 insns, 53 GPRs + codegen k 17408 lb 8 rows 2 sched 0 coal 1: 291 insns, 63 GPRs + codegen k 17408 lb 8 rows 2 sched 1 coal 0: 261 insns, 61 GPRs + codegen k 17408 lb 8 rows 2 sched 1 coal 1: 291 insns, 71 GPRs + codegen k 17408 lb 8 rows 4 sched 0 coal 0: 463 insns, 63 GPRs + codegen k 17408 lb 8 rows 4 sched 0 coal 0: 463 insns, 63 GPRs + codegen k 17408 lb 8 rows 4 sched 1 coal 0: 463 insns, 69 GPRs + codegen k 17408 lb 8 rows 4 sched 1 coal 0: 463 insns, 69 GPRs + codegen k 17408 lb 8 rows 8 sched 0 coal 0: 867 insns, 83 GPRs + codegen k 17408 lb 8 rows 8 sched 0 coal 0: 867 insns, 83 GPRs + codegen k 17408 lb 8 rows 8 sched 1 coal 0: 867 insns, 85 GPRs + codegen k 17408 lb 8 rows 8 sched 1 coal 0: 867 insns, 85 GPRs + codegen k 17408 lb 16 rows 1 sched 0 coal 0: 244 insns, 68 GPRs + codegen k 17408 lb 16 rows 1 sched 0 coal 1: 274 insns, 77 GPRs + codegen k 17408 lb 16 rows 1 sched 1 coal 0: 244 insns, 75 GPRs + codegen k 17408 lb 16 rows 1 sched 1 coal 1: 274 insns, 85 GPRs + codegen k 17408 lb 16 rows 2 sched 0 coal 0: 425 insns, 73 GPRs + codegen k 17408 lb 16 rows 2 sched 0 coal 1: 455 insns, 84 GPRs + codegen k 17408 lb 16 rows 2 sched 1 coal 0: 425 insns, 81 GPRs + codegen k 17408 lb 16 rows 2 sched 1 coal 1: 455 insns, 91 GPRs + codegen k 17408 lb 16 rows 4 sched 0 coal 0: 787 insns, 88 GPRs + codegen k 17408 lb 16 rows 4 sched 0 coal 0: 787 insns, 88 GPRs + codegen k 17408 lb 16 rows 4 sched 1 coal 0: 787 insns, 93 GPRs + codegen k 17408 lb 16 rows 4 sched 1 coal 0: 787 insns, 93 GPRs + pf codegen k 5120 lb 8 rows 1 coal 0: 186 insns, 68 GPRs, lint clean (186 insns) + pf codegen k 5120 lb 8 rows 1 coal 1: 210 insns, 74 GPRs, lint clean (210 insns) + pf codegen k 5120 lb 8 rows 1 coal 0: 208 insns, 84 GPRs, lint clean (208 insns) + pf codegen k 5120 lb 8 rows 1 coal 1: 232 insns, 90 GPRs, lint clean (232 insns) + pf codegen k 5120 lb 8 rows 2 coal 0: 293 insns, 79 GPRs, lint clean (293 insns) + pf codegen k 5120 lb 8 rows 2 coal 1: 317 insns, 85 GPRs, lint clean (317 insns) + pf codegen k 5120 lb 8 rows 2 coal 0: 315 insns, 95 GPRs, lint clean (315 insns) + pf codegen k 5120 lb 8 rows 2 coal 1: 339 insns, 101 GPRs, lint clean (339 insns) + pf codegen k 5120 lb 8 rows 4 coal 0: 507 insns, 97 GPRs, lint clean (507 insns) + pf codegen k 5120 lb 8 rows 4 coal 1: 531 insns, 103 GPRs, lint clean (531 insns) + pf codegen k 5120 lb 8 rows 4 coal 0: 529 insns, 113 GPRs, lint clean (529 insns) + pf codegen k 5120 lb 8 rows 4 coal 1: 553 insns, 119 GPRs, lint clean (553 insns) + pf codegen k 5120 lb 16 rows 1 coal 0: 272 insns, 88 GPRs, lint clean (272 insns) + pf codegen k 5120 lb 16 rows 1 coal 1: 296 insns, 94 GPRs, lint clean (296 insns) + pf codegen k 5120 lb 16 rows 1 coal 0: 314 insns, 120 GPRs, lint clean (314 insns) + pf codegen k 5120 lb 16 rows 1 coal 1: 338 insns, 126 GPRs, lint clean (338 insns) + pf codegen k 5120 lb 16 rows 2 coal 0: 461 insns, 103 GPRs, lint clean (461 insns) + pf codegen k 5120 lb 16 rows 2 coal 1: 485 insns, 109 GPRs, lint clean (485 insns) + pf codegen k 5120 lb 16 rows 2 coal 0: 503 insns, 135 GPRs, lint clean (503 insns) + pf codegen k 5120 lb 16 rows 2 coal 1: 527 insns, 141 GPRs, lint clean (527 insns) + pf codegen k 5120 lb 16 rows 4 coal 0: 881 insns, 161 GPRs, lint clean (881 insns) + pf codegen k 5120 lb 16 rows 4 coal 1: 905 insns, 167 GPRs, lint clean (905 insns) + pf codegen k 6144 lb 8 rows 1 coal 0: 186 insns, 68 GPRs, lint clean (186 insns) + pf codegen k 6144 lb 8 rows 1 coal 1: 210 insns, 74 GPRs, lint clean (210 insns) + pf codegen k 6144 lb 8 rows 1 coal 0: 208 insns, 84 GPRs, lint clean (208 insns) + pf codegen k 6144 lb 8 rows 1 coal 1: 232 insns, 90 GPRs, lint clean (232 insns) + pf codegen k 6144 lb 8 rows 2 coal 0: 293 insns, 79 GPRs, lint clean (293 insns) + pf codegen k 6144 lb 8 rows 2 coal 1: 317 insns, 85 GPRs, lint clean (317 insns) + pf codegen k 6144 lb 8 rows 2 coal 0: 315 insns, 95 GPRs, lint clean (315 insns) + pf codegen k 6144 lb 8 rows 2 coal 1: 339 insns, 101 GPRs, lint clean (339 insns) + pf codegen k 6144 lb 8 rows 4 coal 0: 507 insns, 97 GPRs, lint clean (507 insns) + pf codegen k 6144 lb 8 rows 4 coal 1: 531 insns, 103 GPRs, lint clean (531 insns) + pf codegen k 6144 lb 8 rows 4 coal 0: 529 insns, 113 GPRs, lint clean (529 insns) + pf codegen k 6144 lb 8 rows 4 coal 1: 553 insns, 119 GPRs, lint clean (553 insns) + pf codegen k 6144 lb 16 rows 1 coal 0: 272 insns, 88 GPRs, lint clean (272 insns) + pf codegen k 6144 lb 16 rows 1 coal 1: 296 insns, 94 GPRs, lint clean (296 insns) + pf codegen k 6144 lb 16 rows 1 coal 0: 314 insns, 120 GPRs, lint clean (314 insns) + pf codegen k 6144 lb 16 rows 1 coal 1: 338 insns, 126 GPRs, lint clean (338 insns) + pf codegen k 6144 lb 16 rows 2 coal 0: 461 insns, 103 GPRs, lint clean (461 insns) + pf codegen k 6144 lb 16 rows 2 coal 1: 485 insns, 109 GPRs, lint clean (485 insns) + pf codegen k 6144 lb 16 rows 2 coal 0: 503 insns, 135 GPRs, lint clean (503 insns) + pf codegen k 6144 lb 16 rows 2 coal 1: 527 insns, 141 GPRs, lint clean (527 insns) + pf codegen k 6144 lb 16 rows 4 coal 0: 881 insns, 161 GPRs, lint clean (881 insns) + pf codegen k 6144 lb 16 rows 4 coal 1: 905 insns, 167 GPRs, lint clean (905 insns) + pf codegen k 17408 lb 8 rows 1 coal 0: 186 insns, 68 GPRs, lint clean (186 insns) + pf codegen k 17408 lb 8 rows 1 coal 1: 210 insns, 74 GPRs, lint clean (210 insns) + pf codegen k 17408 lb 8 rows 1 coal 0: 208 insns, 84 GPRs, lint clean (208 insns) + pf codegen k 17408 lb 8 rows 1 coal 1: 232 insns, 90 GPRs, lint clean (232 insns) + pf codegen k 17408 lb 8 rows 2 coal 0: 293 insns, 79 GPRs, lint clean (293 insns) + pf codegen k 17408 lb 8 rows 2 coal 1: 317 insns, 85 GPRs, lint clean (317 insns) + pf codegen k 17408 lb 8 rows 2 coal 0: 315 insns, 95 GPRs, lint clean (315 insns) + pf codegen k 17408 lb 8 rows 2 coal 1: 339 insns, 101 GPRs, lint clean (339 insns) + pf codegen k 17408 lb 8 rows 4 coal 0: 507 insns, 97 GPRs, lint clean (507 insns) + pf codegen k 17408 lb 8 rows 4 coal 1: 531 insns, 103 GPRs, lint clean (531 insns) + pf codegen k 17408 lb 8 rows 4 coal 0: 529 insns, 113 GPRs, lint clean (529 insns) + pf codegen k 17408 lb 8 rows 4 coal 1: 553 insns, 119 GPRs, lint clean (553 insns) + pf codegen k 17408 lb 16 rows 1 coal 0: 272 insns, 88 GPRs, lint clean (272 insns) + pf codegen k 17408 lb 16 rows 1 coal 1: 296 insns, 94 GPRs, lint clean (296 insns) + pf codegen k 17408 lb 16 rows 1 coal 0: 314 insns, 120 GPRs, lint clean (314 insns) + pf codegen k 17408 lb 16 rows 1 coal 1: 338 insns, 126 GPRs, lint clean (338 insns) + pf codegen k 17408 lb 16 rows 2 coal 0: 461 insns, 103 GPRs, lint clean (461 insns) + pf codegen k 17408 lb 16 rows 2 coal 1: 485 insns, 109 GPRs, lint clean (485 insns) + pf codegen k 17408 lb 16 rows 2 coal 0: 503 insns, 135 GPRs, lint clean (503 insns) + pf codegen k 17408 lb 16 rows 2 coal 1: 527 insns, 141 GPRs, lint clean (527 insns) + pf codegen k 17408 lb 16 rows 4 coal 0: 881 insns, 161 GPRs, lint clean (881 insns) + pf codegen k 17408 lb 16 rows 4 coal 1: 905 insns, 167 GPRs, lint clean (905 insns) +GPU_W4_API_TEST host : 399 checks, 0 failed -> PASS diff --git a/evidence/w4-711/resident/SHA256SUMS b/evidence/w4-711/resident/SHA256SUMS new file mode 100644 index 00000000..4b629f18 --- /dev/null +++ b/evidence/w4-711/resident/SHA256SUMS @@ -0,0 +1,7 @@ +ea55c5feda860c82b0b08256fb79b89a7b547f9b120de5bb67046aa782ea1e5d author.stdout +6e5bf255bf163de8b5cce81569945de6b155e9e3ec435156b3675779c8c77e5b controls-results.txt +efd6820f47fcfdd5ece92071ea61c25c059889c13929deefd2253528db642661 controls.json +1b0c987e66c2a43ede3dc1f6a6aa1ea70cf3cbd1660f824ed5b0a9a6b2e6a4e1 independent.stdout +5cf67eaf87b2d4982db1836e2ee68b2e2f81dfc7f4af11ad557181b296d7a54e projection.txt +cdf59667803618609f4d22e34e811852cb632db555a678e1a7eaa46d19d08196 receipt.json +bdc5afff8dad113e25ecf6e89dbc74929cf8b9b51342bb6dfba45faa96d96a7b review.txt diff --git a/evidence/w4-711/resident/author.stdout b/evidence/w4-711/resident/author.stdout new file mode 100644 index 00000000..8e9137ad --- /dev/null +++ b/evidence/w4-711/resident/author.stdout @@ -0,0 +1,2 @@ +8715 +0 diff --git a/evidence/w4-711/resident/controls-results.txt b/evidence/w4-711/resident/controls-results.txt new file mode 100644 index 00000000..d5846631 --- /dev/null +++ b/evidence/w4-711/resident/controls-results.txt @@ -0,0 +1,9 @@ +alignment compile=0 execute=1 +296271 +24564 +validation compile=0 execute=1 +296271 +280 +cleanup compile=0 execute=1 +296141 +139164 diff --git a/evidence/w4-711/resident/controls.json b/evidence/w4-711/resident/controls.json new file mode 100644 index 00000000..f37f8d15 --- /dev/null +++ b/evidence/w4-711/resident/controls.json @@ -0,0 +1,14 @@ +{ + "alignment": [ + "start = and add weights 4095 18446744073709547520", + "start = weights" + ], + "validation": [ + "if scale\n", + "if false\n" + ], + "cleanup": [ + "fn wabort status int to int\nif ne mapdrop get wstage 0 0\nret 74\nend", + "fn wabort status int to int" + ] +} \ No newline at end of file diff --git a/evidence/w4-711/resident/independent.stdout b/evidence/w4-711/resident/independent.stdout new file mode 100644 index 00000000..345f2f74 --- /dev/null +++ b/evidence/w4-711/resident/independent.stdout @@ -0,0 +1,2 @@ +296271 +0 diff --git a/evidence/w4-711/resident/projection.txt b/evidence/w4-711/resident/projection.txt new file mode 100644 index 00000000..6c028158 --- /dev/null +++ b/evidence/w4-711/resident/projection.txt @@ -0,0 +1,40 @@ +Executed real-projection load/readback, 2026-10-23 + +Build ordered units: + native/w4/resident.om + native/w4/review/resident-projection.om +Compile with the L788 mapping profile identified in receipt.json, into +projection.elf. Compiler exit0. Executable is handwritten Omega, emitted +by the seeded compiler without a foreign runtime. + +For each rule0,1,2, use existing full real projection outputs from the preceding +native tensor converter qualification. Verify their hashes against +../tensor/receipt.json before replay. Run with two raw-file paths: +quiet-build timeout30 projection.elf gate-R.w4 gate-R.e8 +The native program validates and loads17408x5120 values, closes both input +files, emits44564480 packed weight bytes followed by2785280 scale bytes, +then releases the owned memory mapping. Its budget is exactly47349760 bytes. +Compare its stdout with concatenated gate-R.w4 and gate-R.e8 using cmp. +Executed as a pipe with both producer and comparison statuses captured: +rule0: loader0 comparison0 +rule1: loader0 comparison0 +rule2: loader0 comparison0 + +The independent native resident suite was separately rebuilt by the parent +from the committed independent.om test unit and executed in a fresh private +directory:296271checks,0failures,exit0. Author8715checks also pass. Three +compiled sensitivity controls and isolated stale-handle exit103 are recorded +by independent review, not counted as model or GPU experiments. + +Earlier author test draft reported two failures: its file-length case had an +insufficient allocation budget (correctly refused earlier with75), and its +recovery fixture restored scale192 but expected180. Corrected those fixture +expectations/setup, added explicit maximum-scale192 acceptance, then froze +source before independent qualification. Earlier compilation exposed register +capacity; splitting budget/allocation helpers resolved it without compiler edits. + +These are actual host memory copies and lifecycle checks. There is no GPU +registration, launch, matrix computation, full-model inference or timing claim. +Input/output hashes retain the earlier model provenance. No model bytes or +binaries are committed. Repository preflight remains failed on the same base, +as recorded in ../preflight.txt; no gate waiver or automatic closure. diff --git a/evidence/w4-711/resident/receipt.json b/evidence/w4-711/resident/receipt.json new file mode 100644 index 00000000..df63b848 --- /dev/null +++ b/evidence/w4-711/resident/receipt.json @@ -0,0 +1,76 @@ +{ + "date": "2026-10-23", + "source_commit": "3a0ff5ce59ed1ba5df0d02ca48fffd27f120af53", + "source_sha256": "c08d54c939675a4beca757943ba9872480cc0bbff64c3d90c288027f73c92bd5", + "compiler": { + "repository": "aien-dev/omega-mv", + "functional": "d80b428c6ed9e3864fd7fc02cd7392bd4ad67f56", + "consumed_head": "7bc13ac26a99d47c7afec9d9f1e84a05cd904d45", + "pr": 676, + "state": "open draft, not merged", + "sha256": "1d1aad082539399920bc6c90ff41f0a0c3a1ca3225e518fd0d259e0aeb71732d" + }, + "binaries": { + "author": "6056c2aba7e8428caa0fc4ae8e694b8d12ce3e408ca727581fc8565919087dd5", + "independent": "582f72c50922f6ea7a110075a3005e3edfeaffa5230b0161536bd7a685ba852b", + "projection": "b0f4be684a4a56ce93e636d309c2d7371f991994ead05f965f266059272d14e0" + }, + "author_checks": 8715, + "independent_checks": 296271, + "failures": 0, + "independent_compiled_controls": 3, + "parent_rebuilt_independent": true, + "real_projection": { + "rows": 17408, + "columns": 5120, + "requested_mapping_bytes": 47349760, + "rules": [ + { + "rule": 0, + "weights_sha256": "61041e6e5fd0dd7e88694cff6153404a2c66830dbfb941773d2081018bf96e07", + "scales_sha256": "f598dce7944a0894cec7b7ddcd06f6147ca19c3d5a67d446f120c7b4b1fd68e6", + "loader_exit": 0, + "comparison_exit": 0 + }, + { + "rule": 1, + "weights_sha256": "7f7a34e5f8f721c5e8e937f3325f8713e861262fae85096281f224e1c7429d60", + "scales_sha256": "7b6d506799d45092bb63e8dbd97cfcfba66925f6dacf20730994d59ef64bebca", + "loader_exit": 0, + "comparison_exit": 0 + }, + { + "rule": 2, + "weights_sha256": "bc66e317ac69585242ba972e096e33a6e50afa35b14c593904cd87ccce9fac94", + "scales_sha256": "671deee797da983426ed802724d39579f37135cfd2b8e6cad163191c3b5d6260", + "loader_exit": 0, + "comparison_exit": 0 + } + ] + }, + "source_files": [ + { + "path": "native/w4/resident-test.om", + "sha256": "205a9fd5cc637ffbef2c0df37b52dcf990eb1a391f5aa690a4bd7a19d7d14f49" + }, + { + "path": "native/w4/resident.om", + "sha256": "c08d54c939675a4beca757943ba9872480cc0bbff64c3d90c288027f73c92bd5" + }, + { + "path": "native/w4/review/resident-independent.om", + "sha256": "3f1eb3639de28edc8c1a54536e836101b81dbca4fc72f34ad1098a7631dd3bf4" + }, + { + "path": "native/w4/review/resident-projection.om", + "sha256": "a3f4d9119f3ed95fe6b3e30a102a2415535d95441206bd71477e56103fc5f01c" + }, + { + "path": "native/w4/review/resident-stale.om", + "sha256": "4612067cc1b676e0d53a12fc19ac184a31ddeb6474f87728d04b861c179e9195" + } + ], + "gpu": false, + "full_model": false, + "repository_gate": "FAIL retained; no waiver" +} diff --git a/evidence/w4-711/resident/review.txt b/evidence/w4-711/resident/review.txt new file mode 100644 index 00000000..d13b1687 --- /dev/null +++ b/evidence/w4-711/resident/review.txt @@ -0,0 +1,95 @@ +Independent L791 native packed resident-loader review, 2026-10-23 +PASS: no blocking findings in the owned-handle lifecycle. Product unchanged. + +Identities +resident.om SHA256 c08d54c939675a4beca757943ba9872480cc0bbff64c3d90c288027f73c92bd5 +resident-test.om SHA256 205a9fd5cc637ffbef2c0df37b52dcf990eb1a391f5aa690a4bd7a19d7d14f49 +Live resident.om rehashed after tests, identical to frozen source. +Compiler /tmp/core711-resident/omc +SHA256 1d1aad082539399920bc6c90ff41f0a0c3a1ca3225e518fd0d259e0aeb71732d +Parent identifies L788 source d80b428c / PR676 head7bc13ac2 as GitHub-verified. + +Independent native tests +independent.om builds its own owned files and computes expected bytes +without calling loader helpers for expected layout. Rows529, cols512: +weights135424 bytes, padding3840, scales8464, scale offset139264, +total147728. Both weight and scale copies cross the8192-byte chunk boundary. +Weights follow (absolute_index*17+3)%256. Scales follow absolute_index%193, +covering every accepted scale including192. Every mapped image byte is +verified twice through wread: weights, zero padding, and scale bytes. +Final execution:296271 checks,0 failures, exit0. +Evidence: independent.om, all.om, test.elf, compile.log, test.stdout, results.txt. + +Coverage +- Empty read/drop lifecycle, repeated drop, zero-length endpoint read. +- Exact state dimensions, offset and byte count; busy-load refusal. +- Oversized read, endpoint overrun and maximum-unsigned offset refusal. +- Zero budget, budget above64GiB, one-byte-short budget, exact budget. +- Negative, huge invalid, equal and closed file descriptors. +- Incorrect weight lengths, empty weight/scale files and trailing scale byte. +- Actual128-slot mapping table exhaustion through real anonymous allocations. + Loader returns75 without publishing state. Freeing one slot permits load; + dropping all retained maps restores normal allocation. +-140 consecutive failures on scale193 in the final scale byte, beyond the + first8192-byte scale chunk. Each returns76 with empty published and staged + state. A second actual table-capacity test proves no mapping-slot leak. +- Full successful reload and whole-image verification after failure series. +- All test-owned descriptors close and source files are removed. + +Stale handle behavior +Separate stale.om allocates, drops, then directly mapreads its retired +handle. Runtime exits103 fail-closed. It does not return a normal negative +mapread result. This is intentionally isolated from the main passing suite. +An earlier draft expected a returned error and stopped103; that run is not +counted as passing evidence. Public wread after wdrop returns73 without +calling runtime on the retired handle, and passes in the main suite. +Callers must preserve the loader's ownership of its mapping handle; direct +out-of-band mapdrop of wstate is outside the tested owned-handle lifecycle. + +Compiled sensitivity controls +All three mutations compile successfully and execute exit1: +1. Unaligned scale start set directly to weights:24564 failures/296271 checks. +2. Scale validation skipped:280 failures/296271 checks. +3. wabort mapdrop removed:139164 failures/296141 checks. Lower check count + follows actual leaked capacity in the capacity-dependent cleanup loop. +Exact edits:controls.json. Per-control .om,.elf,.log,.stdout and aggregate +controls-results.txt retain evidence. Controls use the final native suite. + +Resource/error-path review +Dimension checks precede multiplication; maximum rows*cols=2^33, weight +bytes2^32 and scale bytes2^28, safely within unsigned64-bit calculations. +4KiB round-up cannot overflow under these limits. Budget is explicitly +required and checked before source-size checks or allocation. Source-size +checks rewind accepted files. Copy loops bound chunks to8192 and handle +short reads; trailing-byte probes refuse growing sources. Scale validation +precedes writing its chunk to the private map. Stage handle is published +only after both complete copies pass, and every copy refusal calls wabort. +Map allocation failure leaves both stage and public state empty. wdrop +retire/clear behavior and mapping-table recovery were exercised directly. +The loader borrows input descriptors and leaves closing to its caller. +It does not mutate the source files. wbuffer is scratch state on failures. + +Reproduction commands +Working directory /tmp/core711-review/resident: + cat resident.om independent.om > all.om + /tmp/core711-resident/omc < all.om > test.elf 2> compile.log + chmod 700 test.elf + mkdir -p fresh-run + (cd fresh-run && ../test.elf) > test.stdout +Use a fresh directory: test files are exclusive creations. Each mutation +is its changed resident source concatenated with independent.om, compiled +and executed by the same sequence in its own fresh directory. + /tmp/core711-resident/omc < stale.om > stale.elf 2> stale.log + chmod 700 stale.elf + ./stale.elf +Expected stale exit103. SHA256SUMS identifies retained test artifacts. + +Limits +Host anonymous-memory loading only. No GPU, device upload, matrix launch, +full-model resident claim, inference-speed measurement, or model accuracy. +Parent owns the full-projection comparison; not counted in this review. +No runtime/compiler edits, product edits, live-service or GitHub changes. +No injected mid-read OS failure, mapping-write failure, unmap OS failure, +concurrent source-file mutation or partial read. Those paths source-reviewed. +This validates bytes and loader lifetime; it does not establish accelerator +pointer/layout compatibility or production model integration. diff --git a/evidence/w4-711/review.txt b/evidence/w4-711/review.txt new file mode 100644 index 00000000..d0adc3c1 --- /dev/null +++ b/evidence/w4-711/review.txt @@ -0,0 +1,85 @@ +Independent Core #711 native W4 review +Date: 2026-10-23 +Reviewer: /root/w4_validation + +Scope and source identity +Reviewed immutable copies of native/w4/pack.om and stream.om from +/home/drakestapleton/workspace/sc-native-w4-711. +Live product hashes rechecked after testing, unchanged: +pack.om 724fc1476a29655a087b7385e7a7a47410028ea0ede9dcfd84e39a6dab5e16db +tests.om 2b6f2aa739d73bd502ae6873624458d522a5415c5ff4bcae9fcb5b2bb21a7ab5 +stream.om 4383e5183c3c2ca9e64231a9615c1a61baba5239daaddb4fd8aebc19ac3deeff +Compiler: /home/drakestapleton/workspace/cudapp-adaptive-27b/build/speculation/toolchain/build/bootstrap/omc +Compiler SHA256: 191b776ef98821597c3e30655da6d680a9b66edbc9ceaca3c39c61ea6df098e9 +Original contract read from omega-speed3-w4gemv/src/omega_gpu_w4_api.c +and omega_blackwell_codegen_w4.h, parent-confirmed remote revision +8655007f0f09d454b47b75fb3d83bc80e8f6d4da. +No product files edited. No GPU, GitHub, service, or shared compiler changes. + +Independent native oracle +probes.om enumerates nearest absolute distance across all eight E2M1 +magnitudes with even-code tie breaking. Expected results do not use the +product midpoint expression or its qround/qgrid/qtrial helpers. +Native build and execution pass: 4,381,347 checks, zero failures, exit 0. +Evidence: probes.om, all.om, compile.log, probes.elf, probes.stdout. +Coverage includes all 65,536 BF16 encodings with mixed signed FP8 groups +under OCP/FIT/BEST; negative and subnormal BF16 scales; positive and negative +zero; scale underflow/overflow refusals; finite and nonfinite scales; +NaN in each of 32 input positions; small integer lattice powers 0..11 and +values 0..4095; large exact midpoint ties and adjacent integers at powers +0..22; packed low-nibble-first order; status, output, and metadata. + +Compiled sensitivity controls +Three product mutations compiled successfully and were detected by this +same independent oracle, each returning exit 1: +- Inverted tie parity: 5,899 failed checks. +- Inverted BEST error comparison: 263,995 failed checks. +- Swapped packed nibble order: 1,867,304 failed checks. +Exact edits and results: controls.json. Per-control source, binary, +compilation log, and stdout are retained. +Earlier unsuccessful authoring builds of the independent test were not +counted as execution evidence or as successful controls. + +Stream checks +fixture.om and reply.om are separate native request generator and response +verifier. Across 128 requests, independently verified exact 20-byte replies +for positive scale, negative scale, zero group, and NaN rejection, cycling +all three policies. Total input 4,480 bytes and output 2,560 bytes. +A bytewise native producer passed, then explicit split delivery demonstrated +an actual one-byte read followed by a 34-byte read (split.trace). Both +stream and independent verifier returned 0. +EOF on empty input: exit 0, no output. +Truncated 34-byte request: exit 65, no output. +Closed input descriptor: exit 74, no output. +Closed output descriptor: exit 74. +Evidence: stream-results.txt, fixture.om, reply.om, stream-all.om, +requests.bin, replies.bin, split.trace, split.reply, individual build logs. +Partial-output retries were reviewed in source but not fault-injected. +A closed output descriptor verifies returned write errors, not SIGPIPE: +a broken pipe may terminate by signal before the write error is handled. +The implementation treats interrupted reads/writes as errors rather than +retrying them. This is consistent with its fail-on-I/O-error diagnostic scope. + +Arithmetic bound review +Finite E4M3FN magnitude decoded in units of 1/512 is at most 229376. +Multiplication by a finite BF16 mantissa at most 255 yields raw <=58490880, +strictly below 2^26. Thus base power <=25 and raised power <=26. +Rounding midpoint and scaled raw comparisons fit well within unsigned 64 bits. +For base power p, raw lies below 2^(p+1), so reconstruction target raw*8 +lies below 16*2^p. The final grid point is 12*2^p. Saturation error is +less than 4*2^p; unsaturated nearest error is at most 2*2^p. +At p<=25 this makes each error less than 2^27. +For the raised trial, original maximum is below 8*2^p, so its nearest error +is at most 2^p with p<=26, also below 2^27. +Each squared error is below 2^54; 32 terms total below 2^59. No overflow in +the 64-bit sum or products. Scale arithmetic is bounded before output. + +Findings and limits +No blocking converter or stream defects found for the documented diagnostic +group contract. There are no requested product fixes from this review. +This review does not claim GPU execution, inference speed, full-checkpoint +conversion, model loading, model accuracy, or production integration. +The oracle validates the inspected mathematical contract independently; +this review did not execute a legacy C converter differential comparison. +Parent author's 1,219,868 checks are separate and are not included in the +independent 4,381,347 count. diff --git a/evidence/w4-711/tensor/SHA256SUMS b/evidence/w4-711/tensor/SHA256SUMS new file mode 100644 index 00000000..b247f268 --- /dev/null +++ b/evidence/w4-711/tensor/SHA256SUMS @@ -0,0 +1,10 @@ +e6f95bc7f0320bcce032d6bb6a1c382c7ac21eaa4b93260b720418ee8f98420b author.stdout +a62c9daefd11ac22cc8d7577d771e049f6e4f83b422bb49c0f64ccbacaae6ea4 checks.txt +352bdb6c8d042e429987033bdc527ea62992efb9522fbd3275b8876c2303500c development-commands.txt +f26a45827d92f4937b5aacf40b0a855886d6c49ea5dd7d5d75fd290e0bdfe5e0 differential.txt +9eaee2715e0c4c6b5536938a1ccccde6971fa01b8381903dc741326a3b218530 extra-checks.txt +c58a217be99b85042ca8441000ee265f5aa38af1ed12e32c6b91c2844c81cb95 independent.stdout +1de1cc46672619e7469e7ac6d34b1e5e4dd599da8f891247989a9b6b3ac67586 model-source.json +5742e0a93a6f7ee16091cac7686d0d053341d8f3c3c61157ecc63e6596828876 mutant.txt +ff6f6667d83c0781bcf30cbb4cf737f7425a4cc5b0496c4ddf74282fb063fe73 receipt.json +230a489ac6d913bd889fe28be53d0f10cafdebc75ea86646fbd1bb28753b7bbb review.txt diff --git a/evidence/w4-711/tensor/author.stdout b/evidence/w4-711/tensor/author.stdout new file mode 100644 index 00000000..576662ed --- /dev/null +++ b/evidence/w4-711/tensor/author.stdout @@ -0,0 +1,2 @@ +1219868 +0 diff --git a/evidence/w4-711/tensor/checks.txt b/evidence/w4-711/tensor/checks.txt new file mode 100644 index 00000000..d5c30fa8 --- /dev/null +++ b/evidence/w4-711/tensor/checks.txt @@ -0,0 +1,47 @@ +w4-rule0 expected=0 actual=0 +e8-rule0 expected=0 actual=0 +w4-rule1 expected=0 actual=0 +e8-rule1 expected=0 actual=0 +w4-rule2 expected=0 actual=0 +e8-rule2 expected=0 actual=0 +argc expected=64 actual=64 +rows-0 expected=65 actual=65 +rows-1 expected=65 actual=65 +rows-127 expected=65 actual=65 +rows-129 expected=65 actual=65 +rows-524416 expected=65 actual=65 +width-0 expected=65 actual=65 +width-1 expected=65 actual=65 +width-127 expected=65 actual=65 +width-129 expected=65 actual=65 +width-32896 expected=65 actual=65 +number--128 expected=64 actual=64 +number-+128 expected=64 actual=64 +number-1a expected=64 actual=64 +number-99999999999 expected=64 actual=64 +number- expected=64 actual=64 +policy expected=69 actual=69 +missing expected=74 actual=74 +short.fp8 expected=65 actual=65 +long.fp8 expected=65 actual=65 +short.bf16 expected=65 actual=65 +long.bf16 expected=65 actual=65 +no-bad-w4 expected=0 actual=0 +no-bad-e8 expected=0 actual=0 +late-nan expected=76 actual=76 +cleanup-late-w4 expected=0 actual=0 +cleanup-late-e8 expected=0 actual=0 +existing-first expected=74 actual=74 +preserved-first expected=0 actual=0 +no-new-e8 expected=0 actual=0 +existing-second expected=74 actual=74 +cleanup-new-w4 expected=0 actual=0 +preserved-second expected=0 actual=0 +same-path expected=74 actual=74 +cleanup-same expected=0 actual=0 +input-output-alias expected=74 actual=74 +preserved-input expected=0 actual=0 +subsequent-success expected=0 actual=0 +subsequent-w4 expected=0 actual=0 +subsequent-e8 expected=0 actual=0 +checks=46 failures=0 diff --git a/evidence/w4-711/tensor/development-commands.txt b/evidence/w4-711/tensor/development-commands.txt new file mode 100644 index 00000000..68af8384 --- /dev/null +++ b/evidence/w4-711/tensor/development-commands.txt @@ -0,0 +1,49 @@ +#!/bin/bash +checks=0 +failures=0 +check() { + local name=$1 expected=$2 + shift 2 + "$@" > /dev/null 2>&1 + local actual=$? + checks=$((checks+1)) + if [ "$actual" -ne "$expected" ]; then failures=$((failures+1)); fi + printf '%s expected=%s actual=%s\n' "$name" "$expected" "$actual" +} +for rule in 0 1 2; do +check "w4-rule$rule" 0 cmp expected.w4 "rule$rule.w4" +check "e8-rule$rule" 0 cmp expected.e8 "rule$rule.e8" +done +check argc 64 ./tensor.elf +for n in 0 1 127 129 524416; do check "rows-$n" 65 ./tensor.elf input.fp8 scales.bf16 bad.w4 bad.e8 "$n" 256 0; done +for k in 0 1 127 129 32896; do check "width-$k" 65 ./tensor.elf input.fp8 scales.bf16 bad.w4 bad.e8 256 "$k" 0; done +for n in -128 +128 1a 99999999999 ''; do check "number-$n" 64 ./tensor.elf input.fp8 scales.bf16 bad.w4 bad.e8 "$n" 256 0; done +check policy 69 ./tensor.elf input.fp8 scales.bf16 bad.w4 bad.e8 256 256 3 +check missing 74 ./tensor.elf missing.fp8 scales.bf16 bad.w4 bad.e8 256 256 0 +head -c 65535 input.fp8 > short.fp8 +{ cat input.fp8; head -c 1 input.fp8; } > long.fp8 +head -c 7 scales.bf16 > short.bf16 +{ cat scales.bf16; head -c 1 scales.bf16; } > long.bf16 +for input in short.fp8 long.fp8; do check "$input" 65 ./tensor.elf "$input" scales.bf16 bad.w4 bad.e8 256 256 0; done +for scale in short.bf16 long.bf16; do check "$scale" 65 ./tensor.elf input.fp8 "$scale" bad.w4 bad.e8 256 256 0; done +check no-bad-w4 0 test ! -e bad.w4 +check no-bad-e8 0 test ! -e bad.e8 +check late-nan 76 ./tensor.elf late-nan.fp8 scales.bf16 late.w4 late.e8 256 256 0 +check cleanup-late-w4 0 test ! -e late.w4 +check cleanup-late-e8 0 test ! -e late.e8 +check existing-first 74 ./tensor.elf input.fp8 scales.bf16 rule0.w4 new.e8 256 256 0 +check preserved-first 0 cmp expected.w4 rule0.w4 +check no-new-e8 0 test ! -e new.e8 +check existing-second 74 ./tensor.elf input.fp8 scales.bf16 new.w4 rule0.e8 256 256 0 +check cleanup-new-w4 0 test ! -e new.w4 +check preserved-second 0 cmp expected.e8 rule0.e8 +check same-path 74 ./tensor.elf input.fp8 scales.bf16 same.out same.out 256 256 0 +check cleanup-same 0 test ! -e same.out +check input-output-alias 74 ./tensor.elf input.fp8 scales.bf16 input.fp8 alias.e8 256 256 0 +./fixture.elf 0 > input-check.fp8 +check preserved-input 0 cmp input.fp8 input-check.fp8 +check subsequent-success 0 ./tensor.elf input.fp8 scales.bf16 final.w4 final.e8 256 256 2 +check subsequent-w4 0 cmp expected.w4 final.w4 +check subsequent-e8 0 cmp expected.e8 final.e8 +printf 'checks=%s failures=%s\n' "$checks" "$failures" +test "$failures" -eq 0 diff --git a/evidence/w4-711/tensor/differential.txt b/evidence/w4-711/tensor/differential.txt new file mode 100644 index 00000000..b9242026 --- /dev/null +++ b/evidence/w4-711/tensor/differential.txt @@ -0,0 +1,46 @@ +Full real-tensor differential, 2026-10-23 + +Source: same pinned model/checkpoint as parent differential.txt. +Tensor: model.language_model.layers.0.mlp.gate_proj.weight, [17408,5120]. +Contiguous weight bytes 89128960; BF16 scale bytes10880, shape[136,40]. +Full tensor identities in model-source.json. No model data is committed. +Development Node extraction copied declared contiguous byte ranges directly, +using a fixed1MiB buffer, without quantization or layout computation. + +Native build: +cat native/w4/pack.om native/w4/tensor.om > tensor.om +quiet-build timeout30 < tensor.om > tensor.elf +Actual compiler exit0. Compiler SHA e5d60db8... recorded fully in receipt.json. +Native invocation for each rule0,1,2, with fresh exclusive output paths: +quiet-build timeout180 tensor.elf gate.weights gate.scales gate-R.w4 gate-R.e8 17408 5120 R +All actual exits0; no timing claim is made from development timeout commands. +Outputs per rule: W4 44564480bytes; E8 2785280bytes. Total47349760bytes. + +Existing reference binary/source/physics pins are unchanged from the original +small-block differential. GDB stopped its own reference child at main before +running tests. Allocations: weights89128960bytes, BF16scales10880bytes, +W4output44564480bytes, E8output2785280bytes. Raw files restored to input buffers. +Called explicitly typed omega_gpu_w4_from_fp8_rule: + (17408,5120,weights,scales,0,17408,rule,output,e8,0) +for each rule0,1,2. All three return0. Dumped full output buffers. +GDB process exit0. Existing reference is a C development oracle only; +there is no C dependency in the delivered native tensor executable. + +Six independent full-file cmp operations returned0: each native W4 and E8 +file against its respective reference output for all three rules. +SHA256 values and tool/source/binary hashes are in receipt.json. +The author's1219868-check and independent4381347-check arithmetic suites were +recompiled with this native-host compiler, executed, and passed with0failures. +Parent also rebuilt the independent256x256 fixture, repeated all three native +conversions, and compared all six files successfully. The independent reviewer +separately tested refusal/cleanup/layout and a compiling wrong-scale mutant. + +Exploratory compilation refusals before final source freeze: reserved word +own, omitted array lengths, passing a global as array argument, and compiler +register capacity. Corrected within caller code; shared compiler unchanged. +None is counted as a passing mutation or execution. + +NOT_RUN: GPU, whole-model inference/quality/latency, physical allocator, +checkpoint parsing/identity admission, crash recovery, injected disk-full or +close/sync failures. Native outputs require successful exit before consumption. +Repository preflight remains failed as recorded in ../preflight.txt. diff --git a/evidence/w4-711/tensor/extra-checks.txt b/evidence/w4-711/tensor/extra-checks.txt new file mode 100644 index 00000000..6ecab905 --- /dev/null +++ b/evidence/w4-711/tensor/extra-checks.txt @@ -0,0 +1,2 @@ +late_inf_status=76 +late_inf_cleanup=0 diff --git a/evidence/w4-711/tensor/independent.stdout b/evidence/w4-711/tensor/independent.stdout new file mode 100644 index 00000000..e82f78a2 --- /dev/null +++ b/evidence/w4-711/tensor/independent.stdout @@ -0,0 +1,2 @@ +4381347 +0 diff --git a/evidence/w4-711/tensor/model-source.json b/evidence/w4-711/tensor/model-source.json new file mode 100644 index 00000000..3a1e1f1a --- /dev/null +++ b/evidence/w4-711/tensor/model-source.json @@ -0,0 +1,35 @@ +{ + "source_file": "layers-0.safetensors", + "model_revision": "017b9c7af6b5689d5dd426a76e0bc077eb5ca20a", + "header_sha256": "f10e6204808d68452bb2b9584988d965ee3dea86aa04fa21c7e2a12df9641736", + "tensors": [ + { + "name": "model.language_model.layers.0.mlp.gate_proj.weight", + "dtype": "F8_E4M3", + "shape": [ + 17408, + 5120 + ], + "data_offsets": [ + 205604928, + 294733888 + ], + "bytes": 89128960, + "sha256": "4329138e685449fc21213af99925fde5d655c9242023b06073098a3636056155" + }, + { + "name": "model.language_model.layers.0.mlp.gate_proj.weight_scale_inv", + "dtype": "BF16", + "shape": [ + 136, + 40 + ], + "data_offsets": [ + 1100608, + 1111488 + ], + "bytes": 10880, + "sha256": "61495ba505545f7c426e4d42262e7f3d3c8bcf498b67210487372778110d71d5" + } + ] +} diff --git a/evidence/w4-711/tensor/mutant.txt b/evidence/w4-711/tensor/mutant.txt new file mode 100644 index 00000000..0083697a --- /dev/null +++ b/evidence/w4-711/tensor/mutant.txt @@ -0,0 +1,3 @@ +mutant_conversion=0 +mutant_w4_comparison=1 +mutant_e8_comparison=1 diff --git a/evidence/w4-711/tensor/receipt.json b/evidence/w4-711/tensor/receipt.json new file mode 100644 index 00000000..b1273168 --- /dev/null +++ b/evidence/w4-711/tensor/receipt.json @@ -0,0 +1,61 @@ +{ + "date": "2026-10-23", + "source_commit": "9af15b12fc1d1451b001065bd83f64e391c86cf2", + "compiler_source": "aien-dev/omega-mv@f0499f415571bdd7496b6de391096915e78f7556", + "compiler_sha256": "e5d60db892c8f21cc8c9128af26d8bded0e96d7f92946f5a549397c43a872649", + "tensor_source_sha256": "f6d0bfd5a3683c52db869a00604384f5356b20c7ffb96d474e2529dd4f6f0920", + "pack_source_sha256": "724fc1476a29655a087b7385e7a7a47410028ea0ede9dcfd84e39a6dab5e16db", + "native_binary_sha256": "2a27af3f35946c538b7760255be892a05b28175175849b167e66dafaa022d1b3", + "reference_binary_sha256": "ca45e2a8d7ad6fefeae2f8ea175ffcf5e9e67865e458a1511942bf83d8750155", + "reference_source": "aien-dev/omega-mv@8655007f0f09d454b47b75fb3d83bc80e8f6d4da", + "physics_source": "6d7cf0d4d8eb2cda7b512100ff6058e25dbb3ddf", + "rows": 17408, + "columns": 5120, + "rules": [ + { + "rule": 0, + "native_exit": 0, + "reference_return": 0, + "weights_cmp_exit": 0, + "scales_cmp_exit": 0, + "packed_bytes": 44564480, + "scale_bytes": 2785280, + "packed_sha256": "61041e6e5fd0dd7e88694cff6153404a2c66830dbfb941773d2081018bf96e07", + "scale_sha256": "f598dce7944a0894cec7b7ddcd06f6147ca19c3d5a67d446f120c7b4b1fd68e6" + }, + { + "rule": 1, + "native_exit": 0, + "reference_return": 0, + "weights_cmp_exit": 0, + "scales_cmp_exit": 0, + "packed_bytes": 44564480, + "scale_bytes": 2785280, + "packed_sha256": "7f7a34e5f8f721c5e8e937f3325f8713e861262fae85096281f224e1c7429d60", + "scale_sha256": "7b6d506799d45092bb63e8dbd97cfcfba66925f6dacf20730994d59ef64bebca" + }, + { + "rule": 2, + "native_exit": 0, + "reference_return": 0, + "weights_cmp_exit": 0, + "scales_cmp_exit": 0, + "packed_bytes": 44564480, + "scale_bytes": 2785280, + "packed_sha256": "bc66e317ac69585242ba972e096e33a6e50afa35b14c593904cd87ccce9fac94", + "scale_sha256": "671deee797da983426ed802724d39579f37135cfd2b8e6cad163191c3b5d6260" + } + ], + "independent_file_assertions": 46, + "independent_late_scale_cleanup": true, + "compiled_wrong_scale_mutant_detected": true, + "parent_replayed_fixture": true, + "host_profile_arithmetic_checks": [ + 1219868, + 4381347 + ], + "gpu": false, + "full_model": false, + "repository_gate": "FAIL retained; no waiver", + "publication": "review only" +} diff --git a/evidence/w4-711/tensor/review.txt b/evidence/w4-711/tensor/review.txt new file mode 100644 index 00000000..4e52453b --- /dev/null +++ b/evidence/w4-711/tensor/review.txt @@ -0,0 +1,92 @@ +Independent L791 raw tensor qualification, 2026-10-23 +PASS, no blocking findings. No product files edited. + +Source identities +pack.om SHA256 724fc1476a29655a087b7385e7a7a47410028ea0ede9dcfd84e39a6dab5e16db +tensor.om SHA256 f6d0bfd5a3683c52db869a00604384f5356b20c7ffb96d474e2529dd4f6f0920 +Live tensor source rehashed after tests, identical to frozen copy. +Compiler /home/drakestapleton/workspace/cudapp-adaptive-27b/build/speculation/toolchain-host/seed/out/omc +Compiler verified SHA256 e5d60db892c8f21cc8c9128af26d8bded0e96d7f92946f5a549397c43a872649 +Parent identifies its pinned Omega revision as f0499f415571bdd7496b6de391096915e78f7556. + +Native independent fixture +fixture.om generates a 256x256 FP8 tensor of alternating signed ones, +with row parity flipping the signs. Scale grid is [[1,-2],[4,-8]], encoded +as raw little-endian BF16. This crosses both row128 and column128 scale +boundaries. It independently generates expected packed and E8 bytes using +known E2M1 magnitude6, sign placement and exponent125+scale power. +No qpack, qgrid, qround, or product implementation is called for expectations. +Sizes: FP8 65536, BF16 8, W4 32768, E8 2048 bytes. +All three policies return0 and byte-match both complete expected files. +This fixture intentionally has identical numerical outcomes under the +three policies; it verifies policy acceptance and full transport/layout. +Distinct OCP/FIT/BEST rounding behavior is covered by the preceding +independent 4381347-check packer review at the unchanged pack.om hash. + +46 assertions in results.txt all pass, covering: +- Six full-file output comparisons across the three policies. +- Missing arguments; zero, misaligned, and excessive dimensions. +- Negative, signed-plus, nonnumeric, oversized and empty numeric arguments. +- Unsupported policy and missing input. +- Truncated and trailing bytes in each input file. +- No created output on setup refusal. +- NaN in final element of final row returns76 and removes both outputs. +- Existing first output preserved and second not created. +- Existing second output preserved and newly created first removed. +- Identical output paths return74 and remove newly created file. +- Input/output alias refused with original input byte-for-byte preserved. +- Subsequent clean conversion succeeds and both outputs remain exact. +Additional native scale-fixture.om emits infinity in the final BF16 scale +cell: conversion returns76 and both outputs are removed. extra-results.txt. + +Compiled mutation sensitivity +Changed only sindex = mul div group 4 2 to sindex = ulong 0 in a private +copy, forcing every column block to use the first scale. Mutant compiles, +executes with status0, and both whole-file expected output comparisons +reject it (comparison status1). mutant-results.txt and diff files retain +evidence. Product source was unchanged. + +Resource/error-path review +Maximum row width32768 fits inrow32768. Scale row size512 fits scrow512. +Packed row16384 fits outrow16384; E8 row1024 fits erow1024. Group scale +index ranges0..510 plus its second byte. Maximum n*k=17179869184 fits +64-bit size arithmetic. Numeric input is at most10 digits, below64-bit +limits. Dimensions and exact input sizes are checked before output creation. +Exclusive output creation prevents truncating existing files. fds start +at -1, each successful open is recorded immediately, and finish closes +all recorded descriptors. made tracks only successfully created outputs, +so error cleanup targets owned files. Second-output failure also removes +the first new output, including identical output path handling. +Rows flush fully through write loops. fsync applies to both outputs before +success; close, fsync, returned read/write and unlink errors propagate. +Scale rows are read every128 tensor rows; input scratch is copied to scrow +before the next FP8 row overwrites inrow. Source EOF is rechecked at end. + +Commands and reproducibility +From /tmp/core711-review/tensor: + cat pack.om tensor.om > all.om + "$compiler_path" < all.om > tensor.elf 2> tensor.log + "$compiler_path" < fixture.om > fixture.elf 2> fixture.log + chmod 700 tensor.elf fixture.elf + ./fixture.elf 0 > input.fp8 + ./fixture.elf 1 > scales.bf16 + ./fixture.elf 2 > expected.w4 + ./fixture.elf 3 > expected.e8 + ./fixture.elf 4 > late-nan.fp8 + ./tensor.elf input.fp8 scales.bf16 rule0.w4 rule0.e8 256 256 0 +Repeat the last command with unique output names and rule1/rule2. +run.sh contains the exact remaining invocation/status/file assertions. +Mutant compiler and invocation use mutant-all.om and mutant.elf with the +same compiler. Existing output paths must be fresh for re-execution. +All newly authored computational fixtures and expected-byte generation are +.om; shell performs development orchestration and standard file comparisons. + +Limits +No GPU, live services, desk, GitHub, or shared compiler changes. +No real-model accuracy or performance claim. Parent owns the real-weight +reference comparison; it is not counted as this review's evidence. +No injected disk-full, fsync failure, close failure, unlink failure, or +partial-write condition. Those branches received source review only. +Concurrent replacement/mutation of input or output files was not tested. +No claim of atomic pair publication or crash recovery: files are exclusive +and cleanup is implemented for returned failures, not process termination. diff --git a/native/w4/README.md b/native/w4/README.md new file mode 100644 index 00000000..b48e61c4 --- /dev/null +++ b/native/w4/README.md @@ -0,0 +1,270 @@ +# Native packed W4 group converter + +Partial implementation for core issue #711. This handwritten seeded Omega +module migrates the existing `speed3/w4-gemv` converter's OCP, FIT and BEST +rules. It does not implement a GPU kernel, checkpoint reader or model runner. +No inference speed or full-model quality claim is made. + +## Contract + +`qpack(scale, rule)` consumes 32 E4M3FN bytes in `qinput`, a BF16 scale +represented by its unsigned 16-bit encoding, and rule 0 (OCP), 1 (FIT) or +2 (BEST). It produces 16 bytes in `qoutput`: even inputs occupy the low +nibble, odd inputs the high nibble. E2M1 magnitudes are +0, 0.5, 1, 1.5, 2, 3, 4, 6; bit 3 carries the sign. Zero has canonical +positive sign. Ties select the even magnitude code. + +OCP chooses X = 2^(floor(log2(maximum absolute scaled input)) - 2). +FIT doubles X if the OCP group clips any magnitude above 6X. BEST tries +that same doubled scale only when clipping occurs and selects it only +when exact squared error is strictly lower. Equal errors keep OCP. +All-zero groups produce zero bytes and E8M0 scale 127. The supported +E8M0 output range is 0..192, matching the existing device implementation. + +The five `qmeta` words are: valid, E8M0 scale, all-zero flag, clipped +count, and squared error in the internal integer units. Public outputs +and metadata are cleared before every call, including refusals. Status +0 means success; 65 means scale input exceeds 16 bits; 69 means unsupported +rule; 75 means unrepresentable output scale; 76 means nonfinite input. +E4M3FN encodings 0x7f and 0xff and all BF16 exponent-255 scales are refused. +Finite negative, zero and subnormal BF16 scales are supported. + +Arithmetic is exact unsigned 64-bit integer arithmetic. The raw magnitude +is the FP8 magnitude in units of 1/512 multiplied by the BF16 significand. +Its maximum is 58,490,880. The actual value is raw times 2^(bexp-143) +for a normal BF16 scale, or raw times 2^-142 for a subnormal scale. +Squared error sums differences in eight-times-raw units; multiply by +2^(2*(bexp-146)), or 2^-290 for subnormals, to obtain physical squared +error. This diagnostic is not comparable across differently scaled groups +without that conversion. Reviewed bounds keep each 32-element sum below +2^59. Global scratch arrays make the module nonreentrant: callers must +serialize calls or use separate instances. + +## Diagnostic transport + +Concatenate `pack.om` with `stream.om` to build a bounded binary adapter. +Each request is 35 bytes: rule u8, BF16 scale u16 little-endian, then 32 +FP8 bytes. Each response is 20 bytes: status u8, E8M0 u8, 16 packed bytes, +clipped count u8, all-zero flag u8. A rejected group emits a status with +cleared remaining fields and does not prevent later groups succeeding. + +At most 512 records are buffered. Short reads and returned short writes +are handled; EOF after complete records returns 0, incomplete final +records return 65 after previously completed responses. Returned I/O +errors or zero writes return 74. Interrupted calls are treated as errors; +broken-pipe signals can terminate the process. Short-write retries were +source-reviewed, not fault-injected. The transport supplies no model +identity, checkpoint validation or concurrency protection. + +## Build and check + +Use the reconstructed seeded `omc` executable with SHA256 +`191b776ef98821597c3e30655da6d680a9b66edbc9ceaca3c39c61ea6df098e9` +(omega-bridge source `0fc7d8662cb799e7c206b17c18ea4c3ec2b8fea9`, seed +Omega `29b12760`), on the qualified AArch64 host. Set `OMC` to that executable. +Development shell commands concatenate native source and invoke the compiler: + +```sh +cat native/w4/pack.om native/w4/tests.om > /tmp/w4-tests.om +"$OMC" < /tmp/w4-tests.om > /tmp/w4-tests +chmod 700 /tmp/w4-tests +/tmp/w4-tests +cat native/w4/pack.om native/w4/review/probes.om > /tmp/w4-independent.om +"$OMC" < /tmp/w4-independent.om > /tmp/w4-independent +chmod 700 /tmp/w4-independent +/tmp/w4-independent +``` + +Require compilation success before executing an output. Author checks +report 1,219,868 and zero failures. The separate nearest-distance oracle +reports 4,381,347 and zero failures. Compiled intentional defects verify +that the tests detect tie, nibble, exponent, BEST and nonfinite mistakes. +The independent oracle covers every BF16 encoding and exact rounding +boundaries. `review/fixture.om` and `review/reply.om` independently generate +and verify 1,536 transport records. Their entry points must be compiled +separately, not appended to the other test entry points. + +Top-level `fixture.om` and `reply.om` are different, test-only tools for the +real-weight differential: the former repeats one three-byte rule/scale +header across raw 32-byte input groups; the latter accepts exactly 512 +successful replies and writes 8,192 packed bytes followed by 512 scales. +Neither is a production checkpoint reader. + +## Existing implementation and evidence + +The reference is `aien-dev/omega-mv` branch `speed3/w4-gemv`, commit +`8655007f0f09d454b47b75fb3d83bc80e8f6d4da`, specifically +`src/omega_gpu_w4_api.c` and `src/omega_blackwell_codegen_w4.h`. +Its physics dependency was built at the locked commit +`6d7cf0d4d8eb2cda7b512100ff6058e25dbb3ddf`. That existing C implementation +is a development reference only, not a dependency of these native binaries. +Historical GPU results on that branch are not new qualification evidence. + +See `evidence/w4-711/` for recorded source identities, raw check results, +review reports, controls and the exact real-model sample differential. +The real checkpoint sample agrees byte-for-byte for all three rules. +Model data and generated binaries are not included in this repository. +Repository preflight remains failed on the same base due to the existing +browser screenshot test and dependency advisories recorded by L790. + +Remaining issue acceptance includes a native device path and model loading, +whole-checkpoint layout and quality validation, safe serving attachment, +and uncontended full-model latency/throughput/memory measurements. The +issue must remain open until those requirements are met. + +## Whole raw-tensor conversion + +`pack.om` plus `tensor.om` forms a native file converter. This entry point uses +the separately qualified native-host compiler at Omega +`f0499f415571bdd7496b6de391096915e78f7556`, executable SHA256 +`e5d60db892c8f21cc8c9128af26d8bded0e96d7f92946f5a549397c43a872649`. +The author and independent arithmetic suites were rebuilt and passed under +this compiler too. It is a different profile from the earlier pure compiler; +no unsupported combination of compiler features is assumed. + +```text +w4-tensor raw-fp8 raw-bf16 packed-output e8-output rows columns rule +``` + +Arguments are unsigned decimal integers without signs, whitespace or prefixes. +Rows must be a positive multiple of 128, at most 524,288. Columns must be a +positive multiple of 128, at most 32,768. Rule is 0, 1 or 2. A width accepted +by this converter is not necessarily accepted by a particular device kernel. + +Input weights are exactly rows*columns contiguous E4M3FN bytes, row major. +The scale file contains exactly (rows/128)*(columns/128) little-endian BF16 +values, row major. The source scale for element (r,c) is +scale[r/128][c/128]. Outputs are rows*columns/2 packed bytes and +rows*columns/32 E8M0 scale bytes, each row major, identical to the historical +converter's separate output arrays. This is MXFP4, with one E8M0 scale per +32 values. It is not NVFP4 and does not accept another format's scale/layout +under the same interface. The two raw outputs have no self-describing header. + +Inputs must be immutable, seekable regular model extracts supplied by a caller +that has already authenticated their identities and dimensions. This command +does not parse safetensors, select model tensors or authenticate checkpoints. +It verifies exact input sizes before creating outputs, then checks for extra +bytes at EOF. That does not detect arbitrary concurrent same-size input edits. + +The converter reads one weight row and one 128-row scale block at a time; +its buffers have fixed capacities independent of tensor size. It converts +every group through qpack and retains packed output, with no whole-tensor +expansion. Output files are created exclusively with owner-only permissions. +Existing outputs are refused without overwriting them. Handled conversion, +read, write, synchronization or close failures remove only outputs created +by this invocation. A private output directory under the caller's control is +required; concurrent path replacement is outside this contract. + +A successful exit is required before any consumer opens either result. Both +files are synchronized before success, but publication of the pair is not +atomic, directory entries are not synchronized, and a crash or signal may +leave incomplete files. There is no restart/resume or in-place update mode. +Exit 64 means malformed command arguments, 65 invalid shape/length/truncation, +69 unsupported rule, 74 an I/O failure, 75 unrepresentable scale and 76 +nonfinite data. Clean up failed-run files before retrying with fresh output +names. This diagnostic converter is not a serving loader or model registry. + +A complete 17,408x5,120 gate projection from the pinned real model was +converted under all three rules. Each result matched the existing converter +exactly: 44,564,480 weight bytes and 2,785,280 scale bytes. Those file bytes +are about 53% of the input weight+scale bytes, not measured physical GPU +allocation or traffic. See `evidence/w4-711/tensor/` for exact identities, +commands and independent file-lifecycle/layout checks. Whole-model quality, +GPU kernels, loading and serving integration remain unqualified. + +## Packed host memory image + +`resident.om` loads the two raw packed files into one managed anonymous host +mapping. It consumes the existing L788 compiler extension from Omega functional +source `d80b428c6ed9e3864fd7fc02cd7392bd4ad67f56`, source/test head +`7bc13ac26a99d47c7afec9d9f1e84a05cd904d45` (draft Omega PR #676), compiler +SHA256 `1d1aad082539399920bc6c90ff41f0a0c3a1ca3225e518fd0d259e0aeb71732d`. +The extension is proposed branch work, not merged default-branch capability. +No compiler, mapping implementation or GPU launcher is duplicated here. + +Set `wlimit[0]` to the remaining host allocation budget, after accounting for +other live allocations and reservations, then call `wload(wfd,sfd,rows,cols)`. +The descriptors are borrowed, must be distinct, readable and seekable, and +remain the caller's responsibility to close. This operation changes their file +positions. The caller must authenticate and freeze the raw MXFP4 file identities, +layout and dimensions first. There is no checkpoint parser or format detection. + +Rows are 1..262144; columns are a positive multiple of 512, at most32768, +matching the existing packed upload's alignment class. The loader verifies +exact file lengths, copies packed bytes unchanged, checks each E8M0 scale is +0..192, and rechecks EOF. Weights start at zero; scales start at the next +4KiB boundary, matching the historical upload layout. Padding comes from the +zero-filled anonymous allocation. No weights expand into FP8 or floating point. +At the maximum supported shape each copy loop stays within the compiler's +one-million-iteration limit. + +Only after both files copy and validate does `wstate` expose its five words: +managed handle, rows, columns, scale offset, total requested mapping bytes. +Failed loads publish no handle and release their private mapping. A cleanup +failure retains internal ownership for a subsequent `wdrop` retry; another +load is refused until it is cleared. Loading over an existing image refuses +without changing it. The caller must serialize the module and must not modify +its internal globals or unmap its handle externally. + +`wread(offset,count)` copies at most8192 bytes to `wbuffer` after validating +both ends against the published allocation. It permits a zero-length read at +the exact end. This is a host inspection/copy method, not device execution. +`wdrop` releases the image and clears its descriptor, and is idempotent when +empty. Status0 means success,65 invalid descriptor/shape/length/range, +73 empty/busy lifecycle,74 I/O/unmap failure,75 budget/allocation refusal, +and76 invalid E8M0 scale. Returned failure means the buffer is not a result. +The underlying compiler traps on corrupted or externally retired handles; +this module does not turn arbitrary process memory corruption into recoverable +errors. + +The configured limit bounds requested mapping bytes. Linux may lazily commit +pages, so successful mapping is not proof of guaranteed physical residency or +recovery from an OS out-of-memory kill. The image is not pinned or registered +with the GPU, and no device coherency, transfer, kernel or full-model speed +claim follows from it. Input files must remain immutable during loading; after +successful copying they can be closed without invalidating the owned image. + +Concatenate `resident.om` with `resident-test.om` and compile with the mapping +profile to run the8715-check native author suite in a fresh private directory. +`review/resident-projection.om` is a separate test entrypoint for the exact +17408x5120 real projection: two input paths, then raw weights+scales on stdout. +It closes both source files before reading the image. All three rule outputs +round-tripped through the native mapping byte-for-byte (47349760bytes each). +Independent coverage, failure controls and exact hashes are recorded under +`evidence/w4-711/resident/`. Actual GPU upload and serving remain open gates. + +## Corrected compiler compatibility + +The compiler safety correction in Omega PR676 also reproduces this component +without changing its executable bytes. See [evidence/w4-711/compiler-correction](../../evidence/w4-711/compiler-correction/README.md) for the exact compiler/source pins, binary comparisons and fresh host replays. The original qualification remains preserved. + +## Automatic native host gate + +`tests/gates/run.sh native-w4` runs `SC-NATIVE-W4`. The retained shell dispatch +uses its existing offline sibling pin mechanism to materialize the exact Omega +commit in `native/w4/compiler.lock`, checks both compiler source and executable +against `compiler.sha256`, and builds the native supervisor in fresh scratch. +This dedicated compiler pin is separate from `omega.lock`, which still governs +legacy linked composition. The compiler is proposed Omega PR676 work, not a +merged prerequisite. Missing commit objects, digest mismatches or unavailable +compiler executables fail the gate; there is no network fetch or fallback. + +All test assembly, child execution and result decisions are in `gate.om`. +The 15 groups run author and independent arithmetic and resident suites with +exact expected output; verify all 1,536 transport responses and reject a short +request; compare both synthetic tensor outputs for all three packing rules; +check late nonfinite weight/scale cleanup and preservation of existing scale +output; verify the diagnostic 512-group extract; check the released-mapping +trap and reject a projection invocation missing its paths. Every native source +entrypoint is compiled. Projection data itself is not supplied by this gate. + +Each child has a 30-second deadline. Compiler failure, signal, timeout, +unexpected exit, incorrect output or reused scratch cannot produce PASS. +Optional supervisor control argument 0, 1 or 2 deliberately runs the wrong-exit, +signal or deadline fixture. These are negative tests, not normal gate modes. +Fresh scratch and child output remain under the private build target for review. +The manifest requires the exact `w4_groups == 15` observation and exit zero. + +This reproducible host gate does not replace the recorded real-model differential, +full tensor refusal matrix, GPU integration, model quality/performance checks, +or the repository's other required checks. No inference timing is measured here. diff --git a/native/w4/compiler.lock b/native/w4/compiler.lock new file mode 100644 index 00000000..79d4f8ab --- /dev/null +++ b/native/w4/compiler.lock @@ -0,0 +1 @@ +1dffceaeb0dd26fb69ea64d367a49a9950c25a62 diff --git a/native/w4/compiler.sha256 b/native/w4/compiler.sha256 new file mode 100644 index 00000000..a02483ed --- /dev/null +++ b/native/w4/compiler.sha256 @@ -0,0 +1,2 @@ +9f48f66a9ee9f6a166df615a7ab9c48bf5b06ac2ba544ac51e52e9a3d290a6c4 seed/out/omc +a2691c76dfae15e1e8c4503fb22ce483f638824e5ab87146a13e2edb70b5a513 seed/omc/omc.om diff --git a/native/w4/fixture.om b/native/w4/fixture.om new file mode 100644 index 00000000..2a9cbc93 --- /dev/null +++ b/native/w4/fixture.om @@ -0,0 +1,43 @@ +note SPDX-License-Identifier: AGPL-3.0-only +note Test transport: rule+BF16 scale header, then FP8 groups, to stream requests. +global packet uchar 35 +fn exact offset ulong size ulong to long +have = ulong 0 +while lt have size +n = read 0 packet add offset have sub size have +if lt n 0 +ret -1 +end +if eq n 0 +if eq have 0 +ret 0 +end +ret -1 +end +have = add have ulong n +end +ret long size +end +fn main to int +if ne exact 0 3 3 +ret 65 +end +while eq ulong 1 1 +n = exact 3 32 +if eq n 0 +ret 0 +end +if lt n 0 +ret 65 +end +have = ulong 0 +while lt have 35 +w = write 1 packet have sub 35 have +if le w 0 +ret 74 +end +have = add have ulong w +end +end +ret 0 +end diff --git a/native/w4/gate-child.om b/native/w4/gate-child.om new file mode 100644 index 00000000..ca94d9b5 --- /dev/null +++ b/native/w4/gate-child.om @@ -0,0 +1,20 @@ +note Supervisor negative controls: known wrong exit, self-signal, deadline overrun. +global mode uchar 1 +fn main to int +if ne read 0 mode 0 1 1 +ret 90 +end +m = get mode 0 +if eq m 0 +ret 7 +end +if eq m 1 +r = killpid int getpid 9 +ret 98 +end +if eq m 2 +r = sleepns 45000000000 +ret 98 +end +ret 90 +end diff --git a/native/w4/gate.om b/native/w4/gate.om new file mode 100644 index 00000000..931d254f --- /dev/null +++ b/native/w4/gate.om @@ -0,0 +1,573 @@ +note SPDX-License-Identifier: AGPL-3.0-only +note W4 host qualification. Process helpers adapted from Omega gate669 at1dffceae. +note No GPU. Exact exits and output bytes; child deadlines30s; scratch exclusive. +text scratch "build/w4-native-gate" +text prefix "build/w4-native-gate/" +text names "unused\n/dev/null\nnative/w4/pack.om\nnative/w4/tests.om\nnative/w4/review/probes.om\nnative/w4/resident.om\nnative/w4/resident-test.om\nnative/w4/review/resident-independent.om\nnative/w4/stream.om\nnative/w4/review/fixture.om\nnative/w4/review/reply.om\nnative/w4/tensor.om\nnative/w4/review/tensor-fixture.om\nnative/w4/review/tensor-scale-fixture.om\n256\nnative/w4/gate-child.om\nnative/w4/fixture.om\nnative/w4/reply.om\nnative/w4/review/resident-stale.om\nnative/w4/review/resident-projection.om\n" +text input " < " +text output " > " +text errors " 2> " +text nl "\n" +text statusm "exit=" +text expect " expected=" +text signalm "INVALID child wait low-byte=" +text timeoutm "INVALID child deadline exceeded; sent SIGKILL; wait low-byte=" +text passed "AIEN-OBS w4_groups 15\nW4_NATIVE_GATE: PASS\n" +text failed "W4_NATIVE_GATE: FAIL; retain all scratch files and command output\n" +global pathbuf uchar 4096 +global plen ulong 1 +global serial ulong 1 +global argv uchar 4096 +global argc ulong 1 +global apos ulong 1 +global statbuf uchar 4 +global buf uchar 4096 +global other uchar 4096 +global digits uchar 32 +global cases ulong 1 +global tbin ulong 1 +text wauthor "1219868\n0\n" +text wreview "4381347\n0\n" +text wresid "8715\n0\n" +text windep "296271\n0\n" +fn stop to void +r = write 2 failed 0 len failed +exit 99 +end +fn decimal v ulong to ulong +x = v +n = ulong 0 +while ge x 10 +put digits n uchar add 48 rem x 10 +x = div x 10 +n = add n 1 +end +put digits n uchar add 48 x +ret add n 1 +end +fn num v ulong to void +n = decimal v +for i ulong n +r = write 1 digits sub sub n i 1 1 +if ne r 1 +stop +end +end +end +fn setpath id ulong to void +if eq id 1 +n = argread 1 pathbuf 0 len pathbuf +if le n 0 +stop +end +put plen 0 ulong n +ret +end +if and ge id 100 lt id 356 +put pathbuf 0 uchar sub id 100 +put plen 0 1 +ret +end +if ge id 1000 +for i ulong len prefix +put pathbuf i get prefix i +end +n = decimal id +for i ulong n +put pathbuf add len prefix i get digits sub sub n i 1 +end +put plen 0 add len prefix n +ret +end +index = ulong 1 +p = ulong 0 +for i ulong len names +b = get names i +if eq b 10 +if eq index id +put plen 0 p +ret +end +index = add index 1 +else +if eq index id +put pathbuf p b +p = add p 1 +end +end +end +stop +end +fn showpath id ulong to void +setpath id +r = write 1 pathbuf 0 get plen 0 +if ne r long get plen 0 +stop +end +end +fn openfile id ulong flags int to int +setpath id +r = fopen pathbuf 0 get plen 0 flags 384 +if lt r 0 +stop +end +ret int r +end +fn fresh to ulong +n = add get serial 0 1 +if ge n 400000 +stop +end +put serial 0 n +ret add 1000 n +end +fn arg id ulong to void +setpath id +p = get apos 0 +n = get plen 0 +if gt add add p n 2 len argv +stop +end +put argv p uchar and n 255 +put argv add p 1 uchar shr n 8 +p = add p 2 +for i ulong n +put argv add p i get pathbuf i +end +put apos 0 add p n +put argc 0 add get argc 0 1 +end +fn command exe ulong to void +put argc 0 0 +put apos 0 2 +arg exe +showpath exe +end +fn argument id ulong to void +put digits 0 32 +r = write 1 digits 0 1 +showpath id +arg id +end +fn close fd int to void +if ne fclose fd 0 +stop +end +end +fn redirect source int dest int to void +if ne source dest +if ne dupfd source dest 0 long dest +stop +end +end +end +fn reap pid int to ulong +start = monons +if lt start 0 +stop +end +while true +r = waitpid pid statbuf 0 len statbuf 1 +if eq r long pid +if ne get statbuf 0 0 +r = write 1 signalm 0 len signalm +num ulong get statbuf 0 +r = write 1 nl 0 1 +stop +end +ret ulong get statbuf 1 +end +if lt r 0 +stop +end +now = monons +if or lt now start gt sub now start 30000000000 +r = killpid pid 9 +r = waitpid pid statbuf 0 len statbuf 0 +r = write 1 timeoutm 0 len timeoutm +num ulong get statbuf 0 +r = write 1 nl 0 1 +stop +end +if ne sleepns 1000000 0 +stop +end +end +exit 99 +end +fn run source ulong wanted ulong to ulong +outid = fresh +errid = add outid 500000 +r = write 1 input 0 len input +showpath source +r = write 1 output 0 len output +showpath outid +r = write 1 errors 0 len errors +showpath errid +r = write 1 nl 0 1 +rd = openfile source 524288 +wr = openfile outid 524481 +er = openfile errid 524481 +put argv 0 uchar get argc 0 +put argv 1 uchar shr get argc 0 8 +pid = fork +if lt pid 0 +stop +end +if eq pid 0 +redirect rd 0 +redirect wr 1 +redirect er 2 +r = execprog argv 0 get apos 0 +exit 98 +end +close rd +close wr +close er +actual = reap int pid +r = write 1 statusm 0 len statusm +num actual +r = write 1 expect 0 len expect +num wanted +r = write 1 nl 0 1 +if ne actual wanted +stop +end +ret outid +end +fn enable id ulong to void +fd = openfile id 524288 +r = read fd buf 0 4 +if ne r 4 +stop +end +if or ne get buf 0 127 ne get buf 1 69 +stop +end +if or ne get buf 2 76 ne get buf 3 70 +stop +end +if ne fchmod fd 448 0 +stop +end +close fd +end +fn empty id ulong to void +fd = openfile id 524288 +r = read fd buf 0 1 +close fd +if ne r 0 +stop +end +end +fn compile cc ulong src ulong wanted ulong to ulong +command cc +outid = run src wanted +if eq wanted 0 +enable outid +else +empty outid +end +ret outid +end +fn append source ulong dest int to void +fd = openfile source 524288 +while true +n = read fd buf 0 len buf +if lt n 0 +stop +end +if eq n 0 +close fd +ret +end +if ne write dest buf 0 ulong n n +stop +end +end +end +fn combine first ulong second ulong to ulong +id = fresh +fd = openfile id 524481 +append first fd +put buf 0 10 +if ne write fd buf 0 1 1 +stop +end +append second fd +close fd +ret compile 1 id 0 +end +fn exact id ulong want ulong to void +fd = openfile id 524288 +n = read fd buf 0 len buf +extra = read fd other 0 1 +close fd +size = len wauthor +if eq want 1 +size = len wreview +end +if eq want 2 +size = len wresid +end +if eq want 3 +size = len windep +end +if or ne n long size ne extra 0 +stop +end +for i ulong size +b = uchar 0 +if eq want 0 +b = get wauthor i +end +if eq want 1 +b = get wreview i +end +if eq want 2 +b = get wresid i +end +if eq want 3 +b = get windep i +end +if ne get buf i b +stop +end +end +end +fn suite first ulong second ulong want ulong to void +exe = combine first second +command exe +outid = run 2 0 +exact outid want +put cases 0 add get cases 0 1 +end +fn same a ulong b ulong to void +fa = openfile a 524288 +fb = openfile b 524288 +while true +na = read fa buf 0 len buf +nb = read fb other 0 len other +if or lt na 0 ne na nb +stop +end +if eq na 0 +close fa +close fb +ret +end +for i ulong ulong na +if ne get buf i get other i +stop +end +end +end +end +fn absent id ulong to void +setpath id +fd = fopen pathbuf 0 get plen 0 524288 0 +if ne fd -2 +stop +end +end +fn modefile value uchar to ulong +id = fresh +fd = openfile id 524481 +put buf 0 value +if ne write fd buf 0 1 1 +stop +end +close fd +ret id +end +fn generate exe ulong mode ulong to ulong +command exe +argument add mode 148 +ret run 2 0 +end +fn tensor weights ulong scales ulong packed ulong e8 ulong rule ulong wanted ulong to void +command get tbin 0 +argument weights +argument scales +argument packed +argument e8 +argument 15 +argument 15 +argument add rule 148 +outid = run 2 wanted +empty outid +end +fn failures weights ulong scales ulong expects ulong fixture ulong scalegen ulong to void +late = generate fixture 4 +packed = fresh +e8 = fresh +tensor late scales packed e8 0 76 +absent packed +absent e8 +put cases 0 add get cases 0 1 +badscale = generate scalegen 5 +packed = fresh +e8 = fresh +tensor weights badscale packed e8 0 76 +absent packed +absent e8 +put cases 0 add get cases 0 1 +packed = fresh +tensor weights scales packed expects 0 74 +absent packed +freshs = generate fixture 3 +same expects freshs +put cases 0 add get cases 0 1 +end +fn tensors to void +exe = combine 3 12 +put tbin 0 exe +fixture = compile 1 13 0 +scalegen = compile 1 14 0 +weights = generate fixture 0 +scales = generate fixture 1 +expectw = generate fixture 2 +expects = generate fixture 3 +for rule ulong 3 +packed = fresh +e8 = fresh +tensor weights scales packed e8 rule 0 +same packed expectw +same e8 expects +put cases 0 add get cases 0 1 +end +failures weights scales expects fixture scalegen +end +fn transport to void +exe = combine 3 9 +fixture = compile 1 10 0 +reply = compile 1 11 0 +mode = modefile 0 +command fixture +request = run mode 0 +command exe +response = run request 0 +command reply +result = run response 0 +empty result +put cases 0 add get cases 0 1 +mode = modefile 1 +command fixture +request = run mode 0 +command exe +response = run request 65 +empty response +put cases 0 add get cases 0 1 +end +fn extract to void +fixture = compile 1 17 0 +stream = combine 3 9 +reply = compile 1 18 0 +id = fresh +fd = openfile id 524481 +put buf 0 0 +put buf 1 128 +put buf 2 63 +if ne write fd buf 0 3 3 +stop +end +for i ulong 32 +put buf i 56 +end +for g ulong 512 +if ne write fd buf 0 32 32 +stop +end +end +close fd +command fixture +requests = run id 0 +command stream +response = run requests 0 +command reply +result = run response 0 +verify result +put cases 0 add get cases 0 1 +end +fn verify id ulong to void +fd = openfile id 524288 +pos = ulong 0 +while lt pos 8704 +n = read fd buf 0 len buf +if le n 0 +stop +end +for i ulong ulong n +want = uchar 102 +if ge add pos i 8192 +want = 125 +end +if ne get buf i want +stop +end +end +pos = add pos ulong n +end +if ne pos 8704 +stop +end +n = read fd buf 0 1 +close fd +if ne n 0 +stop +end +end +fn aux to void +exe = compile 1 19 0 +command exe +result = run 2 103 +empty result +put cases 0 add get cases 0 1 +exe = combine 6 20 +command exe +result = run 2 64 +empty result +put cases 0 add get cases 0 1 +extract +end +fn control to void +if ne argread 2 buf 0 1 1 +stop +end +m = get buf 0 +if or lt m 48 gt m 50 +stop +end +id = modefile uchar sub m 48 +child = compile 1 16 0 +command child +result = run id 0 +stop +end +fn main to int +if or lt argcnt 2 gt argcnt 3 +ret 90 +end +if ne makedir scratch 0 len scratch 448 0 +ret 91 +end +if eq argcnt 3 +control +ret 99 +end +suite 3 4 0 +suite 3 5 1 +suite 6 7 2 +suite 6 8 3 +transport +tensors +aux +if ne get cases 0 15 +stop +end +r = write 1 passed 0 len passed +if ne r long len passed +ret 99 +end +ret 0 +end diff --git a/native/w4/pack.om b/native/w4/pack.om new file mode 100644 index 00000000..0c531141 --- /dev/null +++ b/native/w4/pack.om @@ -0,0 +1,181 @@ +note SPDX-License-Identifier: AGPL-3.0-only +note Native migration of speed3/w4-gemv MXFP4 OCP/FIT/BEST group conversion. +note Exact integer arithmetic over E4M3FN input and one BF16 scale per group. +note qmeta: valid, E8M0 scale, all-zero group, clipped count, squared raw error. +global qinput uchar 32 +global qoutput uchar 16 +global qmeta ulong 5 +global qvalues ulong 32 +global qsigns uchar 32 +global qcodes uchar 32 +global qother uchar 32 +global qerr ulong 2 +global qclip ulong 2 + +fn qgrid code ulong to ulong +if lt code 5 +ret code +end +if eq code 5 +ret 6 +end +if eq code 6 +ret 8 +end +ret 12 +end + +fn qround value ulong power ulong to ulong +note Twice the e2m1 grid is integral. Compare exact midpoints without division. +for i ulong 7 +mid = shl add qgrid i qgrid add i 1 power +scaled = mul value 16 +if lt scaled mid +ret i +end +if eq scaled mid +if eq and i 1 0 +ret i +end +ret add i 1 +end +end +ret 7 +end + +fn qtrial power ulong slot ulong to void +total = ulong 0 +clipped = ulong 0 +for c ulong 32 +value = get qvalues c +code = qround value power +if eq slot 0 +put qcodes c uchar code +else +put qother c uchar code +end +if gt mul value 4 shl 6 power +clipped = add clipped 1 +end +back = shl qgrid code power +raw = mul value 8 +delta = ulong 0 +if ge back raw +delta = sub back raw +else +delta = sub raw back +end +total = add total mul delta delta +end +put qerr slot total +put qclip slot clipped +end + +fn qwrite chosen ulong to void +for c ulong 32 +code = ulong get qcodes c +if eq chosen 1 +code = ulong get qother c +end +code = or code shl ulong get qsigns c 3 +index = shr c 1 +old = ulong get qoutput index +put qoutput index uchar or old shl code mul and c 1 4 +end +end + +fn qpack scale ulong rule ulong to int +note Refusals clear public output so no caller can consume a partial group. +for i ulong 16 +put qoutput i 0 +end +for i ulong 5 +put qmeta i 0 +end +if gt scale 65535 +ret 65 +end +if gt rule 2 +ret 69 +end +bexp = and shr scale 7 255 +if eq bexp 255 +ret 76 +end +mant = and scale 127 +if ne bexp 0 +mant = add mant 128 +end +largest = ulong 0 +for c ulong 32 +bits = ulong get qinput c +mag = and bits 127 +if eq mag 127 +ret 76 +end +expo = shr mag 3 +value = and mag 7 +if ne expo 0 +value = shl add value 8 sub expo 1 +end +value = mul value mant +put qvalues c value +sign = xor shr bits 7 shr scale 15 +if eq value 0 +sign = 0 +end +put qsigns c uchar sign +if gt value largest +largest = value +end +end +if eq largest 0 +put qmeta 0 1 +put qmeta 1 127 +put qmeta 2 1 +ret 0 +end +power = ulong 0 +value = largest +while ge value 2 +value = shr value 1 +power = add power 1 +end +qtrial power 0 +chosen = ulong 0 +if ne rule 0 +if ne get qclip 0 0 +qtrial add power 1 1 +if eq rule 1 +chosen = 1 +else +if lt get qerr 1 get qerr 0 +chosen = 1 +end +end +end +end +note E = floor(log2 amax) - 2 + 127, including BF16 subnormal exponent. +expo = add power chosen +if eq bexp 0 +if lt expo 17 +ret 75 +end +expo = sub expo 17 +else +expo = add expo bexp +if lt expo 18 +ret 75 +end +expo = sub expo 18 +end +if gt expo 192 +ret 75 +end +qwrite chosen +put qmeta 0 1 +put qmeta 1 expo +put qmeta 3 get qclip chosen +put qmeta 4 get qerr chosen +ret 0 +end diff --git a/native/w4/reply.om b/native/w4/reply.om new file mode 100644 index 00000000..fca63b1b --- /dev/null +++ b/native/w4/reply.om @@ -0,0 +1,37 @@ +note SPDX-License-Identifier: AGPL-3.0-only +note Test transport:512 successful group replies -> packed8192 then scales512. +global raw uchar 10240 +global packed uchar 8704 +fn main to int +have = ulong 0 +while lt have 10240 +n = read 0 raw have sub 10240 have +if le n 0 +ret 65 +end +have = add have ulong n +end +extra = new uchar 1 0 +if ne read 0 extra 0 1 0 +ret 65 +end +for g ulong 512 +base = mul g 20 +if ne get raw base 0 +ret 76 +end +for i ulong 16 +put packed add mul g 16 i get raw add add base 2 i +end +put packed add 8192 g get raw add base 1 +end +have = 0 +while lt have 8704 +n = write 1 packed have sub 8704 have +if le n 0 +ret 74 +end +have = add have ulong n +end +ret 0 +end diff --git a/native/w4/resident-test.om b/native/w4/resident-test.om new file mode 100644 index 00000000..c7b094d7 --- /dev/null +++ b/native/w4/resident-test.om @@ -0,0 +1,119 @@ +note Native resident loader checks, using owned temporary files in private cwd. +text weights "weights.bin" +text scales "scales.bin" +global counts ulong 2 +global wtest uchar 8192 +global wtfd int 2 +fn check yes bool to void +put counts 0 add get counts 0 1 +if not yes +put counts 1 add get counts 1 1 +end +end +fn number value ulong to void +if ge value 10 +number div value 10 +end +put wtest 0 uchar add rem value 10 48 +r = write 1 wtest 0 1 +end +fn loadtest rows ulong cols ulong to int +ret wload get wtfd 0 get wtfd 1 rows cols +end +fn filetest to void +put wtfd 0 int fopen weights 0 len weights 194 384 +put wtfd 1 int fopen scales 0 len scales 194 384 +check ge get wtfd 0 0 +check ge get wtfd 1 0 +for i ulong 256 +put wtest i uchar rem i 256 +end +check eq write get wtfd 0 wtest 0 256 256 +for i ulong 16 +put wtest i uchar mul i 12 +end +check eq write get wtfd 1 wtest 0 16 16 +end +fn valid to void +put wlimit 0 4112 +check eq loadtest 1 512 0 +check gt get wstate 0 0 +check eq get wstate 1 1 +check eq get wstate 2 512 +check eq get wstate 3 4096 +check eq get wstate 4 4112 +check eq wread 0 256 0 +for i ulong 256 +check eq get wbuffer i uchar i +end +check eq wread 256 3840 0 +for i ulong 3840 +check eq get wbuffer i 0 +end +check eq wread 4096 16 0 +for i ulong 16 +check eq get wbuffer i uchar mul i 12 +end +check eq wread 4112 0 0 +check eq wread 4112 1 65 +check eq wread 18446744073709551615 1 65 +check eq wread 0 8193 65 +check eq loadtest 1 512 73 +check eq wdrop 0 +for i ulong 5 +check eq get wstate i 0 +end +check eq wdrop 0 +check eq wread 0 0 73 +end +fn main to int +filetest +put wlimit 0 4111 +check eq loadtest 1 512 75 +check eq get wstate 0 0 +put wlimit 0 4112 +check eq loadtest 0 512 65 +check eq loadtest 262145 512 65 +check eq loadtest 1 0 65 +check eq loadtest 1 513 65 +check eq loadtest 1 33280 65 +put wlimit 0 5000 +check eq loadtest 2 512 65 +put wlimit 0 4112 +check eq wload get wtfd 0 get wtfd 0 1 512 65 +valid +note A failed scale validation must retire its private mapping, all128 slots recover. +check eq fseek get wtfd 1 15 0 15 +put wtest 0 193 +check eq write get wtfd 1 wtest 0 1 1 +for i ulong 140 +check eq loadtest 1 512 76 +check eq get wstate 0 0 +check eq get wstage 0 0 +end +check eq fseek get wtfd 1 15 0 15 +put wtest 0 180 +check eq write get wtfd 1 wtest 0 1 1 +valid +check eq fseek get wtfd 1 15 0 15 +put wtest 0 192 +check eq write get wtfd 1 wtest 0 1 1 +check eq loadtest 1 512 0 +check eq wread 4111 1 0 +check eq get wbuffer 0 192 +check eq wdrop 0 +check eq fclose get wtfd 0 0 +check eq fclose get wtfd 1 0 +check eq unlink weights 0 len weights 0 +check eq unlink scales 0 len scales 0 +number get counts 0 +put wtest 0 10 +r = write 1 wtest 0 1 +number get counts 1 +put wtest 0 10 +r = write 1 wtest 0 1 +if ne get counts 1 0 +ret 1 +end +ret 0 +end diff --git a/native/w4/resident.om b/native/w4/resident.om new file mode 100644 index 00000000..570d34a7 --- /dev/null +++ b/native/w4/resident.om @@ -0,0 +1,174 @@ +note SPDX-License-Identifier: AGPL-3.0-only +note Packed MXFP4 host resident image. L788 managed mappings; no device launch. +note wstate:handle,n,k,scale offset,total bytes. wlimit must be set by caller. +global wstate ulong 5 +global wlimit ulong 1 +global wbuffer uchar 8192 +global wstage long 1 + +fn wdrop to int +if ne get wstage 0 0 +if ne mapdrop get wstage 0 0 +ret 74 +end +put wstage 0 0 +end +if eq get wstate 0 0 +ret 0 +end +if ne mapdrop long get wstate 0 0 +ret 74 +end +for i ulong 5 +put wstate i 0 +end +ret 0 +end + +fn wread offset ulong count ulong to int +if eq get wstate 0 0 +ret 73 +end +if gt count len wbuffer +ret 65 +end +if gt offset get wstate 4 +ret 65 +end +if gt count sub get wstate 4 offset +ret 65 +end +if ne mapread long get wstate 0 offset wbuffer 0 count long count +ret 74 +end +ret 0 +end + +fn wsize fd int want ulong to int +if ne fseek fd 0 2 long want +ret 65 +end +if ne fseek fd 0 0 0 +ret 74 +end +ret 0 +end + +fn wcopy fd int dest ulong bytes ulong scale bool to int +copied = ulong 0 +while lt copied bytes +count = sub bytes copied +if gt count len wbuffer +count = len wbuffer +end +have = ulong 0 +while lt have count +got = read fd wbuffer have sub count have +if lt got 0 +ret 74 +end +if eq got 0 +ret 65 +end +have = add have ulong got +end +if scale +for i ulong count +if gt get wbuffer i 192 +ret 76 +end +end +end +if ne mapwrite get wstage 0 add dest copied wbuffer 0 count long count +ret 74 +end +copied = add copied count +end +last = read fd wbuffer 0 1 +if lt last 0 +ret 74 +end +if ne last 0 +ret 65 +end +ret 0 +end + +fn wabort status int to int +if ne mapdrop get wstage 0 0 +ret 74 +end +put wstage 0 0 +ret status +end + +fn walloc bytes ulong to long +ret mapnew neg int 1 0 bytes 3 34 +end + +fn wbudget total ulong to int +if or eq get wlimit 0 0 gt get wlimit 0 68719476736 +ret 65 +end +if gt total get wlimit 0 +ret 75 +end +ret 0 +end + +fn wload wfd int sfd int rows ulong cols ulong to int +if or ne get wstate 0 0 ne get wstage 0 0 +ret 73 +end +if or lt wfd 0 lt sfd 0 +ret 65 +end +if eq wfd sfd +ret 65 +end +if or eq rows 0 gt rows 262144 +ret 65 +end +if or eq cols 0 gt cols 32768 +ret 65 +end +if ne rem cols 512 0 +ret 65 +end +weights = div mul rows cols 2 +scales = div mul rows cols 32 +start = and add weights 4095 18446744073709547520 +total = add start scales +rc = wbudget total +if ne rc 0 +ret rc +end +rc = wsize wfd weights +if ne rc 0 +ret rc +end +rc = wsize sfd scales +if ne rc 0 +ret rc +end +h = walloc total +if le h 0 +ret 75 +end +put wstage 0 h +rc = wcopy wfd 0 weights false +if ne rc 0 +ret wabort rc +end +rc = wcopy sfd start scales true +if ne rc 0 +ret wabort rc +end +put wstate 0 ulong h +put wstate 1 rows +put wstate 2 cols +put wstate 3 start +put wstate 4 total +put wstage 0 0 +ret 0 +end diff --git a/native/w4/review/fixture.om b/native/w4/review/fixture.om new file mode 100644 index 00000000..c391c0da --- /dev/null +++ b/native/w4/review/fixture.om @@ -0,0 +1,41 @@ +global mode uchar 1 +global buf uchar 35 +fn main to int +got = read 0 mode 0 1 +if ne got 1 +ret 65 +end +for frame ulong 1536 +kind = rem frame 4 +put buf 0 uchar rem frame 3 +put buf 1 128 +put buf 2 63 +for i ulong 32 +put buf add i 3 56 +end +if eq kind 1 +put buf 2 191 +end +if eq kind 2 +put buf 1 1 +put buf 2 0 +for i ulong 32 +put buf add i 3 128 +end +end +if eq kind 3 +put buf 3 127 +end +if eq get mode 0 1 +w = write 1 buf 0 34 +ret 0 +end +for i ulong 35 +w = write 1 buf i 1 +if ne w 1 +ret 74 +end +end +end +ret 0 +end diff --git a/native/w4/review/probes.om b/native/w4/review/probes.om new file mode 100644 index 00000000..8e6bc590 --- /dev/null +++ b/native/w4/review/probes.om @@ -0,0 +1,263 @@ +note Independent exact-distance oracle; does not call product qround/qgrid/qtrial. +global icount ulong 1 +global ifails ulong 1 +global igrid ulong 8 +global iraw ulong 32 +global isign ulong 32 +global icodes ulong 64 +global ierr ulong 2 +global isat ulong 2 +fn verify a ulong b ulong to void +put icount 0 add get icount 0 1 +if ne a b +put ifails 0 add get ifails 0 1 +end +end +fn emitnum value ulong to void +b = new uchar 32 0 +n = ulong 0 +v = value +while ge v 10 +put b n uchar add rem v 10 48 +n = add n 1 +v = div v 10 +end +put b n uchar add v 48 +n = add n 1 +while gt n 0 +n = sub n 1 +w = write 1 b n 1 +end +put b 0 10 +w = write 1 b 0 1 +end +fn nearest raw ulong power ulong to ulong +best = ulong 0 +distance = mul raw 8 +for i ulong 8 +back = mul get igrid i shl 1 power +delta = ulong 0 +if ge back mul raw 8 +delta = sub back mul raw 8 +else +delta = sub mul raw 8 back +end +if lt delta distance +best = i +distance = delta +else +if eq delta distance +if eq rem i 2 0 +best = i +end +end +end +end +ret best +end +fn trial power ulong slot ulong to void +put ierr slot 0 +put isat slot 0 +for i ulong 32 +raw = get iraw i +code = nearest raw power +put icodes add mul slot 32 i code +back = mul get igrid code shl 1 power +delta = ulong 0 +if ge back mul raw 8 +delta = sub back mul raw 8 +else +delta = sub mul raw 8 back +end +put ierr slot add get ierr slot mul delta delta +if gt mul raw 8 mul 12 shl 1 power +put isat slot add get isat slot 1 +end +end +end +fn empty to void +for i ulong 5 +verify get qmeta i 0 +end +for i ulong 16 +verify ulong get qoutput i 0 +end +end +fn decode scale ulong to ulong +exp = rem div scale 128 256 +mant = rem scale 128 +if ne exp 0 +mant = add mant 128 +end +largest = ulong 0 +for i ulong 32 +bits = ulong get qinput i +mag = rem bits 128 +if eq mag 127 +ret 18446744073709551615 +end +value = rem mag 8 +e = div mag 8 +if gt e 0 +value = add value 8 +for j ulong sub e 1 +value = mul value 2 +end +end +value = mul value mant +put iraw i value +bits = div bits 128 +bits = add bits div scale 32768 +put isign i rem bits 2 +if eq value 0 +put isign i 0 +end +if gt value largest +largest = value +end +end +ret largest +end +fn packed chosen ulong to void +for i ulong 16 +index = mul i 2 +base = mul chosen 32 +lo = get icodes add base index +lo = add lo mul get isign index 8 +index = add index 1 +hi = get icodes add base index +hi = add hi mul get isign index 8 +verify ulong get qoutput i add lo mul hi 16 +end +end +fn compare scale ulong rule ulong to void +status = qpack scale rule +exp = rem div scale 128 256 +if eq exp 255 +verify ulong status 76 +empty +ret +end +largest = decode scale +if eq largest 18446744073709551615 +verify ulong status 76 +empty +ret +end +if eq largest 0 +verify ulong status 0 +verify get qmeta 0 1 +verify get qmeta 1 127 +verify get qmeta 2 1 +verify get qmeta 3 0 +verify get qmeta 4 0 +for i ulong 16 +verify ulong get qoutput i 0 +end +ret +end +power = ulong 0 +ibound = ulong 1 +while le mul ibound 2 largest +ibound = mul ibound 2 +power = add power 1 +end +trial power 0 +chosen = ulong 0 +if gt rule 0 +if gt get isat 0 0 +trial add power 1 1 +if eq rule 1 +chosen = 1 +end +if eq rule 2 +if lt get ierr 1 get ierr 0 +chosen = 1 +end +end +end +end +e = add power chosen +if eq exp 0 +e = add e 1 +else +e = add e exp +end +if lt e 18 +verify ulong status 75 +empty +ret +end +e = sub e 18 +if gt e 192 +verify ulong status 75 +empty +ret +end +verify ulong status 0 +verify get qmeta 0 1 +verify get qmeta 1 e +verify get qmeta 2 0 +verify get qmeta 3 get isat chosen +verify get qmeta 4 get ierr chosen +packed chosen +end +fn main to int +put igrid 0 0 +put igrid 1 1 +put igrid 2 2 +put igrid 3 3 +put igrid 4 4 +put igrid 5 6 +put igrid 6 8 +put igrid 7 12 +note Every BF16 encoding with mixed positive/negative, normal/subnormal/zero FP8. +for scale ulong 65536 +for i ulong 32 +v = rem add mul scale 37 mul i 73 256 +if eq rem v 128 127 +v = sub v 1 +end +put qinput i uchar v +end +put qinput 0 0 +put qinput 1 128 +for rule ulong 3 +compare scale rule +end +end +note Exhaustive small integer lattice plus exact large midpoint ties. +for power ulong 12 +for raw ulong 4096 +verify qround raw power nearest raw power +end +end +for power ulong 23 +for i ulong 7 +raw = mul add get igrid i get igrid add i 1 shl 1 power +verify qround raw add power 4 nearest raw add power 4 +if gt raw 0 +verify qround sub raw 1 add power 4 nearest sub raw 1 add power 4 +end +verify qround add raw 1 add power 4 nearest add raw 1 add power 4 +end +end +note Invalid FP8 in every slot refuses, including under signed-zero scale. +for i ulong 32 +for j ulong 32 +put qinput j 0 +end +put qinput i 255 +for rule ulong 3 +compare 0 rule +compare 32768 rule +compare 16256 rule +end +end +emitnum get icount 0 +emitnum get ifails 0 +if ne get ifails 0 0 +ret 1 +end +ret 0 +end diff --git a/native/w4/review/reply.om b/native/w4/review/reply.om new file mode 100644 index 00000000..b6183d53 --- /dev/null +++ b/native/w4/review/reply.om @@ -0,0 +1,53 @@ +global buf uchar 20 +fn main to int +for frame ulong 1536 +have = ulong 0 +while lt have 20 +count = read 0 buf have sub 20 have +if le count 0 +ret 1 +end +have = add have ulong count +end +kind = rem frame 4 +status = uchar 0 +expo = uchar 125 +value = uchar 102 +zero = uchar 0 +if eq kind 1 +value = 238 +end +if eq kind 2 +expo = 127 +value = 0 +zero = 1 +end +if eq kind 3 +status = 76 +expo = 0 +value = 0 +end +if ne get buf 0 status +ret 1 +end +if ne get buf 1 expo +ret 1 +end +for i ulong 16 +if ne get buf add i 2 value +ret 1 +end +end +if ne get buf 18 0 +ret 1 +end +if ne get buf 19 zero +ret 1 +end +end +count = read 0 buf 0 1 +if ne count 0 +ret 1 +end +ret 0 +end diff --git a/native/w4/review/resident-independent.om b/native/w4/review/resident-independent.om new file mode 100644 index 00000000..a0787a75 --- /dev/null +++ b/native/w4/review/resident-independent.om @@ -0,0 +1,178 @@ +text tiny "review-empty.bin" +text wp "review-weights.bin" +text sp "review-scales.bin" +global rf int 2 +global cb uchar 8192 +global result ulong 2 +global held long 256 +fn ck yes bool to void +put result 0 add get result 0 1 +if not yes +put result 1 add get result 1 1 +end +end +fn emit n ulong to void +if ge n 10 +emit div n 10 +end +put cb 0 uchar add 48 rem n 10 +r = write 1 cb 0 1 +end +fn pattern pos ulong scale bool to uchar +if scale +ret uchar rem pos 193 +end +ret uchar rem add mul pos 17 3 256 +end +fn create fd int size ulong scale bool to void +pos = ulong 0 +while lt pos size +amount = sub size pos +if gt amount 8192 +amount = 8192 +end +for i ulong amount +put cb i pattern add pos i scale +end +ck eq write fd cb 0 amount long amount +pos = add pos amount +end +end +fn load to int +ret wload get rf 0 get rf 1 529 512 +end +fn inspect to void +ck eq load 0 +ck eq get wstate 1 529 +ck eq get wstate 2 512 +ck eq get wstate 3 139264 +ck eq get wstate 4 147728 +pos = ulong 0 +while lt pos 147728 +amount = sub 147728 pos +if gt amount 8192 +amount = 8192 +end +ck eq wread pos amount 0 +for i ulong amount +at = add pos i +expected = uchar 0 +if lt at 135424 +expected = pattern at false +end +if ge at 139264 +expected = pattern sub at 139264 true +end +ck eq get wbuffer i expected +end +pos = add pos amount +end +ck eq load 73 +ck eq wread 147728 0 0 +ck eq wread 147728 1 65 +ck eq wread 18446744073709551615 1 65 +ck eq wread 0 8193 65 +old = long get wstate 0 +ck eq wdrop 0 +ck eq wdrop 0 +ck eq wread 0 1 73 +for i ulong 5 +ck eq get wstate i 0 +end +end +fn capacity to void +count = ulong 0 +keep = true +while keep +h = walloc 4096 +if le h 0 +keep = false +else +put held count h +count = add count 1 +if eq count 256 +keep = false +end +end +end +ck eq count 128 +ck eq load 75 +ck eq get wstate 0 0 +ck eq get wstage 0 0 +if gt count 0 +count = sub count 1 +ck eq mapdrop get held count 0 +ck eq load 0 +ck eq wdrop 0 +end +for i ulong count +ck eq mapdrop get held i 0 +end +ck eq load 0 +ck eq wdrop 0 +end +fn main to int +put rf 0 int fopen wp 0 len wp 194 384 +put rf 1 int fopen sp 0 len sp 194 384 +ck ge get rf 0 0 +ck ge get rf 1 0 +create get rf 0 135424 false +create get rf 1 8464 true +ck eq wdrop 0 +ck eq wread 0 0 73 +put wlimit 0 0 +ck eq load 65 +put wlimit 0 68719476737 +ck eq load 65 +put wlimit 0 147727 +ck eq load 75 +put wlimit 0 147728 +ck eq wload neg int 1 get rf 1 529 512 65 +ck eq wload get rf 0 get rf 0 529 512 65 +ck eq wload 999999 get rf 1 529 512 65 +ck eq wload get rf 0 get rf 1 528 512 65 +ck eq wload get rf 0 get rf 1 530 512 75 +tfd = int fopen tiny 0 len tiny 194 384 +ck ge tfd 0 +ck eq wload tfd get rf 1 529 512 65 +ck eq wload get rf 0 tfd 529 512 65 +ck eq fclose tfd 0 +ck eq wload tfd get rf 1 529 512 65 +ck eq unlink tiny 0 len tiny 0 +inspect +capacity +note Late invalid scale is after the first full8192-byte scale copy. +ck eq fseek get rf 1 8463 0 8463 +put cb 0 193 +ck eq write get rf 1 cb 0 1 1 +for i ulong 140 +ck eq load 76 +ck eq get wstate 0 0 +ck eq get wstage 0 0 +r = wdrop +end +ck eq fseek get rf 1 8463 0 8463 +put cb 0 pattern 8463 true +ck eq write get rf 1 cb 0 1 1 +capacity +inspect +ck eq fseek get rf 1 0 2 8464 +put cb 0 0 +ck eq write get rf 1 cb 0 1 1 +ck eq load 65 +ck eq get wstate 0 0 +ck eq fclose get rf 0 0 +ck eq fclose get rf 1 0 +ck eq unlink wp 0 len wp 0 +ck eq unlink sp 0 len sp 0 +emit get result 0 +put cb 0 10 +r = write 1 cb 0 1 +emit get result 1 +put cb 0 10 +r = write 1 cb 0 1 +if ne get result 1 0 +ret 1 +end +ret 0 +end diff --git a/native/w4/review/resident-projection.om b/native/w4/review/resident-projection.om new file mode 100644 index 00000000..2922adf1 --- /dev/null +++ b/native/w4/review/resident-projection.om @@ -0,0 +1,63 @@ +note Test-only full17408x5120 projection load/readback. Two immutable raw-file paths. +global rpaths uchar 8192 +global rlens ulong 2 +global rfds int 2 +fn emit offset ulong count ulong to int +copied = ulong 0 +while lt copied count +chunk = sub count copied +if gt chunk len wbuffer +chunk = len wbuffer +end +rc = wread add offset copied chunk +if ne rc 0 +ret rc +end +sent = ulong 0 +while lt sent chunk +n = write 1 wbuffer sent sub chunk sent +if le n 0 +ret 74 +end +sent = add sent ulong n +end +copied = add copied chunk +end +ret 0 +end +fn main to int +if ne argcnt 3 +ret 64 +end +for i ulong 2 +count = argread add i 1 rpaths mul i 4096 4096 +if le count 0 +ret 64 +end +put rlens i ulong count +fd = fopen rpaths mul i 4096 ulong count 0 0 +if lt fd 0 +ret 74 +end +put rfds i int fd +end +put wlimit 0 47349760 +rc = wload get rfds 0 get rfds 1 17408 5120 +for i ulong 2 +if ne fclose get rfds i 0 +ret 74 +end +end +if ne rc 0 +ret rc +end +rc = emit 0 44564480 +if ne rc 0 +ret rc +end +rc = emit get wstate 3 2785280 +if ne rc 0 +ret rc +end +ret wdrop +end diff --git a/native/w4/review/resident-stale.om b/native/w4/review/resident-stale.om new file mode 100644 index 00000000..e50bd7f1 --- /dev/null +++ b/native/w4/review/resident-stale.om @@ -0,0 +1,12 @@ +global buf uchar 1 +fn main to int +h = mapnew neg int 1 0 4096 3 34 +if le h 0 +ret 1 +end +if ne mapdrop h 0 +ret 2 +end +r = mapread h 0 buf 0 1 +ret 3 +end diff --git a/native/w4/review/tensor-fixture.om b/native/w4/review/tensor-fixture.om new file mode 100644 index 00000000..5f6510a7 --- /dev/null +++ b/native/w4/review/tensor-fixture.om @@ -0,0 +1,63 @@ +global mode uchar 1 +global buf uchar 256 +fn main to int +if ne argread 1 mode 0 1 1 +ret 64 +end +which = get mode 0 +if eq which 49 +put buf 0 128 +put buf 1 63 +put buf 2 0 +put buf 3 192 +put buf 4 128 +put buf 5 64 +put buf 6 0 +put buf 7 193 +if ne write 1 buf 0 8 8 +ret 74 +end +ret 0 +end +for row ulong 256 +if or eq which 48 eq which 52 +for col ulong 256 +v = ulong 56 +if ne rem add row col 2 0 +v = add v 128 +end +if eq which 52 +if and eq row 255 eq col 255 +v = 127 +end +end +put buf col uchar v +end +if ne write 1 buf 0 256 256 +ret 74 +end +end +if eq which 50 +for col ulong 128 +v = ulong 230 +sign = xor rem row 2 div col 64 +if ne sign 0 +v = 110 +end +put buf col uchar v +end +if ne write 1 buf 0 128 128 +ret 74 +end +end +if eq which 51 +for col ulong 8 +put buf col uchar add 125 add mul div row 128 2 div col 4 +end +if ne write 1 buf 0 8 8 +ret 74 +end +end +end +ret 0 +end diff --git a/native/w4/review/tensor-scale-fixture.om b/native/w4/review/tensor-scale-fixture.om new file mode 100644 index 00000000..eccef461 --- /dev/null +++ b/native/w4/review/tensor-scale-fixture.om @@ -0,0 +1,67 @@ +global mode uchar 1 +global buf uchar 256 +fn main to int +if ne argread 1 mode 0 1 1 +ret 64 +end +which = get mode 0 +if or eq which 49 eq which 53 +put buf 0 128 +put buf 1 63 +put buf 2 0 +put buf 3 192 +put buf 4 128 +put buf 5 64 +put buf 6 0 +put buf 7 193 +if eq which 53 +put buf 6 128 +put buf 7 127 +end +if ne write 1 buf 0 8 8 +ret 74 +end +ret 0 +end +for row ulong 256 +if or eq which 48 eq which 52 +for col ulong 256 +v = ulong 56 +if ne rem add row col 2 0 +v = add v 128 +end +if eq which 52 +if and eq row 255 eq col 255 +v = 127 +end +end +put buf col uchar v +end +if ne write 1 buf 0 256 256 +ret 74 +end +end +if eq which 50 +for col ulong 128 +v = ulong 230 +sign = xor rem row 2 div col 64 +if ne sign 0 +v = 110 +end +put buf col uchar v +end +if ne write 1 buf 0 128 128 +ret 74 +end +end +if eq which 51 +for col ulong 8 +put buf col uchar add 125 add mul div row 128 2 div col 4 +end +if ne write 1 buf 0 8 8 +ret 74 +end +end +end +ret 0 +end diff --git a/native/w4/stream.om b/native/w4/stream.om new file mode 100644 index 00000000..9d09a3ad --- /dev/null +++ b/native/w4/stream.om @@ -0,0 +1,55 @@ +note SPDX-License-Identifier: AGPL-3.0-only +note Diagnostic group stream:35-byte requests,20-byte replies. Not checkpoint IO. +note Request rule:u8,scale:u16le,32E4M3FN bytes. Reply status,E,16packed,clip,zero. +note Batch transport is bounded to512 groups, emitting every complete input frame. +global request uchar 17920 +global reply uchar 10240 +fn frame index ulong to void +src = mul index 35 +dst = mul index 20 +for i ulong 32 +put qinput i get request add add src i 3 +end +scale = or ulong get request add src 1 shl ulong get request add src 2 8 +status = qpack scale ulong get request src +put reply dst uchar status +put reply add dst 1 uchar get qmeta 1 +for i ulong 16 +put reply add add dst i 2 get qoutput i +end +put reply add dst 18 uchar get qmeta 3 +put reply add dst 19 uchar get qmeta 2 +end +fn main to int +have = ulong 0 +while eq ulong 1 1 +count = read 0 request have sub 17920 have +if lt count 0 +ret 74 +end +if eq count 0 +if eq have 0 +ret 0 +end +ret 65 +end +total = add have ulong count +frames = div total 35 +for i ulong frames +frame i +end +sent = ulong 0 +while lt sent mul frames 20 +count = write 1 reply sent sub mul frames 20 sent +if le count 0 +ret 74 +end +sent = add sent ulong count +end +have = sub total mul frames 35 +for i ulong have +put request i get request add mul frames 35 i +end +end +ret 0 +end diff --git a/native/w4/tensor.om b/native/w4/tensor.om new file mode 100644 index 00000000..e1e6c0f8 --- /dev/null +++ b/native/w4/tensor.om @@ -0,0 +1,224 @@ +note SPDX-License-Identifier: AGPL-3.0-only +note Raw tensor converter. argv: FP8,BF16,packed,E8,n,k,rule. Outputs exclusive. +note Exact historical row-major source and scale[r/128][c/128] layout. +global paths uchar 16384 +global sizes ulong 4 +global fds long 4 +global made uchar 2 +global dims ulong 3 +global inrow uchar 32768 +global scrow uchar 512 +global outrow uchar 16384 +global erow uchar 1024 +global digits uchar 24 + +fn number index ulong to long +count = argread index digits 0 len digits +if or le count 0 gt count 10 +ret neg long 1 +end +value = ulong 0 +for i ulong ulong count +digit = ulong get digits i +if or lt digit 48 gt digit 57 +ret neg long 1 +end +value = add mul value 10 sub digit 48 +end +ret long value +end + +fn exact fd int count ulong to int +have = ulong 0 +while lt have count +nread = read fd inrow have sub count have +if lt nread 0 +ret 74 +end +if eq nread 0 +ret 65 +end +have = add have ulong nread +end +ret 0 +end + +fn flush fd int count ulong to int +sent = ulong 0 +while lt sent count +nwrote = write fd outrow sent sub count sent +if le nwrote 0 +ret 74 +end +sent = add sent ulong nwrote +end +ret 0 +end + +fn finish status int to int +for i ulong 4 +if ge get fds i 0 +rc = fclose int get fds i +if ne rc 0 +status = 74 +end +put fds i neg long 1 +end +end +if ne status 0 +for i ulong 2 +if ne get made i 0 +rc = unlink paths mul add i 2 4096 get sizes add i 2 +if ne rc 0 +status = 74 +end +end +end +end +ret status +end + +fn setup to int +if ne argcnt 8 +ret 64 +end +for i ulong 4 +n = argread add i 1 paths mul i 4096 4096 +if le n 0 +ret 64 +end +put sizes i ulong n +end +for i ulong 3 +value = number add i 5 +if lt value 0 +ret 64 +end +put dims i ulong value +end +nrow = get dims 0 +width = get dims 1 +if or eq nrow 0 gt nrow 524288 +ret 65 +end +if or ne rem nrow 128 0 ne rem width 128 0 +ret 65 +end +if or eq width 0 gt width 32768 +ret 65 +end +if gt get dims 2 2 +ret 69 +end +for i ulong 2 +fd = fopen paths mul i 4096 get sizes i 0 0 +if lt fd 0 +ret 74 +end +put fds i fd +want = mul nrow width +if eq i 1 +want = mul div nrow 128 mul div width 128 2 +end +size = fseek int fd 0 2 +if ne size long want +ret 65 +end +if ne fseek int fd 0 0 0 +ret 74 +end +end +for i ulong 2 +index = add i 2 +fd = fopen paths mul index 4096 get sizes index 193 384 +if lt fd 0 +ret 74 +end +put fds index fd +put made i 1 +end +ret 0 +end + +fn packrow to int +width = get dims 1 +rc = exact int get fds 0 width +if ne rc 0 +ret rc +end +for group ulong div width 32 +for c ulong 32 +put qinput c get inrow add mul group 32 c +end +sindex = mul div group 4 2 +scale = or ulong get scrow sindex shl ulong get scrow add sindex 1 8 +rc = qpack scale get dims 2 +if ne rc 0 +ret rc +end +for c ulong 16 +put outrow add mul group 16 c get qoutput c +end +put erow group uchar get qmeta 1 +end +rc = flush int get fds 2 div width 2 +if ne rc 0 +ret rc +end +for i ulong div width 32 +put outrow i get erow i +end +ret flush int get fds 3 div width 32 +end + +fn scales to int +rc = exact int get fds 1 mul div get dims 1 128 2 +if ne rc 0 +ret rc +end +for i ulong mul div get dims 1 128 2 +put scrow i get inrow i +end +ret 0 +end + +fn convert to int +for row ulong get dims 0 +if eq rem row 128 0 +rc = scales +if ne rc 0 +ret rc +end +end +rc = packrow +if ne rc 0 +ret rc +end +end +for i ulong 2 +count = read int get fds i digits 0 1 +if lt count 0 +ret 74 +end +if ne count 0 +ret 65 +end +end +for i ulong 2 +if ne fsync int get fds add i 2 0 +ret 74 +end +end +ret 0 +end + +fn main to int +for i ulong 4 +put fds i neg long 1 +end +status = setup +if ne status 0 +ret finish status +end +ret finish convert +end diff --git a/native/w4/tests.om b/native/w4/tests.om new file mode 100644 index 00000000..cc1a5e09 --- /dev/null +++ b/native/w4/tests.om @@ -0,0 +1,189 @@ +note SPDX-License-Identifier: AGPL-3.0-only +global tests ulong 1 +global fails ulong 1 +fn assert got ulong want ulong to void +put tests 0 add get tests 0 1 +if ne got want +put fails 0 add get fails 0 1 +end +end +fn number value ulong to void +b = new uchar 32 0 +n = ulong 0 +v = value +while ge v 10 +put b n uchar add rem v 10 48 +n = add n 1 +v = div v 10 +end +put b n uchar add v 48 +n = add n 1 +while gt n 0 +n = sub n 1 +w = write 1 b n 1 +end +put b 0 10 +w = write 1 b 0 1 +end +fn fill value ulong to void +for i ulong 32 +put qinput i uchar value +end +end +fn cleared to void +assert get qmeta 0 0 +for i ulong 16 +assert ulong get qoutput i 0 +end +end +fn uniform bits ulong exponent ulong to void +fill bits +status = qpack shl exponent 7 0 +mag = and bits 127 +if eq mag 127 +assert ulong status 76 +cleared +ret +end +if eq mag 0 +assert ulong status 0 +assert get qmeta 1 127 +assert get qmeta 2 1 +for i ulong 16 +assert ulong get qoutput i 0 +end +ret +end +e = add shr mag 3 118 +code = ulong 6 +if ge mag 8 +if gt and mag 7 2 +code = 7 +end +else +if eq mag 1 +e = 116 +else +if le mag 3 +e = 117 +else +e = 118 +end +end +if eq mag 3 +code = 7 +end +if ge mag 6 +code = 7 +end +end +e = add e exponent +if lt e 127 +assert ulong status 75 +cleared +ret +end +e = sub e 127 +if gt e 192 +assert ulong status 75 +cleared +ret +end +assert ulong status 0 +assert get qmeta 0 1 +assert get qmeta 1 e +code = or code shl shr bits 7 3 +for i ulong 16 +assert ulong get qoutput i mul code 17 +end +end +fn main to int +note Exact homogeneous OCP answers from the FP8 encoding, independently tabulated. +for exponent ulong 254 +for bits ulong 256 +uniform bits add exponent 1 +end +end +note Exact representable 0,0.5,1,1.5,2,3,4,6 packed low nibble first. +codes = new uchar 8 0 +put codes 1 48 +put codes 2 56 +put codes 3 60 +put codes 4 64 +put codes 5 68 +put codes 6 72 +put codes 7 76 +for i ulong 32 +v = get codes rem i 8 +if ge i 16 +v = uchar or ulong v 128 +end +put qinput i v +end +for rule ulong 3 +assert ulong qpack 16256 rule 0 +assert get qmeta 1 127 +assert get qmeta 3 0 +assert get qmeta 4 0 +for i ulong 16 +lo = rem mul i 2 8 +hi = add lo 1 +if ge i 8 +if ne lo 0 +lo = or lo 8 +end +hi = or hi 8 +end +assert ulong get qoutput i or lo shl hi 4 +end +end +note Signed BF16 scale reverses nonzero signs. +fill 56 +assert ulong qpack 49024 0 0 +assert ulong get qoutput 0 238 +note FIT expands a clipping group while BEST chooses the lower squared error. +fill 62 +assert ulong qpack 16256 0 0 +assert get qmeta 1 125 +assert get qmeta 3 32 +assert ulong get qoutput 0 119 +assert ulong qpack 16256 1 0 +assert get qmeta 1 126 +assert get qmeta 3 0 +assert ulong get qoutput 0 102 +assert ulong qpack 16256 2 0 +note Uniform 1.75 is equally distant from1.5 and2. BEST retains OCP on ties. +assert get qmeta 1 125 +fill 63 +assert ulong qpack 16256 2 0 +assert get qmeta 1 126 +note Every position rejects NaN, even under a zero BF16 scale. +for i ulong 32 +fill 56 +put qinput i 127 +assert ulong qpack 0 0 76 +cleared +end +fill 56 +assert ulong qpack 32640 0 76 +cleared +assert ulong qpack 65408 0 76 +cleared +assert ulong qpack 65536 0 65 +cleared +assert ulong qpack 16256 3 69 +cleared +note All-zero subnormal and negative-zero scale are canonical zero groups. +fill 128 +assert ulong qpack 1 0 0 +assert get qmeta 2 1 +fill 56 +assert ulong qpack 32768 0 0 +assert get qmeta 2 1 +number get tests 0 +number get fails 0 +if ne get fails 0 0 +ret 1 +end +ret 0 +end diff --git a/tests/gates/run.sh b/tests/gates/run.sh index cb63fb4a..761ceb03 100755 --- a/tests/gates/run.sh +++ b/tests/gates/run.sh @@ -125,6 +125,25 @@ case "$step" in cargo test -p aien-inference-abi --lib --test attention_wiring --test transformer_parity -- --test-threads=1 cargo test -p aien-inference-runtime --test strict_real_model -- --test-threads=1 ;; + native-w4) + # Qualified seeded compiler is separate from the legacy linked-compose pin. + # No network fetch or fallback to another compiler/profile. + omega_native_sha="$(tr -d '[:space:]' < native/w4/compiler.lock)" + [[ "$omega_native_sha" =~ ^[0-9a-f]{40}$ ]] || exit 3 + pin omega-w4-native omega "$omega_native_sha" + compiler_root="$(cd "$PINS/omega-w4-native" && pwd)" + (cd "$compiler_root" && sha256sum -c "$ROOT/native/w4/compiler.sha256") || exit 3 + [ -x "$compiler_root/seed/out/omc" ] || exit 3 + mkdir -p "$TARGET" + stage="$(mktemp -d "$TARGET/w4-check.XXXXXX")" + stage="$(cd "$stage" && pwd)" + mkdir -p "$stage/native" "$stage/build" + cp -R native/w4 "$stage/native/w4" + timeout --kill-after=2 30 "$compiler_root/seed/out/omc" < "$stage/native/w4/gate.om" > "$stage/gate.elf" + chmod 700 "$stage/gate.elf" + cd "$stage" + exec "$stage/gate.elf" "$compiler_root/seed/out/omc" + ;; zero-cuda) bash scripts/zero-cuda-gate.sh --self-test cargo build -p aien-cli diff --git a/tests/gates/sc-native-w4.gate b/tests/gates/sc-native-w4.gate new file mode 100644 index 00000000..6d454991 --- /dev/null +++ b/tests/gates/sc-native-w4.gate @@ -0,0 +1,21 @@ +# Native host qualification for issue711. No device or model-speed claim. +gate: SC-NATIVE-W4 +manifest_version: 2 +owner: aien-sovereign-core +requires: + - host +inputs: + - native/w4/ + - evidence/w4-711/ + - tests/gates/run.sh + - tests/gates/sc-native-w4.gate +run: + exec: tests/gates/run.sh + args: ["native-w4"] +expects: + exit: 0 + observe: ["w4_groups == 15"] + verdict: PASS +timeout: 5m +exactness: EXACT +cache_scope: machine