Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions crates/stark-backend/src/prover/metrics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ pub struct TraceMetrics {
#[derive(Clone, Debug, Serialize, Deserialize)]
pub struct SingleTraceMetrics {
pub air_name: String,
pub air_id: usize,
pub height: usize,
/// The after challenge width is adjusted to be in terms of **base field** elements.
pub width: TraceWidth,
Expand Down Expand Up @@ -93,8 +94,8 @@ pub fn trace_metrics<PB: ProverBackend>(
(weighted_sum, trace_height_constraint.threshold as usize)
})
.collect::<Vec<_>>();
let per_air: Vec<_> = zip_eq(&mpk.per_air, heights)
.map(|(pk, height)| {
let per_air: Vec<_> = zip_eq(mpk.air_ids.iter().copied(), zip_eq(&mpk.per_air, heights))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just use izip! since we don't really need to check equal lengths

.map(|(air_id, (pk, height))| {
let air_name = &pk.air_name;
let mut width = pk.vk.params.width.clone();
let ext_degree = PB::CHALLENGE_EXT_DEGREE as usize;
Expand All @@ -115,6 +116,7 @@ pub fn trace_metrics<PB: ProverBackend>(
.sum::<usize>();
SingleTraceMetrics {
air_name: air_name.to_string(),
air_id,
height,
width,
cells,
Expand Down Expand Up @@ -216,7 +218,10 @@ mod emit {

impl SingleTraceMetrics {
pub fn emit(&self) {
let labels = [("air_name", self.air_name.clone())];
let labels = [
("air_name", self.air_name.clone()),
("air_id", self.air_id.to_string()),
];
counter!("rows", &labels).absolute(self.height as u64);
counter!("cells", &labels).absolute(self.total_cells as u64);
counter!("prep_cols", &labels).absolute(self.width.preprocessed.unwrap_or(0) as u64);
Expand Down