Context
NASA Trick simulation framework can snapshot and restore full simulation state at any point. Rapier Physics guarantees deterministic, bit-identical state serialization. Both use this for debugging, regression testing, and incremental computation.
Problem
When a compilation issue occurs in Synth, debugging requires re-running the full pipeline. There's no way to inspect IR state between passes, compare IR across compiler versions, or skip unchanged passes during incremental recompilation.
Proposal
Add serializable IR checkpoints between compilation phases:
- Serialize IR state after each major phase (parse → IR → optimize → select → encode)
- Deterministic serialization — bit-identical output for identical input (avoid HashMap iteration order, etc.)
- Use cases:
- Debugging: Dump IR before/after a suspicious pass
- Regression testing: Diff serialized IR between compiler versions
- Bisection: Binary search for which pass introduced a problem
- Incremental recompilation: Skip passes whose inputs haven't changed
- Snapshot-diff verification: Prove pre/post snapshots are equivalent via Z3 (complementing Rocq proofs)
Implementation
- Derive
serde::Serialize/Deserialize on IR types
- Add
--checkpoint-dir <path> CLI flag to synth-cli
- Add
--resume-from <phase> flag to skip completed phases
- Determinism: use
BTreeMap instead of HashMap in IR, or sort before serialization
Priority
Medium-High — enables incremental compilation and snapshot-diff verification.
Context
NASA Trick simulation framework can snapshot and restore full simulation state at any point. Rapier Physics guarantees deterministic, bit-identical state serialization. Both use this for debugging, regression testing, and incremental computation.
Problem
When a compilation issue occurs in Synth, debugging requires re-running the full pipeline. There's no way to inspect IR state between passes, compare IR across compiler versions, or skip unchanged passes during incremental recompilation.
Proposal
Add serializable IR checkpoints between compilation phases:
Implementation
serde::Serialize/Deserializeon IR types--checkpoint-dir <path>CLI flag to synth-cli--resume-from <phase>flag to skip completed phasesBTreeMapinstead ofHashMapin IR, or sort before serializationPriority
Medium-High — enables incremental compilation and snapshot-diff verification.