-
Notifications
You must be signed in to change notification settings - Fork 121
Fall back to software after trace generation #3449
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
base: main
Are you sure you want to change the base?
Changes from all commits
3717ee9
0c595a1
3b751da
483e5a5
ab93fee
f8a14e7
82ddadb
ff54de8
6c0b48d
5b7ba91
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,15 +8,22 @@ use std::{cmp::Eq, hash::Hash}; | |
| use crate::expression::{AlgebraicExpression, AlgebraicReference}; | ||
| use crate::{Apc, InstructionHandler}; | ||
|
|
||
| pub struct OriginalRowReference<'a, D> { | ||
| pub struct OriginalRowReference<'a, D, I> { | ||
| pub air_id: &'a I, | ||
| pub row_index: usize, | ||
| pub data: &'a D, | ||
| pub start: usize, | ||
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Removed this because it can be derived from the rest |
||
| pub length: usize, | ||
| } | ||
|
|
||
| pub struct TraceData<'a, F, D> { | ||
| impl<'a, D, I> OriginalRowReference<'a, D, I> { | ||
| pub fn start(&self) -> usize { | ||
| self.row_index * self.length | ||
| } | ||
| } | ||
|
|
||
| pub struct TraceData<'a, F, D, I> { | ||
| /// For each call of the apc, the values of each original instruction's dummy trace. | ||
| pub dummy_values: Vec<Vec<OriginalRowReference<'a, D>>>, | ||
| pub dummy_values: Vec<Vec<OriginalRowReference<'a, D, I>>>, | ||
| /// The mapping from dummy trace index to APC index for each instruction. | ||
| pub dummy_trace_index_to_apc_index_by_instruction: Vec<Vec<(usize, usize)>>, | ||
| /// The mapping from poly_id to the index in the list of apc columns. | ||
|
|
@@ -43,7 +50,7 @@ pub fn generate_trace<'a, IH, M: TraceTrait<IH::Field>>( | |
| instruction_handler: &'a IH, | ||
| apc_call_count: usize, | ||
| apc: &'a Apc<IH::Field, IH::Instruction>, | ||
| ) -> TraceData<'a, IH::Field, M::Values> | ||
| ) -> TraceData<'a, IH::Field, M::Values, IH::AirId> | ||
| where | ||
| IH: InstructionHandler, | ||
| IH::Field: Display + Clone + Send + Sync, | ||
|
|
@@ -104,15 +111,16 @@ where | |
| .iter() | ||
| .zip_eq(original_instruction_table_offsets.iter()) | ||
| .map(|(air_id, dummy_table_offset)| { | ||
| let trace = air_id_to_dummy_trace.get(air_id).unwrap(); | ||
| let (air_id, trace) = air_id_to_dummy_trace.get_key_value(air_id).unwrap(); | ||
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Interesting case here, |
||
| let values = trace.values(); | ||
| let width = trace.width(); | ||
| let occurrences_per_record = air_id_occurrences.get(air_id).unwrap(); | ||
| let start = (trace_row * occurrences_per_record + dummy_table_offset) * width; | ||
| let row_index = trace_row * occurrences_per_record + dummy_table_offset; | ||
| OriginalRowReference { | ||
| data: values, | ||
| start, | ||
| length: width, | ||
| air_id, | ||
| row_index, | ||
| } | ||
| }) | ||
| .collect_vec() | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added this because when an apc row fails tracegen, we need to know which original rows to add to the software tables.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Original rows aka rejected rows of the APC dummy traces?
Software tables aka non-APC traces?