-
Notifications
You must be signed in to change notification settings - Fork 39
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
feat: Enable more optional tables #724
Conversation
This reverts commit f63363b.
…le_keccak_optional_proving
I have successfully tested this PR on block 448 in the test chain. |
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.
LGTM, thanks! Just a couple of nits
Thank you for the careful review! |
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.
Thanks Sai, nice improvement overall! Just a couple nitpicky comments for readabily, otherwise looks good
let mut table_in_use = [true; NUM_TABLES]; | ||
if state.traces.keccak_inputs.is_empty() && OPTIONAL_TABLE_INDICES.contains(&Table::Keccak) { | ||
assert!(OPTIONAL_TABLE_INDICES.contains(&Table::KeccakSponge)); | ||
info!("Keccak and KeccakSponge tables not in use"); |
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.
I think my outdated comment got lost during refactoring, I was suggesting to remove all these info!
messages as they can get a bit noisy and are sharing information that is already guessable from the TraceCheckpoint
displayed on every segment proof.
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.
Actually, they serve different purposes. We have the config to choose which table should be optional, but I’m fine with changing them to log::debug.
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 I'd rather at least put them one level lower, to Debug
. Info
should really be only for meaningful outputs.
if final_len == 0 && OPTIONAL_TABLE_INDICES.contains(&MemAfter) { | ||
info!("MemAfter table not in use"); | ||
table_in_use[*MemAfter] = false; | ||
} |
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.
nit: we don't need to expose final_len
. MemAfter
is empty when there is nothing to propagate (final segment), which can be retrieved as so:
if final_len == 0 && OPTIONAL_TABLE_INDICES.contains(&MemAfter) { | |
info!("MemAfter table not in use"); | |
table_in_use[*MemAfter] = false; | |
} | |
let is_last_segment = next_data.registers_after.program_counter == KERNEL.global_labels["halt"]; | |
if is_last_segment && OPTIONAL_TABLE_INDICES.contains(&MemAfter) { | |
table_in_use[*MemAfter] = false; | |
} |
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.
The bool table_in_use is directly dependent on the length of trace rows. If there’s any change between is_last_segment and the length of trace rows (although it’s unlikely), then mem_after will not be empty, and we might encounter some bugs.
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 I can't see why we would ever get a non-empty final MemAfter, as there is nothing to propagate though, and we would catch the discrepancy anyway as we'd have conflicts in the challenges
evm_arithmetization/src/prover.rs
Outdated
&ctl_data_per_table[*$table], | ||
ctl_challenges, | ||
challenger, | ||
if !OPTIONAL_TABLE_INDICES.contains(&$table) || table_in_use[*$table] { |
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.
if !OPTIONAL_TABLE_INDICES.contains(&$table) || table_in_use[*$table] { | |
if table_in_use[*$table] { |
slightly more concise, and the shortcut from the first bool condition is not significant enough
I forgot to mention it in the review, but a next step could be to also skip altogether the commit phase for each of these tables, especially as some of these tables are padded to a default value larger than the cap length due to their permutation argument. |
Yes, this would require a significant refactor of how CTL works, including changes to Plonky2, with minimal performance gains. I’ll work on it, but I believe it’s a low priority for now |
Yeah we can just make it a tracking ticket for now. |
Thanks for reviewing! Comments are addressed, and the PR is merged. |
In addition to Keccak tables #620 , this PR enables BytePacking, Logic, MemAfter, and Poseidon tables as optional tables in the root circuit, reducing table proving time and recursion time.
Root circuit size change:
Before this PR
After this PR
Recursion Proving Time After this PR: