Skip to content

Commit

Permalink
feat: Sync from aztec-packages (#6656)
Browse files Browse the repository at this point in the history
Co-authored-by: Ary Borenszweig <asterite@gmail.com>
Co-authored-by: Tom French <15848336+TomAFrench@users.noreply.github.com>
Co-authored-by: TomAFrench <tom@tomfren.ch>
  • Loading branch information
4 people authored Nov 29, 2024
1 parent c49d720 commit 594aad2
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .aztec-sync-commit
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1bfc15e08873a1f0f3743e259f418b70426b3f25
0577c1a70e9746bd06f07d2813af1be39e01ca02
3 changes: 0 additions & 3 deletions compiler/noirc_evaluator/src/ssa/ssa_gen/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -733,9 +733,6 @@ impl<'a> FunctionContext<'a> {
let element_types = Self::convert_type(element_type);
values.map_both(element_types, |value, element_type| {
let reference = value.eval_reference();
// Reference counting in brillig relies on us incrementing reference
// counts when arrays/slices are constructed or indexed.
// Thus, if we dereference an lvalue which happens to be array/slice we should increment its reference counter.
self.builder.insert_load(reference, element_type).into()
})
}
Expand Down
25 changes: 21 additions & 4 deletions tooling/profiler/src/cli/gates_flamegraph_cmd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ pub(crate) struct GatesFlamegraphCommand {
/// The output folder for the flamegraph svg files
#[clap(long, short)]
output: String,

/// The output name for the flamegraph svg files
#[clap(long, short = 'f')]
output_filename: Option<String>,
}

pub(crate) fn run(args: GatesFlamegraphCommand) -> eyre::Result<()> {
Expand All @@ -43,6 +47,7 @@ pub(crate) fn run(args: GatesFlamegraphCommand) -> eyre::Result<()> {
},
&InfernoFlamegraphGenerator { count_name: "gates".to_string() },
&PathBuf::from(args.output),
args.output_filename,
)
}

Expand All @@ -51,6 +56,7 @@ fn run_with_provider<Provider: GatesProvider, Generator: FlamegraphGenerator>(
gates_provider: &Provider,
flamegraph_generator: &Generator,
output_path: &Path,
output_filename: Option<String>,
) -> eyre::Result<()> {
let mut program =
read_program_from_file(artifact_path).context("Error reading program from file")?;
Expand Down Expand Up @@ -91,13 +97,18 @@ fn run_with_provider<Provider: GatesProvider, Generator: FlamegraphGenerator>(
})
.collect();

let output_filename = if let Some(output_filename) = &output_filename {
format!("{}::{}::gates.svg", output_filename, func_name)
} else {
format!("{}::gates.svg", func_name)
};
flamegraph_generator.generate_flamegraph(
samples,
&debug_artifact.debug_symbols[func_idx],
&debug_artifact,
artifact_path.to_str().unwrap(),
&func_name,
&Path::new(&output_path).join(Path::new(&format!("{}_gates.svg", &func_name))),
&Path::new(&output_path).join(Path::new(&output_filename)),
)?;
}

Expand Down Expand Up @@ -189,11 +200,17 @@ mod tests {
};
let flamegraph_generator = TestFlamegraphGenerator::default();

super::run_with_provider(&artifact_path, &provider, &flamegraph_generator, temp_dir.path())
.expect("should run without errors");
super::run_with_provider(
&artifact_path,
&provider,
&flamegraph_generator,
temp_dir.path(),
Some(String::from("test_filename")),
)
.expect("should run without errors");

// Check that the output file was written to
let output_file = temp_dir.path().join("main_gates.svg");
let output_file = temp_dir.path().join("test_filename::main::gates.svg");
assert!(output_file.exists());
}
}

0 comments on commit 594aad2

Please sign in to comment.