Commit cc55f45
authored
rust phir classical interp (#284)
* Add Rust PhirClassicalInterpreter as drop-in replacement for Python version
* Add FFCall bridge, Angle64 name resolver, typed results, cvar_export support
* Fix signed integer binary string formatting to match Python behavior
* Fix multi-assign eval order, optional size, multi-qubit arg format, signed binary strings
* Add unsigned size masking and optional size inference from data type
* Add cinterp='rust' option to HybridEngine, fix dtype name mapping
* Add passthrough iterator for inner interpreter, cache Python class lookups
* Add run_phir_sim for full-Rust execution path (3.6x speedup), auto-detect in HybridEngine
* Remove Result cop requirement, fix bit string widths, filter internal vars from results
* Add WASM and depolarizing noise support to run_phir_sim full Rust path
* Fix cross-engine test to compare values not Data types
* Support Rust and Python noise models in run_phir_sim via build_noise_model
* Add ArgItem::UInteger for u64 max values, fix unsigned ResultValue
* Replace TypedValue storage with BitUInt-based BitValue in Environment
Uses BitUInt from pecos-core for proper arbitrary-width integer storage.
Values are automatically masked to declared bit width. Signed values
interpreted via two's complement on read. Removes manual mask_to_size
workaround.
* Fix BitValue sign interpretation to use type width, disable auto fast path
* Make Rust classical interpreter the default for HybridEngine
* Add pickle support for multiprocessing compatibility
* Add foreign_obj getter for protocol parity
* Fix signed type storage to use type width (matching Python), improve fuzz to 970/971
* Fix expression evaluation to constrain results to operand type width
* Untrack known-issues docs
* Track suspected Python PhirClassicalInterpreter bugs found during Rust reimplementation
* Remove stale Rust known-issues gitignore entry (issues resolved)
* Refine Python suspected bugs: remove fixed/non-bugs, add confidence levels
* Note relationship between suspected Python bugs and PECOS#213
* Fix PECOS dtype overflow (related to #213): truncate instead of reject out-of-range values
* Mark Python dtype overflow bugs as fixed in suspected bugs doc
* Fix ScalarI64 arithmetic overflow panic: use wrapping_add/sub/mul
* Add Rust/Python parity test suite with fuzz testing (60 tests)
* Fix u64 dtype constructor to accept negative values (wrap to unsigned)
* Refactor ExpressionEvaluator to use BitUInt at 64-bit evaluation width
All expression evaluation now happens at MIN_EVAL_WIDTH (64 bits),
matching the hardware model where everything is i64 under the hood.
Variables wider than 64 bits will naturally evaluate at their width.
Removes constrain_to_width hack. Fixes comparison between Boolean
and integer types.
* Use BitUInt arithmetic directly in expression evaluator for arbitrary-width support
* Store all types at type width, mask to size on assignment; fix Qubits zero-width panic
* Fix Python eval_expr to evaluate at Python int width, mask all types to size on assignment
* Add gitignore entry for unstaged QASM-to-PHIR test plan
* Add QASM-to-PHIR-JSON converter, validation tests, and classical edge case tests
* Default to Python classical interpreter, remove disabled full-Rust path
* Fix signed arithmetic, remove dead code, tighten tests
* Guard against negative shift amounts, add i64::MIN / -1 regression test
* Remove TypedValue, qasm-to-phir-test-plan.md, and gitignore entry1 parent 65d0c7e commit cc55f45
30 files changed
Lines changed: 5763 additions & 1238 deletions
File tree
- crates
- pecos-phir-json/src
- v0_1
- pecos-qasm
- src
- tests/fixtures/qasm_validation
- design
- python
- pecos-rslib/src
- quantum-pecos
- src/pecos
- classical_interpreters
- engines
- tests/pecos/unit
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
604 | 604 | | |
605 | 605 | | |
606 | 606 | | |
607 | | - | |
| 607 | + | |
| 608 | + | |
608 | 609 | | |
609 | 610 | | |
610 | | - | |
611 | | - | |
| 611 | + | |
| 612 | + | |
| 613 | + | |
| 614 | + | |
| 615 | + | |
| 616 | + | |
| 617 | + | |
| 618 | + | |
| 619 | + | |
| 620 | + | |
| 621 | + | |
| 622 | + | |
| 623 | + | |
612 | 624 | | |
613 | | - | |
614 | | - | |
| 625 | + | |
| 626 | + | |
615 | 627 | | |
616 | 628 | | |
617 | 629 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
| 2 | + | |
2 | 3 | | |
3 | 4 | | |
| 5 | + | |
4 | 6 | | |
5 | 7 | | |
6 | 8 | | |
| |||
48 | 50 | | |
49 | 51 | | |
50 | 52 | | |
51 | | - | |
52 | | - | |
53 | | - | |
54 | | - | |
55 | | - | |
56 | | - | |
57 | | - | |
58 | | - | |
59 | | - | |
60 | | - | |
61 | | - | |
62 | | - | |
63 | | - | |
64 | | - | |
65 | | - | |
66 | | - | |
67 | 53 | | |
68 | 54 | | |
69 | 55 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| 10 | + | |
10 | 11 | | |
11 | 12 | | |
12 | 13 | | |
| |||
20 | 21 | | |
21 | 22 | | |
22 | 23 | | |
23 | | - | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
24 | 27 | | |
25 | 28 | | |
26 | 29 | | |
| |||
78 | 81 | | |
79 | 82 | | |
80 | 83 | | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
81 | 89 | | |
82 | 90 | | |
83 | 91 | | |
| |||
103 | 111 | | |
104 | 112 | | |
105 | 113 | | |
106 | | - | |
| 114 | + | |
107 | 115 | | |
| 116 | + | |
| 117 | + | |
108 | 118 | | |
109 | 119 | | |
110 | 120 | | |
| |||
124 | 134 | | |
125 | 135 | | |
126 | 136 | | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
127 | 151 | | |
128 | 152 | | |
129 | 153 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
144 | 144 | | |
145 | 145 | | |
146 | 146 | | |
147 | | - | |
148 | | - | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
149 | 153 | | |
150 | 154 | | |
151 | 155 | | |
| |||
219 | 223 | | |
220 | 224 | | |
221 | 225 | | |
| 226 | + | |
| 227 | + | |
| 228 | + | |
222 | 229 | | |
223 | 230 | | |
224 | 231 | | |
| |||
831 | 838 | | |
832 | 839 | | |
833 | 840 | | |
834 | | - | |
| 841 | + | |
835 | 842 | | |
836 | 843 | | |
837 | 844 | | |
| |||
0 commit comments