Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Poseidon: vectorized MDS matrix multiplication (AVX2) #229

Merged
merged 13 commits into from
Sep 13, 2021

Conversation

nbgl
Copy link
Contributor

@nbgl nbgl commented Sep 10, 2021

AVX2 implementation of the MDS layer for Crandall. Makes width-8 Poseidon go from 1.8µs to 1.4µs and width-12 from 3.0µs to 2.1µs.

Yes, it’s completely unrolled. While I have heard of loops, they do not seem too useful here. Rust complains that SHIFT_AMT[i] is not a constant (because i is a loop counter) and does not want to place it in an immediate. We could place some of the function in unrolled loops, but I actually found that harder to read and it was inexplicably slower.

@nbgl nbgl requested a review from dlubarov September 10, 2021 20:06
@nbgl nbgl changed the title Poseidon: vectorized MDS matrix multiplication Poseidon: vectorized MDS matrix multiplication (AVX2) Sep 11, 2021
src/hash/poseidon.rs Outdated Show resolved Hide resolved
@nbgl nbgl requested a review from dlubarov September 11, 2021 22:17
Copy link
Contributor

@dlubarov dlubarov left a comment

Choose a reason for hiding this comment

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

LGTM apart from the couple comment requests from the NEON PR

@nbgl nbgl merged commit 6465e35 into main Sep 13, 2021
@nbgl nbgl deleted the jakub/poseidon-mds-avx2 branch September 13, 2021 18:46
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.

2 participants