Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

updated names #265

Merged
merged 1 commit into from
Dec 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions stwo_cairo_prover/crates/prover/src/cairo_air/air.rs
Original file line number Diff line number Diff line change
Expand Up @@ -465,13 +465,13 @@ impl CairoComponents {
tree_span_provider,
verify_instruction::Eval {
claim: cairo_claim.verify_instruction,
memoryaddresstoid_lookup_elements: interaction_elements
memory_address_to_id_lookup_elements: interaction_elements
.memory_address_to_id
.clone(),
memoryidtobig_lookup_elements: interaction_elements.memory_id_to_value.clone(),
rangecheck_4_3_lookup_elements: interaction_elements.range_check_4_3.clone(),
rangecheck_7_2_5_lookup_elements: interaction_elements.range_check_7_2_5.clone(),
verifyinstruction_lookup_elements: interaction_elements.verify_instruction.clone(),
memory_id_to_big_lookup_elements: interaction_elements.memory_id_to_value.clone(),
range_check_4_3_lookup_elements: interaction_elements.range_check_4_3.clone(),
range_check_7_2_5_lookup_elements: interaction_elements.range_check_7_2_5.clone(),
verify_instruction_lookup_elements: interaction_elements.verify_instruction.clone(),
},
interaction_claim.verify_instruction.logup_sums,
);
Expand Down
184 changes: 92 additions & 92 deletions stwo_cairo_prover/crates/prover/src/cairo_air/debug_tools.rs

Large diffs are not rendered by default.

282 changes: 141 additions & 141 deletions stwo_cairo_prover/crates/prover/src/cairo_air/opcodes_air.rs

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ use crate::relations;

pub struct Eval {
pub claim: Claim,
pub memoryaddresstoid_lookup_elements: relations::MemoryAddressToId,
pub memoryidtobig_lookup_elements: relations::MemoryIdToBig,
pub memory_address_to_id_lookup_elements: relations::MemoryAddressToId,
pub memory_id_to_big_lookup_elements: relations::MemoryIdToBig,
pub opcodes_lookup_elements: relations::Opcodes,
pub verifyinstruction_lookup_elements: relations::VerifyInstruction,
pub verify_instruction_lookup_elements: relations::VerifyInstruction,
}

#[derive(Copy, Clone, Serialize, Deserialize, CairoSerialize)]
Expand Down Expand Up @@ -97,10 +97,10 @@ impl FrameworkEval for Eval {
let op1_limb_1_col8 = eval.next_trace_mask();
let op1_limb_2_col9 = eval.next_trace_mask();

// DecodeInstruction_95ed11aea2bb2eff.
// Decode Instruction.

eval.add_to_relation(RelationEntry::new(
&self.verifyinstruction_lookup_elements,
&self.verify_instruction_lookup_elements,
E::EF::one(),
&[
input_pc_col0.clone(),
Expand All @@ -121,18 +121,18 @@ impl FrameworkEval for Eval {
],
));

// ReadSmall.
// Read Small.

eval.add_to_relation(RelationEntry::new(
&self.memoryaddresstoid_lookup_elements,
&self.memory_address_to_id_lookup_elements,
E::EF::one(),
&[
(input_ap_col1.clone() + (offset2_col3.clone() - M31_32768.clone())),
op1_id_col4.clone(),
],
));

// CondDecodeSmallSign.
// Cond Decode Small Sign.

// msb is a bit.
eval.add_constraint((msb_col5.clone() * (msb_col5.clone() - M31_1.clone())));
Expand All @@ -146,7 +146,7 @@ impl FrameworkEval for Eval {
);

eval.add_to_relation(RelationEntry::new(
&self.memoryidtobig_lookup_elements,
&self.memory_id_to_big_lookup_elements,
E::EF::one(),
&[
op1_id_col4.clone(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -160,27 +160,27 @@ pub fn write_trace_simd(
let UInt16_7 = PackedUInt16::broadcast(UInt16::from(7));

inputs.into_iter().enumerate().for_each(
|(row_index, add_ap_opcode_is_imm_f_op1_base_fp_f_input)| {
let input_tmp_8b74_0 = add_ap_opcode_is_imm_f_op1_base_fp_f_input;
|(row_index, add_ap_opcode_is_imm_f_op_1_base_fp_f_input)| {
let input_tmp_8b74_0 = add_ap_opcode_is_imm_f_op_1_base_fp_f_input;
let input_pc_col0 = input_tmp_8b74_0.pc;
trace[0].data[row_index] = input_pc_col0;
let input_ap_col1 = input_tmp_8b74_0.ap;
trace[1].data[row_index] = input_ap_col1;
let input_fp_col2 = input_tmp_8b74_0.fp;
trace[2].data[row_index] = input_fp_col2;

// DecodeInstruction_95ed11aea2bb2eff.
// Decode Instruction.

let memoryaddresstoid_value_tmp_8b74_1 =
let memory_address_to_id_value_tmp_8b74_1 =
memory_address_to_id_state.deduce_output(input_pc_col0);
let memoryidtobig_value_tmp_8b74_2 =
memory_id_to_big_state.deduce_output(memoryaddresstoid_value_tmp_8b74_1);
let memory_id_to_big_value_tmp_8b74_2 =
memory_id_to_big_state.deduce_output(memory_address_to_id_value_tmp_8b74_1);
let offset2_tmp_8b74_3 =
((((PackedUInt16::from_m31(memoryidtobig_value_tmp_8b74_2.get_m31(3)))
((((PackedUInt16::from_m31(memory_id_to_big_value_tmp_8b74_2.get_m31(3)))
>> (UInt16_5))
+ ((PackedUInt16::from_m31(memoryidtobig_value_tmp_8b74_2.get_m31(4)))
+ ((PackedUInt16::from_m31(memory_id_to_big_value_tmp_8b74_2.get_m31(4)))
<< (UInt16_4)))
+ (((PackedUInt16::from_m31(memoryidtobig_value_tmp_8b74_2.get_m31(5)))
+ (((PackedUInt16::from_m31(memory_id_to_big_value_tmp_8b74_2.get_m31(5)))
& (UInt16_7))
<< (UInt16_13)));
let offset2_col3 = offset2_tmp_8b74_3.as_m31();
Expand All @@ -198,7 +198,7 @@ pub fn write_trace_simd(
.unpack(),
);

lookup_data.verifyinstruction[0].push([
lookup_data.verify_instruction[0].push([
input_pc_col0,
M31_32767,
M31_32767,
Expand All @@ -220,40 +220,41 @@ pub fn write_trace_simd(
M31_0,
]);

// ReadSmall.
// Read Small.

let memoryaddresstoid_value_tmp_8b74_4 = memory_address_to_id_state
let memory_address_to_id_value_tmp_8b74_4 = memory_address_to_id_state
.deduce_output(((input_ap_col1) + ((offset2_col3) - (M31_32768))));
let memoryidtobig_value_tmp_8b74_5 =
memory_id_to_big_state.deduce_output(memoryaddresstoid_value_tmp_8b74_4);
let op1_id_col4 = memoryaddresstoid_value_tmp_8b74_4;
let memory_id_to_big_value_tmp_8b74_5 =
memory_id_to_big_state.deduce_output(memory_address_to_id_value_tmp_8b74_4);
let op1_id_col4 = memory_address_to_id_value_tmp_8b74_4;
trace[4].data[row_index] = op1_id_col4;
sub_components_inputs.memory_address_to_id_inputs[0]
.extend(((input_ap_col1) + ((offset2_col3) - (M31_32768))).unpack());

lookup_data.memoryaddresstoid[0].push([
lookup_data.memory_address_to_id[0].push([
((input_ap_col1) + ((offset2_col3) - (M31_32768))),
op1_id_col4,
]);

// CondDecodeSmallSign.
// Cond Decode Small Sign.

let msb_tmp_8b74_6 = memoryidtobig_value_tmp_8b74_5.get_m31(27).eq(M31_256);
let msb_tmp_8b74_6 = memory_id_to_big_value_tmp_8b74_5.get_m31(27).eq(M31_256);
let msb_col5 = msb_tmp_8b74_6.as_m31();
trace[5].data[row_index] = msb_col5;
let mid_limbs_set_tmp_8b74_7 = memoryidtobig_value_tmp_8b74_5.get_m31(20).eq(M31_511);
let mid_limbs_set_tmp_8b74_7 =
memory_id_to_big_value_tmp_8b74_5.get_m31(20).eq(M31_511);
let mid_limbs_set_col6 = mid_limbs_set_tmp_8b74_7.as_m31();
trace[6].data[row_index] = mid_limbs_set_col6;

let op1_limb_0_col7 = memoryidtobig_value_tmp_8b74_5.get_m31(0);
let op1_limb_0_col7 = memory_id_to_big_value_tmp_8b74_5.get_m31(0);
trace[7].data[row_index] = op1_limb_0_col7;
let op1_limb_1_col8 = memoryidtobig_value_tmp_8b74_5.get_m31(1);
let op1_limb_1_col8 = memory_id_to_big_value_tmp_8b74_5.get_m31(1);
trace[8].data[row_index] = op1_limb_1_col8;
let op1_limb_2_col9 = memoryidtobig_value_tmp_8b74_5.get_m31(2);
let op1_limb_2_col9 = memory_id_to_big_value_tmp_8b74_5.get_m31(2);
trace[9].data[row_index] = op1_limb_2_col9;
sub_components_inputs.memory_id_to_big_inputs[0].extend(op1_id_col4.unpack());

lookup_data.memoryidtobig[0].push([
lookup_data.memory_id_to_big[0].push([
op1_id_col4,
op1_limb_0_col7,
op1_limb_1_col8,
Expand Down Expand Up @@ -302,19 +303,19 @@ pub fn write_trace_simd(
}

pub struct LookupData {
pub memoryaddresstoid: [Vec<[PackedM31; 2]>; 1],
pub memoryidtobig: [Vec<[PackedM31; 29]>; 1],
pub memory_address_to_id: [Vec<[PackedM31; 2]>; 1],
pub memory_id_to_big: [Vec<[PackedM31; 29]>; 1],
pub opcodes: [Vec<[PackedM31; 3]>; 2],
pub verifyinstruction: [Vec<[PackedM31; 19]>; 1],
pub verify_instruction: [Vec<[PackedM31; 19]>; 1],
}
impl LookupData {
#[allow(unused_variables)]
fn with_capacity(capacity: usize) -> Self {
Self {
memoryaddresstoid: [Vec::with_capacity(capacity)],
memoryidtobig: [Vec::with_capacity(capacity)],
memory_address_to_id: [Vec::with_capacity(capacity)],
memory_id_to_big: [Vec::with_capacity(capacity)],
opcodes: [Vec::with_capacity(capacity), Vec::with_capacity(capacity)],
verifyinstruction: [Vec::with_capacity(capacity)],
verify_instruction: [Vec::with_capacity(capacity)],
}
}
}
Expand All @@ -327,10 +328,10 @@ impl InteractionClaimGenerator {
pub fn write_interaction_trace<MC: MerkleChannel>(
self,
tree_builder: &mut TreeBuilder<'_, '_, SimdBackend, MC>,
memoryaddresstoid_lookup_elements: &relations::MemoryAddressToId,
memoryidtobig_lookup_elements: &relations::MemoryIdToBig,
memory_address_to_id_lookup_elements: &relations::MemoryAddressToId,
memory_id_to_big_lookup_elements: &relations::MemoryIdToBig,
opcodes_lookup_elements: &relations::Opcodes,
verifyinstruction_lookup_elements: &relations::VerifyInstruction,
verify_instruction_lookup_elements: &relations::VerifyInstruction,
) -> InteractionClaim
where
SimdBackend: BackendForChannel<MC>,
Expand All @@ -339,25 +340,25 @@ impl InteractionClaimGenerator {
let mut logup_gen = LogupTraceGenerator::new(log_size);

let mut col_gen = logup_gen.new_col();
let lookup_row = &self.lookup_data.verifyinstruction[0];
let lookup_row = &self.lookup_data.verify_instruction[0];
for (i, lookup_values) in lookup_row.iter().enumerate() {
let denom = verifyinstruction_lookup_elements.combine(lookup_values);
let denom = verify_instruction_lookup_elements.combine(lookup_values);
col_gen.write_frac(i, PackedQM31::one(), denom);
}
col_gen.finalize_col();

let mut col_gen = logup_gen.new_col();
let lookup_row = &self.lookup_data.memoryaddresstoid[0];
let lookup_row = &self.lookup_data.memory_address_to_id[0];
for (i, lookup_values) in lookup_row.iter().enumerate() {
let denom = memoryaddresstoid_lookup_elements.combine(lookup_values);
let denom = memory_address_to_id_lookup_elements.combine(lookup_values);
col_gen.write_frac(i, PackedQM31::one(), denom);
}
col_gen.finalize_col();

let mut col_gen = logup_gen.new_col();
let lookup_row = &self.lookup_data.memoryidtobig[0];
let lookup_row = &self.lookup_data.memory_id_to_big[0];
for (i, lookup_values) in lookup_row.iter().enumerate() {
let denom = memoryidtobig_lookup_elements.combine(lookup_values);
let denom = memory_id_to_big_lookup_elements.combine(lookup_values);
col_gen.write_frac(i, PackedQM31::one(), denom);
}
col_gen.finalize_col();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ use crate::relations;

pub struct Eval {
pub claim: Claim,
pub memoryaddresstoid_lookup_elements: relations::MemoryAddressToId,
pub memoryidtobig_lookup_elements: relations::MemoryIdToBig,
pub memory_address_to_id_lookup_elements: relations::MemoryAddressToId,
pub memory_id_to_big_lookup_elements: relations::MemoryIdToBig,
pub opcodes_lookup_elements: relations::Opcodes,
pub verifyinstruction_lookup_elements: relations::VerifyInstruction,
pub verify_instruction_lookup_elements: relations::VerifyInstruction,
}

#[derive(Copy, Clone, Serialize, Deserialize, CairoSerialize)]
Expand Down Expand Up @@ -97,10 +97,10 @@ impl FrameworkEval for Eval {
let op1_limb_1_col8 = eval.next_trace_mask();
let op1_limb_2_col9 = eval.next_trace_mask();

// DecodeInstruction_3a1aeaa2aac0bdcf.
// Decode Instruction.

eval.add_to_relation(RelationEntry::new(
&self.verifyinstruction_lookup_elements,
&self.verify_instruction_lookup_elements,
E::EF::one(),
&[
input_pc_col0.clone(),
Expand All @@ -121,18 +121,18 @@ impl FrameworkEval for Eval {
],
));

// ReadSmall.
// Read Small.

eval.add_to_relation(RelationEntry::new(
&self.memoryaddresstoid_lookup_elements,
&self.memory_address_to_id_lookup_elements,
E::EF::one(),
&[
(input_fp_col2.clone() + (offset2_col3.clone() - M31_32768.clone())),
op1_id_col4.clone(),
],
));

// CondDecodeSmallSign.
// Cond Decode Small Sign.

// msb is a bit.
eval.add_constraint((msb_col5.clone() * (msb_col5.clone() - M31_1.clone())));
Expand All @@ -146,7 +146,7 @@ impl FrameworkEval for Eval {
);

eval.add_to_relation(RelationEntry::new(
&self.memoryidtobig_lookup_elements,
&self.memory_id_to_big_lookup_elements,
E::EF::one(),
&[
op1_id_col4.clone(),
Expand Down
Loading
Loading