From 9e5208d5dbd4583d014c68f8c783e656ade4b2f6 Mon Sep 17 00:00:00 2001 From: Tom French <15848336+TomAFrench@users.noreply.github.com> Date: Mon, 2 Sep 2024 16:41:13 +0100 Subject: [PATCH] chore: add a span to track timing of brillig gen (#5835) # Description ## Problem\* Resolves ## Summary\* Small change which adds tracking for how long brillig gen takes to the debug logs. ## Additional Context ## Documentation\* Check one: - [x] No documentation needed. - [ ] Documentation included in this PR. - [ ] **[For Experimental Features]** Documentation to be submitted in a separate PR. # PR Checklist\* - [x] I have tested the changes locally. - [x] I have formatted the changes with [Prettier](https://prettier.io/) and/or `cargo fmt` on default settings. --- compiler/noirc_evaluator/src/brillig/mod.rs | 1 + compiler/noirc_evaluator/src/ssa.rs | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/compiler/noirc_evaluator/src/brillig/mod.rs b/compiler/noirc_evaluator/src/brillig/mod.rs index 9a628d601df..45b84f5311e 100644 --- a/compiler/noirc_evaluator/src/brillig/mod.rs +++ b/compiler/noirc_evaluator/src/brillig/mod.rs @@ -58,6 +58,7 @@ impl std::ops::Index for Brillig { impl Ssa { /// Compile to brillig brillig functions and ACIR functions reachable from them + #[tracing::instrument(level = "trace", skip_all)] pub(crate) fn to_brillig(&self, enable_debug_trace: bool) -> Brillig { // Collect all the function ids that are reachable from brillig // That means all the functions marked as brillig and ACIR functions called by them diff --git a/compiler/noirc_evaluator/src/ssa.rs b/compiler/noirc_evaluator/src/ssa.rs index 2d138c13f7f..57bd76d4f78 100644 --- a/compiler/noirc_evaluator/src/ssa.rs +++ b/compiler/noirc_evaluator/src/ssa.rs @@ -127,12 +127,13 @@ pub(crate) fn optimize_into_acir( ssa.check_for_underconstrained_values() }) }; + + drop(ssa_gen_span_guard); + let brillig = time("SSA to Brillig", options.print_codegen_timings, || { ssa.to_brillig(options.enable_brillig_logging) }); - drop(ssa_gen_span_guard); - let artifacts = time("SSA to ACIR", options.print_codegen_timings, || { ssa.into_acir(&brillig, options.expression_width) })?;