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

feat: direct multivariate polynomial evaluation in non-native #1299

Merged
merged 14 commits into from
Nov 22, 2024

Conversation

ivokub
Copy link
Collaborator

@ivokub ivokub commented Oct 16, 2024

Description

This PR adds direct multivariate polynomial evaluation using non-native arithmetic. It can be used to perform direct extension computation, used in pairing computation (BW6, BN254, BLS12-377).

The idea is very similar to the multiplication approach, but when we do the evaluation check then we can work with arbitrary multivariate polynomials. This is really beneficial as the most of the cost is in range checking the result and the quotient, so when we can amortize multiple operations.

Another PR using it in BW6 evaluation is incoming, but it saves more than 50% of constraints in the Miller loop computation.

NB! One thing which I haven't figure out is how to allow negative coefficients. For example for BW6 we need to multiply by the non residue -4 for which we currently use a non-native value. But this changes the carry computation and SZ check which still isn't fully functional. But I think I'll keep it for the future to get working.

Type of change

  • New feature (non-breaking change which adds functionality)

How has this been tested?

  • TestPolyEval

Checklist:

  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • I have added tests that prove my fix is effective or that my feature works
  • I did not modify files generated from templates
  • golangci-lint does not output errors locally
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published in downstream modules

@ivokub ivokub requested a review from gbotrel November 4, 2024 16:13
@ivokub ivokub self-assigned this Nov 4, 2024
@ivokub ivokub added the perf label Nov 4, 2024
@ivokub ivokub added this to the v0.11.N milestone Nov 4, 2024
@ivokub ivokub marked this pull request as ready for review November 4, 2024 16:13
Copy link
Collaborator

@gbotrel gbotrel left a comment

Choose a reason for hiding this comment

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

nice, I like the new interface and multivariate poly representation, much easier to follow / less verbose :)

std/math/emulated/field_mul.go Outdated Show resolved Hide resolved
@ivokub ivokub requested a review from gbotrel November 22, 2024 13:32
@ivokub ivokub merged commit 32e3404 into master Nov 22, 2024
5 checks passed
@ivokub ivokub deleted the feat/nna-poly branch November 22, 2024 14:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants