Expand description
Graph-IR generation backend for the chip_traits traits.
Halo2IRBuilder implements the same chip traits as
Halo2Backend but records a dataflow graph
of Halo2GraphNodes instead of assigning halo2 cells. Each node writes a
statically-sized slice of the advice + range tapes; executing them in tape
order reproduces the halo2 backend’s stream byte-for-byte.
To keep replay stateless (parallel-safe), the builder mirrors chip bookkeeping exactly:
max_bitstracking + explicitHalo2Opcode::BBReducenodes for pre-op reduces; atomic ops (div, extmul/div) re-derive interleaved reduce decisions from operand bit bounds at replay.- Constant caching (
zero_cell+ BabyBear const cache) matchesContext::load_zero/BabyBearChip::const_cache. Atomic ops expose internally-loaded constants (BBDiv→ONE,ExtMul→W,ExtDiv→ONE/ZERO/W) as extra outputs; whether each materializes is decided at build time and recorded inNodeMeta::constant_skip_inds. - Transcript sponge/buffer state mirrors
TranscriptChip.
Fixed-column QuantumCell::Constants (select branches, IP coefficients,
Const witness values) are GraphCell::Const operands, not nodes.
Non-arithmetic opcodes cover the rest of the populate pipeline:
LoadWitness, InnerProduct, DecomposeBn254ToBabyBear, RangeDiv.
Structs§
- Halo2
Graph Node - Halo2IR
Builder - Backend that records the circuit-population trace as a graph IR.
- Node
Meta - Per-node replay metadata deduced at build time; together with operand values it is everything an executor needs to replay a node in isolation (no runtime cache), enabling parallel replay.
Enums§
- Graph
Cell - IR operand/result: a node-produced value or a fixed-column constant.
- Halo2
Opcode - IR opcodes. Each op writes a statically-known slice of the advice + range tapes when executed.
Type Aliases§
- NodeId
- Unique id of an IR node; also its index in
Halo2IRBuilder::nodes.