Upload 40 files
Browse filesFiles changed (40)
- .gitattributes-34
- .gitignoreAdded+9
- LICENSEAdded+202
- PUBLISHING.mdAdded+26
- README.md+227
- THIRD_PARTY_NOTICES.mdAdded+17
- config.jsonAdded+12
- evaluation/EXCLUDED_ARTIFACTS.mdAdded+15
- evaluation/benchmark.jsonAdded+186
- evaluation/fresh_test.jsonAdded+334
- evaluation/portability.jsonAdded+30
- evaluation/preparation.jsonAdded+52
- evaluation/regression.jsonAdded+28
- evaluation/validation.jsonAdded+329
- examples/batch_example.pyAdded+6
- examples/compile_example.pyAdded+3
- examples/inspect_example.pyAdded+4
- manifest.jsonAdded
- neuro_compiler/__init__.pyAdded+4
- neuro_compiler/cli.pyAdded+18
- neuro_compiler/compiler.pyAdded+86
- neuro_compiler/neurocc.pyAdded+48
- neuro_compiler/neurocc_ast.pyAdded+102
- neuro_compiler/neurocc_backend_trace.pyAdded+38
- neuro_compiler/neurocc_binary.pyAdded+113
- neuro_compiler/neurocc_ir_unfolded.pyAdded+47
- neuro_compiler/neurocc_isel.pyAdded+44
- neuro_compiler/neurocc_isel_v2.pyAdded+41
- neuro_compiler/neurocc_live_v2.pyAdded+129
- neuro_compiler/neurocc_regalloc.pyAdded+48
- neuro_compiler/neurocc_regalloc_v2.pyAdded+23
- neuro_compiler/verification.pyAdded+10
- pyproject.tomlAdded+21
- requirements.txtAdded+4
- tests/test_contract.pyAdded+19
- weights/ast.safetensorsAdded+3
- weights/binary.safetensorsAdded+3
- weights/isel.safetensorsAdded+3
- weights/regalloc.safetensorsAdded+3
- weights/ssa.safetensorsAdded+3
1234567891011121314151617181920212223242526272829303132333435*.7z filter=lfs diff=lfs merge=lfs -text*.arrow filter=lfs diff=lfs merge=lfs -text*.bin filter=lfs diff=lfs merge=lfs -text*.bz2 filter=lfs diff=lfs merge=lfs -text*.ckpt filter=lfs diff=lfs merge=lfs -text*.ftz filter=lfs diff=lfs merge=lfs -text*.gz filter=lfs diff=lfs merge=lfs -text*.h5 filter=lfs diff=lfs merge=lfs -text*.joblib filter=lfs diff=lfs merge=lfs -text*.lfs.* filter=lfs diff=lfs merge=lfs -text*.mlmodel filter=lfs diff=lfs merge=lfs -text*.model filter=lfs diff=lfs merge=lfs -text*.msgpack filter=lfs diff=lfs merge=lfs -text*.npy filter=lfs diff=lfs merge=lfs -text*.npz filter=lfs diff=lfs merge=lfs -text*.onnx filter=lfs diff=lfs merge=lfs -text*.ot filter=lfs diff=lfs merge=lfs -text*.parquet filter=lfs diff=lfs merge=lfs -text*.pb filter=lfs diff=lfs merge=lfs -text*.pickle filter=lfs diff=lfs merge=lfs -text*.pkl filter=lfs diff=lfs merge=lfs -text*.pt filter=lfs diff=lfs merge=lfs -text*.pth filter=lfs diff=lfs merge=lfs -text*.rar filter=lfs diff=lfs merge=lfs -text*.safetensors filter=lfs diff=lfs merge=lfs -textsaved_model/**/* filter=lfs diff=lfs merge=lfs -text*.tar.* filter=lfs diff=lfs merge=lfs -text*.tar filter=lfs diff=lfs merge=lfs -text*.tflite filter=lfs diff=lfs merge=lfs -text*.tgz filter=lfs diff=lfs merge=lfs -text*.wasm filter=lfs diff=lfs merge=lfs -text*.xz filter=lfs diff=lfs merge=lfs -text*.zip filter=lfs diff=lfs merge=lfs -text*.zst filter=lfs diff=lfs merge=lfs -text*tfevents* filter=lfs diff=lfs merge=lfs -text1*.safetensors filter=lfs diff=lfs merge=lfs -text
123456789__pycache__/*.pyc.venv/*.egg-info/build/dist/.env*.pt.cache/123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202
Apache License Version 2.0, January 2004 http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction, and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all other entities that control, are controlled by, or are under common control with that entity. For the purposes of this definition, "control" means (i) the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or (ii) ownership of fifty percent (50%) or more of the outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications, including but not limited to software source code, documentation source, and configuration files.
"Object" form shall mean any form resulting from mechanical transformation or translation of a Source form, including but not limited to compiled object code, generated documentation, and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or Object form, made available under the License, as indicated by a copyright notice that is included in or attached to the work (an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object form, that is based on (or derived from) the Work and for which the editorial revisions, annotations, elaborations, or other modifications represent, as a whole, an original work of authorship. For the purposes of this License, Derivative Works shall not include works that remain separable from, or merely link (or bind by name) to the interfaces of, the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including the original version of the Work and any modifications or additions to that Work or Derivative Works thereof, that is intentionally submitted to Licensor for inclusion in the Work by the copyright owner or by an individual or Legal Entity authorized to submit on behalf of the copyright owner. For the purposes of this definition, "submitted" means any form of electronic, verbal, or written communication sent to the Licensor or its representatives, including but not limited to communication on electronic mailing lists, source code control systems, and issue tracking systems that are managed by, or on behalf of, the Licensor for the purpose of discussing and improving the Work, but excluding communication that is conspicuously marked or otherwise designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity on behalf of whom a Contribution has been received by Licensor and subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable copyright license to reproduce, prepare Derivative Works of, publicly display, publicly perform, sublicense, and distribute the Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of this License, each Contributor hereby grants to You a perpetual, worldwide, non-exclusive, no-charge, royalty-free, irrevocable (except as stated in this section) patent license to make, have made, use, offer to sell, sell, import, and otherwise transfer the Work, where such license applies only to those patent claims licensable by such Contributor that are necessarily infringed by their Contribution(s) alone or by combination of their Contribution(s) with the Work to which such Contribution(s) was submitted. If You institute patent litigation against any entity (including a cross-claim or counterclaim in a lawsuit) alleging that the Work or a Contribution incorporated within the Work constitutes direct or contributory patent infringement, then any patent licenses granted to You under this License for that Work shall terminate as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the Work or Derivative Works thereof in any medium, with or without modifications, and in Source or Object form, provided that You meet the following conditions:
(a) You must give any other recipients of the Work or Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works that You distribute, all copyright, patent, trademark, and attribution notices from the Source form of the Work, excluding those notices that do not pertain to any part of the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its distribution, then any Derivative Works that You distribute must include a readable copy of the attribution notices contained within such NOTICE file, excluding those notices that do not pertain to any part of the Derivative Works, in at least one of the following places: within a NOTICE text file distributed as part of the Derivative Works; within the Source form or documentation, if provided along with the Derivative Works; or, within a display generated by the Derivative Works, if and wherever such third-party notices normally appear. The contents of the NOTICE file are for informational purposes only and do not modify the License. You may add Your own attribution notices within Derivative Works that You distribute, alongside or as an addendum to the NOTICE text from the Work, provided that such additional attribution notices cannot be construed as modifying the License.
You may add Your own copyright statement to Your modifications and may provide additional or different license terms and conditions for use, reproduction, or distribution of Your modifications, or for any such Derivative Works as a whole, provided Your use, reproduction, and distribution of the Work otherwise complies with the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise, any Contribution intentionally submitted for inclusion in the Work by You to the Licensor shall be under the terms and conditions of this License, without any additional terms or conditions. Notwithstanding the above, nothing herein shall supersede or modify the terms of any separate license agreement you may have executed with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade names, trademarks, service marks, or product names of the Licensor, except as required for reasonable and customary use in describing the origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or agreed to in writing, Licensor provides the Work (and each Contributor provides its Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied, including, without limitation, any warranties or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A PARTICULAR PURPOSE. You are solely responsible for determining the appropriateness of using or redistributing the Work and assume any risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory, whether in tort (including negligence), contract, or otherwise, unless required by applicable law (such as deliberate and grossly negligent acts) or agreed to in writing, shall any Contributor be liable to You for damages, including any direct, indirect, special, incidental, or consequential damages of any character arising as a result of this License or out of the use or inability to use the Work (including but not limited to damages for loss of goodwill, work stoppage, computer failure or malfunction, or any and all other commercial damages or losses), even if such Contributor has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing the Work or Derivative Works thereof, You may choose to offer, and charge a fee for, acceptance of support, warranty, indemnity, or other liability obligations and/or rights consistent with this License. However, in accepting such obligations, You may act only on Your own behalf and on Your sole responsibility, not on behalf of any other Contributor, and only if You agree to indemnify, defend, and hold each Contributor harmless for any liability incurred by, or claims asserted against, such Contributor by reason of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following boilerplate notice, with the fields enclosed by brackets "[]" replaced with your own identifying information. (Don't include the brackets!) The text should be enclosed in the appropriate comment syntax for the file format. We also recommend that a file or class name and description of purpose be included on the same "printed page" as the copyright notice for easier identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.1234567891011121314151617181920212223242526# Publication after owner review
No upload has been performed. Run these commands only after reviewing thisdirectory and explicitly authorizing publication. Upload only this directory,not its parent (which contains private audit data and PyTorch checkpoints).
```bashhf auth loginhf repo create orthagonal/neuro-compiler --repo-type model --privatehf upload orthagonal/neuro-compiler . --repo-type model```
Run from the `release/neuro-compiler` directory. If the model repository alreadyexists, omit `repo create`. The private flag preserves review access controls;changing repository visibility is a separate owner action after approval.
Local installation before publication:
```bashpython -m pip install '.[evaluation]'neuro-compiler --model . --source 'unsigned f(unsigned a,unsigned b,unsigned c){return (a+b);}' --verifypython -m unittest discover -s tests```
The pip package contains inference code; the directory's SafeTensors weightsare loaded through `--model .` or `from_pretrained`, not embedded into the wheel.123---license: apache-2.0---123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230---language:- enlicense: apache-2.0library_name: neuro_compilerbase_model: Qwen/Qwen2.5-Coder-0.5Btags:- neural-compiler- experimental- non-autoregressive- x86-64model-index:- name: neuro-compilerresults: []---# neuro-compiler · 0.1.0-experimentalNeuro-Compiler is an experimental, non-autoregressive neural compiler thattranslates a restricted subset of C++ directly into x86-64 machine code througha series of specialized neural networks. Rather than generating assembly text,it learns successive compilation transformations through syntax trees,intermediate representations, instruction selection, register allocation andbinary encoding.This is a research proof of concept and work in progress, not a production-readycompiler. Generated machine code may be incorrect or unsafe. No semanticcorrectness is guaranteed. Never execute untrusted generated code natively.## Research architecture```textC++ source → frozen Qwen blocks 1–6 → neural AST → neural unfolded SSA→ neural instruction selection → neural register allocation→ neural binary generation → x86-64 SysV machine-code bytes```Internal architecture: NeuroCC V2. Stage modes are `deps_w128`, `deps_w128`,`discrete_copy_w128`, `aligned_copy_w128`, and `copy_w128`, respectively. No V3register allocator is included. All stages predict in parallel, withoutautoregressive decoding. Inference uses tensor operations and learned encodingtemplate lookup/packing; it has no conventional compiler, assembler, semanticoracle, deterministic instruction selector, or allocator.The backbone is **Qwen/Qwen2.5-Coder-0.5B**, pinned to revision`0576a1bc0ae53f21860e905e081807bd7ff4a4c7`. The loader downloads that revisionfrom Hugging Face and retains its first six blocks; full base weights may bedownloaded before unused blocks are discarded. The remaining backbone has225,608,960 parameters. Specialized stages have 3,934,092 parameters.Weights are unquantized and retain trained dtypes. CUDA Qwen uses FP16 andFP16 autocast; specialized computation uses FP32 with explicit FP16 stageboundaries, including before discrete head decoding. CPU Qwen uses FP32;cross-device byte identity is not assumed.## Installation and useUse Python 3.10 or newer. Install a PyTorch build suitable for your CPU or CUDAdevice first. The measured environment used Python 3.14, PyTorch 2.13.0+cu132,Transformers 4.57.6, SafeTensors 0.8.0 and Hugging Face Hub 0.36.2. Other PyTorchversions satisfy the install bounds but have not been regression-tested here.```bashhf download orthagonal/neuro-compiler --local-dir neuro-compilerpython -m pip install ./neuro-compiler# Optional sampled semantic verification:python -m pip install './neuro-compiler[evaluation]'``````pythonfrom neuro_compiler import NeuralCompilercompiler = NeuralCompiler.from_pretrained('orthagonal/neuro-compiler', device='cuda')# A downloaded local directory also works:# compiler = NeuralCompiler.from_pretrained('./neuro-compiler', device='cpu')source = 'unsigned f(unsigned a,unsigned b,unsigned c){return ((a+b)*(c-7u));}'machine_code = compiler.compile(source)print(machine_code.hex(' '))results = compiler.compile_batch([source, source], batch_size=32)result = compiler.compile(source, return_intermediates=True)print(result.ast, result.ssa, result.virtual_mir, result.physical_mir)print(result.machine_code)``````bashneuro-compiler --model ./neuro-compiler --file example.cpp --device cudaneuro-compiler --model ./neuro-compiler --source 'unsigned f(unsigned a,unsigned b,unsigned c){return (a+b);}' --output f.bin --verify```There is no native execution interface or Windows executable packaging in thisrelease. Output targets **x86-64 SysV**, not the Windows x64 calling convention.CUDA and CPU are supported. Empty/malformed byte output raises an error. Sourcecapacity is 192 UTF-8 bytes and 96 Qwen tokens; oversized inputs are rejected,never silently truncated. Lexical checks detect some unsupported inputs, butacceptance is not a guarantee that an input belongs to the trained grammar.## Intermediate representations`result.ast` contains breadth-first node class IDs and FP16 latent features.`ssa` contains opcode, operand-address and unsigned constant tensors. VirtualMIR contains signature IDs, virtual operand references and immediates. PhysicalMIR contains signature IDs, register IDs, immediates and stack fields. All thesepublic intermediate tensors are moved to CPU. Exact vocabularies, dimensions,mask conventions, operand reference conventions, and binary templates are in`manifest.json` and the inference modules. They are embedded in configurationsrather than duplicated into separate vocabulary files. SSA references useargument IDs 1–3, instruction IDs beginning at 4, constant ID 12, and padding 0.## Supported source grammarThe dataset generator uses the signature`unsigned f(unsigned a,unsigned b,unsigned c){return EXPR;}`. Expressions arefully parenthesized balanced binary trees of depth 1–3, with leaves `a`, `b`,`c`, or unsigned literals `1u` through `63u`. Operators are `+`, `-`, `*`, `^`,`&`, `|`; arithmetic wraps at 32 bits. Up to seven arithmetic nodes plus returnfit the eight-slot unfolded SSA. Formatting different from training is notvalidated for accuracy.There is no general control flow, loops, arbitrary calls, pointers, division,signed or floating-point arithmetic, arbitrary trees, or full C++ support.Spills remain a major weakness. A syntactically accepted source may yieldsemantically wrong machine code.## Training and release provenanceThe original synthetic corpus contains 10,000 unique balanced expressionfunctions: 8,000 training, 1,000 validation and 1,000 original test rows. FrozenQwen features feed progressively trained specialized stages, with compilertraces used only as training/reference labels. V2 instruction selection andregister allocation learn operand-addressed copying; binary prediction learnstemplates and payloads. Dataset fingerprint and checkpoint hashes are recordedin the manifest. Training data, traces and activation caches are not included.During release preparation, the retained original register-allocation cachematched the historical binary decoder's training cache SHA-256 exactly. Thecurrent best allocator was epoch 171, whereas the historical allocator wasepoch 165. Regenerating all 9,000 train/validation rows found 17,254,761 differingFP16 feature elements and 66 signature, 163 register, and 21 immediateprediction differences. Stack predictions matched. Consequently the historicalbinary decoder was not reused. Only the V2 binary decoder was retrained, for50 epochs with seed 42, using a separately regenerated and hash-validatedallocator cache. No upstream network was retrained. Historical checkpoints,caches and results were backed up and preserved.## Verification and reproducibilitySuccessful serialization establishes only valid byte/EOS/padding structure.Complete Capstone disassembly establishes decoding into supported straight-lineinstructions. Unicorn checks compare sampled inputs to a separate restrictedsource oracle. None constitutes formal verification. Optional evaluation isseparate from inference and never corrects model predictions:```pythonfrom neuro_compiler.verification import verifyreport = verify(source, machine_code, samples=32)print(report['disassembled'], report['semantic'])```The local preparation tools `neurocc_release_recover.py`,`neurocc_release_validate.py`, `neurocc_release_evaluate.py`, and`neurocc_export.py` remain in the development checkout. They require privatetraining artifacts and are not runtime dependencies. Frozen checkpoint hashesare in the manifest. SafeTensors exports are checked for exact tensor and dtyperound trips. Full stage and semantic comparisons against the live V2implementation are reported in `evaluation/regression.json`.Fresh evaluation uses the original generator, seed 20261126, excludes alloriginal source strings and preserves original test-depth proportions. Sampledlive verification uses 32 inputs (eight edge cases plus seeded random triples)per function, seed 20261125. Fresh-test summary includes the generated sourcedigest. Fresh results must not be used to tune this release.## Measured release results| Metric | Historical V2 validation | This release validation | Fresh source-disjoint test || --- | ---: | ---: | ---: || Functions | 1,000 | 1,000 | 1,000 || Exact unoptimized reference bytes | 97.1% | 97.4% | Not measured || Sampled semantic correctness | 97.7% | 97.7% | 97.3% || Completely disassembled | 99.9% | 99.9% | 99.8% || Serializable | 100% | 100% | 100% |Each semantic evaluation uses 32 input triples per function. New cached versuslive byte agreement is 100%. Packaged versus new live V2 predictions matchexactly on all 1,000 validation functions at every stage, including ASTpredictions, SSA, virtual MIR, physical MIR, final bytes and semantic outcomes.The new compiler matches historical V2 bytes on 976/1,000 functions: **24 outputschanged**. Equal aggregate semantic accuracy does not imply identical programs.The original V2 runtime benchmark of this release's weights measured 648.07candidates/second and 633.16 sampled-correct candidates/second on an NVIDIAGeForce RTX 2060 SUPER and Intel Core i9-10850K, batch 32, three repeats over1,000 functions. Median inference time was 1.5431 seconds; peak CUDA allocationwas 562.59 MiB. Timing includes tokenization, GPU inference, CPU transfer andserialization; it excludes initialization, verification and disk I/O. Correctthroughput is candidate throughput multiplied by the separately measured sampledsemantic rate. These are newly measured V2 results; no V1 timing is used.Packaged CUDA initialization measured 4.586 seconds in the standalone smoketest with locally cached backbone files; CPU initialization measured 1.034seconds afterward in the same process. The warmed second-model initializationin the regression harness was 1.206 seconds. These are not first-download times.CPU and CUDA both compiled, batched, exposed intermediates and passed sampledverification for the documented quick-start source. Full regression was CUDAonly. An installed wheel ran outside the checkout while audit hooks deniedaccess to the development directory and original artifact storage. The separatevirtual environment shared system CUDA dependencies; a fully isolated dependencyinstallation was not tested. See the JSON reports in `evaluation/`.SafeTensors sizes: AST 2,897,832 bytes; SSA 3,275,072; ISEL 3,228,664;register allocation 3,029,992; binary 3,331,152. Combined: 15,762,712 bytes,including SafeTensors headers and state metadata. No Qwen weights are bundled.## Limitations and future workAccuracy is measured on a narrow synthetic grammar. Validation was used forcheckpoint selection; it is not an independent generalization estimate.Batch-size and numerical backend changes may change predictions. No throughputadvantage over conventional compilers has been established. Historical V1benchmark claims are not measurements of this release.Research directions include variable-sized graphs, learned pointers, arbitraryexpression trees, control flow and pluggable hardware backends. These are plans,not implemented capabilities. The long-term objective is to study whether GPUparallelism can outperform conventional compilation while preserving semantics.## License and attributionApache-2.0 for project code and specialized trained weights, authorized by theproject owner. Qwen attribution and optional dependency licensing are describedin `THIRD_PARTY_NOTICES.md`. Qwen weights and third-party source are not bundled.
1234567891011121314151617# Third-party components and release licensing
The frozen backbone is Qwen/Qwen2.5-Coder-0.5B, revision0576a1bc0ae53f21860e905e081807bd7ff4a4c7. Its weights and tokenizer are downloadedfrom Hugging Face rather than redistributed here. See the upstream model cardand license: https://huggingface.co/Qwen/Qwen2.5-Coder-0.5B .
Runtime dependencies are separately installed: PyTorch (BSD-style license),Transformers (Apache-2.0), SafeTensors (Apache-2.0), Hugging Face Hub(Apache-2.0). Optional Capstone and Unicorn have their own BSD and GPL-familylicensing terms respectively; they are evaluation dependencies, not bundled code.Consult the installed versions' license files before redistributing them.
The project owner authorized Apache-2.0 for project code and specialized trainedweights during release preparation. See LICENSE. The pinned Qwen revision'sHugging Face model metadata declares Apache-2.0; its snapshot does not containa separate LICENSE file. Its model card links to the upstream license.123456789101112{
"architecture": "NeuroCC V2",
"package_version": "0.1.0.dev0",
"spec": {
"backbone": "Qwen/Qwen2.5-Coder-0.5B",
"revision": "0576a1bc0ae53f21860e905e081807bd7ff4a4c7",
"tokens": 96,
"depths": [
6
]
}
}123456789101112131415# Excluded from publication
Original and regenerated training datasets; Qwen activation caches; stagelatent/prediction caches; LLVM IR, MIR and compilation traces; optimizer andresume checkpoints; all original PyTorch checkpoints; V1 models; V3 and otherarchitectural experiments; training scripts; full training histories; executabledemos; screenshots; development logs; local inventory and backup manifests;credentials/environment files; Python caches; build and packaging intermediates.
Frozen PyTorch checkpoint copies are retained separately in the developmentcheckout under `release/checkpoints-v2`, with SHA-256 lock metadata and read-onlyfile attributes. They are not needed by the public SafeTensors runtime and mustnot be uploaded. The complete original project/artifact backup is outside thisrelease. Selected evaluation summaries contain small failure examples, not thetraining corpus or fresh-evaluation source dataset.123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186{
"pipeline": {
"compiler_version": "v2",
"abi": "x86_64 SysV",
"spec": {
"backbone": "Qwen/Qwen2.5-Coder-0.5B",
"revision": "0576a1bc0ae53f21860e905e081807bd7ff4a4c7",
"tokens": 96,
"depths": [
6
]
},
"fingerprint": "b8dd5570bd628cdad71bcb8bbffc76de11cd46f7b5d3be0cc4e3ad0bb2997e31",
"device": "cuda",
"checkpoints": {
"ast": {
"sha256": "e753e8ab8e997ebe48e166e6b0f2380bb3ab450c087871c4d740eef2326897e3",
"mode": "deps",
"epoch": 12
},
"ir": {
"sha256": "90bea9167a71409202397e2543c5c8beecd5a4a2d1169b268337db0175536244",
"mode": "deps",
"epoch": 15
},
"isel": {
"sha256": "d95f10f3bca327e65cb3c1e716d1b85d3db1addea2f144b40709809c27c9ff61",
"mode": "discrete_copy",
"epoch": 37
},
"regalloc": {
"sha256": "48f77152cff7532ebff835b4d0b15d603504de20f34378ab29634a4c3e83e582",
"mode": "aligned_copy",
"epoch": 171
},
"binary": {
"sha256": "3159a286d3b021fb62fec303648545c4abb9a8ad44a27246e02f75420bc58c4b",
"mode": "copy",
"epoch": 43
}
},
"precision": "Qwen cache precision; FP16 boundaries, FP32 specialized stages",
"specialized_parameters": 3934092,
"backbone_parameters": 225608960,
"binary_validation": {
"n": 1000,
"exact": 0.9739999771118164,
"byte_accuracy": 0.976840078830719,
"count_accuracy": 0.9900000095367432,
"template_accuracy": 0.9810349345207214,
"template_exact": 0.9779999852180481,
"payload_byte_accuracy_given_template": 0.9982773661613464,
"immediate_byte_accuracy_given_template": 0.9982691407203674,
"displacement_byte_accuracy_given_template": 1.0,
"spill_exact": 0.1538461595773697,
"spill_n": 13,
"nonspill_exact": 0.9848024249076843,
"semantic32": 0.977,
"semantic_accuracy": 0.977,
"semantic_n": 1000,
"inputs_per_function": 32,
"fully_disassembled": 0.999,
"semantic_failure_examples": [
{
"row": 8139,
"reason": "row 8139: emulator mismatch on (0, 0, 0), 13 != 122"
},
{
"row": 8143,
"reason": "row 8143: emulator mismatch on (0, 0, 0), 0 != 7"
},
{
"row": 8202,
"reason": "row 8202: emulator mismatch on (1, 1, 1), 1 != 15"
},
{
"row": 8225,
"reason": "row 8225: emulator mismatch on (1, 1, 1), 57 != 58"
},
{
"row": 8232,
"reason": "row 8232: emulator mismatch on (0, 4294967295, 1), 0 != 150"
},
{
"row": 8234,
"reason": "row 8234: emulator mismatch on (0, 0, 0), 1206 != 582"
},
{
"row": 8297,
"reason": "row 8297: emulator mismatch on (1, 1, 1), 100 != 105"
},
{
"row": 8380,
"reason": "row 8380: emulator mismatch on (0, 4294967295, 1), 4294967294 != 4294967295"
},
{
"row": 8441,
"reason": "row 8441: emulator mismatch on (2147483648, 2147483647, 1431655765), 4260880241 != 3579139389"
},
{
"row": 8453,
"reason": "row 8453: emulator mismatch on (0, 0, 0), 0 != 4294967294"
},
{
"row": 8493,
"reason": "row 8493: emulator mismatch on (1, 1, 1), 0 != 16"
},
{
"row": 8573,
"reason": "not a complete supported straight-line function"
},
{
"row": 8603,
"reason": "row 8603: emulator mismatch on (0, 0, 0), 4294966738 != 4294962244"
},
{
"row": 8699,
"reason": "row 8699: emulator mismatch on (1, 1, 1), 0 != 41"
},
{
"row": 8742,
"reason": "row 8742: emulator mismatch on (4294967295, 4294967295, 4294967295), 4294967255 != 4294967287"
},
{
"row": 8767,
"reason": "row 8767: emulator mismatch on (4294967295, 4294967295, 4294967295), 21 != 23"
},
{
"row": 8817,
"reason": "row 8817: emulator mismatch on (0, 4294967295, 1), 36 != 37"
},
{
"row": 8863,
"reason": "row 8863: emulator mismatch on (1, 1, 1), 4 != 1604"
},
{
"row": 8890,
"reason": "row 8890: emulator mismatch on (4294967295, 0, 1), 4294967244 != 44"
},
{
"row": 8908,
"reason": "row 8908: emulator mismatch on (0, 4294967295, 1), 2154 != 2108"
}
]
},
"backend_provenance": {
"unfolded": "e6722114c92eac9f1a4c9d83816bf31ff14f0bcd7aa062ae49165144f4811c9f",
"post": "c91050116bb488ef934bbbce4eccf54230efbc35d2e000d7085da86c602b83ef",
"instructions": "aa4085b054722f3372d133ee607e359f6008cf4214a4bac8560bd8335d1792ed",
"binary": "d3b2dca8f3aec7621d1d46291d0762d99bc22fcf42371ff4da2d8dd38c28a511",
"templates": "9cea97b4be362f0e0f46084612bd5af961abaab0feabbc6eaae3debeb4e6cc5f",
"raw_post": "1a77192f19ebf79502b4b63303bc694586a78203aea58a45d0a321615f411915"
}
},
"split": "validation",
"evaluation_status": "validation",
"neural": {
"functions": 1000,
"batch": 32,
"repeats": 3,
"seconds": [
1.5238853000337258,
1.5837862000335008,
1.5430534000042826
],
"median_seconds": 1.5430534000042826,
"candidates_per_second": 648.0657117875666,
"peak_cuda_allocated_mib": 562.59033203125,
"sampled_correct_candidates_per_second": 633.1602004164525
},
"verification": {
"functions": 1000,
"serializable": 1.0,
"fully_disassembled": 0.999,
"semantic_accuracy": 0.977,
"semantic_correct": 977
},
"cpu": "Intel(R) Core(TM) i9-10850K CPU @ 3.60GHz",
"gpu": "NVIDIA GeForce RTX 2060 SUPER",
"verification_in_timing": false,
"timing_scope": "Warm model; tokenization, neural inference, CPU transfer, byte serialization; excludes initialization, emulation and disk I/O",
"environment": {
"python": "3.14.0",
"torch": "2.13.0+cu132"
}
}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334{
"pipeline": {
"compiler_version": "v2",
"abi": "x86_64 SysV",
"spec": {
"backbone": "Qwen/Qwen2.5-Coder-0.5B",
"revision": "0576a1bc0ae53f21860e905e081807bd7ff4a4c7",
"tokens": 96,
"depths": [
6
]
},
"fingerprint": "b8dd5570bd628cdad71bcb8bbffc76de11cd46f7b5d3be0cc4e3ad0bb2997e31",
"device": "cuda",
"checkpoints": {
"ast": {
"sha256": "e753e8ab8e997ebe48e166e6b0f2380bb3ab450c087871c4d740eef2326897e3",
"mode": "deps",
"epoch": 12
},
"ir": {
"sha256": "90bea9167a71409202397e2543c5c8beecd5a4a2d1169b268337db0175536244",
"mode": "deps",
"epoch": 15
},
"isel": {
"sha256": "d95f10f3bca327e65cb3c1e716d1b85d3db1addea2f144b40709809c27c9ff61",
"mode": "discrete_copy",
"epoch": 37
},
"regalloc": {
"sha256": "48f77152cff7532ebff835b4d0b15d603504de20f34378ab29634a4c3e83e582",
"mode": "aligned_copy",
"epoch": 171
},
"binary": {
"sha256": "3159a286d3b021fb62fec303648545c4abb9a8ad44a27246e02f75420bc58c4b",
"mode": "copy",
"epoch": 43
}
},
"precision": "Qwen cache precision; FP16 boundaries, FP32 specialized stages",
"specialized_parameters": 3934092,
"backbone_parameters": 225608960,
"binary_validation": {
"n": 1000,
"exact": 0.9739999771118164,
"byte_accuracy": 0.976840078830719,
"count_accuracy": 0.9900000095367432,
"template_accuracy": 0.9810349345207214,
"template_exact": 0.9779999852180481,
"payload_byte_accuracy_given_template": 0.9982773661613464,
"immediate_byte_accuracy_given_template": 0.9982691407203674,
"displacement_byte_accuracy_given_template": 1.0,
"spill_exact": 0.1538461595773697,
"spill_n": 13,
"nonspill_exact": 0.9848024249076843,
"semantic32": 0.977,
"semantic_accuracy": 0.977,
"semantic_n": 1000,
"inputs_per_function": 32,
"fully_disassembled": 0.999,
"semantic_failure_examples": [
{
"row": 8139,
"reason": "row 8139: emulator mismatch on (0, 0, 0), 13 != 122"
},
{
"row": 8143,
"reason": "row 8143: emulator mismatch on (0, 0, 0), 0 != 7"
},
{
"row": 8202,
"reason": "row 8202: emulator mismatch on (1, 1, 1), 1 != 15"
},
{
"row": 8225,
"reason": "row 8225: emulator mismatch on (1, 1, 1), 57 != 58"
},
{
"row": 8232,
"reason": "row 8232: emulator mismatch on (0, 4294967295, 1), 0 != 150"
},
{
"row": 8234,
"reason": "row 8234: emulator mismatch on (0, 0, 0), 1206 != 582"
},
{
"row": 8297,
"reason": "row 8297: emulator mismatch on (1, 1, 1), 100 != 105"
},
{
"row": 8380,
"reason": "row 8380: emulator mismatch on (0, 4294967295, 1), 4294967294 != 4294967295"
},
{
"row": 8441,
"reason": "row 8441: emulator mismatch on (2147483648, 2147483647, 1431655765), 4260880241 != 3579139389"
},
{
"row": 8453,
"reason": "row 8453: emulator mismatch on (0, 0, 0), 0 != 4294967294"
},
{
"row": 8493,
"reason": "row 8493: emulator mismatch on (1, 1, 1), 0 != 16"
},
{
"row": 8573,
"reason": "not a complete supported straight-line function"
},
{
"row": 8603,
"reason": "row 8603: emulator mismatch on (0, 0, 0), 4294966738 != 4294962244"
},
{
"row": 8699,
"reason": "row 8699: emulator mismatch on (1, 1, 1), 0 != 41"
},
{
"row": 8742,
"reason": "row 8742: emulator mismatch on (4294967295, 4294967295, 4294967295), 4294967255 != 4294967287"
},
{
"row": 8767,
"reason": "row 8767: emulator mismatch on (4294967295, 4294967295, 4294967295), 21 != 23"
},
{
"row": 8817,
"reason": "row 8817: emulator mismatch on (0, 4294967295, 1), 36 != 37"
},
{
"row": 8863,
"reason": "row 8863: emulator mismatch on (1, 1, 1), 4 != 1604"
},
{
"row": 8890,
"reason": "row 8890: emulator mismatch on (4294967295, 0, 1), 4294967244 != 44"
},
{
"row": 8908,
"reason": "row 8908: emulator mismatch on (0, 4294967295, 1), 2154 != 2108"
}
]
},
"backend_provenance": {
"unfolded": "e6722114c92eac9f1a4c9d83816bf31ff14f0bcd7aa062ae49165144f4811c9f",
"post": "c91050116bb488ef934bbbce4eccf54230efbc35d2e000d7085da86c602b83ef",
"instructions": "aa4085b054722f3372d133ee607e359f6008cf4214a4bac8560bd8335d1792ed",
"binary": "d3b2dca8f3aec7621d1d46291d0762d99bc22fcf42371ff4da2d8dd38c28a511",
"templates": "9cea97b4be362f0e0f46084612bd5af961abaab0feabbc6eaae3debeb4e6cc5f",
"raw_post": "1a77192f19ebf79502b4b63303bc694586a78203aea58a45d0a321615f411915"
}
},
"split": "fresh",
"evaluation_status": "fresh source-disjoint test; do not tune on these results",
"fresh_seed": 20261126,
"fresh_count_requested": 1000,
"source_sha256": "c00d7cd373f7e9ce39ca1bed86005698de38e7b165fb8da845bf6448b8050eaa",
"depth_counts": {
"1": 105,
"2": 433,
"3": 462
},
"samples": 32,
"sample_seed": 20261125,
"functions": 1000,
"serializable": 1.0,
"fully_disassembled": 0.998,
"semantic_accuracy": 0.973,
"semantic_correct": 973,
"failure_examples": [
{
"row": 10066,
"source": "unsigned f(unsigned a,unsigned b,unsigned c){return (((19u-b)-(c^b))^((50u-b)&(c+b)));}",
"hex": "b8 13 00 00 00 29 f0 89 d1 31 f1 29 c8 b9 32 00 00 00 29 f1 01 f2 31 d1 31 c8 c3",
"disassembled": true,
"semantic": false,
"error": "row 10066: emulator mismatch on (0, 0, 0), 33 != 19"
},
{
"row": 10102,
"source": "unsigned f(unsigned a,unsigned b,unsigned c){return ((13u-c)&(61u+c));}",
"hex": "b8 0d 00 00 00 29 d0 83 c2 3d 01 d0 c3",
"disassembled": true,
"semantic": false,
"error": "row 10102: emulator mismatch on (0, 0, 0), 74 != 13"
},
{
"row": 10106,
"source": "unsigned f(unsigned a,unsigned b,unsigned c){return (((a*30u)*(c*b))|((b+c)*(a^57u)));}",
"hex": "89 f1 6b c7 1e 89 d6 0f af f1 0f af c6 01 d1 0f af ff 0f af cf 09 c8 c3",
"disassembled": true,
"semantic": false,
"error": "row 10106: emulator mismatch on (1, 1, 1), 30 != 126"
},
{
"row": 10138,
"source": "unsigned f(unsigned a,unsigned b,unsigned c){return ((c^45u)+(b*1u));}",
"hex": "89 d0 83 f0 2d d1 e6 01 f0 c3",
"disassembled": true,
"semantic": false,
"error": "row 10138: emulator mismatch on (1, 1, 1), 46 != 45"
},
{
"row": 10180,
"source": "unsigned f(unsigned a,unsigned b,unsigned c){return (((48u*a)-(23u*61u))&((c&c)&(b*2u)));}",
"hex": "89 d1 6b c7 30 ba 3d 00 00 00 29 ca 29 d0 21 c9 d1 e6 21 f1 21 c8 c3",
"disassembled": true,
"semantic": false,
"error": "row 10180: emulator mismatch on (4294967295, 4294967295, 4294967295), 4294967186 != 4294965844"
},
{
"row": 10196,
"source": "unsigned f(unsigned a,unsigned b,unsigned c){return (((51u^c)*(c-a))&((52u&26u)^(7u&20u)));}",
"hex": "89 d0 83 f0 33 29 fa 0f af c2 b9 1a 00 00 00 83 e1 34 ba 14 00 00 00 83 e2 07 31 d1 21 c8 21 c8",
"disassembled": false,
"semantic": false,
"error": "Not a supported complete straight-line function"
},
{
"row": 10246,
"source": "unsigned f(unsigned a,unsigned b,unsigned c){return (((b+59u)&(b*34u))|((b*16u)&(14u-a)));}",
"hex": "89 f1 89 c8 83 c0 3b 6b f1 22 21 d0 c1 e1 05 ba 0e 00 00 00 29 fa 21 d1 09 c8 c3",
"disassembled": true,
"semantic": false,
"error": "row 10246: emulator mismatch on (1, 1, 1), 0 != 32"
},
{
"row": 10291,
"source": "unsigned f(unsigned a,unsigned b,unsigned c){return (((37u+2u)+(21u-9u))|((45u^c)^(c+b)));}",
"hex": "b8 02 00 00 00 83 c0 25 b9 15 00 00 00 83 e9 09 31 c8 89 d1 83 f1 2d 01 f2 31 d1 09 c8 c3",
"disassembled": true,
"semantic": false,
"error": "row 10291: emulator mismatch on (0, 0, 0), 47 != 63"
},
{
"row": 10308,
"source": "unsigned f(unsigned a,unsigned b,unsigned c){return (((c+c)&(c|45u))*((30u*24u)*(10u-a)));}",
"hex": "89 d0 01 c0 83 ca 2d 21 d0 21 c8 6b c9 1e ba 0a 00 00 00 29 fa 0f af ca 0f af c1 c3",
"disassembled": true,
"semantic": false,
"error": "row 10308: emulator mismatch on (4294967295, 4294967295, 4294967295), 0 != 4294951456"
},
{
"row": 10314,
"source": "unsigned f(unsigned a,unsigned b,unsigned c){return (((a|a)|(b^60u))|((39u|48u)+(a^b)));}",
"hex": "89 f8 09 c0 89 f1 83 f1 3c 09 c8 89 f1 83 c9 27 31 f7 01 f9 09 c8 c3",
"disassembled": true,
"semantic": false,
"error": "row 10314: emulator mismatch on (0, 4294967295, 1), 4294967295 != 4294967287"
},
{
"row": 10318,
"source": "unsigned f(unsigned a,unsigned b,unsigned c){return (((54u&a)+(37u^22u))&((b^31u)|(a&b)));}",
"hex": "89 f8 83 e0 36 b9 15 00 00 00 83 f1 25 01 c8 89 f1 83 f1 1f 21 f7 09 f9 21 c8 c3",
"disassembled": true,
"semantic": false,
"error": "row 10318: emulator mismatch on (0, 0, 0), 16 != 19"
},
{
"row": 10323,
"source": "unsigned f(unsigned a,unsigned b,unsigned c){return (((c|c)^(c-b))-((a*c)^(c^7u)));}",
"hex": "89 f9 89 d0 09 c0 89 d6 29 f6 31 f0 0f af ca 83 f2 07 31 d1 29 c8 c3",
"disassembled": true,
"semantic": false,
"error": "row 10323: emulator mismatch on (0, 4294967295, 1), 4294967291 != 4294967293"
},
{
"row": 10362,
"source": "unsigned f(unsigned a,unsigned b,unsigned c){return (((7u*b)-(b&c))-((c-b)^(41u+a)));}",
"hex": "89 d1 6b c6 07 89 f2 21 d2 29 d0 29 f1 83 c7 29 31 f9 29 c8 c3",
"disassembled": true,
"semantic": false,
"error": "row 10362: emulator mismatch on (0, 4294967295, 1), 4294967247 != 4294967245"
},
{
"row": 10427,
"source": "unsigned f(unsigned a,unsigned b,unsigned c){return (((a*30u)&(c*a))&((a*44u)+(a+a)));}",
"hex": "6b c7 1e 0f af d7 0f af c7 89 f9 6b cf 2c 01 ff 01 f9 21 c8 c3",
"disassembled": true,
"semantic": false,
"error": "row 10427: emulator mismatch on (1, 1, 1), 14 != 0"
},
{
"row": 10449,
"source": "unsigned f(unsigned a,unsigned b,unsigned c){return (((19u*b)^(42u*a))*((61u+a)|(c^c)));}",
"hex": "89 f9 6b c6 2a 6b f1 2a 31 f7 83 c1 3d 31 d2 09 d1 0f af c1 c3",
"disassembled": true,
"semantic": false,
"error": "row 10449: emulator mismatch on (1, 1, 1), 2604 != 3534"
},
{
"row": 10534,
"source": "unsigned f(unsigned a,unsigned b,unsigned c){return (((29u^58u)-(a&44u))*((b-46u)*(c+39u)));}",
"hex": "89 f1 b8 3a 00 00 00 83 f0 1d 83 e7 2c 29 f8 83 e9 2e 83 c2 27 01 d1 0f af c1 c3",
"disassembled": true,
"semantic": false,
"error": "row 10534: emulator mismatch on (0, 0, 0), 4294967023 != 4294897330"
},
{
"row": 10558,
"source": "unsigned f(unsigned a,unsigned b,unsigned c){return ((1u|40u)*(30u+a));}",
"hex": "b8 28 00 00 00 83 c8 01 83 c7 1e 01 f8 c3",
"disassembled": true,
"semantic": false,
"error": "row 10558: emulator mismatch on (0, 0, 0), 71 != 1230"
},
{
"row": 10613,
"source": "unsigned f(unsigned a,unsigned b,unsigned c){return (((38u^59u)+(11u+19u))|((b|c)*(b*c)));}",
"hex": "b8 3b 00 00 00 83 f0 26 89 d1 83 c1 0b 01 c8 89 f1 09 d1 0f af f2 0f af ce 09 c8 c3",
"disassembled": true,
"semantic": false,
"error": "row 10613: emulator mismatch on (0, 0, 0), 40 != 59"
},
{
"row": 10662,
"source": "unsigned f(unsigned a,unsigned b,unsigned c){return (((c&c)|(22u|a))*((16u|60u)^(b&c)));}",
"hex": "89 d0 21 c0 83 cf 16 09 f8 89 d1 83 c9 10 21 d6 31 f1 0f af c1 c3",
"disassembled": true,
"semantic": false,
"error": "row 10662: emulator mismatch on (0, 0, 0), 352 != 1320"
},
{
"row": 10692,
"source": "unsigned f(unsigned a,unsigned b,unsigned c){return (((50u+34u)*(b*a))&((5u-b)+(39u&42u)));}",
"hex": "b8 22 00 00 00 83 c0 32 89 f1 0f af cf 0f af c1 b9 05 00 00 00 29 f1 ba 2a 00 00 00 83 e2 27 21 d1 21 c8 c3",
"disassembled": true,
"semantic": false,
"error": "row 10692: emulator mismatch on (1, 1, 1), 0 != 4"
}
]
}123456789101112131415161718192021222324252627282930{
"cuda": {
"initialization_seconds": 4.585737199988216,
"hex": "89 f8 01 f0 83 ea 07 0f af c2 c3",
"verification": {
"row": 0,
"source": "unsigned f(unsigned a,unsigned b,unsigned c){return ((a+b)*(c-7u));}",
"hex": "89 f8 01 f0 83 ea 07 0f af c2 c3",
"disassembled": true,
"semantic": true,
"error": null
},
"batch_and_intermediate_api": true
},
"cpu": {
"initialization_seconds": 1.0340769999893382,
"hex": "89 f8 01 f0 83 ea 07 0f af c2 c3",
"verification": {
"row": 0,
"source": "unsigned f(unsigned a,unsigned b,unsigned c){return ((a+b)*(c-7u));}",
"hex": "89 f8 01 f0 83 ea 07 0f af c2 c3",
"disassembled": true,
"semantic": true,
"error": null
},
"batch_and_intermediate_api": true
},
"development_artifacts_denied": true,
"environment": "Separate venv with system-site-packages; installed wheel; outside development working directory"
}12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152{
"original_cache_sha256": "728eb7de1b4cd5e32a7dec37ed199b3ba53f1a2051192719715711347cd375ae",
"original_checkpoint_sha256": "cf980b3520e0a83522d4f5557bffaf937a84c200ec3e9b7e7b809deed17bd125",
"current_checkpoint_sha256": "48f77152cff7532ebff835b4d0b15d603504de20f34378ab29634a4c3e83e582",
"current_epoch": 171,
"current_validation": {
"exact": 0.9729999899864197,
"signature_accuracy": 0.9837442636489868,
"register_accuracy": 0.98609459400177,
"immediate_accuracy": 0.9680156707763672,
"stack_accuracy": 1.0,
"constant_repair": 0.9769999980926514,
"register_repair": 0.9789999723434448,
"spill_exact": 0.1538461595773697,
"spill_n": 13,
"nonspill_exact": 0.9837892651557922,
"n": 1000,
"epoch": 171,
"loss": 0.026706223241286353,
"seconds": 5.911403000005521
},
"differences": {
"features": 17254761,
"predictions": [
66,
163,
21,
0
]
},
"equivalent": false,
"regenerated_cache_sha256": "9d4784815ded74937a321504d71f956fa8d5f430c823e019d39d46d8bfcd83ae",
"historical_binary_checkpoint_sha256": "479036e37e256c825d2496e962a9b477a97735a0691cf700dd3a12dd84e9a800",
"history_epochs": 185,
"historical_epoch165_metrics": {
"exact": 0.9700000286102295,
"signature_accuracy": 0.9837442636489868,
"register_accuracy": 0.9863322973251343,
"immediate_accuracy": 0.9686684012413025,
"stack_accuracy": 1.0,
"constant_repair": 0.9729999899864197,
"register_repair": 0.9769999980926514,
"spill_exact": 0.07692307978868484,
"spill_n": 13,
"nonspill_exact": 0.9817629456520081,
"n": 1000,
"epoch": 165,
"loss": 0.028876638630405068,
"seconds": 5.8465824000304565
},
"history_last_epoch": 185
}12345678910111213141516171819202122232425262728{
"functions": 1000,
"equal": {
"ast_features": true,
"ssa_features": true,
"ssa_predictions": true,
"virtual_features": true,
"virtual_mir": true,
"physical_features": true,
"physical_mir": true,
"ast_predictions": true,
"binary_predictions": true,
"machine_code": true
},
"verification_equal": true,
"historical_binary_rows_equal": 976,
"original_initialization_seconds": 4.489245200064033,
"package_initialization_seconds": 1.2063965999986976,
"verification": {
"functions": 1000,
"serializable": 1.0,
"fully_disassembled": 0.999,
"semantic_accuracy": 0.977,
"semantic_correct": 977
},
"device": "NVIDIA GeForce RTX 2060 SUPER",
"torch": "2.13.0+cu132"
}123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329{
"pipeline": {
"compiler_version": "v2",
"abi": "x86_64 SysV",
"spec": {
"backbone": "Qwen/Qwen2.5-Coder-0.5B",
"revision": "0576a1bc0ae53f21860e905e081807bd7ff4a4c7",
"tokens": 96,
"depths": [
6
]
},
"fingerprint": "b8dd5570bd628cdad71bcb8bbffc76de11cd46f7b5d3be0cc4e3ad0bb2997e31",
"device": "cuda",
"checkpoints": {
"ast": {
"sha256": "e753e8ab8e997ebe48e166e6b0f2380bb3ab450c087871c4d740eef2326897e3",
"mode": "deps",
"epoch": 12
},
"ir": {
"sha256": "90bea9167a71409202397e2543c5c8beecd5a4a2d1169b268337db0175536244",
"mode": "deps",
"epoch": 15
},
"isel": {
"sha256": "d95f10f3bca327e65cb3c1e716d1b85d3db1addea2f144b40709809c27c9ff61",
"mode": "discrete_copy",
"epoch": 37
},
"regalloc": {
"sha256": "48f77152cff7532ebff835b4d0b15d603504de20f34378ab29634a4c3e83e582",
"mode": "aligned_copy",
"epoch": 171
},
"binary": {
"sha256": "3159a286d3b021fb62fec303648545c4abb9a8ad44a27246e02f75420bc58c4b",
"mode": "copy",
"epoch": 43
}
},
"precision": "Qwen cache precision; FP16 boundaries, FP32 specialized stages",
"specialized_parameters": 3934092,
"backbone_parameters": 225608960,
"binary_validation": {
"n": 1000,
"exact": 0.9739999771118164,
"byte_accuracy": 0.976840078830719,
"count_accuracy": 0.9900000095367432,
"template_accuracy": 0.9810349345207214,
"template_exact": 0.9779999852180481,
"payload_byte_accuracy_given_template": 0.9982773661613464,
"immediate_byte_accuracy_given_template": 0.9982691407203674,
"displacement_byte_accuracy_given_template": 1.0,
"spill_exact": 0.1538461595773697,
"spill_n": 13,
"nonspill_exact": 0.9848024249076843,
"semantic32": 0.977,
"semantic_accuracy": 0.977,
"semantic_n": 1000,
"inputs_per_function": 32,
"fully_disassembled": 0.999,
"semantic_failure_examples": [
{
"row": 8139,
"reason": "row 8139: emulator mismatch on (0, 0, 0), 13 != 122"
},
{
"row": 8143,
"reason": "row 8143: emulator mismatch on (0, 0, 0), 0 != 7"
},
{
"row": 8202,
"reason": "row 8202: emulator mismatch on (1, 1, 1), 1 != 15"
},
{
"row": 8225,
"reason": "row 8225: emulator mismatch on (1, 1, 1), 57 != 58"
},
{
"row": 8232,
"reason": "row 8232: emulator mismatch on (0, 4294967295, 1), 0 != 150"
},
{
"row": 8234,
"reason": "row 8234: emulator mismatch on (0, 0, 0), 1206 != 582"
},
{
"row": 8297,
"reason": "row 8297: emulator mismatch on (1, 1, 1), 100 != 105"
},
{
"row": 8380,
"reason": "row 8380: emulator mismatch on (0, 4294967295, 1), 4294967294 != 4294967295"
},
{
"row": 8441,
"reason": "row 8441: emulator mismatch on (2147483648, 2147483647, 1431655765), 4260880241 != 3579139389"
},
{
"row": 8453,
"reason": "row 8453: emulator mismatch on (0, 0, 0), 0 != 4294967294"
},
{
"row": 8493,
"reason": "row 8493: emulator mismatch on (1, 1, 1), 0 != 16"
},
{
"row": 8573,
"reason": "not a complete supported straight-line function"
},
{
"row": 8603,
"reason": "row 8603: emulator mismatch on (0, 0, 0), 4294966738 != 4294962244"
},
{
"row": 8699,
"reason": "row 8699: emulator mismatch on (1, 1, 1), 0 != 41"
},
{
"row": 8742,
"reason": "row 8742: emulator mismatch on (4294967295, 4294967295, 4294967295), 4294967255 != 4294967287"
},
{
"row": 8767,
"reason": "row 8767: emulator mismatch on (4294967295, 4294967295, 4294967295), 21 != 23"
},
{
"row": 8817,
"reason": "row 8817: emulator mismatch on (0, 4294967295, 1), 36 != 37"
},
{
"row": 8863,
"reason": "row 8863: emulator mismatch on (1, 1, 1), 4 != 1604"
},
{
"row": 8890,
"reason": "row 8890: emulator mismatch on (4294967295, 0, 1), 4294967244 != 44"
},
{
"row": 8908,
"reason": "row 8908: emulator mismatch on (0, 4294967295, 1), 2154 != 2108"
}
]
},
"backend_provenance": {
"unfolded": "e6722114c92eac9f1a4c9d83816bf31ff14f0bcd7aa062ae49165144f4811c9f",
"post": "c91050116bb488ef934bbbce4eccf54230efbc35d2e000d7085da86c602b83ef",
"instructions": "aa4085b054722f3372d133ee607e359f6008cf4214a4bac8560bd8335d1792ed",
"binary": "d3b2dca8f3aec7621d1d46291d0762d99bc22fcf42371ff4da2d8dd38c28a511",
"templates": "9cea97b4be362f0e0f46084612bd5af961abaab0feabbc6eaae3debeb4e6cc5f",
"raw_post": "1a77192f19ebf79502b4b63303bc694586a78203aea58a45d0a321615f411915"
}
},
"split": "validation",
"evaluation_status": "validation",
"samples": 32,
"sample_seed": 20261125,
"functions": 1000,
"serializable": 1.0,
"fully_disassembled": 0.999,
"semantic_accuracy": 0.977,
"semantic_correct": 977,
"exact_unoptimized_backend": 0.974,
"cached_vs_live_exact": 1.0,
"exact_original_optimized_bytes_diagnostic": 0.082,
"failure_examples": [
{
"row": 8139,
"source": "unsigned f(unsigned a,unsigned b,unsigned c){return (((b|a)^(45u|56u))^((12u+59u)-(a&36u)));}",
"hex": "89 f0 09 f8 b9 38 00 00 00 83 c9 2d 31 c8 b9 24 00 00 00 83 c1 0c 83 e7 24 29 f9 31 c8 c3",
"disassembled": true,
"semantic": false,
"error": "row 8139: emulator mismatch on (0, 0, 0), 13 != 122"
},
{
"row": 8143,
"source": "unsigned f(unsigned a,unsigned b,unsigned c){return (((a^c)^(7u-c))|((30u+b)&(a|a)));}",
"hex": "89 f1 89 f8 31 d0 ba 07 00 00 00 29 d2 31 d0 83 c1 1e 09 ff 21 f9 09 c8 c3",
"disassembled": true,
"semantic": false,
"error": "row 8143: emulator mismatch on (0, 0, 0), 0 != 7"
},
{
"row": 8202,
"source": "unsigned f(unsigned a,unsigned b,unsigned c){return (((c|a)&(b*c))^((a+a)*(b|7u)));}",
"hex": "89 54 24 fc 89 f9 09 c8 89 f0 09 c8 89 f2 01 fa 83 ce 07 01 f1 31 f6 0f af ce 31 c8 c3",
"disassembled": true,
"semantic": false,
"error": "row 8202: emulator mismatch on (1, 1, 1), 1 != 15"
},
{
"row": 8225,
"source": "unsigned f(unsigned a,unsigned b,unsigned c){return (((a*51u)-(b&a))|((55u*a)+(a*a)));}",
"hex": "6b c7 33 21 fe 21 f0 89 f9 6b cf 37 0f af ff 01 f9 09 c8 c3",
"disassembled": true,
"semantic": false,
"error": "row 8225: emulator mismatch on (1, 1, 1), 57 != 58"
},
{
"row": 8232,
"source": "unsigned f(unsigned a,unsigned b,unsigned c){return (((50u*3u)*(a^c))|((b-b)|(52u*a)));}",
"hex": "89 f1 b8 03 00 00 00 6b c0 32 89 fa 31 d2 0f af c2 29 c9 6b d7 34 09 d1 09 c8 c3",
"disassembled": true,
"semantic": false,
"error": "row 8232: emulator mismatch on (0, 4294967295, 1), 0 != 150"
},
{
"row": 8234,
"source": "unsigned f(unsigned a,unsigned b,unsigned c){return ((16u*37u)^(b+22u));}",
"hex": "b8 25 00 00 00 c1 e0 05 83 c6 16 31 f0 c3",
"disassembled": true,
"semantic": false,
"error": "row 8234: emulator mismatch on (0, 0, 0), 1206 != 582"
},
{
"row": 8297,
"source": "unsigned f(unsigned a,unsigned b,unsigned c){return (((52u|b)^(15u*b))+((a^c)+(16u^63u)));}",
"hex": "89 f9 89 f9 83 c8 34 6b f6 0f 31 f8 31 d1 ba 3f 00 00 00 83 f2 10 01 d1 01 c8 c3",
"disassembled": true,
"semantic": false,
"error": "row 8297: emulator mismatch on (1, 1, 1), 100 != 105"
},
{
"row": 8380,
"source": "unsigned f(unsigned a,unsigned b,unsigned c){return (((c-3u)|(a-c))-((b*a)*(a*47u)));}",
"hex": "89 d0 89 f1 83 e8 03 89 fa 29 d2 09 d0 0f af cf 6b d7 2f 0f af ca 29 c8 c3",
"disassembled": true,
"semantic": false,
"error": "row 8380: emulator mismatch on (0, 4294967295, 1), 4294967294 != 4294967295"
},
{
"row": 8441,
"source": "unsigned f(unsigned a,unsigned b,unsigned c){return (((c^36u)+(b*c))|((a|c)-(39u-b)));}",
"hex": "89 f9 89 d0 83 f0 24 89 f7 0f af d2 01 f8 09 d1 ba 27 00 00 00 29 f2 29 d1 09 c8 c3",
"disassembled": true,
"semantic": false,
"error": "row 8441: emulator mismatch on (2147483648, 2147483647, 1431655765), 4260880241 != 3579139389"
},
{
"row": 8453,
"source": "unsigned f(unsigned a,unsigned b,unsigned c){return (((c|a)-(2u-b))-((a^c)+(60u*c)));}",
"hex": "89 f9 89 d0 09 c8 be 02 00 00 00 29 f6 29 f0 31 d1 6b d2 3c 01 d1 29 c8 c3",
"disassembled": true,
"semantic": false,
"error": "row 8453: emulator mismatch on (0, 0, 0), 0 != 4294967294"
},
{
"row": 8493,
"source": "unsigned f(unsigned a,unsigned b,unsigned c){return (((c&55u)^(27u*a))&((49u^13u)-(9u-c)));}",
"hex": "89 54 24 fc 89 f1 8b 74 24 fc 6b c0 1b b9 0d 00 00 00 ba 09 00 00 00 ba 09 00 00 00 29 d2 29 d1 21 c8 c3",
"disassembled": true,
"semantic": false,
"error": "row 8493: emulator mismatch on (1, 1, 1), 0 != 16"
},
{
"row": 8573,
"source": "unsigned f(unsigned a,unsigned b,unsigned c){return (((a-a)-(42u*b))|((c&c)&(42u-c)));}",
"hex": "89 54 24 fc 89 f1 8b 74 24 fc 6b c1 2a 29 c0 29 c9 29 c8 29 f2 21 c9 ba 2a 00 00 00 29 f2 09 c8 c3 c3",
"disassembled": false,
"semantic": false,
"error": "Not a supported complete straight-line function"
},
{
"row": 8603,
"source": "unsigned f(unsigned a,unsigned b,unsigned c){return (((a*b)-(10u*58u))^((61u+31u)*(50u-b)));}",
"hex": "89 f8 0f af c6 b9 3a 00 00 00 6b c9 0a 29 c8 b9 1f 00 00 00 83 c1 3d ba 32 00 00 00 29 f2 31 d1 31 c8 c3",
"disassembled": true,
"semantic": false,
"error": "row 8603: emulator mismatch on (0, 0, 0), 4294966738 != 4294962244"
},
{
"row": 8699,
"source": "unsigned f(unsigned a,unsigned b,unsigned c){return (((6u*b)^(a*45u))^((b+b)-(c^c)));}",
"hex": "89 f1 6b c1 06 6b f7 2d 31 f0 31 f1 01 ce 29 d1 31 c8 c3",
"disassembled": true,
"semantic": false,
"error": "row 8699: emulator mismatch on (1, 1, 1), 0 != 41"
},
{
"row": 8742,
"source": "unsigned f(unsigned a,unsigned b,unsigned c){return (((a+32u)|(a-c))-((b+a)&(40u-c)));}",
"hex": "89 54 24 fc 89 f1 8b 74 24 fc 89 f8 83 c0 20 89 fa 89 ca 09 d0 01 f9 ba 28 00 00 00 29 f2 21 d1 29 c8 c3",
"disassembled": true,
"semantic": false,
"error": "row 8742: emulator mismatch on (4294967295, 4294967295, 4294967295), 4294967255 != 4294967287"
},
{
"row": 8767,
"source": "unsigned f(unsigned a,unsigned b,unsigned c){return (((c|30u)&(21u-c))|((10u&a)+(5u|6u)));}",
"hex": "89 d0 89 f9 83 c8 1e be 15 00 00 00 29 f2 21 f0 83 e1 0a ba 06 00 00 00 83 ca 05 01 d1 09 c8 c3",
"disassembled": true,
"semantic": false,
"error": "row 8767: emulator mismatch on (4294967295, 4294967295, 4294967295), 21 != 23"
},
{
"row": 8817,
"source": "unsigned f(unsigned a,unsigned b,unsigned c){return (((c&c)-(29u-c))&((27u|a)-(b^25u)));}",
"hex": "89 d0 89 f9 21 c0 ba 1d 00 00 00 29 ca 29 d0 83 c9 1b 83 f6 19 29 f1 21 c8 c3",
"disassembled": true,
"semantic": false,
"error": "row 8817: emulator mismatch on (0, 4294967295, 1), 36 != 37"
},
{
"row": 8863,
"source": "unsigned f(unsigned a,unsigned b,unsigned c){return (((c*29u)*(58u-a))&((a-a)-(c*60u)));}",
"hex": "89 f9 6b c2 1d be 3a 00 00 00 0f af f1 0f af c7 29 c9 6b d2 3c 29 d1 21 c8 c3",
"disassembled": true,
"semantic": false,
"error": "row 8863: emulator mismatch on (1, 1, 1), 4 != 1604"
},
{
"row": 8890,
"source": "unsigned f(unsigned a,unsigned b,unsigned c){return (((20u^52u)*(c^b))|((27u&a)+(c-16u)));}",
"hex": "89 f9 b8 34 00 00 00 83 f0 14 89 d6 31 ce 0f af c6 83 e1 1b 83 ea 10 01 d1 09 c8 c3",
"disassembled": true,
"semantic": false,
"error": "row 8890: emulator mismatch on (4294967295, 0, 1), 4294967244 != 44"
},
{
"row": 8908,
"source": "unsigned f(unsigned a,unsigned b,unsigned c){return (((b+48u)*(c+45u))-((a+54u)-(c^c)));}",
"hex": "89 f9 89 f8 83 c0 30 89 d6 83 c6 2d 0f af c6 83 c1 36 31 d2 29 d1 29 c8 c3",
"disassembled": true,
"semantic": false,
"error": "row 8908: emulator mismatch on (0, 4294967295, 1), 2154 != 2108"
}
]
}123456from neuro_compiler import NeuralCompilercompiler = NeuralCompiler.from_pretrained('orthagonal/neuro-compiler')sources = ['unsigned f(unsigned a,unsigned b,unsigned c){return (a+b);}', 'unsigned f(unsigned a,unsigned b,unsigned c){return (a^c);}']for code in compiler.compile_batch(sources): print(code.hex(' '))123from neuro_compiler import NeuralCompilercompiler = NeuralCompiler.from_pretrained('orthagonal/neuro-compiler', device='auto')print(compiler.compile('unsigned f(unsigned a,unsigned b,unsigned c){return ((a+b)*(c-7u));}').hex(' '))1234from neuro_compiler import NeuralCompilercompiler = NeuralCompiler.from_pretrained('orthagonal/neuro-compiler')result = compiler.compile('unsigned f(unsigned a,unsigned b,unsigned c){return (a+b);}', return_intermediates=True)print(result.ast, result.ssa, result.virtual_mir, result.physical_mir, result.machine_code)1234"""Experimental non-autoregressive neural compiler. Generated code may be unsafe."""from .compiler import NeuralCompiler, CompilationResult__version__ = '0.1.0.dev0'__all__ = ['NeuralCompiler', 'CompilationResult']123456789101112131415161718import argparsefrom pathlib import Pathfrom . import NeuralCompiler
def main(): p=argparse.ArgumentParser(description='Experimental x86-64 SysV neural compiler; generated bytes may be unsafe.') g=p.add_mutually_exclusive_group(required=True); g.add_argument('--source'); g.add_argument('--file',type=Path) p.add_argument('--model',default='orthagonal/neuro-compiler'); p.add_argument('--device',choices=['auto','cpu','cuda'],default='auto'); p.add_argument('--output',type=Path); p.add_argument('--verify',action='store_true') a=p.parse_args(); source=a.source if a.source is not None else a.file.read_text(encoding='utf-8') code=NeuralCompiler.from_pretrained(a.model,device=a.device).compile(source) if a.output: a.output.write_bytes(code) else: print(code.hex(' ')) if a.verify: import json from .verification import verify print(json.dumps(verify(source,code)))
if __name__=='__main__': main()1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586from dataclasses import dataclassfrom pathlib import Pathimport hashlibimport jsonimport warningsimport torchfrom safetensors.torch import load_filefrom . import neurocc as ncfrom .neurocc_live_v2 import NeuralCompiler as Pipeline, raw_bytesfrom .neurocc_ast import ASTStagefrom .neurocc_ir_unfolded import IRStagefrom .neurocc_isel_v2 import ISELStageV2from .neurocc_regalloc_v2 import RegisterStageV2from .neurocc_binary import BinaryStage
@dataclassclass CompilationResult: machine_code: bytes ast: dict ssa: tuple virtual_mir: tuple physical_mir: tuple
class NeuralCompiler: """Load frozen V2 stages; compile without a parser, assembler, or native execution.""" @classmethod def from_pretrained(cls, model_id='orthagonal/neuro-compiler', device='auto', revision=None): root=Path(model_id) if not root.is_dir(): from huggingface_hub import snapshot_download root=Path(snapshot_download(str(model_id),revision=revision,allow_patterns=['manifest.json','config.json','weights/*.safetensors'])) self=cls(); self.root=root try: self.manifest=json.loads((root/'manifest.json').read_text()) except FileNotFoundError as e: raise FileNotFoundError(f'Missing release manifest in {root}') from e m=self.manifest if m['architecture']!='NeuroCC V2' or m['spec']['depths']!=[6] or m['spec']['revision']!='0576a1bc0ae53f21860e905e081807bd7ff4a4c7': raise ValueError('Incompatible compiler architecture or backbone revision') self.spec=m['spec']; self.dev=nc.device() if device=='auto' else torch.device(device) if self.dev.type not in ('cpu','cuda'): raise ValueError('Only CPU and CUDA inference are supported') if self.dev.type=='cuda' and not torch.cuda.is_available(): raise ValueError('CUDA requested but unavailable') stages=[] for name,factory,mode in zip(('ast','ssa','isel','regalloc','binary'),(ASTStage,IRStage,ISELStageV2,RegisterStageV2,BinaryStage),('deps','deps','discrete_copy','aligned_copy','copy')): entry=m['stages'][name]; path=root/'weights'/f'{name}.safetensors' if not path.is_file(): raise FileNotFoundError(f'Missing stage weights: {path}') if hashlib.sha256(path.read_bytes()).hexdigest()!=entry['sha256']: raise ValueError(f'Weight integrity check failed: {name}') if entry['config']['mode']!=mode or entry['config']['width']!=128: raise ValueError(f'Incompatible stage configuration: {name}') stage=factory(entry['config']); stage.load_state_dict(load_file(str(path)),strict=True) if sum(p.numel() for p in stage.parameters())!=entry['parameters']: raise ValueError(f'Parameter count mismatch: {name}') stages.append(stage) self.tokenizer=nc.tokenizer_for(self.spec) bb=nc.Backbone(self.spec,self.dev) self.model=Pipeline(bb,*stages,self.dev).to(self.dev).eval() warnings.warn('Experimental neural compiler: generated machine code may be incorrect or unsafe. No native execution or formal verification is performed.',UserWarning,stacklevel=2) return self
@torch.inference_mode() def predict(self,sources): """Return raw byte IDs and stage tensors for reproducibility tools.""" if isinstance(sources,str): raise TypeError('Expected a sequence of source strings') if not sources: raise ValueError('Empty batch') for source in sources: if not isinstance(source,str) or not source.strip(): raise ValueError('Source must be a nonempty string') if len(source.encode('utf-8'))>192: raise ValueError('Source exceeds the trained 192-byte source capacity') import re if not re.fullmatch(r'[\x20-\x7e\r\n\t]+',source) or re.search(r'[/%=<>!~?:\[\]]|\b(if|while|for|goto|switch)\b',source): raise ValueError('Unsupported source characters or control flow; see the trained grammar') try: ids,mask=nc.tokenize(self.tokenizer,sources,self.spec['tokens']) except RuntimeError as e: raise ValueError(f'Source exceeds the trained {self.spec["tokens"]}-token limit; no truncation performed') from e return self.model.stages(ids.to(self.dev),mask.to(self.dev))
def compile_batch(self,sources,return_intermediates=False,batch_size=32): if isinstance(sources,str): raise TypeError('Expected a sequence of source strings') sources=list(sources) if batch_size<1: raise ValueError('batch_size must be positive') results=[] for i in range(0,len(sources),batch_size): bp,stages=self.predict(sources[i:i+batch_size]); a,h,ip,m,mp,r,rp=stages nodes=self.model.ast.node(a.float()).argmax(-1) if return_intermediates else None for j,row in enumerate(bp[-1]): code=raw_bytes(row.cpu()) if code is None: raise ValueError(f'Malformed neural byte output at batch index {i+j}: invalid EOS, padding, or byte value') results.append(CompilationResult(code,{'nodes':nodes[j].cpu(),'features':a[j].cpu()},tuple(x[j].cpu() for x in ip),tuple(x[j].cpu() for x in mp),tuple(x[j].cpu() for x in rp)) if return_intermediates else code) return results
def compile(self,source,return_intermediates=False): return self.compile_batch([source],return_intermediates=return_intermediates)[0]123456789101112131415161718192021222324252627282930313233343536373839404142434445464748from __future__ import annotations
import torch
from torch import nn
SRC, OUT, PAD, EOS = 192, 64, 256, 257
def device(): return torch.device('cuda' if torch.cuda.is_available() else 'cpu')
def amp(dev): return torch.autocast(dev.type,dtype=torch.float16,enabled=dev.type=='cuda')
def tokenizer_for(spec):
from transformers import AutoTokenizer
tok=AutoTokenizer.from_pretrained(spec['backbone'],revision=spec['revision'],trust_remote_code=False)
if tok.pad_token_id is None: tok.pad_token=tok.eos_token
tok.padding_side='right'; return tok
def tokenize(tok,sources,tokens):
result=tok(sources,add_special_tokens=False,padding='max_length',max_length=tokens,truncation=False,return_tensors=None)
# HF does not truncate; check before converting ragged lists into a tensor.
if any(len(row)!=tokens for row in result['input_ids']): raise RuntimeError(f'Source exceeds --tokens {tokens}; increase limit and rebuild cache')
return torch.tensor(result['input_ids'],dtype=torch.long),torch.tensor(result['attention_mask'],dtype=torch.bool)
class Backbone(nn.Module):
"""Use AutoModel (not AutoModelForCausalLM). Depth k = output of k blocks.
Intermediate features are raw block output; full depth has Qwen final norm.
Truncated inference uses identical features to full-model caching.
"""
def __init__(self,spec,dev):
super().__init__()
from transformers import AutoModel
self.net=AutoModel.from_pretrained(spec['backbone'],revision=spec['revision'],trust_remote_code=False,torch_dtype=torch.float16 if dev.type=='cuda' else torch.float32)
self.depths=sorted(spec['depths']); self.full_depth=len(self.net.layers); self.hidden=self.net.config.hidden_size
depth=max(self.depths)
if depth>self.full_depth: raise RuntimeError(f'Model only has {self.full_depth} blocks')
# Remove unused blocks physically, avoiding their computation and resident weights.
self.net.layers=nn.ModuleList(list(self.net.layers)[:depth])
self.net.config.num_hidden_layers=depth
if depth<self.full_depth: self.net.norm=nn.Identity()
self.net.requires_grad_(False); self.net.to(dev).eval()
def forward(self,ids,mask):
if max(self.depths)==0: return (self.net.get_input_embeddings()(ids),)
# HF returns input embeddings, intermediate block outputs, and final norm output.
if len(self.depths)==1:
return (self.net(input_ids=ids,attention_mask=mask,use_cache=False,return_dict=True).last_hidden_state,)
states=self.net(input_ids=ids,attention_mask=mask,use_cache=False,output_hidden_states=True,return_dict=True).hidden_states
return tuple(states[k] for k in self.depths)123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102from __future__ import annotations
import math
import torch
from torch import nn
CLASSES = ['absent', '+', '-', '*', '^', '&', '|', 'a', 'b', 'c', *[f'{i}u' for i in range(1,64)]]
SLOTS = 15
def tree_depth(i): return (i+1).bit_length()-1
def tree_paths():
return [bin(i+1)[3:] for i in range(SLOTS)]
def tree_relations():
"""Fixed, directed relations. No target-tree information enters attention."""
paths = tree_paths(); keys = []
for p in paths:
for q in paths:
k = 0
while k < min(len(p),len(q)) and p[k] == q[k]: k += 1
up, down = len(p)-k, len(q)-k
# Distinguish ancestor/descendant distances and left/right branches.
keys.append((up, down, p[k:k+1], q[k:k+1]))
vocab = {v:i for i,v in enumerate(sorted(set(keys)))}
return torch.tensor([vocab[k] for k in keys]).reshape(SLOTS,SLOTS), len(vocab)
class Block(nn.Module):
def __init__(self,d,heads,dropout,self_attention,tree=False):
super().__init__(); self.heads=heads
self.cross=nn.MultiheadAttention(d,heads,dropout=dropout,batch_first=True)
self.cn=nn.LayerNorm(d); self.sn=nn.LayerNorm(d); self.fn=nn.LayerNorm(d)
self.self_attn=nn.MultiheadAttention(d,heads,dropout=dropout,batch_first=True) if self_attention else None
if tree:
rel,n=tree_relations(); self.register_buffer('relations',rel,persistent=False)
self.bias=nn.Embedding(n,heads); nn.init.zeros_(self.bias.weight)
else: self.bias=None
self.ff=nn.Sequential(nn.Linear(d,4*d),nn.GELU(),nn.Dropout(dropout),nn.Linear(4*d,d))
self.drop=nn.Dropout(dropout)
def forward(self,q,m,mask):
z=self.cn(q); q=q+self.drop(self.cross(z,m,m,key_padding_mask=~mask,need_weights=False)[0])
if self.self_attn is not None:
z=self.sn(q); bias=None
if self.bias is not None:
bias=self.bias(self.relations).permute(2,0,1).unsqueeze(0).expand(len(q),-1,-1,-1).reshape(-1,SLOTS,SLOTS).to(z.dtype)
q=q+self.drop(self.self_attn(z,z,z,attn_mask=bias,need_weights=False)[0])
return q+self.drop(self.ff(self.fn(q)))
class ASTStage(nn.Module):
"""encode() is the reusable continuous compiler stage, independent of all labels."""
def __init__(self,cfg):
super().__init__(); self.cfg=dict(cfg); d=cfg['width']; mode=cfg['mode']; heads=cfg['heads']; drop=cfg['dropout']
self.project=nn.Sequential(nn.Linear(cfg['hidden'],d),nn.LayerNorm(d))
self.query=nn.Parameter(torch.randn(SLOTS,d)*.02)
self.tree=mode in ('tree','span','deps','recursive')
if self.tree:
self.depth_emb=nn.Embedding(4,d); self.path_emb=nn.Embedding(6,d)
nn.init.normal_(self.depth_emb.weight,std=.02); nn.init.normal_(self.path_emb.weight,std=.02)
p=torch.zeros(SLOTS,6)
for i,path in enumerate(tree_paths()):
for j,s in enumerate(path): p[i,2*j+int(s)]=1
self.register_buffer('paths',p,persistent=False)
self.register_buffer('depths',torch.tensor([tree_depth(i) for i in range(SLOTS)]),persistent=False)
if mode=='recursive':
self.blocks=nn.ModuleList([Block(d,heads,drop,True) for _ in range(cfg['layers'])])
self.child=nn.Sequential(nn.Linear(d,d),nn.GELU(),nn.LayerNorm(d))
self.side=nn.Embedding(2,d)
else:
self.blocks=nn.ModuleList([Block(d,heads,drop,mode!='cross',self.tree) for _ in range(1 if mode=='cross' else cfg['layers'])])
self.norm=nn.LayerNorm(d); self.node=nn.Linear(d,len(CLASSES))
if mode in ('span','deps'):
self.span_q=nn.ModuleList([nn.Linear(d,d,bias=False) for _ in range(2)])
self.span_k=nn.ModuleList([nn.Linear(d,d,bias=False) for _ in range(2)])
else: self.span_q=None
self.dep=nn.Linear(d,3) if mode=='deps' else None
def _encode(self,features,mask):
m=self.project(features.float()); mask=mask.bool(); base=self.query
if self.tree: base=base+self.depth_emb(self.depths)+self.paths@self.path_emb.weight
if self.cfg['mode']=='recursive':
levels=[]; q=base[:1].unsqueeze(0).expand(len(m),-1,-1)
for depth in range(4):
if depth:
n=2**depth; start=n-1
q=self.child(levels[-1]).repeat_interleave(2,dim=1)+self.side(torch.arange(n,device=m.device)%2)[None]+base[start:start+n][None]
for block in self.blocks: q=block(q,m,mask)
levels.append(q)
q=torch.cat(levels,dim=1)
else:
q=base.unsqueeze(0).expand(len(m),-1,-1)
for block in self.blocks: q=block(q,m,mask)
return self.norm(q),m
def encode(self,features,mask): return self._encode(features,mask)[0]
def forward(self,features,mask):
h,m=self._encode(features,mask); out={'nodes':self.node(h)}
if self.span_q is not None:
z=[(q(h)@k(m).transpose(1,2))/math.sqrt(h.shape[-1]) for q,k in zip(self.span_q,self.span_k)]
out['spans']=torch.stack(z,dim=2).masked_fill(~mask.bool()[:,None,None,:],-1e4)
if self.dep is not None: out['deps']=self.dep(h)
return out1234567891011121314151617181920212223242526272829303132333435363738from __future__ import annotations
import random
import struct
MASK=0xffffffff
def evaluate(op,args,values,x):
results=[]
for i,k in enumerate(op):
def get(j):
a=args[i][j]
return values[i][j] if a==12 else x[a-1] if 1<=a<=3 else results[a-4]
a=get(0)
if k==7: return a
b=get(1); results.append((a+b,a-b,a*b,a^b,a&b,a|b)[k-1]&MASK)
raise ValueError('no ret')
def samples(n):
edge=[(0,0,0),(1,1,1),(MASK,MASK,MASK),(0,MASK,1),(MASK,0,1),(1,0,MASK),(0x80000000,0x7fffffff,0x55555555),(0xaaaaaaaa,0x55555555,0x80000000)]
rng=random.Random(971); return edge[:n]+[tuple(rng.getrandbits(32) for _ in range(3)) for _ in range(max(0,n-len(edge)))]
def verify_binary(raw,row,xs):
from unicorn import Uc, UC_ARCH_X86, UC_MODE_64, UC_PROT_READ, UC_PROT_WRITE, UC_PROT_EXEC
from unicorn.x86_const import UC_X86_REG_RSP, UC_X86_REG_RIP, UC_X86_REG_EAX, UC_X86_REG_EDI, UC_X86_REG_ESI, UC_X86_REG_EDX, UC_X86_REG_RAX, UC_X86_REG_RBX, UC_X86_REG_RCX, UC_X86_REG_RBP, UC_X86_REG_R8, UC_X86_REG_R9, UC_X86_REG_R10, UC_X86_REG_R11, UC_X86_REG_R12, UC_X86_REG_R13, UC_X86_REG_R14, UC_X86_REG_R15, UC_X86_REG_RDI, UC_X86_REG_RSI, UC_X86_REG_RDX, UC_X86_REG_EFLAGS
base=0x100000; stack=0x200000; size=0x10000; stop=base+0x1000
if len(raw)>=0x1000: raise ValueError('function exceeds emulator code page')
uc=Uc(UC_ARCH_X86,UC_MODE_64); uc.mem_map(base,0x2000,UC_PROT_READ|UC_PROT_WRITE|UC_PROT_EXEC); uc.mem_write(base,raw); uc.mem_protect(base,0x2000,UC_PROT_READ|UC_PROT_EXEC); uc.mem_map(stack,size,UC_PROT_READ|UC_PROT_WRITE)
rsp=stack+size//2-8
regs=(UC_X86_REG_RAX,UC_X86_REG_RBX,UC_X86_REG_RCX,UC_X86_REG_RBP,UC_X86_REG_R8,UC_X86_REG_R9,UC_X86_REG_R10,UC_X86_REG_R11,UC_X86_REG_R12,UC_X86_REG_R13,UC_X86_REG_R14,UC_X86_REG_R15,UC_X86_REG_RDI,UC_X86_REG_RSI,UC_X86_REG_RDX)
for x in xs:
for reg in regs: uc.reg_write(reg,0)
uc.reg_write(UC_X86_REG_EFLAGS,2); uc.mem_write(rsp-4096,b'\0'*8192); uc.mem_write(rsp,struct.pack('<Q',stop)); uc.reg_write(UC_X86_REG_RSP,rsp)
for reg,v in zip((UC_X86_REG_EDI,UC_X86_REG_ESI,UC_X86_REG_EDX),x): uc.reg_write(reg,v)
uc.emu_start(base,stop,count=512)
actual=uc.reg_read(UC_X86_REG_EAX); expected=evaluate(*row[1:],x)
if uc.reg_read(UC_X86_REG_RIP)!=stop or uc.reg_read(UC_X86_REG_RSP)!=rsp+8 or actual!=expected: raise ValueError(f'row {row[0]}: emulator mismatch on {x}, {actual} != {expected}')123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113from __future__ import annotations
import math
import torch
from torch import nn
from . import neurocc as nc
from . import neurocc_ast as ast
def tables(entries, p):
"""IDs 0/1 are reserved; validate training-derived template dictionary."""
n = len(entries) + 2
fixed = torch.zeros(n, 15, dtype=torch.long)
lengths = torch.zeros(n, dtype=torch.long)
positions = torch.zeros(n, 15, dtype=torch.long)
field = torch.zeros(n, p, dtype=torch.long)
rank = torch.zeros(n, p, dtype=torch.long)
for i, e in enumerate(entries, 2):
l, f, tags, pos = e['length'], e['fixed_bytes'], e['field_tags'], e['payload_positions']
if e['id'] != i or not 1 <= l <= 15 or len(f) != l or len(tags) != l or any(not 0 <= b <= 255 for b in f) or any(t not in (0, 1, 2) for t in tags) or pos != [j for j,t in enumerate(tags) if t] or len(pos) > p:
raise ValueError(f'invalid template {i}')
lengths[i] = l; fixed[i, :l] = torch.tensor(f)
counts = {1: 0, 2: 0}
for k, j in enumerate(pos):
tag = tags[j]; positions[i, j] = k + 1
field[i, k] = tag; rank[i, k] = counts[tag]; counts[tag] += 1
if counts[1] > 4: raise ValueError('immediates wider than 32 bits not supported')
return dict(fixed=fixed, lengths=lengths, positions=positions, field=field, rank=rank)
def materialize(tab, ids, payload, count, out):
"""Parallel lookup, exclusive prefix sum and scatter; no ISA rules."""
lengths = tab['lengths'][ids]
pos = tab['positions'][ids]
data = torch.cat((torch.zeros_like(payload[..., :1]), payload), -1)
values = torch.where(pos.ne(0), data.gather(-1, pos), tab['fixed'][ids])
active = torch.arange(ids.shape[1], device=ids.device)[None, :] < count[:, None]
lengths = lengths * active
offsets = lengths.cumsum(1) - lengths
j = torch.arange(15, device=ids.device)[None, None, :]
valid = j < lengths[..., None]
dst = offsets[..., None] + j
total = lengths.sum(1)
buf = torch.zeros((len(ids), out), dtype=torch.long, device=ids.device)
buf.scatter_add_(1, dst.clamp(0,out-1).flatten(1), torch.where(valid & dst.lt(out), values, 0).flatten(1))
index = torch.arange(out, device=ids.device)[None, :]
y = torch.where(index < total[:,None], buf, torch.where(index == total[:,None], nc.EOS, nc.PAD))
good = (count > 0) & (count <= ids.shape[1]) & (total < out) & ((ids >= 2) | ~active).all(1)
return torch.where(good[:,None], y, nc.PAD)
class BinaryStage(nn.Module):
"""Predict count, template IDs and template-conditioned payload bytes."""
def __init__(self,cfg):
super().__init__(); self.cfg=cfg; d=cfg['width']; self.d=d; self.s=cfg['slots']; self.p=cfg['payload_width']; self.mode=cfg['mode']; self.graph=self.mode in ('graph','copy','oracle_copy'); self.latent=self.mode!='oracle_copy'; self.copy=self.mode.endswith('copy'); self.nt=len(cfg['templates'])+2; self.ps=cfg['source_slots']; self.pw=cfg['source_operands']
self.proj=nn.Linear(cfg['input_width'],d) if self.latent else None
self.pos=nn.Parameter(torch.randn(self.ps,d)*.02); self.memnorm=nn.LayerNorm(d)
if self.graph:
self.source_sig=nn.Embedding(len(cfg['source_vocab']),d)
self.source_reg=nn.Embedding(len(cfg['register_vocab']),16)
self.source_num=nn.Embedding(len(cfg['immediate_vocab'])+1,16)
self.source_stack=nn.Embedding(len(cfg['stack_vocab'])+1,8)
self.source_operands=nn.Linear(self.pw*40,d)
self.query=nn.Parameter(torch.randn(self.s,d)*.02)
self.blocks=nn.ModuleList([ast.Block(d,cfg['heads'],cfg['dropout'],True) for _ in range(cfg['layers'])]); self.norm=nn.LayerNorm(d)
self.template=nn.Linear(d,self.nt); self.count=nn.Linear(d,self.s); self.template_emb=nn.Embedding(self.nt,d)
self.payload_head=nn.Sequential(nn.Linear(d,d),nn.GELU(),nn.Linear(d,self.p*256))
if self.copy:
self.copy_query=nn.Linear(d,d); self.copy_key=nn.Linear(d,d); self.copy_number=nn.Embedding(len(cfg['immediate_vocab'])+1,d); self.copy_pos=nn.Parameter(torch.randn(self.pw,d)*.02); self.gate=nn.Linear(d,1)
for k,v in tables(cfg['templates'],self.p).items(): self.register_buffer('tab_'+k,v,persistent=False)
for k in ('imm','stack'): self.register_buffer('src_'+k+'_mask',torch.tensor(cfg['source_'+k+'_mask'],dtype=torch.bool),persistent=False)
self.register_buffer('numbers',torch.tensor(cfg['immediate_vocab'],dtype=torch.long),persistent=False)
self.register_buffer('stacks',torch.tensor(cfg['stack_vocab'],dtype=torch.long),persistent=False)
def table(self): return {k:getattr(self,'tab_'+k) for k in ('fixed','lengths','positions','field','rank')}
@staticmethod
def ids(values,vocab,mask):
matches=values.unsqueeze(-1).eq(vocab); return (matches.long().argmax(-1)+1).masked_fill(~matches.any(-1)|~mask,0)
def encode(self,h,mask,sig,reg,imm,stack):
m=self.pos[None].expand(len(h),-1,-1)
if self.latent: m=m+self.proj(h.float())
ni=None; valid=None
if self.graph:
valid=self.src_imm_mask[sig]; ni=self.ids(imm,self.numbers,valid); si=self.ids(stack,self.stacks,self.src_stack_mask[sig]); valid=valid&ni.ne(0)
m=m+self.source_sig(sig)+self.source_operands(torch.cat((self.source_reg(reg),self.source_num(ni),self.source_stack(si)),-1).flatten(2))
m=self.memnorm(m); q=self.query[None].expand(len(h),-1,-1)
for block in self.blocks: q=block(q,m,mask)
return self.norm(q),m,ni,valid,imm
def forward(self,*inputs):
z,mem,ni,valid,imm=self.encode(*inputs)
logits=self.template(z); logits=logits.masked_fill(torch.arange(self.nt,device=z.device)<2,-1e4)
return z,mem,ni,valid,imm,logits,self.count(z.mean(1))
def payload_logits(self,out,ids):
z,m,ni,valid,imm,_,_=out; b,s,d=z.shape; q=z+self.template_emb(ids)
gen=self.payload_head(q).reshape(b,s,self.p,256)
if not self.copy: return gen
# One learned pointer distribution per instruction. Values are copied
# from predicted source operands; only serialization of bytes is exact.
# Displacements are always predicted, never calculated from stack slots.
keys=self.copy_key(m.unsqueeze(2)+self.copy_number(ni)+self.copy_pos).flatten(1,2)
valid=valid.flatten(1); score=torch.einsum('bsd,bkd->bsk',self.copy_query(q),keys)/math.sqrt(d)
prob=score.masked_fill(~valid[:,None,:],-1e4).softmax(-1)*valid[:,None,:]
vals=imm.flatten(1)[:,None,None,:]; rank=self.tab_rank[ids]; bytes_=((vals >> (8*rank.unsqueeze(-1))) & 255).expand(b,s,self.p,-1)
cp=torch.zeros_like(gen).scatter_add(-1,bytes_,prob.unsqueeze(2).expand_as(bytes_))
gate=self.gate(q).sigmoid().unsqueeze(-1)*self.tab_field[ids].eq(1).unsqueeze(-1)*valid.any(-1)[:,None,None,None]
return ((1-gate)*gen.softmax(-1)+gate*cp).clamp_min(1e-12).log()
def decode(self,out):
ids=out[-2].argmax(-1); count=out[-1].argmax(-1)+1
payload=self.payload_logits(out,ids).argmax(-1)
y=materialize(self.table(),ids,payload,count,self.cfg['out_bytes'])
active=torch.arange(self.s,device=ids.device)[None,:]<count[:,None]
ids=ids.masked_fill(~active,0); payload=payload.masked_fill(~self.tab_field[ids].ne(0),0)
return ids,count,payload,y1234567891011121314151617181920212223242526272829303132333435363738394041424344454647from __future__ import annotations
import torch
from torch import nn
from . import neurocc_ast as ast
SLOTS=8
OPS=('PAD','add','sub','mul','xor','and','or','ret')
REF=4
CONST=REF+SLOTS
NVAL=CONST+1
class IRStage(nn.Module):
"""Learned instruction queries -> SSA latent slots; no teacher forcing."""
def __init__(self,cfg):
super().__init__(); self.cfg=dict(cfg); d=cfg['width']; mode=cfg['mode']; self.mode=mode
self.ap=nn.Sequential(nn.Linear(cfg['ast_width'],d),nn.LayerNorm(d)) if mode in ('cross','standard','deps','ast_qwen') else None
self.qp=nn.Sequential(nn.Linear(cfg['qwen_width'],d),nn.LayerNorm(d)) if mode in ('qwen','ast_qwen') else None
self.discrete=nn.Embedding(73,d) if mode in ('oracle','discrete') else None
self.ast_pos=nn.Parameter(torch.randn(15,d)*.02) if mode!='qwen' else None
self.query=nn.Parameter(torch.randn(SLOTS,d)*.02)
self.blocks=nn.ModuleList([ast.Block(d,cfg['heads'],cfg['dropout'],True) for _ in range(cfg['layers'])]); self.norm=nn.LayerNorm(d)
self.op=nn.Linear(d,len(OPS)); self.args=nn.Linear(d,2*NVAL); self.const=nn.Linear(d,2*4*256)
def encode(self, a=None, q=None, mask=None):
mem=[]; valid=[]
if self.ap is not None or self.discrete is not None:
m=self.ap(a.float()) if self.ap is not None else self.discrete(a.long())
m=m+self.ast_pos; mem.append(m); valid.append(torch.ones(m.shape[:2],dtype=torch.bool,device=m.device))
if self.qp is not None:
m=self.qp(q.float()); mem.append(m); valid.append(mask.bool())
m=torch.cat(mem,1); keep=torch.cat(valid,1); h=self.query[None].expand(len(m),-1,-1)
for b in self.blocks: h=b(h,m,keep)
return self.norm(h)
def forward(self,a=None,q=None,mask=None):
h=self.encode(a,q,mask); return self.op(h),self.args(h).reshape(len(h),SLOTS,2,NVAL),self.const(h).reshape(len(h),SLOTS,2,4,256)
def decode(out):
op=out[0].argmax(-1); arg=out[1].argmax(-1)
arg=arg.masked_fill(op.eq(0).unsqueeze(-1),0); arg[:,:,1]=arg[:,:,1].masked_fill(op.eq(7),0)
c=(out[2].argmax(-1)<<torch.arange(0,32,8,device=arg.device)).sum(-1).masked_fill(arg.ne(CONST),0)
return op,arg,c1234567891011121314151617181920212223242526272829303132333435363738394041424344from __future__ import annotations
import math
import torch
from torch import nn
import torch.nn.functional as F
from . import neurocc_ast as ast
from . import neurocc_ir_unfolded as ir
class ISELStage(nn.Module):
def __init__(self,cfg):
super().__init__(); self.cfg=cfg; d=cfg['width']; s=cfg['slots']; w=cfg['operands']; self.s=s; self.w=w; self.mode=cfg['mode']; self.pointer=self.mode!='direct'; self.graph=self.mode in ('graph','oracle')
self.proj=nn.Linear(cfg['input_width'],d); self.pos=nn.Parameter(torch.randn(8,d)*.02); self.memnorm=nn.LayerNorm(d)
if self.graph: self.graph_proj=nn.Linear(len(ir.OPS)+2*ir.NVAL+64,d)
self.query=nn.Parameter(torch.randn(s,d)*.02); self.blocks=nn.ModuleList([ast.Block(d,cfg['heads'],cfg['dropout'],True) for _ in range(cfg['layers'])]); self.norm=nn.LayerNorm(d)
self.sig=nn.Linear(d,len(cfg['vocab'])); self.num=nn.Linear(d,w*(len(cfg['immediate_vocab'])+1))
if self.pointer: self.rq=nn.Linear(d,w*d); self.rk=nn.Linear(d,d)
else: self.ref=nn.Linear(d,w*s)
# Signature-specific operand roles are decoded by table lookup, not an instruction selector.
self.register_buffer('rm',torch.tensor(cfg['signature_ref_mask'],dtype=torch.bool),persistent=False); self.register_buffer('cm',torch.tensor(cfg['signature_imm_mask'],dtype=torch.bool),persistent=False)
self.register_buffer('numbers',torch.tensor([0]+cfg['immediate_vocab'],dtype=torch.long),persistent=False)
def encode(self,h,so,sa,sv):
m=self.proj(h.float())+self.pos
if self.graph:
f=torch.cat([F.one_hot(so,len(ir.OPS)),F.one_hot(sa,ir.NVAL).flatten(2),((sv.unsqueeze(-1)>>torch.arange(32,device=h.device))&1).flatten(2)],-1).float(); m=m+self.graph_proj(f)
m=self.memnorm(m); q=self.query.unsqueeze(0).expand(len(h),-1,-1); mask=torch.ones(m.shape[:2],dtype=torch.bool,device=m.device)
for block in self.blocks: q=block(q,m,mask)
return self.norm(q)
def heads(self,h):
b,s,d=h.shape; p=self.sig(h); num=self.num(h).reshape(b,s,self.w,-1); num=num.masked_fill(torch.arange(num.shape[-1],device=h.device)==0,-1e4)
if self.pointer: ref=torch.einsum('bswd,btd->bswt',self.rq(h).reshape(b,s,self.w,d),self.rk(h))/math.sqrt(d)
else: ref=self.ref(h).reshape(b,s,self.w,s)
# Index k references defining slot k; no forward/self references. Slot 0
# has no legal references; its logits never contribute to reference loss.
ix=torch.arange(s,device=h.device); ref=ref.masked_fill((ix[None,:]>=ix[:,None])[None,:,None,:],-1e4)
return p,ref,num
def forward(self,*x): return self.heads(self.encode(*x))
def decode(self,out):
p,r,c=out; sig=p.argmax(-1); ref=(r.argmax(-1)+1).masked_fill(~self.rm[sig],0); imm=self.numbers[c.argmax(-1)].masked_fill(~self.cm[sig],0); return sig,ref,imm1234567891011121314151617181920212223242526272829303132333435363738394041from __future__ import annotations
import math
import torch
from torch import nn
from . import neurocc_ir_unfolded as ir
from . import neurocc_isel as v1
K=ir.SLOTS*2
class ISELStageV2(v1.ISELStage):
def __init__(self,cfg):
super().__init__({**cfg,'mode':'graph'}); self.cfg=cfg; self.mode=cfg['mode']; d=cfg['width']; self.use_latent=self.mode in ('copy','aligned_copy'); self.aligned=self.mode in ('aligned_copy','oracle_aligned')
self.src_op=nn.Embedding(len(ir.OPS),d); self.src_arg=nn.Embedding(ir.NVAL,d); self.src_bits=nn.Linear(32,d); self.src_slot=nn.Parameter(torch.randn(ir.SLOTS,d)*.02); self.src_role=nn.Parameter(torch.randn(2,d)*.02)
self.src_lat=nn.Linear(cfg['input_width'],d) if self.use_latent else None
self.src_norm=nn.LayerNorm(d); self.cq=nn.Linear(d,self.w*d); self.ck=nn.Linear(d,d); self.gate=nn.Linear(d,self.w); self.aq=nn.Linear(d,d); self.ak=nn.Linear(d,d)
def encode(self,h,so,sa,sv):
return super().encode(h if self.use_latent else torch.zeros_like(h),so,sa,sv)
def heads(self,h,source,so,sa,sv,details=False):
p,r,c=super().heads(h); b,s,d=h.shape
bits=((sv.unsqueeze(-1)>>torch.arange(32,device=h.device))&1).float()
keys=self.src_op(so).unsqueeze(2)+self.src_arg(sa)+self.src_bits(bits)+self.src_slot[:,None]+self.src_role
if self.use_latent: keys=keys+self.src_lat(source.float()).unsqueeze(2)
keys=self.src_norm(keys); q=self.cq(h).reshape(b,s,self.w,d)
logits=torch.einsum('bswd,bkd->bswk',q,self.ck(keys.flatten(1,2)))/math.sqrt(d)
# Only actual predicted IR constant operands with representable values.
flat=sv.flatten(1); matches=flat.unsqueeze(-1).eq(self.numbers[1:]); valid=sa.flatten(1).eq(ir.CONST)&matches.any(-1)&so.ne(0).unsqueeze(-1).expand(-1,-1,2).flatten(1)
ids=matches.long().argmax(-1)+1; ids=ids.masked_fill(~valid,0)
att=logits.masked_fill(~valid[:,None,None,:],-1e4).softmax(-1)*valid[:,None,None,:]
g=self.gate(h).sigmoid().unsqueeze(-1)*valid.any(-1)[:,None,None,None]
copy=torch.zeros_like(c).scatter_add(-1,ids[:,None,None,:].expand(b,s,self.w,K),att)
logp=((1-g)*c.softmax(-1)+g*copy).clamp_min(1e-12).log()
if not details: return p,r,logp
align=torch.einsum('bsd,btd->bst',self.aq(h),self.ak(keys.mean(2)))/math.sqrt(d)
align=align.masked_fill(~so.ne(0)[:,None,:],-1e4)
return (p,r,logp),g*att,align,valid
def forward(self,*x): return self.heads(self.encode(*x),*x)123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129from __future__ import annotations
import random
import re
import torch
from torch import nn
from . import neurocc as nc
from . import neurocc_ir_unfolded as ir
from . import neurocc_backend_trace as bt
def require(condition, message):
if not condition:
raise ValueError(message)
class NeuralCompiler(nn.Module):
"""Exactly mirror the train/export interfaces, including FP16 boundaries."""
def __init__(self, backbone, ast_stage, ir_stage, isel_stage, regalloc_stage, binary_stage, dev):
super().__init__()
self.backbone = backbone
self.ast = ast_stage
self.ir = ir_stage
self.isel = isel_stage
self.regalloc = regalloc_stage
self.binary = binary_stage
self.dev = torch.device(dev)
self.eval().requires_grad_(False)
def isel_step(self, h, ip):
# V2 heads also consume the actual predicted SSA, including operand addresses.
m = self.isel.encode(h, *ip).half()
mp = self.isel.decode(self.isel.heads(m.float(), h, *ip))
return m, mp
def stages(self, ids, mask):
# Qwen cache was produced with CUDA FP16 autocast. Other stages were FP32.
with nc.amp(self.dev):
q = self.backbone(ids, mask)[0].half()
a = self.ast.encode(q, mask).half()
# The selected progressive IR chain is dependency AST -> unfolded IR.
h = self.ir.encode(a, None, None).half()
z = h.float()
n = len(z)
ip = ir.decode((self.ir.op(z), self.ir.args(z).reshape(n,ir.SLOTS,2,ir.NVAL),
self.ir.const(z).reshape(n,ir.SLOTS,2,4,256)))
m, mp = self.isel_step(h, ip)
r, mem, source_ids = self.regalloc.encode(m, *mp)
r = r.half()
rp = self.regalloc.decode(self.regalloc.heads(r.float(), mem, source_ids))
rm = torch.ones(r.shape[:2], dtype=torch.bool, device=r.device)
bp = self.binary.decode(self.binary(r, rm, *rp))
return bp, (a, h, ip, m, mp, r, rp)
def forward(self, ids, mask):
return self.stages(ids, mask)[0][-1]
def raw_bytes(row):
vals = row.tolist() if isinstance(row,torch.Tensor) else list(row)
if vals.count(nc.EOS)!=1:
return None
end=vals.index(nc.EOS)
if not end or any(not 0<=v<256 for v in vals[:end]) or any(v!=nc.PAD for v in vals[end+1:]):
return None
return bytes(vals[:end])
HEADER = re.compile(r'\s*unsigned\s+f\s*\(\s*unsigned\s+a\s*,\s*unsigned\s+b\s*,\s*unsigned\s+c\s*\)\s*\{\s*return\s+(.+?)\s*;\s*\}\s*',re.S)
TOKEN = re.compile(r'\s*(\d+u|[abc()+*^&|\-])')
OP = {'+':1,'-':2,'*':3,'^':4,'&':5,'|':6}
def evaluation_row(source, row_id):
m = HEADER.fullmatch(source)
if not m:
raise ValueError('Evaluation requires the original unsigned f(unsigned a,unsigned b,unsigned c) grammar.')
text=m.group(1).strip(); tokens=[]; p=0
while p<len(text):
t=TOKEN.match(text,p)
if not t: raise ValueError(f'Unsupported evaluation expression at offset {p}')
tokens.append(t.group(1)); p=t.end()
pos=0; op=[]; args=[]; vals=[]
def take():
nonlocal pos
if pos>=len(tokens): raise ValueError('Unexpected end of expression')
t=tokens[pos]; pos+=1; return t
def node(depth=0):
if depth>3: raise ValueError('Expression exceeds training depth 3')
t=take()
if t in ('a','b','c'): return ('abc'.index(t)+1,0)
if t.endswith('u') and t[:-1].isdigit():
v=int(t[:-1]); require(1<=v<=63,'Literal outside training range 1..63'); return (12,v)
require(t=='(','Expected fully parenthesized expression')
a=node(depth+1); k=take(); require(k in OP,'Expected binary operator'); b=node(depth+1); require(take()==')','Expected closing parenthesis')
j=len(op); op.append(OP[k]); args.append([a[0],b[0]]); vals.append([a[1],b[1]]); return (4+j,0)
a=node(); require(pos==len(tokens),'Trailing expression tokens')
op.append(7); args.append([a[0],0]); vals.append([a[1],0]); require(len(op)<=8,'Too many instructions')
while len(op)<8: op.append(0); args.append([0,0]); vals.append([0,0])
return row_id,op,args,vals
def verify_outputs(sources, ids, y, samples, seed):
import capstone
from unicorn import UcError
md=capstone.Cs(capstone.CS_ARCH_X86,capstone.CS_MODE_64)
allowed={'mov','or','sub','add','and','ret','imul','xor','shl','sal'}
# Include standard edge cases, then fresh reproducible random inputs.
xs=bt.samples(min(8,samples)); rng=random.Random(seed)
xs.extend(tuple(rng.getrandbits(32) for _ in range(3)) for _ in range(samples-len(xs)))
entries=[]
for s,i,v in zip(sources,ids,y):
row=evaluation_row(s,i); raw=raw_bytes(v); decoded=False; success=False; reason=None
try:
if raw is None: raise ValueError('Invalid byte serialization')
ins=list(md.disasm(raw,0))
if not ins or sum(x.size for x in ins)!=len(raw) or any(x.mnemonic not in allowed for x in ins) or ins[-1].mnemonic!='ret' or any(x.mnemonic=='ret' for x in ins[:-1]):
raise ValueError('Not a supported complete straight-line function')
decoded=True; bt.verify_binary(raw,row,xs); success=True
except (ValueError,UcError) as e:
reason=str(e)
entries.append(dict(row=i,source=s,hex=raw.hex(' ') if raw else None,disassembled=decoded,semantic=success,error=reason))
return entries
def summarize(entries):
n=len(entries)
return dict(functions=n,serializable=sum(x['hex'] is not None for x in entries)/n,fully_disassembled=sum(x['disassembled'] for x in entries)/n,semantic_accuracy=sum(x['semantic'] for x in entries)/n,semantic_correct=sum(x['semantic'] for x in entries))123456789101112131415161718192021222324252627282930313233343536373839404142434445464748from __future__ import annotations
import math
import torch
from torch import nn
from . import neurocc_ast as ast
class RegisterStage(nn.Module):
def __init__(self,cfg):
super().__init__(); self.cfg=cfg; d=cfg['width']; self.s=cfg['slots']; self.w=cfg['operands']; self.mode=cfg['mode']; self.use_graph=self.mode!='direct'; self.use_latent=self.mode not in ('discrete_copy','oracle_copy'); self.copy=self.mode.endswith('copy'); self.ps=cfg['pre_slots']; self.pw=cfg['pre_operands']; self.nnumbers=len(cfg['immediate_vocab'])+1
self.proj=nn.Linear(cfg['input_width'],d) if self.use_latent else None
self.pos=nn.Parameter(torch.randn(self.ps,d)*.02); self.memnorm=nn.LayerNorm(d)
if self.use_graph:
self.source_sig=nn.Embedding(len(cfg['pre_vocab']),d); self.source_ref=nn.Embedding(self.ps+1,16); self.source_num=nn.Embedding(self.nnumbers,16); self.source_operands=nn.Linear(self.pw*32,d)
self.query=nn.Parameter(torch.randn(self.s,d)*.02); self.blocks=nn.ModuleList([ast.Block(d,cfg['heads'],cfg['dropout'],True) for _ in range(cfg['layers'])]); self.norm=nn.LayerNorm(d)
self.sig=nn.Linear(d,len(cfg['vocab'])); self.reg=nn.Linear(d,self.w*len(cfg['register_vocab'])); self.num=nn.Linear(d,self.w*self.nnumbers); self.stack=nn.Linear(d,self.w*(len(cfg['stack_vocab'])+1))
if self.copy:
self.copy_q=nn.Linear(d,self.w*d); self.copy_k=nn.Linear(d,d); self.copy_num=nn.Embedding(self.nnumbers,d); self.copy_pos=nn.Parameter(torch.randn(self.pw,d)*.02); self.gate=nn.Linear(d,self.w)
for key in ('reg','imm','stack'):
self.register_buffer(key+'mask',torch.tensor(cfg['signature_'+key+'_mask'],dtype=torch.bool),persistent=False)
self.register_buffer('pre_cm',torch.tensor(cfg['pre_imm_mask'],dtype=torch.bool),persistent=False)
self.register_buffer('numbers',torch.tensor([0]+cfg['immediate_vocab'],dtype=torch.long),persistent=False)
self.register_buffer('stacks',torch.tensor([0]+cfg['stack_vocab'],dtype=torch.long),persistent=False)
def source_ids(self,sig,imm):
# The compact literal vocabulary is a representation lookup, not an ALU.
matches=imm.unsqueeze(-1).eq(self.numbers[1:]); ids=(matches.long().argmax(-1)+1).masked_fill(~matches.any(-1),0); return ids.masked_fill(~self.pre_cm[sig],0)
def encode(self,h,sig,ref,imm):
m=self.pos.unsqueeze(0).expand(len(h),-1,-1)
if self.use_latent: m=m+self.proj(h.float())
ids=self.source_ids(sig,imm)
if self.use_graph:
m=m+self.source_sig(sig)+self.source_operands(torch.cat((self.source_ref(ref),self.source_num(ids)),-1).flatten(2))
m=self.memnorm(m); q=self.query.unsqueeze(0).expand(len(h),-1,-1); mask=torch.ones(m.shape[:2],dtype=torch.bool,device=m.device)
for block in self.blocks: q=block(q,m,mask)
return self.norm(q),m,ids
def heads(self,z,m,ids):
b,s,d=z.shape; p=self.sig(z); r=self.reg(z).reshape(b,s,self.w,-1); c=self.num(z).reshape(b,s,self.w,-1); a=self.stack(z).reshape(b,s,self.w,-1)
r=r.masked_fill(torch.arange(r.shape[-1],device=z.device)<2,-1e4); c=c.masked_fill(torch.arange(c.shape[-1],device=z.device)==0,-1e4); a=a.masked_fill(torch.arange(a.shape[-1],device=z.device)==0,-1e4)
if self.copy:
keys=self.copy_k(m.unsqueeze(2)+self.copy_num(ids)+self.copy_pos).flatten(1,2); query=self.copy_q(z).reshape(b,s,self.w,d); flat=ids.flatten(1); valid=flat.ne(0)
attn=torch.einsum('bswd,bkd->bswk',query,keys)/math.sqrt(d); attn=attn.masked_fill(~valid[:,None,None,:],-1e4); probs=attn.softmax(-1)*valid[:,None,None,:]; copy_probs=torch.zeros_like(c).scatter_add(-1,flat[:,None,None,:].expand(b,s,self.w,-1),probs); gate=self.gate(z).sigmoid().unsqueeze(-1)*valid.any(-1)[:,None,None,None]; c=((1-gate)*c.softmax(-1)+gate*copy_probs).clamp_min(1e-12).log()
return p,r,c,a
def forward(self,*x): return self.heads(*self.encode(*x))
def decode(self,out):
p,r,c,a=out; s=p.argmax(-1); return s,r.argmax(-1).masked_fill(~self.regmask[s],0),self.numbers[c.argmax(-1)].masked_fill(~self.immmask[s],0),self.stacks[a.argmax(-1)].masked_fill(~self.stackmask[s],0)1234567891011121314151617181920212223from __future__ import annotations
import math
import torch
from . import neurocc_regalloc as v1
class RegisterStageV2(v1.RegisterStage):
"""Identical v1 copy architecture, with optional supervised copy addresses.
Both discrete and hybrid modes share the same categorical fallback head.
"""
def __init__(self,cfg):
mode=cfg['mode']; base={'aligned_copy':'copy','discrete_aligned':'discrete_copy'}.get(mode,mode)
super().__init__({**cfg,'mode':base}); self.cfg=cfg; self.mode=mode; self.aligned=mode in ('aligned_copy','discrete_aligned')
def heads(self,z,m,ids,details=False):
b,s,d=z.shape; p=self.sig(z); r=self.reg(z).reshape(b,s,self.w,-1); c=self.num(z).reshape(b,s,self.w,-1); a=self.stack(z).reshape(b,s,self.w,-1)
r=r.masked_fill(torch.arange(r.shape[-1],device=z.device)<2,-1e4); c=c.masked_fill(torch.arange(c.shape[-1],device=z.device)==0,-1e4); a=a.masked_fill(torch.arange(a.shape[-1],device=z.device)==0,-1e4)
keys=self.copy_k(m.unsqueeze(2)+self.copy_num(ids)+self.copy_pos).flatten(1,2); query=self.copy_q(z).reshape(b,s,self.w,d); flat=ids.flatten(1); valid=flat.ne(0)
attn=torch.einsum('bswd,bkd->bswk',query,keys)/math.sqrt(d); attn=attn.masked_fill(~valid[:,None,None,:],-1e4); probs=attn.softmax(-1)*valid[:,None,None,:]
cp=torch.zeros_like(c).scatter_add(-1,flat[:,None,None,:].expand(b,s,self.w,-1),probs); gate=self.gate(z).sigmoid().unsqueeze(-1)*valid.any(-1)[:,None,None,None]; c=((1-gate)*c.softmax(-1)+gate*cp).clamp_min(1e-12).log()
out=(p,r,c,a)
return (out,gate*probs,flat) if details else out12345678910"""Optional evaluation only: never repairs predictions or executes them natively."""import torchfrom .neurocc_live_v2 import verify_outputsfrom . import neurocc as nc
def verify(source,machine_code,samples=32,seed=20261125): if samples<1: raise ValueError('samples must be positive') if not machine_code: raise ValueError('Empty machine code') row=torch.tensor([*machine_code,nc.EOS],dtype=torch.long) return verify_outputs([source],[0],[row],samples,seed)[0]123456789101112131415161718192021[build-system]requires = ["setuptools>=70"]build-backend = "setuptools.build_meta"
[project]name = "neuro_compiler"version = "0.1.0.dev0"description = "Experimental non-autoregressive neural compiler for restricted unsigned expressions"license = "Apache-2.0"requires-python = ">=3.10"dependencies = ["torch>=2.4", "transformers==4.57.6", "safetensors>=0.4", "huggingface-hub>=0.36,<1"]
[project.optional-dependencies]evaluation = ["capstone==5.0.9", "unicorn==2.1.4"]dev = ["pytest>=8", "build>=1"]
[project.scripts]neuro-compiler = "neuro_compiler.cli:main"
[tool.setuptools.packages.find]include = ["neuro_compiler*"]1234torch>=2.4transformers==4.57.6safetensors>=0.4huggingface-hub>=0.36,<112345678910111213141516171819import unittestimport torchfrom neuro_compiler import NeuralCompilerfrom neuro_compiler.neurocc_live_v2 import raw_bytes
class Contracts(unittest.TestCase): def test_serialization_rejects_malformed_output(self): for row in ([195,257,257],[195,256],[257],[195,257,0],[999,257]): self.assertIsNone(raw_bytes(torch.tensor(row))) self.assertEqual(raw_bytes(torch.tensor([195,257,256])),b'\xc3')
def test_input_errors_before_model_execution(self): compiler=NeuralCompiler(); compiler.spec={'tokens':96} for source in ('', 'a'*193, 'while(a){}'): with self.assertRaises(ValueError): compiler.predict([source]) with self.assertRaises(TypeError): compiler.compile_batch('source') self.assertEqual(compiler.compile_batch([]),[])
if __name__=='__main__': unittest.main()123version https://git-lfs.github.com/spec/v1oid sha256:dafa71eebb5df2a12d2e9e3e5e30f709d29f464216e6296cc90c14d523a0fbe5size 2897832123version https://git-lfs.github.com/spec/v1oid sha256:68ae6851185af7a5e5c065c5e63b3194238addf9112547c0db88e31e18a33298size 3331152123version https://git-lfs.github.com/spec/v1oid sha256:52aab4ecc660021293b31af0bbe83910e3d41d31ed6318dbec64663a1d5d9fb4size 3228664123version https://git-lfs.github.com/spec/v1oid sha256:f2b58158bfcc4c132136f3666960e4314cba0e7ba9b96a4bcf6e3ceec199790dsize 3029992123version https://git-lfs.github.com/spec/v1oid sha256:e0d0118568df34557704db780fb63e16b1682c2003a6e30b3fd8a42596155497size 3275072.gitattributes-34
.gitignoreAdded+9
LICENSEAdded+202
PUBLISHING.mdAdded+26
README.md+227
THIRD_PARTY_NOTICES.mdAdded+17
config.jsonAdded+12
evaluation/EXCLUDED_ARTIFACTS.mdAdded+15
evaluation/benchmark.jsonAdded+186
evaluation/fresh_test.jsonAdded+334
evaluation/portability.jsonAdded+30
evaluation/preparation.jsonAdded+52
evaluation/regression.jsonAdded+28
evaluation/validation.jsonAdded+329
examples/batch_example.pyAdded+6
examples/compile_example.pyAdded+3
examples/inspect_example.pyAdded+4
manifest.jsonAdded
neuro_compiler/__init__.pyAdded+4
neuro_compiler/cli.pyAdded+18
neuro_compiler/compiler.pyAdded+86
neuro_compiler/neurocc.pyAdded+48
neuro_compiler/neurocc_ast.pyAdded+102
neuro_compiler/neurocc_backend_trace.pyAdded+38
neuro_compiler/neurocc_binary.pyAdded+113
neuro_compiler/neurocc_ir_unfolded.pyAdded+47
neuro_compiler/neurocc_isel.pyAdded+44
neuro_compiler/neurocc_isel_v2.pyAdded+41
neuro_compiler/neurocc_live_v2.pyAdded+129
neuro_compiler/neurocc_regalloc.pyAdded+48
neuro_compiler/neurocc_regalloc_v2.pyAdded+23
neuro_compiler/verification.pyAdded+10
pyproject.tomlAdded+21
requirements.txtAdded+4
tests/test_contract.pyAdded+19
weights/ast.safetensorsAdded+3
weights/binary.safetensorsAdded+3
weights/isel.safetensorsAdded+3
weights/regalloc.safetensorsAdded+3
weights/ssa.safetensorsAdded+3