Muhash parallel reduce -- optimize U3072 mul when LHS = one #581
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.
The following PR tightens performance of parallel muhash reduction by adding a special condition within the inner
U3072::mul
. Results suggest that using multiple threads strongly scales now, as oppose to prior to this change where much of the gain was countered by the increased number of inner mul ops.The optimization is to short-circuit and self assign
other
(RHS) when LHS is one. This case is especially frequent during parallel reduce operation where the identity (one) is used for each sub-computation (at the LHS).Benchmarks before 09d6679:
and after: