Skip to content

feat: MDS mult. using FFT & special matrix#10

Draft
Al-Kindi-0 wants to merge 4 commits into
mainfrom
rescue_final
Draft

feat: MDS mult. using FFT & special matrix#10
Al-Kindi-0 wants to merge 4 commits into
mainfrom
rescue_final

Conversation

@Al-Kindi-0
Copy link
Copy Markdown
Owner

This PR implements an optimization, discussed in the setting of the Poseidon hash function here, and relies on FFT-based fast matrix-vector multiplication techniques for circulant matrices. See here for a light exposition of the ideas.
By choosing an MDS matrix of a very special form, we are able to implement several optimizations on top of the FFT-based multiplication. More precisely, the MDS matrix we chose has components that are small powers of two in "frequency domain" and some of these powers are even equal to zero, provided we scale the (i)FFT appropriately. This translates to multiplications, in frequency domain, being substituted with shifts or even removed entirely. Moreover, the small powers of two entries permit very efficient scheduling of modular reductions. The special matrix we use was found using very optimized code that was kindly provided by the Polygon Zero team. The current implementation benefited, in addition, of the discussions and insights of Hamish Ivey-Law and Jacqueline Nabaglo.

@Al-Kindi-0 Al-Kindi-0 requested a review from bobbinth July 13, 2022 18:05
Copy link
Copy Markdown
Collaborator

@bobbinth bobbinth left a comment

Choose a reason for hiding this comment

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

Overall, looks good but a couple of comments:

  1. I think mds_freq.rs file is not longer a part of this PR for some reason.
  2. Let's mention Hamish and Jacqueline in the code comments as well (in the mds_freq.rs).
  3. Let's add a sentence or two on performance improvements to the PR description.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants