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.
NaiveMulMod
instead ofnaiveMulMod
Use case for the SIS hash function:
The function
instance.Sum(...)
is called in "bulk".Namely, in the prover we want to hash many vectors at the same time. Thus, there is no need to parallelize within the
instance.Sum
function. For this reason, we only care about the single-threaded performances of theSum
function.In the past version (pure-SIS), we noticed there was an issue with the memory bandwidth footprint of the function (on 96 cores, the memory bus was the bottleneck). But we believe, this will not be the case with the
ring-SIS
approach that we wish to optimize.The function is importantly used
The vectors we intend to hash (seen as slices of field elements) typically contain plenty of successive zeroes.
The SIS hash function works by splitting in limbs the fields elements, then interpreting the limbs as the coefficients of polynomials and then performing a scalar product of polynomials.
Let us illustrates it with an example (where we assume q = 251, log2beta=2, n = 2). And let$x$ be an input vector $x = (172, 201, 0, 0, 0, 0)$ where each entry is understood to be in the field modulo 251.
Note, that P2 and P3 are the zero polynomials.
H = P0A0 + P1A1 + P2A2 + P3A3
The optimization is to notice that since P2 and P3 are the zero polynomial, we can just "skip" the term in the scalar product.
While it looks simple, it is a crucial optimization for the prover.