-
Notifications
You must be signed in to change notification settings - Fork 275
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: added a UnivariateMonomial representation to reduce field ops i…
…n protogalaxy+sumcheck (#10401) Summary: `client_ivc_bench.sh` benchmark has been improved by approx 10% (26218ms vs 29306ms) In both protogalaxy + sumcheck, the basic representation of the edge of the boolean hypercube is now a degree-1 monomial instead of a MAX_RELATION_DEGREE-degree monomial The class UnivariateMonomial can efficiently evaluate low-degree monomial relations of up to degree-2. The relations in the `relations` directory have been reworked to perform initial low-degree algebraic computations using UnivariateMonomial, only converting to a full Monomial object once the UnivariateMonomial would otherwise exceed degree-2 Reason why we do all of this: 1. for MegaFlavor, `extend_edges` was converting every flavour polynomial into a degree-11 Univariate. This was introducing 9 Fp additions * NUM_ALL_ENTITIES per row in the circuit. Given the sparse trace structure we are working with, this is a lot of computation that this PR makes redundant 2. for each relation, we check if it can be skipped by typically calling `is_zero` on a selector. The selector poly is in Univariate form (MegaFlavor = degree-11) which is 11 Fp zero-checks. MegaFlavor has 9 skippable relations which is 99 Fp zero-checks. With the new degree-2 representation this is reduced to only 18 Fp zero-checks 3. The number of raw Fp add and mul operations required to evaluate our relations is reduced. For example, in the permutation argument each `*`/`+` operation in the `accumulate` function was costing us 11 Fp muls/adds. It is cheaper to compute low-degree sub-terms in the coefficient representation before extend inginto point-evaluation representation e.g. consider (in the protogalaxy case where challenges are degree-1 univariates) `(w_i + \beta * S_i + \gamma)` for `i = 0,1,2,3`. In coefficient representation this term can be computed with 8 Fp adds and 3 Fp muls. Extending into a degree-11 point evaluation form costs 18 Fp adds for a total of 26 Fp adds and 3 Fp muls. In master branch, using Univariate<11> this computation costs us 20 Fp adds and 10 Fp muls. Assuming an add is 1/3 the cost of a mul, this makes the new approach cost 35 Fp add-equivalent operations vs 50 Fp add-equivalent Overall in the new approach, the number of field operations to compute the permutation argument has reduced by 30%
- Loading branch information
1 parent
8b4387d
commit 15475f4
Showing
34 changed files
with
1,288 additions
and
463 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.