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

Optimize FRI remainder polynomial check #1670

Conversation

Al-Kindi-0
Copy link
Collaborator

Follow-up to #1665.
Instead of using the probabilistic NTT to do the FRI remainder polynomial check, we use direct polynomial evaluation using horner_eval_ext.
In the process of this PR, the strict bounds $64$, $128$, $256$ on the degree of the remainder polynomial where tested and the choice $128$ was found to be optimal when the number of FRI queries is $27$.

The recursive verifier in #1665, verifies an execution trace of size 1 << 20 rows in:

  1. $39059$ main trace rows, and
  2. $57256$ hasher chiplet rows.

The recursive verifier in this PR, verifies an execution trace of size 1 << 20 rows in:

  1. $32786$ main trace rows, and
  2. $52880$ hasher chiplet rows.

Putting in draft until the preceding PRs get merged.

@plafer plafer mentioned this pull request Mar 5, 2025
@Al-Kindi-0 Al-Kindi-0 force-pushed the al-update-recursive-verifier-after-horner-eval-and-optimize-remainder branch from 693f6a8 to 9dfec5e Compare March 18, 2025 17:16
@Al-Kindi-0 Al-Kindi-0 marked this pull request as ready for review March 18, 2025 17:18
@Al-Kindi-0 Al-Kindi-0 force-pushed the al-update-recursive-verifier-after-horner-eval-and-optimize-remainder branch from 7f5a4e6 to 361ffab Compare March 18, 2025 18:26
@Al-Kindi-0 Al-Kindi-0 requested review from plafer and bobbinth March 18, 2025 18:29
Copy link
Contributor

@bobbinth bobbinth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! Thank you! Not a full review, but I left some comments inline.

where
E: FieldElement,
{
p.iter().fold(E::ZERO, |acc, &coeff| acc * E::from(x) + coeff)
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
p.iter().fold(E::ZERO, |acc, &coeff| acc * E::from(x) + coeff)
p.iter().reduce(|acc, &coeff| acc * E::from(x) + coeff).unwrap_or(E::ZERO)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think fold is a bit cleaner to me, but no strong preference, let me know

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's perfectly fine, especially since this is a test, and it only saves one multiplication.

let remainder = channel.read_remainder::<4>(remainder_commitment)?;
for (pos, eval) in final_pos_eval.iter() {
if remainder[*pos] != *eval {
let remainder_poly = channel.read_remainder::<4>(remainder_commitment)?;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we replace the const generic with a constant?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With the recent changes, we don't need the const anymore so I removed it now
Thank you for pointing it out

@bobbinth
Copy link
Contributor

@Al-Kindi-0 - v0.12.2 winter-prover and winter-verifier crates (with the reversal of remainder commitment coefficients) are on crates.io.

Copy link
Contributor

@plafer plafer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very cool! Love seeing the horner ops progressively improving the falcon & recursive verifier 🙂

Left a few nits to help readability

@Al-Kindi-0 Al-Kindi-0 force-pushed the al-update-recursive-verifier-after-horner-eval-and-optimize-remainder branch from a517393 to 36abaf7 Compare March 20, 2025 07:16
Copy link
Contributor

@bobbinth bobbinth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! Thank you! I Overall, I'd probably move even more functionality into getters/setters instead of getting pointers and loading from memory (and I left a couple of comments about this) - but that's something we can do in follow-up PRs.

Copy link
Contributor

@bobbinth bobbinth left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good! Thank you!

@bobbinth bobbinth merged commit 4582d3c into next Mar 21, 2025
8 checks passed
@bobbinth bobbinth deleted the al-update-recursive-verifier-after-horner-eval-and-optimize-remainder branch March 21, 2025 00:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants