TL;DR
EquivFusion is an end-to-end formal verification tool that bridges the gap between high-level software algorithms (like PyTorch or C++) and low-level hardware implementations (like Verilog or gate-level netlists). By leveraging the Multi-Level Intermediate Representation (MLIR) framework, it unifies these drastically different design layers into a single pipeline, enabling automated equivalence checking early in the hardware design cycle.
What Problem Does This Paper Address?
Modern hardware design is incredibly fragmented. An engineer might start by prototyping a deep learning accelerator in PyTorch, write a behavioral reference model in C++, generate Register-Transfer Level (RTL) code using a hardware construction language like Chisel, and finally synthesize it down to a gate-level netlist.
Ensuring that the final hardware netlist actually does the exact same thing as the original PyTorch model is a massive headache. Existing equivalence checking tools are siloed—they might check C-to-RTL or RTL-to-netlist, but they cannot span the entire spectrum from machine learning frameworks to gates. As a result, engineers often rely on slow, manual, and error-prone simulation testbenches that can easily miss subtle arithmetic bugs.
Methods
EquivFusion solves this by using MLIR and CIRCT (Circuit IR Compilers and Tools) as a unified verification backbone. Instead of building ad-hoc translators for every pair of languages, EquivFusion compiles all inputs into a common intermediate representation (IR).
The pipeline consists of three main phases:
- Unified Multi-Modal Frontend: High-level algorithmic descriptions (PyTorch via
torch-mlir, C/C++ viaPolygeist) are lowered into the MLIR Affine dialect. Hardware descriptions (Chisel, Verilog) are parsed into CIRCT core dialects. For sequential hardware, EquivFusion applies sequential unrolling to create a combinational view over a finite number of clock cycles. - Miter Construction Middle-End: The tool automatically matches the input/output ports of the specification and the implementation. It then constructs a "miter circuit"—a verification model that feeds identical inputs to both designs and uses XOR gates or word-level assertions to check if their outputs ever diverge.
- Multi-Engine Backend: The miter circuit is exported into standard formal verification formats (SMT-LIB, BTOR2, or AIGER) and handed off to off-the-shelf solvers like Z3, Bitwuzla, or Kissat.
Datasets
Because this is a formal verification tool rather than a machine learning model, the authors do not use traditional datasets. Instead, they evaluate EquivFusion using custom, datapath-intensive hardware design benchmarks:
- C++ vs. Chisel Sorting: Comparing a sequential Bubble Sort algorithm (C++) against a parallel Bitonic Sort hardware implementation (Chisel).
- PyTorch vs. Gate-Level Netlist Dot Product: Comparing a high-level
torch.dotoperation against a synthesized, flattened gate-level netlist. - Dot64: A 64-element dot product benchmark comparing C++ to Chisel to evaluate scalability and bug-catching behavior.
Key Insights and Ideas
- Verification-Oriented Lowering: Unlike standard compiler pipelines that optimize aggressively and throw away high-level semantic information (like arrays and loops), EquivFusion's pipeline preserves these structures where beneficial. This prevents the "semantic loss" that makes formal reasoning difficult.
- Decoupling Frontends from Backends: By using MLIR as a universal bridge, adding support for a new language (e.g., a new ML framework) or a new formal solver only requires writing a single translator to or from the intermediate representation, rather than reinventing the whole tool.
- Catching Cross-Layer Semantic Bugs: The tool proves that formal verification can catch extremely subtle bugs—such as how a hardware description handles sign-extension during intermediate math operations—that are notoriously difficult to find via standard simulation.
Key Results
The authors demonstrated EquivFusion's capabilities across two primary experiments:
- Algorithm-to-RTL Equivalence: The tool successfully proved that a parallel Bitonic Sorter in Chisel was functionally identical to a sequential Bubble Sort in C++ (returning an
UNSATresult, meaning no bugs were found). When a sorting order bug was intentionally injected, the backend solver correctly returnedSATand provided a counterexample. - Algorithm-to-Netlist Precision Mismatch: In the PyTorch vs. Netlist dot product case study, an 8-bit configuration was proven equivalent. However, when scaled to a 32-bit configuration, EquivFusion flagged a mismatch (
SAT). It successfully pinpointed a subtle bug: the Verilog implementation was sign-extending intermediate values during calculation, causing a semantic divergence from the PyTorch specification. - Performance: Verification times ranged from fractions of a second for smaller miter constructions to roughly 45–55 seconds for full solver execution on the sorting benchmarks.
Limitations and Future Work
Currently, EquivFusion is limited to integer arithmetic and fixed-width bit-vectors; it does not yet natively support floating-point operations. Control flow is also restricted to statically resolvable conditionals and static loops with compile-time bounds.
To address these limitations, the authors propose several future directions:
- Intelligent Solver Orchestration: Using Machine Learning (like Graph Neural Networks) to analyze the circuit structure and automatically select the fastest solver (e.g., routing boolean logic to Kissat and word-level arithmetic to Bitwuzla).
- Floating-Point Emulation: Integrating software emulation libraries (like SoftFloat) to lower floating-point operations into bit-precise integer logic for formal reasoning.
- User-Guided Verification: Allowing engineers to inject hand-written assumptions and lemmas to help the solver navigate highly complex, unrolled loops or heavily optimized pipelines.
Summary updated