-
Notifications
You must be signed in to change notification settings - Fork 37
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
Add STARK batching #388
Add STARK batching #388
Conversation
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.
some perf comments. I suspect a large part of the overhead coming from the 3 sections cloning the entire PolyValues though
// Add lookup columns. | ||
let lookups = stark.lookups(); | ||
let mut res = { | ||
let mut columns = Vec::new(); |
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.
let mut columns = Vec::new(); | |
let mut columns = Vec::with_capacity(lookups.len() * config.num_challenges); |
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.
There are more columns than that, since the number of lookup columns depend on the individual lookups. I don't think computing it just for the capacity is worth it?
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.
yeah it's a lower bound, but it avoids all intermediary allocations. Right now we're starting with a capacity of 4.
evm_arithmetization/src/prover.rs
Outdated
let mut degree_bits_squashed = Table::all_degree_logs().to_vec(); | ||
degree_bits_squashed.dedup(); |
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.
why not a HashSet
?
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.
We need a slice as argument for prove_openings
so I decided to go with a vec directly.
evm_arithmetization/src/prover.rs
Outdated
let trace_poly_values_sorted: [_; NUM_TABLES] = Table::all_sorted() | ||
.iter() | ||
.map(|&table| trace_poly_values[*table].clone()) | ||
.collect::<Vec<_>>() | ||
.try_into() | ||
.unwrap(); | ||
|
||
// We compute the Field Merkle Tree of all STARK traces. | ||
let trace_polys_values_sorted_flat: Vec<_> = trace_poly_values_sorted | ||
.clone() | ||
.into_iter() | ||
.flatten() | ||
.collect(); | ||
let num_trace_polys = trace_polys_values_sorted_flat.len(); |
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.
Same here, the clones are way too heavy
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.
These clones are a bit trickier to remove, but I got rid of the other two sections.
evm_arithmetization/src/prover.rs
Outdated
pub fn zkevm_fast_config() -> StarkConfig { | ||
let cap_height = 4; | ||
let mut strategy = Vec::new(); | ||
for window in Table::all_degree_logs().windows(2) { | ||
if window[0] != window[1] { | ||
strategy.push(window[0] - window[1]); | ||
} | ||
} |
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.
How do you intend to have it work with dynamic batching? The config must be known for preprocessing
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.
Hmm, good point. I guess the easiest way would be to add a BatchedStark
strategy to compute this dynamically.
097e324
to
f44f9a4
Compare
Replaces #366.
This one is targeting
feat/continuations
instead ofdevelop
.