Skip to content

Commit

Permalink
Allow 3 full transform passes
Browse files Browse the repository at this point in the history
  • Loading branch information
aakoshh committed Dec 4, 2024
1 parent 7c72b29 commit 4a06523
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions acvm-repo/acvm/src/compiler/transformers/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ fn _transform<F: AcirField>(
///
/// Accepts an injected `acir_opcode_positions` to allow transformations to be applied directly after optimizations.
///
/// Does multiple passes until the output stabilises.
/// Does multiple passes until the output stabilizes.
#[tracing::instrument(level = "trace", name = "transform_acir", skip(acir, acir_opcode_positions))]
pub(super) fn transform_internal<F: AcirField>(
mut acir: Circuit<F>,
Expand All @@ -64,6 +64,13 @@ pub(super) fn transform_internal<F: AcirField>(

acir = new_acir;
acir_opcode_positions = new_acir_opcode_positions;

let new_opcodes_hash = fxhash::hash64(&acir.opcodes);

if new_opcodes_hash == prev_opcodes_hash {
break;
}
prev_opcodes_hash = new_opcodes_hash;
}
// After the elimination of intermediate variables the `current_witness_index` is potentially higher than it needs to be,
// which would cause gaps if we ran the optimization a second time, making it look like new variables were added.
Expand All @@ -76,7 +83,7 @@ pub(super) fn transform_internal<F: AcirField>(
///
/// Accepts an injected `acir_opcode_positions` to allow transformations to be applied directly after optimizations.
///
/// Does a single optimisation pass.
/// Does a single optimization pass.
#[tracing::instrument(
level = "trace",
name = "transform_acir_once",
Expand Down

0 comments on commit 4a06523

Please sign in to comment.