Skip to content

Commit

Permalink
Improve the error on benchmarking on low optimizer modes
Browse files Browse the repository at this point in the history
  • Loading branch information
hedgar2017 committed Apr 17, 2024
1 parent 6839147 commit bf943e3
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion compiler_tester/src/compiler_tester/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ fn main_inner(arguments: Arguments) -> anyhow::Result<()> {
);

if let Some(path) = arguments.benchmark {
let benchmark = summary.benchmark();
let benchmark = summary.benchmark()?;
benchmark.write_to_file(path)?;
}

Expand Down
9 changes: 5 additions & 4 deletions compiler_tester/src/summary/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ impl Summary {
///
/// Returns the benchmark structure.
///
pub fn benchmark(&self) -> benchmark_analyzer::Benchmark {
pub fn benchmark(&self) -> anyhow::Result<benchmark_analyzer::Benchmark> {
let mut benchmark = benchmark_analyzer::Benchmark::default();
benchmark.groups.insert(
format!(
Expand Down Expand Up @@ -132,16 +132,17 @@ impl Summary {
.insert(key.clone(), benchmark_element.clone());
}

let group_key = format!("{} {}", benchmark_analyzer::BENCHMARK_ALL_GROUP_NAME, mode);
benchmark
.groups
.get_mut(
format!("{} {}", benchmark_analyzer::BENCHMARK_ALL_GROUP_NAME, mode).as_str(),
group_key.as_str(),
)
.expect("Always exists")
.ok_or_else(|| anyhow::anyhow!("Group `{group_key}` not found. Only M3 and Mz groups are allowed in benchmarking"))?
.elements
.insert(key, benchmark_element);
}
benchmark
Ok(benchmark)
}

///
Expand Down

0 comments on commit bf943e3

Please sign in to comment.