Skip to content

Commit

Permalink
rename n calls to n rows
Browse files Browse the repository at this point in the history
  • Loading branch information
ohad-starkware committed Jan 9, 2025
1 parent cdd7329 commit 5f7a660
Show file tree
Hide file tree
Showing 52 changed files with 481 additions and 481 deletions.
50 changes: 25 additions & 25 deletions stwo_cairo_prover/crates/prover/src/cairo_air/debug_tools.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ where
opcodes_lookup_elements: relations::Opcodes::dummy(),
verify_instruction_lookup_elements: relations::VerifyInstruction::dummy(),
},
claim.n_calls,
claim.n_rows,
)
.entries(trace),
);
Expand All @@ -82,7 +82,7 @@ where
opcodes_lookup_elements: relations::Opcodes::dummy(),
verify_instruction_lookup_elements: relations::VerifyInstruction::dummy(),
},
claim.n_calls,
claim.n_rows,
)
.entries(trace),
);
Expand All @@ -98,7 +98,7 @@ where
opcodes_lookup_elements: relations::Opcodes::dummy(),
verify_instruction_lookup_elements: relations::VerifyInstruction::dummy(),
},
claim.n_calls,
claim.n_rows,
)
.entries(trace),
);
Expand All @@ -114,7 +114,7 @@ where
opcodes_lookup_elements: relations::Opcodes::dummy(),
verify_instruction_lookup_elements: relations::VerifyInstruction::dummy(),
},
claim.n_calls,
claim.n_rows,
)
.entries(trace),
);
Expand All @@ -130,7 +130,7 @@ where
opcodes_lookup_elements: relations::Opcodes::dummy(),
verify_instruction_lookup_elements: relations::VerifyInstruction::dummy(),
},
claim.n_calls,
claim.n_rows,
)
.entries(trace),
);
Expand All @@ -146,7 +146,7 @@ where
opcodes_lookup_elements: relations::Opcodes::dummy(),
verify_instruction_lookup_elements: relations::VerifyInstruction::dummy(),
},
claim.n_calls,
claim.n_rows,
)
.entries(trace),
);
Expand All @@ -162,7 +162,7 @@ where
opcodes_lookup_elements: relations::Opcodes::dummy(),
verify_instruction_lookup_elements: relations::VerifyInstruction::dummy(),
},
claim.n_calls,
claim.n_rows,
)
.entries(trace),
);
Expand All @@ -178,7 +178,7 @@ where
opcodes_lookup_elements: relations::Opcodes::dummy(),
verify_instruction_lookup_elements: relations::VerifyInstruction::dummy(),
},
claim.n_calls,
claim.n_rows,
)
.entries(trace),
);
Expand All @@ -193,7 +193,7 @@ where
opcodes_lookup_elements: relations::Opcodes::dummy(),
verify_instruction_lookup_elements: relations::VerifyInstruction::dummy(),
},
claim.n_calls,
claim.n_rows,
)
.entries(trace),
);
Expand All @@ -209,7 +209,7 @@ where
opcodes_lookup_elements: relations::Opcodes::dummy(),
verify_instruction_lookup_elements: relations::VerifyInstruction::dummy(),
},
claim.n_calls,
claim.n_rows,
)
.entries(trace),
)
Expand All @@ -225,7 +225,7 @@ where
opcodes_lookup_elements: relations::Opcodes::dummy(),
verify_instruction_lookup_elements: relations::VerifyInstruction::dummy(),
},
claim.n_calls,
claim.n_rows,
)
.entries(trace),
);
Expand All @@ -241,7 +241,7 @@ where
opcodes_lookup_elements: relations::Opcodes::dummy(),
verify_instruction_lookup_elements: relations::VerifyInstruction::dummy(),
},
claim.n_calls,
claim.n_rows,
)
.entries(trace),
);
Expand All @@ -257,7 +257,7 @@ where
opcodes_lookup_elements: relations::Opcodes::dummy(),
verify_instruction_lookup_elements: relations::VerifyInstruction::dummy(),
},
claim.n_calls,
claim.n_rows,
)
.entries(trace),
);
Expand All @@ -275,7 +275,7 @@ where
range_check_19_lookup_elements: relations::RangeCheck_19::dummy(),
range_check_9_9_lookup_elements: relations::RangeCheck_9_9::dummy(),
},
claim.n_calls,
claim.n_rows,
)
.entries(trace),
);
Expand All @@ -291,7 +291,7 @@ where
opcodes_lookup_elements: relations::Opcodes::dummy(),
verify_instruction_lookup_elements: relations::VerifyInstruction::dummy(),
},
claim.n_calls,
claim.n_rows,
)
.entries(trace),
);
Expand All @@ -307,7 +307,7 @@ where
opcodes_lookup_elements: relations::Opcodes::dummy(),
verify_instruction_lookup_elements: relations::VerifyInstruction::dummy(),
},
claim.n_calls,
claim.n_rows,
)
.entries(trace),
);
Expand All @@ -323,7 +323,7 @@ where
opcodes_lookup_elements: relations::Opcodes::dummy(),
verify_instruction_lookup_elements: relations::VerifyInstruction::dummy(),
},
claim.n_calls,
claim.n_rows,
)
.entries(trace),
);
Expand All @@ -339,7 +339,7 @@ where
opcodes_lookup_elements: relations::Opcodes::dummy(),
verify_instruction_lookup_elements: relations::VerifyInstruction::dummy(),
},
claim.n_calls,
claim.n_rows,
)
.entries(trace),
);
Expand All @@ -355,7 +355,7 @@ where
opcodes_lookup_elements: relations::Opcodes::dummy(),
verify_instruction_lookup_elements: relations::VerifyInstruction::dummy(),
},
claim.n_calls,
claim.n_rows,
)
.entries(trace),
);
Expand All @@ -371,7 +371,7 @@ where
opcodes_lookup_elements: relations::Opcodes::dummy(),
verify_instruction_lookup_elements: relations::VerifyInstruction::dummy(),
},
claim.n_calls,
claim.n_rows,
)
.entries(trace),
);
Expand All @@ -387,7 +387,7 @@ where
opcodes_lookup_elements: relations::Opcodes::dummy(),
verify_instruction_lookup_elements: relations::VerifyInstruction::dummy(),
},
claim.n_calls,
claim.n_rows,
)
.entries(trace),
);
Expand All @@ -403,7 +403,7 @@ where
opcodes_lookup_elements: relations::Opcodes::dummy(),
verify_instruction_lookup_elements: relations::VerifyInstruction::dummy(),
},
claim.n_calls,
claim.n_rows,
)
.entries(trace),
);
Expand All @@ -420,7 +420,7 @@ where
verify_instruction_lookup_elements: relations::VerifyInstruction::dummy(),
range_check_19_lookup_elements: relations::RangeCheck_19::dummy(),
},
claim.n_calls,
claim.n_rows,
)
.entries(trace),
);
Expand All @@ -437,7 +437,7 @@ where
verify_instruction_lookup_elements: relations::VerifyInstruction::dummy(),
range_check_19_lookup_elements: relations::RangeCheck_19::dummy(),
},
claim.n_calls,
claim.n_rows,
)
.entries(trace),
);
Expand All @@ -453,7 +453,7 @@ where
opcodes_lookup_elements: relations::Opcodes::dummy(),
verify_instruction_lookup_elements: relations::VerifyInstruction::dummy(),
},
claim.n_calls,
claim.n_rows,
)
.entries(trace),
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@ pub struct Eval {

#[derive(Copy, Clone, Serialize, Deserialize, CairoSerialize)]
pub struct Claim {
pub n_calls: usize,
pub n_rows: usize,
}
impl Claim {
pub fn log_sizes(&self) -> TreeVec<Vec<u32>> {
let log_size = std::cmp::max(self.n_calls.next_power_of_two().ilog2(), LOG_N_LANES);
let log_size = std::cmp::max(self.n_rows.next_power_of_two().ilog2(), LOG_N_LANES);
let trace_log_sizes = vec![log_size; 10];
let interaction_log_sizes = vec![log_size; SECURE_EXTENSION_DEGREE * 3];
let preprocessed_log_sizes = vec![log_size];
Expand All @@ -42,7 +42,7 @@ impl Claim {
}

pub fn mix_into(&self, channel: &mut impl Channel) {
channel.mix_u64(self.n_calls as u64);
channel.mix_u64(self.n_rows as u64);
}
}

Expand All @@ -65,7 +65,7 @@ pub type Component = FrameworkComponent<Eval>;

impl FrameworkEval for Eval {
fn log_size(&self) -> u32 {
std::cmp::max(self.claim.n_calls.next_power_of_two().ilog2(), LOG_N_LANES)
std::cmp::max(self.claim.n_rows.next_power_of_two().ilog2(), LOG_N_LANES)
}

fn max_constraint_log_degree_bound(&self) -> u32 {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,10 +53,10 @@ impl ClaimGenerator {
where
SimdBackend: BackendForChannel<MC>,
{
let n_calls = self.inputs.len();
assert_ne!(n_calls, 0);
let size = std::cmp::max(n_calls.next_power_of_two(), N_LANES);
let need_padding = n_calls != size;
let n_rows = self.inputs.len();
assert_ne!(n_rows, 0);
let size = std::cmp::max(n_rows.next_power_of_two(), N_LANES);
let need_padding = n_rows != size;

if need_padding {
self.inputs.resize(size, *self.inputs.first().unwrap());
Expand All @@ -77,27 +77,27 @@ impl ClaimGenerator {
.memory_address_to_id_inputs
.iter()
.for_each(|inputs| {
memory_address_to_id_state.add_inputs(&inputs[..n_calls]);
memory_address_to_id_state.add_inputs(&inputs[..n_rows]);
});
sub_components_inputs
.memory_id_to_big_inputs
.iter()
.for_each(|inputs| {
memory_id_to_big_state.add_inputs(&inputs[..n_calls]);
memory_id_to_big_state.add_inputs(&inputs[..n_rows]);
});
sub_components_inputs
.verify_instruction_inputs
.iter()
.for_each(|inputs| {
verify_instruction_state.add_inputs(&inputs[..n_calls]);
verify_instruction_state.add_inputs(&inputs[..n_rows]);
});

tree_builder.extend_evals(trace.to_evals());

(
Claim { n_calls },
Claim { n_rows },
InteractionClaimGenerator {
n_calls,
n_rows,
lookup_data,
},
)
Expand Down Expand Up @@ -323,7 +323,7 @@ struct LookupData {
}

pub struct InteractionClaimGenerator {
n_calls: usize,
n_rows: usize,
lookup_data: LookupData,
}
impl InteractionClaimGenerator {
Expand All @@ -338,7 +338,7 @@ impl InteractionClaimGenerator {
where
SimdBackend: BackendForChannel<MC>,
{
let log_size = std::cmp::max(self.n_calls.next_power_of_two().ilog2(), LOG_N_LANES);
let log_size = std::cmp::max(self.n_rows.next_power_of_two().ilog2(), LOG_N_LANES);
let mut logup_gen = LogupTraceGenerator::new(log_size);

// Sum logup terms in pairs.
Expand Down Expand Up @@ -376,13 +376,13 @@ impl InteractionClaimGenerator {
}
col_gen.finalize_col();

let (trace, total_sum, claimed_sum) = if self.n_calls == 1 << log_size {
let (trace, total_sum, claimed_sum) = if self.n_rows == 1 << log_size {
let (trace, claimed_sum) = logup_gen.finalize_last();
(trace, claimed_sum, None)
} else {
let (trace, [total_sum, claimed_sum]) =
logup_gen.finalize_at([(1 << log_size) - 1, self.n_calls - 1]);
(trace, total_sum, Some((claimed_sum, self.n_calls - 1)))
logup_gen.finalize_at([(1 << log_size) - 1, self.n_rows - 1]);
(trace, total_sum, Some((claimed_sum, self.n_rows - 1)))
};
tree_builder.extend_evals(trace);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@ pub struct Eval {

#[derive(Copy, Clone, Serialize, Deserialize, CairoSerialize)]
pub struct Claim {
pub n_calls: usize,
pub n_rows: usize,
}
impl Claim {
pub fn log_sizes(&self) -> TreeVec<Vec<u32>> {
let log_size = std::cmp::max(self.n_calls.next_power_of_two().ilog2(), LOG_N_LANES);
let log_size = std::cmp::max(self.n_rows.next_power_of_two().ilog2(), LOG_N_LANES);
let trace_log_sizes = vec![log_size; 10];
let interaction_log_sizes = vec![log_size; SECURE_EXTENSION_DEGREE * 3];
let preprocessed_log_sizes = vec![log_size];
Expand All @@ -42,7 +42,7 @@ impl Claim {
}

pub fn mix_into(&self, channel: &mut impl Channel) {
channel.mix_u64(self.n_calls as u64);
channel.mix_u64(self.n_rows as u64);
}
}

Expand All @@ -65,7 +65,7 @@ pub type Component = FrameworkComponent<Eval>;

impl FrameworkEval for Eval {
fn log_size(&self) -> u32 {
std::cmp::max(self.claim.n_calls.next_power_of_two().ilog2(), LOG_N_LANES)
std::cmp::max(self.claim.n_rows.next_power_of_two().ilog2(), LOG_N_LANES)
}

fn max_constraint_log_degree_bound(&self) -> u32 {
Expand Down
Loading

0 comments on commit 5f7a660

Please sign in to comment.