Commit 20b7637
feat(ppvm-vihaco): add the composite machine and VM (#174)
## Merge order
Part of the #168 split. This PR targets **#173**
(`david/42.2-circuit-component`) and sits at the top of the vihaco line:
1. RotXY / R gate (#170) → `main` ✅ merged
2. tableau expectation/reset (#172) → `main` ✅ merged
3. vihaco-circuit-isa (#169) → `main` (open; carries #170 + #172 via a
`main` merge)
4. native `.pyi` stubs (#171) → `main` (open; independent)
5. circuit component (#173) → #169
6. **composite machine + VM (this PR)** → #173
7. CLI + TUI (#166) → this PR
## Summary
Completes the `ppvm-vihaco` crate on top of the circuit component (#173)
— the composite machine that drives it plus the surrounding VM.
| File | What |
|------|------|
| `composite.rs` | the `PPVM` composite: vihaco machine (CPU + program
loader) driving the circuit component, measurement/trace observers,
backend selection from the device header, reset, single-instruction
stepping |
| `syntax.rs` | `.sst` header parse / lower (`PPVMHeader`,
`PPVMResolver`) |
| `bytecode.rs` | `.ssb` bytecode emit / load (magic-tagged) |
| `observable.rs` | observable-header parsing for the PauliSum backends
|
| `shots.rs` | multi-shot execution (serial + optional `rayon`) |
| `lib.rs` | full module wiring + `load`/`run`/`dump`/`compile`/`parse`
helpers + `PPVMModule` |
| `Cargo.toml` | adds `vihaco-cpu`, `log`, optional `rayon` feature |
| `tests/*.sst` + `sst_fixtures.rs` | 28 integration fixtures |
## `device_info` relocation resolves here
`composite.rs` no longer defines `PPVM_MAGIC` / `BackendKind` /
`PPVMDeviceInfo` — it imports them from `device_info` (introduced in
#173) and `pub use`-re-exports them, so the existing
`crate::composite::{…}` paths in `lib.rs` / `bytecode.rs` / `syntax.rs`
keep resolving with no other edits.
The machete-ignore added in #173 is dropped here — the full crate uses
`chumsky` / `vihaco-parser-core` directly.
## Testing
`cargo test -p ppvm-vihaco` — **111 unit + 28 integration** tests, green
with and without `--features rayon`. Full workspace builds; clippy +
machete clean.
---------
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>1 parent 8d50344 commit 20b7637
27 files changed
Lines changed: 4267 additions & 14 deletions
File tree
- crates/ppvm-vihaco
- src
- tests
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
6 | 12 | | |
7 | 13 | | |
8 | 14 | | |
9 | 15 | | |
10 | 16 | | |
| 17 | + | |
11 | 18 | | |
12 | | - | |
13 | | - | |
| 19 | + | |
14 | 20 | | |
| 21 | + | |
15 | 22 | | |
| 23 | + | |
16 | 24 | | |
17 | 25 | | |
18 | 26 | | |
19 | | - | |
20 | | - | |
21 | | - | |
22 | | - | |
23 | | - | |
| 27 | + | |
0 commit comments