[Performance Improvement] Poseidon with AVX2 (x86-64) #1621
+1,677
−988
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.
This is a performance improvement PR targeting x86-64 systems with AVX2 support.
target bottleneck
Currently, Plonky2 does not have a working AVX2 Poseidon hashing implementation. AVX2 has the potential to improve the performance of Poseidon hashing by executing up to 4 64-bit Goldilocks operations at the same time.
how performance is measured
We use current benchmarks in plonky2/benches:
With AVX2 support, we run:
We checked the performance on a c7i.2xlarge AWS instance with AMD CPU with the following specs:
CPU: AMD EPYC 9R14 (16 vCPU)
RAM: 16 GB
OS: Ubuntu 24.04
Compilers: GCC 13
Rust: rustc 1.82.0-nightly
Performance improvement is 10-12%. For example, the output of
RUSTFLAGS="-C target-feature=+avx2" cargo bench --bench=merkle
is: