Linear map generation for some muls and using the method of four russians #3
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
In sumcheck there are scenarios(like when the verifier issues a challenge) when one operand in a multiplication is fixed and repeated many times. This pull request aims to exploit and reduce redundant computations. This technique is especially very useful in bitsliced setting.
When one of the multiplication operand is repeated, we can generate a linear map of the multiplication. i.e there are no non-linear(AND) ops in the map. The map (referenced as constant mul matrix in code) is generated by multiplying the constant with basis elements of the field. This one time cost amortized over many multiplications where the same fixed operand is used.
Since the constant mul matrix is a linear map. Now we can use the "method of four russians" on it and reduce the number of XOR operations significantly.
There are lot of optimizations that still can be done. But this PR is a minimal proof of concept and with localized changes. For NUM_VARS: 28 COMPOSITION_SIZE: 4 we get about 11% improvement in raw computation.