acvm

Module compiler

Source
Expand description

The compiler module contains several pass to transform an ACIR program. Roughly, the passes are spearated into the optimizers which try to reduce the number of opcodes and the transformers which adapt the opcodes to the proving backend.

§Optimizers

  • GeneralOptimizer: simple pass which simplify AssertZero opcodes when possible (e.g remove terms with null coeficient)
  • UnusedMemoryOptimizer: simple pass which removes MemoryInit opcodes when they are not used (e.g no corresponding MemoryOp opcode)
  • RangeOptimizer: forward pass to collect range check information, and backward pass to remove the ones that are redundant.

§Transformers

  • CSAT: create intermediate variables so that AssertZero opcodes have the correct Circuit’s ExpressionWidth.

ACIR generation is performed by calling the Ssa::into_acir method, providing any necessary brillig bytecode. The compiled program will be returned as an Artifacts type.

Modules§

Structs§

  • This module can move and decompose acir opcodes into multiple opcodes. The transformation map allows consumers of this module to map metadata they had about the opcodes to the new opcode structure generated after the transformation. ACIR opcodes are stored inside a vector of opcodes. A transformation pass will generate a new vector of opcodes, but each opcode is the result of the transformation of an opcode in the original vector. So we simply keep track of the relation: index of the original opcode -> index of the new opcode in the new vector However we need a vector of new indexes for the map values in the case the old opcode is decomposed into multiple opcodes.
  • Simulate a symbolic solve for a circuit Instead of evaluating witness values from the inputs, like the PWG module is doing, this pass simply mark the witness that can be evaluated, from the known inputs, and incrementally from the previously marked witnesses. This avoid any computation on a big field which makes the process efficient. When all the witness of an opcode are marked as solvable, it means that the opcode is solvable.

Constants§

Functions§