diff --git a/stwo_cairo_prover/crates/prover/src/cairo_air/debug_tools.rs b/stwo_cairo_prover/crates/prover/src/cairo_air/debug_tools.rs index 9a46f24f..a599b5a9 100644 --- a/stwo_cairo_prover/crates/prover/src/cairo_air/debug_tools.rs +++ b/stwo_cairo_prover/crates/prover/src/cairo_air/debug_tools.rs @@ -15,14 +15,13 @@ use stwo_prover::core::poly::circle::CanonicCoset; use super::air::CairoClaim; use crate::components::{ - add_ap_opcode, add_ap_opcode_imm, add_ap_opcode_op_1_base_fp, add_opcode_is_small_f_is_imm_f, - add_opcode_is_small_f_is_imm_t, add_opcode_is_small_t_is_imm_f, add_opcode_is_small_t_is_imm_t, - assert_eq_opcode_is_double_deref_f_is_imm_f, assert_eq_opcode_is_double_deref_f_is_imm_t, - assert_eq_opcode_is_double_deref_t_is_imm_f, call_opcode_is_rel_f_op_1_base_fp_f, - call_opcode_is_rel_f_op_1_base_fp_t, call_opcode_is_rel_t_op_1_base_fp_f, generic_opcode, - jnz_opcode_is_taken_f_dst_base_fp_f, jnz_opcode_is_taken_f_dst_base_fp_t, - jnz_opcode_is_taken_t_dst_base_fp_f, jnz_opcode_is_taken_t_dst_base_fp_t, - jump_opcode_is_rel_f_is_imm_f_is_double_deref_f, + add_ap_opcode, add_ap_opcode_imm, add_ap_opcode_op_1_base_fp, add_opcode, add_opcode_imm, + add_opcode_small, add_opcode_small_imm, assert_eq_opcode_is_double_deref_f_is_imm_f, + assert_eq_opcode_is_double_deref_f_is_imm_t, assert_eq_opcode_is_double_deref_t_is_imm_f, + call_opcode_is_rel_f_op_1_base_fp_f, call_opcode_is_rel_f_op_1_base_fp_t, + call_opcode_is_rel_t_op_1_base_fp_f, generic_opcode, jnz_opcode_is_taken_f_dst_base_fp_f, + jnz_opcode_is_taken_f_dst_base_fp_t, jnz_opcode_is_taken_t_dst_base_fp_f, + jnz_opcode_is_taken_t_dst_base_fp_t, jump_opcode_is_rel_f_is_imm_f_is_double_deref_f, jump_opcode_is_rel_f_is_imm_f_is_double_deref_t, jump_opcode_is_rel_t_is_imm_f_is_double_deref_f, jump_opcode_is_rel_t_is_imm_t_is_double_deref_f, memory_address_to_id, memory_id_to_big, @@ -54,11 +53,11 @@ where let mut entries = vec![]; // TODO(Ohad): reduce boilerplate. - for claim in claim.opcodes.add_f_f.clone() { + for claim in claim.opcodes.add.clone() { entries.extend( RelationTrackerComponent::new( tree_span_provider, - add_opcode_is_small_f_is_imm_f::Eval { + add_opcode::Eval { claim, memory_address_to_id_lookup_elements: relations::MemoryAddressToId::dummy(), memory_id_to_big_lookup_elements: relations::MemoryIdToBig::dummy(), @@ -70,11 +69,11 @@ where .entries(trace), ); } - for claim in claim.opcodes.add_f_t.clone() { + for claim in claim.opcodes.add_imm.clone() { entries.extend( RelationTrackerComponent::new( tree_span_provider, - add_opcode_is_small_f_is_imm_t::Eval { + add_opcode_imm::Eval { claim, memory_address_to_id_lookup_elements: relations::MemoryAddressToId::dummy(), memory_id_to_big_lookup_elements: relations::MemoryIdToBig::dummy(), @@ -86,11 +85,11 @@ where .entries(trace), ); } - for claim in claim.opcodes.add_t_f.clone() { + for claim in claim.opcodes.add_small.clone() { entries.extend( RelationTrackerComponent::new( tree_span_provider, - add_opcode_is_small_t_is_imm_f::Eval { + add_opcode_small::Eval { claim, memory_address_to_id_lookup_elements: relations::MemoryAddressToId::dummy(), memory_id_to_big_lookup_elements: relations::MemoryIdToBig::dummy(), @@ -102,11 +101,11 @@ where .entries(trace), ); } - for claim in claim.opcodes.add_t_t.clone() { + for claim in claim.opcodes.add_small_imm.clone() { entries.extend( RelationTrackerComponent::new( tree_span_provider, - add_opcode_is_small_t_is_imm_t::Eval { + add_opcode_small_imm::Eval { claim, memory_address_to_id_lookup_elements: relations::MemoryAddressToId::dummy(), memory_id_to_big_lookup_elements: relations::MemoryIdToBig::dummy(), diff --git a/stwo_cairo_prover/crates/prover/src/cairo_air/opcodes_air.rs b/stwo_cairo_prover/crates/prover/src/cairo_air/opcodes_air.rs index 61757d44..cb681e26 100644 --- a/stwo_cairo_prover/crates/prover/src/cairo_air/opcodes_air.rs +++ b/stwo_cairo_prover/crates/prover/src/cairo_air/opcodes_air.rs @@ -13,14 +13,13 @@ use stwo_prover::core::pcs::{TreeBuilder, TreeVec}; use super::air::CairoInteractionElements; use super::debug_tools::display_components; use crate::components::{ - add_ap_opcode, add_ap_opcode_imm, add_ap_opcode_op_1_base_fp, add_opcode_is_small_f_is_imm_f, - add_opcode_is_small_f_is_imm_t, add_opcode_is_small_t_is_imm_f, add_opcode_is_small_t_is_imm_t, - assert_eq_opcode_is_double_deref_f_is_imm_f, assert_eq_opcode_is_double_deref_f_is_imm_t, - assert_eq_opcode_is_double_deref_t_is_imm_f, call_opcode_is_rel_f_op_1_base_fp_f, - call_opcode_is_rel_f_op_1_base_fp_t, call_opcode_is_rel_t_op_1_base_fp_f, generic_opcode, - jnz_opcode_is_taken_f_dst_base_fp_f, jnz_opcode_is_taken_f_dst_base_fp_t, - jnz_opcode_is_taken_t_dst_base_fp_f, jnz_opcode_is_taken_t_dst_base_fp_t, - jump_opcode_is_rel_f_is_imm_f_is_double_deref_f, + add_ap_opcode, add_ap_opcode_imm, add_ap_opcode_op_1_base_fp, add_opcode, add_opcode_imm, + add_opcode_small, add_opcode_small_imm, assert_eq_opcode_is_double_deref_f_is_imm_f, + assert_eq_opcode_is_double_deref_f_is_imm_t, assert_eq_opcode_is_double_deref_t_is_imm_f, + call_opcode_is_rel_f_op_1_base_fp_f, call_opcode_is_rel_f_op_1_base_fp_t, + call_opcode_is_rel_t_op_1_base_fp_f, generic_opcode, jnz_opcode_is_taken_f_dst_base_fp_f, + jnz_opcode_is_taken_f_dst_base_fp_t, jnz_opcode_is_taken_t_dst_base_fp_f, + jnz_opcode_is_taken_t_dst_base_fp_t, jump_opcode_is_rel_f_is_imm_f_is_double_deref_f, jump_opcode_is_rel_f_is_imm_f_is_double_deref_t, jump_opcode_is_rel_t_is_imm_f_is_double_deref_f, jump_opcode_is_rel_t_is_imm_t_is_double_deref_f, memory_address_to_id, memory_id_to_big, @@ -31,10 +30,10 @@ use crate::input::state_transitions::StateTransitions; #[derive(Serialize, Deserialize, CairoSerialize)] pub struct OpcodeClaim { - pub add_f_f: Vec, - pub add_f_t: Vec, - pub add_t_f: Vec, - pub add_t_t: Vec, + pub add: Vec, + pub add_imm: Vec, + pub add_small: Vec, + pub add_small_imm: Vec, pub add_ap: Vec, pub add_ap_op_1_base_fp: Vec, pub add_ap_imm: Vec, @@ -59,10 +58,10 @@ pub struct OpcodeClaim { } impl OpcodeClaim { pub fn mix_into(&self, channel: &mut impl Channel) { - self.add_f_f.iter().for_each(|c| c.mix_into(channel)); - self.add_f_t.iter().for_each(|c| c.mix_into(channel)); - self.add_t_f.iter().for_each(|c| c.mix_into(channel)); - self.add_t_t.iter().for_each(|c| c.mix_into(channel)); + self.add.iter().for_each(|c| c.mix_into(channel)); + self.add_imm.iter().for_each(|c| c.mix_into(channel)); + self.add_small.iter().for_each(|c| c.mix_into(channel)); + self.add_small_imm.iter().for_each(|c| c.mix_into(channel)); self.add_ap.iter().for_each(|c| c.mix_into(channel)); self.add_ap_op_1_base_fp .iter() @@ -90,10 +89,10 @@ impl OpcodeClaim { pub fn log_sizes(&self) -> TreeVec> { TreeVec::concat_cols(chain!( - self.add_f_f.iter().map(|c| c.log_sizes()), - self.add_f_t.iter().map(|c| c.log_sizes()), - self.add_t_f.iter().map(|c| c.log_sizes()), - self.add_t_t.iter().map(|c| c.log_sizes()), + self.add.iter().map(|c| c.log_sizes()), + self.add_imm.iter().map(|c| c.log_sizes()), + self.add_small.iter().map(|c| c.log_sizes()), + self.add_small_imm.iter().map(|c| c.log_sizes()), self.add_ap.iter().map(|c| c.log_sizes()), self.add_ap_op_1_base_fp.iter().map(|c| c.log_sizes()), self.add_ap_imm.iter().map(|c| c.log_sizes()), @@ -120,10 +119,10 @@ impl OpcodeClaim { } pub struct OpcodesClaimGenerator { - add_f_f: Vec, - add_f_t: Vec, - add_t_f: Vec, - add_t_t: Vec, + add: Vec, + add_imm: Vec, + add_small: Vec, + add_small_imm: Vec, add_ap: Vec, add_ap_op_1_base_fp: Vec, add_ap_imm: Vec, @@ -149,10 +148,10 @@ pub struct OpcodesClaimGenerator { impl OpcodesClaimGenerator { pub fn new(input: StateTransitions) -> Self { // TODO(Ohad): decide split sizes for opcode traces. - let mut add_f_f = vec![]; - let mut add_f_t = vec![]; - let mut add_t_f = vec![]; - let mut add_t_t = vec![]; + let mut add = vec![]; + let mut add_imm = vec![]; + let mut add_small = vec![]; + let mut add_small_imm = vec![]; let mut add_ap = vec![]; let mut add_ap_op_1_base_fp = vec![]; let mut add_ap_imm = vec![]; @@ -174,40 +173,24 @@ impl OpcodesClaimGenerator { let mut mul_f_f = vec![]; let mut mul_f_t = vec![]; let mut ret = vec![]; - if !input - .casm_states_by_opcode - .add_opcode_is_small_f_is_imm_f - .is_empty() - { - add_f_f.push(add_opcode_is_small_f_is_imm_f::ClaimGenerator::new( - input.casm_states_by_opcode.add_opcode_is_small_f_is_imm_f, + if !input.casm_states_by_opcode.add_opcode.is_empty() { + add.push(add_opcode::ClaimGenerator::new( + input.casm_states_by_opcode.add_opcode, )); } - if !input - .casm_states_by_opcode - .add_opcode_is_small_f_is_imm_t - .is_empty() - { - add_f_t.push(add_opcode_is_small_f_is_imm_t::ClaimGenerator::new( - input.casm_states_by_opcode.add_opcode_is_small_f_is_imm_t, + if !input.casm_states_by_opcode.add_opcode_imm.is_empty() { + add_imm.push(add_opcode_imm::ClaimGenerator::new( + input.casm_states_by_opcode.add_opcode_imm, )); } - if !input - .casm_states_by_opcode - .add_opcode_is_small_t_is_imm_f - .is_empty() - { - add_t_f.push(add_opcode_is_small_t_is_imm_f::ClaimGenerator::new( - input.casm_states_by_opcode.add_opcode_is_small_t_is_imm_f, + if !input.casm_states_by_opcode.add_opcode_small.is_empty() { + add_small.push(add_opcode_small::ClaimGenerator::new( + input.casm_states_by_opcode.add_opcode_small, )); } - if !input - .casm_states_by_opcode - .add_opcode_is_small_t_is_imm_t - .is_empty() - { - add_t_t.push(add_opcode_is_small_t_is_imm_t::ClaimGenerator::new( - input.casm_states_by_opcode.add_opcode_is_small_t_is_imm_t, + if !input.casm_states_by_opcode.add_opcode_small_imm.is_empty() { + add_small_imm.push(add_opcode_small_imm::ClaimGenerator::new( + input.casm_states_by_opcode.add_opcode_small_imm, )); } if !input.casm_states_by_opcode.add_ap_opcode.is_empty() { @@ -428,10 +411,10 @@ impl OpcodesClaimGenerator { )); } Self { - add_f_f, - add_f_t, - add_t_f, - add_t_t, + add, + add_imm, + add_small, + add_small_imm, add_ap, add_ap_op_1_base_fp, add_ap_imm, @@ -468,8 +451,8 @@ impl OpcodesClaimGenerator { where SimdBackend: BackendForChannel, { - let (add_f_f_claims, add_f_f_interaction_gens) = self - .add_f_f + let (add_claims, add_interaction_gens) = self + .add .into_iter() .map(|gen| { gen.write_trace( @@ -480,8 +463,8 @@ impl OpcodesClaimGenerator { ) }) .unzip(); - let (add_f_t_claims, add_f_t_interaction_gens) = self - .add_f_t + let (add_imm_claims, add_imm_interaction_gens) = self + .add_imm .into_iter() .map(|gen| { gen.write_trace( @@ -492,8 +475,8 @@ impl OpcodesClaimGenerator { ) }) .unzip(); - let (add_t_f_claims, add_t_f_interaction_gens) = self - .add_t_f + let (add_small_claims, add_small_interaction_gens) = self + .add_small .into_iter() .map(|gen| { gen.write_trace( @@ -504,8 +487,8 @@ impl OpcodesClaimGenerator { ) }) .unzip(); - let (add_t_t_claims, add_t_t_interaction_gens) = self - .add_t_t + let (add_small_imm_claims, add_small_imm_interaction_gens) = self + .add_small_imm .into_iter() .map(|gen| { gen.write_trace( @@ -516,7 +499,7 @@ impl OpcodesClaimGenerator { ) }) .unzip(); - let (add_ap_f_f_claims, add_ap_f_f_interaction_gens) = self + let (add_ap_claims, add_ap_interaction_gens) = self .add_ap .into_iter() .map(|gen| { @@ -528,7 +511,7 @@ impl OpcodesClaimGenerator { ) }) .unzip(); - let (add_ap_f_t_claims, add_ap_f_t_interaction_gens) = self + let (add_ap_op_1_base_fp_claims, add_ap_op_1_base_fp_interaction_gens) = self .add_ap_op_1_base_fp .into_iter() .map(|gen| { @@ -540,7 +523,7 @@ impl OpcodesClaimGenerator { ) }) .unzip(); - let (add_ap_t_f_claims, add_ap_t_f_interaction_gens) = self + let (add_ap_imm_claims, add_ap_imm_interaction_gens) = self .add_ap_imm .into_iter() .map(|gen| { @@ -774,13 +757,13 @@ impl OpcodesClaimGenerator { .unzip(); ( OpcodeClaim { - add_f_f: add_f_f_claims, - add_f_t: add_f_t_claims, - add_t_f: add_t_f_claims, - add_t_t: add_t_t_claims, - add_ap: add_ap_f_f_claims, - add_ap_op_1_base_fp: add_ap_f_t_claims, - add_ap_imm: add_ap_t_f_claims, + add: add_claims, + add_imm: add_imm_claims, + add_small: add_small_claims, + add_small_imm: add_small_imm_claims, + add_ap: add_ap_claims, + add_ap_op_1_base_fp: add_ap_op_1_base_fp_claims, + add_ap_imm: add_ap_imm_claims, assert_eq_f_f: assert_eq_f_f_claims, assert_eq_f_t: assert_eq_f_t_claims, assert_eq_t_f: assert_eq_t_f_claims, @@ -801,13 +784,13 @@ impl OpcodesClaimGenerator { ret: ret_claims, }, OpcodesInteractionClaimGenerator { - add_f_f: add_f_f_interaction_gens, - add_f_t: add_f_t_interaction_gens, - add_t_f: add_t_f_interaction_gens, - add_t_t: add_t_t_interaction_gens, - add_ap: add_ap_f_f_interaction_gens, - add_ap_op_1_base_fp: add_ap_f_t_interaction_gens, - add_ap_imm: add_ap_t_f_interaction_gens, + add: add_interaction_gens, + add_imm: add_imm_interaction_gens, + add_small: add_small_interaction_gens, + add_small_imm: add_small_imm_interaction_gens, + add_ap: add_ap_interaction_gens, + add_ap_op_1_base_fp: add_ap_op_1_base_fp_interaction_gens, + add_ap_imm: add_ap_imm_interaction_gens, assert_eq_f_f: assert_eq_f_f_interaction_gens, assert_eq_f_t: assert_eq_f_t_interaction_gens, assert_eq_t_f: assert_eq_t_f_interaction_gens, @@ -833,10 +816,10 @@ impl OpcodesClaimGenerator { #[derive(Serialize, Deserialize, CairoSerialize)] pub struct OpcodeInteractionClaim { - add_f_f: Vec, - add_f_t: Vec, - add_t_f: Vec, - add_t_t: Vec, + add: Vec, + add_imm: Vec, + add_small: Vec, + add_small_imm: Vec, add_ap: Vec, add_ap_op_1_base_fp: Vec, add_ap_imm: Vec, @@ -861,10 +844,10 @@ pub struct OpcodeInteractionClaim { } impl OpcodeInteractionClaim { pub fn mix_into(&self, channel: &mut impl Channel) { - self.add_f_f.iter().for_each(|c| c.mix_into(channel)); - self.add_f_t.iter().for_each(|c| c.mix_into(channel)); - self.add_t_f.iter().for_each(|c| c.mix_into(channel)); - self.add_t_t.iter().for_each(|c| c.mix_into(channel)); + self.add.iter().for_each(|c| c.mix_into(channel)); + self.add_imm.iter().for_each(|c| c.mix_into(channel)); + self.add_small.iter().for_each(|c| c.mix_into(channel)); + self.add_small_imm.iter().for_each(|c| c.mix_into(channel)); self.add_ap.iter().for_each(|c| c.mix_into(channel)); self.add_ap_op_1_base_fp .iter() @@ -892,28 +875,28 @@ impl OpcodeInteractionClaim { pub fn sum(&self) -> SecureField { let mut sum = QM31::zero(); - for interaction_claim in &self.add_f_f { + for interaction_claim in &self.add { let (total_sum, claimed_sum) = interaction_claim.logup_sums; sum += match claimed_sum { Some((claimed_sum, ..)) => claimed_sum, None => total_sum, }; } - for interaction_claim in &self.add_f_t { + for interaction_claim in &self.add_imm { let (total_sum, claimed_sum) = interaction_claim.logup_sums; sum += match claimed_sum { Some((claimed_sum, ..)) => claimed_sum, None => total_sum, }; } - for interaction_claim in &self.add_t_f { + for interaction_claim in &self.add_small { let (total_sum, claimed_sum) = interaction_claim.logup_sums; sum += match claimed_sum { Some((claimed_sum, ..)) => claimed_sum, None => total_sum, }; } - for interaction_claim in &self.add_t_t { + for interaction_claim in &self.add_small_imm { let (total_sum, claimed_sum) = interaction_claim.logup_sums; sum += match claimed_sum { Some((claimed_sum, ..)) => claimed_sum, @@ -1072,10 +1055,10 @@ impl OpcodeInteractionClaim { } pub struct OpcodesInteractionClaimGenerator { - add_f_f: Vec, - add_f_t: Vec, - add_t_f: Vec, - add_t_t: Vec, + add: Vec, + add_imm: Vec, + add_small: Vec, + add_small_imm: Vec, add_ap: Vec, add_ap_op_1_base_fp: Vec, add_ap_imm: Vec, @@ -1107,8 +1090,8 @@ impl OpcodesInteractionClaimGenerator { where SimdBackend: BackendForChannel, { - let add_f_f_interaction_claims = self - .add_f_f + let add_interaction_claims = self + .add .into_iter() .map(|gen| { gen.write_interaction_trace( @@ -1120,8 +1103,8 @@ impl OpcodesInteractionClaimGenerator { ) }) .collect(); - let add_f_t_interaction_claims = self - .add_f_t + let add_imm_interaction_claims = self + .add_imm .into_iter() .map(|gen| { gen.write_interaction_trace( @@ -1133,8 +1116,8 @@ impl OpcodesInteractionClaimGenerator { ) }) .collect(); - let add_t_f_interaction_claims = self - .add_t_f + let add_small_interaction_claims = self + .add_small .into_iter() .map(|gen| { gen.write_interaction_trace( @@ -1146,8 +1129,8 @@ impl OpcodesInteractionClaimGenerator { ) }) .collect(); - let add_t_t_interaction_claims = self - .add_t_t + let add_small_imm_interaction_claims = self + .add_small_imm .into_iter() .map(|gen| { gen.write_interaction_trace( @@ -1159,7 +1142,7 @@ impl OpcodesInteractionClaimGenerator { ) }) .collect(); - let add_ap_f_f_interaction_claims = self + let add_ap_interaction_claims = self .add_ap .into_iter() .map(|gen| { @@ -1172,7 +1155,7 @@ impl OpcodesInteractionClaimGenerator { ) }) .collect(); - let add_ap_f_t_interaction_claims = self + let add_ap_op_1_base_fp_interaction_claims = self .add_ap_op_1_base_fp .into_iter() .map(|gen| { @@ -1185,7 +1168,7 @@ impl OpcodesInteractionClaimGenerator { ) }) .collect(); - let add_ap_t_f_interaction_claims = self + let add_ap_imm_interaction_claims = self .add_ap_imm .into_iter() .map(|gen| { @@ -1435,13 +1418,13 @@ impl OpcodesInteractionClaimGenerator { }) .collect(); OpcodeInteractionClaim { - add_f_f: add_f_f_interaction_claims, - add_f_t: add_f_t_interaction_claims, - add_t_f: add_t_f_interaction_claims, - add_t_t: add_t_t_interaction_claims, - add_ap: add_ap_f_f_interaction_claims, - add_ap_op_1_base_fp: add_ap_f_t_interaction_claims, - add_ap_imm: add_ap_t_f_interaction_claims, + add: add_interaction_claims, + add_imm: add_imm_interaction_claims, + add_small: add_small_interaction_claims, + add_small_imm: add_small_imm_interaction_claims, + add_ap: add_ap_interaction_claims, + add_ap_op_1_base_fp: add_ap_op_1_base_fp_interaction_claims, + add_ap_imm: add_ap_imm_interaction_claims, assert_eq_f_f: assert_eq_f_f_interaction_claims, assert_eq_f_t: assert_eq_f_t_interaction_claims, assert_eq_t_f: assert_eq_t_f_interaction_claims, @@ -1465,10 +1448,10 @@ impl OpcodesInteractionClaimGenerator { } pub struct OpcodeComponents { - add_f_f: Vec, - add_f_t: Vec, - add_t_f: Vec, - add_t_t: Vec, + add: Vec, + add_imm: Vec, + add_small: Vec, + add_small_imm: Vec, add_ap: Vec, add_ap_op_1_base_fp: Vec, add_ap_imm: Vec, @@ -1498,14 +1481,14 @@ impl OpcodeComponents { interaction_elements: &CairoInteractionElements, interaction_claim: &OpcodeInteractionClaim, ) -> Self { - let add_f_f_components = claim - .add_f_f + let add_components = claim + .add .iter() - .zip(interaction_claim.add_f_f.iter()) + .zip(interaction_claim.add.iter()) .map(|(&claim, &interaction_claim)| { - add_opcode_is_small_f_is_imm_f::Component::new( + add_opcode::Component::new( tree_span_provider, - add_opcode_is_small_f_is_imm_f::Eval { + add_opcode::Eval { claim, memory_address_to_id_lookup_elements: interaction_elements .memory_address_to_id @@ -1522,14 +1505,14 @@ impl OpcodeComponents { ) }) .collect_vec(); - let add_f_t_components = claim - .add_f_t + let add_imm_components = claim + .add_imm .iter() - .zip(interaction_claim.add_f_t.iter()) + .zip(interaction_claim.add_imm.iter()) .map(|(&claim, &interaction_claim)| { - add_opcode_is_small_f_is_imm_t::Component::new( + add_opcode_imm::Component::new( tree_span_provider, - add_opcode_is_small_f_is_imm_t::Eval { + add_opcode_imm::Eval { claim, memory_address_to_id_lookup_elements: interaction_elements .memory_address_to_id @@ -1546,14 +1529,14 @@ impl OpcodeComponents { ) }) .collect_vec(); - let add_t_f_components = claim - .add_t_f + let add_small_components = claim + .add_small .iter() - .zip(interaction_claim.add_t_f.iter()) + .zip(interaction_claim.add_small.iter()) .map(|(&claim, &interaction_claim)| { - add_opcode_is_small_t_is_imm_f::Component::new( + add_opcode_small::Component::new( tree_span_provider, - add_opcode_is_small_t_is_imm_f::Eval { + add_opcode_small::Eval { claim, memory_address_to_id_lookup_elements: interaction_elements .memory_address_to_id @@ -1570,14 +1553,14 @@ impl OpcodeComponents { ) }) .collect_vec(); - let add_t_t_components = claim - .add_t_t + let add_small_imm_components = claim + .add_small_imm .iter() - .zip(interaction_claim.add_t_t.iter()) + .zip(interaction_claim.add_small_imm.iter()) .map(|(&claim, &interaction_claim)| { - add_opcode_is_small_t_is_imm_t::Component::new( + add_opcode_small_imm::Component::new( tree_span_provider, - add_opcode_is_small_t_is_imm_t::Eval { + add_opcode_small_imm::Eval { claim, memory_address_to_id_lookup_elements: interaction_elements .memory_address_to_id @@ -1594,7 +1577,7 @@ impl OpcodeComponents { ) }) .collect_vec(); - let add_ap_f_f_components = claim + let add_ap_components = claim .add_ap .iter() .zip(interaction_claim.add_ap.iter()) @@ -1618,7 +1601,7 @@ impl OpcodeComponents { ) }) .collect_vec(); - let add_ap_f_t_components = claim + let add_ap_op_1_base_fp_components = claim .add_ap_op_1_base_fp .iter() .zip(interaction_claim.add_ap_op_1_base_fp.iter()) @@ -1642,7 +1625,7 @@ impl OpcodeComponents { ) }) .collect_vec(); - let add_ap_t_f_components = claim + let add_ap_imm_components = claim .add_ap_imm .iter() .zip(interaction_claim.add_ap_imm.iter()) @@ -2099,13 +2082,13 @@ impl OpcodeComponents { }) .collect_vec(); Self { - add_f_f: add_f_f_components, - add_f_t: add_f_t_components, - add_t_f: add_t_f_components, - add_t_t: add_t_t_components, - add_ap: add_ap_f_f_components, - add_ap_op_1_base_fp: add_ap_f_t_components, - add_ap_imm: add_ap_t_f_components, + add: add_components, + add_imm: add_imm_components, + add_small: add_small_components, + add_small_imm: add_small_imm_components, + add_ap: add_ap_components, + add_ap_op_1_base_fp: add_ap_op_1_base_fp_components, + add_ap_imm: add_ap_imm_components, assert_eq_f_f: assert_eq_f_f_components, assert_eq_f_t: assert_eq_f_t_components, assert_eq_t_f: assert_eq_t_f_components, @@ -2130,22 +2113,22 @@ impl OpcodeComponents { pub fn provers(&self) -> Vec<&dyn ComponentProver> { let mut vec: Vec<&dyn ComponentProver> = vec![]; vec.extend( - self.add_f_f + self.add .iter() .map(|component| component as &dyn ComponentProver), ); vec.extend( - self.add_f_t + self.add_imm .iter() .map(|component| component as &dyn ComponentProver), ); vec.extend( - self.add_t_f + self.add_small .iter() .map(|component| component as &dyn ComponentProver), ); vec.extend( - self.add_t_t + self.add_small_imm .iter() .map(|component| component as &dyn ComponentProver), ); @@ -2260,14 +2243,14 @@ impl OpcodeComponents { impl std::fmt::Display for OpcodeComponents { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - writeln!(f, "add_f_f:")?; - writeln!(f, "{}", display_components(&self.add_f_f))?; - writeln!(f, "add_f_t:")?; - writeln!(f, "{}", display_components(&self.add_f_t))?; - writeln!(f, "add_t_f:")?; - writeln!(f, "{}", display_components(&self.add_t_f))?; - writeln!(f, "add_t_t:")?; - writeln!(f, "{}", display_components(&self.add_t_t))?; + writeln!(f, "add:")?; + writeln!(f, "{}", display_components(&self.add))?; + writeln!(f, "add_imm:")?; + writeln!(f, "{}", display_components(&self.add_imm))?; + writeln!(f, "add_small:")?; + writeln!(f, "{}", display_components(&self.add_small))?; + writeln!(f, "add_small_imm:")?; + writeln!(f, "{}", display_components(&self.add_small_imm))?; writeln!(f, "add_ap:")?; writeln!(f, "{}", display_components(&self.add_ap))?; writeln!(f, "add_ap_op_1_base_fp:")?; diff --git a/stwo_cairo_prover/crates/prover/src/components/add_opcode_is_small_f_is_imm_f/component.rs b/stwo_cairo_prover/crates/prover/src/components/add_opcode/component.rs similarity index 81% rename from stwo_cairo_prover/crates/prover/src/components/add_opcode_is_small_f_is_imm_f/component.rs rename to stwo_cairo_prover/crates/prover/src/components/add_opcode/component.rs index 3671f5be..e81cd4b0 100644 --- a/stwo_cairo_prover/crates/prover/src/components/add_opcode_is_small_f_is_imm_f/component.rs +++ b/stwo_cairo_prover/crates/prover/src/components/add_opcode/component.rs @@ -4,6 +4,7 @@ use num_traits::{One, Zero}; use serde::{Deserialize, Serialize}; use stwo_cairo_serialize::CairoSerialize; use stwo_prover::constraint_framework::logup::{LogupAtRow, LogupSums, LookupElements}; +use stwo_prover::constraint_framework::preprocessed_columns::PreprocessedColumn; use stwo_prover::constraint_framework::{ EvalAtRow, FrameworkComponent, FrameworkEval, RelationEntry, }; @@ -383,305 +384,305 @@ impl FrameworkEval for Eval { eval.add_constraint( (sub_p_bit_col101.clone() * (sub_p_bit_col101.clone() - M31_1.clone())), ); - let carry_tmp_f459d_18 = eval.add_intermediate( + let carry_tmp_3fa46_18 = eval.add_intermediate( (((((op0_limb_0_col44.clone() + op1_limb_0_col73.clone()) + M31_0.clone()) - dst_limb_0_col15.clone()) - (M31_1.clone() * sub_p_bit_col101.clone())) * M31_4194304.clone()), ); eval.add_constraint( - (carry_tmp_f459d_18.clone() - * ((carry_tmp_f459d_18.clone() * carry_tmp_f459d_18.clone()) - M31_1.clone())), + (carry_tmp_3fa46_18.clone() + * ((carry_tmp_3fa46_18.clone() * carry_tmp_3fa46_18.clone()) - M31_1.clone())), ); - let carry_tmp_f459d_19 = eval.add_intermediate( + let carry_tmp_3fa46_19 = eval.add_intermediate( (((((op0_limb_1_col45.clone() + op1_limb_1_col74.clone()) - + carry_tmp_f459d_18.clone()) + + carry_tmp_3fa46_18.clone()) - dst_limb_1_col16.clone()) - (M31_0.clone() * sub_p_bit_col101.clone())) * M31_4194304.clone()), ); eval.add_constraint( - (carry_tmp_f459d_19.clone() - * ((carry_tmp_f459d_19.clone() * carry_tmp_f459d_19.clone()) - M31_1.clone())), + (carry_tmp_3fa46_19.clone() + * ((carry_tmp_3fa46_19.clone() * carry_tmp_3fa46_19.clone()) - M31_1.clone())), ); - let carry_tmp_f459d_20 = eval.add_intermediate( + let carry_tmp_3fa46_20 = eval.add_intermediate( (((((op0_limb_2_col46.clone() + op1_limb_2_col75.clone()) - + carry_tmp_f459d_19.clone()) + + carry_tmp_3fa46_19.clone()) - dst_limb_2_col17.clone()) - (M31_0.clone() * sub_p_bit_col101.clone())) * M31_4194304.clone()), ); eval.add_constraint( - (carry_tmp_f459d_20.clone() - * ((carry_tmp_f459d_20.clone() * carry_tmp_f459d_20.clone()) - M31_1.clone())), + (carry_tmp_3fa46_20.clone() + * ((carry_tmp_3fa46_20.clone() * carry_tmp_3fa46_20.clone()) - M31_1.clone())), ); - let carry_tmp_f459d_21 = eval.add_intermediate( + let carry_tmp_3fa46_21 = eval.add_intermediate( (((((op0_limb_3_col47.clone() + op1_limb_3_col76.clone()) - + carry_tmp_f459d_20.clone()) + + carry_tmp_3fa46_20.clone()) - dst_limb_3_col18.clone()) - (M31_0.clone() * sub_p_bit_col101.clone())) * M31_4194304.clone()), ); eval.add_constraint( - (carry_tmp_f459d_21.clone() - * ((carry_tmp_f459d_21.clone() * carry_tmp_f459d_21.clone()) - M31_1.clone())), + (carry_tmp_3fa46_21.clone() + * ((carry_tmp_3fa46_21.clone() * carry_tmp_3fa46_21.clone()) - M31_1.clone())), ); - let carry_tmp_f459d_22 = eval.add_intermediate( + let carry_tmp_3fa46_22 = eval.add_intermediate( (((((op0_limb_4_col48.clone() + op1_limb_4_col77.clone()) - + carry_tmp_f459d_21.clone()) + + carry_tmp_3fa46_21.clone()) - dst_limb_4_col19.clone()) - (M31_0.clone() * sub_p_bit_col101.clone())) * M31_4194304.clone()), ); eval.add_constraint( - (carry_tmp_f459d_22.clone() - * ((carry_tmp_f459d_22.clone() * carry_tmp_f459d_22.clone()) - M31_1.clone())), + (carry_tmp_3fa46_22.clone() + * ((carry_tmp_3fa46_22.clone() * carry_tmp_3fa46_22.clone()) - M31_1.clone())), ); - let carry_tmp_f459d_23 = eval.add_intermediate( + let carry_tmp_3fa46_23 = eval.add_intermediate( (((((op0_limb_5_col49.clone() + op1_limb_5_col78.clone()) - + carry_tmp_f459d_22.clone()) + + carry_tmp_3fa46_22.clone()) - dst_limb_5_col20.clone()) - (M31_0.clone() * sub_p_bit_col101.clone())) * M31_4194304.clone()), ); eval.add_constraint( - (carry_tmp_f459d_23.clone() - * ((carry_tmp_f459d_23.clone() * carry_tmp_f459d_23.clone()) - M31_1.clone())), + (carry_tmp_3fa46_23.clone() + * ((carry_tmp_3fa46_23.clone() * carry_tmp_3fa46_23.clone()) - M31_1.clone())), ); - let carry_tmp_f459d_24 = eval.add_intermediate( + let carry_tmp_3fa46_24 = eval.add_intermediate( (((((op0_limb_6_col50.clone() + op1_limb_6_col79.clone()) - + carry_tmp_f459d_23.clone()) + + carry_tmp_3fa46_23.clone()) - dst_limb_6_col21.clone()) - (M31_0.clone() * sub_p_bit_col101.clone())) * M31_4194304.clone()), ); eval.add_constraint( - (carry_tmp_f459d_24.clone() - * ((carry_tmp_f459d_24.clone() * carry_tmp_f459d_24.clone()) - M31_1.clone())), + (carry_tmp_3fa46_24.clone() + * ((carry_tmp_3fa46_24.clone() * carry_tmp_3fa46_24.clone()) - M31_1.clone())), ); - let carry_tmp_f459d_25 = eval.add_intermediate( + let carry_tmp_3fa46_25 = eval.add_intermediate( (((((op0_limb_7_col51.clone() + op1_limb_7_col80.clone()) - + carry_tmp_f459d_24.clone()) + + carry_tmp_3fa46_24.clone()) - dst_limb_7_col22.clone()) - (M31_0.clone() * sub_p_bit_col101.clone())) * M31_4194304.clone()), ); eval.add_constraint( - (carry_tmp_f459d_25.clone() - * ((carry_tmp_f459d_25.clone() * carry_tmp_f459d_25.clone()) - M31_1.clone())), + (carry_tmp_3fa46_25.clone() + * ((carry_tmp_3fa46_25.clone() * carry_tmp_3fa46_25.clone()) - M31_1.clone())), ); - let carry_tmp_f459d_26 = eval.add_intermediate( + let carry_tmp_3fa46_26 = eval.add_intermediate( (((((op0_limb_8_col52.clone() + op1_limb_8_col81.clone()) - + carry_tmp_f459d_25.clone()) + + carry_tmp_3fa46_25.clone()) - dst_limb_8_col23.clone()) - (M31_0.clone() * sub_p_bit_col101.clone())) * M31_4194304.clone()), ); eval.add_constraint( - (carry_tmp_f459d_26.clone() - * ((carry_tmp_f459d_26.clone() * carry_tmp_f459d_26.clone()) - M31_1.clone())), + (carry_tmp_3fa46_26.clone() + * ((carry_tmp_3fa46_26.clone() * carry_tmp_3fa46_26.clone()) - M31_1.clone())), ); - let carry_tmp_f459d_27 = eval.add_intermediate( + let carry_tmp_3fa46_27 = eval.add_intermediate( (((((op0_limb_9_col53.clone() + op1_limb_9_col82.clone()) - + carry_tmp_f459d_26.clone()) + + carry_tmp_3fa46_26.clone()) - dst_limb_9_col24.clone()) - (M31_0.clone() * sub_p_bit_col101.clone())) * M31_4194304.clone()), ); eval.add_constraint( - (carry_tmp_f459d_27.clone() - * ((carry_tmp_f459d_27.clone() * carry_tmp_f459d_27.clone()) - M31_1.clone())), + (carry_tmp_3fa46_27.clone() + * ((carry_tmp_3fa46_27.clone() * carry_tmp_3fa46_27.clone()) - M31_1.clone())), ); - let carry_tmp_f459d_28 = eval.add_intermediate( + let carry_tmp_3fa46_28 = eval.add_intermediate( (((((op0_limb_10_col54.clone() + op1_limb_10_col83.clone()) - + carry_tmp_f459d_27.clone()) + + carry_tmp_3fa46_27.clone()) - dst_limb_10_col25.clone()) - (M31_0.clone() * sub_p_bit_col101.clone())) * M31_4194304.clone()), ); eval.add_constraint( - (carry_tmp_f459d_28.clone() - * ((carry_tmp_f459d_28.clone() * carry_tmp_f459d_28.clone()) - M31_1.clone())), + (carry_tmp_3fa46_28.clone() + * ((carry_tmp_3fa46_28.clone() * carry_tmp_3fa46_28.clone()) - M31_1.clone())), ); - let carry_tmp_f459d_29 = eval.add_intermediate( + let carry_tmp_3fa46_29 = eval.add_intermediate( (((((op0_limb_11_col55.clone() + op1_limb_11_col84.clone()) - + carry_tmp_f459d_28.clone()) + + carry_tmp_3fa46_28.clone()) - dst_limb_11_col26.clone()) - (M31_0.clone() * sub_p_bit_col101.clone())) * M31_4194304.clone()), ); eval.add_constraint( - (carry_tmp_f459d_29.clone() - * ((carry_tmp_f459d_29.clone() * carry_tmp_f459d_29.clone()) - M31_1.clone())), + (carry_tmp_3fa46_29.clone() + * ((carry_tmp_3fa46_29.clone() * carry_tmp_3fa46_29.clone()) - M31_1.clone())), ); - let carry_tmp_f459d_30 = eval.add_intermediate( + let carry_tmp_3fa46_30 = eval.add_intermediate( (((((op0_limb_12_col56.clone() + op1_limb_12_col85.clone()) - + carry_tmp_f459d_29.clone()) + + carry_tmp_3fa46_29.clone()) - dst_limb_12_col27.clone()) - (M31_0.clone() * sub_p_bit_col101.clone())) * M31_4194304.clone()), ); eval.add_constraint( - (carry_tmp_f459d_30.clone() - * ((carry_tmp_f459d_30.clone() * carry_tmp_f459d_30.clone()) - M31_1.clone())), + (carry_tmp_3fa46_30.clone() + * ((carry_tmp_3fa46_30.clone() * carry_tmp_3fa46_30.clone()) - M31_1.clone())), ); - let carry_tmp_f459d_31 = eval.add_intermediate( + let carry_tmp_3fa46_31 = eval.add_intermediate( (((((op0_limb_13_col57.clone() + op1_limb_13_col86.clone()) - + carry_tmp_f459d_30.clone()) + + carry_tmp_3fa46_30.clone()) - dst_limb_13_col28.clone()) - (M31_0.clone() * sub_p_bit_col101.clone())) * M31_4194304.clone()), ); eval.add_constraint( - (carry_tmp_f459d_31.clone() - * ((carry_tmp_f459d_31.clone() * carry_tmp_f459d_31.clone()) - M31_1.clone())), + (carry_tmp_3fa46_31.clone() + * ((carry_tmp_3fa46_31.clone() * carry_tmp_3fa46_31.clone()) - M31_1.clone())), ); - let carry_tmp_f459d_32 = eval.add_intermediate( + let carry_tmp_3fa46_32 = eval.add_intermediate( (((((op0_limb_14_col58.clone() + op1_limb_14_col87.clone()) - + carry_tmp_f459d_31.clone()) + + carry_tmp_3fa46_31.clone()) - dst_limb_14_col29.clone()) - (M31_0.clone() * sub_p_bit_col101.clone())) * M31_4194304.clone()), ); eval.add_constraint( - (carry_tmp_f459d_32.clone() - * ((carry_tmp_f459d_32.clone() * carry_tmp_f459d_32.clone()) - M31_1.clone())), + (carry_tmp_3fa46_32.clone() + * ((carry_tmp_3fa46_32.clone() * carry_tmp_3fa46_32.clone()) - M31_1.clone())), ); - let carry_tmp_f459d_33 = eval.add_intermediate( + let carry_tmp_3fa46_33 = eval.add_intermediate( (((((op0_limb_15_col59.clone() + op1_limb_15_col88.clone()) - + carry_tmp_f459d_32.clone()) + + carry_tmp_3fa46_32.clone()) - dst_limb_15_col30.clone()) - (M31_0.clone() * sub_p_bit_col101.clone())) * M31_4194304.clone()), ); eval.add_constraint( - (carry_tmp_f459d_33.clone() - * ((carry_tmp_f459d_33.clone() * carry_tmp_f459d_33.clone()) - M31_1.clone())), + (carry_tmp_3fa46_33.clone() + * ((carry_tmp_3fa46_33.clone() * carry_tmp_3fa46_33.clone()) - M31_1.clone())), ); - let carry_tmp_f459d_34 = eval.add_intermediate( + let carry_tmp_3fa46_34 = eval.add_intermediate( (((((op0_limb_16_col60.clone() + op1_limb_16_col89.clone()) - + carry_tmp_f459d_33.clone()) + + carry_tmp_3fa46_33.clone()) - dst_limb_16_col31.clone()) - (M31_0.clone() * sub_p_bit_col101.clone())) * M31_4194304.clone()), ); eval.add_constraint( - (carry_tmp_f459d_34.clone() - * ((carry_tmp_f459d_34.clone() * carry_tmp_f459d_34.clone()) - M31_1.clone())), + (carry_tmp_3fa46_34.clone() + * ((carry_tmp_3fa46_34.clone() * carry_tmp_3fa46_34.clone()) - M31_1.clone())), ); - let carry_tmp_f459d_35 = eval.add_intermediate( + let carry_tmp_3fa46_35 = eval.add_intermediate( (((((op0_limb_17_col61.clone() + op1_limb_17_col90.clone()) - + carry_tmp_f459d_34.clone()) + + carry_tmp_3fa46_34.clone()) - dst_limb_17_col32.clone()) - (M31_0.clone() * sub_p_bit_col101.clone())) * M31_4194304.clone()), ); eval.add_constraint( - (carry_tmp_f459d_35.clone() - * ((carry_tmp_f459d_35.clone() * carry_tmp_f459d_35.clone()) - M31_1.clone())), + (carry_tmp_3fa46_35.clone() + * ((carry_tmp_3fa46_35.clone() * carry_tmp_3fa46_35.clone()) - M31_1.clone())), ); - let carry_tmp_f459d_36 = eval.add_intermediate( + let carry_tmp_3fa46_36 = eval.add_intermediate( (((((op0_limb_18_col62.clone() + op1_limb_18_col91.clone()) - + carry_tmp_f459d_35.clone()) + + carry_tmp_3fa46_35.clone()) - dst_limb_18_col33.clone()) - (M31_0.clone() * sub_p_bit_col101.clone())) * M31_4194304.clone()), ); eval.add_constraint( - (carry_tmp_f459d_36.clone() - * ((carry_tmp_f459d_36.clone() * carry_tmp_f459d_36.clone()) - M31_1.clone())), + (carry_tmp_3fa46_36.clone() + * ((carry_tmp_3fa46_36.clone() * carry_tmp_3fa46_36.clone()) - M31_1.clone())), ); - let carry_tmp_f459d_37 = eval.add_intermediate( + let carry_tmp_3fa46_37 = eval.add_intermediate( (((((op0_limb_19_col63.clone() + op1_limb_19_col92.clone()) - + carry_tmp_f459d_36.clone()) + + carry_tmp_3fa46_36.clone()) - dst_limb_19_col34.clone()) - (M31_0.clone() * sub_p_bit_col101.clone())) * M31_4194304.clone()), ); eval.add_constraint( - (carry_tmp_f459d_37.clone() - * ((carry_tmp_f459d_37.clone() * carry_tmp_f459d_37.clone()) - M31_1.clone())), + (carry_tmp_3fa46_37.clone() + * ((carry_tmp_3fa46_37.clone() * carry_tmp_3fa46_37.clone()) - M31_1.clone())), ); - let carry_tmp_f459d_38 = eval.add_intermediate( + let carry_tmp_3fa46_38 = eval.add_intermediate( (((((op0_limb_20_col64.clone() + op1_limb_20_col93.clone()) - + carry_tmp_f459d_37.clone()) + + carry_tmp_3fa46_37.clone()) - dst_limb_20_col35.clone()) - (M31_0.clone() * sub_p_bit_col101.clone())) * M31_4194304.clone()), ); eval.add_constraint( - (carry_tmp_f459d_38.clone() - * ((carry_tmp_f459d_38.clone() * carry_tmp_f459d_38.clone()) - M31_1.clone())), + (carry_tmp_3fa46_38.clone() + * ((carry_tmp_3fa46_38.clone() * carry_tmp_3fa46_38.clone()) - M31_1.clone())), ); - let carry_tmp_f459d_39 = eval.add_intermediate( + let carry_tmp_3fa46_39 = eval.add_intermediate( (((((op0_limb_21_col65.clone() + op1_limb_21_col94.clone()) - + carry_tmp_f459d_38.clone()) + + carry_tmp_3fa46_38.clone()) - dst_limb_21_col36.clone()) - (M31_136.clone() * sub_p_bit_col101.clone())) * M31_4194304.clone()), ); eval.add_constraint( - (carry_tmp_f459d_39.clone() - * ((carry_tmp_f459d_39.clone() * carry_tmp_f459d_39.clone()) - M31_1.clone())), + (carry_tmp_3fa46_39.clone() + * ((carry_tmp_3fa46_39.clone() * carry_tmp_3fa46_39.clone()) - M31_1.clone())), ); - let carry_tmp_f459d_40 = eval.add_intermediate( + let carry_tmp_3fa46_40 = eval.add_intermediate( (((((op0_limb_22_col66.clone() + op1_limb_22_col95.clone()) - + carry_tmp_f459d_39.clone()) + + carry_tmp_3fa46_39.clone()) - dst_limb_22_col37.clone()) - (M31_0.clone() * sub_p_bit_col101.clone())) * M31_4194304.clone()), ); eval.add_constraint( - (carry_tmp_f459d_40.clone() - * ((carry_tmp_f459d_40.clone() * carry_tmp_f459d_40.clone()) - M31_1.clone())), + (carry_tmp_3fa46_40.clone() + * ((carry_tmp_3fa46_40.clone() * carry_tmp_3fa46_40.clone()) - M31_1.clone())), ); - let carry_tmp_f459d_41 = eval.add_intermediate( + let carry_tmp_3fa46_41 = eval.add_intermediate( (((((op0_limb_23_col67.clone() + op1_limb_23_col96.clone()) - + carry_tmp_f459d_40.clone()) + + carry_tmp_3fa46_40.clone()) - dst_limb_23_col38.clone()) - (M31_0.clone() * sub_p_bit_col101.clone())) * M31_4194304.clone()), ); eval.add_constraint( - (carry_tmp_f459d_41.clone() - * ((carry_tmp_f459d_41.clone() * carry_tmp_f459d_41.clone()) - M31_1.clone())), + (carry_tmp_3fa46_41.clone() + * ((carry_tmp_3fa46_41.clone() * carry_tmp_3fa46_41.clone()) - M31_1.clone())), ); - let carry_tmp_f459d_42 = eval.add_intermediate( + let carry_tmp_3fa46_42 = eval.add_intermediate( (((((op0_limb_24_col68.clone() + op1_limb_24_col97.clone()) - + carry_tmp_f459d_41.clone()) + + carry_tmp_3fa46_41.clone()) - dst_limb_24_col39.clone()) - (M31_0.clone() * sub_p_bit_col101.clone())) * M31_4194304.clone()), ); eval.add_constraint( - (carry_tmp_f459d_42.clone() - * ((carry_tmp_f459d_42.clone() * carry_tmp_f459d_42.clone()) - M31_1.clone())), + (carry_tmp_3fa46_42.clone() + * ((carry_tmp_3fa46_42.clone() * carry_tmp_3fa46_42.clone()) - M31_1.clone())), ); - let carry_tmp_f459d_43 = eval.add_intermediate( + let carry_tmp_3fa46_43 = eval.add_intermediate( (((((op0_limb_25_col69.clone() + op1_limb_25_col98.clone()) - + carry_tmp_f459d_42.clone()) + + carry_tmp_3fa46_42.clone()) - dst_limb_25_col40.clone()) - (M31_0.clone() * sub_p_bit_col101.clone())) * M31_4194304.clone()), ); eval.add_constraint( - (carry_tmp_f459d_43.clone() - * ((carry_tmp_f459d_43.clone() * carry_tmp_f459d_43.clone()) - M31_1.clone())), + (carry_tmp_3fa46_43.clone() + * ((carry_tmp_3fa46_43.clone() * carry_tmp_3fa46_43.clone()) - M31_1.clone())), ); - let carry_tmp_f459d_44 = eval.add_intermediate( + let carry_tmp_3fa46_44 = eval.add_intermediate( (((((op0_limb_26_col70.clone() + op1_limb_26_col99.clone()) - + carry_tmp_f459d_43.clone()) + + carry_tmp_3fa46_43.clone()) - dst_limb_26_col41.clone()) - (M31_0.clone() * sub_p_bit_col101.clone())) * M31_4194304.clone()), ); eval.add_constraint( - (carry_tmp_f459d_44.clone() - * ((carry_tmp_f459d_44.clone() * carry_tmp_f459d_44.clone()) - M31_1.clone())), + (carry_tmp_3fa46_44.clone() + * ((carry_tmp_3fa46_44.clone() * carry_tmp_3fa46_44.clone()) - M31_1.clone())), ); eval.add_constraint( ((((op0_limb_27_col71.clone() + op1_limb_27_col100.clone()) - + carry_tmp_f459d_44.clone()) + + carry_tmp_3fa46_44.clone()) - dst_limb_27_col42.clone()) - (M31_256.clone() * sub_p_bit_col101.clone())), ); diff --git a/stwo_cairo_prover/crates/prover/src/components/add_opcode_is_small_f_is_imm_f/mod.rs b/stwo_cairo_prover/crates/prover/src/components/add_opcode/mod.rs similarity index 100% rename from stwo_cairo_prover/crates/prover/src/components/add_opcode_is_small_f_is_imm_f/mod.rs rename to stwo_cairo_prover/crates/prover/src/components/add_opcode/mod.rs diff --git a/stwo_cairo_prover/crates/prover/src/components/add_opcode_is_small_f_is_imm_f/prover.rs b/stwo_cairo_prover/crates/prover/src/components/add_opcode/prover.rs similarity index 85% rename from stwo_cairo_prover/crates/prover/src/components/add_opcode_is_small_f_is_imm_f/prover.rs rename to stwo_cairo_prover/crates/prover/src/components/add_opcode/prover.rs index c59a9687..51a40849 100644 --- a/stwo_cairo_prover/crates/prover/src/components/add_opcode_is_small_f_is_imm_f/prover.rs +++ b/stwo_cairo_prover/crates/prover/src/components/add_opcode/prover.rs @@ -7,10 +7,13 @@ use itertools::{chain, zip_eq, Itertools}; use num_traits::{One, Zero}; use prover_types::cpu::*; use prover_types::simd::*; -use rayon::iter::{IndexedParallelIterator, IntoParallelRefIterator, ParallelIterator}; +use rayon::iter::{ + IndexedParallelIterator, IntoParallelIterator, IntoParallelRefIterator, ParallelIterator, +}; use stwo_air_utils::trace::component_trace::ComponentTrace; use stwo_air_utils_derive::{IterMut, ParIterMut, Uninitialized}; use stwo_prover::constraint_framework::logup::LogupTraceGenerator; +use stwo_prover::constraint_framework::preprocessed_columns::PreprocessedColumn; use stwo_prover::constraint_framework::Relation; use stwo_prover::core::air::Component; use stwo_prover::core::backend::simd::column::BaseColumn; @@ -21,6 +24,7 @@ use stwo_prover::core::backend::simd::SimdBackend; use stwo_prover::core::backend::{BackendForChannel, Col, Column}; use stwo_prover::core::channel::{Channel, MerkleChannel}; use stwo_prover::core::fields::m31::M31; +use stwo_prover::core::fields::FieldExpOps; use stwo_prover::core::pcs::TreeBuilder; use stwo_prover::core::poly::circle::{CanonicCoset, CircleEvaluation}; use stwo_prover::core::poly::BitReversedOrder; @@ -66,6 +70,7 @@ impl ClaimGenerator { let packed_inputs = pack_values(&self.inputs); let (trace, mut sub_components_inputs, lookup_data) = write_trace_simd( + n_rows, packed_inputs, memory_address_to_id_state, memory_id_to_big_state, @@ -104,8 +109,8 @@ impl ClaimGenerator { ) } - pub fn add_inputs(&mut self, inputs: &[InputType]) { - self.inputs.extend(inputs); + pub fn add_inputs(&self, _inputs: &[InputType]) { + unimplemented!("Implement manually"); } } @@ -121,6 +126,7 @@ pub struct SubComponentInputs { #[allow(clippy::double_parens)] #[allow(non_snake_case)] fn write_trace_simd( + n_rows: usize, inputs: Vec, memory_address_to_id_state: &memory_address_to_id::ClaimGenerator, memory_id_to_big_state: &memory_id_to_big::ClaimGenerator, @@ -158,111 +164,108 @@ fn write_trace_simd( trace .par_iter_mut() - .zip(inputs.par_iter()) + .enumerate() + .zip(inputs.into_par_iter()) .zip(lookup_data.par_iter_mut()) .zip(sub_components_inputs.par_iter_mut().chunks(N_LANES)) .for_each( - |( - ((row, add_opcode_is_small_f_is_imm_f_input), lookup_data), - mut sub_components_inputs, - )| { - let input_tmp_f459d_0 = add_opcode_is_small_f_is_imm_f_input; - let input_pc_col0 = input_tmp_f459d_0.pc; + |((((row_index, row), add_opcode_input), lookup_data), mut sub_components_inputs)| { + let input_tmp_3fa46_0 = add_opcode_input; + let input_pc_col0 = input_tmp_3fa46_0.pc; *row[0] = input_pc_col0; - let input_ap_col1 = input_tmp_f459d_0.ap; + let input_ap_col1 = input_tmp_3fa46_0.ap; *row[1] = input_ap_col1; - let input_fp_col2 = input_tmp_f459d_0.fp; + let input_fp_col2 = input_tmp_3fa46_0.fp; *row[2] = input_fp_col2; // Decode Instruction. - let memory_address_to_id_value_tmp_f459d_1 = + let memory_address_to_id_value_tmp_3fa46_1 = memory_address_to_id_state.deduce_output(input_pc_col0); - let memory_id_to_big_value_tmp_f459d_2 = - memory_id_to_big_state.deduce_output(memory_address_to_id_value_tmp_f459d_1); - let offset0_tmp_f459d_3 = - ((PackedUInt16::from_m31(memory_id_to_big_value_tmp_f459d_2.get_m31(0))) + let memory_id_to_big_value_tmp_3fa46_2 = + memory_id_to_big_state.deduce_output(memory_address_to_id_value_tmp_3fa46_1); + let offset0_tmp_3fa46_3 = + ((PackedUInt16::from_m31(memory_id_to_big_value_tmp_3fa46_2.get_m31(0))) + (((PackedUInt16::from_m31( - memory_id_to_big_value_tmp_f459d_2.get_m31(1), + memory_id_to_big_value_tmp_3fa46_2.get_m31(1), )) & (UInt16_127)) << (UInt16_9))); - let offset0_col3 = offset0_tmp_f459d_3.as_m31(); + let offset0_col3 = offset0_tmp_3fa46_3.as_m31(); *row[3] = offset0_col3; - let offset1_tmp_f459d_4 = - ((((PackedUInt16::from_m31(memory_id_to_big_value_tmp_f459d_2.get_m31(1))) + let offset1_tmp_3fa46_4 = + ((((PackedUInt16::from_m31(memory_id_to_big_value_tmp_3fa46_2.get_m31(1))) >> (UInt16_7)) + ((PackedUInt16::from_m31( - memory_id_to_big_value_tmp_f459d_2.get_m31(2), + memory_id_to_big_value_tmp_3fa46_2.get_m31(2), )) << (UInt16_2))) + (((PackedUInt16::from_m31( - memory_id_to_big_value_tmp_f459d_2.get_m31(3), + memory_id_to_big_value_tmp_3fa46_2.get_m31(3), )) & (UInt16_31)) << (UInt16_11))); - let offset1_col4 = offset1_tmp_f459d_4.as_m31(); + let offset1_col4 = offset1_tmp_3fa46_4.as_m31(); *row[4] = offset1_col4; - let offset2_tmp_f459d_5 = - ((((PackedUInt16::from_m31(memory_id_to_big_value_tmp_f459d_2.get_m31(3))) + let offset2_tmp_3fa46_5 = + ((((PackedUInt16::from_m31(memory_id_to_big_value_tmp_3fa46_2.get_m31(3))) >> (UInt16_5)) + ((PackedUInt16::from_m31( - memory_id_to_big_value_tmp_f459d_2.get_m31(4), + memory_id_to_big_value_tmp_3fa46_2.get_m31(4), )) << (UInt16_4))) + (((PackedUInt16::from_m31( - memory_id_to_big_value_tmp_f459d_2.get_m31(5), + memory_id_to_big_value_tmp_3fa46_2.get_m31(5), )) & (UInt16_7)) << (UInt16_13))); - let offset2_col5 = offset2_tmp_f459d_5.as_m31(); + let offset2_col5 = offset2_tmp_3fa46_5.as_m31(); *row[5] = offset2_col5; - let dst_base_fp_tmp_f459d_6 = - (((((PackedUInt16::from_m31(memory_id_to_big_value_tmp_f459d_2.get_m31(5))) + let dst_base_fp_tmp_3fa46_6 = + (((((PackedUInt16::from_m31(memory_id_to_big_value_tmp_3fa46_2.get_m31(5))) >> (UInt16_3)) + ((PackedUInt16::from_m31( - memory_id_to_big_value_tmp_f459d_2.get_m31(6), + memory_id_to_big_value_tmp_3fa46_2.get_m31(6), )) << (UInt16_6))) >> (UInt16_0)) & (UInt16_1)); - let dst_base_fp_col6 = dst_base_fp_tmp_f459d_6.as_m31(); + let dst_base_fp_col6 = dst_base_fp_tmp_3fa46_6.as_m31(); *row[6] = dst_base_fp_col6; - let op0_base_fp_tmp_f459d_7 = - (((((PackedUInt16::from_m31(memory_id_to_big_value_tmp_f459d_2.get_m31(5))) + let op0_base_fp_tmp_3fa46_7 = + (((((PackedUInt16::from_m31(memory_id_to_big_value_tmp_3fa46_2.get_m31(5))) >> (UInt16_3)) + ((PackedUInt16::from_m31( - memory_id_to_big_value_tmp_f459d_2.get_m31(6), + memory_id_to_big_value_tmp_3fa46_2.get_m31(6), )) << (UInt16_6))) >> (UInt16_1)) & (UInt16_1)); - let op0_base_fp_col7 = op0_base_fp_tmp_f459d_7.as_m31(); + let op0_base_fp_col7 = op0_base_fp_tmp_3fa46_7.as_m31(); *row[7] = op0_base_fp_col7; - let op1_base_fp_tmp_f459d_8 = - (((((PackedUInt16::from_m31(memory_id_to_big_value_tmp_f459d_2.get_m31(5))) + let op1_base_fp_tmp_3fa46_8 = + (((((PackedUInt16::from_m31(memory_id_to_big_value_tmp_3fa46_2.get_m31(5))) >> (UInt16_3)) + ((PackedUInt16::from_m31( - memory_id_to_big_value_tmp_f459d_2.get_m31(6), + memory_id_to_big_value_tmp_3fa46_2.get_m31(6), )) << (UInt16_6))) >> (UInt16_3)) & (UInt16_1)); - let op1_base_fp_col8 = op1_base_fp_tmp_f459d_8.as_m31(); + let op1_base_fp_col8 = op1_base_fp_tmp_3fa46_8.as_m31(); *row[8] = op1_base_fp_col8; - let op1_base_ap_tmp_f459d_9 = - (((((PackedUInt16::from_m31(memory_id_to_big_value_tmp_f459d_2.get_m31(5))) + let op1_base_ap_tmp_3fa46_9 = + (((((PackedUInt16::from_m31(memory_id_to_big_value_tmp_3fa46_2.get_m31(5))) >> (UInt16_3)) + ((PackedUInt16::from_m31( - memory_id_to_big_value_tmp_f459d_2.get_m31(6), + memory_id_to_big_value_tmp_3fa46_2.get_m31(6), )) << (UInt16_6))) >> (UInt16_4)) & (UInt16_1)); - let op1_base_ap_col9 = op1_base_ap_tmp_f459d_9.as_m31(); + let op1_base_ap_col9 = op1_base_ap_tmp_3fa46_9.as_m31(); *row[9] = op1_base_ap_col9; - let ap_update_add_1_tmp_f459d_10 = - (((((PackedUInt16::from_m31(memory_id_to_big_value_tmp_f459d_2.get_m31(5))) + let ap_update_add_1_tmp_3fa46_10 = + (((((PackedUInt16::from_m31(memory_id_to_big_value_tmp_3fa46_2.get_m31(5))) >> (UInt16_3)) + ((PackedUInt16::from_m31( - memory_id_to_big_value_tmp_f459d_2.get_m31(6), + memory_id_to_big_value_tmp_3fa46_2.get_m31(6), )) << (UInt16_6))) >> (UInt16_11)) & (UInt16_1)); - let ap_update_add_1_col10 = ap_update_add_1_tmp_f459d_10.as_m31(); + let ap_update_add_1_col10 = ap_update_add_1_tmp_3fa46_10.as_m31(); *row[10] = ap_update_add_1_col10; - for (i, &input) in ( input_pc_col0, [offset0_col3, offset1_col4, offset2_col5], @@ -324,11 +327,11 @@ fn write_trace_simd( // Read Positive Num Bits 252. - let memory_address_to_id_value_tmp_f459d_11 = memory_address_to_id_state + let memory_address_to_id_value_tmp_3fa46_11 = memory_address_to_id_state .deduce_output(((mem_dst_base_col11) + ((offset0_col3) - (M31_32768)))); - let memory_id_to_big_value_tmp_f459d_12 = - memory_id_to_big_state.deduce_output(memory_address_to_id_value_tmp_f459d_11); - let dst_id_col14 = memory_address_to_id_value_tmp_f459d_11; + let memory_id_to_big_value_tmp_3fa46_12 = + memory_id_to_big_state.deduce_output(memory_address_to_id_value_tmp_3fa46_11); + let dst_id_col14 = memory_address_to_id_value_tmp_3fa46_11; *row[14] = dst_id_col14; for (i, &input) in ((mem_dst_base_col11) + ((offset0_col3) - (M31_32768))) .unpack() @@ -341,61 +344,61 @@ fn write_trace_simd( ((mem_dst_base_col11) + ((offset0_col3) - (M31_32768))), dst_id_col14, ]; - let dst_limb_0_col15 = memory_id_to_big_value_tmp_f459d_12.get_m31(0); + let dst_limb_0_col15 = memory_id_to_big_value_tmp_3fa46_12.get_m31(0); *row[15] = dst_limb_0_col15; - let dst_limb_1_col16 = memory_id_to_big_value_tmp_f459d_12.get_m31(1); + let dst_limb_1_col16 = memory_id_to_big_value_tmp_3fa46_12.get_m31(1); *row[16] = dst_limb_1_col16; - let dst_limb_2_col17 = memory_id_to_big_value_tmp_f459d_12.get_m31(2); + let dst_limb_2_col17 = memory_id_to_big_value_tmp_3fa46_12.get_m31(2); *row[17] = dst_limb_2_col17; - let dst_limb_3_col18 = memory_id_to_big_value_tmp_f459d_12.get_m31(3); + let dst_limb_3_col18 = memory_id_to_big_value_tmp_3fa46_12.get_m31(3); *row[18] = dst_limb_3_col18; - let dst_limb_4_col19 = memory_id_to_big_value_tmp_f459d_12.get_m31(4); + let dst_limb_4_col19 = memory_id_to_big_value_tmp_3fa46_12.get_m31(4); *row[19] = dst_limb_4_col19; - let dst_limb_5_col20 = memory_id_to_big_value_tmp_f459d_12.get_m31(5); + let dst_limb_5_col20 = memory_id_to_big_value_tmp_3fa46_12.get_m31(5); *row[20] = dst_limb_5_col20; - let dst_limb_6_col21 = memory_id_to_big_value_tmp_f459d_12.get_m31(6); + let dst_limb_6_col21 = memory_id_to_big_value_tmp_3fa46_12.get_m31(6); *row[21] = dst_limb_6_col21; - let dst_limb_7_col22 = memory_id_to_big_value_tmp_f459d_12.get_m31(7); + let dst_limb_7_col22 = memory_id_to_big_value_tmp_3fa46_12.get_m31(7); *row[22] = dst_limb_7_col22; - let dst_limb_8_col23 = memory_id_to_big_value_tmp_f459d_12.get_m31(8); + let dst_limb_8_col23 = memory_id_to_big_value_tmp_3fa46_12.get_m31(8); *row[23] = dst_limb_8_col23; - let dst_limb_9_col24 = memory_id_to_big_value_tmp_f459d_12.get_m31(9); + let dst_limb_9_col24 = memory_id_to_big_value_tmp_3fa46_12.get_m31(9); *row[24] = dst_limb_9_col24; - let dst_limb_10_col25 = memory_id_to_big_value_tmp_f459d_12.get_m31(10); + let dst_limb_10_col25 = memory_id_to_big_value_tmp_3fa46_12.get_m31(10); *row[25] = dst_limb_10_col25; - let dst_limb_11_col26 = memory_id_to_big_value_tmp_f459d_12.get_m31(11); + let dst_limb_11_col26 = memory_id_to_big_value_tmp_3fa46_12.get_m31(11); *row[26] = dst_limb_11_col26; - let dst_limb_12_col27 = memory_id_to_big_value_tmp_f459d_12.get_m31(12); + let dst_limb_12_col27 = memory_id_to_big_value_tmp_3fa46_12.get_m31(12); *row[27] = dst_limb_12_col27; - let dst_limb_13_col28 = memory_id_to_big_value_tmp_f459d_12.get_m31(13); + let dst_limb_13_col28 = memory_id_to_big_value_tmp_3fa46_12.get_m31(13); *row[28] = dst_limb_13_col28; - let dst_limb_14_col29 = memory_id_to_big_value_tmp_f459d_12.get_m31(14); + let dst_limb_14_col29 = memory_id_to_big_value_tmp_3fa46_12.get_m31(14); *row[29] = dst_limb_14_col29; - let dst_limb_15_col30 = memory_id_to_big_value_tmp_f459d_12.get_m31(15); + let dst_limb_15_col30 = memory_id_to_big_value_tmp_3fa46_12.get_m31(15); *row[30] = dst_limb_15_col30; - let dst_limb_16_col31 = memory_id_to_big_value_tmp_f459d_12.get_m31(16); + let dst_limb_16_col31 = memory_id_to_big_value_tmp_3fa46_12.get_m31(16); *row[31] = dst_limb_16_col31; - let dst_limb_17_col32 = memory_id_to_big_value_tmp_f459d_12.get_m31(17); + let dst_limb_17_col32 = memory_id_to_big_value_tmp_3fa46_12.get_m31(17); *row[32] = dst_limb_17_col32; - let dst_limb_18_col33 = memory_id_to_big_value_tmp_f459d_12.get_m31(18); + let dst_limb_18_col33 = memory_id_to_big_value_tmp_3fa46_12.get_m31(18); *row[33] = dst_limb_18_col33; - let dst_limb_19_col34 = memory_id_to_big_value_tmp_f459d_12.get_m31(19); + let dst_limb_19_col34 = memory_id_to_big_value_tmp_3fa46_12.get_m31(19); *row[34] = dst_limb_19_col34; - let dst_limb_20_col35 = memory_id_to_big_value_tmp_f459d_12.get_m31(20); + let dst_limb_20_col35 = memory_id_to_big_value_tmp_3fa46_12.get_m31(20); *row[35] = dst_limb_20_col35; - let dst_limb_21_col36 = memory_id_to_big_value_tmp_f459d_12.get_m31(21); + let dst_limb_21_col36 = memory_id_to_big_value_tmp_3fa46_12.get_m31(21); *row[36] = dst_limb_21_col36; - let dst_limb_22_col37 = memory_id_to_big_value_tmp_f459d_12.get_m31(22); + let dst_limb_22_col37 = memory_id_to_big_value_tmp_3fa46_12.get_m31(22); *row[37] = dst_limb_22_col37; - let dst_limb_23_col38 = memory_id_to_big_value_tmp_f459d_12.get_m31(23); + let dst_limb_23_col38 = memory_id_to_big_value_tmp_3fa46_12.get_m31(23); *row[38] = dst_limb_23_col38; - let dst_limb_24_col39 = memory_id_to_big_value_tmp_f459d_12.get_m31(24); + let dst_limb_24_col39 = memory_id_to_big_value_tmp_3fa46_12.get_m31(24); *row[39] = dst_limb_24_col39; - let dst_limb_25_col40 = memory_id_to_big_value_tmp_f459d_12.get_m31(25); + let dst_limb_25_col40 = memory_id_to_big_value_tmp_3fa46_12.get_m31(25); *row[40] = dst_limb_25_col40; - let dst_limb_26_col41 = memory_id_to_big_value_tmp_f459d_12.get_m31(26); + let dst_limb_26_col41 = memory_id_to_big_value_tmp_3fa46_12.get_m31(26); *row[41] = dst_limb_26_col41; - let dst_limb_27_col42 = memory_id_to_big_value_tmp_f459d_12.get_m31(27); + let dst_limb_27_col42 = memory_id_to_big_value_tmp_3fa46_12.get_m31(27); *row[42] = dst_limb_27_col42; for (i, &input) in dst_id_col14.unpack().iter().enumerate() { *sub_components_inputs[i].memory_id_to_big_inputs[0] = input; @@ -434,11 +437,11 @@ fn write_trace_simd( // Read Positive Num Bits 252. - let memory_address_to_id_value_tmp_f459d_13 = memory_address_to_id_state + let memory_address_to_id_value_tmp_3fa46_13 = memory_address_to_id_state .deduce_output(((mem0_base_col12) + ((offset1_col4) - (M31_32768)))); - let memory_id_to_big_value_tmp_f459d_14 = - memory_id_to_big_state.deduce_output(memory_address_to_id_value_tmp_f459d_13); - let op0_id_col43 = memory_address_to_id_value_tmp_f459d_13; + let memory_id_to_big_value_tmp_3fa46_14 = + memory_id_to_big_state.deduce_output(memory_address_to_id_value_tmp_3fa46_13); + let op0_id_col43 = memory_address_to_id_value_tmp_3fa46_13; *row[43] = op0_id_col43; for (i, &input) in ((mem0_base_col12) + ((offset1_col4) - (M31_32768))) .unpack() @@ -451,61 +454,61 @@ fn write_trace_simd( ((mem0_base_col12) + ((offset1_col4) - (M31_32768))), op0_id_col43, ]; - let op0_limb_0_col44 = memory_id_to_big_value_tmp_f459d_14.get_m31(0); + let op0_limb_0_col44 = memory_id_to_big_value_tmp_3fa46_14.get_m31(0); *row[44] = op0_limb_0_col44; - let op0_limb_1_col45 = memory_id_to_big_value_tmp_f459d_14.get_m31(1); + let op0_limb_1_col45 = memory_id_to_big_value_tmp_3fa46_14.get_m31(1); *row[45] = op0_limb_1_col45; - let op0_limb_2_col46 = memory_id_to_big_value_tmp_f459d_14.get_m31(2); + let op0_limb_2_col46 = memory_id_to_big_value_tmp_3fa46_14.get_m31(2); *row[46] = op0_limb_2_col46; - let op0_limb_3_col47 = memory_id_to_big_value_tmp_f459d_14.get_m31(3); + let op0_limb_3_col47 = memory_id_to_big_value_tmp_3fa46_14.get_m31(3); *row[47] = op0_limb_3_col47; - let op0_limb_4_col48 = memory_id_to_big_value_tmp_f459d_14.get_m31(4); + let op0_limb_4_col48 = memory_id_to_big_value_tmp_3fa46_14.get_m31(4); *row[48] = op0_limb_4_col48; - let op0_limb_5_col49 = memory_id_to_big_value_tmp_f459d_14.get_m31(5); + let op0_limb_5_col49 = memory_id_to_big_value_tmp_3fa46_14.get_m31(5); *row[49] = op0_limb_5_col49; - let op0_limb_6_col50 = memory_id_to_big_value_tmp_f459d_14.get_m31(6); + let op0_limb_6_col50 = memory_id_to_big_value_tmp_3fa46_14.get_m31(6); *row[50] = op0_limb_6_col50; - let op0_limb_7_col51 = memory_id_to_big_value_tmp_f459d_14.get_m31(7); + let op0_limb_7_col51 = memory_id_to_big_value_tmp_3fa46_14.get_m31(7); *row[51] = op0_limb_7_col51; - let op0_limb_8_col52 = memory_id_to_big_value_tmp_f459d_14.get_m31(8); + let op0_limb_8_col52 = memory_id_to_big_value_tmp_3fa46_14.get_m31(8); *row[52] = op0_limb_8_col52; - let op0_limb_9_col53 = memory_id_to_big_value_tmp_f459d_14.get_m31(9); + let op0_limb_9_col53 = memory_id_to_big_value_tmp_3fa46_14.get_m31(9); *row[53] = op0_limb_9_col53; - let op0_limb_10_col54 = memory_id_to_big_value_tmp_f459d_14.get_m31(10); + let op0_limb_10_col54 = memory_id_to_big_value_tmp_3fa46_14.get_m31(10); *row[54] = op0_limb_10_col54; - let op0_limb_11_col55 = memory_id_to_big_value_tmp_f459d_14.get_m31(11); + let op0_limb_11_col55 = memory_id_to_big_value_tmp_3fa46_14.get_m31(11); *row[55] = op0_limb_11_col55; - let op0_limb_12_col56 = memory_id_to_big_value_tmp_f459d_14.get_m31(12); + let op0_limb_12_col56 = memory_id_to_big_value_tmp_3fa46_14.get_m31(12); *row[56] = op0_limb_12_col56; - let op0_limb_13_col57 = memory_id_to_big_value_tmp_f459d_14.get_m31(13); + let op0_limb_13_col57 = memory_id_to_big_value_tmp_3fa46_14.get_m31(13); *row[57] = op0_limb_13_col57; - let op0_limb_14_col58 = memory_id_to_big_value_tmp_f459d_14.get_m31(14); + let op0_limb_14_col58 = memory_id_to_big_value_tmp_3fa46_14.get_m31(14); *row[58] = op0_limb_14_col58; - let op0_limb_15_col59 = memory_id_to_big_value_tmp_f459d_14.get_m31(15); + let op0_limb_15_col59 = memory_id_to_big_value_tmp_3fa46_14.get_m31(15); *row[59] = op0_limb_15_col59; - let op0_limb_16_col60 = memory_id_to_big_value_tmp_f459d_14.get_m31(16); + let op0_limb_16_col60 = memory_id_to_big_value_tmp_3fa46_14.get_m31(16); *row[60] = op0_limb_16_col60; - let op0_limb_17_col61 = memory_id_to_big_value_tmp_f459d_14.get_m31(17); + let op0_limb_17_col61 = memory_id_to_big_value_tmp_3fa46_14.get_m31(17); *row[61] = op0_limb_17_col61; - let op0_limb_18_col62 = memory_id_to_big_value_tmp_f459d_14.get_m31(18); + let op0_limb_18_col62 = memory_id_to_big_value_tmp_3fa46_14.get_m31(18); *row[62] = op0_limb_18_col62; - let op0_limb_19_col63 = memory_id_to_big_value_tmp_f459d_14.get_m31(19); + let op0_limb_19_col63 = memory_id_to_big_value_tmp_3fa46_14.get_m31(19); *row[63] = op0_limb_19_col63; - let op0_limb_20_col64 = memory_id_to_big_value_tmp_f459d_14.get_m31(20); + let op0_limb_20_col64 = memory_id_to_big_value_tmp_3fa46_14.get_m31(20); *row[64] = op0_limb_20_col64; - let op0_limb_21_col65 = memory_id_to_big_value_tmp_f459d_14.get_m31(21); + let op0_limb_21_col65 = memory_id_to_big_value_tmp_3fa46_14.get_m31(21); *row[65] = op0_limb_21_col65; - let op0_limb_22_col66 = memory_id_to_big_value_tmp_f459d_14.get_m31(22); + let op0_limb_22_col66 = memory_id_to_big_value_tmp_3fa46_14.get_m31(22); *row[66] = op0_limb_22_col66; - let op0_limb_23_col67 = memory_id_to_big_value_tmp_f459d_14.get_m31(23); + let op0_limb_23_col67 = memory_id_to_big_value_tmp_3fa46_14.get_m31(23); *row[67] = op0_limb_23_col67; - let op0_limb_24_col68 = memory_id_to_big_value_tmp_f459d_14.get_m31(24); + let op0_limb_24_col68 = memory_id_to_big_value_tmp_3fa46_14.get_m31(24); *row[68] = op0_limb_24_col68; - let op0_limb_25_col69 = memory_id_to_big_value_tmp_f459d_14.get_m31(25); + let op0_limb_25_col69 = memory_id_to_big_value_tmp_3fa46_14.get_m31(25); *row[69] = op0_limb_25_col69; - let op0_limb_26_col70 = memory_id_to_big_value_tmp_f459d_14.get_m31(26); + let op0_limb_26_col70 = memory_id_to_big_value_tmp_3fa46_14.get_m31(26); *row[70] = op0_limb_26_col70; - let op0_limb_27_col71 = memory_id_to_big_value_tmp_f459d_14.get_m31(27); + let op0_limb_27_col71 = memory_id_to_big_value_tmp_3fa46_14.get_m31(27); *row[71] = op0_limb_27_col71; for (i, &input) in op0_id_col43.unpack().iter().enumerate() { *sub_components_inputs[i].memory_id_to_big_inputs[1] = input; @@ -544,11 +547,11 @@ fn write_trace_simd( // Read Positive Num Bits 252. - let memory_address_to_id_value_tmp_f459d_15 = memory_address_to_id_state + let memory_address_to_id_value_tmp_3fa46_15 = memory_address_to_id_state .deduce_output(((mem1_base_col13) + ((offset2_col5) - (M31_32768)))); - let memory_id_to_big_value_tmp_f459d_16 = - memory_id_to_big_state.deduce_output(memory_address_to_id_value_tmp_f459d_15); - let op1_id_col72 = memory_address_to_id_value_tmp_f459d_15; + let memory_id_to_big_value_tmp_3fa46_16 = + memory_id_to_big_state.deduce_output(memory_address_to_id_value_tmp_3fa46_15); + let op1_id_col72 = memory_address_to_id_value_tmp_3fa46_15; *row[72] = op1_id_col72; for (i, &input) in ((mem1_base_col13) + ((offset2_col5) - (M31_32768))) .unpack() @@ -561,61 +564,61 @@ fn write_trace_simd( ((mem1_base_col13) + ((offset2_col5) - (M31_32768))), op1_id_col72, ]; - let op1_limb_0_col73 = memory_id_to_big_value_tmp_f459d_16.get_m31(0); + let op1_limb_0_col73 = memory_id_to_big_value_tmp_3fa46_16.get_m31(0); *row[73] = op1_limb_0_col73; - let op1_limb_1_col74 = memory_id_to_big_value_tmp_f459d_16.get_m31(1); + let op1_limb_1_col74 = memory_id_to_big_value_tmp_3fa46_16.get_m31(1); *row[74] = op1_limb_1_col74; - let op1_limb_2_col75 = memory_id_to_big_value_tmp_f459d_16.get_m31(2); + let op1_limb_2_col75 = memory_id_to_big_value_tmp_3fa46_16.get_m31(2); *row[75] = op1_limb_2_col75; - let op1_limb_3_col76 = memory_id_to_big_value_tmp_f459d_16.get_m31(3); + let op1_limb_3_col76 = memory_id_to_big_value_tmp_3fa46_16.get_m31(3); *row[76] = op1_limb_3_col76; - let op1_limb_4_col77 = memory_id_to_big_value_tmp_f459d_16.get_m31(4); + let op1_limb_4_col77 = memory_id_to_big_value_tmp_3fa46_16.get_m31(4); *row[77] = op1_limb_4_col77; - let op1_limb_5_col78 = memory_id_to_big_value_tmp_f459d_16.get_m31(5); + let op1_limb_5_col78 = memory_id_to_big_value_tmp_3fa46_16.get_m31(5); *row[78] = op1_limb_5_col78; - let op1_limb_6_col79 = memory_id_to_big_value_tmp_f459d_16.get_m31(6); + let op1_limb_6_col79 = memory_id_to_big_value_tmp_3fa46_16.get_m31(6); *row[79] = op1_limb_6_col79; - let op1_limb_7_col80 = memory_id_to_big_value_tmp_f459d_16.get_m31(7); + let op1_limb_7_col80 = memory_id_to_big_value_tmp_3fa46_16.get_m31(7); *row[80] = op1_limb_7_col80; - let op1_limb_8_col81 = memory_id_to_big_value_tmp_f459d_16.get_m31(8); + let op1_limb_8_col81 = memory_id_to_big_value_tmp_3fa46_16.get_m31(8); *row[81] = op1_limb_8_col81; - let op1_limb_9_col82 = memory_id_to_big_value_tmp_f459d_16.get_m31(9); + let op1_limb_9_col82 = memory_id_to_big_value_tmp_3fa46_16.get_m31(9); *row[82] = op1_limb_9_col82; - let op1_limb_10_col83 = memory_id_to_big_value_tmp_f459d_16.get_m31(10); + let op1_limb_10_col83 = memory_id_to_big_value_tmp_3fa46_16.get_m31(10); *row[83] = op1_limb_10_col83; - let op1_limb_11_col84 = memory_id_to_big_value_tmp_f459d_16.get_m31(11); + let op1_limb_11_col84 = memory_id_to_big_value_tmp_3fa46_16.get_m31(11); *row[84] = op1_limb_11_col84; - let op1_limb_12_col85 = memory_id_to_big_value_tmp_f459d_16.get_m31(12); + let op1_limb_12_col85 = memory_id_to_big_value_tmp_3fa46_16.get_m31(12); *row[85] = op1_limb_12_col85; - let op1_limb_13_col86 = memory_id_to_big_value_tmp_f459d_16.get_m31(13); + let op1_limb_13_col86 = memory_id_to_big_value_tmp_3fa46_16.get_m31(13); *row[86] = op1_limb_13_col86; - let op1_limb_14_col87 = memory_id_to_big_value_tmp_f459d_16.get_m31(14); + let op1_limb_14_col87 = memory_id_to_big_value_tmp_3fa46_16.get_m31(14); *row[87] = op1_limb_14_col87; - let op1_limb_15_col88 = memory_id_to_big_value_tmp_f459d_16.get_m31(15); + let op1_limb_15_col88 = memory_id_to_big_value_tmp_3fa46_16.get_m31(15); *row[88] = op1_limb_15_col88; - let op1_limb_16_col89 = memory_id_to_big_value_tmp_f459d_16.get_m31(16); + let op1_limb_16_col89 = memory_id_to_big_value_tmp_3fa46_16.get_m31(16); *row[89] = op1_limb_16_col89; - let op1_limb_17_col90 = memory_id_to_big_value_tmp_f459d_16.get_m31(17); + let op1_limb_17_col90 = memory_id_to_big_value_tmp_3fa46_16.get_m31(17); *row[90] = op1_limb_17_col90; - let op1_limb_18_col91 = memory_id_to_big_value_tmp_f459d_16.get_m31(18); + let op1_limb_18_col91 = memory_id_to_big_value_tmp_3fa46_16.get_m31(18); *row[91] = op1_limb_18_col91; - let op1_limb_19_col92 = memory_id_to_big_value_tmp_f459d_16.get_m31(19); + let op1_limb_19_col92 = memory_id_to_big_value_tmp_3fa46_16.get_m31(19); *row[92] = op1_limb_19_col92; - let op1_limb_20_col93 = memory_id_to_big_value_tmp_f459d_16.get_m31(20); + let op1_limb_20_col93 = memory_id_to_big_value_tmp_3fa46_16.get_m31(20); *row[93] = op1_limb_20_col93; - let op1_limb_21_col94 = memory_id_to_big_value_tmp_f459d_16.get_m31(21); + let op1_limb_21_col94 = memory_id_to_big_value_tmp_3fa46_16.get_m31(21); *row[94] = op1_limb_21_col94; - let op1_limb_22_col95 = memory_id_to_big_value_tmp_f459d_16.get_m31(22); + let op1_limb_22_col95 = memory_id_to_big_value_tmp_3fa46_16.get_m31(22); *row[95] = op1_limb_22_col95; - let op1_limb_23_col96 = memory_id_to_big_value_tmp_f459d_16.get_m31(23); + let op1_limb_23_col96 = memory_id_to_big_value_tmp_3fa46_16.get_m31(23); *row[96] = op1_limb_23_col96; - let op1_limb_24_col97 = memory_id_to_big_value_tmp_f459d_16.get_m31(24); + let op1_limb_24_col97 = memory_id_to_big_value_tmp_3fa46_16.get_m31(24); *row[97] = op1_limb_24_col97; - let op1_limb_25_col98 = memory_id_to_big_value_tmp_f459d_16.get_m31(25); + let op1_limb_25_col98 = memory_id_to_big_value_tmp_3fa46_16.get_m31(25); *row[98] = op1_limb_25_col98; - let op1_limb_26_col99 = memory_id_to_big_value_tmp_f459d_16.get_m31(26); + let op1_limb_26_col99 = memory_id_to_big_value_tmp_3fa46_16.get_m31(26); *row[99] = op1_limb_26_col99; - let op1_limb_27_col100 = memory_id_to_big_value_tmp_f459d_16.get_m31(27); + let op1_limb_27_col100 = memory_id_to_big_value_tmp_3fa46_16.get_m31(27); *row[100] = op1_limb_27_col100; for (i, &input) in op1_id_col72.unpack().iter().enumerate() { *sub_components_inputs[i].memory_id_to_big_inputs[2] = input; @@ -654,11 +657,11 @@ fn write_trace_simd( // Verify Add 252. - let sub_p_bit_tmp_f459d_17 = ((UInt16_1) + let sub_p_bit_tmp_3fa46_17 = ((UInt16_1) & (((PackedUInt16::from_m31(op0_limb_0_col44)) ^ (PackedUInt16::from_m31(op1_limb_0_col73))) ^ (PackedUInt16::from_m31(dst_limb_0_col15)))); - let sub_p_bit_col101 = sub_p_bit_tmp_f459d_17.as_m31(); + let sub_p_bit_col101 = sub_p_bit_tmp_3fa46_17.as_m31(); *row[101] = sub_p_bit_col101; *lookup_data.opcodes_0 = [input_pc_col0, input_ap_col1, input_fp_col2]; diff --git a/stwo_cairo_prover/crates/prover/src/components/add_opcode_is_small_f_is_imm_t/component.rs b/stwo_cairo_prover/crates/prover/src/components/add_opcode_imm/component.rs similarity index 81% rename from stwo_cairo_prover/crates/prover/src/components/add_opcode_is_small_f_is_imm_t/component.rs rename to stwo_cairo_prover/crates/prover/src/components/add_opcode_imm/component.rs index f47b85c1..315c14ca 100644 --- a/stwo_cairo_prover/crates/prover/src/components/add_opcode_is_small_f_is_imm_t/component.rs +++ b/stwo_cairo_prover/crates/prover/src/components/add_opcode_imm/component.rs @@ -4,6 +4,7 @@ use num_traits::{One, Zero}; use serde::{Deserialize, Serialize}; use stwo_cairo_serialize::CairoSerialize; use stwo_prover::constraint_framework::logup::{LogupAtRow, LogupSums, LookupElements}; +use stwo_prover::constraint_framework::preprocessed_columns::PreprocessedColumn; use stwo_prover::constraint_framework::{ EvalAtRow, FrameworkComponent, FrameworkEval, RelationEntry, }; @@ -369,305 +370,305 @@ impl FrameworkEval for Eval { // sub_p_bit is a bit. eval.add_constraint((sub_p_bit_col97.clone() * (sub_p_bit_col97.clone() - M31_1.clone()))); - let carry_tmp_f0ae3_15 = eval.add_intermediate( + let carry_tmp_7e965_15 = eval.add_intermediate( (((((op0_limb_0_col40.clone() + op1_limb_0_col69.clone()) + M31_0.clone()) - dst_limb_0_col11.clone()) - (M31_1.clone() * sub_p_bit_col97.clone())) * M31_4194304.clone()), ); eval.add_constraint( - (carry_tmp_f0ae3_15.clone() - * ((carry_tmp_f0ae3_15.clone() * carry_tmp_f0ae3_15.clone()) - M31_1.clone())), + (carry_tmp_7e965_15.clone() + * ((carry_tmp_7e965_15.clone() * carry_tmp_7e965_15.clone()) - M31_1.clone())), ); - let carry_tmp_f0ae3_16 = eval.add_intermediate( + let carry_tmp_7e965_16 = eval.add_intermediate( (((((op0_limb_1_col41.clone() + op1_limb_1_col70.clone()) - + carry_tmp_f0ae3_15.clone()) + + carry_tmp_7e965_15.clone()) - dst_limb_1_col12.clone()) - (M31_0.clone() * sub_p_bit_col97.clone())) * M31_4194304.clone()), ); eval.add_constraint( - (carry_tmp_f0ae3_16.clone() - * ((carry_tmp_f0ae3_16.clone() * carry_tmp_f0ae3_16.clone()) - M31_1.clone())), + (carry_tmp_7e965_16.clone() + * ((carry_tmp_7e965_16.clone() * carry_tmp_7e965_16.clone()) - M31_1.clone())), ); - let carry_tmp_f0ae3_17 = eval.add_intermediate( + let carry_tmp_7e965_17 = eval.add_intermediate( (((((op0_limb_2_col42.clone() + op1_limb_2_col71.clone()) - + carry_tmp_f0ae3_16.clone()) + + carry_tmp_7e965_16.clone()) - dst_limb_2_col13.clone()) - (M31_0.clone() * sub_p_bit_col97.clone())) * M31_4194304.clone()), ); eval.add_constraint( - (carry_tmp_f0ae3_17.clone() - * ((carry_tmp_f0ae3_17.clone() * carry_tmp_f0ae3_17.clone()) - M31_1.clone())), + (carry_tmp_7e965_17.clone() + * ((carry_tmp_7e965_17.clone() * carry_tmp_7e965_17.clone()) - M31_1.clone())), ); - let carry_tmp_f0ae3_18 = eval.add_intermediate( + let carry_tmp_7e965_18 = eval.add_intermediate( (((((op0_limb_3_col43.clone() + op1_limb_3_col72.clone()) - + carry_tmp_f0ae3_17.clone()) + + carry_tmp_7e965_17.clone()) - dst_limb_3_col14.clone()) - (M31_0.clone() * sub_p_bit_col97.clone())) * M31_4194304.clone()), ); eval.add_constraint( - (carry_tmp_f0ae3_18.clone() - * ((carry_tmp_f0ae3_18.clone() * carry_tmp_f0ae3_18.clone()) - M31_1.clone())), + (carry_tmp_7e965_18.clone() + * ((carry_tmp_7e965_18.clone() * carry_tmp_7e965_18.clone()) - M31_1.clone())), ); - let carry_tmp_f0ae3_19 = eval.add_intermediate( + let carry_tmp_7e965_19 = eval.add_intermediate( (((((op0_limb_4_col44.clone() + op1_limb_4_col73.clone()) - + carry_tmp_f0ae3_18.clone()) + + carry_tmp_7e965_18.clone()) - dst_limb_4_col15.clone()) - (M31_0.clone() * sub_p_bit_col97.clone())) * M31_4194304.clone()), ); eval.add_constraint( - (carry_tmp_f0ae3_19.clone() - * ((carry_tmp_f0ae3_19.clone() * carry_tmp_f0ae3_19.clone()) - M31_1.clone())), + (carry_tmp_7e965_19.clone() + * ((carry_tmp_7e965_19.clone() * carry_tmp_7e965_19.clone()) - M31_1.clone())), ); - let carry_tmp_f0ae3_20 = eval.add_intermediate( + let carry_tmp_7e965_20 = eval.add_intermediate( (((((op0_limb_5_col45.clone() + op1_limb_5_col74.clone()) - + carry_tmp_f0ae3_19.clone()) + + carry_tmp_7e965_19.clone()) - dst_limb_5_col16.clone()) - (M31_0.clone() * sub_p_bit_col97.clone())) * M31_4194304.clone()), ); eval.add_constraint( - (carry_tmp_f0ae3_20.clone() - * ((carry_tmp_f0ae3_20.clone() * carry_tmp_f0ae3_20.clone()) - M31_1.clone())), + (carry_tmp_7e965_20.clone() + * ((carry_tmp_7e965_20.clone() * carry_tmp_7e965_20.clone()) - M31_1.clone())), ); - let carry_tmp_f0ae3_21 = eval.add_intermediate( + let carry_tmp_7e965_21 = eval.add_intermediate( (((((op0_limb_6_col46.clone() + op1_limb_6_col75.clone()) - + carry_tmp_f0ae3_20.clone()) + + carry_tmp_7e965_20.clone()) - dst_limb_6_col17.clone()) - (M31_0.clone() * sub_p_bit_col97.clone())) * M31_4194304.clone()), ); eval.add_constraint( - (carry_tmp_f0ae3_21.clone() - * ((carry_tmp_f0ae3_21.clone() * carry_tmp_f0ae3_21.clone()) - M31_1.clone())), + (carry_tmp_7e965_21.clone() + * ((carry_tmp_7e965_21.clone() * carry_tmp_7e965_21.clone()) - M31_1.clone())), ); - let carry_tmp_f0ae3_22 = eval.add_intermediate( + let carry_tmp_7e965_22 = eval.add_intermediate( (((((op0_limb_7_col47.clone() + op1_limb_7_col76.clone()) - + carry_tmp_f0ae3_21.clone()) + + carry_tmp_7e965_21.clone()) - dst_limb_7_col18.clone()) - (M31_0.clone() * sub_p_bit_col97.clone())) * M31_4194304.clone()), ); eval.add_constraint( - (carry_tmp_f0ae3_22.clone() - * ((carry_tmp_f0ae3_22.clone() * carry_tmp_f0ae3_22.clone()) - M31_1.clone())), + (carry_tmp_7e965_22.clone() + * ((carry_tmp_7e965_22.clone() * carry_tmp_7e965_22.clone()) - M31_1.clone())), ); - let carry_tmp_f0ae3_23 = eval.add_intermediate( + let carry_tmp_7e965_23 = eval.add_intermediate( (((((op0_limb_8_col48.clone() + op1_limb_8_col77.clone()) - + carry_tmp_f0ae3_22.clone()) + + carry_tmp_7e965_22.clone()) - dst_limb_8_col19.clone()) - (M31_0.clone() * sub_p_bit_col97.clone())) * M31_4194304.clone()), ); eval.add_constraint( - (carry_tmp_f0ae3_23.clone() - * ((carry_tmp_f0ae3_23.clone() * carry_tmp_f0ae3_23.clone()) - M31_1.clone())), + (carry_tmp_7e965_23.clone() + * ((carry_tmp_7e965_23.clone() * carry_tmp_7e965_23.clone()) - M31_1.clone())), ); - let carry_tmp_f0ae3_24 = eval.add_intermediate( + let carry_tmp_7e965_24 = eval.add_intermediate( (((((op0_limb_9_col49.clone() + op1_limb_9_col78.clone()) - + carry_tmp_f0ae3_23.clone()) + + carry_tmp_7e965_23.clone()) - dst_limb_9_col20.clone()) - (M31_0.clone() * sub_p_bit_col97.clone())) * M31_4194304.clone()), ); eval.add_constraint( - (carry_tmp_f0ae3_24.clone() - * ((carry_tmp_f0ae3_24.clone() * carry_tmp_f0ae3_24.clone()) - M31_1.clone())), + (carry_tmp_7e965_24.clone() + * ((carry_tmp_7e965_24.clone() * carry_tmp_7e965_24.clone()) - M31_1.clone())), ); - let carry_tmp_f0ae3_25 = eval.add_intermediate( + let carry_tmp_7e965_25 = eval.add_intermediate( (((((op0_limb_10_col50.clone() + op1_limb_10_col79.clone()) - + carry_tmp_f0ae3_24.clone()) + + carry_tmp_7e965_24.clone()) - dst_limb_10_col21.clone()) - (M31_0.clone() * sub_p_bit_col97.clone())) * M31_4194304.clone()), ); eval.add_constraint( - (carry_tmp_f0ae3_25.clone() - * ((carry_tmp_f0ae3_25.clone() * carry_tmp_f0ae3_25.clone()) - M31_1.clone())), + (carry_tmp_7e965_25.clone() + * ((carry_tmp_7e965_25.clone() * carry_tmp_7e965_25.clone()) - M31_1.clone())), ); - let carry_tmp_f0ae3_26 = eval.add_intermediate( + let carry_tmp_7e965_26 = eval.add_intermediate( (((((op0_limb_11_col51.clone() + op1_limb_11_col80.clone()) - + carry_tmp_f0ae3_25.clone()) + + carry_tmp_7e965_25.clone()) - dst_limb_11_col22.clone()) - (M31_0.clone() * sub_p_bit_col97.clone())) * M31_4194304.clone()), ); eval.add_constraint( - (carry_tmp_f0ae3_26.clone() - * ((carry_tmp_f0ae3_26.clone() * carry_tmp_f0ae3_26.clone()) - M31_1.clone())), + (carry_tmp_7e965_26.clone() + * ((carry_tmp_7e965_26.clone() * carry_tmp_7e965_26.clone()) - M31_1.clone())), ); - let carry_tmp_f0ae3_27 = eval.add_intermediate( + let carry_tmp_7e965_27 = eval.add_intermediate( (((((op0_limb_12_col52.clone() + op1_limb_12_col81.clone()) - + carry_tmp_f0ae3_26.clone()) + + carry_tmp_7e965_26.clone()) - dst_limb_12_col23.clone()) - (M31_0.clone() * sub_p_bit_col97.clone())) * M31_4194304.clone()), ); eval.add_constraint( - (carry_tmp_f0ae3_27.clone() - * ((carry_tmp_f0ae3_27.clone() * carry_tmp_f0ae3_27.clone()) - M31_1.clone())), + (carry_tmp_7e965_27.clone() + * ((carry_tmp_7e965_27.clone() * carry_tmp_7e965_27.clone()) - M31_1.clone())), ); - let carry_tmp_f0ae3_28 = eval.add_intermediate( + let carry_tmp_7e965_28 = eval.add_intermediate( (((((op0_limb_13_col53.clone() + op1_limb_13_col82.clone()) - + carry_tmp_f0ae3_27.clone()) + + carry_tmp_7e965_27.clone()) - dst_limb_13_col24.clone()) - (M31_0.clone() * sub_p_bit_col97.clone())) * M31_4194304.clone()), ); eval.add_constraint( - (carry_tmp_f0ae3_28.clone() - * ((carry_tmp_f0ae3_28.clone() * carry_tmp_f0ae3_28.clone()) - M31_1.clone())), + (carry_tmp_7e965_28.clone() + * ((carry_tmp_7e965_28.clone() * carry_tmp_7e965_28.clone()) - M31_1.clone())), ); - let carry_tmp_f0ae3_29 = eval.add_intermediate( + let carry_tmp_7e965_29 = eval.add_intermediate( (((((op0_limb_14_col54.clone() + op1_limb_14_col83.clone()) - + carry_tmp_f0ae3_28.clone()) + + carry_tmp_7e965_28.clone()) - dst_limb_14_col25.clone()) - (M31_0.clone() * sub_p_bit_col97.clone())) * M31_4194304.clone()), ); eval.add_constraint( - (carry_tmp_f0ae3_29.clone() - * ((carry_tmp_f0ae3_29.clone() * carry_tmp_f0ae3_29.clone()) - M31_1.clone())), + (carry_tmp_7e965_29.clone() + * ((carry_tmp_7e965_29.clone() * carry_tmp_7e965_29.clone()) - M31_1.clone())), ); - let carry_tmp_f0ae3_30 = eval.add_intermediate( + let carry_tmp_7e965_30 = eval.add_intermediate( (((((op0_limb_15_col55.clone() + op1_limb_15_col84.clone()) - + carry_tmp_f0ae3_29.clone()) + + carry_tmp_7e965_29.clone()) - dst_limb_15_col26.clone()) - (M31_0.clone() * sub_p_bit_col97.clone())) * M31_4194304.clone()), ); eval.add_constraint( - (carry_tmp_f0ae3_30.clone() - * ((carry_tmp_f0ae3_30.clone() * carry_tmp_f0ae3_30.clone()) - M31_1.clone())), + (carry_tmp_7e965_30.clone() + * ((carry_tmp_7e965_30.clone() * carry_tmp_7e965_30.clone()) - M31_1.clone())), ); - let carry_tmp_f0ae3_31 = eval.add_intermediate( + let carry_tmp_7e965_31 = eval.add_intermediate( (((((op0_limb_16_col56.clone() + op1_limb_16_col85.clone()) - + carry_tmp_f0ae3_30.clone()) + + carry_tmp_7e965_30.clone()) - dst_limb_16_col27.clone()) - (M31_0.clone() * sub_p_bit_col97.clone())) * M31_4194304.clone()), ); eval.add_constraint( - (carry_tmp_f0ae3_31.clone() - * ((carry_tmp_f0ae3_31.clone() * carry_tmp_f0ae3_31.clone()) - M31_1.clone())), + (carry_tmp_7e965_31.clone() + * ((carry_tmp_7e965_31.clone() * carry_tmp_7e965_31.clone()) - M31_1.clone())), ); - let carry_tmp_f0ae3_32 = eval.add_intermediate( + let carry_tmp_7e965_32 = eval.add_intermediate( (((((op0_limb_17_col57.clone() + op1_limb_17_col86.clone()) - + carry_tmp_f0ae3_31.clone()) + + carry_tmp_7e965_31.clone()) - dst_limb_17_col28.clone()) - (M31_0.clone() * sub_p_bit_col97.clone())) * M31_4194304.clone()), ); eval.add_constraint( - (carry_tmp_f0ae3_32.clone() - * ((carry_tmp_f0ae3_32.clone() * carry_tmp_f0ae3_32.clone()) - M31_1.clone())), + (carry_tmp_7e965_32.clone() + * ((carry_tmp_7e965_32.clone() * carry_tmp_7e965_32.clone()) - M31_1.clone())), ); - let carry_tmp_f0ae3_33 = eval.add_intermediate( + let carry_tmp_7e965_33 = eval.add_intermediate( (((((op0_limb_18_col58.clone() + op1_limb_18_col87.clone()) - + carry_tmp_f0ae3_32.clone()) + + carry_tmp_7e965_32.clone()) - dst_limb_18_col29.clone()) - (M31_0.clone() * sub_p_bit_col97.clone())) * M31_4194304.clone()), ); eval.add_constraint( - (carry_tmp_f0ae3_33.clone() - * ((carry_tmp_f0ae3_33.clone() * carry_tmp_f0ae3_33.clone()) - M31_1.clone())), + (carry_tmp_7e965_33.clone() + * ((carry_tmp_7e965_33.clone() * carry_tmp_7e965_33.clone()) - M31_1.clone())), ); - let carry_tmp_f0ae3_34 = eval.add_intermediate( + let carry_tmp_7e965_34 = eval.add_intermediate( (((((op0_limb_19_col59.clone() + op1_limb_19_col88.clone()) - + carry_tmp_f0ae3_33.clone()) + + carry_tmp_7e965_33.clone()) - dst_limb_19_col30.clone()) - (M31_0.clone() * sub_p_bit_col97.clone())) * M31_4194304.clone()), ); eval.add_constraint( - (carry_tmp_f0ae3_34.clone() - * ((carry_tmp_f0ae3_34.clone() * carry_tmp_f0ae3_34.clone()) - M31_1.clone())), + (carry_tmp_7e965_34.clone() + * ((carry_tmp_7e965_34.clone() * carry_tmp_7e965_34.clone()) - M31_1.clone())), ); - let carry_tmp_f0ae3_35 = eval.add_intermediate( + let carry_tmp_7e965_35 = eval.add_intermediate( (((((op0_limb_20_col60.clone() + op1_limb_20_col89.clone()) - + carry_tmp_f0ae3_34.clone()) + + carry_tmp_7e965_34.clone()) - dst_limb_20_col31.clone()) - (M31_0.clone() * sub_p_bit_col97.clone())) * M31_4194304.clone()), ); eval.add_constraint( - (carry_tmp_f0ae3_35.clone() - * ((carry_tmp_f0ae3_35.clone() * carry_tmp_f0ae3_35.clone()) - M31_1.clone())), + (carry_tmp_7e965_35.clone() + * ((carry_tmp_7e965_35.clone() * carry_tmp_7e965_35.clone()) - M31_1.clone())), ); - let carry_tmp_f0ae3_36 = eval.add_intermediate( + let carry_tmp_7e965_36 = eval.add_intermediate( (((((op0_limb_21_col61.clone() + op1_limb_21_col90.clone()) - + carry_tmp_f0ae3_35.clone()) + + carry_tmp_7e965_35.clone()) - dst_limb_21_col32.clone()) - (M31_136.clone() * sub_p_bit_col97.clone())) * M31_4194304.clone()), ); eval.add_constraint( - (carry_tmp_f0ae3_36.clone() - * ((carry_tmp_f0ae3_36.clone() * carry_tmp_f0ae3_36.clone()) - M31_1.clone())), + (carry_tmp_7e965_36.clone() + * ((carry_tmp_7e965_36.clone() * carry_tmp_7e965_36.clone()) - M31_1.clone())), ); - let carry_tmp_f0ae3_37 = eval.add_intermediate( + let carry_tmp_7e965_37 = eval.add_intermediate( (((((op0_limb_22_col62.clone() + op1_limb_22_col91.clone()) - + carry_tmp_f0ae3_36.clone()) + + carry_tmp_7e965_36.clone()) - dst_limb_22_col33.clone()) - (M31_0.clone() * sub_p_bit_col97.clone())) * M31_4194304.clone()), ); eval.add_constraint( - (carry_tmp_f0ae3_37.clone() - * ((carry_tmp_f0ae3_37.clone() * carry_tmp_f0ae3_37.clone()) - M31_1.clone())), + (carry_tmp_7e965_37.clone() + * ((carry_tmp_7e965_37.clone() * carry_tmp_7e965_37.clone()) - M31_1.clone())), ); - let carry_tmp_f0ae3_38 = eval.add_intermediate( + let carry_tmp_7e965_38 = eval.add_intermediate( (((((op0_limb_23_col63.clone() + op1_limb_23_col92.clone()) - + carry_tmp_f0ae3_37.clone()) + + carry_tmp_7e965_37.clone()) - dst_limb_23_col34.clone()) - (M31_0.clone() * sub_p_bit_col97.clone())) * M31_4194304.clone()), ); eval.add_constraint( - (carry_tmp_f0ae3_38.clone() - * ((carry_tmp_f0ae3_38.clone() * carry_tmp_f0ae3_38.clone()) - M31_1.clone())), + (carry_tmp_7e965_38.clone() + * ((carry_tmp_7e965_38.clone() * carry_tmp_7e965_38.clone()) - M31_1.clone())), ); - let carry_tmp_f0ae3_39 = eval.add_intermediate( + let carry_tmp_7e965_39 = eval.add_intermediate( (((((op0_limb_24_col64.clone() + op1_limb_24_col93.clone()) - + carry_tmp_f0ae3_38.clone()) + + carry_tmp_7e965_38.clone()) - dst_limb_24_col35.clone()) - (M31_0.clone() * sub_p_bit_col97.clone())) * M31_4194304.clone()), ); eval.add_constraint( - (carry_tmp_f0ae3_39.clone() - * ((carry_tmp_f0ae3_39.clone() * carry_tmp_f0ae3_39.clone()) - M31_1.clone())), + (carry_tmp_7e965_39.clone() + * ((carry_tmp_7e965_39.clone() * carry_tmp_7e965_39.clone()) - M31_1.clone())), ); - let carry_tmp_f0ae3_40 = eval.add_intermediate( + let carry_tmp_7e965_40 = eval.add_intermediate( (((((op0_limb_25_col65.clone() + op1_limb_25_col94.clone()) - + carry_tmp_f0ae3_39.clone()) + + carry_tmp_7e965_39.clone()) - dst_limb_25_col36.clone()) - (M31_0.clone() * sub_p_bit_col97.clone())) * M31_4194304.clone()), ); eval.add_constraint( - (carry_tmp_f0ae3_40.clone() - * ((carry_tmp_f0ae3_40.clone() * carry_tmp_f0ae3_40.clone()) - M31_1.clone())), + (carry_tmp_7e965_40.clone() + * ((carry_tmp_7e965_40.clone() * carry_tmp_7e965_40.clone()) - M31_1.clone())), ); - let carry_tmp_f0ae3_41 = eval.add_intermediate( + let carry_tmp_7e965_41 = eval.add_intermediate( (((((op0_limb_26_col66.clone() + op1_limb_26_col95.clone()) - + carry_tmp_f0ae3_40.clone()) + + carry_tmp_7e965_40.clone()) - dst_limb_26_col37.clone()) - (M31_0.clone() * sub_p_bit_col97.clone())) * M31_4194304.clone()), ); eval.add_constraint( - (carry_tmp_f0ae3_41.clone() - * ((carry_tmp_f0ae3_41.clone() * carry_tmp_f0ae3_41.clone()) - M31_1.clone())), + (carry_tmp_7e965_41.clone() + * ((carry_tmp_7e965_41.clone() * carry_tmp_7e965_41.clone()) - M31_1.clone())), ); eval.add_constraint( ((((op0_limb_27_col67.clone() + op1_limb_27_col96.clone()) - + carry_tmp_f0ae3_41.clone()) + + carry_tmp_7e965_41.clone()) - dst_limb_27_col38.clone()) - (M31_256.clone() * sub_p_bit_col97.clone())), ); diff --git a/stwo_cairo_prover/crates/prover/src/components/add_opcode_is_small_f_is_imm_t/mod.rs b/stwo_cairo_prover/crates/prover/src/components/add_opcode_imm/mod.rs similarity index 100% rename from stwo_cairo_prover/crates/prover/src/components/add_opcode_is_small_f_is_imm_t/mod.rs rename to stwo_cairo_prover/crates/prover/src/components/add_opcode_imm/mod.rs diff --git a/stwo_cairo_prover/crates/prover/src/components/add_opcode_is_small_f_is_imm_t/prover.rs b/stwo_cairo_prover/crates/prover/src/components/add_opcode_imm/prover.rs similarity index 86% rename from stwo_cairo_prover/crates/prover/src/components/add_opcode_is_small_f_is_imm_t/prover.rs rename to stwo_cairo_prover/crates/prover/src/components/add_opcode_imm/prover.rs index 564cf4be..8023ecee 100644 --- a/stwo_cairo_prover/crates/prover/src/components/add_opcode_is_small_f_is_imm_t/prover.rs +++ b/stwo_cairo_prover/crates/prover/src/components/add_opcode_imm/prover.rs @@ -7,10 +7,13 @@ use itertools::{chain, zip_eq, Itertools}; use num_traits::{One, Zero}; use prover_types::cpu::*; use prover_types::simd::*; -use rayon::iter::{IndexedParallelIterator, IntoParallelRefIterator, ParallelIterator}; +use rayon::iter::{ + IndexedParallelIterator, IntoParallelIterator, IntoParallelRefIterator, ParallelIterator, +}; use stwo_air_utils::trace::component_trace::ComponentTrace; use stwo_air_utils_derive::{IterMut, ParIterMut, Uninitialized}; use stwo_prover::constraint_framework::logup::LogupTraceGenerator; +use stwo_prover::constraint_framework::preprocessed_columns::PreprocessedColumn; use stwo_prover::constraint_framework::Relation; use stwo_prover::core::air::Component; use stwo_prover::core::backend::simd::column::BaseColumn; @@ -21,6 +24,7 @@ use stwo_prover::core::backend::simd::SimdBackend; use stwo_prover::core::backend::{BackendForChannel, Col, Column}; use stwo_prover::core::channel::{Channel, MerkleChannel}; use stwo_prover::core::fields::m31::M31; +use stwo_prover::core::fields::FieldExpOps; use stwo_prover::core::pcs::TreeBuilder; use stwo_prover::core::poly::circle::{CanonicCoset, CircleEvaluation}; use stwo_prover::core::poly::BitReversedOrder; @@ -66,6 +70,7 @@ impl ClaimGenerator { let packed_inputs = pack_values(&self.inputs); let (trace, mut sub_components_inputs, lookup_data) = write_trace_simd( + n_rows, packed_inputs, memory_address_to_id_state, memory_id_to_big_state, @@ -104,8 +109,8 @@ impl ClaimGenerator { ) } - pub fn add_inputs(&mut self, inputs: &[InputType]) { - self.inputs.extend(inputs); + pub fn add_inputs(&self, _inputs: &[InputType]) { + unimplemented!("Implement manually"); } } @@ -121,6 +126,7 @@ pub struct SubComponentInputs { #[allow(clippy::double_parens)] #[allow(non_snake_case)] fn write_trace_simd( + n_rows: usize, inputs: Vec, memory_address_to_id_state: &memory_address_to_id::ClaimGenerator, memory_id_to_big_state: &memory_id_to_big::ClaimGenerator, @@ -157,79 +163,79 @@ fn write_trace_simd( trace .par_iter_mut() - .zip(inputs.par_iter()) + .enumerate() + .zip(inputs.into_par_iter()) .zip(lookup_data.par_iter_mut()) .zip(sub_components_inputs.par_iter_mut().chunks(N_LANES)) .for_each( |( - ((row, add_opcode_is_small_f_is_imm_t_input), lookup_data), + (((row_index, row), add_opcode_imm_input), lookup_data), mut sub_components_inputs, )| { - let input_tmp_f0ae3_0 = add_opcode_is_small_f_is_imm_t_input; - let input_pc_col0 = input_tmp_f0ae3_0.pc; + let input_tmp_7e965_0 = add_opcode_imm_input; + let input_pc_col0 = input_tmp_7e965_0.pc; *row[0] = input_pc_col0; - let input_ap_col1 = input_tmp_f0ae3_0.ap; + let input_ap_col1 = input_tmp_7e965_0.ap; *row[1] = input_ap_col1; - let input_fp_col2 = input_tmp_f0ae3_0.fp; + let input_fp_col2 = input_tmp_7e965_0.fp; *row[2] = input_fp_col2; // Decode Instruction. - let memory_address_to_id_value_tmp_f0ae3_1 = + let memory_address_to_id_value_tmp_7e965_1 = memory_address_to_id_state.deduce_output(input_pc_col0); - let memory_id_to_big_value_tmp_f0ae3_2 = - memory_id_to_big_state.deduce_output(memory_address_to_id_value_tmp_f0ae3_1); - let offset0_tmp_f0ae3_3 = - ((PackedUInt16::from_m31(memory_id_to_big_value_tmp_f0ae3_2.get_m31(0))) + let memory_id_to_big_value_tmp_7e965_2 = + memory_id_to_big_state.deduce_output(memory_address_to_id_value_tmp_7e965_1); + let offset0_tmp_7e965_3 = + ((PackedUInt16::from_m31(memory_id_to_big_value_tmp_7e965_2.get_m31(0))) + (((PackedUInt16::from_m31( - memory_id_to_big_value_tmp_f0ae3_2.get_m31(1), + memory_id_to_big_value_tmp_7e965_2.get_m31(1), )) & (UInt16_127)) << (UInt16_9))); - let offset0_col3 = offset0_tmp_f0ae3_3.as_m31(); + let offset0_col3 = offset0_tmp_7e965_3.as_m31(); *row[3] = offset0_col3; - let offset1_tmp_f0ae3_4 = - ((((PackedUInt16::from_m31(memory_id_to_big_value_tmp_f0ae3_2.get_m31(1))) + let offset1_tmp_7e965_4 = + ((((PackedUInt16::from_m31(memory_id_to_big_value_tmp_7e965_2.get_m31(1))) >> (UInt16_7)) + ((PackedUInt16::from_m31( - memory_id_to_big_value_tmp_f0ae3_2.get_m31(2), + memory_id_to_big_value_tmp_7e965_2.get_m31(2), )) << (UInt16_2))) + (((PackedUInt16::from_m31( - memory_id_to_big_value_tmp_f0ae3_2.get_m31(3), + memory_id_to_big_value_tmp_7e965_2.get_m31(3), )) & (UInt16_31)) << (UInt16_11))); - let offset1_col4 = offset1_tmp_f0ae3_4.as_m31(); + let offset1_col4 = offset1_tmp_7e965_4.as_m31(); *row[4] = offset1_col4; - let dst_base_fp_tmp_f0ae3_5 = - (((((PackedUInt16::from_m31(memory_id_to_big_value_tmp_f0ae3_2.get_m31(5))) + let dst_base_fp_tmp_7e965_5 = + (((((PackedUInt16::from_m31(memory_id_to_big_value_tmp_7e965_2.get_m31(5))) >> (UInt16_3)) + ((PackedUInt16::from_m31( - memory_id_to_big_value_tmp_f0ae3_2.get_m31(6), + memory_id_to_big_value_tmp_7e965_2.get_m31(6), )) << (UInt16_6))) >> (UInt16_0)) & (UInt16_1)); - let dst_base_fp_col5 = dst_base_fp_tmp_f0ae3_5.as_m31(); + let dst_base_fp_col5 = dst_base_fp_tmp_7e965_5.as_m31(); *row[5] = dst_base_fp_col5; - let op0_base_fp_tmp_f0ae3_6 = - (((((PackedUInt16::from_m31(memory_id_to_big_value_tmp_f0ae3_2.get_m31(5))) + let op0_base_fp_tmp_7e965_6 = + (((((PackedUInt16::from_m31(memory_id_to_big_value_tmp_7e965_2.get_m31(5))) >> (UInt16_3)) + ((PackedUInt16::from_m31( - memory_id_to_big_value_tmp_f0ae3_2.get_m31(6), + memory_id_to_big_value_tmp_7e965_2.get_m31(6), )) << (UInt16_6))) >> (UInt16_1)) & (UInt16_1)); - let op0_base_fp_col6 = op0_base_fp_tmp_f0ae3_6.as_m31(); + let op0_base_fp_col6 = op0_base_fp_tmp_7e965_6.as_m31(); *row[6] = op0_base_fp_col6; - let ap_update_add_1_tmp_f0ae3_7 = - (((((PackedUInt16::from_m31(memory_id_to_big_value_tmp_f0ae3_2.get_m31(5))) + let ap_update_add_1_tmp_7e965_7 = + (((((PackedUInt16::from_m31(memory_id_to_big_value_tmp_7e965_2.get_m31(5))) >> (UInt16_3)) + ((PackedUInt16::from_m31( - memory_id_to_big_value_tmp_f0ae3_2.get_m31(6), + memory_id_to_big_value_tmp_7e965_2.get_m31(6), )) << (UInt16_6))) >> (UInt16_11)) & (UInt16_1)); - let ap_update_add_1_col7 = ap_update_add_1_tmp_f0ae3_7.as_m31(); + let ap_update_add_1_col7 = ap_update_add_1_tmp_7e965_7.as_m31(); *row[7] = ap_update_add_1_col7; - for (i, &input) in ( input_pc_col0, [offset0_col3, offset1_col4, M31_32769], @@ -288,11 +294,11 @@ fn write_trace_simd( // Read Positive Num Bits 252. - let memory_address_to_id_value_tmp_f0ae3_8 = memory_address_to_id_state + let memory_address_to_id_value_tmp_7e965_8 = memory_address_to_id_state .deduce_output(((mem_dst_base_col8) + ((offset0_col3) - (M31_32768)))); - let memory_id_to_big_value_tmp_f0ae3_9 = - memory_id_to_big_state.deduce_output(memory_address_to_id_value_tmp_f0ae3_8); - let dst_id_col10 = memory_address_to_id_value_tmp_f0ae3_8; + let memory_id_to_big_value_tmp_7e965_9 = + memory_id_to_big_state.deduce_output(memory_address_to_id_value_tmp_7e965_8); + let dst_id_col10 = memory_address_to_id_value_tmp_7e965_8; *row[10] = dst_id_col10; for (i, &input) in ((mem_dst_base_col8) + ((offset0_col3) - (M31_32768))) .unpack() @@ -305,61 +311,61 @@ fn write_trace_simd( ((mem_dst_base_col8) + ((offset0_col3) - (M31_32768))), dst_id_col10, ]; - let dst_limb_0_col11 = memory_id_to_big_value_tmp_f0ae3_9.get_m31(0); + let dst_limb_0_col11 = memory_id_to_big_value_tmp_7e965_9.get_m31(0); *row[11] = dst_limb_0_col11; - let dst_limb_1_col12 = memory_id_to_big_value_tmp_f0ae3_9.get_m31(1); + let dst_limb_1_col12 = memory_id_to_big_value_tmp_7e965_9.get_m31(1); *row[12] = dst_limb_1_col12; - let dst_limb_2_col13 = memory_id_to_big_value_tmp_f0ae3_9.get_m31(2); + let dst_limb_2_col13 = memory_id_to_big_value_tmp_7e965_9.get_m31(2); *row[13] = dst_limb_2_col13; - let dst_limb_3_col14 = memory_id_to_big_value_tmp_f0ae3_9.get_m31(3); + let dst_limb_3_col14 = memory_id_to_big_value_tmp_7e965_9.get_m31(3); *row[14] = dst_limb_3_col14; - let dst_limb_4_col15 = memory_id_to_big_value_tmp_f0ae3_9.get_m31(4); + let dst_limb_4_col15 = memory_id_to_big_value_tmp_7e965_9.get_m31(4); *row[15] = dst_limb_4_col15; - let dst_limb_5_col16 = memory_id_to_big_value_tmp_f0ae3_9.get_m31(5); + let dst_limb_5_col16 = memory_id_to_big_value_tmp_7e965_9.get_m31(5); *row[16] = dst_limb_5_col16; - let dst_limb_6_col17 = memory_id_to_big_value_tmp_f0ae3_9.get_m31(6); + let dst_limb_6_col17 = memory_id_to_big_value_tmp_7e965_9.get_m31(6); *row[17] = dst_limb_6_col17; - let dst_limb_7_col18 = memory_id_to_big_value_tmp_f0ae3_9.get_m31(7); + let dst_limb_7_col18 = memory_id_to_big_value_tmp_7e965_9.get_m31(7); *row[18] = dst_limb_7_col18; - let dst_limb_8_col19 = memory_id_to_big_value_tmp_f0ae3_9.get_m31(8); + let dst_limb_8_col19 = memory_id_to_big_value_tmp_7e965_9.get_m31(8); *row[19] = dst_limb_8_col19; - let dst_limb_9_col20 = memory_id_to_big_value_tmp_f0ae3_9.get_m31(9); + let dst_limb_9_col20 = memory_id_to_big_value_tmp_7e965_9.get_m31(9); *row[20] = dst_limb_9_col20; - let dst_limb_10_col21 = memory_id_to_big_value_tmp_f0ae3_9.get_m31(10); + let dst_limb_10_col21 = memory_id_to_big_value_tmp_7e965_9.get_m31(10); *row[21] = dst_limb_10_col21; - let dst_limb_11_col22 = memory_id_to_big_value_tmp_f0ae3_9.get_m31(11); + let dst_limb_11_col22 = memory_id_to_big_value_tmp_7e965_9.get_m31(11); *row[22] = dst_limb_11_col22; - let dst_limb_12_col23 = memory_id_to_big_value_tmp_f0ae3_9.get_m31(12); + let dst_limb_12_col23 = memory_id_to_big_value_tmp_7e965_9.get_m31(12); *row[23] = dst_limb_12_col23; - let dst_limb_13_col24 = memory_id_to_big_value_tmp_f0ae3_9.get_m31(13); + let dst_limb_13_col24 = memory_id_to_big_value_tmp_7e965_9.get_m31(13); *row[24] = dst_limb_13_col24; - let dst_limb_14_col25 = memory_id_to_big_value_tmp_f0ae3_9.get_m31(14); + let dst_limb_14_col25 = memory_id_to_big_value_tmp_7e965_9.get_m31(14); *row[25] = dst_limb_14_col25; - let dst_limb_15_col26 = memory_id_to_big_value_tmp_f0ae3_9.get_m31(15); + let dst_limb_15_col26 = memory_id_to_big_value_tmp_7e965_9.get_m31(15); *row[26] = dst_limb_15_col26; - let dst_limb_16_col27 = memory_id_to_big_value_tmp_f0ae3_9.get_m31(16); + let dst_limb_16_col27 = memory_id_to_big_value_tmp_7e965_9.get_m31(16); *row[27] = dst_limb_16_col27; - let dst_limb_17_col28 = memory_id_to_big_value_tmp_f0ae3_9.get_m31(17); + let dst_limb_17_col28 = memory_id_to_big_value_tmp_7e965_9.get_m31(17); *row[28] = dst_limb_17_col28; - let dst_limb_18_col29 = memory_id_to_big_value_tmp_f0ae3_9.get_m31(18); + let dst_limb_18_col29 = memory_id_to_big_value_tmp_7e965_9.get_m31(18); *row[29] = dst_limb_18_col29; - let dst_limb_19_col30 = memory_id_to_big_value_tmp_f0ae3_9.get_m31(19); + let dst_limb_19_col30 = memory_id_to_big_value_tmp_7e965_9.get_m31(19); *row[30] = dst_limb_19_col30; - let dst_limb_20_col31 = memory_id_to_big_value_tmp_f0ae3_9.get_m31(20); + let dst_limb_20_col31 = memory_id_to_big_value_tmp_7e965_9.get_m31(20); *row[31] = dst_limb_20_col31; - let dst_limb_21_col32 = memory_id_to_big_value_tmp_f0ae3_9.get_m31(21); + let dst_limb_21_col32 = memory_id_to_big_value_tmp_7e965_9.get_m31(21); *row[32] = dst_limb_21_col32; - let dst_limb_22_col33 = memory_id_to_big_value_tmp_f0ae3_9.get_m31(22); + let dst_limb_22_col33 = memory_id_to_big_value_tmp_7e965_9.get_m31(22); *row[33] = dst_limb_22_col33; - let dst_limb_23_col34 = memory_id_to_big_value_tmp_f0ae3_9.get_m31(23); + let dst_limb_23_col34 = memory_id_to_big_value_tmp_7e965_9.get_m31(23); *row[34] = dst_limb_23_col34; - let dst_limb_24_col35 = memory_id_to_big_value_tmp_f0ae3_9.get_m31(24); + let dst_limb_24_col35 = memory_id_to_big_value_tmp_7e965_9.get_m31(24); *row[35] = dst_limb_24_col35; - let dst_limb_25_col36 = memory_id_to_big_value_tmp_f0ae3_9.get_m31(25); + let dst_limb_25_col36 = memory_id_to_big_value_tmp_7e965_9.get_m31(25); *row[36] = dst_limb_25_col36; - let dst_limb_26_col37 = memory_id_to_big_value_tmp_f0ae3_9.get_m31(26); + let dst_limb_26_col37 = memory_id_to_big_value_tmp_7e965_9.get_m31(26); *row[37] = dst_limb_26_col37; - let dst_limb_27_col38 = memory_id_to_big_value_tmp_f0ae3_9.get_m31(27); + let dst_limb_27_col38 = memory_id_to_big_value_tmp_7e965_9.get_m31(27); *row[38] = dst_limb_27_col38; for (i, &input) in dst_id_col10.unpack().iter().enumerate() { *sub_components_inputs[i].memory_id_to_big_inputs[0] = input; @@ -398,11 +404,11 @@ fn write_trace_simd( // Read Positive Num Bits 252. - let memory_address_to_id_value_tmp_f0ae3_10 = memory_address_to_id_state + let memory_address_to_id_value_tmp_7e965_10 = memory_address_to_id_state .deduce_output(((mem0_base_col9) + ((offset1_col4) - (M31_32768)))); - let memory_id_to_big_value_tmp_f0ae3_11 = - memory_id_to_big_state.deduce_output(memory_address_to_id_value_tmp_f0ae3_10); - let op0_id_col39 = memory_address_to_id_value_tmp_f0ae3_10; + let memory_id_to_big_value_tmp_7e965_11 = + memory_id_to_big_state.deduce_output(memory_address_to_id_value_tmp_7e965_10); + let op0_id_col39 = memory_address_to_id_value_tmp_7e965_10; *row[39] = op0_id_col39; for (i, &input) in ((mem0_base_col9) + ((offset1_col4) - (M31_32768))) .unpack() @@ -415,61 +421,61 @@ fn write_trace_simd( ((mem0_base_col9) + ((offset1_col4) - (M31_32768))), op0_id_col39, ]; - let op0_limb_0_col40 = memory_id_to_big_value_tmp_f0ae3_11.get_m31(0); + let op0_limb_0_col40 = memory_id_to_big_value_tmp_7e965_11.get_m31(0); *row[40] = op0_limb_0_col40; - let op0_limb_1_col41 = memory_id_to_big_value_tmp_f0ae3_11.get_m31(1); + let op0_limb_1_col41 = memory_id_to_big_value_tmp_7e965_11.get_m31(1); *row[41] = op0_limb_1_col41; - let op0_limb_2_col42 = memory_id_to_big_value_tmp_f0ae3_11.get_m31(2); + let op0_limb_2_col42 = memory_id_to_big_value_tmp_7e965_11.get_m31(2); *row[42] = op0_limb_2_col42; - let op0_limb_3_col43 = memory_id_to_big_value_tmp_f0ae3_11.get_m31(3); + let op0_limb_3_col43 = memory_id_to_big_value_tmp_7e965_11.get_m31(3); *row[43] = op0_limb_3_col43; - let op0_limb_4_col44 = memory_id_to_big_value_tmp_f0ae3_11.get_m31(4); + let op0_limb_4_col44 = memory_id_to_big_value_tmp_7e965_11.get_m31(4); *row[44] = op0_limb_4_col44; - let op0_limb_5_col45 = memory_id_to_big_value_tmp_f0ae3_11.get_m31(5); + let op0_limb_5_col45 = memory_id_to_big_value_tmp_7e965_11.get_m31(5); *row[45] = op0_limb_5_col45; - let op0_limb_6_col46 = memory_id_to_big_value_tmp_f0ae3_11.get_m31(6); + let op0_limb_6_col46 = memory_id_to_big_value_tmp_7e965_11.get_m31(6); *row[46] = op0_limb_6_col46; - let op0_limb_7_col47 = memory_id_to_big_value_tmp_f0ae3_11.get_m31(7); + let op0_limb_7_col47 = memory_id_to_big_value_tmp_7e965_11.get_m31(7); *row[47] = op0_limb_7_col47; - let op0_limb_8_col48 = memory_id_to_big_value_tmp_f0ae3_11.get_m31(8); + let op0_limb_8_col48 = memory_id_to_big_value_tmp_7e965_11.get_m31(8); *row[48] = op0_limb_8_col48; - let op0_limb_9_col49 = memory_id_to_big_value_tmp_f0ae3_11.get_m31(9); + let op0_limb_9_col49 = memory_id_to_big_value_tmp_7e965_11.get_m31(9); *row[49] = op0_limb_9_col49; - let op0_limb_10_col50 = memory_id_to_big_value_tmp_f0ae3_11.get_m31(10); + let op0_limb_10_col50 = memory_id_to_big_value_tmp_7e965_11.get_m31(10); *row[50] = op0_limb_10_col50; - let op0_limb_11_col51 = memory_id_to_big_value_tmp_f0ae3_11.get_m31(11); + let op0_limb_11_col51 = memory_id_to_big_value_tmp_7e965_11.get_m31(11); *row[51] = op0_limb_11_col51; - let op0_limb_12_col52 = memory_id_to_big_value_tmp_f0ae3_11.get_m31(12); + let op0_limb_12_col52 = memory_id_to_big_value_tmp_7e965_11.get_m31(12); *row[52] = op0_limb_12_col52; - let op0_limb_13_col53 = memory_id_to_big_value_tmp_f0ae3_11.get_m31(13); + let op0_limb_13_col53 = memory_id_to_big_value_tmp_7e965_11.get_m31(13); *row[53] = op0_limb_13_col53; - let op0_limb_14_col54 = memory_id_to_big_value_tmp_f0ae3_11.get_m31(14); + let op0_limb_14_col54 = memory_id_to_big_value_tmp_7e965_11.get_m31(14); *row[54] = op0_limb_14_col54; - let op0_limb_15_col55 = memory_id_to_big_value_tmp_f0ae3_11.get_m31(15); + let op0_limb_15_col55 = memory_id_to_big_value_tmp_7e965_11.get_m31(15); *row[55] = op0_limb_15_col55; - let op0_limb_16_col56 = memory_id_to_big_value_tmp_f0ae3_11.get_m31(16); + let op0_limb_16_col56 = memory_id_to_big_value_tmp_7e965_11.get_m31(16); *row[56] = op0_limb_16_col56; - let op0_limb_17_col57 = memory_id_to_big_value_tmp_f0ae3_11.get_m31(17); + let op0_limb_17_col57 = memory_id_to_big_value_tmp_7e965_11.get_m31(17); *row[57] = op0_limb_17_col57; - let op0_limb_18_col58 = memory_id_to_big_value_tmp_f0ae3_11.get_m31(18); + let op0_limb_18_col58 = memory_id_to_big_value_tmp_7e965_11.get_m31(18); *row[58] = op0_limb_18_col58; - let op0_limb_19_col59 = memory_id_to_big_value_tmp_f0ae3_11.get_m31(19); + let op0_limb_19_col59 = memory_id_to_big_value_tmp_7e965_11.get_m31(19); *row[59] = op0_limb_19_col59; - let op0_limb_20_col60 = memory_id_to_big_value_tmp_f0ae3_11.get_m31(20); + let op0_limb_20_col60 = memory_id_to_big_value_tmp_7e965_11.get_m31(20); *row[60] = op0_limb_20_col60; - let op0_limb_21_col61 = memory_id_to_big_value_tmp_f0ae3_11.get_m31(21); + let op0_limb_21_col61 = memory_id_to_big_value_tmp_7e965_11.get_m31(21); *row[61] = op0_limb_21_col61; - let op0_limb_22_col62 = memory_id_to_big_value_tmp_f0ae3_11.get_m31(22); + let op0_limb_22_col62 = memory_id_to_big_value_tmp_7e965_11.get_m31(22); *row[62] = op0_limb_22_col62; - let op0_limb_23_col63 = memory_id_to_big_value_tmp_f0ae3_11.get_m31(23); + let op0_limb_23_col63 = memory_id_to_big_value_tmp_7e965_11.get_m31(23); *row[63] = op0_limb_23_col63; - let op0_limb_24_col64 = memory_id_to_big_value_tmp_f0ae3_11.get_m31(24); + let op0_limb_24_col64 = memory_id_to_big_value_tmp_7e965_11.get_m31(24); *row[64] = op0_limb_24_col64; - let op0_limb_25_col65 = memory_id_to_big_value_tmp_f0ae3_11.get_m31(25); + let op0_limb_25_col65 = memory_id_to_big_value_tmp_7e965_11.get_m31(25); *row[65] = op0_limb_25_col65; - let op0_limb_26_col66 = memory_id_to_big_value_tmp_f0ae3_11.get_m31(26); + let op0_limb_26_col66 = memory_id_to_big_value_tmp_7e965_11.get_m31(26); *row[66] = op0_limb_26_col66; - let op0_limb_27_col67 = memory_id_to_big_value_tmp_f0ae3_11.get_m31(27); + let op0_limb_27_col67 = memory_id_to_big_value_tmp_7e965_11.get_m31(27); *row[67] = op0_limb_27_col67; for (i, &input) in op0_id_col39.unpack().iter().enumerate() { *sub_components_inputs[i].memory_id_to_big_inputs[1] = input; @@ -508,71 +514,71 @@ fn write_trace_simd( // Read Positive Num Bits 252. - let memory_address_to_id_value_tmp_f0ae3_12 = + let memory_address_to_id_value_tmp_7e965_12 = memory_address_to_id_state.deduce_output(((input_pc_col0) + (M31_1))); - let memory_id_to_big_value_tmp_f0ae3_13 = - memory_id_to_big_state.deduce_output(memory_address_to_id_value_tmp_f0ae3_12); - let op1_id_col68 = memory_address_to_id_value_tmp_f0ae3_12; + let memory_id_to_big_value_tmp_7e965_13 = + memory_id_to_big_state.deduce_output(memory_address_to_id_value_tmp_7e965_12); + let op1_id_col68 = memory_address_to_id_value_tmp_7e965_12; *row[68] = op1_id_col68; for (i, &input) in ((input_pc_col0) + (M31_1)).unpack().iter().enumerate() { *sub_components_inputs[i].memory_address_to_id_inputs[2] = input; } *lookup_data.memory_address_to_id_2 = [((input_pc_col0) + (M31_1)), op1_id_col68]; - let op1_limb_0_col69 = memory_id_to_big_value_tmp_f0ae3_13.get_m31(0); + let op1_limb_0_col69 = memory_id_to_big_value_tmp_7e965_13.get_m31(0); *row[69] = op1_limb_0_col69; - let op1_limb_1_col70 = memory_id_to_big_value_tmp_f0ae3_13.get_m31(1); + let op1_limb_1_col70 = memory_id_to_big_value_tmp_7e965_13.get_m31(1); *row[70] = op1_limb_1_col70; - let op1_limb_2_col71 = memory_id_to_big_value_tmp_f0ae3_13.get_m31(2); + let op1_limb_2_col71 = memory_id_to_big_value_tmp_7e965_13.get_m31(2); *row[71] = op1_limb_2_col71; - let op1_limb_3_col72 = memory_id_to_big_value_tmp_f0ae3_13.get_m31(3); + let op1_limb_3_col72 = memory_id_to_big_value_tmp_7e965_13.get_m31(3); *row[72] = op1_limb_3_col72; - let op1_limb_4_col73 = memory_id_to_big_value_tmp_f0ae3_13.get_m31(4); + let op1_limb_4_col73 = memory_id_to_big_value_tmp_7e965_13.get_m31(4); *row[73] = op1_limb_4_col73; - let op1_limb_5_col74 = memory_id_to_big_value_tmp_f0ae3_13.get_m31(5); + let op1_limb_5_col74 = memory_id_to_big_value_tmp_7e965_13.get_m31(5); *row[74] = op1_limb_5_col74; - let op1_limb_6_col75 = memory_id_to_big_value_tmp_f0ae3_13.get_m31(6); + let op1_limb_6_col75 = memory_id_to_big_value_tmp_7e965_13.get_m31(6); *row[75] = op1_limb_6_col75; - let op1_limb_7_col76 = memory_id_to_big_value_tmp_f0ae3_13.get_m31(7); + let op1_limb_7_col76 = memory_id_to_big_value_tmp_7e965_13.get_m31(7); *row[76] = op1_limb_7_col76; - let op1_limb_8_col77 = memory_id_to_big_value_tmp_f0ae3_13.get_m31(8); + let op1_limb_8_col77 = memory_id_to_big_value_tmp_7e965_13.get_m31(8); *row[77] = op1_limb_8_col77; - let op1_limb_9_col78 = memory_id_to_big_value_tmp_f0ae3_13.get_m31(9); + let op1_limb_9_col78 = memory_id_to_big_value_tmp_7e965_13.get_m31(9); *row[78] = op1_limb_9_col78; - let op1_limb_10_col79 = memory_id_to_big_value_tmp_f0ae3_13.get_m31(10); + let op1_limb_10_col79 = memory_id_to_big_value_tmp_7e965_13.get_m31(10); *row[79] = op1_limb_10_col79; - let op1_limb_11_col80 = memory_id_to_big_value_tmp_f0ae3_13.get_m31(11); + let op1_limb_11_col80 = memory_id_to_big_value_tmp_7e965_13.get_m31(11); *row[80] = op1_limb_11_col80; - let op1_limb_12_col81 = memory_id_to_big_value_tmp_f0ae3_13.get_m31(12); + let op1_limb_12_col81 = memory_id_to_big_value_tmp_7e965_13.get_m31(12); *row[81] = op1_limb_12_col81; - let op1_limb_13_col82 = memory_id_to_big_value_tmp_f0ae3_13.get_m31(13); + let op1_limb_13_col82 = memory_id_to_big_value_tmp_7e965_13.get_m31(13); *row[82] = op1_limb_13_col82; - let op1_limb_14_col83 = memory_id_to_big_value_tmp_f0ae3_13.get_m31(14); + let op1_limb_14_col83 = memory_id_to_big_value_tmp_7e965_13.get_m31(14); *row[83] = op1_limb_14_col83; - let op1_limb_15_col84 = memory_id_to_big_value_tmp_f0ae3_13.get_m31(15); + let op1_limb_15_col84 = memory_id_to_big_value_tmp_7e965_13.get_m31(15); *row[84] = op1_limb_15_col84; - let op1_limb_16_col85 = memory_id_to_big_value_tmp_f0ae3_13.get_m31(16); + let op1_limb_16_col85 = memory_id_to_big_value_tmp_7e965_13.get_m31(16); *row[85] = op1_limb_16_col85; - let op1_limb_17_col86 = memory_id_to_big_value_tmp_f0ae3_13.get_m31(17); + let op1_limb_17_col86 = memory_id_to_big_value_tmp_7e965_13.get_m31(17); *row[86] = op1_limb_17_col86; - let op1_limb_18_col87 = memory_id_to_big_value_tmp_f0ae3_13.get_m31(18); + let op1_limb_18_col87 = memory_id_to_big_value_tmp_7e965_13.get_m31(18); *row[87] = op1_limb_18_col87; - let op1_limb_19_col88 = memory_id_to_big_value_tmp_f0ae3_13.get_m31(19); + let op1_limb_19_col88 = memory_id_to_big_value_tmp_7e965_13.get_m31(19); *row[88] = op1_limb_19_col88; - let op1_limb_20_col89 = memory_id_to_big_value_tmp_f0ae3_13.get_m31(20); + let op1_limb_20_col89 = memory_id_to_big_value_tmp_7e965_13.get_m31(20); *row[89] = op1_limb_20_col89; - let op1_limb_21_col90 = memory_id_to_big_value_tmp_f0ae3_13.get_m31(21); + let op1_limb_21_col90 = memory_id_to_big_value_tmp_7e965_13.get_m31(21); *row[90] = op1_limb_21_col90; - let op1_limb_22_col91 = memory_id_to_big_value_tmp_f0ae3_13.get_m31(22); + let op1_limb_22_col91 = memory_id_to_big_value_tmp_7e965_13.get_m31(22); *row[91] = op1_limb_22_col91; - let op1_limb_23_col92 = memory_id_to_big_value_tmp_f0ae3_13.get_m31(23); + let op1_limb_23_col92 = memory_id_to_big_value_tmp_7e965_13.get_m31(23); *row[92] = op1_limb_23_col92; - let op1_limb_24_col93 = memory_id_to_big_value_tmp_f0ae3_13.get_m31(24); + let op1_limb_24_col93 = memory_id_to_big_value_tmp_7e965_13.get_m31(24); *row[93] = op1_limb_24_col93; - let op1_limb_25_col94 = memory_id_to_big_value_tmp_f0ae3_13.get_m31(25); + let op1_limb_25_col94 = memory_id_to_big_value_tmp_7e965_13.get_m31(25); *row[94] = op1_limb_25_col94; - let op1_limb_26_col95 = memory_id_to_big_value_tmp_f0ae3_13.get_m31(26); + let op1_limb_26_col95 = memory_id_to_big_value_tmp_7e965_13.get_m31(26); *row[95] = op1_limb_26_col95; - let op1_limb_27_col96 = memory_id_to_big_value_tmp_f0ae3_13.get_m31(27); + let op1_limb_27_col96 = memory_id_to_big_value_tmp_7e965_13.get_m31(27); *row[96] = op1_limb_27_col96; for (i, &input) in op1_id_col68.unpack().iter().enumerate() { *sub_components_inputs[i].memory_id_to_big_inputs[2] = input; @@ -611,11 +617,11 @@ fn write_trace_simd( // Verify Add 252. - let sub_p_bit_tmp_f0ae3_14 = ((UInt16_1) + let sub_p_bit_tmp_7e965_14 = ((UInt16_1) & (((PackedUInt16::from_m31(op0_limb_0_col40)) ^ (PackedUInt16::from_m31(op1_limb_0_col69))) ^ (PackedUInt16::from_m31(dst_limb_0_col11)))); - let sub_p_bit_col97 = sub_p_bit_tmp_f0ae3_14.as_m31(); + let sub_p_bit_col97 = sub_p_bit_tmp_7e965_14.as_m31(); *row[97] = sub_p_bit_col97; *lookup_data.opcodes_0 = [input_pc_col0, input_ap_col1, input_fp_col2]; diff --git a/stwo_cairo_prover/crates/prover/src/components/add_opcode_is_small_t_is_imm_f/component.rs b/stwo_cairo_prover/crates/prover/src/components/add_opcode_small/component.rs similarity index 99% rename from stwo_cairo_prover/crates/prover/src/components/add_opcode_is_small_t_is_imm_f/component.rs rename to stwo_cairo_prover/crates/prover/src/components/add_opcode_small/component.rs index 44b4d9bf..bbfdf739 100644 --- a/stwo_cairo_prover/crates/prover/src/components/add_opcode_is_small_t_is_imm_f/component.rs +++ b/stwo_cairo_prover/crates/prover/src/components/add_opcode_small/component.rs @@ -4,6 +4,7 @@ use num_traits::{One, Zero}; use serde::{Deserialize, Serialize}; use stwo_cairo_serialize::CairoSerialize; use stwo_prover::constraint_framework::logup::{LogupAtRow, LogupSums, LookupElements}; +use stwo_prover::constraint_framework::preprocessed_columns::PreprocessedColumn; use stwo_prover::constraint_framework::{ EvalAtRow, FrameworkComponent, FrameworkEval, RelationEntry, }; diff --git a/stwo_cairo_prover/crates/prover/src/components/add_opcode_is_small_t_is_imm_f/mod.rs b/stwo_cairo_prover/crates/prover/src/components/add_opcode_small/mod.rs similarity index 100% rename from stwo_cairo_prover/crates/prover/src/components/add_opcode_is_small_t_is_imm_f/mod.rs rename to stwo_cairo_prover/crates/prover/src/components/add_opcode_small/mod.rs diff --git a/stwo_cairo_prover/crates/prover/src/components/add_opcode_is_small_t_is_imm_f/prover.rs b/stwo_cairo_prover/crates/prover/src/components/add_opcode_small/prover.rs similarity index 84% rename from stwo_cairo_prover/crates/prover/src/components/add_opcode_is_small_t_is_imm_f/prover.rs rename to stwo_cairo_prover/crates/prover/src/components/add_opcode_small/prover.rs index a1ace6a2..636245ba 100644 --- a/stwo_cairo_prover/crates/prover/src/components/add_opcode_is_small_t_is_imm_f/prover.rs +++ b/stwo_cairo_prover/crates/prover/src/components/add_opcode_small/prover.rs @@ -7,10 +7,13 @@ use itertools::{chain, zip_eq, Itertools}; use num_traits::{One, Zero}; use prover_types::cpu::*; use prover_types::simd::*; -use rayon::iter::{IndexedParallelIterator, IntoParallelRefIterator, ParallelIterator}; +use rayon::iter::{ + IndexedParallelIterator, IntoParallelIterator, IntoParallelRefIterator, ParallelIterator, +}; use stwo_air_utils::trace::component_trace::ComponentTrace; use stwo_air_utils_derive::{IterMut, ParIterMut, Uninitialized}; use stwo_prover::constraint_framework::logup::LogupTraceGenerator; +use stwo_prover::constraint_framework::preprocessed_columns::PreprocessedColumn; use stwo_prover::constraint_framework::Relation; use stwo_prover::core::air::Component; use stwo_prover::core::backend::simd::column::BaseColumn; @@ -21,6 +24,7 @@ use stwo_prover::core::backend::simd::SimdBackend; use stwo_prover::core::backend::{BackendForChannel, Col, Column}; use stwo_prover::core::channel::{Channel, MerkleChannel}; use stwo_prover::core::fields::m31::M31; +use stwo_prover::core::fields::FieldExpOps; use stwo_prover::core::pcs::TreeBuilder; use stwo_prover::core::poly::circle::{CanonicCoset, CircleEvaluation}; use stwo_prover::core::poly::BitReversedOrder; @@ -66,6 +70,7 @@ impl ClaimGenerator { let packed_inputs = pack_values(&self.inputs); let (trace, mut sub_components_inputs, lookup_data) = write_trace_simd( + n_rows, packed_inputs, memory_address_to_id_state, memory_id_to_big_state, @@ -104,8 +109,8 @@ impl ClaimGenerator { ) } - pub fn add_inputs(&mut self, inputs: &[InputType]) { - self.inputs.extend(inputs); + pub fn add_inputs(&self, _inputs: &[InputType]) { + unimplemented!("Implement manually"); } } @@ -121,6 +126,7 @@ pub struct SubComponentInputs { #[allow(clippy::double_parens)] #[allow(non_snake_case)] fn write_trace_simd( + n_rows: usize, inputs: Vec, memory_address_to_id_state: &memory_address_to_id::ClaimGenerator, memory_id_to_big_state: &memory_id_to_big::ClaimGenerator, @@ -161,111 +167,111 @@ fn write_trace_simd( trace .par_iter_mut() - .zip(inputs.par_iter()) + .enumerate() + .zip(inputs.into_par_iter()) .zip(lookup_data.par_iter_mut()) .zip(sub_components_inputs.par_iter_mut().chunks(N_LANES)) .for_each( |( - ((row, add_opcode_is_small_t_is_imm_f_input), lookup_data), + (((row_index, row), add_opcode_small_input), lookup_data), mut sub_components_inputs, )| { - let input_tmp_6202e_0 = add_opcode_is_small_t_is_imm_f_input; - let input_pc_col0 = input_tmp_6202e_0.pc; + let input_tmp_8d553_0 = add_opcode_small_input; + let input_pc_col0 = input_tmp_8d553_0.pc; *row[0] = input_pc_col0; - let input_ap_col1 = input_tmp_6202e_0.ap; + let input_ap_col1 = input_tmp_8d553_0.ap; *row[1] = input_ap_col1; - let input_fp_col2 = input_tmp_6202e_0.fp; + let input_fp_col2 = input_tmp_8d553_0.fp; *row[2] = input_fp_col2; // Decode Instruction. - let memory_address_to_id_value_tmp_6202e_1 = + let memory_address_to_id_value_tmp_8d553_1 = memory_address_to_id_state.deduce_output(input_pc_col0); - let memory_id_to_big_value_tmp_6202e_2 = - memory_id_to_big_state.deduce_output(memory_address_to_id_value_tmp_6202e_1); - let offset0_tmp_6202e_3 = - ((PackedUInt16::from_m31(memory_id_to_big_value_tmp_6202e_2.get_m31(0))) + let memory_id_to_big_value_tmp_8d553_2 = + memory_id_to_big_state.deduce_output(memory_address_to_id_value_tmp_8d553_1); + let offset0_tmp_8d553_3 = + ((PackedUInt16::from_m31(memory_id_to_big_value_tmp_8d553_2.get_m31(0))) + (((PackedUInt16::from_m31( - memory_id_to_big_value_tmp_6202e_2.get_m31(1), + memory_id_to_big_value_tmp_8d553_2.get_m31(1), )) & (UInt16_127)) << (UInt16_9))); - let offset0_col3 = offset0_tmp_6202e_3.as_m31(); + let offset0_col3 = offset0_tmp_8d553_3.as_m31(); *row[3] = offset0_col3; - let offset1_tmp_6202e_4 = - ((((PackedUInt16::from_m31(memory_id_to_big_value_tmp_6202e_2.get_m31(1))) + let offset1_tmp_8d553_4 = + ((((PackedUInt16::from_m31(memory_id_to_big_value_tmp_8d553_2.get_m31(1))) >> (UInt16_7)) + ((PackedUInt16::from_m31( - memory_id_to_big_value_tmp_6202e_2.get_m31(2), + memory_id_to_big_value_tmp_8d553_2.get_m31(2), )) << (UInt16_2))) + (((PackedUInt16::from_m31( - memory_id_to_big_value_tmp_6202e_2.get_m31(3), + memory_id_to_big_value_tmp_8d553_2.get_m31(3), )) & (UInt16_31)) << (UInt16_11))); - let offset1_col4 = offset1_tmp_6202e_4.as_m31(); + let offset1_col4 = offset1_tmp_8d553_4.as_m31(); *row[4] = offset1_col4; - let offset2_tmp_6202e_5 = - ((((PackedUInt16::from_m31(memory_id_to_big_value_tmp_6202e_2.get_m31(3))) + let offset2_tmp_8d553_5 = + ((((PackedUInt16::from_m31(memory_id_to_big_value_tmp_8d553_2.get_m31(3))) >> (UInt16_5)) + ((PackedUInt16::from_m31( - memory_id_to_big_value_tmp_6202e_2.get_m31(4), + memory_id_to_big_value_tmp_8d553_2.get_m31(4), )) << (UInt16_4))) + (((PackedUInt16::from_m31( - memory_id_to_big_value_tmp_6202e_2.get_m31(5), + memory_id_to_big_value_tmp_8d553_2.get_m31(5), )) & (UInt16_7)) << (UInt16_13))); - let offset2_col5 = offset2_tmp_6202e_5.as_m31(); + let offset2_col5 = offset2_tmp_8d553_5.as_m31(); *row[5] = offset2_col5; - let dst_base_fp_tmp_6202e_6 = - (((((PackedUInt16::from_m31(memory_id_to_big_value_tmp_6202e_2.get_m31(5))) + let dst_base_fp_tmp_8d553_6 = + (((((PackedUInt16::from_m31(memory_id_to_big_value_tmp_8d553_2.get_m31(5))) >> (UInt16_3)) + ((PackedUInt16::from_m31( - memory_id_to_big_value_tmp_6202e_2.get_m31(6), + memory_id_to_big_value_tmp_8d553_2.get_m31(6), )) << (UInt16_6))) >> (UInt16_0)) & (UInt16_1)); - let dst_base_fp_col6 = dst_base_fp_tmp_6202e_6.as_m31(); + let dst_base_fp_col6 = dst_base_fp_tmp_8d553_6.as_m31(); *row[6] = dst_base_fp_col6; - let op0_base_fp_tmp_6202e_7 = - (((((PackedUInt16::from_m31(memory_id_to_big_value_tmp_6202e_2.get_m31(5))) + let op0_base_fp_tmp_8d553_7 = + (((((PackedUInt16::from_m31(memory_id_to_big_value_tmp_8d553_2.get_m31(5))) >> (UInt16_3)) + ((PackedUInt16::from_m31( - memory_id_to_big_value_tmp_6202e_2.get_m31(6), + memory_id_to_big_value_tmp_8d553_2.get_m31(6), )) << (UInt16_6))) >> (UInt16_1)) & (UInt16_1)); - let op0_base_fp_col7 = op0_base_fp_tmp_6202e_7.as_m31(); + let op0_base_fp_col7 = op0_base_fp_tmp_8d553_7.as_m31(); *row[7] = op0_base_fp_col7; - let op1_base_fp_tmp_6202e_8 = - (((((PackedUInt16::from_m31(memory_id_to_big_value_tmp_6202e_2.get_m31(5))) + let op1_base_fp_tmp_8d553_8 = + (((((PackedUInt16::from_m31(memory_id_to_big_value_tmp_8d553_2.get_m31(5))) >> (UInt16_3)) + ((PackedUInt16::from_m31( - memory_id_to_big_value_tmp_6202e_2.get_m31(6), + memory_id_to_big_value_tmp_8d553_2.get_m31(6), )) << (UInt16_6))) >> (UInt16_3)) & (UInt16_1)); - let op1_base_fp_col8 = op1_base_fp_tmp_6202e_8.as_m31(); + let op1_base_fp_col8 = op1_base_fp_tmp_8d553_8.as_m31(); *row[8] = op1_base_fp_col8; - let op1_base_ap_tmp_6202e_9 = - (((((PackedUInt16::from_m31(memory_id_to_big_value_tmp_6202e_2.get_m31(5))) + let op1_base_ap_tmp_8d553_9 = + (((((PackedUInt16::from_m31(memory_id_to_big_value_tmp_8d553_2.get_m31(5))) >> (UInt16_3)) + ((PackedUInt16::from_m31( - memory_id_to_big_value_tmp_6202e_2.get_m31(6), + memory_id_to_big_value_tmp_8d553_2.get_m31(6), )) << (UInt16_6))) >> (UInt16_4)) & (UInt16_1)); - let op1_base_ap_col9 = op1_base_ap_tmp_6202e_9.as_m31(); + let op1_base_ap_col9 = op1_base_ap_tmp_8d553_9.as_m31(); *row[9] = op1_base_ap_col9; - let ap_update_add_1_tmp_6202e_10 = - (((((PackedUInt16::from_m31(memory_id_to_big_value_tmp_6202e_2.get_m31(5))) + let ap_update_add_1_tmp_8d553_10 = + (((((PackedUInt16::from_m31(memory_id_to_big_value_tmp_8d553_2.get_m31(5))) >> (UInt16_3)) + ((PackedUInt16::from_m31( - memory_id_to_big_value_tmp_6202e_2.get_m31(6), + memory_id_to_big_value_tmp_8d553_2.get_m31(6), )) << (UInt16_6))) >> (UInt16_11)) & (UInt16_1)); - let ap_update_add_1_col10 = ap_update_add_1_tmp_6202e_10.as_m31(); + let ap_update_add_1_col10 = ap_update_add_1_tmp_8d553_10.as_m31(); *row[10] = ap_update_add_1_col10; - for (i, &input) in ( input_pc_col0, [offset0_col3, offset1_col4, offset2_col5], @@ -327,11 +333,11 @@ fn write_trace_simd( // Read Small. - let memory_address_to_id_value_tmp_6202e_11 = memory_address_to_id_state + let memory_address_to_id_value_tmp_8d553_11 = memory_address_to_id_state .deduce_output(((mem_dst_base_col11) + ((offset0_col3) - (M31_32768)))); - let memory_id_to_big_value_tmp_6202e_12 = - memory_id_to_big_state.deduce_output(memory_address_to_id_value_tmp_6202e_11); - let dst_id_col14 = memory_address_to_id_value_tmp_6202e_11; + let memory_id_to_big_value_tmp_8d553_12 = + memory_id_to_big_state.deduce_output(memory_address_to_id_value_tmp_8d553_11); + let dst_id_col14 = memory_address_to_id_value_tmp_8d553_11; *row[14] = dst_id_col14; for (i, &input) in ((mem_dst_base_col11) + ((offset0_col3) - (M31_32768))) .unpack() @@ -347,19 +353,19 @@ fn write_trace_simd( // Cond Decode Small Sign. - let msb_tmp_6202e_13 = memory_id_to_big_value_tmp_6202e_12.get_m31(27).eq(M31_256); - let msb_col15 = msb_tmp_6202e_13.as_m31(); + let msb_tmp_8d553_13 = memory_id_to_big_value_tmp_8d553_12.get_m31(27).eq(M31_256); + let msb_col15 = msb_tmp_8d553_13.as_m31(); *row[15] = msb_col15; - let mid_limbs_set_tmp_6202e_14 = - memory_id_to_big_value_tmp_6202e_12.get_m31(20).eq(M31_511); - let mid_limbs_set_col16 = mid_limbs_set_tmp_6202e_14.as_m31(); + let mid_limbs_set_tmp_8d553_14 = + memory_id_to_big_value_tmp_8d553_12.get_m31(20).eq(M31_511); + let mid_limbs_set_col16 = mid_limbs_set_tmp_8d553_14.as_m31(); *row[16] = mid_limbs_set_col16; - let dst_limb_0_col17 = memory_id_to_big_value_tmp_6202e_12.get_m31(0); + let dst_limb_0_col17 = memory_id_to_big_value_tmp_8d553_12.get_m31(0); *row[17] = dst_limb_0_col17; - let dst_limb_1_col18 = memory_id_to_big_value_tmp_6202e_12.get_m31(1); + let dst_limb_1_col18 = memory_id_to_big_value_tmp_8d553_12.get_m31(1); *row[18] = dst_limb_1_col18; - let dst_limb_2_col19 = memory_id_to_big_value_tmp_6202e_12.get_m31(2); + let dst_limb_2_col19 = memory_id_to_big_value_tmp_8d553_12.get_m31(2); *row[19] = dst_limb_2_col19; for (i, &input) in dst_id_col14.unpack().iter().enumerate() { *sub_components_inputs[i].memory_id_to_big_inputs[0] = input; @@ -398,11 +404,11 @@ fn write_trace_simd( // Read Small. - let memory_address_to_id_value_tmp_6202e_15 = memory_address_to_id_state + let memory_address_to_id_value_tmp_8d553_15 = memory_address_to_id_state .deduce_output(((mem0_base_col12) + ((offset1_col4) - (M31_32768)))); - let memory_id_to_big_value_tmp_6202e_16 = - memory_id_to_big_state.deduce_output(memory_address_to_id_value_tmp_6202e_15); - let op0_id_col20 = memory_address_to_id_value_tmp_6202e_15; + let memory_id_to_big_value_tmp_8d553_16 = + memory_id_to_big_state.deduce_output(memory_address_to_id_value_tmp_8d553_15); + let op0_id_col20 = memory_address_to_id_value_tmp_8d553_15; *row[20] = op0_id_col20; for (i, &input) in ((mem0_base_col12) + ((offset1_col4) - (M31_32768))) .unpack() @@ -418,19 +424,19 @@ fn write_trace_simd( // Cond Decode Small Sign. - let msb_tmp_6202e_17 = memory_id_to_big_value_tmp_6202e_16.get_m31(27).eq(M31_256); - let msb_col21 = msb_tmp_6202e_17.as_m31(); + let msb_tmp_8d553_17 = memory_id_to_big_value_tmp_8d553_16.get_m31(27).eq(M31_256); + let msb_col21 = msb_tmp_8d553_17.as_m31(); *row[21] = msb_col21; - let mid_limbs_set_tmp_6202e_18 = - memory_id_to_big_value_tmp_6202e_16.get_m31(20).eq(M31_511); - let mid_limbs_set_col22 = mid_limbs_set_tmp_6202e_18.as_m31(); + let mid_limbs_set_tmp_8d553_18 = + memory_id_to_big_value_tmp_8d553_16.get_m31(20).eq(M31_511); + let mid_limbs_set_col22 = mid_limbs_set_tmp_8d553_18.as_m31(); *row[22] = mid_limbs_set_col22; - let op0_limb_0_col23 = memory_id_to_big_value_tmp_6202e_16.get_m31(0); + let op0_limb_0_col23 = memory_id_to_big_value_tmp_8d553_16.get_m31(0); *row[23] = op0_limb_0_col23; - let op0_limb_1_col24 = memory_id_to_big_value_tmp_6202e_16.get_m31(1); + let op0_limb_1_col24 = memory_id_to_big_value_tmp_8d553_16.get_m31(1); *row[24] = op0_limb_1_col24; - let op0_limb_2_col25 = memory_id_to_big_value_tmp_6202e_16.get_m31(2); + let op0_limb_2_col25 = memory_id_to_big_value_tmp_8d553_16.get_m31(2); *row[25] = op0_limb_2_col25; for (i, &input) in op0_id_col20.unpack().iter().enumerate() { *sub_components_inputs[i].memory_id_to_big_inputs[1] = input; @@ -469,11 +475,11 @@ fn write_trace_simd( // Read Small. - let memory_address_to_id_value_tmp_6202e_19 = memory_address_to_id_state + let memory_address_to_id_value_tmp_8d553_19 = memory_address_to_id_state .deduce_output(((mem1_base_col13) + ((offset2_col5) - (M31_32768)))); - let memory_id_to_big_value_tmp_6202e_20 = - memory_id_to_big_state.deduce_output(memory_address_to_id_value_tmp_6202e_19); - let op1_id_col26 = memory_address_to_id_value_tmp_6202e_19; + let memory_id_to_big_value_tmp_8d553_20 = + memory_id_to_big_state.deduce_output(memory_address_to_id_value_tmp_8d553_19); + let op1_id_col26 = memory_address_to_id_value_tmp_8d553_19; *row[26] = op1_id_col26; for (i, &input) in ((mem1_base_col13) + ((offset2_col5) - (M31_32768))) .unpack() @@ -489,19 +495,19 @@ fn write_trace_simd( // Cond Decode Small Sign. - let msb_tmp_6202e_21 = memory_id_to_big_value_tmp_6202e_20.get_m31(27).eq(M31_256); - let msb_col27 = msb_tmp_6202e_21.as_m31(); + let msb_tmp_8d553_21 = memory_id_to_big_value_tmp_8d553_20.get_m31(27).eq(M31_256); + let msb_col27 = msb_tmp_8d553_21.as_m31(); *row[27] = msb_col27; - let mid_limbs_set_tmp_6202e_22 = - memory_id_to_big_value_tmp_6202e_20.get_m31(20).eq(M31_511); - let mid_limbs_set_col28 = mid_limbs_set_tmp_6202e_22.as_m31(); + let mid_limbs_set_tmp_8d553_22 = + memory_id_to_big_value_tmp_8d553_20.get_m31(20).eq(M31_511); + let mid_limbs_set_col28 = mid_limbs_set_tmp_8d553_22.as_m31(); *row[28] = mid_limbs_set_col28; - let op1_limb_0_col29 = memory_id_to_big_value_tmp_6202e_20.get_m31(0); + let op1_limb_0_col29 = memory_id_to_big_value_tmp_8d553_20.get_m31(0); *row[29] = op1_limb_0_col29; - let op1_limb_1_col30 = memory_id_to_big_value_tmp_6202e_20.get_m31(1); + let op1_limb_1_col30 = memory_id_to_big_value_tmp_8d553_20.get_m31(1); *row[30] = op1_limb_1_col30; - let op1_limb_2_col31 = memory_id_to_big_value_tmp_6202e_20.get_m31(2); + let op1_limb_2_col31 = memory_id_to_big_value_tmp_8d553_20.get_m31(2); *row[31] = op1_limb_2_col31; for (i, &input) in op1_id_col26.unpack().iter().enumerate() { *sub_components_inputs[i].memory_id_to_big_inputs[2] = input; diff --git a/stwo_cairo_prover/crates/prover/src/components/add_opcode_is_small_t_is_imm_t/component.rs b/stwo_cairo_prover/crates/prover/src/components/add_opcode_small_imm/component.rs similarity index 99% rename from stwo_cairo_prover/crates/prover/src/components/add_opcode_is_small_t_is_imm_t/component.rs rename to stwo_cairo_prover/crates/prover/src/components/add_opcode_small_imm/component.rs index 84c945ac..77a5e9dd 100644 --- a/stwo_cairo_prover/crates/prover/src/components/add_opcode_is_small_t_is_imm_t/component.rs +++ b/stwo_cairo_prover/crates/prover/src/components/add_opcode_small_imm/component.rs @@ -4,6 +4,7 @@ use num_traits::{One, Zero}; use serde::{Deserialize, Serialize}; use stwo_cairo_serialize::CairoSerialize; use stwo_prover::constraint_framework::logup::{LogupAtRow, LogupSums, LookupElements}; +use stwo_prover::constraint_framework::preprocessed_columns::PreprocessedColumn; use stwo_prover::constraint_framework::{ EvalAtRow, FrameworkComponent, FrameworkEval, RelationEntry, }; diff --git a/stwo_cairo_prover/crates/prover/src/components/add_opcode_is_small_t_is_imm_t/mod.rs b/stwo_cairo_prover/crates/prover/src/components/add_opcode_small_imm/mod.rs similarity index 100% rename from stwo_cairo_prover/crates/prover/src/components/add_opcode_is_small_t_is_imm_t/mod.rs rename to stwo_cairo_prover/crates/prover/src/components/add_opcode_small_imm/mod.rs diff --git a/stwo_cairo_prover/crates/prover/src/components/add_opcode_is_small_t_is_imm_t/prover.rs b/stwo_cairo_prover/crates/prover/src/components/add_opcode_small_imm/prover.rs similarity index 85% rename from stwo_cairo_prover/crates/prover/src/components/add_opcode_is_small_t_is_imm_t/prover.rs rename to stwo_cairo_prover/crates/prover/src/components/add_opcode_small_imm/prover.rs index a392c6c6..5d0409e0 100644 --- a/stwo_cairo_prover/crates/prover/src/components/add_opcode_is_small_t_is_imm_t/prover.rs +++ b/stwo_cairo_prover/crates/prover/src/components/add_opcode_small_imm/prover.rs @@ -7,10 +7,13 @@ use itertools::{chain, zip_eq, Itertools}; use num_traits::{One, Zero}; use prover_types::cpu::*; use prover_types::simd::*; -use rayon::iter::{IndexedParallelIterator, IntoParallelRefIterator, ParallelIterator}; +use rayon::iter::{ + IndexedParallelIterator, IntoParallelIterator, IntoParallelRefIterator, ParallelIterator, +}; use stwo_air_utils::trace::component_trace::ComponentTrace; use stwo_air_utils_derive::{IterMut, ParIterMut, Uninitialized}; use stwo_prover::constraint_framework::logup::LogupTraceGenerator; +use stwo_prover::constraint_framework::preprocessed_columns::PreprocessedColumn; use stwo_prover::constraint_framework::Relation; use stwo_prover::core::air::Component; use stwo_prover::core::backend::simd::column::BaseColumn; @@ -21,6 +24,7 @@ use stwo_prover::core::backend::simd::SimdBackend; use stwo_prover::core::backend::{BackendForChannel, Col, Column}; use stwo_prover::core::channel::{Channel, MerkleChannel}; use stwo_prover::core::fields::m31::M31; +use stwo_prover::core::fields::FieldExpOps; use stwo_prover::core::pcs::TreeBuilder; use stwo_prover::core::poly::circle::{CanonicCoset, CircleEvaluation}; use stwo_prover::core::poly::BitReversedOrder; @@ -66,6 +70,7 @@ impl ClaimGenerator { let packed_inputs = pack_values(&self.inputs); let (trace, mut sub_components_inputs, lookup_data) = write_trace_simd( + n_rows, packed_inputs, memory_address_to_id_state, memory_id_to_big_state, @@ -104,8 +109,8 @@ impl ClaimGenerator { ) } - pub fn add_inputs(&mut self, inputs: &[InputType]) { - self.inputs.extend(inputs); + pub fn add_inputs(&self, _inputs: &[InputType]) { + unimplemented!("Implement manually"); } } @@ -121,6 +126,7 @@ pub struct SubComponentInputs { #[allow(clippy::double_parens)] #[allow(non_snake_case)] fn write_trace_simd( + n_rows: usize, inputs: Vec, memory_address_to_id_state: &memory_address_to_id::ClaimGenerator, memory_id_to_big_state: &memory_id_to_big::ClaimGenerator, @@ -160,79 +166,79 @@ fn write_trace_simd( trace .par_iter_mut() - .zip(inputs.par_iter()) + .enumerate() + .zip(inputs.into_par_iter()) .zip(lookup_data.par_iter_mut()) .zip(sub_components_inputs.par_iter_mut().chunks(N_LANES)) .for_each( |( - ((row, add_opcode_is_small_t_is_imm_t_input), lookup_data), + (((row_index, row), add_opcode_small_imm_input), lookup_data), mut sub_components_inputs, )| { - let input_tmp_c5e3c_0 = add_opcode_is_small_t_is_imm_t_input; - let input_pc_col0 = input_tmp_c5e3c_0.pc; + let input_tmp_49e92_0 = add_opcode_small_imm_input; + let input_pc_col0 = input_tmp_49e92_0.pc; *row[0] = input_pc_col0; - let input_ap_col1 = input_tmp_c5e3c_0.ap; + let input_ap_col1 = input_tmp_49e92_0.ap; *row[1] = input_ap_col1; - let input_fp_col2 = input_tmp_c5e3c_0.fp; + let input_fp_col2 = input_tmp_49e92_0.fp; *row[2] = input_fp_col2; // Decode Instruction. - let memory_address_to_id_value_tmp_c5e3c_1 = + let memory_address_to_id_value_tmp_49e92_1 = memory_address_to_id_state.deduce_output(input_pc_col0); - let memory_id_to_big_value_tmp_c5e3c_2 = - memory_id_to_big_state.deduce_output(memory_address_to_id_value_tmp_c5e3c_1); - let offset0_tmp_c5e3c_3 = - ((PackedUInt16::from_m31(memory_id_to_big_value_tmp_c5e3c_2.get_m31(0))) + let memory_id_to_big_value_tmp_49e92_2 = + memory_id_to_big_state.deduce_output(memory_address_to_id_value_tmp_49e92_1); + let offset0_tmp_49e92_3 = + ((PackedUInt16::from_m31(memory_id_to_big_value_tmp_49e92_2.get_m31(0))) + (((PackedUInt16::from_m31( - memory_id_to_big_value_tmp_c5e3c_2.get_m31(1), + memory_id_to_big_value_tmp_49e92_2.get_m31(1), )) & (UInt16_127)) << (UInt16_9))); - let offset0_col3 = offset0_tmp_c5e3c_3.as_m31(); + let offset0_col3 = offset0_tmp_49e92_3.as_m31(); *row[3] = offset0_col3; - let offset1_tmp_c5e3c_4 = - ((((PackedUInt16::from_m31(memory_id_to_big_value_tmp_c5e3c_2.get_m31(1))) + let offset1_tmp_49e92_4 = + ((((PackedUInt16::from_m31(memory_id_to_big_value_tmp_49e92_2.get_m31(1))) >> (UInt16_7)) + ((PackedUInt16::from_m31( - memory_id_to_big_value_tmp_c5e3c_2.get_m31(2), + memory_id_to_big_value_tmp_49e92_2.get_m31(2), )) << (UInt16_2))) + (((PackedUInt16::from_m31( - memory_id_to_big_value_tmp_c5e3c_2.get_m31(3), + memory_id_to_big_value_tmp_49e92_2.get_m31(3), )) & (UInt16_31)) << (UInt16_11))); - let offset1_col4 = offset1_tmp_c5e3c_4.as_m31(); + let offset1_col4 = offset1_tmp_49e92_4.as_m31(); *row[4] = offset1_col4; - let dst_base_fp_tmp_c5e3c_5 = - (((((PackedUInt16::from_m31(memory_id_to_big_value_tmp_c5e3c_2.get_m31(5))) + let dst_base_fp_tmp_49e92_5 = + (((((PackedUInt16::from_m31(memory_id_to_big_value_tmp_49e92_2.get_m31(5))) >> (UInt16_3)) + ((PackedUInt16::from_m31( - memory_id_to_big_value_tmp_c5e3c_2.get_m31(6), + memory_id_to_big_value_tmp_49e92_2.get_m31(6), )) << (UInt16_6))) >> (UInt16_0)) & (UInt16_1)); - let dst_base_fp_col5 = dst_base_fp_tmp_c5e3c_5.as_m31(); + let dst_base_fp_col5 = dst_base_fp_tmp_49e92_5.as_m31(); *row[5] = dst_base_fp_col5; - let op0_base_fp_tmp_c5e3c_6 = - (((((PackedUInt16::from_m31(memory_id_to_big_value_tmp_c5e3c_2.get_m31(5))) + let op0_base_fp_tmp_49e92_6 = + (((((PackedUInt16::from_m31(memory_id_to_big_value_tmp_49e92_2.get_m31(5))) >> (UInt16_3)) + ((PackedUInt16::from_m31( - memory_id_to_big_value_tmp_c5e3c_2.get_m31(6), + memory_id_to_big_value_tmp_49e92_2.get_m31(6), )) << (UInt16_6))) >> (UInt16_1)) & (UInt16_1)); - let op0_base_fp_col6 = op0_base_fp_tmp_c5e3c_6.as_m31(); + let op0_base_fp_col6 = op0_base_fp_tmp_49e92_6.as_m31(); *row[6] = op0_base_fp_col6; - let ap_update_add_1_tmp_c5e3c_7 = - (((((PackedUInt16::from_m31(memory_id_to_big_value_tmp_c5e3c_2.get_m31(5))) + let ap_update_add_1_tmp_49e92_7 = + (((((PackedUInt16::from_m31(memory_id_to_big_value_tmp_49e92_2.get_m31(5))) >> (UInt16_3)) + ((PackedUInt16::from_m31( - memory_id_to_big_value_tmp_c5e3c_2.get_m31(6), + memory_id_to_big_value_tmp_49e92_2.get_m31(6), )) << (UInt16_6))) >> (UInt16_11)) & (UInt16_1)); - let ap_update_add_1_col7 = ap_update_add_1_tmp_c5e3c_7.as_m31(); + let ap_update_add_1_col7 = ap_update_add_1_tmp_49e92_7.as_m31(); *row[7] = ap_update_add_1_col7; - for (i, &input) in ( input_pc_col0, [offset0_col3, offset1_col4, M31_32769], @@ -291,11 +297,11 @@ fn write_trace_simd( // Read Small. - let memory_address_to_id_value_tmp_c5e3c_8 = memory_address_to_id_state + let memory_address_to_id_value_tmp_49e92_8 = memory_address_to_id_state .deduce_output(((mem_dst_base_col8) + ((offset0_col3) - (M31_32768)))); - let memory_id_to_big_value_tmp_c5e3c_9 = - memory_id_to_big_state.deduce_output(memory_address_to_id_value_tmp_c5e3c_8); - let dst_id_col10 = memory_address_to_id_value_tmp_c5e3c_8; + let memory_id_to_big_value_tmp_49e92_9 = + memory_id_to_big_state.deduce_output(memory_address_to_id_value_tmp_49e92_8); + let dst_id_col10 = memory_address_to_id_value_tmp_49e92_8; *row[10] = dst_id_col10; for (i, &input) in ((mem_dst_base_col8) + ((offset0_col3) - (M31_32768))) .unpack() @@ -311,19 +317,19 @@ fn write_trace_simd( // Cond Decode Small Sign. - let msb_tmp_c5e3c_10 = memory_id_to_big_value_tmp_c5e3c_9.get_m31(27).eq(M31_256); - let msb_col11 = msb_tmp_c5e3c_10.as_m31(); + let msb_tmp_49e92_10 = memory_id_to_big_value_tmp_49e92_9.get_m31(27).eq(M31_256); + let msb_col11 = msb_tmp_49e92_10.as_m31(); *row[11] = msb_col11; - let mid_limbs_set_tmp_c5e3c_11 = - memory_id_to_big_value_tmp_c5e3c_9.get_m31(20).eq(M31_511); - let mid_limbs_set_col12 = mid_limbs_set_tmp_c5e3c_11.as_m31(); + let mid_limbs_set_tmp_49e92_11 = + memory_id_to_big_value_tmp_49e92_9.get_m31(20).eq(M31_511); + let mid_limbs_set_col12 = mid_limbs_set_tmp_49e92_11.as_m31(); *row[12] = mid_limbs_set_col12; - let dst_limb_0_col13 = memory_id_to_big_value_tmp_c5e3c_9.get_m31(0); + let dst_limb_0_col13 = memory_id_to_big_value_tmp_49e92_9.get_m31(0); *row[13] = dst_limb_0_col13; - let dst_limb_1_col14 = memory_id_to_big_value_tmp_c5e3c_9.get_m31(1); + let dst_limb_1_col14 = memory_id_to_big_value_tmp_49e92_9.get_m31(1); *row[14] = dst_limb_1_col14; - let dst_limb_2_col15 = memory_id_to_big_value_tmp_c5e3c_9.get_m31(2); + let dst_limb_2_col15 = memory_id_to_big_value_tmp_49e92_9.get_m31(2); *row[15] = dst_limb_2_col15; for (i, &input) in dst_id_col10.unpack().iter().enumerate() { *sub_components_inputs[i].memory_id_to_big_inputs[0] = input; @@ -362,11 +368,11 @@ fn write_trace_simd( // Read Small. - let memory_address_to_id_value_tmp_c5e3c_12 = memory_address_to_id_state + let memory_address_to_id_value_tmp_49e92_12 = memory_address_to_id_state .deduce_output(((mem0_base_col9) + ((offset1_col4) - (M31_32768)))); - let memory_id_to_big_value_tmp_c5e3c_13 = - memory_id_to_big_state.deduce_output(memory_address_to_id_value_tmp_c5e3c_12); - let op0_id_col16 = memory_address_to_id_value_tmp_c5e3c_12; + let memory_id_to_big_value_tmp_49e92_13 = + memory_id_to_big_state.deduce_output(memory_address_to_id_value_tmp_49e92_12); + let op0_id_col16 = memory_address_to_id_value_tmp_49e92_12; *row[16] = op0_id_col16; for (i, &input) in ((mem0_base_col9) + ((offset1_col4) - (M31_32768))) .unpack() @@ -382,19 +388,19 @@ fn write_trace_simd( // Cond Decode Small Sign. - let msb_tmp_c5e3c_14 = memory_id_to_big_value_tmp_c5e3c_13.get_m31(27).eq(M31_256); - let msb_col17 = msb_tmp_c5e3c_14.as_m31(); + let msb_tmp_49e92_14 = memory_id_to_big_value_tmp_49e92_13.get_m31(27).eq(M31_256); + let msb_col17 = msb_tmp_49e92_14.as_m31(); *row[17] = msb_col17; - let mid_limbs_set_tmp_c5e3c_15 = - memory_id_to_big_value_tmp_c5e3c_13.get_m31(20).eq(M31_511); - let mid_limbs_set_col18 = mid_limbs_set_tmp_c5e3c_15.as_m31(); + let mid_limbs_set_tmp_49e92_15 = + memory_id_to_big_value_tmp_49e92_13.get_m31(20).eq(M31_511); + let mid_limbs_set_col18 = mid_limbs_set_tmp_49e92_15.as_m31(); *row[18] = mid_limbs_set_col18; - let op0_limb_0_col19 = memory_id_to_big_value_tmp_c5e3c_13.get_m31(0); + let op0_limb_0_col19 = memory_id_to_big_value_tmp_49e92_13.get_m31(0); *row[19] = op0_limb_0_col19; - let op0_limb_1_col20 = memory_id_to_big_value_tmp_c5e3c_13.get_m31(1); + let op0_limb_1_col20 = memory_id_to_big_value_tmp_49e92_13.get_m31(1); *row[20] = op0_limb_1_col20; - let op0_limb_2_col21 = memory_id_to_big_value_tmp_c5e3c_13.get_m31(2); + let op0_limb_2_col21 = memory_id_to_big_value_tmp_49e92_13.get_m31(2); *row[21] = op0_limb_2_col21; for (i, &input) in op0_id_col16.unpack().iter().enumerate() { *sub_components_inputs[i].memory_id_to_big_inputs[1] = input; @@ -433,11 +439,11 @@ fn write_trace_simd( // Read Small. - let memory_address_to_id_value_tmp_c5e3c_16 = + let memory_address_to_id_value_tmp_49e92_16 = memory_address_to_id_state.deduce_output(((input_pc_col0) + (M31_1))); - let memory_id_to_big_value_tmp_c5e3c_17 = - memory_id_to_big_state.deduce_output(memory_address_to_id_value_tmp_c5e3c_16); - let op1_id_col22 = memory_address_to_id_value_tmp_c5e3c_16; + let memory_id_to_big_value_tmp_49e92_17 = + memory_id_to_big_state.deduce_output(memory_address_to_id_value_tmp_49e92_16); + let op1_id_col22 = memory_address_to_id_value_tmp_49e92_16; *row[22] = op1_id_col22; for (i, &input) in ((input_pc_col0) + (M31_1)).unpack().iter().enumerate() { *sub_components_inputs[i].memory_address_to_id_inputs[2] = input; @@ -446,19 +452,19 @@ fn write_trace_simd( // Cond Decode Small Sign. - let msb_tmp_c5e3c_18 = memory_id_to_big_value_tmp_c5e3c_17.get_m31(27).eq(M31_256); - let msb_col23 = msb_tmp_c5e3c_18.as_m31(); + let msb_tmp_49e92_18 = memory_id_to_big_value_tmp_49e92_17.get_m31(27).eq(M31_256); + let msb_col23 = msb_tmp_49e92_18.as_m31(); *row[23] = msb_col23; - let mid_limbs_set_tmp_c5e3c_19 = - memory_id_to_big_value_tmp_c5e3c_17.get_m31(20).eq(M31_511); - let mid_limbs_set_col24 = mid_limbs_set_tmp_c5e3c_19.as_m31(); + let mid_limbs_set_tmp_49e92_19 = + memory_id_to_big_value_tmp_49e92_17.get_m31(20).eq(M31_511); + let mid_limbs_set_col24 = mid_limbs_set_tmp_49e92_19.as_m31(); *row[24] = mid_limbs_set_col24; - let op1_limb_0_col25 = memory_id_to_big_value_tmp_c5e3c_17.get_m31(0); + let op1_limb_0_col25 = memory_id_to_big_value_tmp_49e92_17.get_m31(0); *row[25] = op1_limb_0_col25; - let op1_limb_1_col26 = memory_id_to_big_value_tmp_c5e3c_17.get_m31(1); + let op1_limb_1_col26 = memory_id_to_big_value_tmp_49e92_17.get_m31(1); *row[26] = op1_limb_1_col26; - let op1_limb_2_col27 = memory_id_to_big_value_tmp_c5e3c_17.get_m31(2); + let op1_limb_2_col27 = memory_id_to_big_value_tmp_49e92_17.get_m31(2); *row[27] = op1_limb_2_col27; for (i, &input) in op1_id_col22.unpack().iter().enumerate() { *sub_components_inputs[i].memory_id_to_big_inputs[2] = input; diff --git a/stwo_cairo_prover/crates/prover/src/components/mod.rs b/stwo_cairo_prover/crates/prover/src/components/mod.rs index be5e7770..951bd318 100644 --- a/stwo_cairo_prover/crates/prover/src/components/mod.rs +++ b/stwo_cairo_prover/crates/prover/src/components/mod.rs @@ -1,10 +1,10 @@ pub mod add_ap_opcode; pub mod add_ap_opcode_imm; pub mod add_ap_opcode_op_1_base_fp; -pub mod add_opcode_is_small_f_is_imm_f; -pub mod add_opcode_is_small_f_is_imm_t; -pub mod add_opcode_is_small_t_is_imm_f; -pub mod add_opcode_is_small_t_is_imm_t; +pub mod add_opcode; +pub mod add_opcode_imm; +pub mod add_opcode_small; +pub mod add_opcode_small_imm; pub mod assert_eq_opcode_is_double_deref_f_is_imm_f; pub mod assert_eq_opcode_is_double_deref_f_is_imm_t; pub mod assert_eq_opcode_is_double_deref_t_is_imm_f; diff --git a/stwo_cairo_prover/crates/prover/src/input/state_transitions.rs b/stwo_cairo_prover/crates/prover/src/input/state_transitions.rs index 2a018794..34b7d294 100644 --- a/stwo_cairo_prover/crates/prover/src/input/state_transitions.rs +++ b/stwo_cairo_prover/crates/prover/src/input/state_transitions.rs @@ -26,10 +26,10 @@ pub struct CasmStatesByOpcode { pub add_ap_opcode: Vec, pub add_ap_opcode_imm: Vec, pub add_ap_opcode_op_1_base_fp: Vec, - pub add_opcode_is_small_t_is_imm_t: Vec, - pub add_opcode_is_small_f_is_imm_f: Vec, - pub add_opcode_is_small_t_is_imm_f: Vec, - pub add_opcode_is_small_f_is_imm_t: Vec, + pub add_opcode_small_imm: Vec, + pub add_opcode: Vec, + pub add_opcode_small: Vec, + pub add_opcode_imm: Vec, pub assert_eq_opcode_is_double_deref_f_is_imm_f: Vec, pub assert_eq_opcode_is_double_deref_t_is_imm_f: Vec, pub assert_eq_opcode_is_double_deref_f_is_imm_t: Vec, @@ -61,22 +61,10 @@ impl CasmStatesByOpcode { "add_ap_opcode_op_1_base_fp", self.add_ap_opcode_op_1_base_fp.len(), ), - ( - "add_opcode_is_small_t_is_imm_t", - self.add_opcode_is_small_t_is_imm_t.len(), - ), - ( - "add_opcode_is_small_f_is_imm_f", - self.add_opcode_is_small_f_is_imm_f.len(), - ), - ( - "add_opcode_is_small_t_is_imm_f", - self.add_opcode_is_small_t_is_imm_f.len(), - ), - ( - "add_opcode_is_small_f_is_imm_t", - self.add_opcode_is_small_f_is_imm_t.len(), - ), + ("add_opcode_small_imm", self.add_opcode_small_imm.len()), + ("add_opcode", self.add_opcode.len()), + ("add_opcode_small", self.add_opcode_small.len()), + ("add_opcode_imm", self.add_opcode_imm.len()), ( "assert_eq_opcode_is_double_deref_f_is_imm_f", self.assert_eq_opcode_is_double_deref_f_is_imm_f.len(), @@ -616,25 +604,17 @@ impl StateTransitions { // [ap/fp + offset0] = [ap/fp + offset1] + Imm. assert!(!op_1_base_fp && !op_1_base_ap && offset2 == 1); if is_small_add(dst, op0, op_1) { - self.casm_states_by_opcode - .add_opcode_is_small_t_is_imm_t - .push(state); + self.casm_states_by_opcode.add_opcode_small_imm.push(state); } else { - self.casm_states_by_opcode - .add_opcode_is_small_f_is_imm_t - .push(state); + self.casm_states_by_opcode.add_opcode_imm.push(state); }; } else { // [ap/fp + offset0] = [ap/fp + offset1] + [ap/fp + offset2]. assert!((op_1_base_fp || op_1_base_ap)); if is_small_add(dst, op0, op_1) { - self.casm_states_by_opcode - .add_opcode_is_small_t_is_imm_f - .push(state); + self.casm_states_by_opcode.add_opcode_small.push(state); } else { - self.casm_states_by_opcode - .add_opcode_is_small_f_is_imm_f - .push(state); + self.casm_states_by_opcode.add_opcode.push(state); } } } @@ -710,10 +690,7 @@ mod mappings_tests { .len(), 1 ); - assert_eq!( - casm_states_by_opcode.add_opcode_is_small_t_is_imm_t.len(), - 1 - ); + assert_eq!(casm_states_by_opcode.add_opcode_small_imm.len(), 1); } #[test] @@ -910,20 +887,14 @@ mod mappings_tests { let input = input_from_plain_casm(instructions, false); let casm_states_by_opcode = input.state_transitions.casm_states_by_opcode; - assert_eq!( - casm_states_by_opcode.add_opcode_is_small_t_is_imm_f.len(), - 1 - ); + assert_eq!(casm_states_by_opcode.add_opcode_small.len(), 1); assert_eq!( casm_states_by_opcode .assert_eq_opcode_is_double_deref_f_is_imm_t .len(), 2 ); - assert_eq!( - casm_states_by_opcode.add_opcode_is_small_t_is_imm_t.len(), - 1 - ); + assert_eq!(casm_states_by_opcode.add_opcode_small_imm.len(), 1); } #[test] @@ -941,14 +912,8 @@ mod mappings_tests { let input = input_from_plain_casm(instructions, false); let casm_states_by_opcode = input.state_transitions.casm_states_by_opcode; - assert_eq!( - casm_states_by_opcode.add_opcode_is_small_f_is_imm_f.len(), - 1 - ); - assert_eq!( - casm_states_by_opcode.add_opcode_is_small_f_is_imm_t.len(), - 1 - ); + assert_eq!(casm_states_by_opcode.add_opcode.len(), 1); + assert_eq!(casm_states_by_opcode.add_opcode_imm.len(), 1); } // TODO(Ohad): un-ignore. diff --git a/stwo_cairo_prover/crates/prover/src/input/vm_import/mod.rs b/stwo_cairo_prover/crates/prover/src/input/vm_import/mod.rs index 1f63d892..da713583 100644 --- a/stwo_cairo_prover/crates/prover/src/input/vm_import/mod.rs +++ b/stwo_cairo_prover/crates/prover/src/input/vm_import/mod.rs @@ -198,10 +198,10 @@ pub mod tests { assert_eq!(components.add_ap_opcode.len(), 0); assert_eq!(components.add_ap_opcode_imm.len(), 36895); assert_eq!(components.add_ap_opcode_op_1_base_fp.len(), 33); - assert_eq!(components.add_opcode_is_small_t_is_imm_t.len(), 84732); - assert_eq!(components.add_opcode_is_small_f_is_imm_f.len(), 189425); - assert_eq!(components.add_opcode_is_small_t_is_imm_f.len(), 36623); - assert_eq!(components.add_opcode_is_small_f_is_imm_t.len(), 22089); + assert_eq!(components.add_opcode_small_imm.len(), 84732); + assert_eq!(components.add_opcode.len(), 189425); + assert_eq!(components.add_opcode_small.len(), 36623); + assert_eq!(components.add_opcode_imm.len(), 22089); assert_eq!( components.assert_eq_opcode_is_double_deref_f_is_imm_f.len(), 233432 @@ -282,10 +282,10 @@ pub mod tests { assert_eq!(components.add_ap_opcode.len(), 0); assert_eq!(components.add_ap_opcode_imm.len(), 2); assert_eq!(components.add_ap_opcode_op_1_base_fp.len(), 1); - assert_eq!(components.add_opcode_is_small_t_is_imm_t.len(), 500); - assert_eq!(components.add_opcode_is_small_f_is_imm_f.len(), 0); - assert_eq!(components.add_opcode_is_small_t_is_imm_f.len(), 0); - assert_eq!(components.add_opcode_is_small_f_is_imm_t.len(), 450); + assert_eq!(components.add_opcode_small_imm.len(), 500); + assert_eq!(components.add_opcode.len(), 0); + assert_eq!(components.add_opcode_small.len(), 0); + assert_eq!(components.add_opcode_imm.len(), 450); assert_eq!( components.assert_eq_opcode_is_double_deref_f_is_imm_f.len(), 55