From fdc8ca24861aac1e37ecd22dd1ce4a56ae59e739 Mon Sep 17 00:00:00 2001 From: Maxim Vezenov Date: Fri, 13 Dec 2024 21:16:14 +0000 Subject: [PATCH 1/6] do not print entire functions when runninga debug trace --- .../src/ssa/checks/check_for_underconstrained_values.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/compiler/noirc_evaluator/src/ssa/checks/check_for_underconstrained_values.rs b/compiler/noirc_evaluator/src/ssa/checks/check_for_underconstrained_values.rs index 40c9dc03ec..5deaa23cef 100644 --- a/compiler/noirc_evaluator/src/ssa/checks/check_for_underconstrained_values.rs +++ b/compiler/noirc_evaluator/src/ssa/checks/check_for_underconstrained_values.rs @@ -108,7 +108,7 @@ struct DependencyContext { } /// Structure keeping track of value ids descending from Brillig calls' -/// arguments and results, also storing information on results +/// arguments and results, also storing information osn results /// already properly constrained #[derive(Clone, Debug)] struct BrilligTaintedIds { @@ -229,7 +229,7 @@ impl DependencyContext { function: &Function, all_functions: &BTreeMap, ) { - trace!("processing instructions of block {} of function {}", block, function); + trace!("processing instructions of block {} of function {}", block, function.id()); for instruction in function.dfg[block].instructions() { let mut arguments = Vec::new(); @@ -321,7 +321,7 @@ impl DependencyContext { // Record arguments/results for each Brillig call for the check trace!( "Brillig function {} called at {}", - all_functions[&callee], + callee, instruction ); self.tainted.insert( From c1869bc76bfd09acdad79704cb097b371fddad4d Mon Sep 17 00:00:00 2001 From: Maxim Vezenov Date: Fri, 13 Dec 2024 16:20:59 -0500 Subject: [PATCH 2/6] Update compiler/noirc_evaluator/src/ssa/checks/check_for_underconstrained_values.rs --- .../src/ssa/checks/check_for_underconstrained_values.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/compiler/noirc_evaluator/src/ssa/checks/check_for_underconstrained_values.rs b/compiler/noirc_evaluator/src/ssa/checks/check_for_underconstrained_values.rs index 5deaa23cef..3106da250a 100644 --- a/compiler/noirc_evaluator/src/ssa/checks/check_for_underconstrained_values.rs +++ b/compiler/noirc_evaluator/src/ssa/checks/check_for_underconstrained_values.rs @@ -108,7 +108,7 @@ struct DependencyContext { } /// Structure keeping track of value ids descending from Brillig calls' -/// arguments and results, also storing information osn results +/// arguments and results, also storing information on results /// already properly constrained #[derive(Clone, Debug)] struct BrilligTaintedIds { From 572f72e69b921b5464754b75ac37661563730cc4 Mon Sep 17 00:00:00 2001 From: Maxim Vezenov Date: Fri, 13 Dec 2024 21:27:08 +0000 Subject: [PATCH 3/6] switch tainted Brillig to number of tainted calls --- .../src/ssa/checks/check_for_underconstrained_values.rs | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/compiler/noirc_evaluator/src/ssa/checks/check_for_underconstrained_values.rs b/compiler/noirc_evaluator/src/ssa/checks/check_for_underconstrained_values.rs index 5deaa23cef..f06a75d7df 100644 --- a/compiler/noirc_evaluator/src/ssa/checks/check_for_underconstrained_values.rs +++ b/compiler/noirc_evaluator/src/ssa/checks/check_for_underconstrained_values.rs @@ -319,11 +319,7 @@ impl DependencyContext { Value::Function(callee) => match all_functions[&callee].runtime() { RuntimeType::Brillig(_) => { // Record arguments/results for each Brillig call for the check - trace!( - "Brillig function {} called at {}", - callee, - instruction - ); + trace!("Brillig function {} called at {}", callee, instruction); self.tainted.insert( *instruction, BrilligTaintedIds::new(&arguments, &results), @@ -376,7 +372,7 @@ impl DependencyContext { } } - trace!("resulting Brillig involved values: {:?}", self.tainted); + trace!("Number tainted Brillig calls: {}", self.tainted.len()); } /// Every Brillig call not properly constrained should remain in the tainted set From 577483c964f1624bc3b884c426eea00a6569a3bc Mon Sep 17 00:00:00 2001 From: Maxim Vezenov Date: Fri, 13 Dec 2024 21:35:57 +0000 Subject: [PATCH 4/6] delete another common trace --- .../src/ssa/checks/check_for_underconstrained_values.rs | 3 --- 1 file changed, 3 deletions(-) diff --git a/compiler/noirc_evaluator/src/ssa/checks/check_for_underconstrained_values.rs b/compiler/noirc_evaluator/src/ssa/checks/check_for_underconstrained_values.rs index ee5927a900..8b7eb10430 100644 --- a/compiler/noirc_evaluator/src/ssa/checks/check_for_underconstrained_values.rs +++ b/compiler/noirc_evaluator/src/ssa/checks/check_for_underconstrained_values.rs @@ -319,7 +319,6 @@ impl DependencyContext { Value::Function(callee) => match all_functions[&callee].runtime() { RuntimeType::Brillig(_) => { // Record arguments/results for each Brillig call for the check - trace!("Brillig function {} called at {}", callee, instruction); self.tainted.insert( *instruction, BrilligTaintedIds::new(&arguments, &results), @@ -403,8 +402,6 @@ impl DependencyContext { /// Check if any of the recorded Brillig calls have been properly constrained /// by given values after recording partial constraints, if so stop tracking them fn clear_constrained(&mut self, constrained_values: &[ValueId], function: &Function) { - trace!("attempting to clear Brillig calls constrained by values: {:?}", constrained_values); - // Remove numeric constants let constrained_values = constrained_values.iter().filter(|v| function.dfg.get_numeric_constant(**v).is_none()); From 2ccdb17b3cbdd1d8a8a5f9f786dbff6b0b86eca2 Mon Sep 17 00:00:00 2001 From: Maxim Vezenov Date: Fri, 13 Dec 2024 21:56:54 +0000 Subject: [PATCH 5/6] switch to num warnings not printing them all --- acvm-repo/acvm/src/compiler/optimizers/mod.rs | 2 +- .../src/ssa/checks/check_for_underconstrained_values.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/acvm-repo/acvm/src/compiler/optimizers/mod.rs b/acvm-repo/acvm/src/compiler/optimizers/mod.rs index 1b743227ac..3531825c70 100644 --- a/acvm-repo/acvm/src/compiler/optimizers/mod.rs +++ b/acvm-repo/acvm/src/compiler/optimizers/mod.rs @@ -37,7 +37,7 @@ pub fn optimize(acir: Circuit) -> (Circuit, AcirTransformati /// Applies [`ProofSystemCompiler`][crate::ProofSystemCompiler] independent optimizations to a [`Circuit`]. /// /// Accepts an injected `acir_opcode_positions` to allow optimizations to be applied in a loop. -#[tracing::instrument(level = "trace", name = "optimize_acir" skip(acir))] +#[tracing::instrument(level = "trace", name = "optimize_acir" skip(acir, acir_opcode_positions))] pub(super) fn optimize_internal( acir: Circuit, acir_opcode_positions: Vec, diff --git a/compiler/noirc_evaluator/src/ssa/checks/check_for_underconstrained_values.rs b/compiler/noirc_evaluator/src/ssa/checks/check_for_underconstrained_values.rs index 8b7eb10430..6c408be17c 100644 --- a/compiler/noirc_evaluator/src/ssa/checks/check_for_underconstrained_values.rs +++ b/compiler/noirc_evaluator/src/ssa/checks/check_for_underconstrained_values.rs @@ -387,7 +387,7 @@ impl DependencyContext { }) .collect(); - trace!("making following reports for function {}: {:?}", function.name(), warnings); + trace!("making {} under constrained reports for function {}", warnings.len(), function.name()); warnings } From 286b9420e5765b2c6558f3b77c2ffd31f747ad6b Mon Sep 17 00:00:00 2001 From: Maxim Vezenov Date: Fri, 13 Dec 2024 21:57:58 +0000 Subject: [PATCH 6/6] fmt --- .../src/ssa/checks/check_for_underconstrained_values.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/compiler/noirc_evaluator/src/ssa/checks/check_for_underconstrained_values.rs b/compiler/noirc_evaluator/src/ssa/checks/check_for_underconstrained_values.rs index 6c408be17c..f092f63cd0 100644 --- a/compiler/noirc_evaluator/src/ssa/checks/check_for_underconstrained_values.rs +++ b/compiler/noirc_evaluator/src/ssa/checks/check_for_underconstrained_values.rs @@ -387,7 +387,11 @@ impl DependencyContext { }) .collect(); - trace!("making {} under constrained reports for function {}", warnings.len(), function.name()); + trace!( + "making {} under constrained reports for function {}", + warnings.len(), + function.name() + ); warnings }