chrisuser commited on
Commit
81de6d2
·
verified ·
1 Parent(s): 51c8a9f

Release Neuro Compiler 0.3.0

Browse files
This view is limited to 50 files because it contains too many changes.   See raw diff
Files changed (50) hide show
  1. .gitattributes +1 -1
  2. .gitignore +5 -9
  3. ARCHITECTURE.md +5 -52
  4. CHANGELOG.md +8 -17
  5. README.md +80 -279
  6. REPRODUCIBILITY.md +12 -67
  7. SHA256SUMS +53 -0
  8. THIRD_PARTY_NOTICES.md +19 -17
  9. config.json +5 -5
  10. dist/neuro_compiler-0.3.0-py3-none-any.whl +0 -0
  11. evaluation/README.md +0 -19
  12. evaluation/benchmark.json +0 -294
  13. evaluation/cases.json +0 -0
  14. evaluation/clean_final_wheel.json +11 -0
  15. evaluation/contract_tests.json +9 -0
  16. evaluation/evaluate.py +19 -0
  17. evaluation/export_parity.json +14 -0
  18. evaluation/fresh_package_parity.json +10 -0
  19. evaluation/portability.json +19 -17
  20. evaluation/qualification.json +0 -0
  21. evaluation/qualified_codes.json +602 -0
  22. evaluation/regression.json +0 -275
  23. evaluation/test.json +0 -132
  24. evaluation/validation.json +0 -133
  25. examples/compile_example.py +0 -11
  26. examples/eight_operations.cpp +1 -0
  27. manifest.json +0 -0
  28. neuro_compiler/__init__.py +3 -3
  29. neuro_compiler/_verify_worker.py +14 -0
  30. neuro_compiler/backbone.py +74 -0
  31. neuro_compiler/backend/__init__.py +1 -0
  32. neuro_compiler/backend/allocation_constants.py +2 -0
  33. neuro_compiler/backend/allocator.py +120 -0
  34. neuro_compiler/backend/boundary.py +49 -0
  35. neuro_compiler/backend/canonical.py +125 -0
  36. neuro_compiler/backend/encoder.py +53 -0
  37. neuro_compiler/backend/graph.py +90 -0
  38. neuro_compiler/backend/physical.py +11 -0
  39. neuro_compiler/backend/policy.py +44 -0
  40. neuro_compiler/backend/resident.py +85 -0
  41. neuro_compiler/backend/stack.py +153 -0
  42. neuro_compiler/cli.py +17 -20
  43. neuro_compiler/compiler.py +121 -110
  44. neuro_compiler/emulation.py +40 -0
  45. neuro_compiler/legacy/__init__.py +0 -4
  46. neuro_compiler/legacy/cli.py +0 -18
  47. neuro_compiler/legacy/compiler.py +0 -86
  48. neuro_compiler/legacy/neurocc.py +0 -48
  49. neuro_compiler/legacy/neurocc_ast.py +0 -102
  50. neuro_compiler/legacy/neurocc_backend_trace.py +0 -38
.gitattributes CHANGED
@@ -1 +1 @@
1
- *.safetensors filter=lfs diff=lfs merge=lfs -text
 
1
+ *.safetensors filter=lfs diff=lfs merge=lfs -text
.gitignore CHANGED
@@ -1,9 +1,5 @@
1
- __pycache__/
2
- *.pyc
3
- .venv/
4
- *.egg-info/
5
- build/
6
- dist/
7
- .env
8
- *.pt
9
- .cache/
 
1
+ __pycache__/
2
+ *.py[cod]
3
+ *.egg-info/
4
+ build/
5
+ .venv/
 
 
 
 
ARCHITECTURE.md CHANGED
@@ -1,56 +1,9 @@
1
- # Graph compiler architecture
2
 
3
- ```mermaid
4
- flowchart TD
5
- S[Restricted C++ source] --> T[Tokenization and character-offset mapping]
6
- T --> Q[Frozen Qwen blocks 1–6]
7
- Q --> A[Source-indexed neural AST]
8
- A --> SSA[Graph neural SSA]
9
- SSA --> I[Graph neural instruction selection]
10
- I --> R[Occupancy-supervised physical resource streams]
11
- R --> B[Independent neural binary encoding]
12
- B --> P[Bit packing and serialization]
13
- P --> X[Callable x86-64 SysV bytes]
14
- ```
15
 
16
- The AST predicts active nodes, types, literal values, root and child pointers at
17
- source-character identities. Raw tokenizer offsets map input characters to
18
- features; they do not parse expressions or identify AST structure.
19
 
20
- SSA preserves computational identities and learns execution ordering, value
21
- dependencies and operand references. Instruction selection retains associations
22
- with originating computations through learned pointers and copying of operand
23
- identities and immediate values.
24
 
25
- The allocator maintains latent streams for physical register resources. Local
26
- temporal processing learns bindings and instruction-emission counts. Register
27
- content supervision supplies an auxiliary training signal at reference-aligned
28
- boundaries; reference occupancy is never supplied during inference. The model
29
- does not build a deterministic interference graph or run a conventional allocator.
30
-
31
- The independent binary encoder operates per physical MIR instruction, predicting
32
- encoding templates and payload fields. Tensor lookup, bit packing, concatenation
33
- and EOS/PAD serialization are infrastructure around learned encoding decisions.
34
- There is no conventional assembler, ISA-based correction or semantic repair.
35
-
36
- | Stage | Parameters | Selected epoch |
37
- | --- | ---: | ---: |
38
- | AST | 753,739 | 68 |
39
- | SSA | 1,078,162 | 79 |
40
- | Instruction selection | 913,695 | 68 |
41
- | Register allocation | 585,134 | 30 |
42
- | Independent binary encoder | 311,553 | 2 |
43
- | Specialized total | 3,642,283 | |
44
- | Frozen backbone | 225,608,960 | |
45
- | Compiler total | 229,251,243 | |
46
-
47
- Precision boundaries, masks, graph identity conventions, register descriptors,
48
- instruction vocabularies and encoding templates are preserved in the packaged
49
- definitions and manifest configs. Intermediate APIs return the original graph
50
- fields, MIR fields, emission counts, overflow flags and instruction lengths.
51
-
52
- Resource-stream allocation and independent binary encoding have approximately
53
- linear program-length scaling under fixed resources and local processing.
54
- This is an architectural scaling argument, not measured generalization beyond
55
- seven operations. Other stages, including Qwen attention, retain quadratic
56
- components. Dynamic representations do not imply unrestricted language support.
 
1
+ # Architecture of 0.3.0
2
 
3
+ The source encoder uses the pinned Qwen2.5-Coder-0.5B tokenizer and its first six transformer blocks. The original intermediate-layer contract omits Qwen's final normalization. Learned grounded graph AST, graph SSA and graph instruction selection retain the accepted eight-operation weights and their latent boundaries.
 
 
 
 
 
 
 
 
 
 
 
4
 
5
+ The 15E backend consumes predicted instruction-selection output. CanonicalMIR performs fixed ISA normalization and rejects unsupported or malformed rows. Exact dependency/lifetime computation and resource reservations supply explicit state. The frozen allocator scores choices using the original learned policy's tensor lookup buffers. Tensor stack lowering routes spill slots and enforces explicit register and System V callee-save/stack behavior. The original slot rank weight is negative and recorded in the manifest. A learned resident encoder and explicit numeric-payload routing emit bytes. This backend replaces both earlier neural regalloc and binary layers.
 
 
6
 
7
+ These explicit lifetime, state, stack and ABI mechanisms are production components of the owner-selected hybrid design. They are not described as learned neural algorithms. The scoring LUT is a frozen buffer, not a trainable parameter. No LLVM, assembler or source-reference compiler is called by production inference. The independent verifier alone parses source expressions and runs bounded emulation; it does not repair model predictions.
 
 
 
8
 
9
+ Export uses tensor-only SafeTensors, strict state loading, parameter-count checks and SHA-256 validation. Original accepted checkpoint SHA-256 relationships remain in the manifest. The exported AST/SSA/ISEL/final bytes match all 600 qualified cached-feature examples. Runtime changes are packaging adaptations, not new training.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
CHANGELOG.md CHANGED
@@ -1,19 +1,10 @@
1
- # Changelog
2
 
3
- ## 0.2.0-experimental · Python 0.2.0.dev0
 
 
 
 
 
4
 
5
- * Source-indexed AST and graph-based SSA/instruction selection.
6
- * Occupancy-supervised physical resource streams with the expanded curriculum.
7
- * Independent per-instruction binary encoding; 3,642,283 specialized parameters.
8
- * Trained scope expands to arbitrary binary tree topologies, one–seven operations.
9
- * Exact packaged/live regression on 2,000 validation and 2,000 held-out programs.
10
- * Preserved single/batch/intermediate APIs, pinned revisions, CPU/CUDA loading,
11
- raw bytes and optional subprocess-isolated sampled verification.
12
- * Retained a legacy inference namespace for prior V2 manifests.
13
- * No retraining, quantization or modification of selected checkpoints for export.
14
-
15
- ## 0.1.0-experimental · Python 0.1.0.dev0
16
-
17
- Initial public balanced-expression NeuroCC V2 release. Preserved at Hugging Face
18
- commit `757aecb2942c3bd66c324b925a93dd366a6a6de1`; five specialized stages with
19
- 3,934,092 parameters. Validation 97.4% exact bytes and 97.7% sampled semantics.
 
1
+ # 0.3.0
2
 
3
+ - Freeze the accepted eight-operation neural input/AST/SSA/ISEL chain.
4
+ - Replace legacy regalloc and binary with the frozen Round13/15E hybrid backend.
5
+ - Export portable SafeTensors and immutable provenance with strict weight validation.
6
+ - Package local or Hugging Face loading, CPU/CUDA inference, batch and intermediate APIs, and isolated sampled byte verification.
7
+ - Stream a byte-exact pinned six-block backbone prefix into cache while preserving original intermediate normalization semantics.
8
+ - Publish existing qualification evidence, all 600 source cases and byte predictions, export parity and clean installed-wheel checks.
9
 
10
+ The 0.1.0-experimental and 0.2.0-experimental tags and their artifacts remain unchanged. No additional training was launched to prepare 0.3.0.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
README.md CHANGED
@@ -1,279 +1,80 @@
1
- ---
2
- language:
3
- - en
4
- license: apache-2.0
5
- library_name: neuro_compiler
6
- base_model: Qwen/Qwen2.5-Coder-0.5B
7
- tags:
8
- - neural-compiler
9
- - experimental
10
- - non-autoregressive
11
- - graph
12
- - x86-64
13
- ---
14
-
15
- # Neuro-Compiler · 0.2.0-experimental
16
-
17
- Neuro-Compiler is an experimental, non-autoregressive neural compiler that
18
- translates restricted C++ source directly into callable x86-64 machine-code
19
- functions. Specialized neural networks learn syntax construction, SSA generation,
20
- instruction selection, register allocation and binary encoding. The output is
21
- bytes, not generated assembly text.
22
-
23
- **Research proof of concept, not a production-ready C++ compiler.** Generated
24
- machine code can be incorrect or unsafe. Sampled verification is not formal
25
- equivalence and provides no correctness guarantee. No API executes code natively.
26
-
27
- ## What changed
28
-
29
- This graph architecture replaces the first release's fixed balanced-tree
30
- representations with source identities, graph dependencies and physical resource
31
- streams. It supports the trained range of arbitrary binary tree topologies with
32
- one through seven operations. Specialized parameters decrease from 3,934,092 to
33
- 3,642,283; this is an architectural change, not simply a larger model.
34
-
35
- ```text
36
- Restricted C++ source
37
- ↓ tokenizer + raw character/token offset mapping
38
- Frozen Qwen blocks 1–6
39
- ↓
40
- Source-indexed neural AST
41
- ↓
42
- Graph neural SSA
43
- ↓
44
- Graph neural instruction selection
45
- ↓
46
- Occupancy-supervised physical resource streams
47
- ↓
48
- Independent neural binary encoding
49
- ↓ byte packing and serialization
50
- Callable x86-64 System V function bytes
51
- ```
52
-
53
- The backbone is [Qwen/Qwen2.5-Coder-0.5B](https://huggingface.co/Qwen/Qwen2.5-Coder-0.5B),
54
- revision `0576a1bc0ae53f21860e905e081807bd7ff4a4c7`, first six layers,
55
- 96 input tokens and 225,608,960 retained parameters. Its weights are downloaded
56
- separately. Loading may initially download the complete backbone before unused
57
- layers are discarded. Total retained compiler parameters: **229,251,243**.
58
-
59
- ## Installation
60
-
61
- Python 3.11+; install a CPU or CUDA PyTorch build appropriate for your machine.
62
-
63
- ```bash
64
- hf download chrisuser/neuro-compiler --revision 0.2.0-experimental --local-dir neuro-compiler
65
- python -m pip install ./neuro-compiler
66
- # Optional subprocess-isolated Unicorn verification:
67
- python -m pip install './neuro-compiler[evaluation]'
68
- ```
69
-
70
- CUDA regression used Python 3.14, PyTorch 2.13.0+cu132, Transformers 4.57.6,
71
- SafeTensors 0.8.0 and Hugging Face Hub 0.36.2. A fresh, fully isolated environment
72
- installed the documented dependencies and passed CPU inference with PyTorch
73
- 2.15.0+cpu. Exact cross-version or CPU/CUDA byte identity is not guaranteed.
74
-
75
- ## Python and CLI usage
76
-
77
- ```python
78
- from neuro_compiler import NeuralCompiler
79
-
80
- compiler = NeuralCompiler.from_pretrained(
81
- 'chrisuser/neuro-compiler', revision='0.2.0-experimental', device='cuda'
82
- )
83
- # Local loading and CPU inference also work:
84
- # compiler = NeuralCompiler.from_pretrained('./neuro-compiler', device='cpu')
85
- source = '''unsigned f(unsigned a,unsigned b,unsigned c){
86
- return ((a+b)*(c-7u));
87
- }'''
88
- machine_code = compiler.compile(source)
89
- print(machine_code.hex())
90
- results = compiler.compile_batch([source, source], batch_size=32)
91
- result = compiler.compile(source, return_intermediates=True)
92
- print(result.ast, result.ssa, result.virtual_mir, result.physical_mir)
93
- print(result.machine_code, result.diagnostics)
94
- ```
95
-
96
- ```bash
97
- neuro-compiler --model ./neuro-compiler --file example.cpp --output f.bin
98
- neuro-compiler --model ./neuro-compiler --file example.cpp --verify
99
- ```
100
-
101
- The CLI supports `--revision`, `--device`, source strings and source files.
102
- Output files are raw callable function bytes, **not ELF or PE executables**.
103
- Existing output files are not overwritten. With `--verify`, failed sampled
104
- semantics prevents writing an output file.
105
-
106
- ```python
107
- from neuro_compiler.verification import verify
108
-
109
- if __name__ == '__main__': # required for multiprocessing in standalone scripts
110
- report = verify(source, machine_code, samples=32, timeout=30)
111
- print(report['disassembled'], report['semantic'])
112
- ```
113
-
114
- Verification uses a spawned subprocess, Capstone and Unicorn, with an enforced
115
- timeout. It never repairs model predictions. Serialization, complete disassembly,
116
- sampled semantic correctness, and formal equivalence are distinct. This project
117
- does not provide formal verification or native execution.
118
-
119
- ## Language and target scope
120
-
121
- The training grammar uses `unsigned f(unsigned a,unsigned b,unsigned c)` with
122
- a single return expression. Operands are the three arguments or literals `1u`
123
- through `63u`; operators are `+`, `-`, `*`, `^`, `&`, `|`. Expressions are fully
124
- parenthesized arbitrary binary trees containing one through seven operations.
125
- Arithmetic is unsigned 32-bit wrapping arithmetic. The target is **x86-64 System V**,
126
- not the Windows x64 ABI, even when inference runs on Windows.
127
-
128
- Loops, branches, arbitrary identifiers, pointers, function calls, general memory
129
- operations, broader C++ syntax and general-purpose linking are unsupported.
130
- Lexical checks reject some unsupported inputs but are not a complete grammar
131
- validator. Formatting outside the synthetic training distribution is unvalidated.
132
- Inputs exceeding 96 Qwen tokens are rejected without truncation. Character/token
133
- offset mapping is preserved; there is no deterministic parser in inference.
134
- Allocation overflow and malformed byte sequences raise errors.
135
-
136
- ## Measured end-to-end results
137
-
138
- | Metric | Validation | Held-out test |
139
- | --- | ---: | ---: |
140
- | Programs | 2,000 | 2,000 |
141
- | Sampled-correct programs | 1,974 | 1,963 |
142
- | Sampled semantic accuracy | 98.70% | **98.15%** |
143
- | Fully disassembled | 100% | 100% |
144
- | Serializable | 100% | 100% |
145
- | Exact reference bytes | 98.20% | Not measured |
146
- | Input triples per function | 32 | 32 |
147
-
148
- Packaged versus original `neurocc_graph_live.py` predictions match byte-for-byte
149
- on **all 4,000 validation and held-out programs**. AST, SSA, virtual MIR, physical
150
- MIR, emission counts, overflow flags and instruction lengths also match exactly.
151
- Semantic results match. Single-versus-batch tests passed on 32 programs from
152
- each split. Checkpoints were fixed before these comparisons; held-out results
153
- were not used to select weights or change the architecture.
154
-
155
- | Binary operations | Held-out sampled semantic accuracy |
156
- | ---: | ---: |
157
- | 1 | 100% |
158
- | 2 | 100% |
159
- | 3 | 99.30% |
160
- | 4 | 100% |
161
- | 5 | 98.95% |
162
- | 6 | 95.79% |
163
- | 7 | 92.98% |
164
-
165
- | Expression topology | Held-out sampled semantic accuracy |
166
- | --- | ---: |
167
- | Left chain | 99.80% |
168
- | Balanced shape | 98.39% |
169
- | Right chain | 97.59% |
170
- | Random | 96.83% |
171
-
172
- These are narrow synthetic-distribution measurements. See the exact counts and
173
- split hashes in `evaluation/` and `manifest.json`.
174
-
175
- ## Individual-network measurements
176
-
177
- The occupancy allocator's saved validation reports 98.15% exact physical MIR
178
- reconstruction and 98.60% sampled semantics. These are allocator-stage metrics,
179
- not final held-out compiler metrics. The independent binary encoder reconstructs
180
- 100% of reference validation binaries **given correct reference physical MIR**;
181
- it cannot correct earlier neural errors.
182
-
183
- Occupancy readouts achieve 99.48% overall register-content identity accuracy and
184
- 99.34% computed-value identity accuracy. These measurements use **supervised,
185
- reference-aligned instruction boundaries**; they do not establish end-to-end
186
- runtime register-state correctness. The manifest retains the saved stage metrics.
187
-
188
- ## Performance
189
-
190
- New end-to-end graph-runtime measurements on 2,000 test functions, batch 32,
191
- three repeats: median **4.961 seconds**, **403.15 candidates/second** and
192
- **395.69 sampled-correct candidates/second**. Peak CUDA allocation: **562.14 MiB**
193
- (reserved 616 MiB). Hardware: RTX 2060 SUPER and Intel Core i9-10850K.
194
- Timing includes tokenization, host/device transfers, all neural stages, byte
195
- packing and CPU serialization; it excludes model initialization, file I/O and
196
- verification. Correct throughput multiplies measured candidate throughput by
197
- the separately sampled semantic rate.
198
-
199
- Clang 23.1.2 at `-O0`, batch 128 and eight CPU workers measured **17,648.68
200
- functions/second**, median 0.1133 seconds, for the same source set. This baseline
201
- uses batched C++ translation units and includes frontend/backend compilation;
202
- its correctness was not evaluated by the timing. **These measurements do not
203
- show a performance advantage over Clang.** Conditions differ in batching and
204
- hardware use; see `evaluation/benchmark.json` for the complete methodology.
205
-
206
- Separate synchronized profiling measured milliseconds per function:
207
-
208
- | Stage | ms/function |
209
- | --- | ---: |
210
- | Tokenization and input transfer | 1.0031 |
211
- | Qwen | 1.1426 |
212
- | AST | 0.1522 |
213
- | SSA | 0.2170 |
214
- | Instruction selection | 0.2272 |
215
- | Register allocation | 0.3193 |
216
- | Binary encoding | 0.0618 |
217
- | Output transfer | 0.0038 |
218
-
219
- Synchronization adds overhead; these separate-pass values need not sum to the
220
- unsynchronized end-to-end time. Initialization and CPU smoke-test timings are
221
- recorded in the regression and portability JSON reports. No historical V1 or
222
- 0.1.0 throughput is presented as a measurement of this architecture.
223
-
224
- ## Training and reproducibility
225
-
226
- The base graph curriculum has 16,000 training, 2,000 validation and 2,000 held-out
227
- programs. Register-allocation training additionally uses 48,000 generated training
228
- candidates (approximately 64,000 total curriculum programs; some generated traces
229
- may be filtered). Exact expansion provenance is recorded in the manifest.
230
- Reference traces supervise training and evaluation only. No dataset, cached
231
- activations, compiler traces, optimizer state or training script is required by
232
- the installed inference package.
233
-
234
- All five original checkpoint hashes and selected epochs are recorded in
235
- `manifest.json`, together with configs, vocabularies, register descriptors,
236
- encoding templates, dataset hashes and exported SafeTensors hashes. They are
237
- unquantized FP32 specialized weights, preserving exact values and dtypes.
238
- CUDA Qwen uses the original FP16/autocast path; FP16 inter-stage boundaries and
239
- FP32 specialized operations match the live implementation. CPU Qwen uses FP32.
240
- The loader verifies file hashes, state schemas and vocabulary compatibility.
241
-
242
- Local preparation tools in the development checkout are
243
- `neurocc_graph_export.py`, `neurocc_graph_release_test.py`,
244
- `neurocc_graph_release_smoke.py` and `neurocc_graph_release_benchmark.py`.
245
- They operate on original artifacts without training or modifying weights.
246
- The installed-wheel portability test ran in a fresh dependency environment,
247
- outside the checkout, while denying access to original development directories.
248
-
249
- The previous release remains reproducible at commit
250
- `757aecb2942c3bd66c324b925a93dd366a6a6de1`. The library also dispatches legacy
251
- V2 manifests to its preserved legacy inference implementation. Use a pinned
252
- revision rather than moving `main` for reproducibility.
253
-
254
- ## Research directions
255
-
256
- The next studies target 15, 31 and larger operation counts; more identifiers,
257
- literals and operators; longer-range value tracking and allocation; control flow
258
- and memory; and alternative pretrained frontends. Generalization beyond the
259
- current seven-operation curriculum remains open.
260
-
261
- Source identities and graph pointers retain computational associations across
262
- stages. Several stages have size-independent learned parameters. Resource streams
263
- and independent binary encoding have approximately linear length scaling under
264
- fixed-resource and local-processing assumptions. **The whole compiler is not
265
- linear-time**: Qwen and other attention stages retain quadratic components.
266
- See [ARCHITECTURE.md](ARCHITECTURE.md).
267
-
268
- Natural-language-to-SSA compilation and general-purpose language models with
269
- specialized executable-output heads are proposed research directions, not
270
- features of this release. The long-term question is whether pretrained models
271
- can emit executable computations through learned backends without textual source
272
- or assembly as intermediate outputs. No claim of being the first neural compiler
273
- or of guaranteed executable correctness is made.
274
-
275
- ## License
276
-
277
- Apache-2.0 for project code and specialized weights, following 0.1.0's conventions.
278
- The pinned Qwen model metadata declares Apache-2.0. Qwen weights and third-party
279
- source are not redistributed here. See `LICENSE` and `THIRD_PARTY_NOTICES.md`.
 
1
+ ---
2
+ language: en
3
+ license: apache-2.0
4
+ library_name: neuro_compiler
5
+ base_model: Qwen/Qwen2.5-Coder-0.5B
6
+ tags:
7
+ - compiler
8
+ - neural-compiler
9
+ - hybrid
10
+ - x86-64
11
+ - safetensors
12
+ ---
13
+ # Neuro Compiler 0.3.0
14
+
15
+ A frozen graph neural compiler for small unsigned C++ expressions, with the Round13/15E **hybrid** register allocator and machine-code backend. Neural source → AST → SSA → instruction selection is followed by exact lifetime/resource/ABI state logic, learned allocation scoring and a learned instruction encoder. This release is **not a wholly neural compiler** or an end-to-end trainable model.
16
+
17
+ Version **0.3.0** freezes the accepted eight-operation upstream checkpoints and the new 15E backend. It replaces the old register-allocation **and binary-emission** stages. All released weights are frozen. Earlier releases remain available at `0.1.0-experimental` and `0.2.0-experimental`; use their matching Python packages.
18
+
19
+ This is a research compiler with known incorrect outputs. Successful serialization is not a correctness guarantee. Sampled execution does not prove equivalence or optimality.
20
+
21
+ ## Install and compile
22
+
23
+ Download `dist/neuro_compiler-0.3.0-py3-none-any.whl` from this repository's **0.3.0 tag**, then:
24
+
25
+ ```bash
26
+ python -m pip install "./neuro_compiler-0.3.0-py3-none-any.whl[evaluation]"
27
+ ```
28
+
29
+ Alternatively, download this tagged repository and run `python -m pip install ".[evaluation]"` in its root. The wheel contains code; model weights are downloaded separately by `from_pretrained`.
30
+
31
+ ```python
32
+ from neuro_compiler import NeuralCompiler
33
+ from neuro_compiler.verification import verify
34
+
35
+ compiler = NeuralCompiler.from_pretrained(
36
+ "chrisuser/neuro-compiler", revision="0.3.0", device="auto"
37
+ )
38
+ source = "unsigned f(unsigned a,unsigned b,unsigned c){return ((a+b)*(c-7u));}"
39
+ result = compiler.compile(source, return_intermediates=True)
40
+ print(result.machine_code.hex())
41
+ print(result.diagnostics)
42
+ print(verify(source, result.machine_code, samples=32))
43
+ ```
44
+
45
+ `compile(source)` returns bytes. `compile_batch(sources, batch_size=16)` returns a list of byte strings; `strict=False` preserves rejected rows as `None`. `return_intermediates=True` returns `CompilationResult` objects with AST, SSA, virtual MIR, physical MIR and diagnostics. A local downloaded repository directory also works as `model_id`.
46
+
47
+ CPU and CUDA are supported. The first load downloads the pinned Qwen backbone and tokenizer, then caches an exact six-block tensor prefix; upstream weights are not bundled. See [REPRODUCIBILITY.md](REPRODUCIBILITY.md) for memory and precision details.
48
+
49
+ ## Supported scope
50
+
51
+ - Compact `unsigned f(unsigned a,unsigned b,unsigned c){return EXPR;}` functions.
52
+ - One through **eight binary operations**: `+`, `-`, `*`, `^`, `&`, `|`, fully parenthesized expressions, arguments `a`, `b`, `c`, and unsigned literals `1u` through `63u`.
53
+ - Unsigned 32-bit arithmetic; at most **105 raw characters** and **96 tokenizer tokens**. Out-of-scope inputs are not supported. Raw character overflow is rejected, with no truncation.
54
+ - Output is a raw **x86-64 System V** function body: three uint32 arguments, uint32 result. It is **not Windows x64 ABI**, an ELF or PE executable, or a general C/C++ compiler. The evaluation helper emulates bytes; it never executes them natively.
55
+
56
+ ## Actual qualification results
57
+
58
+ These are the existing research validation and regression sets, **not a new held-out test**. The previous 0.2.0 release's held-out score does not describe this release.
59
+
60
+ | Measure | Result |
61
+ | --- | ---: |
62
+ | Validation serialized / valid / ABI | 400 / 400 each |
63
+ | Validation sampled semantic correctness | **397 / 400 (99.25%)** |
64
+ | Hardest validation subset | **48 / 50 (96%)** |
65
+ | Regression sampled semantic correctness | **200 / 200 (100%)** |
66
+ | SafeTensors export parity: AST, SSA, ISEL and final bytes | **600 / 600 each** |
67
+
68
+ Fresh original source-to-bytes qualification used 32 input triples per program, or **19,200 bounded emulated executions**. Three validation errors remain upstream in instruction selection (row IDs 16023, 16063, 16125). No acceptance criteria were weakened. Export parity reuses qualified frozen backbone features to isolate serialization/runtime changes; it is not a new full-backbone evaluation. A separate installed-wheel CPU test performs fresh source inference, with access to development directories denied.
69
+
70
+ One original CUDA pass (600 functions, batch 16) measured 7.15 s startup, 9.09 s source-to-bytes inference and 66.0 functions/s; peak allocated tensor memory was 506.9 MiB. Verification is excluded. These are single-run observations, not a robust performance benchmark or a comparison against LLVM.
71
+
72
+ Evidence and reproducible cases are under [evaluation/](evaluation). See [ARCHITECTURE.md](ARCHITECTURE.md) for what is neural and what is explicit logic.
73
+
74
+ ## Frozen artifacts
75
+
76
+ - Specialized parameters: **2,765,990**; SafeTensors files: **11,089,998 bytes**.
77
+ - Retained frozen Qwen parameters: **225,608,960** (embedding and six blocks; final norm is replaced with Identity to preserve the original intermediate-layer features).
78
+ - Original checkpoint relationships, export hashes, precision and immutable Qwen revision are recorded in `manifest.json`.
79
+ - `SHA256SUMS` covers the release tree except itself. No optimizer states, training caches or pickle checkpoints are published.
80
+ - Apache-2.0 project code and specialized weights; external dependency terms are described in [THIRD_PARTY_NOTICES.md](THIRD_PARTY_NOTICES.md).
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
REPRODUCIBILITY.md CHANGED
@@ -1,77 +1,22 @@
1
- # Reproducibility and publication
2
 
3
- Release identifier: `0.2.0-experimental`; Python package version: `0.2.0.dev0`.
4
- The canonical model repository is `chrisuser/neuro-compiler`, confirmed during
5
- release preparation. Earlier development configuration used `orthagonal`; do not
6
- upload a replacement repository under that name by accident.
7
 
8
- For inference, pin the version tag or exact published commit SHA:
9
-
10
- ```python
11
- from neuro_compiler import NeuralCompiler
12
- compiler=NeuralCompiler.from_pretrained(
13
- 'chrisuser/neuro-compiler',revision='0.2.0-experimental',device='cuda'
14
- )
15
- ```
16
-
17
- Before publication the directory is usable locally with:
18
-
19
- ```bash
20
- python -m pip install '.[evaluation]'
21
- neuro-compiler --model . --source 'unsigned f(unsigned a,unsigned b,unsigned c){return ((a+b)*(c-7u));}' --verify
22
- python -m unittest discover -s tests
23
- ```
24
-
25
- The inference wheel contains code. SafeTensors/configuration files remain in
26
- the downloaded model directory or are resolved through Hugging Face. They are
27
- not duplicated into the wheel. Qwen is separately resolved at the pinned backbone
28
- commit in the manifest. Original datasets and LLVM are not needed for inference.
29
-
30
- Local development-checkout reproduction commands (not runtime dependencies):
31
 
32
  ```bash
33
- python neurocc_graph_export.py
34
- python neurocc_graph_release_test.py
35
- python neurocc_graph_release_smoke.py
36
- python neurocc_graph_release_benchmark.py
37
  ```
38
 
39
- The exporter verifies selected original checkpoint hashes, epochs, parameter
40
- counts, schema relationships, curriculum split hashes and retained upstream
41
- caches/reference artifacts before exporting. It checks exact SafeTensors tensor
42
- and dtype round trips. Exact original checkpoint copies are frozen separately
43
- from the public directory. Full configs preserve historical training provenance
44
- hashes without retaining local filesystem paths.
45
-
46
- The CUDA regression compares all 2,000 validation and 2,000 test programs against
47
- the original live pipeline at batch 32, including every exposed intermediate,
48
- final bytes and sampled semantics. It does not select new checkpoints. CPU
49
- portability uses a fresh dependency environment and development-file access
50
- denial. Single/batch consistency checks cover 32 programs per split, not every
51
- possible batching arrangement. Different hardware or numerical backends can
52
- change predictions; broader portability remains an empirical question.
53
 
54
- The pre-0.2.0 public main was
55
- `757aecb2942c3bd66c324b925a93dd366a6a6de1`. The publication tool first preserves
56
- it as `0.1.0-experimental`, refusing to move an existing tag. It uploads a staging
57
- branch, compares every remote artifact hash and runs clean-environment inference
58
- from that pinned revision. Only then does it update main and create the new tag.
59
- The exact final commit SHA is reported by the publication tool; Git tags should
60
- not subsequently be moved. Pin the commit SHA for an immutable content reference.
61
 
62
- Publication requires an authenticated account with write access:
63
-
64
- ```bash
65
- hf auth login
66
- # From the development checkout, after the local tests and final inventory:
67
- python neurocc_graph_publish.py
68
- ```
69
 
70
- Tokens must never be embedded in this package or posted in logs/chat. Upload
71
- only this release directory, excluding its parent audit files, archived releases,
72
- checkpoint snapshots and caches. The script refuses changed local files,
73
- concurrent remote-main changes and an already-used release tag.
74
 
75
- No associated public GitHub repository was linked by the inspected prior model
76
- card or package metadata. The local source checkout has no Git repository
77
- metadata establishing one; no unrelated GitHub repository is modified.
 
1
+ # Reproducing the release
2
 
3
+ Use the `0.3.0` Hugging Face tag and its matching wheel. Do not mix older packages with the new manifest. Python 3.11+ is required; qualification/export used PyTorch 2.13.0+cu132, Transformers 4.57.6; clean installed-wheel CPU testing used PyTorch 2.15.0+cpu and Transformers 4.57.6. These observations do not establish every allowed dependency version as tested.
 
 
 
4
 
5
+ Install the wheel with the `evaluation` extra, or install the downloaded repository root with `pip install ".[evaluation,dev]"`. Run:
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6
 
7
  ```bash
8
+ python -m pytest tests -q
9
+ python evaluation/evaluate.py --model . --device cpu --limit 8
10
+ # Full 600-source sampled evaluation (slower):
11
+ python evaluation/evaluate.py --model . --device cuda
12
  ```
13
 
14
+ `evaluation/cases.json` lists the 400 existing validation and 200 regression programs. `qualified_codes.json` contains the byte-exact export predictions in the same order. `qualification.json` records the original fresh qualification; `export_parity.json` records 600-row cached-backbone export parity; `portability.json` records isolated fresh CPU inference from the installed wheel. CPU/GPU and dependency-version numerics can differ; do not mistake sampled execution for formal proof. The three known qualification failures are retained.
 
 
 
 
 
 
 
 
 
 
 
 
 
15
 
16
+ The Qwen tokenizer/config/weights are fetched from revision `0576a1bc0ae53f21860e905e081807bd7ff4a4c7`. The backbone config and original SafeTensors hashes are pinned in `manifest.json`. An exact subset of the original tensor bytes is streamed into the Hugging Face cache. Cache provenance and hashes are checked on each load. No checkpoint or latent cache from a development drive is required. No remote model code is enabled.
 
 
 
 
 
 
17
 
18
+ The backbone initially downloads the full upstream weight file; allow disk space for it, the retained six-block prefix and dependency caches. RAM/commit and GPU headroom are required during loading. Windows with a small/disabled pagefile can fail cold CUDA loads despite apparently free physical RAM. The retained prefix reduces unnecessary mappings; it does not remove memory requirements. There is no automatic CPU fallback for an explicit CUDA request.
 
 
 
 
 
 
19
 
20
+ Production inference requires neither LLVM nor a reference compiler. Independent verification uses Capstone 5.0.9 and Unicorn 2.1.4 in an isolated subprocess with a wall timeout, bounded instruction execution and stack/memory/ABI checks. It never executes generated code natively. Generated functions use System V x86-64 ABI even on Windows hosts.
 
 
 
21
 
22
+ Original accepted weights, curriculum state, training histories and candidate archives were preserved. This release is frozen without additional training. SHA256SUMS covers every public artifact except the checksum file itself.
 
 
SHA256SUMS ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ 5431bb4305fb6af7204c30dd3f55b1d70302dd1004224ee37400c003837deafe .gitattributes
2
+ f42811251b4785d0ab1b5d6c43df8d0d40c4ee15d2e05e65ffc66bc3610872f3 .gitignore
3
+ 2385fe5ba342a2b041aff66b292ca68bc72311f3076e66d0b46aab2d2ed0b677 ARCHITECTURE.md
4
+ 7d43de37d29b2ca6f496b438819cd39cb638ee965d9ea1cbecfe63f066d8bb5b CHANGELOG.md
5
+ cfc7749b96f63bd31c3c42b5c471bf756814053e847c10f3eb003417bc523d30 LICENSE
6
+ f91371dcd2aef280e7e80d723d9c96b1a71b67ef1276bf246a71d28f0c067636 README.md
7
+ 8c47c12ec608823281bbc91fd252273ccd07ea18f1ad210130fbeefc4583097c REPRODUCIBILITY.md
8
+ 01fed119473876bc6fe13dae542adb46dd77aa6b7cfb9150772b351191ed1754 THIRD_PARTY_NOTICES.md
9
+ 2b021e82ff795193eca292489fec2f1ed1435cdbadec8f3ee0f9e616e439fc22 config.json
10
+ 2f6b05d9808d8158f0ff47d810f712c222e7325601656d11f45fcdb75a408f8f dist/neuro_compiler-0.3.0-py3-none-any.whl
11
+ f39e26511fcded945d9ed9bcc6221ac1dfd28e6ee518fe9e3cfa10ab4f8a64d4 evaluation/cases.json
12
+ 62fa91a28c56bcc27c30e1909a5fa96a9f24bf184120d659afc8e0dd60edcec2 evaluation/clean_final_wheel.json
13
+ 75ab76711f268763c5e72aa6fa9dfaf4f71a0ffd98ee2e156e2f77998e96526d evaluation/contract_tests.json
14
+ 57d9837fd7be2da9c632c6208bb563b1155da6b2836802dd4bb5c2a46db2cc17 evaluation/evaluate.py
15
+ cf311273f4ef98eca00e0819ea36364015cc6284603aa6fde2c37f319621cbf8 evaluation/export_parity.json
16
+ 0ebd977868e4edf5d05f1b560b950bcbfb8223224891f79e07e0625005624231 evaluation/fresh_package_parity.json
17
+ 65d18c10f496c4dbc838d2622d0b44ea7cfcf740c7d89241a072d2fb058f19c2 evaluation/portability.json
18
+ 93a8fb44c76429c982fb9461252cc675a8bc81261be9f3f62d76bfadc09e9da8 evaluation/qualification.json
19
+ 5235850f47d5de74b08673cf000aca4c25731952ca31d544802e27dfd2837db8 evaluation/qualified_codes.json
20
+ cb9b9e6fdf50660e723f431054fa9a076a95b19ee67770dd89b73928c9545b65 examples/eight_operations.cpp
21
+ 75726377234e68ca7e33223b7a76dcb6ee9c1eec9711781e521e09b72703caa8 manifest.json
22
+ 20a15a29a7d6d80556c4894ccf2dcc0b8b5f968d3cddbc30363a72e0a0147813 neuro_compiler/__init__.py
23
+ d395434153c7f47643e076ed624f796f2c3a66ab3888e20dbacd9ee4708806af neuro_compiler/_verify_worker.py
24
+ b93211c09a538e36150c170d331ff723370618f0765c8b469b25a0fdf32d0a40 neuro_compiler/backbone.py
25
+ 729007854ebf3e8db085e8d36b9ccd59c290617a4aff117f042ff8d493079a1a neuro_compiler/backend/__init__.py
26
+ d53e35de71ac08bee930fd5e8683042d9fa5d6c1eea95d91b598af8ee56b3f26 neuro_compiler/backend/allocation_constants.py
27
+ b88ead07194b0ddee42e77c08e58d46155b1c2c2e0f45d5ee8007f05e354269b neuro_compiler/backend/allocator.py
28
+ 81203a2022b8ced1e4321ea5978624fee45fed1b029155090acad3c8f5ddd065 neuro_compiler/backend/boundary.py
29
+ ff99ee2056ac49612b7445c6d73ed05440617c2efa35fbd7847213df61d96dbc neuro_compiler/backend/canonical.py
30
+ d77042490506c58b98429dd96b64a077feed859dd613e150bed3685711a922e5 neuro_compiler/backend/encoder.py
31
+ 28e91d0861ff1302321f70a4daacce242c8cff24b1bf450eb09a2b175ad9e015 neuro_compiler/backend/graph.py
32
+ 5b88570f35a0c1f281e0816c97f705ae31f10c79166ee0e881e7dd4d8970a31a neuro_compiler/backend/physical.py
33
+ 0c36e643d1648ca0dfb4ce4f9cdc3d4ef351cba84636cc4b0d9a716c076f8480 neuro_compiler/backend/policy.py
34
+ 532dd4a9ddee131f4922ee8f1fba8b6a3690cc30ca71c04df01e2b4c25be5fe5 neuro_compiler/backend/resident.py
35
+ d7e04d0d572fc7e98c025b9824dcfa6bce5d176ef83b89810700eaae1cd0de62 neuro_compiler/backend/stack.py
36
+ fbab50c74d9b496ced4c3ad7962931cd09766c84e68edde615e552eb9d891f16 neuro_compiler/cli.py
37
+ f36bfe5684d22922296ac4da786f5f809e97f38ec6c60ead6b15c41724c10dff neuro_compiler/compiler.py
38
+ fca314927895e79867e00766e976b2929b884bb27364c9637db5fc1217934fbb neuro_compiler/emulation.py
39
+ f2b8cedf9eb288be51a9a9f1f629dcb5ba07b4e8ac7561ad7379598362ba4ad8 neuro_compiler/neurocc.py
40
+ a7586da6e0827e2f48a04e7eaea89d3ed66ca794ceb1f8d2ddca10fa3c03cc08 neuro_compiler/neurocc_ast.py
41
+ 7bf8b7f50cac9babb6bdf796d2ce7bfd4e963add06f7dbb2ccb0791cf67dfa66 neuro_compiler/neurocc_graph_ast.py
42
+ 91d999063b2f610ab634d07e541cdff9b42bb9940c61e4a3d7af29e8f5683881 neuro_compiler/neurocc_graph_ast_grounded.py
43
+ 54b28ccf53ad2ad6a7a056576d00338e28f003aecec502f58862a1c75a8ba2e5 neuro_compiler/neurocc_graph_isel.py
44
+ 50b5291e15f2ca3abcb39f918679738296a67ead01d3c39d295fbd46b9ad9e25 neuro_compiler/neurocc_graph_schema.py
45
+ 81c0ff9ca8268faed60bca4b7c7c58e8a413dba1521be9611a75caa1b81eb712 neuro_compiler/neurocc_graph_ssa.py
46
+ 713d99934cbedbfe2554191670ca2acb6c3df39b24410cab17d4da389c4cbcb4 neuro_compiler/verification.py
47
+ b6455255e310d74a5eb335650910d1b7223dd315620eb97f9f9e3e14318e1918 pyproject.toml
48
+ 9b6cda69584e6577d599f45de63110d1192f70c9a95848ee5026d82230812b54 requirements.txt
49
+ aea7099fe74ef7e7a1a6e2c8f4669187a3ec097b5de449b68674440835dd623e tests/test_release.py
50
+ bde487aed28c62fb42ab8398705f70118036fe7ac2e713aec21b076fbd465bdc weights/ast.safetensors
51
+ 225ac1f6511a662dc5074b3fb9c9ce8750c621b32ebfeda2b46149ad81a413bf weights/backend.safetensors
52
+ 73ce7dab9c1bd84319e5dcae53903033f12c4a97e7ba2b0b685c1be79396e66f weights/isel.safetensors
53
+ 398de4dfaa856d1eae82aeb28b34636989e624084b8981a8c553e40a8d14680a weights/ssa.safetensors
THIRD_PARTY_NOTICES.md CHANGED
@@ -1,17 +1,19 @@
1
- # Third-party components and release licensing
2
-
3
- The frozen backbone is Qwen/Qwen2.5-Coder-0.5B, revision
4
- 0576a1bc0ae53f21860e905e081807bd7ff4a4c7. Its weights and tokenizer are downloaded
5
- from Hugging Face rather than redistributed here. See the upstream model card
6
- and license: https://huggingface.co/Qwen/Qwen2.5-Coder-0.5B .
7
-
8
- Runtime dependencies are separately installed: PyTorch (BSD-style license),
9
- Transformers (Apache-2.0), SafeTensors (Apache-2.0), Hugging Face Hub
10
- (Apache-2.0). Optional Capstone and Unicorn have their own BSD and GPL-family
11
- licensing terms respectively; they are evaluation dependencies, not bundled code.
12
- Consult the installed versions' license files before redistributing them.
13
-
14
- The project owner authorized Apache-2.0 for project code and specialized trained
15
- weights during release preparation. See LICENSE. The pinned Qwen revision's
16
- Hugging Face model metadata declares Apache-2.0; its snapshot does not contain
17
- a separate LICENSE file. Its model card links to the upstream license.
 
 
 
1
+ # Third-party components and release licensing
2
+
3
+ The frozen backbone is Qwen/Qwen2.5-Coder-0.5B, revision
4
+ 0576a1bc0ae53f21860e905e081807bd7ff4a4c7. Its weights and tokenizer are downloaded
5
+ from Hugging Face rather than redistributed here. See the upstream model card
6
+ and license: https://huggingface.co/Qwen/Qwen2.5-Coder-0.5B .
7
+
8
+ Runtime dependencies are separately installed: PyTorch (BSD-style license),
9
+ Transformers (Apache-2.0), SafeTensors (Apache-2.0), Hugging Face Hub
10
+ (Apache-2.0). Optional Capstone and Unicorn have their own BSD and GPL-family
11
+ licensing terms respectively; they are evaluation dependencies, not bundled code.
12
+ Consult the installed versions' license files before redistributing them.
13
+
14
+ The project owner authorized Apache-2.0 for project code and specialized trained
15
+ weights during release preparation. See LICENSE. The pinned Qwen revision's
16
+ Hugging Face model metadata declares Apache-2.0; its snapshot does not contain
17
+ a separate LICENSE file. Its model card links to the upstream license.
18
+
19
+ Version 0.3.0 includes the owner-supplied Round13/15E hybrid backend under the same Apache-2.0 project license. Exact lifetime/state/ABI logic is disclosed; no claim of a wholly learned backend is made. Qwen weights are not redistributed.
config.json CHANGED
@@ -1,7 +1,8 @@
1
  {
2
- "release_version": "0.2.0-experimental",
3
- "package_version": "0.2.0.dev0",
4
- "architecture": "NeuroCC graph resource streams",
 
5
  "spec": {
6
  "backbone": "Qwen/Qwen2.5-Coder-0.5B",
7
  "revision": "0576a1bc0ae53f21860e905e081807bd7ff4a4c7",
@@ -9,6 +10,5 @@
9
  "depths": [
10
  6
11
  ]
12
- },
13
- "abi": "x86-64 System V"
14
  }
 
1
  {
2
+ "release_version": "0.3.0",
3
+ "architecture": "NeuroCC graph + frozen 15E hybrid",
4
+ "abi": "x86-64 System V",
5
+ "max_operations": 8,
6
  "spec": {
7
  "backbone": "Qwen/Qwen2.5-Coder-0.5B",
8
  "revision": "0576a1bc0ae53f21860e905e081807bd7ff4a4c7",
 
10
  "depths": [
11
  6
12
  ]
13
+ }
 
14
  }
dist/neuro_compiler-0.3.0-py3-none-any.whl ADDED
Binary file (43.5 kB). View file
 
evaluation/README.md DELETED
@@ -1,19 +0,0 @@
1
- # Evaluation artifacts
2
-
3
- `validation.json` and `test.json`: fixed split stage/byte regression, sampled
4
- semantics and grouped accuracies. `regression.json`: combined results and cached
5
- model initialization times. `benchmark.json`: actual original live graph-runtime
6
- benchmark, independent synchronized per-stage profile and Clang timing.
7
- `portability.json`: installed-wheel CPU inference in a fresh dependency venv,
8
- outside the checkout with development-directory access denied.
9
-
10
- Full CUDA regressions used original precision and batch 32. CPU portability is
11
- a smoke test, not a complete CPU accuracy evaluation. Semantic checks use 32
12
- input triples (edge cases plus seeded random inputs), seed 20261127. They do not
13
- prove equivalence. Binary outputs and held-out metrics were not used to select
14
- or retrain any checkpoint during packaging.
15
-
16
- Excluded: original/generated datasets, activation and stage caches, LLVM traces,
17
- optimizer/resume state, original PyTorch checkpoints, training scripts, local
18
- paths and logs, credentials, executables, Python caches and build intermediates.
19
- Frozen original checkpoints are retained outside the public release directory.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
evaluation/benchmark.json DELETED
@@ -1,294 +0,0 @@
1
- {
2
- "pipeline": {
3
- "abi": "x86_64 SysV",
4
- "device": "cuda",
5
- "spec": {
6
- "backbone": "Qwen/Qwen2.5-Coder-0.5B",
7
- "revision": "0576a1bc0ae53f21860e905e081807bd7ff4a4c7",
8
- "tokens": 96,
9
- "depths": [
10
- 6
11
- ]
12
- },
13
- "manifest_sha256": "e7db505c0054653e111aaecdbea2542d00c901173d897cb6f9a93d3d63d2635c",
14
- "source_fingerprint": "fecaadee6daec74c2e6ab067800ddde485698809b0e9c77ef473dfff795e396b",
15
- "checkpoints": {
16
- "ast": {
17
- "sha256": "0115925b513ab25b5307c766b22510ec66db5259bb73387a1778dd8b1470ec03",
18
- "epoch": 68,
19
- "kind": "grounded_graph_ast"
20
- },
21
- "ssa": {
22
- "sha256": "5705cb92c40cc7327da7102071f65aa12600ac9b91de64bf5fb147cb84032978",
23
- "epoch": 79,
24
- "kind": "graph_ssa_stage"
25
- },
26
- "isel": {
27
- "sha256": "0290e3e3dea324a5e571f62503e3c070915e0dcb1b0003b188c607b4eb340fcd",
28
- "epoch": 68,
29
- "kind": "graph_isel_stage"
30
- },
31
- "regalloc": {
32
- "sha256": "c571d8e96f3f1c3c98ca4958f2d776e6949a00ca25c12824d7311ef4318bf659",
33
- "epoch": 30,
34
- "kind": "graph_regalloc_occupancy_stage"
35
- },
36
- "binary": {
37
- "sha256": "c137da040b13ceca334e450d23f32806bdbb01bf831456cf533e612332d14c04",
38
- "epoch": 2,
39
- "kind": "graph_binary_stage"
40
- }
41
- },
42
- "binary_selection": {
43
- "selected": "independent",
44
- "candidates": [
45
- {
46
- "mode": "independent",
47
- "epoch": 2,
48
- "validation": {
49
- "n": 2000,
50
- "exact": 1.0,
51
- "exact_count": 2000,
52
- "instruction_exact": 1.0,
53
- "length_accuracy": 1.0,
54
- "byte_accuracy": 1.0,
55
- "spill_n": 7,
56
- "spill_exact": 1.0,
57
- "nonspill_exact": 1.0
58
- },
59
- "sha256": "c137da040b13ceca334e450d23f32806bdbb01bf831456cf533e612332d14c04"
60
- }
61
- ],
62
- "policy": "Reference validation exact, instruction exact, byte accuracy; local and smaller on ties. No held-out selection."
63
- },
64
- "precision": "Qwen original cache precision; FP16 intermediate boundaries, FP32 specialized operations",
65
- "scope": "Curriculum A: fully parenthesized unsigned 32-bit expressions, a/b/c, literals 1..63, 1..7 binary operations",
66
- "reference_binary_sha256": "1ab80e559f1c8b8485abd1fb2056cc11e181c3ef0a3945b9cf6a1e3a29f56096",
67
- "allocator_validation": {
68
- "exact": 0.9815000295639038,
69
- "signature_accuracy": 0.9906620383262634,
70
- "register_accuracy": 0.9885137677192688,
71
- "immediate_accuracy": 0.9915221333503723,
72
- "stack_accuracy": 1.0,
73
- "constant_repair": 0.9825000166893005,
74
- "register_repair": 0.9900000095367432,
75
- "spill_exact": 0.7142857313156128,
76
- "spill_n": 7,
77
- "nonspill_exact": 0.9824385643005371,
78
- "n": 2000,
79
- "structurally_executable": 0.993,
80
- "semantic32": 0.986,
81
- "semantic_n": 2000,
82
- "inputs_per_function": 32,
83
- "binding_accuracy": 0.9879426956176758,
84
- "emission_overflow": 0,
85
- "reference_eligible": 1992,
86
- "predicted_instructions_mean": 6.584000110626221,
87
- "event_count_accuracy": 0.9987921714782715,
88
- "event_count_exact": 0.9939758777618408,
89
- "anchor_accuracy": null,
90
- "by_depth": {
91
- "1": {
92
- "n": 286,
93
- "exact": 1.0
94
- },
95
- "2": {
96
- "n": 370,
97
- "exact": 1.0
98
- },
99
- "3": {
100
- "n": 520,
101
- "exact": 0.9903846383094788
102
- },
103
- "4": {
104
- "n": 256,
105
- "exact": 0.9921875
106
- },
107
- "5": {
108
- "n": 224,
109
- "exact": 0.9464285969734192
110
- },
111
- "6": {
112
- "n": 191,
113
- "exact": 0.9528796076774597
114
- },
115
- "7": {
116
- "n": 153,
117
- "exact": 0.9411764740943909
118
- }
119
- },
120
- "by_operations": {
121
- "1": {
122
- "n": 286,
123
- "exact": 1.0
124
- },
125
- "2": {
126
- "n": 286,
127
- "exact": 1.0
128
- },
129
- "3": {
130
- "n": 286,
131
- "exact": 0.996503472328186
132
- },
133
- "4": {
134
- "n": 286,
135
- "exact": 0.996503472328186
136
- },
137
- "5": {
138
- "n": 286,
139
- "exact": 0.9895104765892029
140
- },
141
- "6": {
142
- "n": 285,
143
- "exact": 0.9719298481941223
144
- },
145
- "7": {
146
- "n": 285,
147
- "exact": 0.9157894849777222
148
- }
149
- },
150
- "by_origin": {
151
- "balanced_shape": {
152
- "n": 497,
153
- "exact": 0.9919517040252686
154
- },
155
- "left_chain": {
156
- "n": 502,
157
- "exact": 0.9980079531669617
158
- },
159
- "random": {
160
- "n": 504,
161
- "exact": 0.954365074634552
162
- },
163
- "right_chain": {
164
- "n": 497,
165
- "exact": 0.9818913340568542
166
- }
167
- },
168
- "by_balanced": {
169
- "False": {
170
- "n": 1559,
171
- "exact": 0.976908266544342
172
- },
173
- "True": {
174
- "n": 441,
175
- "exact": 0.997732400894165
176
- }
177
- },
178
- "occupancy": {
179
- "labels": 49675,
180
- "kind_accuracy": 0.9956517362858581,
181
- "content_exact": 0.994765978862607,
182
- "known_content_exact": 0.9948304663867443,
183
- "by_kind": {
184
- "0": {
185
- "n": 5377,
186
- "exact": 0.9942347033661894
187
- },
188
- "1": {
189
- "n": 9159,
190
- "exact": 0.9975979910470575
191
- },
192
- "2": {
193
- "n": 8744,
194
- "exact": 0.9969121683440073
195
- },
196
- "3": {
197
- "n": 8270,
198
- "exact": 0.9939540507859734
199
- },
200
- "4": {
201
- "n": 11,
202
- "exact": 0.0
203
- },
204
- "5": {
205
- "n": 18114,
206
- "exact": 0.9934304957491443
207
- }
208
- }
209
- }
210
- },
211
- "binary_reference_validation": {
212
- "n": 2000,
213
- "exact": 1.0,
214
- "exact_count": 2000,
215
- "instruction_exact": 1.0,
216
- "length_accuracy": 1.0,
217
- "byte_accuracy": 1.0,
218
- "spill_n": 7,
219
- "spill_exact": 1.0,
220
- "nonspill_exact": 1.0
221
- },
222
- "specialized_parameters_by_stage": {
223
- "ast": 753739,
224
- "ssa": 1078162,
225
- "isel": 913695,
226
- "regalloc": 585134,
227
- "binary": 311553
228
- },
229
- "specialized_parameters": 3642283,
230
- "backbone_parameters": 225608960,
231
- "total_parameters": 229251243
232
- },
233
- "split": "test",
234
- "neural": {
235
- "functions": 2000,
236
- "batch": 32,
237
- "repeats": 3,
238
- "seconds": [
239
- 4.960962400073186,
240
- 4.9124207000713795,
241
- 5.068292499985546
242
- ],
243
- "median_seconds": 4.960962400073186,
244
- "candidates_per_second": 403.1475828098386,
245
- "peak_cuda_allocated_mib": 562.14208984375,
246
- "peak_cuda_reserved_mib": 616.0,
247
- "includes": "Tokenizer, host/device transfer, all six neural stages, byte packing and CPU byte serialization. Excludes model loading, file I/O and emulation.",
248
- "sampled_correct_candidates_per_second": 395.68935252785656
249
- },
250
- "synchronized_stage_profile_ms_per_function": {
251
- "tokenization_and_transfer": 1.0030856005614623,
252
- "qwen": 1.142623248975724,
253
- "ast": 0.15224995056632906,
254
- "ssa": 0.21704874990973622,
255
- "isel": 0.22722220013383776,
256
- "regalloc": 0.31930019974242896,
257
- "binary": 0.061826799996197224,
258
- "output_transfer": 0.0037986001698300242
259
- },
260
- "profile_note": "Separate synchronized pass; synchronization overhead means totals need not match end-to-end benchmark.",
261
- "clang": {
262
- "tool": "clang++.EXE",
263
- "optimization": "-O0",
264
- "batch": 128,
265
- "workers": 8,
266
- "repeats": 3,
267
- "seconds": [
268
- 0.11174400011077523,
269
- 0.11332290014252067,
270
- 0.11492149997502565
271
- ],
272
- "median_seconds": 0.11332290014252067,
273
- "functions_per_second": 17648.683518377115,
274
- "note": "Clang C++ frontend and backend with batched translation units; may produce different bytes than unfolded SSA reference. Clang correctness not measured by this timing.",
275
- "version": "clang version 23.1.2 (https://github.com/llvm/llvm-project 85ac560262434c9ccfc0c183ec22d4138ed647fb)"
276
- },
277
- "verification": {
278
- "functions": 2000,
279
- "serializable": 1.0,
280
- "fully_disassembled": 1.0,
281
- "semantic_accuracy": 0.9815,
282
- "semantic_correct": 1963,
283
- "inputs_per_function": 32
284
- },
285
- "hardware": {
286
- "gpu": "NVIDIA GeForce RTX 2060 SUPER",
287
- "cpu": "Intel(R) Core(TM) i9-10850K CPU @ 3.60GHz"
288
- },
289
- "environment": {
290
- "python": "3.14.0",
291
- "torch": "2.13.0+cu132"
292
- },
293
- "held_out_note": "Timing only; no checkpoint or architecture selection using these results."
294
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
evaluation/cases.json ADDED
The diff for this file is too large to render. See raw diff
 
evaluation/clean_final_wheel.json ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "installed_wheel": true,
3
+ "version": "0.3.0",
4
+ "fresh_cpu_sources": 2,
5
+ "eight_operation_source": true,
6
+ "byte_matches": 2,
7
+ "sampled_abi_semantic": 2,
8
+ "startup_seconds": 5.871123899938539,
9
+ "development_access_denied": true,
10
+ "torch": "2.15.0+cpu"
11
+ }
evaluation/contract_tests.json ADDED
@@ -0,0 +1,9 @@
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "runner": "python -m unittest discover -s tests -v",
3
+ "device": "cpu",
4
+ "tests": 14,
5
+ "failures": 0,
6
+ "errors": 0,
7
+ "backbone_download": false,
8
+ "training": false
9
+ }
evaluation/evaluate.py ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Fresh source inference plus independent sampled verification; no training."""
2
+ import argparse,json,time
3
+ from pathlib import Path
4
+ from neuro_compiler import NeuralCompiler
5
+ from neuro_compiler.verification import verify
6
+
7
+ def main():
8
+ p=argparse.ArgumentParser();p.add_argument('--model',default='chrisuser/neuro-compiler');p.add_argument('--revision',default='0.3.0');p.add_argument('--device',default='auto');p.add_argument('--limit',type=int);p.add_argument('--output',default='evaluation-result.json');a=p.parse_args()
9
+ rows=json.loads(Path(__file__).with_name('cases.json').read_text());rows=rows if a.limit is None else rows[:a.limit]
10
+ if not rows:raise ValueError('No cases selected')
11
+ started=time.perf_counter();compiler=NeuralCompiler.from_pretrained(a.model,revision=a.revision,device=a.device);startup=time.perf_counter()-started
12
+ started=time.perf_counter();outputs=compiler.compile_batch([r['source'] for r in rows],strict=False);elapsed=time.perf_counter()-started
13
+ results=[]
14
+ for row,code in zip(rows,outputs):
15
+ checked={'abi':False,'semantic':False,'error':'Compilation rejected'} if code is None else verify(row['source'],code,samples=32,timeout=60)
16
+ results.append({'row':row['row'],'group':row['group'],'operations':row['operations'],**checked})
17
+ report={'revision':a.revision,'device':str(compiler.dev),'startup_seconds':startup,'inference_seconds':elapsed,'functions':len(rows),'abi_correct':sum(r['abi'] for r in results),'semantic_correct':sum(r['semantic'] for r in results),'rows':results}
18
+ Path(a.output).write_text(json.dumps(report,indent=2)+'\n');print(json.dumps({k:v for k,v in report.items() if k!='rows'},indent=2))
19
+ if __name__=='__main__':main()
evaluation/export_parity.json ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "scope": "Export regression against the qualified compiler, using its frozen neural backbone features; not a fresh backbone run",
3
+ "functions": 600,
4
+ "exact_matches": {
5
+ "ast": 600,
6
+ "ssa": 600,
7
+ "isel": 600,
8
+ "bytes": 600
9
+ },
10
+ "torch": "2.13.0+cu132",
11
+ "seconds": 15.638571199961007,
12
+ "safe_tensors_export": true,
13
+ "no_original_checkpoint_loading": true
14
+ }
evaluation/fresh_package_parity.json ADDED
@@ -0,0 +1,10 @@
 
 
 
 
 
 
 
 
 
 
 
1
+ {
2
+ "scope": "Fresh portable package source-to-bytes CUDA inference, compared with original qualified bytes",
3
+ "functions": 600,
4
+ "exact_byte_matches": 600,
5
+ "mismatched_rows": [],
6
+ "startup_seconds": 6.952503199921921,
7
+ "inference_seconds": 9.530679299961776,
8
+ "batch_size": 16,
9
+ "no_original_checkpoint_or_latent_cache_loading": true
10
+ }
evaluation/portability.json CHANGED
@@ -1,22 +1,24 @@
1
  {
2
- "cpu_hex": "89f801f083ea070fafc2c3",
3
- "cpu_initialization_seconds": 4.065295299980789,
4
- "semantic_verification": {
5
- "row": 0,
6
- "source": "unsigned f(unsigned a,unsigned b,unsigned c){return ((a+b)*(c-7u));}",
7
- "hex": "89 f8 01 f0 83 ea 07 0f af c2 c3",
8
- "disassembled": true,
 
9
  "semantic": true,
10
- "error": null
11
- },
12
- "batch_and_intermediate_apis": true,
13
- "input_errors": {
14
- "invalid": true,
15
- "oversized": true
16
  },
17
- "torch": "2.15.0+cpu",
18
- "cuda_available": false,
19
- "isolated_environment": true,
 
20
  "development_access_denied": true,
21
- "environment": "Fresh venv without system-site-packages; installed all documented dependencies from package indexes"
 
22
  }
 
1
  {
2
+ "package_version": "0.3.0",
3
+ "torch": "2.15.0+cpu",
4
+ "device": "cpu",
5
+ "startup_seconds": 6.4752321999985725,
6
+ "bytes_hex": "4189d001f74181e807000000410faff889f8c3",
7
+ "verification": {
8
+ "serialized": true,
9
+ "abi": true,
10
  "semantic": true,
11
+ "error": null,
12
+ "samples": 32,
13
+ "sampled_instructions": 192,
14
+ "native_execution": false,
15
+ "formal_equivalence": false
 
16
  },
17
+ "batch_consistency": true,
18
+ "intermediates": true,
19
+ "invalid_inputs_rejected": 2,
20
+ "installed_wheel": true,
21
  "development_access_denied": true,
22
+ "system_site_packages": false,
23
+ "backbone": "byte-exact prefix of the pinned original weights, original intermediate norm semantics preserved"
24
  }
evaluation/qualification.json ADDED
The diff for this file is too large to render. See raw diff
 
evaluation/qualified_codes.json ADDED
@@ -0,0 +1,602 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ [
2
+ "4189d041b9090000004181c9390000004489c8c3",
3
+ "4189d069ff1f00000069ff2900000089f8c3",
4
+ "4189d041b9030000004181e1060000004569c93e0000004129f14489c8c3",
5
+ "4189d04189f14109f14181e124000000440fafcf41ba120000004529ca4489d0c3",
6
+ "4189d081f63000000041b90e0000004181c11c0000004421ce4401c681c60a00000089f0c3",
7
+ "4189d041b9330000004181e9020000004181c02a0000004101f04181f0290000004401c64101f14489c8c3",
8
+ "4189d04589c14181f11f0000004589c24509ca4189fb4521c34531da4529d081e7310000004129f84489c0c3",
9
+ "4189d041b9220000004181c11900000041ba220000004529c24521d14181c1140000004181c91e0000004181f12600000081c707000000440fafcf4489c8c3",
10
+ "4189d041b9220000004569c9210000004489c8c3",
11
+ "4189d041b9030000004181c92d0000004181e9040000004489c8c3",
12
+ "4189d081f60600000081f61100000081ee3c00000089f0c3",
13
+ "4189d069f62500000081f61800000081ce080000004429c689f0c3",
14
+ "4189d041b9390000004181c91b000000440fafce4129f14121f14181f10d0000004489c8c3",
15
+ "4189d04189f94529c14569c92f0000004121f94569c91c0000004129f94181e9390000004489c8c3",
16
+ "4189d081c63400000009fe81ce1900000021fe81f62c00000081c6270000004431c689f0c3",
17
+ "4189d041b90c0000004181f11b0000004531c14109f14521c14181c9220000004129f94569c92a0000004181c9030000004489c8c3",
18
+ "4189d041b9090000004181f12f0000004489c8c3",
19
+ "4189d041b93a0000004181e9090000004529c84489c0c3",
20
+ "4189d041b9060000004181e9030000004569c9380000004401ce89f0c3",
21
+ "4189d041b9160000004181c9130000004181f1230000004181c1180000004421ce89f0c3",
22
+ "4189d041b9300000004129f94189fa4509ca4569d23f0000004431d729fe89f0c3",
23
+ "4189d04589c14501c14421ce31f781f72900000069ff2900000081cf0e00000089f8c3",
24
+ "41544189d041b9140000004181e90500000041ba150000004529ca4189f34509d34189f4450fafe34181c4130000004429e721fe89f0415cc3",
25
+ "415441554189d041b9240000004181e9240000004181c91100000041ba0c0000004529ca4589d34529d34529d341bc360000004529dc4189fd4521e5410faffd81c71600000089f8415d415cc3",
26
+ "4189d041b9230000004569c9090000004489c8c3",
27
+ "4189d04589c14181c93e0000004501c84489c0c3",
28
+ "4189d041b9200000004181e1260000004109f04531c14489c8c3",
29
+ "4189d081c62700000041b9290000004181f10b0000004501c84401c689f0c3",
30
+ "4189d041b91f0000004569c93b0000004181c10b00000041ba2b0000004181f2200000004431d64131f14489c8c3",
31
+ "4189d041b91c0000004569c91d0000004181c92700000081cf1300000041ba160000004181ca1a0000004429d74131f94489c8c3",
32
+ "4189d041b90800000041c1e1004189fa4569d2280000004509d14189f34509c301fe4109f3450fafcb4489c8c3",
33
+ "4189d04189f94181e9310000004189fa4181c21b0000004521d181f63000000041bb090000004181f30e0000004409df21fe4129f14489c8c3",
34
+ "4189d041b92a0000004181c12c0000004489c8c3",
35
+ "4189d04569c00b0000004569c02f0000004489c0c3",
36
+ "4189d04181f01b00000041b9030000004181f127000000450fafc14489c0c3",
37
+ "4189d04189f14569c91c0000004131f94181e9270000004131f14489c8c3",
38
+ "4189d041b9140000004181c11f0000004129f94181e91400000069ff360000004121f94489c8c3",
39
+ "4189d081ee3b0000004409c64589c14101f141ba2f0000004181ca250000004509d14509c84489c0c3",
40
+ "4189d041b90a0000004181e1330000004589c24181ca240000004429c60faffe4131fa4501d14529c14489c8c3",
41
+ "4189d04589c14521c14181e10c0000004189f24531ca4181c2120000004421d729f74131f84181c01e0000004489c0c3",
42
+ "4189d041b91c0000004569c9170000004489c8c3",
43
+ "4189d04181c81b0000004109f04489c0c3",
44
+ "4189d04189f94181f1390000004131f94509c14489c8c3",
45
+ "4189d041b90a0000004181e1140000004109f14181c1020000004181e92a0000004489c8c3",
46
+ "4189d041b9190000004181c90d0000004131f94521c14181c1330000004501c14489c8c3",
47
+ "4189d04181c0190000004569c02f000000440fafc74131f84181f0110000004121f84489c0c3",
48
+ "4189d04189f14569c9110000004181c9380000004181e1190000004109f14531c14181e9090000004109f94489c8c3",
49
+ "4189d041b90b0000004569c93f000000440fafce4181f1210000004181c914000000440fafce4181e1130000004181c9370000004181c1320000004489c8c3",
50
+ "4189d041b92100000041c1e1024489c8c3",
51
+ "4189d041b9170000004129f1410faff989f8c3",
52
+ "4189d041b9060000004181e12a0000004431cf41ba3c0000004129fa4489d0c3",
53
+ "4189d081e70d00000081c71c00000081f70400000081cf3b00000089f8c3",
54
+ "4189d04181e82c000000410faff081e62500000081c62600000041b93f0000004129f14489c8c3",
55
+ "4189d04181e8020000004189f94501c14421ce29f781cf2d00000081cf0600000089f8c3",
56
+ "4189d04189f1440fafce4569c9190000004501c84421c781e72300000081f71e00000069ff0c00000089f8c3",
57
+ "4189d041b9150000004181c136000000450fafc14181f0210000004181e020000000410faff869ff030000000faff781f60b00000089f0c3",
58
+ "4189d041b9390000004181c10e0000004489c8c3",
59
+ "4189d081cf2d00000081cf3e00000089f8c3",
60
+ "4189d081c62d00000041b9310000004181f112000000410faff189f0c3",
61
+ "4189d041b9090000004181c91e00000081c72c00000069ff030000004101f94489c8c3",
62
+ "4189d04181c8170000004189f14501c181ee1200000069f6270000004101f14489c8c3",
63
+ "4189d04189f9440fafcf41ba340000004529ca81f60b0000004589c34509c34431de4109f24489d0c3",
64
+ "41544189d041b90d0000004529c14189fa440fafd64531d141bb370000004129fb41bc190000004569e4290000004529e34531d94489c8415cc3",
65
+ "4189d04101f04189f14569c9340000004531c841ba080000004181f22200000081f62e00000041bb190000004129f3450fafd34489d0c3",
66
+ "4189d041b92a0000004181e1210000004489c8c3",
67
+ "4189d041b9160000004181e9210000004181e12d0000004489c8c3",
68
+ "4189d04109f04121f84569c03b0000004489c0c3",
69
+ "4189d04589c14181e9370000004521c14181f10700000041ba210000004529ca4489d0c3",
70
+ "4189d04189f14181e10a0000004181c92f0000004421cf4189f2440fafd7440fafd64489d0c3",
71
+ "4189d04131f04181c01d00000041b90a0000004129f14531c84181c8350000004181f03a0000004489c0c3",
72
+ "4189d04189f94181e9350000004109f94521c809fe81e61d0000004129f04131f84489c0c3",
73
+ "4189d04189f14181c91600000081e71e0000004121f981e61f0000004101f141ba1b0000004181f2100000004529d14181c13e0000004489c8c3",
74
+ "4189d041b9080000004181c1330000004489c8c3",
75
+ "4189d04429c781cf3300000089f8c3",
76
+ "4189d04189f94109f14181c118000000440fafcf4489c8c3",
77
+ "4189d04589c14181e11b0000004569c9210000004509c14569c9140000004489c8c3",
78
+ "4189d041b92900000041c1e1014181f1110000004109f14181e1190000004129f14489c8c3",
79
+ "4189d04189f14181e117000000440fafcf4529c14569c910000000440fafce4131f94489c8c3",
80
+ "4189d041b9040000004181c92c0000004529c1440fafce4529c14181c9110000004101f9450fafc84489c8c3",
81
+ "4189d04189f14181f13d0000004131f94121f94181e1360000004121f94509c14181c1010000004101f14489c8c3",
82
+ "4189d041b9230000004181c9080000004489c8c3",
83
+ "4189d041b9030000004529c141c1e1024489c8c3",
84
+ "4189d04569c03c0000004401c781cf3400000089f8c3",
85
+ "4189d081c7340000004101f84181c83900000041b93b0000004529c14489c8c3",
86
+ "4189d04589c14521c14189fa4521ca4431d781c72700000069ff1300000089f8c3",
87
+ "4189d04189f94569c9140000004409ce81f63700000021f781e727000000440fafc74489c0c3",
88
+ "4189d04589c14129f1410faff981c7250000004189f24121fa4189f3450fafda4431de440fafc64489c0c3",
89
+ "4189d04189f94181c9190000004431cf81c73e00000001fe81ce2100000081e60500000081f6030000004121f04489c0c3",
90
+ "4189d041b9270000004181c9200000004489c8c3",
91
+ "4189d04589c1450fafc84181f1340000004489c8c3",
92
+ "4189d04431c74101f04401c789f8c3",
93
+ "4189d04189f94569c91200000081e72000000081cf210000004129f94489c8c3",
94
+ "4189d04189f14181c91400000041ba330000004529ca4189f34129f34529d84531c24489d0c3",
95
+ "4189d04189f14569c9110000004421ce41ba350000004181e22d00000041bb080000004569db0a0000004521da4421d689f0c3",
96
+ "4189d04189f94181f10d0000004589c24501c24501d14181c00e00000081c71b0000004101f84501c14489c8c3",
97
+ "41544189d04189f14181c91e0000004189f24101fa450fafca41bb0b0000004529c34189f4450fafe04429e64109f3450fafcb4489c8415cc3",
98
+ "4189d041b91a0000004181f1220000004489c8c3",
99
+ "4189d04189f94569c91f0000004409cf89f8c3",
100
+ "4189d041b9200000004181e1010000004401ce81e62e00000089f0c3",
101
+ "4189d081f63300000081c61500000069f63b00000021fe89f0c3",
102
+ "4189d04189f14181c90f0000004121f181ce2d00000021fe4129f14489c8c3",
103
+ "4189d041b9150000004181c9130000004431cf69ff3300000041ba190000004181ea310000004409d781f70200000089f8c3",
104
+ "4189d041b90e0000004181e93a000000440fafce410faff181ee2800000069f62b00000081ce17000000c1e60489f0c3",
105
+ "4189d04189f1440fafcf81cf3600000081cf3000000069ff2e00000041ba330000004129fa4429d6440fafce4181e13c0000004489c8c3",
106
+ "4189d041b9130000004181e92a0000004489c8c3",
107
+ "4189d081e72200000081e73800000089f8c3",
108
+ "4189d04181c0370000004101f8440fafc64489c0c3",
109
+ "4189d041b9010000004569c91f0000004181e9100000004109f94181c9210000004489c8c3",
110
+ "4189d081f73e0000004431c709f74409c781f73a00000089f8c3",
111
+ "4189d04589c14181c102000000440fafce4181c13c0000004121f94521c14181e9040000004489c8c3",
112
+ "4189d04189f94181c9040000004181c1250000004101f14181f1340000004181e12d0000004121f94569c9310000004489c8c3",
113
+ "4189d04189f14129f94181f11f0000004101f14181c13d0000004181f1240000004181f11b0000004181e9230000004181c10a0000004489c8c3",
114
+ "4189d041b90f0000004181c9200000004489c8c3",
115
+ "4189d04409c681c61600000089f0c3",
116
+ "4189d04189f94181f1200000004431cf81c70c00000089f8c3",
117
+ "4189d029fe41b90f0000004129f14421cf81c70200000089f8c3",
118
+ "4189d04189f94101f14421ce81e6150000004189fa4121f24429d789f8c3",
119
+ "41544189d041b9370000004181f1280000004181e11c0000004589c24509ca4589c34501d34589c44501dc4521e04489c0415cc3",
120
+ "41544189d04189f94181c106000000410faff931fe41ba100000004129f24181f20d00000041bb060000004529d341bc110000004529dc4489e0415cc3",
121
+ "4189d04401c669f6300000004589c1440fafce41ba160000004529ca4181f23f0000004181e22f0000004589c34531d34529d84489c0c3",
122
+ "4189d041b92e0000004181c10a0000004489c8c3",
123
+ "4189d04181c02f0000004181e0250000004489c0c3",
124
+ "4189d041b92d0000004181c12000000081ee0b0000004121f14489c8c3",
125
+ "4189d0410faff881c6220000004109f04409c789f8c3",
126
+ "4189d069ff330000000faff741b91d0000004181c1320000004181e1390000004409ce89f0c3",
127
+ "4189d041b90600000041c1e1024569c91300000081ce0e0000004569c0320000004431c64129f14489c8c3",
128
+ "4189d081cf0c00000041b93b0000004529c1410faff941ba3a0000004181f22b0000004109f04529c2410faffa89f8c3",
129
+ "41544189d04189f1440fafce4589c24569d238000000450fafca41bb320000004181eb260000004589c44509c44569e4250000004501e34531d94489c8415cc3",
130
+ "4189d041b9390000004181e1070000004489c8c3",
131
+ "4189d04189f9440fafcf4181e9030000004489c8c3",
132
+ "4189d04189f94181e93c0000004181c10d0000004431cf89f8c3",
133
+ "4189d0410faff0440fafc64569c0070000004181e83d0000004489c0c3",
134
+ "4189d04569c02d00000081f60f0000004131f04181c01f0000004181e0360000004489c0c3",
135
+ "4189d04421c74429c741b9370000004181c9030000004401cf4129f84181e81f0000004489c0c3",
136
+ "4189d041b91a0000004181c9020000004181c90b0000004189fa4109f24109f24129fa4531d14501c14489c8c3",
137
+ "4189d04189f14101f141ba1b0000004181ca370000004529d14569c9060000004109f141bb090000004569db130000004529d94509c14489c8c3",
138
+ "4189d041b9160000004181c1180000004489c8c3",
139
+ "4189d081ce1400000021fe89f0c3",
140
+ "4189d04181f0180000004181e0020000004121f84489c0c3",
141
+ "4189d04181c8100000004181f00d0000004121f84131f84489c0c3",
142
+ "4189d041b92a0000004529c14109f94121f14181e92f0000004181c9180000004489c8c3",
143
+ "4189d081c71800000081ef2c00000081f70500000081ef3e00000001f74409c789f8c3",
144
+ "4189d04589c14181e9360000004131f94129f94529c14181e13b0000004181e1090000004181e90b0000004489c8c3",
145
+ "4189d041b91c0000004181e9340000004131f14181c130000000440fafce440fafcf4129f94181c9210000004181f10e0000004489c8c3",
146
+ "4189d041b9240000004181f12c0000004489c8c3",
147
+ "4189d04189f14569c9270000004409ce89f0c3",
148
+ "4189d041b90f0000004129f14181c1240000004181c93e0000004489c8c3",
149
+ "4189d041b90b0000004569c9120000004509c84181e0190000004569c0130000004489c0c3",
150
+ "4189d04181e0030000004181e03e0000004181e0150000004181f02d0000004431c789f8c3",
151
+ "4189d04189f94121f141ba360000004529ca4409d6440fafc64429c769ff2300000089f8c3",
152
+ "4189d081ce060000004189f94121f141ba270000004529ca410faffa69ff3800000081cf0200000081c72500000089f8c3",
153
+ "4189d041b9110000004181e1200000004181f1190000004181f10a0000004189f2450fafd14189f34521d3410faff381e61300000069f62600000089f0c3",
154
+ "4189d041b91b0000004181e1350000004489c8c3",
155
+ "4189d069ff2200000081cf3800000089f8c3",
156
+ "4189d04409c641b9180000004181e1390000004429ce89f0c3",
157
+ "4189d04189f94129f169ff2e00000069ff180000004121f94489c8c3",
158
+ "4189d04189f14181f121000000450fafc141ba0f0000004181f2160000004401d64101f04489c0c3",
159
+ "4189d081cf0d0000004189f14131f94189f24181e21500000081ce090000004129f24531d14489c8c3",
160
+ "4189d04189f14181c90a00000041ba140000004181f20f0000004509d141bb080000004181eb1300000081e62b0000004129f34501d94489c8c3",
161
+ "4189d041b9040000004181c11f0000004189f24181c2310000004501d141bb370000004569db3500000081e6080000004131f04529c3450fafcb4489c8c3",
162
+ "4189d041b9070000004569c9070000004489c8c3",
163
+ "4189d009f781cf0100000089f8c3",
164
+ "4189d081e72f00000081cf3000000081e71900000089f8c3",
165
+ "4189d081e62100000081ee1800000081c63b00000081f60200000089f0c3",
166
+ "4189d041b92a0000004181e9230000004181c13d0000004531c84181f0060000004181e00f0000004489c0c3",
167
+ "4189d04189f14181c93400000041ba2a0000004181ea1a0000004501d14409c669f63a0000004101f14489c8c3",
168
+ "4189d04189f94181e12e00000081c72100000081cf0c00000081c71a00000081cf38000000440fafcf4569c9360000004489c8c3",
169
+ "41544189d041b92a0000004529c14189fa4181ca220000000faff74129f24589c34531c341bc350000004529dc4501e24529d14489c8415cc3",
170
+ "4189d041b91a0000004181c10b0000004489c8c3",
171
+ "4189d04589c14509c14181c9180000004489c8c3",
172
+ "4189d081f60500000081f62e00000081ee2c00000089f0c3",
173
+ "4189d041b9270000004181c1170000004181c1380000004131f14181e9370000004489c8c3",
174
+ "4189d04589c14501c14181c1240000004531c1450fafc84109f94489c8c3",
175
+ "4189d04189f14181e111000000440fafce4181e1030000004181c92a0000004109f14109f94489c8c3",
176
+ "4189d04181c03d0000004131f0440fafc74131f04131f84569c0350000004129f84489c0c3",
177
+ "4189d04589c1450fafc84109f14569c9240000004181c9190000004101f14129f94181c9200000004181e9350000004489c8c3",
178
+ "4189d041b91a0000004181e12c0000004489c8c3",
179
+ "4189d041b9180000004181c13a0000004181f1180000004489c8c3",
180
+ "4189d081e63e00000081f61200000081e63700000089f0c3",
181
+ "4189d04189f94181c9310000004569c92e0000004429cf4129f84489c0c3",
182
+ "4189d04189f94181e1200000004589c24521ca4189fb4501d34531d8410faff889f8c3",
183
+ "4189d04181c03f0000004181e02900000041b9340000004529c14181f1130000004189fa4501ca4431d789f8c3",
184
+ "4189d04189f14129f14189fa4521ca4431d64589c3440fafde4501d84181f0160000004431c789f8c3",
185
+ "4189d04189f14109f14569c90f00000041ba380000004529ca4181c2280000004181f22f0000004401d781e70f00000081f70500000089f8c3",
186
+ "4189d041b93c0000004181f1150000004489c8c3",
187
+ "4189d081f71500000081c73600000089f8c3",
188
+ "4189d041b9350000004181f1180000004181e0190000004531c14489c8c3",
189
+ "4189d04589c14181c9350000004589c24531c24409d64101f14489c8c3",
190
+ "4189d04189f14569c90e0000004181e12b0000004189fa4121fa4409d64131f14489c8c3",
191
+ "4189d041b9320000004181c91c0000004181c13f0000004189f24181f22900000031fe4121f24531d14489c8c3",
192
+ "4189d041b91e0000004181c93400000069f63c0000004129f141ba250000004181ea2b00000069ff380000004131fa4501d14489c8c3",
193
+ "4189d041b9290000004181c91d0000004589c24569d2240000004521d141bb200000004529c34569c00f0000004181c80d0000004501c34529d94489c8c3",
194
+ "4189d041b93a0000004181c92d0000004489c8c3",
195
+ "4189d041b90e0000004129f1440fafce4489c8c3",
196
+ "4189d04189f94181e1340000004409cf81f71e00000089f8c3",
197
+ "4189d04589c1440fafce4401ce4181e8100000004431c689f0c3",
198
+ "4189d04181c81d00000041b9050000004181c13b0000004181c91a0000004529c84569c0330000004489c0c3",
199
+ "4189d041b92f0000004181c9340000004189f24501ca4129f24181c21800000041bb210000004569db190000004521da4489d0c3",
200
+ "4189d041b9290000004569c91c0000004569c92a0000004589c24109f24181ea320000004529c24509d14181c10f0000004489c8c3",
201
+ "4189d041b9390000004181e91d00000041ba070000004529ca4521d04181f0320000004129f84181e8020000004121f04181e03f0000004489c0c3",
202
+ "4189d041b91c0000004569c9140000004489c8c3",
203
+ "4189d041b90b0000004181c10b0000004509c14489c8c3",
204
+ "4189d041b9180000004181e9220000004121f14181c12c0000004489c8c3",
205
+ "4189d041b93f0000004529c14181e11b0000004529c14569c9230000004489c8c3",
206
+ "4189d04181f00e0000004109f84129f84101f04569c02b0000004489c0c3",
207
+ "4189d04189f14109f14569c9290000004181e1060000004569c9130000004131f94529c14489c8c3",
208
+ "4189d04101f84129f84181e8150000004129f84181f02c0000004181c8310000004181e80d0000004489c0c3",
209
+ "4189d04429c681e63000000069f60300000081ce1c00000081ce2f0000004431c681c62d00000081ce0b00000089f0c3",
210
+ "4189d041b9060000004181e9180000004489c8c3",
211
+ "4189d041b9060000004181c92d000000450fafc14489c0c3",
212
+ "4189d081f61c00000069f60b00000081c62a00000089f0c3",
213
+ "4189d04189f94121f14421ce29f781f71100000089f8c3",
214
+ "4189d041b9280000004181e13e0000004189f24521ca4181e21c0000004181ca050000004421d689f0c3",
215
+ "4189d04189f14569c9390000004529c841ba3f0000004529c24181f20b0000004189f34529d3410faff389f0c3",
216
+ "4189d041b91e0000004181e10a0000004181c92a0000004181e1350000004181f12b0000004531c84181e0350000004409c689f0c3",
217
+ "4189d04569c01900000041b9220000004529c14181e1190000004189fa450fafd14181f2280000004409d701fe81ce0d00000089f0c3",
218
+ "4189d041b9130000004181c1390000004489c8c3",
219
+ "4189d041b9340000004181f1240000004181e1360000004489c8c3",
220
+ "4189d041b92c0000004181e135000000410faff04109f14489c8c3",
221
+ "4189d009fe4189f94131f94181c1060000004429ce89f0c3",
222
+ "4189d04181f0130000004181c0120000004189f94181e11c000000410faff94129f84489c0c3",
223
+ "4189d0410faff04189f94129f1410faff841ba1d0000004181ea380000004401d74121f94489c8c3",
224
+ "4189d04589c14501c181c7310000004121f941ba1d0000004181c20100000041bb090000004181eb020000004531da4529d14489c8c3",
225
+ "4189d04189f14121f14589c24569d22f0000004521d14189fb440fafdf4121f04181f0080000004521c34509d94489c8c3",
226
+ "4189d041b9250000004181e1230000004489c8c3",
227
+ "4189d04589c14181e11c000000450fafc14489c0c3",
228
+ "4189d081ee0800000081c61f00000081f61200000089f0c3",
229
+ "4189d04569c0130000004101f841b92a0000004181f12b0000004501c84489c0c3",
230
+ "4189d081e62800000081c61000000009f741b93b0000004129f94181c9150000004489c8c3",
231
+ "4189d04189f14181e10c00000081f71900000021fe4409c6440fafce4181c9190000004489c8c3",
232
+ "4189d04189f14101f14181e11f0000004409ce21f781e73a000000c1e70381f71e00000089f8c3",
233
+ "4189d041b93a0000004181c9180000004181e9120000004181e1340000004189f24101f24181f2100000004181e228000000450fafd04531d14489c8c3",
234
+ "4189d041b91c0000004181c9270000004489c8c3",
235
+ "4189d081f6050000004431c689f0c3",
236
+ "4189d041b9010000004181f1020000004569c93c0000004181e9180000004489c8c3",
237
+ "4189d04189f9440fafce4181e9220000004101f94501c14489c8c3",
238
+ "4189d081ee3800000081ce3400000081ee3800000081f60400000021fe89f0c3",
239
+ "4189d041b9140000004181f1110000004121f14181e9140000004181f10d0000004181e9070000004181e1130000004489c8c3",
240
+ "4189d081e7170000004421c781f70900000081e71c00000081ef1400000081ef3000000081c71d00000089f8c3",
241
+ "4189d041b9360000004181f1360000004181f10d0000004181f12a000000450fafc84121f14101f14109f94121f14489c8c3",
242
+ "4189d041b93a0000004181f10e0000004489c8c3",
243
+ "4189d0410faff081c61600000089f0c3",
244
+ "4189d04189f94181c1180000004181f13a0000004409cf89f8c3",
245
+ "4189d04589c1450fafc84569c91d0000004181f1080000004569c9070000004489c8c3",
246
+ "4189d041b9270000004181c9080000004181c93f00000041ba290000004529ca4569d2140000004509d04489c0c3",
247
+ "4189d041b92a0000004181e10c0000004181e10e0000004501c8410faff809fe81e60500000089f0c3",
248
+ "4189d041b9160000004529c14589c2450fafd14181ca3e0000004181c20a0000004181c22c0000004501d04181e0250000004489c0c3",
249
+ "4189d04189f14181e92500000041ba380000004529ca4429d781e73e00000081c72b00000031fe81f63700000081e63c00000089f0c3",
250
+ "4189d041b92a0000004181c9100000004489c8c3",
251
+ "4189d041b93d0000004529c14401cf89f8c3",
252
+ "4189d009fe41b91e0000004181c91f000000410faff189f0c3",
253
+ "4189d04181e82400000081c61700000081f6180000004121f04489c0c3",
254
+ "4189d041b9260000004129f94181c92700000021fe69f6030000004121f14489c8c3",
255
+ "4189d041b93f0000004181e9350000004181c1210000004189fa4181f20f00000069ff210000004129fa4509d14489c8c3",
256
+ "4189d04189f14101f14181c8120000004509c129fe41ba210000004181e204000000410faff2440fafce4489c8c3",
257
+ "4189d041b93e0000004129f941ba0a0000004181e233000000450fafca4189fb440fafdf4181f0110000004431c64131f34531d94489c8c3",
258
+ "4189d041b93a0000004181e1040000004489c8c3",
259
+ "4189d081e62200000041b91b0000004129f14489c8c3",
260
+ "4189d04589c14181f13e0000004181c12b0000004529c14489c8c3",
261
+ "4189d041b9160000004181f10700000031fe81c6220000004121f14489c8c3",
262
+ "4189d04589c14101f94181e02d00000041ba0f0000004529c24431d64101f14489c8c3",
263
+ "4189d081e63200000081f6010000004431c64589c1450fafc84181f1110000004421ce89f0c3",
264
+ "4189d081cf330000004589c14569c91a0000004431cf81c61700000081f63f00000009f74101f84489c0c3",
265
+ "4189d041b93b0000004181f1330000004181c114000000440fafce4181c1030000004131f94181c1370000004409cf41ba050000004129fa4489d0c3",
266
+ "4189d041b90e0000004181c10d0000004489c8c3",
267
+ "4189d041b9150000004569c9210000004521c14489c8c3",
268
+ "4189d04189f94101f94181f1340000004101f14489c8c3",
269
+ "4189d04181c03b0000004181c8240000004181c81c0000004181c03d0000004489c0c3",
270
+ "4189d081ef1400000081f73e00000081cf3a00000081e7090000004429c789f8c3",
271
+ "4189d081ef2200000081cf2800000031f781cf2500000081cf21000000c1e70589f8c3",
272
+ "4189d04189f9440fafce4181c91b0000004521c14131f94181c10f0000004121f94181f1300000004489c8c3",
273
+ "4189d04589c14181f1270000004181e90d0000004181e13f0000004101f94529c14181c9030000004181c1180000004531c14489c8c3",
274
+ "4189d041b9370000004181c1140000004489c8c3",
275
+ "4189d041b9020000004181f11d00000041ba350000004529ca4489d0c3",
276
+ "4189d04189f94181e1010000004429cf29fe89f0c3",
277
+ "4189d031fe69f60f00000081ce030000000faffe89f8c3",
278
+ "4189d041b9170000004569c92a0000004181c9220000004181c10d0000004181c1170000004421ce89f0c3",
279
+ "4189d081c71800000041b91a0000004129f94589c24501ca4409d669f61c0000004131f04489c0c3",
280
+ "4189d04429c64189f94131f14189fa4501ca4181c22d0000004181e203000000450fafc24429c789f8c3",
281
+ "4189d04589c14121f94181c92b0000004189f24531ca4181c21f0000004181c2220000004529d04421c681e61700000089f0c3",
282
+ "4189d041b90e0000004181e1280000004489c8c3",
283
+ "4189d081f61c00000081f62000000089f0c3",
284
+ "4189d081f70d00000041b90b0000004569c90e000000410faff989f8c3",
285
+ "4189d04189f14129f181f71e000000440fafc74531c14489c8c3",
286
+ "4189d04589c1450fafc84189fa450fafd14189fb4529c34429df4109fa4489d0c3",
287
+ "4189d04589c14181c10a0000004589c24531ca41bb260000004181eb210000004131f84521c3450fafd34489d0c3",
288
+ "4189d04189f14131f181e6280000004121f14189fa4501c281f70a0000004109fa4521d14489c8c3",
289
+ "4189d041b9050000004569c90a0000004589c24569d224000000450fafca4589c34531c381e62700000069f6110000004131f34521d94489c8c3",
290
+ "4189d041b9030000004181c90c0000004489c8c3",
291
+ "4189d029fe4129f04489c0c3",
292
+ "4189d04189f94101f941ba2c0000004529ca4431d689f0c3",
293
+ "4189d04181e01c0000004101f029fe4131f04489c0c3",
294
+ "4189d041b9110000004181e11f0000004181c92a0000004429c64101f14501c14489c8c3",
295
+ "4189d081e61a0000004401c681ee0500000009f781f73900000081e70300000089f8c3",
296
+ "4189d04589c14181c13000000041ba280000004181e20d0000004509d14129f94181c1190000004529c14129f94489c8c3",
297
+ "4189d04189f941c1e1004589c24529ca4131f24181c2130000004421c74121f84521c241bb010000004529d34489d8c3",
298
+ "4189d041b9190000004569c93c0000004489c8c3",
299
+ "4189d041b92a0000004181f13f000000440fafce4489c8c3",
300
+ "4189d04189f94181c9160000004529c1440fafcf4489c8c3",
301
+ "4189d081ef070000004431c781ef02000000410faff889f8c3",
302
+ "4189d04189f14181e11d0000004121f14131f94131f14101f14489c8c3",
303
+ "4189d041b92b0000004181e9140000004529c14181e901000000450fafc8440fafce450fafc84489c8c3",
304
+ "4189d04189f94181c1110000004109f14131f94109f94101f14181f1220000004181e9380000004489c8c3",
305
+ "4189d041b9330000004181c1380000004101f9450fafc84101f14181c1300000004181e10b0000004569c93c0000004131f94489c8c3",
306
+ "4189d041b9170000004569c93c0000004489c8c3",
307
+ "4189d081ef2e000000440fafc74489c0c3",
308
+ "4189d04589c14569c9240000004589c2450fafd14531d04489c0c3",
309
+ "4189d021fe81c61f00000081f60500000001f789f8c3",
310
+ "4189d081c624000000440fafc64421c781f71200000041b92e0000004129f94489c8c3",
311
+ "4189d041b9280000004181f11c0000004189f2450fafd14181c2080000004409d681f61e00000069f61d00000089f0c3",
312
+ "4189d041b9180000004181c12f00000041ba280000004529ca4189fb4531d34181f3100000004431df29fe4121f04489c0c3",
313
+ "4189d04189f94109f94181f11a0000004531c84189f24531c24181ca2a0000004181ca21000000410faff241bb040000004129f34489d8c3",
314
+ "4189d041b9230000004181e9340000004489c8c3",
315
+ "4189d069f63d0000000faffe89f8c3",
316
+ "4189d04189f94181f11a00000081cf030000004121f94489c8c3",
317
+ "4189d04131f881ce2b00000081e618000000440fafc64489c0c3",
318
+ "4189d04129f04401c681c72200000081f73200000001fe89f0c3",
319
+ "4189d041b9020000004181c93700000041ba2c0000004529ca4189f34181e30600000081ce180000004129f34509da4489d0c3",
320
+ "4189d04189f94181f13c00000009f74121f94101f081f6100000004101f04529c14489c8c3",
321
+ "4189d04589c14101f969ff290000004129f94181c82c00000081ee3c00000041ba120000004129f24521d04501c14489c8c3",
322
+ "4189d041b90b0000004181e9110000004489c8c3",
323
+ "4189d041b92e0000004181e9200000004181f1320000004489c8c3",
324
+ "4189d041b9240000004181c11f0000004181f1370000004421ce89f0c3",
325
+ "4189d04189f94121f14189fa4569d22a0000004409d74121f94489c8c3",
326
+ "4189d041b9140000004181e1210000004189fa4181c2360000004121fa41bb1f0000004529d34509d94489c8c3",
327
+ "4189d041b9250000004181e9130000004121f84501c14181c13a0000004181f10b0000004421ce89f0c3",
328
+ "4189d0440fafc74181e83c0000004189f94521c14429cf81c73200000041ba120000004129f24421d789f8c3",
329
+ "4189d041b92e0000004181e93e0000004181c90e00000041ba370000004181ea0c0000004189f34181cb050000004531da4501d1410faff04109f14489c8c3",
330
+ "4189d041b9020000004569c9240000004489c8c3",
331
+ "4189d04181c0070000004129f04489c0c3",
332
+ "4189d081c62100000081f61300000081ee3200000089f0c3",
333
+ "4189d069f61b00000069f63a00000081c6220000004421c689f0c3",
334
+ "4189d04181f0130000004181c8260000004101f8440fafc64181e82c0000004489c0c3",
335
+ "4189d001f74431c781e70b0000004421c781c72000000081f71c00000089f8c3",
336
+ "4189d04189f94181e13b000000440fafce4121f94131f14181e9200000004181e138000000440fafcf4489c8c3",
337
+ "4189d04189f94131f94181c1130000004181f1370000004109f14101f94181f1050000004181c1370000004101f14489c8c3",
338
+ "4189d041b93c0000004181e1320000004489c8c3",
339
+ "4189d081f61400000081f61d00000089f0c3",
340
+ "4189d081f61500000081c63a0000004121f04489c0c3",
341
+ "4189d04589c14181f10b0000004421ce0faffe4101f84489c0c3",
342
+ "4189d069f62700000041b9230000004129f14189fa4501ca4189fb4509d34429df89f8c3",
343
+ "4189d041b9120000004181f1150000004431cf81e73400000081c73100000029fe69f63c00000089f0c3",
344
+ "4189d04189f14181c1030000004409cf31fe81e63900000081ce3000000041ba090000004129f24569d2250000004489d0c3",
345
+ "4189d04189f14101f14181e10d0000004189f24521ca4189fb4509d34569db340000004181f3310000004401de0faffe89f8c3",
346
+ "4189d041b9240000004569c93f0000004489c8c3",
347
+ "4189d081c7360000004109f84489c0c3",
348
+ "4189d04431c641b9080000004181e91b0000004401ce89f0c3",
349
+ "4189d04409c64189f94181c921000000410faff90faff789f0c3",
350
+ "4189d04189f94131f94181e10400000041ba130000004181c206000000410faffa4121f94489c8c3",
351
+ "4189d041b91b0000004181e9220000004181e13e0000004421c741ba3c0000004129f24409d7440fafcf4489c8c3",
352
+ "4189d001f741b90c0000004181e930000000410faff94121f041ba0c0000004181e23d0000004531d04401c789f8c3",
353
+ "4189d04401c64589c14521c14409ce4589c24181f20d0000004181f0340000004569c01d0000004501c24401d689f0c3",
354
+ "4189d041b9360000004181e1240000004489c8c3",
355
+ "4189d041b90a0000004181f1270000004181c9250000004489c8c3",
356
+ "4189d04589c14569c93b0000004589c24509c24509d14489c8c3",
357
+ "4189d041b9390000004129f94181e1240000004181c11900000041ba050000004529ca4489d0c3",
358
+ "4189d081ce1b0000004121f041b93d0000004181c93b000000450fafc14181c8010000004489c0c3",
359
+ "4189d04189f94181e11f0000004569c93d0000004121f181e7150000004101f94429ce89f0c3",
360
+ "4189d041b90a0000004181c1160000004181c1300000004181c90b00000041c1e1034181e9370000004429c74109f94489c8c3",
361
+ "4189d081c7250000004181f0350000004181f00f0000004181e01c0000004569c00e0000004409c629f781f72d00000089f8c3",
362
+ "4189d041b93c0000004181c9330000004489c8c3",
363
+ "4189d04189f14121f9440fafce4489c8c3",
364
+ "4189d04589c14109f94181c91b0000004509c14489c8c3",
365
+ "4189d041b9050000004181e9090000004109f14181e9060000004181c12e0000004489c8c3",
366
+ "4189d041b91c0000004181e1200000004181f11f0000004501c14181e93d000000440fafcf4489c8c3",
367
+ "4189d04189f94101f14501c14521c14501c14131f94569c9220000004489c8c3",
368
+ "4189d081ce2900000081e60500000081ee1d00000081c62e00000081ce0500000001fe81ee3400000089f0c3",
369
+ "4189d04589c14569c9270000004181e9260000004181e10b0000004529c14181f13b0000004181f12a0000004181f1060000004181e9090000004489c8c3",
370
+ "4189d041b9100000004181e1140000004489c8c3",
371
+ "4189d04189f14569c93b0000004409ce89f0c3",
372
+ "4189d04189f14129f94409ce29f789f8c3",
373
+ "4189d04431c681f60d00000081c63500000081ce2300000089f0c3",
374
+ "4189d04189f94569c93900000041ba140000004529ca4429d74189f34131fb4401de89f0c3",
375
+ "4189d081ef1100000041b90e0000004129f94189f2450fafd14409d64589c34121f34521d84489c0c3",
376
+ "4189d04189f14181e91b0000004181c1220000004589c24529ca4181e23c0000004501d04421c629f789f8c3",
377
+ "415441554189d04189f14181c93f0000004189fa4531ca4189fb4529d34189fc4501dc4189f54531e5410faff529f781cf3f00000089f8415d415cc3",
378
+ "4189d041b9280000004181c10f0000004489c8c3",
379
+ "4189d081c738000000440fafc74489c0c3",
380
+ "4189d04189f94121f981e6010000004131f14489c8c3",
381
+ "4189d04569c02800000041b93d0000004181c1240000004181e1390000004521c84489c0c3",
382
+ "4189d04189f14131f94189f24531ca69f61300000081e6280000004121f24489d0c3",
383
+ "4189d04589c14181e1320000004189f24531ca4109f041bb2e0000004181f3270000004529d84531c24489d0c3",
384
+ "4189d041b91b0000004181e93200000081f7270000004129f981c60e00000041ba0d0000004181f2140000004429d64121f14489c8c3",
385
+ "4189d041b90b0000004181e91e0000004181c009000000450fafc84189f24181e20a00000081e63b00000081f609000000440fafd64521d14489c8c3",
386
+ "4189d041b9020000004181f12d0000004489c8c3",
387
+ "4189d081cf0c00000081ef3900000089f8c3",
388
+ "4189d041b90e0000004181c13e0000004421ce81ce3700000089f0c3",
389
+ "4189d04189f94181f13a00000041ba2e0000004181c2290000004109fa4521d14489c8c3",
390
+ "4189d04189f14181c90100000041ba3b0000004129f24569d2360000004509d14401cf89f8c3",
391
+ "4189d04589c14181c12f0000004129f14531c84181f00b00000081c61c000000440fafc64489c0c3",
392
+ "4189d04589c14531c14509c821fe4101f04121f84181f0370000004181c0350000004489c0c3",
393
+ "4189d04189f94529c141c1e1054101f14569c917000000410faff181e62800000069ff2400000021fe89f0c3",
394
+ "4189d041b9310000004181c12d0000004489c8c3",
395
+ "4189d04181e8040000004131f84489c0c3",
396
+ "4189d04589c14121f94531c14521c14489c8c3",
397
+ "4189d041b90d0000004181c1360000004531c14569c93b0000004181c9280000004489c8c3",
398
+ "4189d081c73100000081cf0900000081c71000000081c71d00000001f789f8c3",
399
+ "4189d04401c681e63400000009fe81f60d0000004431c669f62e00000089f0c3",
400
+ "4189d04589c14501c14181f10d0000004529c14509c14181c9090000004181f1230000004569c9170000004489c8c3",
401
+ "4189d04189f94109f14129f14129f14181c9300000004181c1130000004501c14531c14129f94489c8c3",
402
+ "4189d041b9240000004181f12800000081e6110000004121f14489c8c3",
403
+ "4189d041b93b0000004181e9210000004589c24521ca4521d04489c0c3",
404
+ "4189d04189f94131f94181c11e0000004181c911000000440fafce4489c8c3",
405
+ "4189d041b93d0000004181e9370000004489c8c3",
406
+ "4189d04189f14129f14181c1180000004489c8c3",
407
+ "4189d04189f94181c10b0000004121f981e62f0000004129f14489c8c3",
408
+ "4189d04569c03f0000004569c01d0000004489c0c3",
409
+ "4189d069f63300000081ce0100000089f0c3",
410
+ "4189d081f62b00000041b9010000004129f14589c24509ca450fafc24181e0040000004181c8100000004181f0040000004489c0c3",
411
+ "4189d041b9340000004181e10100000041ba1b0000004129f24501d14181e03e0000004569c0150000004501c14109f14489c8c3",
412
+ "4189d04189f94181f12e0000004189fa450fafd14529c24189fb450fafda4181e3250000004101fb4489d8c3",
413
+ "4189d04589c1450fafc841ba2e0000004529ca4181e22b0000004529d041bb1c0000004529c34421df81f73700000089f8c3",
414
+ "4189d04589c1450fafc84409ce89f0c3",
415
+ "4189d081f6370000004101f04489c0c3",
416
+ "4189d041b93c0000004569c93200000069ff0c00000041ba3c0000004129fa4501d14489c8c3",
417
+ "4189d04189f94569c9130000004181e92a0000004109f94531c14131f14101f14101f14489c8c3",
418
+ "4189d041b9380000004181e9200000004181c1270000004409cf81e60500000021f781e72e00000089f8c3",
419
+ "4189d04189f14129f14589c24531ca4181c81b00000041bb2d0000004181e3170000004501d84529c24489d0c3",
420
+ "4189d041b9040000004181f1150000004509c1440fafcf4489c8c3",
421
+ "4189d04589c14121f94181f0150000004181f0250000004501c14489c8c3",
422
+ "4189d04189f14501c14131f14181f12c0000004501c14489c8c3",
423
+ "4189d041b9260000004129f141c1e1034189f24129f24521d0450fafc84489c8c3",
424
+ "4189d04181f03e00000041b9210000004529c14569c9230000004409cf89f8c3",
425
+ "4189d04189f14121f14589c24509ca4189f34501d34181cb1b0000004521d84421c681f63400000089f0c3",
426
+ "4189d081ce1e00000041b90b0000004181f1150000004421ce4589c24569d23c0000004121f84529c2410faff289f0c3",
427
+ "4189d081cf050000004409c781cf3100000081c71b00000081f62d00000029f789f8c3",
428
+ "4189d041b9210000004181c11d00000041ba280000004181ea280000004521d14489c8c3",
429
+ "4189d04189f14181f10e0000004409ce41ba1f0000004181e237000000410faffa0faff789f0c3",
430
+ "4189d041b9070000004569c90f0000004189fa4529ca4181f21a0000004131fa4181f2250000004569d235000000440fafd74489d0c3",
431
+ "4189d041b9290000004569c9190000004489c8c3",
432
+ "4189d081ee3a00000089f0c3",
433
+ "4189d04189f14181e11600000081ee080000004121f14489c8c3",
434
+ "4189d041b9250000004181e10b000000440fafcf4489c8c3",
435
+ "4189d04189f94181c93e0000004181e9110000004181f1150000004521c14531c14131f94181f13e0000004489c8c3",
436
+ "4189d041b9330000004181c9230000004181c9280000004509c14489c8c3",
437
+ "4189d041b9090000004181c91e0000004521c14189f24181f2070000004121fa4509d04409c64129f14489c8c3",
438
+ "4189d04589c14521c141ba0b0000004529ca4489d0c3",
439
+ "4189d041b90b0000004529c14421cf4101f84569c0380000004181c81d0000004181c8200000004489c0c3",
440
+ "4189d041b9180000004181e90b0000004181f11d0000004421ce89f0c3",
441
+ "4189d041b9270000004181f1120000004489c8c3",
442
+ "4189d041b9360000004181f1380000004489c8c3",
443
+ "4189d041b92a0000004181e939000000450fafc84569c9160000004489c8c3",
444
+ "4189d04189f94181c91c0000004401cf81e73a0000004129f84181c0110000004181c01f0000004489c0c3",
445
+ "4189d081e6390000004421c74121f84431c689f0c3",
446
+ "4189d04429c769ff2800000081e71b00000081c7300000004109f84489c0c3",
447
+ "4189d041b93a0000004569c93b0000004569c90d0000004181c10b000000440fafce4489c8c3",
448
+ "4189d081f62600000089f0c3",
449
+ "4189d081e71500000089f8c3",
450
+ "4189d04189f94121f94589c24509ca4531d04489c0c3",
451
+ "4189d081c63800000001f789f8c3",
452
+ "4189d04189f94181c10a0000004531c84401c789f8c3",
453
+ "4189d041b91f0000004181f11e0000004489c8c3",
454
+ "4189d04189f94181c1380000004189fa4181ca350000004431d74131f94401ce89f0c3",
455
+ "4189d04589c14569c9290000004501c14489c8c3",
456
+ "4189d081f63600000089f0c3",
457
+ "4189d041b9280000004181e1120000004181c9010000004529c14489c8c3",
458
+ "4189d04589c14181c13a0000004421c7440fafcf4181c1190000004489c8c3",
459
+ "4189d081f70e00000081cf3300000089f8c3",
460
+ "4189d04569c018000000440fafc64489c0c3",
461
+ "4189d04189f94181c12d00000001fe4129f14489c8c3",
462
+ "4189d04569c00700000041b9270000004181e123000000450fafc14489c0c3",
463
+ "4189d041c1e0014181c8370000004489c0c3",
464
+ "4189d04131f04129f04421c609f789f8c3",
465
+ "4189d04431c681e60f00000081e61100000081f60600000081e6160000000faff789f0c3",
466
+ "4189d04189f94509c14429c74101f94489c8c3",
467
+ "4189d04189f9450fafc84189fa4569d2090000004529d10faff781e7380000000faff74109f14489c8c3",
468
+ "41544189d041b9380000004181e11500000041ba2b0000004181f2070000004531d141bb190000004181cb0600000041bc290000004129f44521e34509d94489c8415cc3",
469
+ "4189d04409c769ff1400000021f781ef0c0000004421c769ff1500000089f8c3",
470
+ "4189d04189f14569c9050000004529c14129f14181c1250000004101f94489c8c3",
471
+ "4189d04181e03e0000004181c8110000004401c689f0c3",
472
+ "4189d041b9020000004181c1320000004489c8c3",
473
+ "4189d081ce2500000009fe4429c64431c669f61800000089f0c3",
474
+ "4189d04589c14181e11c0000004531c84431c769ff1800000069ff2f00000069ff3d00000069ff2f00000089f8c3",
475
+ "4189d04181c82a0000004131f84569c0180000004489c0c3",
476
+ "4189d04189f94181c1190000004431cf01fe81ce0400000089f0c3",
477
+ "4189d081c60200000069f62500000081c62b00000089f0c3",
478
+ "4189d04189f94569c9210000004181e1210000004129f94101f94181f13d0000004181e1110000004489c8c3",
479
+ "4189d041b92e0000004181e12300000041ba1a0000004181e23f000000450fafca4489c8c3",
480
+ "4189d04189f94569c92c00000021f74129f941ba220000004181e21c00000081f60b0000004131f24531d14489c8c3",
481
+ "4189d04189f94181c1060000004429cf89f8c3",
482
+ "4189d041b9390000004181e9160000004409cf89f8c3",
483
+ "4189d041b92e0000004181c11400000041ba190000004181e220000000450fafca4489c8c3",
484
+ "4189d081e72900000081e73b00000089f8c3",
485
+ "4189d04181c0320000004489c0c3",
486
+ "4189d04189f94181e93a00000041ba320000004529ca81c61c00000009f7440fafd74489d0c3",
487
+ "4189d041b91a0000004181c90c0000004489c8c3",
488
+ "4189d04421c64181e00c0000004431c681c62c00000069f61f00000081f60200000089f0c3",
489
+ "4189d041b9130000004181e1390000004131f94569c9180000004129f14489c8c3",
490
+ "4189d04431c721f70faffe410faff881e70c00000089f8c3",
491
+ "4189d00faffe4181c0260000004431c741b91f0000004181c90500000081c61c0000004101f1410faff989f8c3",
492
+ "4189d081ee0e00000081ce1b00000089f0c3",
493
+ "4189d041b9010000004181e1060000004489c8c3",
494
+ "4189d041b9260000004181e9070000004489c8c3",
495
+ "4189d041b9180000004181f1020000004489c8c3",
496
+ "4189d04181e80d0000004181e0240000004489c0c3",
497
+ "4189d081c72900000089f8c3",
498
+ "4189d041b93e0000004569c93b0000004589c2450fafd04181c2010000004521d14489c8c3",
499
+ "4189d0c1e60581ce0900000081ce2b0000004421c681e61200000089f0c3",
500
+ "4189d041b9110000004181c9120000004181f1300000004181e9160000004489c8c3",
501
+ "4189d041b9280000004181f1030000004489c8c3",
502
+ "4189d041b91f0000004569c93e0000004181e90b0000004131f14489c8c3",
503
+ "4189d041b9160000004181f1330000004189f24531ca41bb080000004129fb4181c3260000004421de69f60c000000440fafd64489d0c3",
504
+ "4189d04569c0380000004189f94509c1410faff989f8c3",
505
+ "4189d069ff1400000029f789f8c3",
506
+ "4189d04189f94181c91f000000450fafc141ba230000004181f22e0000004189fb4121fb4529da4521d04489c0c3",
507
+ "4189d041b9110000004181c11f0000004489c8c3",
508
+ "4189d04189f14181c9260000004181c0010000004529c181c7060000004189f24129f24421d74131f94489c8c3",
509
+ "4189d04589c14529c14531c14489c8c3",
510
+ "41544189d04189f94569c9310000004189fa450fafd14589c34529d341bc070000004529dc09fe440fafe64529c44489e0415cc3",
511
+ "4189d041b9200000004181e9090000004131f14181c1290000004181e9140000004131f14501c1440fafce4489c8c3",
512
+ "4189d04589c1450fafc84131f8410faff84129f94489c8c3",
513
+ "4189d04181c0250000004431c641b9160000004129f14489c8c3",
514
+ "4189d041b9350000004181e90f0000004489c8c3",
515
+ "4189d04569c02a00000041b9230000004129f94189fa4181ea3a0000004501d14521c84101f04421c789f8c3",
516
+ "4189d069ff2d00000081f71700000081ef2600000081ef2200000089f8c3",
517
+ "4189d029fe4401c689f0c3",
518
+ "4189d041b91e0000004181e10d0000004589c24521ca4531d04421c681ce2b00000089f0c3",
519
+ "4189d041b92c0000004569c9120000004569c9340000004181f1380000004109f14181e12d0000004489c8c3",
520
+ "4189d04189f94181f11b0000004129f94409ce0faff789f0c3",
521
+ "4189d04189f94569c9070000004421ce4189fa4569d2380000004421d70faff789f0c3",
522
+ "4189d04189f14181c91a000000440fafce4489c8c3",
523
+ "4189d04189f94129f1440fafce4129f94569c9050000004521c14489c8c3",
524
+ "4189d04589c14181c9380000004529c84489c0c3",
525
+ "4189d041b9290000004129f14429cf4189f24109f241bb120000004569db3e0000004509da4429d789f8c3",
526
+ "4189d04181e0260000004429c789f8c3",
527
+ "4189d04589c14531c14181f1270000004489c8c3",
528
+ "4189d041b93f0000004181f10a0000004489c8c3",
529
+ "4189d04189f94521c14531c8410faff021f781f70600000089f8c3",
530
+ "4189d04409c681f63300000009fe89f0c3",
531
+ "4189d04189f14569c92900000081e62f0000004101f14589c24501c241bb380000004181e3220000004521da4531d14489c8c3",
532
+ "4189d041b9360000004569c91300000081e71e000000440fafcf4489c8c3",
533
+ "4189d041b9290000004181c1270000004489c8c3",
534
+ "4189d04189f94569c93e0000004109f9440fafcf4569c90c0000004181c9070000004129f94101f14489c8c3",
535
+ "4189d041b92b0000004181f1230000004131f14189f24181e20f0000004429d64101f14501c84489c0c3",
536
+ "4189d001fe4121f84181c0060000004429c689f0c3",
537
+ "4189d081ce1600000081ce0b0000004121f04489c0c3",
538
+ "4189d04189f94529c14131f14129f94181e1160000004181c9150000004181e9130000004131f14489c8c3",
539
+ "4189d04589c14531c14101f10faff74109f14569c01e0000004521c14489c8c3",
540
+ "4189d081f73100000081f71500000089f8c3",
541
+ "4189d081ce2f00000029f789f8c3",
542
+ "4189d081f6090000004189f94569c93b0000004409ce4189fa440fafd64589c34531c34409df4109fa4489d0c3",
543
+ "4189d04189f94181e11d0000004181e9210000004181c134000000450fafc881e7150000004131f94489c8c3",
544
+ "4189d081e63400000081c62e00000041b90b0000004129f14181f1350000004189fa4531ca4189fb4501d3410faffb89f8c3",
545
+ "4189d041b9330000004181c1380000004409ce440fafc64181c03e0000004181c8320000004489c0c3",
546
+ "4189d04189f14181e9340000004181e1330000004569c9310000004401ce89f0c3",
547
+ "4189d041b9310000004129f14431ce89f0c3",
548
+ "4189d04409c769ff1400000089f8c3",
549
+ "4189d04421c681c6330000004181f00c0000004181f0330000004421c689f0c3",
550
+ "4189d041b9160000004181e1140000004489c8c3",
551
+ "4189d041b9100000004181c93f0000004181e11c000000440fafce4569c93d0000004521c14131f1440fafce4489c8c3",
552
+ "4189d04569c0050000004181c0170000004181f02000000069f63100000081c62600000081c60f0000004101f04489c0c3",
553
+ "4189d041b9230000004181e9100000004489c8c3",
554
+ "4189d041b9380000004181e9370000004181f1020000004121f94181f01c00000041c1e0044181c8330000004501c14489c8c3",
555
+ "4189d041b9020000004181f12b000000440fafce4489c8c3",
556
+ "4189d041b90a0000004569c9300000004489c8c3",
557
+ "4189d04189f94181f10d0000004531c14109f94131f14489c8c3",
558
+ "4189d081cf1d00000029fe81c60d0000004429c689f0c3",
559
+ "4189d041b9180000004181f1260000004489c8c3",
560
+ "4189d04189f1450fafc84129f94181f10e0000004529c14569c9300000004181f1200000004129f14489c8c3",
561
+ "4189d04189f14181c90d0000004189fa4501c24531d181c72e00000081ce1400000021f74129f94489c8c3",
562
+ "4189d04189f94181c91100000081ef05000000440fafcf4489c8c3",
563
+ "4189d069f63d00000069f62c00000009fe4429c629fe81c63c00000089f0c3",
564
+ "4189d04181c0260000004401c741b9310000004569c90e0000004181e1330000004429cf89f8c3",
565
+ "4189d041b9180000004181f1090000004569c91f0000004489c8c3",
566
+ "4189d04189f14181c9250000004431c6440fafce4489c8c3",
567
+ "4189d041b9040000004181e90d0000004181e1380000004131f14181e1090000004181f1200000004181c11c0000004181c12b0000004489c8c3",
568
+ "4189d041b9300000004181c11d0000004589c24501ca4589c34569db060000004529d84521c24489d0c3",
569
+ "4189d041b9320000004181f1250000004501c84489c0c3",
570
+ "4189d041b9200000004181e13c00000041ba0e0000004181ca1d0000004401d74129f94489c8c3",
571
+ "4189d041b9010000004181f1200000004131f14129f94401ce410faff081ce2600000089f0c3",
572
+ "4189d081ef0e00000081cf2400000069ff0900000089f8c3",
573
+ "4189d081c71b00000041b9280000004181e1190000004409ce31f789f8c3",
574
+ "4189d04189f14521c14189fa4121fa4181f2080000004509d04431c6440fafce4181c1050000004489c8c3",
575
+ "4189d081f629000000410faff089f0c3",
576
+ "4189d04189f94181f10f00000041ba1d0000004129fa4429d64129f04521c14489c8c3",
577
+ "4189d041b93a0000004181e1110000004181e91a0000004181c9050000004121f14489c8c3",
578
+ "4189d04589c14181c91e0000004529c14181f1320000004501c14101f14121f14569c9380000004489c8c3",
579
+ "4189d041b9040000004181c11c0000004509c14489c8c3",
580
+ "4189d04589c14181f11c0000004589c2450fafd04131f2450fafca4429cf4421c74121f84489c0c3",
581
+ "4189d081ce2d00000089f0c3",
582
+ "4189d081e63a00000081ce0c00000089f0c3",
583
+ "4189d04189f14101f14181e83a0000004529c14181f11e0000004489c8c3",
584
+ "4189d04181c0190000004189f94521c14181e11d0000004121f94489c8c3",
585
+ "4189d04589c14181e91b0000004181e13e0000004181e12b0000004181f1100000004531c84421c689f0c3",
586
+ "4189d04189f14569c90c0000004181c13b0000004121f94109f14181c93c0000004489c8c3",
587
+ "4189d041b91d0000004181f10800000069f60900000081c61b000000440fafce4489c8c3",
588
+ "4189d041b9090000004181f1020000004489c8c3",
589
+ "4189d029f701fe4181c0060000004181e00b000000410faff089f0c3",
590
+ "4189d041b9020000004181f12e0000004121f14489c8c3",
591
+ "4189d04589c14501c14429c64109f14489c8c3",
592
+ "4189d081f72200000001fe4589c14129f141ba3d0000004529ca4501d04489c0c3",
593
+ "41544189d04189f94181c1090000004401cf4189f24101fa4589c3450fafda4589c44501dc450fafc44429c689f0415cc3",
594
+ "4189d04189f94181e1110000004121f94181f13a0000004121f1440fafce4109f14489c8c3",
595
+ "4189d04181e0190000004569c0260000004181f02b0000004569c02c0000004489c0c3",
596
+ "4189d041b9240000004181f10100000069ff1d00000031fe4109f14489c8c3",
597
+ "4189d041b91e0000004181c9110000004129f141ba370000004529ca4489d0c3",
598
+ "4189d04189f94181f10e0000004189f2450fafd141bb2e0000004569db1300000029f74109fb4501da4489d0c3",
599
+ "4189d041b9320000004181e1300000004489c8c3",
600
+ "4189d081cf0f00000081f70700000081cf0600000031f789f8c3",
601
+ "4189d081c72600000041b9320000004181c1230000004409cf41ba070000004181e20200000081ee1d0000004121f24429d789f8c3"
602
+ ]
evaluation/regression.json DELETED
@@ -1,275 +0,0 @@
1
- {
2
- "release": "0.2.0-experimental",
3
- "original_initialization_seconds": 4.416371800005436,
4
- "package_initialization_seconds": 1.2131852000020444,
5
- "device": "NVIDIA GeForce RTX 2060 SUPER",
6
- "torch": "2.13.0+cu132",
7
- "splits": {
8
- "validation": {
9
- "programs": 2000,
10
- "equality": {
11
- "bytes": true,
12
- "byte_tensors": true,
13
- "ast": true,
14
- "ssa": true,
15
- "virtual_mir": true,
16
- "physical_mir": true,
17
- "overflow": true,
18
- "emission_counts": true,
19
- "instruction_lengths": true
20
- },
21
- "semantic_results_equal": true,
22
- "single_vs_batch_equal_32_programs": true,
23
- "original_single_vs_batch_equal": true,
24
- "functions": 2000,
25
- "serializable": 1.0,
26
- "fully_disassembled": 1.0,
27
- "semantic_accuracy": 0.987,
28
- "semantic_correct": 1974,
29
- "by_operations": {
30
- "3": {
31
- "n": 286,
32
- "semantic_correct": 285,
33
- "semantic_accuracy": 0.9965034965034965
34
- },
35
- "4": {
36
- "n": 286,
37
- "semantic_correct": 285,
38
- "semantic_accuracy": 0.9965034965034965
39
- },
40
- "1": {
41
- "n": 286,
42
- "semantic_correct": 286,
43
- "semantic_accuracy": 1.0
44
- },
45
- "2": {
46
- "n": 286,
47
- "semantic_correct": 286,
48
- "semantic_accuracy": 1.0
49
- },
50
- "7": {
51
- "n": 285,
52
- "semantic_correct": 266,
53
- "semantic_accuracy": 0.9333333333333333
54
- },
55
- "6": {
56
- "n": 285,
57
- "semantic_correct": 282,
58
- "semantic_accuracy": 0.9894736842105263
59
- },
60
- "5": {
61
- "n": 286,
62
- "semantic_correct": 284,
63
- "semantic_accuracy": 0.993006993006993
64
- }
65
- },
66
- "by_depth": {
67
- "2": {
68
- "n": 370,
69
- "semantic_correct": 370,
70
- "semantic_accuracy": 1.0
71
- },
72
- "3": {
73
- "n": 520,
74
- "semantic_correct": 517,
75
- "semantic_accuracy": 0.9942307692307693
76
- },
77
- "4": {
78
- "n": 256,
79
- "semantic_correct": 254,
80
- "semantic_accuracy": 0.9921875
81
- },
82
- "1": {
83
- "n": 286,
84
- "semantic_correct": 286,
85
- "semantic_accuracy": 1.0
86
- },
87
- "7": {
88
- "n": 153,
89
- "semantic_correct": 145,
90
- "semantic_accuracy": 0.9477124183006536
91
- },
92
- "6": {
93
- "n": 191,
94
- "semantic_correct": 186,
95
- "semantic_accuracy": 0.9738219895287958
96
- },
97
- "5": {
98
- "n": 224,
99
- "semantic_correct": 216,
100
- "semantic_accuracy": 0.9642857142857143
101
- }
102
- },
103
- "by_origin": {
104
- "balanced_shape": {
105
- "n": 497,
106
- "semantic_correct": 495,
107
- "semantic_accuracy": 0.9959758551307847
108
- },
109
- "right_chain": {
110
- "n": 497,
111
- "semantic_correct": 491,
112
- "semantic_accuracy": 0.9879275653923542
113
- },
114
- "left_chain": {
115
- "n": 502,
116
- "semantic_correct": 501,
117
- "semantic_accuracy": 0.99800796812749
118
- },
119
- "random": {
120
- "n": 504,
121
- "semantic_correct": 487,
122
- "semantic_accuracy": 0.9662698412698413
123
- }
124
- },
125
- "by_balanced": {
126
- "True": {
127
- "n": 441,
128
- "semantic_correct": 440,
129
- "semantic_accuracy": 0.9977324263038548
130
- },
131
- "False": {
132
- "n": 1559,
133
- "semantic_correct": 1534,
134
- "semantic_accuracy": 0.9839640795381654
135
- }
136
- },
137
- "inputs_per_function": 32,
138
- "sample_seed": 20261127,
139
- "exact_reference_bytes": 0.982
140
- },
141
- "test": {
142
- "programs": 2000,
143
- "equality": {
144
- "bytes": true,
145
- "byte_tensors": true,
146
- "ast": true,
147
- "ssa": true,
148
- "virtual_mir": true,
149
- "physical_mir": true,
150
- "overflow": true,
151
- "emission_counts": true,
152
- "instruction_lengths": true
153
- },
154
- "semantic_results_equal": true,
155
- "single_vs_batch_equal_32_programs": true,
156
- "original_single_vs_batch_equal": true,
157
- "functions": 2000,
158
- "serializable": 1.0,
159
- "fully_disassembled": 1.0,
160
- "semantic_accuracy": 0.9815,
161
- "semantic_correct": 1963,
162
- "by_operations": {
163
- "7": {
164
- "n": 285,
165
- "semantic_correct": 265,
166
- "semantic_accuracy": 0.9298245614035088
167
- },
168
- "2": {
169
- "n": 286,
170
- "semantic_correct": 286,
171
- "semantic_accuracy": 1.0
172
- },
173
- "6": {
174
- "n": 285,
175
- "semantic_correct": 273,
176
- "semantic_accuracy": 0.9578947368421052
177
- },
178
- "1": {
179
- "n": 286,
180
- "semantic_correct": 286,
181
- "semantic_accuracy": 1.0
182
- },
183
- "4": {
184
- "n": 286,
185
- "semantic_correct": 286,
186
- "semantic_accuracy": 1.0
187
- },
188
- "3": {
189
- "n": 286,
190
- "semantic_correct": 284,
191
- "semantic_accuracy": 0.993006993006993
192
- },
193
- "5": {
194
- "n": 286,
195
- "semantic_correct": 283,
196
- "semantic_accuracy": 0.9895104895104895
197
- }
198
- },
199
- "by_depth": {
200
- "7": {
201
- "n": 153,
202
- "semantic_correct": 146,
203
- "semantic_accuracy": 0.954248366013072
204
- },
205
- "2": {
206
- "n": 370,
207
- "semantic_correct": 370,
208
- "semantic_accuracy": 1.0
209
- },
210
- "6": {
211
- "n": 182,
212
- "semantic_correct": 175,
213
- "semantic_accuracy": 0.9615384615384616
214
- },
215
- "1": {
216
- "n": 286,
217
- "semantic_correct": 286,
218
- "semantic_accuracy": 1.0
219
- },
220
- "4": {
221
- "n": 256,
222
- "semantic_correct": 253,
223
- "semantic_accuracy": 0.98828125
224
- },
225
- "3": {
226
- "n": 530,
227
- "semantic_correct": 520,
228
- "semantic_accuracy": 0.9811320754716981
229
- },
230
- "5": {
231
- "n": 223,
232
- "semantic_correct": 213,
233
- "semantic_accuracy": 0.9551569506726457
234
- }
235
- },
236
- "by_origin": {
237
- "left_chain": {
238
- "n": 502,
239
- "semantic_correct": 501,
240
- "semantic_accuracy": 0.99800796812749
241
- },
242
- "balanced_shape": {
243
- "n": 497,
244
- "semantic_correct": 489,
245
- "semantic_accuracy": 0.9839034205231388
246
- },
247
- "right_chain": {
248
- "n": 497,
249
- "semantic_correct": 485,
250
- "semantic_accuracy": 0.9758551307847082
251
- },
252
- "random": {
253
- "n": 504,
254
- "semantic_correct": 488,
255
- "semantic_accuracy": 0.9682539682539683
256
- }
257
- },
258
- "by_balanced": {
259
- "False": {
260
- "n": 1559,
261
- "semantic_correct": 1526,
262
- "semantic_accuracy": 0.9788325849903784
263
- },
264
- "True": {
265
- "n": 441,
266
- "semantic_correct": 437,
267
- "semantic_accuracy": 0.9909297052154195
268
- }
269
- },
270
- "inputs_per_function": 32,
271
- "sample_seed": 20261127
272
- }
273
- },
274
- "passed": true
275
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
evaluation/test.json DELETED
@@ -1,132 +0,0 @@
1
- {
2
- "programs": 2000,
3
- "equality": {
4
- "bytes": true,
5
- "byte_tensors": true,
6
- "ast": true,
7
- "ssa": true,
8
- "virtual_mir": true,
9
- "physical_mir": true,
10
- "overflow": true,
11
- "emission_counts": true,
12
- "instruction_lengths": true
13
- },
14
- "semantic_results_equal": true,
15
- "single_vs_batch_equal_32_programs": true,
16
- "original_single_vs_batch_equal": true,
17
- "functions": 2000,
18
- "serializable": 1.0,
19
- "fully_disassembled": 1.0,
20
- "semantic_accuracy": 0.9815,
21
- "semantic_correct": 1963,
22
- "by_operations": {
23
- "7": {
24
- "n": 285,
25
- "semantic_correct": 265,
26
- "semantic_accuracy": 0.9298245614035088
27
- },
28
- "2": {
29
- "n": 286,
30
- "semantic_correct": 286,
31
- "semantic_accuracy": 1.0
32
- },
33
- "6": {
34
- "n": 285,
35
- "semantic_correct": 273,
36
- "semantic_accuracy": 0.9578947368421052
37
- },
38
- "1": {
39
- "n": 286,
40
- "semantic_correct": 286,
41
- "semantic_accuracy": 1.0
42
- },
43
- "4": {
44
- "n": 286,
45
- "semantic_correct": 286,
46
- "semantic_accuracy": 1.0
47
- },
48
- "3": {
49
- "n": 286,
50
- "semantic_correct": 284,
51
- "semantic_accuracy": 0.993006993006993
52
- },
53
- "5": {
54
- "n": 286,
55
- "semantic_correct": 283,
56
- "semantic_accuracy": 0.9895104895104895
57
- }
58
- },
59
- "by_depth": {
60
- "7": {
61
- "n": 153,
62
- "semantic_correct": 146,
63
- "semantic_accuracy": 0.954248366013072
64
- },
65
- "2": {
66
- "n": 370,
67
- "semantic_correct": 370,
68
- "semantic_accuracy": 1.0
69
- },
70
- "6": {
71
- "n": 182,
72
- "semantic_correct": 175,
73
- "semantic_accuracy": 0.9615384615384616
74
- },
75
- "1": {
76
- "n": 286,
77
- "semantic_correct": 286,
78
- "semantic_accuracy": 1.0
79
- },
80
- "4": {
81
- "n": 256,
82
- "semantic_correct": 253,
83
- "semantic_accuracy": 0.98828125
84
- },
85
- "3": {
86
- "n": 530,
87
- "semantic_correct": 520,
88
- "semantic_accuracy": 0.9811320754716981
89
- },
90
- "5": {
91
- "n": 223,
92
- "semantic_correct": 213,
93
- "semantic_accuracy": 0.9551569506726457
94
- }
95
- },
96
- "by_origin": {
97
- "left_chain": {
98
- "n": 502,
99
- "semantic_correct": 501,
100
- "semantic_accuracy": 0.99800796812749
101
- },
102
- "balanced_shape": {
103
- "n": 497,
104
- "semantic_correct": 489,
105
- "semantic_accuracy": 0.9839034205231388
106
- },
107
- "right_chain": {
108
- "n": 497,
109
- "semantic_correct": 485,
110
- "semantic_accuracy": 0.9758551307847082
111
- },
112
- "random": {
113
- "n": 504,
114
- "semantic_correct": 488,
115
- "semantic_accuracy": 0.9682539682539683
116
- }
117
- },
118
- "by_balanced": {
119
- "False": {
120
- "n": 1559,
121
- "semantic_correct": 1526,
122
- "semantic_accuracy": 0.9788325849903784
123
- },
124
- "True": {
125
- "n": 441,
126
- "semantic_correct": 437,
127
- "semantic_accuracy": 0.9909297052154195
128
- }
129
- },
130
- "inputs_per_function": 32,
131
- "sample_seed": 20261127
132
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
evaluation/validation.json DELETED
@@ -1,133 +0,0 @@
1
- {
2
- "programs": 2000,
3
- "equality": {
4
- "bytes": true,
5
- "byte_tensors": true,
6
- "ast": true,
7
- "ssa": true,
8
- "virtual_mir": true,
9
- "physical_mir": true,
10
- "overflow": true,
11
- "emission_counts": true,
12
- "instruction_lengths": true
13
- },
14
- "semantic_results_equal": true,
15
- "single_vs_batch_equal_32_programs": true,
16
- "original_single_vs_batch_equal": true,
17
- "functions": 2000,
18
- "serializable": 1.0,
19
- "fully_disassembled": 1.0,
20
- "semantic_accuracy": 0.987,
21
- "semantic_correct": 1974,
22
- "by_operations": {
23
- "3": {
24
- "n": 286,
25
- "semantic_correct": 285,
26
- "semantic_accuracy": 0.9965034965034965
27
- },
28
- "4": {
29
- "n": 286,
30
- "semantic_correct": 285,
31
- "semantic_accuracy": 0.9965034965034965
32
- },
33
- "1": {
34
- "n": 286,
35
- "semantic_correct": 286,
36
- "semantic_accuracy": 1.0
37
- },
38
- "2": {
39
- "n": 286,
40
- "semantic_correct": 286,
41
- "semantic_accuracy": 1.0
42
- },
43
- "7": {
44
- "n": 285,
45
- "semantic_correct": 266,
46
- "semantic_accuracy": 0.9333333333333333
47
- },
48
- "6": {
49
- "n": 285,
50
- "semantic_correct": 282,
51
- "semantic_accuracy": 0.9894736842105263
52
- },
53
- "5": {
54
- "n": 286,
55
- "semantic_correct": 284,
56
- "semantic_accuracy": 0.993006993006993
57
- }
58
- },
59
- "by_depth": {
60
- "2": {
61
- "n": 370,
62
- "semantic_correct": 370,
63
- "semantic_accuracy": 1.0
64
- },
65
- "3": {
66
- "n": 520,
67
- "semantic_correct": 517,
68
- "semantic_accuracy": 0.9942307692307693
69
- },
70
- "4": {
71
- "n": 256,
72
- "semantic_correct": 254,
73
- "semantic_accuracy": 0.9921875
74
- },
75
- "1": {
76
- "n": 286,
77
- "semantic_correct": 286,
78
- "semantic_accuracy": 1.0
79
- },
80
- "7": {
81
- "n": 153,
82
- "semantic_correct": 145,
83
- "semantic_accuracy": 0.9477124183006536
84
- },
85
- "6": {
86
- "n": 191,
87
- "semantic_correct": 186,
88
- "semantic_accuracy": 0.9738219895287958
89
- },
90
- "5": {
91
- "n": 224,
92
- "semantic_correct": 216,
93
- "semantic_accuracy": 0.9642857142857143
94
- }
95
- },
96
- "by_origin": {
97
- "balanced_shape": {
98
- "n": 497,
99
- "semantic_correct": 495,
100
- "semantic_accuracy": 0.9959758551307847
101
- },
102
- "right_chain": {
103
- "n": 497,
104
- "semantic_correct": 491,
105
- "semantic_accuracy": 0.9879275653923542
106
- },
107
- "left_chain": {
108
- "n": 502,
109
- "semantic_correct": 501,
110
- "semantic_accuracy": 0.99800796812749
111
- },
112
- "random": {
113
- "n": 504,
114
- "semantic_correct": 487,
115
- "semantic_accuracy": 0.9662698412698413
116
- }
117
- },
118
- "by_balanced": {
119
- "True": {
120
- "n": 441,
121
- "semantic_correct": 440,
122
- "semantic_accuracy": 0.9977324263038548
123
- },
124
- "False": {
125
- "n": 1559,
126
- "semantic_correct": 1534,
127
- "semantic_accuracy": 0.9839640795381654
128
- }
129
- },
130
- "inputs_per_function": 32,
131
- "sample_seed": 20261127,
132
- "exact_reference_bytes": 0.982
133
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
examples/compile_example.py DELETED
@@ -1,11 +0,0 @@
1
- from neuro_compiler import NeuralCompiler
2
-
3
- def main():
4
- compiler=NeuralCompiler.from_pretrained('chrisuser/neuro-compiler',revision='0.2.0-experimental')
5
- source='unsigned f(unsigned a,unsigned b,unsigned c){return ((a+b)*(c-7u));}'
6
- print(compiler.compile(source).hex())
7
- print([x.hex() for x in compiler.compile_batch([source,source])])
8
- result=compiler.compile(source,return_intermediates=True)
9
- print(result.ast,result.ssa,result.virtual_mir,result.physical_mir,result.diagnostics)
10
-
11
- if __name__=='__main__': main()
 
 
 
 
 
 
 
 
 
 
 
 
examples/eight_operations.cpp ADDED
@@ -0,0 +1 @@
 
 
1
+ unsigned f(unsigned a,unsigned b,unsigned c){return ((((((25u+34u)&(34u-c))+20u)|30u)^38u)*(7u+a));}
manifest.json CHANGED
The diff for this file is too large to render. See raw diff
 
neuro_compiler/__init__.py CHANGED
@@ -1,4 +1,4 @@
1
- """Experimental neural compiler. Generated machine code may be incorrect or unsafe."""
2
- from .compiler import NeuralCompiler, CompilationResult
3
- __version__='0.2.0.dev0'
4
  __all__=['NeuralCompiler','CompilationResult']
 
1
+ """Research compiler: frozen neural frontend plus an explicitly hybrid backend."""
2
+ from .compiler import NeuralCompiler,CompilationResult
3
+ __version__='0.3.0'
4
  __all__=['NeuralCompiler','CompilationResult']
neuro_compiler/_verify_worker.py ADDED
@@ -0,0 +1,14 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Isolated entry point: imports no candidate model or Torch runtime."""
2
+ import importlib.util,json,random,sys
3
+ from pathlib import Path
4
+
5
+ def load(name,file):
6
+ spec=importlib.util.spec_from_file_location(name,Path(__file__).with_name(file));module=importlib.util.module_from_spec(spec);spec.loader.exec_module(module);return module
7
+ def main():
8
+ request=json.loads(sys.stdin.read());g=load('_reference_schema','neurocc_graph_schema.py');e=load('_bounded_emulation','emulation.py')
9
+ fixed=[(0,0,0),(1,2,3),(0xffffffff,)*3,(0x80000000,0x7fffffff,1),(0,1,0xffffffff),(0xffffffff,0,1),(0x80000000,)*3,(1,1,1)]
10
+ rng=random.Random(request['seed']);xs=fixed[:request['samples']]+[tuple(rng.getrandbits(32) for _ in range(3)) for _ in range(max(0,request['samples']-8))]
11
+ tree=g.parse(request['source']);expected=[g.evaluate(tree,args) for args in xs]
12
+ abi,semantic,error,instructions=e.emulate(bytes.fromhex(request['code_hex']),expected,xs)
13
+ print(json.dumps({'serialized':True,'abi':abi,'semantic':semantic,'error':error,'samples':len(xs),'sampled_instructions':instructions,'native_execution':False,'formal_equivalence':False}))
14
+ if __name__=='__main__':main()
neuro_compiler/backbone.py ADDED
@@ -0,0 +1,74 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Pinned frozen six-block backbone; stream an exact tensor prefix into cache."""
2
+ import hashlib,json,struct,uuid
3
+ from pathlib import Path
4
+ import torch
5
+ from torch import nn
6
+
7
+ def sha(path):
8
+ with Path(path).open('rb') as f:return hashlib.file_digest(f,'sha256').hexdigest()
9
+
10
+ def _extract(source,target,depth):
11
+ with Path(source).open('rb') as f:
12
+ size=struct.unpack('<Q',f.read(8))[0]
13
+ if not 2<=size<=16*1024*1024:raise ValueError('Invalid backbone tensor header')
14
+ header=json.loads(f.read(size));start=8+size;items=[]
15
+ for name,value in header.items():
16
+ if name=='__metadata__':continue
17
+ import re
18
+ layer=re.search(r'(?:^|\.)layers\.(\d+)\.',name)
19
+ if layer and int(layer[1])>=depth:continue
20
+ a,b=value['data_offsets']
21
+ if not 0<=a<=b<=Path(source).stat().st_size-start:raise ValueError('Invalid tensor offsets')
22
+ items.append((a,b,name,value))
23
+ items.sort();new={'__metadata__':header.get('__metadata__',{'format':'pt'})};offset=0
24
+ for a,b,name,value in items:new[name]={**value,'data_offsets':[offset,offset+b-a]};offset+=b-a
25
+ raw=json.dumps(new,separators=(',',':')).encode();raw+=b' '*((-len(raw))%8)
26
+ temp=Path(target).with_name(Path(target).name+'.'+uuid.uuid4().hex+'.tmp')
27
+ try:
28
+ with temp.open('wb') as out:
29
+ out.write(struct.pack('<Q',len(raw)));out.write(raw)
30
+ for a,b,name,value in items:
31
+ f.seek(start+a);remaining=b-a
32
+ while remaining:
33
+ data=f.read(min(1048576,remaining))
34
+ if not data:raise ValueError('Truncated backbone tensors')
35
+ out.write(data);remaining-=len(data)
36
+ temp.replace(target)
37
+ finally:temp.unlink(missing_ok=True)
38
+
39
+ def prefix_cache(spec,expected_sha,expected_config_sha):
40
+ from huggingface_hub import hf_hub_download
41
+ from huggingface_hub.constants import HF_HUB_CACHE
42
+ config_path=Path(hf_hub_download(spec['backbone'],'config.json',revision=spec['revision']))
43
+ if sha(config_path)!=expected_config_sha:raise ValueError('Pinned Qwen config hash mismatch')
44
+ config=json.loads(config_path.read_text());source=Path(hf_hub_download(spec['backbone'],'model.safetensors',revision=spec['revision']))
45
+ if sha(source)!=expected_sha:raise ValueError('Pinned Qwen weight hash mismatch')
46
+ depth=max(spec['depths']);full=config['num_hidden_layers']
47
+ if not 0<depth<=full:raise ValueError('Invalid frozen depth')
48
+ identity={'source_sha256':expected_sha,'config_sha256':sha(config_path),'revision':spec['revision'],'depth':depth,'format':1}
49
+ key=hashlib.sha256(json.dumps(identity,sort_keys=True).encode()).hexdigest();root=Path(HF_HUB_CACHE).parent/'neuro-compiler-prefix'/key;root.mkdir(parents=True,exist_ok=True)
50
+ meta=root/'provenance.json';weight=root/'model.safetensors';cp=root/'config.json'
51
+ if meta.exists():
52
+ saved=json.loads(meta.read_text())
53
+ if saved['identity']!=identity or sha(weight)!=saved['weight_sha256'] or sha(cp)!=saved['config_sha256']:raise ValueError('Frozen backbone prefix cache integrity failed')
54
+ else:
55
+ _extract(source,weight,depth);config={**config,'num_hidden_layers':depth}
56
+ if isinstance(config.get('layer_types'),list):config['layer_types']=config['layer_types'][:depth]
57
+ cp.write_text(json.dumps(config,indent=2));temp=meta.with_name(meta.name+'.'+uuid.uuid4().hex+'.tmp')
58
+ temp.write_text(json.dumps({'identity':identity,'weight_sha256':sha(weight),'config_sha256':sha(cp)},indent=2));temp.replace(meta)
59
+ return root,full
60
+
61
+ class Backbone(nn.Module):
62
+ def __init__(self,spec,dev,expected_sha,expected_config_sha):
63
+ super().__init__()
64
+ from transformers import AutoModel
65
+ root,self.full_depth=prefix_cache(spec,expected_sha,expected_config_sha);self.depths=sorted(spec['depths'])
66
+ # Same original tensor values and compute dtype; no unused block mapping.
67
+ self.net=AutoModel.from_pretrained(str(root),local_files_only=True,trust_remote_code=False,torch_dtype=torch.float16 if dev.type=='cuda' else torch.float32,low_cpu_mem_usage=True)
68
+ self.hidden=self.net.config.hidden_size
69
+ if max(self.depths)<self.full_depth:self.net.norm=nn.Identity()
70
+ self.net.requires_grad_(False);self.net.to(dev).eval()
71
+ def forward(self,ids,mask):
72
+ if len(self.depths)==1:return (self.net(input_ids=ids,attention_mask=mask,use_cache=False,return_dict=True).last_hidden_state,)
73
+ states=self.net(input_ids=ids,attention_mask=mask,use_cache=False,output_hidden_states=True,return_dict=True).hidden_states
74
+ return tuple(states[k] for k in self.depths)
neuro_compiler/backend/__init__.py ADDED
@@ -0,0 +1 @@
 
 
1
+ """Frozen hybrid allocation/lowering/encoding; no reference compiler dependency."""
neuro_compiler/backend/allocation_constants.py ADDED
@@ -0,0 +1,2 @@
 
 
 
1
+ REGS=(7,6,8,9,10,11,3,5,12,13,14,15,0,1,2)
2
+ CALLEE={3,5,12,13,14,15}
neuro_compiler/backend/allocator.py ADDED
@@ -0,0 +1,120 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import torch
2
+ from torch import nn
3
+ from .graph import OPS,GraphPreparation,SHIFT_IDS
4
+ from .policy import TensorPolicy
5
+
6
+
7
+ EVENT_OPS = ('<PAD>', 'store', 'load', 'mov', 'release', 'count', 'ret') + OPS[1:] + tuple((o + '_imm' for o in OPS[2:])) + tuple((OPS[i] + '_cl' for i in SHIFT_IDS))
8
+
9
+ EID = {o: i for i, o in enumerate(EVENT_OPS)}
10
+
11
+ LANES = 17
12
+
13
+ class TensorAllocator(nn.Module):
14
+
15
+ def __init__(self):
16
+ super().__init__()
17
+ self.policy = TensorPolicy()
18
+ self.register_buffer('regular', torch.tensor([0] + [EID[o] for o in OPS[1:]]))
19
+ self.register_buffer('immediate_ops', torch.tensor([0, 0] + [EID[o + '_imm'] for o in OPS[2:]]))
20
+ self.register_buffer('shift_ops', torch.tensor([EID[o + '_cl'] if i in SHIFT_IDS else 0 for i, o in enumerate(OPS)]))
21
+ self.eval().requires_grad_(False)
22
+
23
+ def forward(self, x):
24
+ B, V = x['op'].shape
25
+ dev = x['op'].device
26
+ last = GraphPreparation.exact(x)
27
+ now, future = GraphPreparation.reservations(x)
28
+ state = torch.full((B, 15), -1, device=dev, dtype=torch.long)
29
+ state[:, :3] = torch.arange(3, device=dev)
30
+ dirty = state >= 0
31
+ used = torch.zeros_like(dirty)
32
+ backed = torch.zeros((B, V), device=dev, dtype=torch.bool)
33
+ errors = torch.zeros(B, device=dev, dtype=torch.bool)
34
+ events = torch.zeros((B, V + 1, LANES, 3), device=dev, dtype=torch.long)
35
+ reg = self.policy.regs[None, :]
36
+ zero = torch.zeros(B, device=dev, dtype=torch.long)
37
+ minus = zero - 1
38
+ empty_mask = torch.zeros_like(dirty)
39
+
40
+ def get(a, j):
41
+ return a.gather(1, j.clamp_min(0)[:, None]).squeeze(1)
42
+
43
+ def put(a, j, value, mask):
44
+ j = j.clamp_min(0)[:, None]
45
+ old = a.gather(1, j).squeeze(1)
46
+ a.scatter_(1, j, torch.where(mask, value, old)[:, None])
47
+ for t in range(3, V + 1):
48
+ active = x['n'] > t
49
+ ending = x['n'] == t
50
+ tv = zero + t
51
+ it = min(t, V - 1)
52
+ op = x['op'][:, it]
53
+ refs = x['refs'][:, it]
54
+ imm = x['immediate'][:, it]
55
+ isimm = x['isimm'][:, it]
56
+ const = active & (op == OPS.index('const'))
57
+ arithmetic = active & ~const
58
+ varshift = arithmetic & now[:, t, 1]
59
+ hasright = arithmetic & (refs[:, 1] >= 0)
60
+ reserved = torch.cat((empty_mask[:, :12], now[:, t]), 1)
61
+ nxt = torch.cat((torch.full_like(state[:, :12], -1), future[:, t]), 1)
62
+
63
+ def emit(lane, kind, j, v, mask):
64
+ if isinstance(kind, str):
65
+ kind = zero + EID[kind]
66
+ events[:, t, lane, 0] = torch.where(mask, kind, 0)
67
+ events[:, t, lane, 1] = torch.where(mask, j, 0)
68
+ events[:, t, lane, 2] = torch.where(mask, v, 0)
69
+
70
+ def pick(mask, incoming, protect, left, phase, lane):
71
+ nonlocal errors
72
+ forbidden = reserved | protect
73
+ j, save, _, _ = self.policy(state, dirty, used, forbidden, tv, get(last, incoming), left, zero + phase, last.gather(1, state.clamp_min(0)), nxt)
74
+ errors = errors | mask & get(forbidden, j)
75
+ victim = get(state, j)
76
+ spill = mask & save & (victim >= 0)
77
+ emit(lane, 'store', j, victim, spill)
78
+ put(backed, victim, torch.ones_like(mask), spill)
79
+ put(used, j, torch.ones_like(mask), mask)
80
+ return j
81
+ for i, j0 in enumerate((12, 13, 14)):
82
+ j = zero + j0
83
+ v = get(state, j)
84
+ d = get(dirty, j)
85
+ mask = reserved[:, j0]
86
+ live = (v >= 0) & (get(last, v) >= t)
87
+ key = (v < 0).long() * 16 + live.long() * 8 + d.long() * 4
88
+ save = self.policy.base_save[j0, key]
89
+ relocate = mask & (v >= 0) & save
90
+ k = pick(relocate, v, empty_mask, minus, 0, i * 3)
91
+ emit(i * 3 + 1, 'mov', k, j, relocate)
92
+ put(state, k, v, relocate)
93
+ put(dirty, k, d, relocate)
94
+ emit(i * 3 + 2, 'release', j, zero, mask)
95
+ put(state, j, minus, mask)
96
+ put(dirty, j, torch.zeros_like(mask), mask)
97
+
98
+ def load(v, mask, protect, lane):
99
+ nonlocal errors
100
+ hits = state == v[:, None]
101
+ found = hits.any(1)
102
+ hit = hits.long().argmax(1)
103
+ missing = mask & ~found
104
+ errors = errors | missing & ~get(backed, v)
105
+ j = pick(missing, v, protect, minus, 0, lane)
106
+ emit(lane + 1, 'load', j, v, missing)
107
+ put(state, j, v, missing)
108
+ put(dirty, j, torch.zeros_like(mask), missing)
109
+ return torch.where(found, hit, j)
110
+ l = load(torch.where(ending, x['ret'], refs[:, 0]), arithmetic | ending, empty_mask, 9)
111
+ rr = load(refs[:, 1], hasright, reg == l[:, None], 11)
112
+ emit(13, 'count', rr, zero, varshift)
113
+ d = pick(active, tv.clamp_max(V - 1), (reg == rr[:, None]) & (hasright & ~varshift)[:, None], torch.where(const, minus, l), 1, 14)
114
+ emit(15, 'mov', d, l, arithmetic & (d != l))
115
+ kind = torch.where(varshift, self.shift_ops[op], torch.where(isimm[:, 1], self.immediate_ops[op], self.regular[op]))
116
+ payload = torch.where(const, imm[:, 0], torch.where(varshift, zero, torch.where(hasright, rr, torch.where(isimm[:, 1], imm[:, 1], zero))))
117
+ emit(16, torch.where(ending, zero + EID['ret'], kind), torch.where(ending, l, d), torch.where(ending, zero, payload), active | ending)
118
+ put(state, d, tv, active)
119
+ put(dirty, d, torch.ones_like(active), active)
120
+ return (events, errors)
neuro_compiler/backend/boundary.py ADDED
@@ -0,0 +1,49 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import json
2
+ from . import canonical as experiment
3
+
4
+
5
+ class CanonicalMIR:
6
+
7
+ def __init__(self, config):
8
+ self.vocab = list(config['vocab'])
9
+ self.width = int(config['operands'])
10
+ if self.vocab[:2] != ['<PAD>', '<OOV>'] or len(set(self.vocab)) != len(self.vocab):
11
+ raise ValueError('Invalid MIR vocabulary')
12
+ self.fields = [None, None] + [json.loads(v)[1] for v in self.vocab[2:]]
13
+ for k, operands in enumerate(self.fields[2:], 2):
14
+ if len(operands) > self.width or any((len(o) != 6 for o in operands)):
15
+ raise ValueError('Invalid MIR operand schema')
16
+ for field, rule in [('signature_ref_mask', lambda o: o[0] == 'vreg' and (not o[1])), ('signature_imm_mask', lambda o: o[0] == 'imm')]:
17
+ if field in config and list(config[field][k]) != [rule(o) for o in operands] + [False] * (self.width - len(operands)):
18
+ raise ValueError('MIR mask differs from vocabulary')
19
+
20
+ def decode(self, sig, refs, imm):
21
+ definitions = set()
22
+ padding = False
23
+ for i, k in enumerate(sig, 1):
24
+ if k < 0 or k >= len(self.vocab) or k == 1:
25
+ raise ValueError('OOV MIR signature')
26
+ if k == 0:
27
+ padding = True
28
+ operands = []
29
+ else:
30
+ if padding:
31
+ raise ValueError('Nontrailing MIR padding')
32
+ operands = self.fields[k]
33
+ for j in range(self.width):
34
+ ref = j < len(operands) and operands[j][0] == 'vreg' and (not operands[j][1])
35
+ immediate = j < len(operands) and operands[j][0] == 'imm'
36
+ if ref and refs[i - 1][j] not in definitions:
37
+ raise ValueError('Invalid defining reference')
38
+ if not ref and refs[i - 1][j] != 0:
39
+ raise ValueError('Unexpected reference payload')
40
+ if immediate and (not 0 <= imm[i - 1][j] < 2 ** 32):
41
+ raise ValueError('Immediate outside uint32')
42
+ if not immediate and imm[i - 1][j] != 0:
43
+ raise ValueError('Unexpected immediate payload')
44
+ count = sum((o[0] == 'vreg' and o[1] for o in operands))
45
+ if count > 1:
46
+ raise ValueError('Multiple virtual definitions')
47
+ if count:
48
+ definitions.add(i)
49
+ return experiment.decode_canonical(sig, refs, imm, self.vocab)
neuro_compiler/backend/canonical.py ADDED
@@ -0,0 +1,125 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import json,re
2
+
3
+
4
+ MASK = 4294967295
5
+
6
+ DIVOPS = {'udiv', 'urem', 'sdiv', 'srem'}
7
+
8
+ BIN = {'ADD': 'add', 'SUB': 'sub', 'XOR': 'xor', 'AND': 'and', 'OR': 'or', 'IMUL': 'mul', 'SHL': 'shl', 'SHR': 'shr', 'SAR': 'sar'}
9
+
10
+ def decode_canonical(sig, refs, imms, vocab):
11
+ """Accept NeuroCC signature IDs, one-based refs, raw immediates. Fixed ISA lowering."""
12
+ defs = {}
13
+ phys = {'edi': 0, 'esi': 1, 'edx': 2}
14
+ rows = []
15
+ ret = None
16
+
17
+ def materialize(v):
18
+ if isinstance(v, tuple) and v[0] == 'div':
19
+ _, op, a, b = v
20
+ idx = len(rows) + 3
21
+ rows.append((op, [('v', a), ('v', b)]))
22
+ return idx
23
+ if not isinstance(v, int):
24
+ raise ValueError('invalid physical state')
25
+ return v
26
+ for i, k in enumerate(sig, 1):
27
+ k = int(k)
28
+ if k == 0:
29
+ if ret is None:
30
+ raise ValueError('early padding')
31
+ continue
32
+ if k < 2 or k >= len(vocab) or ret is not None:
33
+ raise ValueError('bad signature/order')
34
+ op, operands = json.loads(vocab[k])
35
+ dest = []
36
+ args = []
37
+ preguse = []
38
+ for j, (kind, d, p, c, flags, tied) in enumerate(operands):
39
+ if kind == 'preg' and p == 'eflags':
40
+ if not d:
41
+ raise ValueError('flags use')
42
+ continue
43
+ if kind == 'vreg' and c not in ('gr32', 'gr32_nosp', ''):
44
+ raise ValueError('register class ' + c)
45
+ if d:
46
+ dest.append((kind, i if kind == 'vreg' else p))
47
+ continue
48
+ if kind == 'vreg':
49
+ args.append(('v', defs[int(refs[i - 1][j])]))
50
+ elif kind == 'preg':
51
+ args.append(('v', phys[p]))
52
+ preguse.append(p)
53
+ elif kind == 'imm':
54
+ args.append(('i', int(imms[i - 1][j]) & MASK))
55
+ else:
56
+ raise ValueError('operand kind ' + kind)
57
+ if op == 'CDQ':
58
+ if set(dest) != {('preg', 'eax'), ('preg', 'edx')} or preguse != ['eax']:
59
+ raise ValueError('CDQ shape')
60
+ phys['eax'] = materialize(args[0][1])
61
+ phys['edx'] = ('sign', phys['eax'])
62
+ continue
63
+ if op in ('DIV32r', 'IDIV32r'):
64
+ if set(dest) != {('preg', 'eax'), ('preg', 'edx')} or preguse != ['eax', 'edx'] or len(args) != 3:
65
+ raise ValueError('DIV shape')
66
+ b = materialize(args[0][1])
67
+ a = materialize(args[1][1])
68
+ high = args[2][1]
69
+ if op == 'DIV32r':
70
+ if not isinstance(high, int) or high < 3 or rows[high - 3] != ('const', [('i', 0)]):
71
+ raise ValueError('nonzero high half')
72
+ q, rem = ('udiv', 'urem')
73
+ else:
74
+ if high != ('sign', a):
75
+ raise ValueError('not sign extended')
76
+ q, rem = ('sdiv', 'srem')
77
+ phys['eax'] = ('div', q, a, b)
78
+ phys['edx'] = ('div', rem, a, b)
79
+ continue
80
+ if op == 'RET64':
81
+ if dest or len(args) != 1 or operands[-1][2] != 'eax':
82
+ raise ValueError('bad ret')
83
+ ret = materialize(args[0][1])
84
+ continue
85
+ if len(dest) != 1:
86
+ raise ValueError('bad dest ' + op)
87
+ typ, key = dest[0]
88
+ if op in ('COPY', 'KILL'):
89
+ if len(args) != 1 or args[0][0] != 'v':
90
+ raise ValueError('copy')
91
+ v = materialize(args[0][1])
92
+ if typ == 'preg' and key not in ('eax', 'edx', 'ecx', 'cl'):
93
+ raise ValueError('unsupported physical def')
94
+ else:
95
+ if typ != 'vreg':
96
+ raise ValueError('physical arithmetic')
97
+ if op == 'MOV32ri':
98
+ kind = 'const'
99
+ elif op == 'MOV32r0':
100
+ kind = 'const'
101
+ args = [('i', 0)]
102
+ elif op in ('NEG32r', 'NOT32r', 'INC32r', 'DEC32r'):
103
+ kind = op[:3].lower()
104
+ else:
105
+ m = re.fullmatch('(ADD|SUB|XOR|AND|OR|IMUL|SHL|SHR|SAR)32(rr|ri|ri8|rri|rri8|r1|rCL)', op)
106
+ if not m:
107
+ raise ValueError('unsupported opcode ' + op)
108
+ kind = BIN[m[1]]
109
+ if m[2] == 'r1':
110
+ args.append(('i', 1))
111
+ if m[2] == 'rCL' and operands[-1][2] != 'cl':
112
+ raise ValueError('missing CL constraint')
113
+ if len(args) != (1 if kind in ['const', 'neg', 'not', 'inc', 'dec'] else 2):
114
+ raise ValueError('arity ' + op)
115
+ if kind == 'const' and args[0][0] != 'i':
116
+ raise ValueError('non-immediate const')
117
+ if kind != 'const' and args[0][0] != 'v':
118
+ raise ValueError('unexpected operand')
119
+ args = [(k, materialize(v) if k == 'v' else v) for k, v in args]
120
+ v = len(rows) + 3
121
+ rows.append((kind, args))
122
+ (defs if typ == 'vreg' else phys)[key] = v
123
+ if ret is None:
124
+ raise ValueError('missing return')
125
+ return (rows, ret)
neuro_compiler/backend/encoder.py ADDED
@@ -0,0 +1,53 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import torch
2
+ from torch import nn
3
+ from torch.nn import functional as F
4
+ from .physical import OPS
5
+
6
+
7
+ INPUTS = ('signature', 'register', 'immediate', 'stack')
8
+
9
+ class Encoder(nn.Module):
10
+
11
+ def __init__(self, width=96):
12
+ super().__init__()
13
+ self.width = width
14
+ self.net = nn.Sequential(nn.Linear(len(OPS) + 34 + 2, width), nn.GELU(), nn.Linear(width, width), nn.GELU(), nn.Linear(width, 42))
15
+
16
+ def forward(self, sig, reg, imm, stack):
17
+ x = torch.cat([F.one_hot(sig, len(OPS)), F.one_hot(reg + 1, 17).flatten(-2), stack.eq(0), stack.le(127)], -1).float()
18
+ z = self.net(x)
19
+ bits, l, p, src = z.split((32, 5, 3, 2), -1)
20
+ return (bits.reshape(*sig.shape, 4, 8), l, p, src)
21
+
22
+ def decode(self, out, sig, imm, stack):
23
+ bits, l, p, src = out
24
+ w = 2 ** torch.arange(8, device=sig.device)
25
+ prefix = ((bits > 0) * w).sum(-1)
26
+ pl = l.argmax(-1)
27
+ n = torch.tensor([0, 1, 4], device=sig.device)[p.argmax(-1)]
28
+ src = src.argmax(-1)
29
+ num = torch.where(src.bool(), stack[..., 0], imm[..., 0])
30
+ pos = torch.arange(8, device=sig.device)
31
+ k = pos - pl[..., None]
32
+ body = num[..., None] >> k.clamp(0, 3) * 8 & 255
33
+ v = torch.where(pos < pl[..., None], prefix.gather(-1, pos.clamp_max(3).expand(*sig.shape, 8)), body)
34
+ lengths = (pl + n).masked_fill(sig == 0, 0)
35
+ if (sig == 1).any():
36
+ raise ValueError('OOV physical MIR')
37
+ return (v, lengths)
38
+
39
+ @torch.no_grad()
40
+ def encode(self, tensors):
41
+ x = tuple((tensors[k] for k in INPUTS))
42
+ v, l = self.decode(self(*x), x[0], x[2], x[3])
43
+ return pack(v, l)
44
+
45
+ def pack(v, l):
46
+ b, t, w = v.shape
47
+ off = l.cumsum(1) - l
48
+ pos = torch.arange(w, device=v.device)
49
+ mask = pos < l[..., None]
50
+ dst = off[..., None] + pos
51
+ buf = torch.zeros(b, t * w, dtype=torch.long, device=v.device)
52
+ buf.scatter_add_(1, dst.clamp_max(t * w - 1).flatten(1), (v * mask).flatten(1))
53
+ return (buf, l.sum(1))
neuro_compiler/backend/graph.py ADDED
@@ -0,0 +1,90 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import torch
2
+ from torch import nn
3
+
4
+
5
+ OPS = ('pad', 'const', 'add', 'sub', 'mul', 'and', 'or', 'xor', 'neg', 'not', 'inc', 'dec', 'shl', 'shr', 'sar', 'udiv', 'urem', 'sdiv', 'srem')
6
+
7
+ DIV_IDS = tuple((OPS.index(o) for o in ('udiv', 'urem', 'sdiv', 'srem')))
8
+
9
+ SHIFT_IDS = tuple((OPS.index(o) for o in ('shl', 'shr', 'sar')))
10
+
11
+ REGS = (12, 13, 14)
12
+
13
+ def pack(programs):
14
+ """CPU: rows/ret -> tensors, position t is normalized value t; 0..2 args."""
15
+ B = len(programs)
16
+ V = max((len(rows) + 3 for rows, _ in programs))
17
+ op = torch.zeros((B, V), dtype=torch.long)
18
+ refs = torch.full((B, V, 2), -1, dtype=torch.long)
19
+ imm = torch.zeros_like(refs)
20
+ isimm = torch.zeros_like(refs, dtype=torch.bool)
21
+ lengths = []
22
+ returns = []
23
+ for i, (rows, ret) in enumerate(programs):
24
+ n = len(rows) + 3
25
+ if not 0 <= ret < n:
26
+ raise ValueError('invalid return')
27
+ lengths.append(n)
28
+ returns.append(ret)
29
+ for t, (name, args) in enumerate(rows, 3):
30
+ op[i, t] = OPS.index(name)
31
+ if len(args) > 2:
32
+ raise ValueError('arity')
33
+ for j, (k, v) in enumerate(args):
34
+ if k == 'v':
35
+ if not 0 <= v < t:
36
+ raise ValueError('invalid ref')
37
+ refs[i, t, j] = v
38
+ elif k == 'i':
39
+ if not 0 <= v < 2 ** 32:
40
+ raise ValueError('uint32')
41
+ imm[i, t, j] = v
42
+ isimm[i, t, j] = True
43
+ else:
44
+ raise ValueError('operand kind')
45
+ return dict(op=op, refs=refs, immediate=imm, isimm=isimm, n=torch.tensor(lengths), ret=torch.tensor(returns))
46
+
47
+ class GraphPreparation(nn.Module):
48
+
49
+ @staticmethod
50
+ def edges(x):
51
+ B, V, K = x['refs'].shape
52
+ dev = x['refs'].device
53
+ pos = torch.arange(V, device=dev, dtype=torch.long)[None, :]
54
+ mask = (x['refs'] >= 0) & (pos[:, :, None] < x['n'][:, None, None])
55
+ dst = torch.where(mask, x['refs'], V).reshape(B, -1)
56
+ times = pos[:, :, None].expand(B, V, K).reshape(B, -1)
57
+ return (torch.cat((dst, x['ret'][:, None]), 1), torch.cat((times, x['n'][:, None]), 1))
58
+
59
+ @staticmethod
60
+ def exact(x):
61
+ B, V, _ = x['refs'].shape
62
+ dev = x['refs'].device
63
+ dst, times = GraphPreparation.edges(x)
64
+ ids = torch.arange(V, device=dev)[None, :].expand(B, -1)
65
+ base = torch.cat((ids.clamp_min(3) - 1, torch.full((B, 1), -1, device=dev, dtype=torch.long)), 1)
66
+ ends = base.scatter_reduce(1, dst, times, reduce='amax')[:, :V]
67
+ return torch.where(ids < x['n'][:, None], ends, -1)
68
+
69
+ @staticmethod
70
+ def reservations(x):
71
+ """[B,V+1,3]: current mask and strictly future reservation; -1 if none."""
72
+ op = x['op']
73
+ B, V = op.shape
74
+ dev = op.device
75
+ div = torch.zeros_like(op, dtype=torch.bool)
76
+ shift = div.clone()
77
+ for k in DIV_IDS:
78
+ div = div | (op == k)
79
+ for k in SHIFT_IDS:
80
+ shift = shift | (op == k)
81
+ shift = shift & (x['refs'][:, :, 1] >= 0)
82
+ valid = torch.arange(V, device=dev)[None, :] < x['n'][:, None]
83
+ div = div & valid
84
+ shift = shift & valid
85
+ now = torch.cat((torch.stack((div, shift, div), -1), torch.zeros((B, 1, 3), device=dev, dtype=torch.bool)), 1)
86
+ pos = torch.arange(V + 1, device=dev)[None, :, None]
87
+ sentinel = V + 1
88
+ inclusive = torch.where(now, pos, sentinel).flip(1).cummin(1).values.flip(1)
89
+ future = torch.cat((inclusive[:, 1:], torch.full((B, 1, 3), sentinel, device=dev, dtype=torch.long)), 1)
90
+ return (now, torch.where(future == sentinel, -1, future))
neuro_compiler/backend/physical.py ADDED
@@ -0,0 +1,11 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+
2
+
3
+ REGS = tuple((i for i in range(16) if i != 4))
4
+
5
+ RR = ('mov', 'add', 'sub', 'xor', 'and', 'or', 'mul')
6
+
7
+ IMM = tuple((x + '_imm' for x in RR if x != 'mov')) + ('shl_imm', 'shr_imm', 'sar_imm')
8
+
9
+ ONE = ('neg', 'not', 'inc', 'dec', 'shl_cl', 'shr_cl', 'sar_cl', 'div', 'idiv', 'push', 'pop')
10
+
11
+ OPS = ('<PAD>', '<OOV>') + RR + IMM + ONE + ('const', 'store', 'load', 'frame_sub', 'frame_add', 'cdq', 'ret')
neuro_compiler/backend/policy.py ADDED
@@ -0,0 +1,44 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import torch
2
+ from torch import nn
3
+ from . import allocation_constants as c
4
+
5
+
6
+ class TensorPolicy(nn.Module):
7
+ """Preserve CPU-generated base LUT and Python double score arithmetic.
8
+ Each row is an independent decision. All 15 candidates are parallel.
9
+ Caller supplies at least one allowed candidate per active decision.
10
+ """
11
+
12
+ def __init__(self):
13
+ super().__init__()
14
+ self.register_buffer('base_score', torch.empty(15, 32, dtype=torch.float64))
15
+ self.register_buffer('base_save', torch.empty(15, 32, dtype=torch.bool))
16
+ self.register_buffer('weights', torch.empty(9, dtype=torch.float64))
17
+ self.register_buffer('regs', torch.arange(15))
18
+ self.register_buffer('callee', torch.tensor([r in c.CALLEE for r in c.REGS]))
19
+ self.register_buffer('extended', torch.tensor([r >= 8 for r in c.REGS]))
20
+ self.eval().requires_grad_(False)
21
+
22
+ def forward(self, state, dirty, used, forbidden, t, incoming_end, left, phase, occupant_end, next_reservation):
23
+ t = t[:, None]
24
+ phase = phase[:, None]
25
+ left = left[:, None]
26
+ incoming_end = incoming_end[:, None]
27
+ empty = state < 0
28
+ live = ~empty & torch.where(phase == 0, occupant_end >= t, occupant_end > t)
29
+ reuse = self.regs == left
30
+ key = empty.long() * 16 + live.long() * 8 + dirty.long() * 4 + reuse.long() * 2 + phase
31
+ q = self.base_score[self.regs, key]
32
+ save = self.base_save[self.regs, key]
33
+ cross = (next_reservation > t) & (next_reservation <= incoming_end)
34
+ remaining = torch.where(live, (occupant_end - t).clamp(0, 32), 0).double() / 32
35
+ soon = torch.where(cross, 1.0 / (next_reservation - t).clamp_min(1).double(), 0.0)
36
+ features = (remaining, cross, self.callee & ~used, self.extended.expand_as(used), reuse, live & dirty, live, empty, soon)
37
+ adj = torch.zeros_like(q)
38
+ for i, f in enumerate(features):
39
+ adj = adj + self.weights[i] * f.double()
40
+ scores = (q + adj).masked_fill(forbidden, -torch.inf)
41
+ allowed_save = save & ~forbidden
42
+ chosen = scores.argmax(1)
43
+ spill = allowed_save.gather(1, chosen[:, None]).squeeze(1)
44
+ return (chosen, spill, scores, allowed_save)
neuro_compiler/backend/resident.py ADDED
@@ -0,0 +1,85 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import torch
2
+ from torch import nn
3
+ from .encoder import Encoder,pack as pack_bytes
4
+ from .physical import OPS
5
+ from .allocator import TensorAllocator
6
+ from .stack import TensorStackLower
7
+
8
+
9
+ class ResidentEncoder(Encoder):
10
+ """Same frozen network/byte packing; tensor error mask replaces scalar OOV check."""
11
+
12
+ def __init__(self, width=96):
13
+ super().__init__(width)
14
+ self.register_buffer('op_ids', torch.arange(len(OPS)), persistent=False)
15
+ self.register_buffer('reg_ids', torch.arange(-1, 16), persistent=False)
16
+ self.register_buffer('byte_weights', 2 ** torch.arange(8), persistent=False)
17
+ self.register_buffer('byte_pos', torch.arange(8), persistent=False)
18
+ self.register_buffer('payload_sizes', torch.tensor([0, 1, 4]), persistent=False)
19
+ self.eval().requires_grad_(False)
20
+
21
+ def forward(self, sig, reg, imm, stack):
22
+ x = torch.cat((sig[..., None] == self.op_ids, (reg[..., None] == self.reg_ids).flatten(-2), stack.eq(0), stack.le(127)), -1).float()
23
+ bits, l, p, src = self.net(x).split((32, 5, 3, 2), -1)
24
+ prefix = ((bits.reshape(*sig.shape, 4, 8) > 0) * self.byte_weights).sum(-1)
25
+ pl = l.argmax(-1)
26
+ n = self.payload_sizes[p.argmax(-1)]
27
+ num = torch.where(src.argmax(-1).bool(), stack[..., 0], imm[..., 0])
28
+ pos = self.byte_pos
29
+ k = pos - pl[..., None]
30
+ body = num[..., None] >> k.clamp(0, 3) * 8 & 255
31
+ v = torch.where(pos < pl[..., None], prefix.gather(-1, pos.clamp_max(3).expand(*sig.shape, 8)), body)
32
+ length = (pl + n).masked_fill(sig == 0, 0)
33
+ return (v, length)
34
+
35
+ def encode_resident(self, z, lengths, error, chunk=256):
36
+ if chunk < 1:
37
+ raise ValueError('positive encoder chunk required')
38
+ sig = z['signature']
39
+ B, T = sig.shape
40
+ pos = torch.arange(T, device=sig.device)[None, :]
41
+ active = pos < lengths[:, None]
42
+ reg = z['register']
43
+ imm = z['immediate']
44
+ stack = z['stack']
45
+ bad = (sig < 0) | (sig >= len(OPS)) | (sig == 1) | ((sig != 0) != active)
46
+ bad |= ((reg < -1) | (reg > 15) | (reg == 4)).any(-1)
47
+ bad |= ((imm < 0) | (imm >= 2 ** 32) | (stack < 0) | (stack >= 2 ** 31)).any(-1)
48
+ error = error | bad.any(1) | (lengths <= 0) | (lengths > T)
49
+ vs = []
50
+ ls = []
51
+ for i in range(0, T, chunk):
52
+ j = min(i + chunk, T)
53
+ good = ~error[:, None]
54
+ s = torch.where(good, sig[:, i:j], 0)
55
+ r = torch.where(good[..., None], reg[:, i:j], -1)
56
+ m = torch.where(good[..., None], imm[:, i:j], 0)
57
+ st = torch.where(good[..., None], stack[:, i:j], 0)
58
+ v, l = self(s, r, m, st)
59
+ error = error | ((s != 0) & ((l < 1) | (l > 8))).any(1)
60
+ vs.append(v)
61
+ ls.append(l)
62
+ v = torch.cat(vs, 1)
63
+ l = torch.cat(ls, 1)
64
+ l = l.masked_fill(error[:, None], 0)
65
+ buf, n = pack_bytes(v, l)
66
+ return (buf, n, error)
67
+
68
+ class TensorBackend(nn.Module):
69
+
70
+ def __init__(self, encoder_chunk=256, encoder_width=96):
71
+ super().__init__()
72
+ self.allocator = TensorAllocator()
73
+ self.lower = TensorStackLower()
74
+ self.encoder = ResidentEncoder(encoder_width)
75
+ if encoder_chunk < 1:
76
+ raise ValueError('positive encoder chunk required')
77
+ self.encoder_chunk = encoder_chunk
78
+ self.eval().requires_grad_(False)
79
+
80
+ @torch.inference_mode()
81
+ def forward(self, x, capacity=None):
82
+ events, ae = self.allocator(x)
83
+ z, lengths, routed, metrics, le = self.lower(x, events, capacity)
84
+ buf, n, error = self.encoder.encode_resident(z, lengths, ae | le, self.encoder_chunk)
85
+ return dict(code=buf, byte_length=n, error=error, physical_length=lengths, allocation_error=ae, lower_error=le, metrics=metrics)
neuro_compiler/backend/stack.py ADDED
@@ -0,0 +1,153 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import torch
2
+ from torch import nn
3
+ from .allocator import EID,EVENT_OPS,LANES
4
+ from .graph import GraphPreparation
5
+ from . import physical as p
6
+ from . import allocation_constants as d
7
+ from . import allocation_constants as e
8
+
9
+
10
+ PID = {o: i for i, o in enumerate(p.OPS)}
11
+
12
+ class TensorStackLower(nn.Module):
13
+
14
+ def __init__(self):
15
+ super().__init__()
16
+ self.register_buffer('regmap', torch.tensor(d.REGS))
17
+ self.register_buffer('callee', torch.tensor(sorted(e.CALLEE)))
18
+ self.register_buffer('ordinary', torch.tensor([PID.get(o, 0) for o in EVENT_OPS]))
19
+ self.eval().requires_grad_(False)
20
+
21
+ def stack(self, x, events):
22
+ B, V = x['op'].shape
23
+ dev = events.device
24
+ flat = events.reshape(B, -1, 3)
25
+ T = flat.shape[1]
26
+ op, r, v = flat.unbind(-1)
27
+ store = op == EID['store']
28
+ load = op == EID['load']
29
+ mem = store | load
30
+ idx = torch.arange(T, device=dev)[None, :].expand(B, -1)
31
+ t = idx // LANES
32
+ valid = (v >= 0) & (v < V)
33
+ safe = v.clamp(0, V - 1)
34
+ dest = torch.where(store & valid, safe, V)
35
+ first = torch.full((B, V + 1), T, device=dev, dtype=torch.long).scatter_reduce(1, dest, idx, reduce='amin')[:, :V]
36
+ order = first.argsort(dim=1, stable=True)
37
+ last = GraphPreparation.exact(x)
38
+ owners = torch.full((B, V), -1, device=dev, dtype=torch.long)
39
+ mapping = owners.clone()
40
+ slots = torch.zeros(B, device=dev, dtype=torch.long)
41
+ peak = slots.clone()
42
+ reuses = slots.clone()
43
+ error = (mem & ~valid).any(1)
44
+ ar = torch.arange(V, device=dev)[None, :]
45
+ for j in range(V):
46
+ val = order[:, j:j + 1]
47
+ pos = first.gather(1, val).squeeze(1)
48
+ active = pos < T
49
+ time = pos // LANES
50
+ occupied = (owners >= 0) & (last.gather(1, owners.clamp_min(0)) >= time[:, None])
51
+ free = ~occupied
52
+ k = free.long().argmax(1)
53
+ error = error | active & ~free.any(1)
54
+ old = owners.gather(1, k[:, None]).squeeze(1)
55
+ reuses += (active & (k < slots)).long()
56
+ slots = torch.maximum(slots, torch.where(active, k + 1, slots))
57
+ peak = torch.maximum(peak, torch.where(active, occupied.sum(1) + 1, peak))
58
+ owners.scatter_(1, k[:, None], torch.where(active, val[:, 0], old)[:, None])
59
+ mapping.scatter_(1, val, torch.where(active, k, -1)[:, None])
60
+ homes = mapping.gather(1, safe)
61
+ error = error | (mem & ((homes < 0) | (first.gather(1, safe) > idx) | (last.gather(1, safe) < t))).any(1)
62
+ routed = torch.stack((op, r, torch.where(mem, homes, v)), dim=-1).reshape_as(events)
63
+ return (routed, dict(slots=slots, distinct_spilled=(first < T).sum(1), reuses=reuses, peak_backed=peak, frame=(4 * slots + 15) // 16 * 16), error)
64
+
65
+ def lower(self, events, metrics, capacity):
66
+ B = events.shape[0]
67
+ dev = events.device
68
+ op, r, s = events.reshape(B, -1, 3).unbind(-1)
69
+ frame = metrics['frame']
70
+ slots = metrics['slots']
71
+ regs = self.regmap[r.clamp(0, 14)]
72
+ src = self.regmap[s.clamp(0, 14)]
73
+ active = (op != 0) & (op != EID['release'])
74
+ ret = op == EID['ret']
75
+ count = op == EID['count']
76
+ store = op == EID['store']
77
+ load = op == EID['load']
78
+ mem = store | load
79
+ div = torch.zeros_like(active)
80
+ signed = div.clone()
81
+ rem = div.clone()
82
+ for name in ('udiv', 'urem', 'sdiv', 'srem'):
83
+ m = op == EID[name]
84
+ div |= m
85
+ if name.startswith('s'):
86
+ signed |= m
87
+ if name.endswith('rem'):
88
+ rem |= m
89
+ saveable = active & ~(store | ret | count)
90
+ saved = torch.stack([((regs == k) & saveable).any(1) for k in self.callee.unbind()], 1)
91
+ nsave = saved.sum(1)
92
+ hasframe = frame > 0
93
+ prefix = nsave + hasframe.long() + 1
94
+ lengths = torch.where(active & ~ret, torch.where(div, 4, 1), 0)
95
+ offset = lengths.cumsum(1) - lengths + prefix[:, None]
96
+ body_end = prefix + lengths.sum(1)
97
+ retreg = (regs * ret).sum(1)
98
+ retmov = retreg != 0
99
+ suffix = retmov.long() + hasframe.long() + nsave + 1
100
+ total = body_end + suffix
101
+ error = (total > capacity) | (ret.sum(1) != 1) | (active & ((r < 0) | (r >= 15))).any(1) | (mem & ((s < 0) | (s >= slots[:, None]))).any(1)
102
+ buf = torch.zeros((B, capacity, 5), device=dev, dtype=torch.long)
103
+
104
+ def emit(pos, mask, kind, a=-1, b=-1, imm=0, stack=0):
105
+ pos = pos.reshape(B, -1)
106
+ mask = mask.reshape_as(pos) & (pos >= 0) & (pos < capacity)
107
+
108
+ def field(z):
109
+ if isinstance(z, int):
110
+ return torch.full_like(pos, z)
111
+ return z.reshape(B, -1).expand_as(pos)
112
+ data = torch.stack((field(kind), field(a) + 1, field(b) + 1, field(imm), field(stack)), dim=-1)
113
+ buf.scatter_add_(1, pos.clamp(0, capacity - 1)[..., None].expand(-1, -1, 5), data * mask[..., None])
114
+ rank = saved.long().cumsum(1) - 1
115
+ cr = self.callee[None, :].expand(B, -1)
116
+ emit(rank, saved, PID['push'], cr)
117
+ emit(nsave, hasframe, PID['frame_sub'], imm=frame)
118
+ emit(prefix - 1, torch.ones_like(hasframe), PID['mov'], 8, 2)
119
+ rr = torch.zeros_like(active)
120
+ im = torch.zeros_like(active)
121
+ shift = torch.zeros_like(active)
122
+ for name in p.RR:
123
+ rr |= op == EID[name]
124
+ for name in p.IMM:
125
+ m = op == EID[name]
126
+ im |= m
127
+ if name.startswith(('shl', 'shr', 'sar')):
128
+ shift |= m
129
+ const = op == EID['const']
130
+ ordinary = active & ~(ret | div | count)
131
+ k = self.ordinary[op]
132
+ error |= (ordinary & (k == 0)).any(1)
133
+ emit(offset, ordinary, k, regs, torch.where(rr, src, -1), torch.where(const | im, torch.where(shift, s & 31, s), 0), torch.where(mem, s * 4, 0))
134
+ emit(offset, count, PID['mov'], 1, regs)
135
+ emit(offset, div, PID['mov'], 0, regs)
136
+ emit(offset + 1, div, torch.where(signed, PID['cdq'], PID['xor']), torch.where(signed, -1, 2), torch.where(signed, -1, 2))
137
+ emit(offset + 2, div, torch.where(signed, PID['idiv'], PID['div']), src)
138
+ emit(offset + 3, div, PID['mov'], regs, torch.where(rem, 2, 0))
139
+ emit(body_end, retmov, PID['mov'], 0, retreg)
140
+ post = body_end + retmov.long()
141
+ emit(post, hasframe, PID['frame_add'], imm=frame)
142
+ popbase = post + hasframe.long()
143
+ emit(popbase[:, None] + nsave[:, None] - rank - 1, saved, PID['pop'], cr)
144
+ emit(total - 1, torch.ones_like(hasframe), PID['ret'])
145
+ return (dict(signature=buf[:, :, 0].contiguous(), register=(buf[:, :, 1:3] - 1).contiguous(), immediate=buf[:, :, 3:4].contiguous(), stack=buf[:, :, 4:5].contiguous()), total, error)
146
+
147
+ def forward(self, x, events, capacity=None):
148
+ capacity = capacity or 8 * x['op'].shape[1] + 32
149
+ if capacity < 1:
150
+ raise ValueError('positive physical capacity required')
151
+ routed, metrics, error = self.stack(x, events)
152
+ physical, lengths, lower_error = self.lower(routed, metrics, capacity)
153
+ return (physical, lengths, routed, metrics, error | lower_error)
neuro_compiler/cli.py CHANGED
@@ -1,20 +1,17 @@
1
- import argparse
2
- from pathlib import Path
3
- from . import NeuralCompiler
4
-
5
- def main():
6
- p=argparse.ArgumentParser(description='Experimental neural compiler; callable x86-64 SysV bytes, no native execution.')
7
- source=p.add_mutually_exclusive_group(required=True); source.add_argument('--source'); source.add_argument('--file',type=Path)
8
- p.add_argument('--model',default='chrisuser/neuro-compiler'); p.add_argument('--revision'); p.add_argument('--device',choices=['auto','cuda','cpu'],default='auto'); p.add_argument('--output',type=Path); p.add_argument('--verify',action='store_true')
9
- a=p.parse_args(); text=a.source if a.source is not None else a.file.read_text(encoding='utf8')
10
- code=NeuralCompiler.from_pretrained(a.model,device=a.device,revision=a.revision).compile(text)
11
- if a.verify:
12
- from .verification import verify
13
- import json
14
- report=verify(text,code); print(json.dumps(report))
15
- if not report['semantic']: raise SystemExit('Sampled semantics failed; output file not written')
16
- if a.output:
17
- with a.output.open('xb') as f: f.write(code)
18
- else: print(code.hex(' '))
19
-
20
- if __name__=='__main__': main()
 
1
+ import argparse,json
2
+ from pathlib import Path
3
+ from . import NeuralCompiler
4
+
5
+ def main():
6
+ p=argparse.ArgumentParser(description='Frozen hybrid compiler; raw x86-64 SysV bytes, never native execution')
7
+ group=p.add_mutually_exclusive_group(required=True);group.add_argument('--source');group.add_argument('--file',type=Path)
8
+ p.add_argument('--model',default='chrisuser/neuro-compiler');p.add_argument('--revision',default='0.3.0');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()
9
+ source=a.source if a.source is not None else a.file.read_text(encoding='utf-8');code=NeuralCompiler.from_pretrained(a.model,revision=a.revision,device=a.device).compile(source)
10
+ if a.verify:
11
+ from .verification import verify
12
+ report=verify(source,code);print(json.dumps(report))
13
+ if not report['semantic'] or not report['abi']:raise SystemExit('Sampled verification failed; no output written')
14
+ if a.output:
15
+ with a.output.open('xb') as f:f.write(code)
16
+ else:print(code.hex(' '))
17
+ if __name__=='__main__':main()
 
 
 
neuro_compiler/compiler.py CHANGED
@@ -1,110 +1,121 @@
1
- from dataclasses import dataclass
2
- from pathlib import Path
3
- import hashlib
4
- import json
5
- import re
6
- import warnings
7
- import torch
8
- from safetensors.torch import load_file
9
- from . import neurocc as nc
10
- from .neurocc_graph_live import Runtime, raw_bytes
11
- from .neurocc_graph_ast_grounded import GroundedAST
12
- from .neurocc_graph_ssa import GraphSSA
13
- from .neurocc_graph_isel import GraphISEL
14
- from .neurocc_graph_regalloc_occupancy import OccupancyAllocator
15
- from .neurocc_graph_binary import BinaryEncoder
16
-
17
- @dataclass
18
- class CompilationResult:
19
- machine_code: bytes
20
- ast: dict
21
- ssa: dict
22
- virtual_mir: dict
23
- physical_mir: dict
24
- diagnostics: dict
25
-
26
- class NeuralCompiler:
27
- @classmethod
28
- def from_pretrained(cls,model_id='chrisuser/neuro-compiler',device='auto',revision=None):
29
- root=Path(model_id)
30
- if not root.is_dir():
31
- from huggingface_hub import snapshot_download
32
- root=Path(snapshot_download(str(model_id),revision=revision,allow_patterns=['manifest.json','config.json','weights/*.safetensors']))
33
- try: manifest=json.loads((root/'manifest.json').read_text())
34
- except FileNotFoundError as e: raise FileNotFoundError(f'Missing model manifest: {root}') from e
35
- if manifest.get('architecture')=='NeuroCC V2':
36
- from .legacy import NeuralCompiler as Legacy
37
- return Legacy.from_pretrained(root,device=device)
38
- if manifest.get('architecture')!='NeuroCC graph resource streams': raise ValueError('Unsupported compiler architecture')
39
- spec=manifest['spec']
40
- if spec!=dict(backbone='Qwen/Qwen2.5-Coder-0.5B',revision='0576a1bc0ae53f21860e905e081807bd7ff4a4c7',tokens=96,depths=[6]): raise ValueError('Incompatible backbone configuration')
41
- self=cls(); self.manifest=manifest; self.root=root
42
- dev=nc.device() if device=='auto' else torch.device(device)
43
- if dev.type not in ('cuda','cpu'): raise ValueError('Only CPU and CUDA inference are supported')
44
- if dev.type=='cuda' and not torch.cuda.is_available(): raise ValueError('CUDA requested but unavailable')
45
- rt=Runtime(); rt.dev=dev; rt.spec=spec
46
- models=[]; configs=[]
47
- for name,factory,attribute in [('ast',GroundedAST,'ast'),('ssa',GraphSSA,'ssa'),('isel',GraphISEL,'isel'),('regalloc',OccupancyAllocator,'ra'),('binary',BinaryEncoder,'binary')]:
48
- entry=manifest['stages'][name]; path=root/'weights'/(name+'.safetensors')
49
- if not path.is_file(): raise FileNotFoundError(f'Missing {name} weights: {path}')
50
- with path.open('rb') as f: digest=hashlib.file_digest(f,'sha256').hexdigest()
51
- if digest!=entry['weight_sha256']: raise ValueError(f'Weight integrity check failed: {name}')
52
- cfg=entry['config']; model=factory(cfg)
53
- try: model.load_state_dict(load_file(str(path)),strict=True)
54
- except RuntimeError as e: raise ValueError(f'Incompatible {name} model configuration or weights') from e
55
- if sum(p.numel() for p in model.parameters())!=entry['parameters']: raise ValueError(f'Parameter count mismatch: {name}')
56
- setattr(rt,attribute,model.to(dev).eval().requires_grad_(False)); models.append(model); configs.append(cfg)
57
- rt.ac,rt.sc,rt.ic,rt.rc,rt.bc=configs
58
- if rt.ac['mode']!='source_indexed' or rt.rc['candidate']!='resource_streams' or rt.rc['occupancy_mode']!='occupancy' or rt.bc['mode']!='independent': raise ValueError('Incompatible stage architecture')
59
- if rt.sc['ast_checkpoint_sha256']!=manifest['stages']['ast']['original_sha256'] or rt.ic['ir_checkpoint_sha256']!=manifest['stages']['ssa']['original_sha256'] or rt.rc['isel_checkpoint_sha256']!=manifest['stages']['isel']['original_sha256']: raise ValueError('Incompatible checkpoint provenance')
60
- if rt.ic['vocab']!=rt.rc['pre_vocab'] or rt.rc['vocab']!=rt.bc['source_vocab'] or any(rt.rc[k]!=rt.bc[k] for k in ('register_vocab','immediate_vocab','stack_vocab')): raise ValueError('Incompatible vocabulary configuration')
61
- rt.tokenizer=nc.tokenizer_for(spec); rt.backbone=nc.Backbone(spec,dev).eval().requires_grad_(False)
62
- if rt.backbone.hidden!=rt.ac['hidden']: raise ValueError('Backbone hidden-width mismatch')
63
- self.runtime=rt; self.dev=dev
64
- warnings.warn('Experimental compiler: generated machine code may be incorrect or unsafe. No native execution or formal verification is performed.',UserWarning,stacklevel=2)
65
- return self
66
-
67
- @staticmethod
68
- def _inputs(sources):
69
- if isinstance(sources,str): raise TypeError('Expected a sequence of source strings')
70
- sources=list(sources)
71
- for source in sources:
72
- if not isinstance(source,str) or not source.strip() or not source.isascii() or '\x00' in source: raise ValueError('Expected nonempty ASCII source without NUL characters')
73
- # Lexical validation only; no syntax graph or compilation decisions.
74
- m=re.fullmatch(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+([abc0-9u()+*^&|\s-]+)\s*;\s*\}\s*',source)
75
- if not m: raise ValueError('Unsupported function signature or source characters; see the restricted grammar')
76
- expression=m.group(1)
77
- operations=len(re.findall(r'[+*^&|-]',expression))
78
- if not 1<=operations<=7: raise ValueError('This release supports one through seven binary operations')
79
- for literal in re.findall(r'\d+u?',expression):
80
- if not literal.endswith('u') or not 1<=int(literal[:-1])<=63: raise ValueError('Supported literals are 1u through 63u')
81
- return sources
82
-
83
- @torch.inference_mode()
84
- def predict(self,sources,details=False):
85
- sources=self._inputs(sources)
86
- if not sources: raise ValueError('Empty prediction batch')
87
- try: return self.runtime.forward_batch(sources,details=details)
88
- except RuntimeError as e:
89
- if 'Source exceeds' in str(e): raise ValueError('Source exceeds the 96-token capacity; no truncation performed') from e
90
- raise
91
-
92
- def compile_batch(self,sources,return_intermediates=False,batch_size=32):
93
- sources=self._inputs(sources)
94
- if not isinstance(batch_size,int) or batch_size<1: raise ValueError('batch_size must be a positive integer')
95
- result=[]
96
- for i in range(0,len(sources),batch_size):
97
- out=self.predict(sources[i:i+batch_size],details=return_intermediates)
98
- y,details=out if return_intermediates else (out,None)
99
- for j,row in enumerate(y):
100
- code=raw_bytes(row)
101
- if code is None: raise ValueError(f'Malformed neural output at batch index {i+j}; invalid byte/EOS/padding sequence or allocation overflow')
102
- if details is None: result.append(code)
103
- else:
104
- fields={k:{n:v[j] for n,v in details[k].items()} for k in ('ast','ssa','virtual_mir','physical_mir')}
105
- diagnostic={k:v[j] for k,v in details.items() if k not in fields}
106
- result.append(CompilationResult(code,**fields,diagnostics=diagnostic))
107
- return result
108
-
109
- def compile(self,source,return_intermediates=False):
110
- return self.compile_batch([source],return_intermediates=return_intermediates)[0]
 
 
 
 
 
 
 
 
 
 
 
 
1
+ """Portable source-to-bytes graph compiler with the frozen 15E hybrid backend."""
2
+ from dataclasses import dataclass
3
+ from pathlib import Path
4
+ import hashlib,json,re,warnings
5
+ import torch
6
+ from safetensors.torch import load_file
7
+ from . import neurocc as nc
8
+ from . import neurocc_graph_ast_grounded as ga
9
+ from . import neurocc_graph_ssa as ss
10
+ from . import neurocc_graph_isel as gi
11
+ from .backbone import Backbone
12
+ from .backend.boundary import CanonicalMIR
13
+ from .backend.graph import pack
14
+ from .backend.resident import TensorBackend
15
+
16
+ @dataclass
17
+ class CompilationResult:
18
+ machine_code: bytes | None
19
+ ast: dict | None
20
+ ssa: dict | None
21
+ virtual_mir: dict | None
22
+ physical_mir: dict | None
23
+ diagnostics: dict
24
+
25
+ def sha(path):
26
+ with Path(path).open('rb') as f:return hashlib.file_digest(f,'sha256').hexdigest()
27
+
28
+ class NeuralCompiler:
29
+ @classmethod
30
+ def from_pretrained(cls,model_id='chrisuser/neuro-compiler',device='auto',revision='0.3.0',load_backbone=True):
31
+ root=Path(model_id)
32
+ if not root.is_dir():
33
+ from huggingface_hub import snapshot_download
34
+ root=Path(snapshot_download(str(model_id),revision=revision,allow_patterns=['manifest.json','config.json','weights/*.safetensors']))
35
+ m=json.loads((root/'manifest.json').read_text())
36
+ if m.get('architecture')!='NeuroCC graph + frozen 15E hybrid' or m.get('release_version')!='0.3.0':raise ValueError('This package requires the 0.3.0 hybrid manifest; install the matching older package for older releases')
37
+ if m['spec']!=dict(backbone='Qwen/Qwen2.5-Coder-0.5B',revision='0576a1bc0ae53f21860e905e081807bd7ff4a4c7',tokens=96,depths=[6]):raise ValueError('Incompatible frozen backbone')
38
+ if m['max_operations']!=8 or m['frozen_backend']['slot_rank_weight']>=0:raise ValueError('Incompatible frozen backend configuration')
39
+ self=cls();self.root=root;self.manifest=m;self.dev=nc.device() if device=='auto' else torch.device(device)
40
+ if self.dev.type not in ('cpu','cuda') or self.dev.type=='cuda' and not torch.cuda.is_available():raise ValueError('Requested device is unavailable')
41
+ def load(entry,model):
42
+ path=root/entry['weight_file']
43
+ if not path.is_file() or sha(path)!=entry['weight_sha256']:raise ValueError('Weight integrity check failed: '+str(path.name))
44
+ model.load_state_dict(load_file(str(path)),strict=True)
45
+ if sum(p.numel() for p in model.parameters())!=entry['parameters']:raise ValueError('Parameter count mismatch')
46
+ return model.to(self.dev).eval().requires_grad_(False)
47
+ self.ac=m['stages']['ast']['config'];self.sc=m['stages']['ssa']['config'];self.ic=m['stages']['isel']['config']
48
+ if self.sc['ast_checkpoint_sha256']!=m['stages']['ast']['original_sha256'] or self.ic['ir_checkpoint_sha256']!=m['stages']['ssa']['original_sha256']:raise ValueError('Upstream checkpoint relationship mismatch')
49
+ self.ast=load(m['stages']['ast'],ga.GroundedAST(self.ac));self.ssa=load(m['stages']['ssa'],ss.GraphSSA(self.sc));self.isel=load(m['stages']['isel'],gi.GraphISEL(self.ic))
50
+ b=m['frozen_backend'];self.backend=load(b,TensorBackend(encoder_chunk=b['encoder_chunk'],encoder_width=b['encoder_width']));self.normalizer=CanonicalMIR(self.ic)
51
+ self.tokenizer=self.backbone=None
52
+ if load_backbone:
53
+ self.tokenizer=nc.tokenizer_for(m['spec']);self.backbone=Backbone(m['spec'],self.dev,m['backbone_weight_sha256'],m['backbone_config_sha256'])
54
+ if self.backbone.hidden!=self.ac['hidden']:raise ValueError('Backbone hidden-width mismatch')
55
+ return self
56
+
57
+ def _inputs(self,sources):
58
+ if isinstance(sources,str):raise TypeError('Expected a sequence of source strings')
59
+ sources=list(sources)
60
+ for source in sources:
61
+ if not isinstance(source,str) or not source.strip() or not source.isascii() or '\x00' in source:raise ValueError('Expected nonempty ASCII source without NUL')
62
+ match=re.fullmatch(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+([abc0-9u()+*^&|\s-]+)\s*;\s*\}\s*',source)
63
+ if not match:raise ValueError('Unsupported function signature or characters')
64
+ expression=match[1]
65
+ if not 1<=len(re.findall(r'[+*^&|-]',expression))<=8:raise ValueError('Supported range is one through eight binary operations')
66
+ if len(source)>self.manifest['character_capacity']:raise ValueError('Source exceeds trained raw-character capacity; no truncation')
67
+ for literal in re.findall(r'\d+u?',expression):
68
+ if not literal.endswith('u') or not 1<=int(literal[:-1])<=63:raise ValueError('Supported literals are 1u through 63u')
69
+ return sources
70
+
71
+ @torch.inference_mode()
72
+ def _frontend(self,features,mask,raw):
73
+ raw={k:v.to(self.dev) for k,v in raw.items()};mask=mask.to(self.dev)
74
+ output=self.ast(features.to(self.dev),mask,self.ac['capacity'],raw);ast=self.ast.decode(output);ast['features']=output['features'].half()
75
+ output=self.ssa({k:ast[k] for k in ss.FIELDS},self.sc['capacity']);ssa=self.ssa.decode(output);ssa['features']=output['features'].half()
76
+ sx={k:ssa[k] for k in gi.FIELDS};h=self.isel.encode(sx,self.ic['slots']).half();mir=self.isel.decode(self.isel.heads(h.float(),sx))
77
+ return ast,ssa,mir
78
+
79
+ @torch.inference_mode()
80
+ def _encode(self,mir,ast=None,ssa=None,details=False,capacity=None):
81
+ sig,refs,imm=mir;programs=[];accepted=[];out=[CompilationResult(None,None,None,None,None,{'status':'isel_rejected','error':None}) for _ in range(len(sig))]
82
+ for i,(a,b,c) in enumerate(zip(*(x.detach().cpu().tolist() for x in mir))):
83
+ try:program=self.normalizer.decode(a,b,c)
84
+ except (ValueError,KeyError,IndexError,TypeError,OverflowError) as error:out[i].diagnostics['error']=str(error)
85
+ else:programs.append(program);accepted.append(i)
86
+ if not programs:return out
87
+ x={k:v.to(self.dev) for k,v in pack(programs).items()};physical=None
88
+ if details:
89
+ events,ae=self.backend.allocator(x);physical,lengths,routed,metrics,le=self.backend.lower(x,events,capacity)
90
+ code,n,error=self.backend.encoder.encode_resident(physical,lengths,ae|le,self.backend.encoder_chunk)
91
+ result={'code':code,'byte_length':n,'error':error,'physical_length':lengths,'metrics':metrics}
92
+ else:result=self.backend(x,capacity)
93
+ flags=result['error'].cpu().tolist();n=result['byte_length'].cpu().tolist();code=result['code'].cpu();lengths=result['physical_length'].cpu().tolist();slots=result['metrics']['slots'].cpu().tolist()
94
+ for j,i in enumerate(accepted):
95
+ if flags[j]:out[i].diagnostics.update(status='backend_rejected',error='Frozen allocator/lowering/encoder rejected this row');continue
96
+ if not 0<n[j]<=code.shape[1]:raise ValueError('Malformed byte length')
97
+ value=out[i];value.machine_code=bytes(code[j,:n[j]].tolist());value.diagnostics.update(status='compiled',backend='frozen15E hybrid',physical_instructions=lengths[j],spill_slots=slots[j])
98
+ if details:
99
+ value.ast=None if ast is None else {k:v[i].detach().cpu() for k,v in ast.items()};value.ssa=None if ssa is None else {k:v[i].detach().cpu() for k,v in ssa.items()};value.virtual_mir={k:v[i].detach().cpu() for k,v in zip(('signature','refs','immediate'),mir)};value.physical_mir={k:v[j,:lengths[j]].detach().cpu() for k,v in physical.items()}
100
+ return out
101
+
102
+ @torch.inference_mode()
103
+ def predict(self,sources,details=False):
104
+ sources=self._inputs(sources)
105
+ if not sources:raise ValueError('Empty prediction batch')
106
+ if self.backbone is None:raise RuntimeError('Source inference requires load_backbone=True')
107
+ ids,mask=nc.tokenize(self.tokenizer,sources,self.manifest['spec']['tokens']);raw,check=ga.encode_sources(self.tokenizer,sources,self.manifest['spec']['tokens'],self.manifest['character_capacity'])
108
+ if not torch.equal(mask,check):raise ValueError('Tokenizer mask mismatch')
109
+ with nc.amp(self.dev):features=self.backbone(ids.to(self.dev),mask.to(self.dev))[0].half()
110
+ ast,ssa,mir=self._frontend(features,mask,raw);return self._encode(mir,ast,ssa,details)
111
+
112
+ def compile_batch(self,sources,return_intermediates=False,batch_size=16,strict=True):
113
+ sources=self._inputs(sources)
114
+ if type(batch_size) is not int or batch_size<1:raise ValueError('batch_size must be a positive integer')
115
+ results=[]
116
+ for start in range(0,len(sources),batch_size):
117
+ for j,value in enumerate(self.predict(sources[start:start+batch_size],return_intermediates)):
118
+ if strict and value.machine_code is None:raise ValueError(f'Compilation rejected row {start+j}: {value.diagnostics}')
119
+ results.append(value if return_intermediates else value.machine_code)
120
+ return results
121
+ def compile(self,source,return_intermediates=False):return self.compile_batch([source],return_intermediates)[0]
neuro_compiler/emulation.py ADDED
@@ -0,0 +1,40 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import struct
2
+
3
+ def emulate(raw,expected,xs):
4
+ import capstone
5
+ import unicorn as u
6
+ import unicorn.x86_const as x
7
+ allowed={'mov','or','sub','add','and','ret','imul','xor','shl','sal','shr','sar','neg','not','inc','dec','push','pop','div','idiv','cdq'}
8
+ if not isinstance(raw,bytes) or not 0<len(raw)<1048576:return False,False,'Invalid byte length',0
9
+ base=0x100000;ins=list(capstone.Cs(capstone.CS_ARCH_X86,capstone.CS_MODE_64).disasm(raw,base))
10
+ if not ins or sum(i.size for i in ins)!=len(raw) or any(i.mnemonic not in allowed for i in ins) or ins[-1].mnemonic!='ret' or any(i.mnemonic=='ret' for i in ins[:-1]):return False,False,'Unsupported or incomplete straight-line code',0
11
+ code_size=((len(raw)+4095)//4096)*4096;end=base+code_size
12
+ stack=0x400000;rsp=stack+0x1f000;boundaries={i.address for i in ins}
13
+ uc=u.Uc(u.UC_ARCH_X86,u.UC_MODE_64);uc.mem_map(base,code_size);uc.mem_write(base,raw);uc.mem_protect(base,code_size,u.UC_PROT_READ|u.UC_PROT_EXEC);uc.mem_map(stack,0x20000,u.UC_PROT_READ|u.UC_PROT_WRITE)
14
+ fault=[];written=set();instructions=[0]
15
+ def memory(engine,access,address,size,value,user):
16
+ if address<stack or address+size>rsp+8:fault.append('Memory outside bounded stack')
17
+ elif access==u.UC_MEM_WRITE:
18
+ if address+size>rsp:fault.append('Return-address overwrite')
19
+ else:written.update(range(address,address+size))
20
+ elif any(v not in written for v in range(address,address+size)):fault.append('Uninitialized stack read')
21
+ if fault:engine.emu_stop()
22
+ def control(engine,address,size,user):
23
+ instructions[0]+=1;sp=engine.reg_read(x.UC_X86_REG_RSP)
24
+ if address not in boundaries or not stack<=sp<=rsp:fault.append('Invalid control flow or stack pointer');engine.emu_stop()
25
+ uc.hook_add(u.UC_HOOK_MEM_READ|u.UC_HOOK_MEM_WRITE,memory);uc.hook_add(u.UC_HOOK_CODE,control)
26
+ callee=[getattr(x,'UC_X86_REG_'+n) for n in ('RBX','RBP','R12','R13','R14','R15')]
27
+ caller=[getattr(x,'UC_X86_REG_'+n) for n in ('RAX','RCX','RDX','RSI','RDI','R8','R9','R10','R11')]
28
+ correct=True
29
+ try:
30
+ for i,args in enumerate(xs):
31
+ fault.clear();written.clear();written.update(range(rsp,rsp+8));uc.mem_write(rsp,struct.pack('<Q',end));uc.reg_write(x.UC_X86_REG_RSP,rsp);uc.reg_write(x.UC_X86_REG_EFLAGS,2)
32
+ for j,reg in enumerate(callee):uc.reg_write(reg,0x1122334400000000+j)
33
+ for j,reg in enumerate(caller):uc.reg_write(reg,0x8877665500000000+j)
34
+ for reg,value in zip((x.UC_X86_REG_EDI,x.UC_X86_REG_ESI,x.UC_X86_REG_EDX),args):uc.reg_write(reg,value)
35
+ uc.emu_start(base,end,timeout=100000,count=max(4096,len(ins)*2))
36
+ if fault or uc.reg_read(x.UC_X86_REG_RIP)!=end or uc.reg_read(x.UC_X86_REG_RSP)!=rsp+8 or any(uc.reg_read(reg)!=0x1122334400000000+j for j,reg in enumerate(callee)):
37
+ return False,False,','.join(fault) or 'Return/stack/callee-save ABI failure',instructions[0]
38
+ correct &= uc.reg_read(x.UC_X86_REG_EAX)==expected[i]
39
+ except u.UcError as error:return False,False,str(error),instructions[0]
40
+ return True,bool(correct),None,instructions[0]
neuro_compiler/legacy/__init__.py DELETED
@@ -1,4 +0,0 @@
1
- """Experimental non-autoregressive neural compiler. Generated code may be unsafe."""
2
- from .compiler import NeuralCompiler, CompilationResult
3
- __version__ = '0.1.0.dev0'
4
- __all__ = ['NeuralCompiler', 'CompilationResult']
 
 
 
 
 
neuro_compiler/legacy/cli.py DELETED
@@ -1,18 +0,0 @@
1
- import argparse
2
- from pathlib import Path
3
- from . import NeuralCompiler
4
-
5
- def main():
6
- p=argparse.ArgumentParser(description='Experimental x86-64 SysV neural compiler; generated bytes may be unsafe.')
7
- g=p.add_mutually_exclusive_group(required=True); g.add_argument('--source'); g.add_argument('--file',type=Path)
8
- 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')
9
- a=p.parse_args(); source=a.source if a.source is not None else a.file.read_text(encoding='utf-8')
10
- code=NeuralCompiler.from_pretrained(a.model,device=a.device).compile(source)
11
- if a.output: a.output.write_bytes(code)
12
- else: print(code.hex(' '))
13
- if a.verify:
14
- import json
15
- from .verification import verify
16
- print(json.dumps(verify(source,code)))
17
-
18
- if __name__=='__main__': main()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
neuro_compiler/legacy/compiler.py DELETED
@@ -1,86 +0,0 @@
1
- from dataclasses import dataclass
2
- from pathlib import Path
3
- import hashlib
4
- import json
5
- import warnings
6
- import torch
7
- from safetensors.torch import load_file
8
- from . import neurocc as nc
9
- from .neurocc_live_v2 import NeuralCompiler as Pipeline, raw_bytes
10
- from .neurocc_ast import ASTStage
11
- from .neurocc_ir_unfolded import IRStage
12
- from .neurocc_isel_v2 import ISELStageV2
13
- from .neurocc_regalloc_v2 import RegisterStageV2
14
- from .neurocc_binary import BinaryStage
15
-
16
- @dataclass
17
- class CompilationResult:
18
- machine_code: bytes
19
- ast: dict
20
- ssa: tuple
21
- virtual_mir: tuple
22
- physical_mir: tuple
23
-
24
- class NeuralCompiler:
25
- """Load frozen V2 stages; compile without a parser, assembler, or native execution."""
26
- @classmethod
27
- def from_pretrained(cls, model_id='orthagonal/neuro-compiler', device='auto', revision=None):
28
- root=Path(model_id)
29
- if not root.is_dir():
30
- from huggingface_hub import snapshot_download
31
- root=Path(snapshot_download(str(model_id),revision=revision,allow_patterns=['manifest.json','config.json','weights/*.safetensors']))
32
- self=cls(); self.root=root
33
- try: self.manifest=json.loads((root/'manifest.json').read_text())
34
- except FileNotFoundError as e: raise FileNotFoundError(f'Missing release manifest in {root}') from e
35
- m=self.manifest
36
- if m['architecture']!='NeuroCC V2' or m['spec']['depths']!=[6] or m['spec']['revision']!='0576a1bc0ae53f21860e905e081807bd7ff4a4c7':
37
- raise ValueError('Incompatible compiler architecture or backbone revision')
38
- self.spec=m['spec']; self.dev=nc.device() if device=='auto' else torch.device(device)
39
- if self.dev.type not in ('cpu','cuda'): raise ValueError('Only CPU and CUDA inference are supported')
40
- if self.dev.type=='cuda' and not torch.cuda.is_available(): raise ValueError('CUDA requested but unavailable')
41
- stages=[]
42
- for name,factory,mode in zip(('ast','ssa','isel','regalloc','binary'),(ASTStage,IRStage,ISELStageV2,RegisterStageV2,BinaryStage),('deps','deps','discrete_copy','aligned_copy','copy')):
43
- entry=m['stages'][name]; path=root/'weights'/f'{name}.safetensors'
44
- if not path.is_file(): raise FileNotFoundError(f'Missing stage weights: {path}')
45
- if hashlib.sha256(path.read_bytes()).hexdigest()!=entry['sha256']: raise ValueError(f'Weight integrity check failed: {name}')
46
- if entry['config']['mode']!=mode or entry['config']['width']!=128: raise ValueError(f'Incompatible stage configuration: {name}')
47
- stage=factory(entry['config']); stage.load_state_dict(load_file(str(path)),strict=True)
48
- if sum(p.numel() for p in stage.parameters())!=entry['parameters']: raise ValueError(f'Parameter count mismatch: {name}')
49
- stages.append(stage)
50
- self.tokenizer=nc.tokenizer_for(self.spec)
51
- bb=nc.Backbone(self.spec,self.dev)
52
- self.model=Pipeline(bb,*stages,self.dev).to(self.dev).eval()
53
- warnings.warn('Experimental neural compiler: generated machine code may be incorrect or unsafe. No native execution or formal verification is performed.',UserWarning,stacklevel=2)
54
- return self
55
-
56
- @torch.inference_mode()
57
- def predict(self,sources):
58
- """Return raw byte IDs and stage tensors for reproducibility tools."""
59
- if isinstance(sources,str): raise TypeError('Expected a sequence of source strings')
60
- if not sources: raise ValueError('Empty batch')
61
- for source in sources:
62
- if not isinstance(source,str) or not source.strip(): raise ValueError('Source must be a nonempty string')
63
- if len(source.encode('utf-8'))>192: raise ValueError('Source exceeds the trained 192-byte source capacity')
64
- import re
65
- if not re.fullmatch(r'[\x20-\x7e\r\n\t]+',source) or re.search(r'[/%=<>!~?:\[\]]|\b(if|while|for|goto|switch)\b',source):
66
- raise ValueError('Unsupported source characters or control flow; see the trained grammar')
67
- try: ids,mask=nc.tokenize(self.tokenizer,sources,self.spec['tokens'])
68
- except RuntimeError as e: raise ValueError(f'Source exceeds the trained {self.spec["tokens"]}-token limit; no truncation performed') from e
69
- return self.model.stages(ids.to(self.dev),mask.to(self.dev))
70
-
71
- def compile_batch(self,sources,return_intermediates=False,batch_size=32):
72
- if isinstance(sources,str): raise TypeError('Expected a sequence of source strings')
73
- sources=list(sources)
74
- if batch_size<1: raise ValueError('batch_size must be positive')
75
- results=[]
76
- for i in range(0,len(sources),batch_size):
77
- bp,stages=self.predict(sources[i:i+batch_size]); a,h,ip,m,mp,r,rp=stages
78
- nodes=self.model.ast.node(a.float()).argmax(-1) if return_intermediates else None
79
- for j,row in enumerate(bp[-1]):
80
- code=raw_bytes(row.cpu())
81
- if code is None: raise ValueError(f'Malformed neural byte output at batch index {i+j}: invalid EOS, padding, or byte value')
82
- 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)
83
- return results
84
-
85
- def compile(self,source,return_intermediates=False):
86
- return self.compile_batch([source],return_intermediates=return_intermediates)[0]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
neuro_compiler/legacy/neurocc.py DELETED
@@ -1,48 +0,0 @@
1
- from __future__ import annotations
2
-
3
- import torch
4
-
5
- from torch import nn
6
-
7
- SRC, OUT, PAD, EOS = 192, 64, 256, 257
8
-
9
- def device(): return torch.device('cuda' if torch.cuda.is_available() else 'cpu')
10
-
11
- def amp(dev): return torch.autocast(dev.type,dtype=torch.float16,enabled=dev.type=='cuda')
12
-
13
- def tokenizer_for(spec):
14
- from transformers import AutoTokenizer
15
- tok=AutoTokenizer.from_pretrained(spec['backbone'],revision=spec['revision'],trust_remote_code=False)
16
- if tok.pad_token_id is None: tok.pad_token=tok.eos_token
17
- tok.padding_side='right'; return tok
18
-
19
- def tokenize(tok,sources,tokens):
20
- result=tok(sources,add_special_tokens=False,padding='max_length',max_length=tokens,truncation=False,return_tensors=None)
21
- # HF does not truncate; check before converting ragged lists into a tensor.
22
- if any(len(row)!=tokens for row in result['input_ids']): raise RuntimeError(f'Source exceeds --tokens {tokens}; increase limit and rebuild cache')
23
- return torch.tensor(result['input_ids'],dtype=torch.long),torch.tensor(result['attention_mask'],dtype=torch.bool)
24
-
25
- class Backbone(nn.Module):
26
- """Use AutoModel (not AutoModelForCausalLM). Depth k = output of k blocks.
27
- Intermediate features are raw block output; full depth has Qwen final norm.
28
- Truncated inference uses identical features to full-model caching.
29
- """
30
- def __init__(self,spec,dev):
31
- super().__init__()
32
- from transformers import AutoModel
33
- 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)
34
- self.depths=sorted(spec['depths']); self.full_depth=len(self.net.layers); self.hidden=self.net.config.hidden_size
35
- depth=max(self.depths)
36
- if depth>self.full_depth: raise RuntimeError(f'Model only has {self.full_depth} blocks')
37
- # Remove unused blocks physically, avoiding their computation and resident weights.
38
- self.net.layers=nn.ModuleList(list(self.net.layers)[:depth])
39
- self.net.config.num_hidden_layers=depth
40
- if depth<self.full_depth: self.net.norm=nn.Identity()
41
- self.net.requires_grad_(False); self.net.to(dev).eval()
42
- def forward(self,ids,mask):
43
- if max(self.depths)==0: return (self.net.get_input_embeddings()(ids),)
44
- # HF returns input embeddings, intermediate block outputs, and final norm output.
45
- if len(self.depths)==1:
46
- return (self.net(input_ids=ids,attention_mask=mask,use_cache=False,return_dict=True).last_hidden_state,)
47
- states=self.net(input_ids=ids,attention_mask=mask,use_cache=False,output_hidden_states=True,return_dict=True).hidden_states
48
- return tuple(states[k] for k in self.depths)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
neuro_compiler/legacy/neurocc_ast.py DELETED
@@ -1,102 +0,0 @@
1
- from __future__ import annotations
2
-
3
- import math
4
-
5
- import torch
6
-
7
- from torch import nn
8
-
9
- CLASSES = ['absent', '+', '-', '*', '^', '&', '|', 'a', 'b', 'c', *[f'{i}u' for i in range(1,64)]]
10
-
11
- SLOTS = 15
12
-
13
- def tree_depth(i): return (i+1).bit_length()-1
14
-
15
- def tree_paths():
16
- return [bin(i+1)[3:] for i in range(SLOTS)]
17
-
18
- def tree_relations():
19
- """Fixed, directed relations. No target-tree information enters attention."""
20
- paths = tree_paths(); keys = []
21
- for p in paths:
22
- for q in paths:
23
- k = 0
24
- while k < min(len(p),len(q)) and p[k] == q[k]: k += 1
25
- up, down = len(p)-k, len(q)-k
26
- # Distinguish ancestor/descendant distances and left/right branches.
27
- keys.append((up, down, p[k:k+1], q[k:k+1]))
28
- vocab = {v:i for i,v in enumerate(sorted(set(keys)))}
29
- return torch.tensor([vocab[k] for k in keys]).reshape(SLOTS,SLOTS), len(vocab)
30
-
31
- class Block(nn.Module):
32
- def __init__(self,d,heads,dropout,self_attention,tree=False):
33
- super().__init__(); self.heads=heads
34
- self.cross=nn.MultiheadAttention(d,heads,dropout=dropout,batch_first=True)
35
- self.cn=nn.LayerNorm(d); self.sn=nn.LayerNorm(d); self.fn=nn.LayerNorm(d)
36
- self.self_attn=nn.MultiheadAttention(d,heads,dropout=dropout,batch_first=True) if self_attention else None
37
- if tree:
38
- rel,n=tree_relations(); self.register_buffer('relations',rel,persistent=False)
39
- self.bias=nn.Embedding(n,heads); nn.init.zeros_(self.bias.weight)
40
- else: self.bias=None
41
- self.ff=nn.Sequential(nn.Linear(d,4*d),nn.GELU(),nn.Dropout(dropout),nn.Linear(4*d,d))
42
- self.drop=nn.Dropout(dropout)
43
- def forward(self,q,m,mask):
44
- z=self.cn(q); q=q+self.drop(self.cross(z,m,m,key_padding_mask=~mask,need_weights=False)[0])
45
- if self.self_attn is not None:
46
- z=self.sn(q); bias=None
47
- if self.bias is not None:
48
- bias=self.bias(self.relations).permute(2,0,1).unsqueeze(0).expand(len(q),-1,-1,-1).reshape(-1,SLOTS,SLOTS).to(z.dtype)
49
- q=q+self.drop(self.self_attn(z,z,z,attn_mask=bias,need_weights=False)[0])
50
- return q+self.drop(self.ff(self.fn(q)))
51
-
52
- class ASTStage(nn.Module):
53
- """encode() is the reusable continuous compiler stage, independent of all labels."""
54
- def __init__(self,cfg):
55
- super().__init__(); self.cfg=dict(cfg); d=cfg['width']; mode=cfg['mode']; heads=cfg['heads']; drop=cfg['dropout']
56
- self.project=nn.Sequential(nn.Linear(cfg['hidden'],d),nn.LayerNorm(d))
57
- self.query=nn.Parameter(torch.randn(SLOTS,d)*.02)
58
- self.tree=mode in ('tree','span','deps','recursive')
59
- if self.tree:
60
- self.depth_emb=nn.Embedding(4,d); self.path_emb=nn.Embedding(6,d)
61
- nn.init.normal_(self.depth_emb.weight,std=.02); nn.init.normal_(self.path_emb.weight,std=.02)
62
- p=torch.zeros(SLOTS,6)
63
- for i,path in enumerate(tree_paths()):
64
- for j,s in enumerate(path): p[i,2*j+int(s)]=1
65
- self.register_buffer('paths',p,persistent=False)
66
- self.register_buffer('depths',torch.tensor([tree_depth(i) for i in range(SLOTS)]),persistent=False)
67
- if mode=='recursive':
68
- self.blocks=nn.ModuleList([Block(d,heads,drop,True) for _ in range(cfg['layers'])])
69
- self.child=nn.Sequential(nn.Linear(d,d),nn.GELU(),nn.LayerNorm(d))
70
- self.side=nn.Embedding(2,d)
71
- else:
72
- self.blocks=nn.ModuleList([Block(d,heads,drop,mode!='cross',self.tree) for _ in range(1 if mode=='cross' else cfg['layers'])])
73
- self.norm=nn.LayerNorm(d); self.node=nn.Linear(d,len(CLASSES))
74
- if mode in ('span','deps'):
75
- self.span_q=nn.ModuleList([nn.Linear(d,d,bias=False) for _ in range(2)])
76
- self.span_k=nn.ModuleList([nn.Linear(d,d,bias=False) for _ in range(2)])
77
- else: self.span_q=None
78
- self.dep=nn.Linear(d,3) if mode=='deps' else None
79
- def _encode(self,features,mask):
80
- m=self.project(features.float()); mask=mask.bool(); base=self.query
81
- if self.tree: base=base+self.depth_emb(self.depths)+self.paths@self.path_emb.weight
82
- if self.cfg['mode']=='recursive':
83
- levels=[]; q=base[:1].unsqueeze(0).expand(len(m),-1,-1)
84
- for depth in range(4):
85
- if depth:
86
- n=2**depth; start=n-1
87
- 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]
88
- for block in self.blocks: q=block(q,m,mask)
89
- levels.append(q)
90
- q=torch.cat(levels,dim=1)
91
- else:
92
- q=base.unsqueeze(0).expand(len(m),-1,-1)
93
- for block in self.blocks: q=block(q,m,mask)
94
- return self.norm(q),m
95
- def encode(self,features,mask): return self._encode(features,mask)[0]
96
- def forward(self,features,mask):
97
- h,m=self._encode(features,mask); out={'nodes':self.node(h)}
98
- if self.span_q is not None:
99
- z=[(q(h)@k(m).transpose(1,2))/math.sqrt(h.shape[-1]) for q,k in zip(self.span_q,self.span_k)]
100
- out['spans']=torch.stack(z,dim=2).masked_fill(~mask.bool()[:,None,None,:],-1e4)
101
- if self.dep is not None: out['deps']=self.dep(h)
102
- return out
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
neuro_compiler/legacy/neurocc_backend_trace.py DELETED
@@ -1,38 +0,0 @@
1
- from __future__ import annotations
2
-
3
- import random
4
-
5
- import struct
6
-
7
- MASK=0xffffffff
8
-
9
- def evaluate(op,args,values,x):
10
- results=[]
11
- for i,k in enumerate(op):
12
- def get(j):
13
- a=args[i][j]
14
- return values[i][j] if a==12 else x[a-1] if 1<=a<=3 else results[a-4]
15
- a=get(0)
16
- if k==7: return a
17
- b=get(1); results.append((a+b,a-b,a*b,a^b,a&b,a|b)[k-1]&MASK)
18
- raise ValueError('no ret')
19
-
20
- def samples(n):
21
- 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)]
22
- rng=random.Random(971); return edge[:n]+[tuple(rng.getrandbits(32) for _ in range(3)) for _ in range(max(0,n-len(edge)))]
23
-
24
- def verify_binary(raw,row,xs):
25
- from unicorn import Uc, UC_ARCH_X86, UC_MODE_64, UC_PROT_READ, UC_PROT_WRITE, UC_PROT_EXEC
26
- 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
27
- base=0x100000; stack=0x200000; size=0x10000; stop=base+0x1000
28
- if len(raw)>=0x1000: raise ValueError('function exceeds emulator code page')
29
- 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)
30
- rsp=stack+size//2-8
31
- 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)
32
- for x in xs:
33
- for reg in regs: uc.reg_write(reg,0)
34
- 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)
35
- for reg,v in zip((UC_X86_REG_EDI,UC_X86_REG_ESI,UC_X86_REG_EDX),x): uc.reg_write(reg,v)
36
- uc.emu_start(base,stop,count=512)
37
- actual=uc.reg_read(UC_X86_REG_EAX); expected=evaluate(*row[1:],x)
38
- 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}')