Port AES-GCM AVX-2 implementation from BoringSSL#2934
Conversation
14506c1 to
8d94e2a
Compare
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2934 +/- ##
=======================================
Coverage 78.17% 78.18%
=======================================
Files 693 693
Lines 123874 123921 +47
Branches 17200 17209 +9
=======================================
+ Hits 96840 96885 +45
+ Misses 26116 26115 -1
- Partials 918 921 +3 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
Hi @sticnarf, thanks for your contribution! We are trying to prioritize reviewing and merging this PR, but we are missing some data on how impactful the performance improvement would be (we are weighing the performance benefit against the added complexity, code size, and potential for new bugs). What is your use case for this? Do you know of a service or app that uses Zen3 CPUs extensively? |
My service involves heavy TLS data transfer and is subject to random scheduling across different nodes (including Zen 3 instances). I'm trying to optimize its CPU consumption. Currently, AES encryption/decryption accounts for 20% of the total CPU usage. That's why I hope this optimization can be added to AWS-LC. By the way, I'm not so familiar with the wide variety of CI configurations here. It seems the failures mostly occur on older operating systems, which I suspect might be related to linker or compiler support for AVX2 instructions. Does it mean the code should also respect the |
|
@bgemmill thanks for following up. I'll start reviewing the code and suggest ways to fix the CI failures. |
8d94e2a to
2e9fd41
Compare
|
@dkostic I've updated |
2e9fd41 to
2587073
Compare
|
Update again to align it more closely with |
2587073 to
df9d6b0
Compare
|
Sorry, I had to do the rebase again. The keccak dispatch indices in |
Signed-off-by: Yilin Chen <sticnarf@gmail.com>
Issues:
Addresses #2283
Description of changes:
On x86_64 CPUs that support VAES + VPCLMULQDQ + AVX2 but do not support AVX-512 (notably AMD Zen 3 and some Intel client parts), AWS-LC would not take advantage of the newer VAES/VPCLMUL instructions.
This change ports BoringSSL’s AES-GCM AVX2 VAES + VPCLMULQDQ implementation (https://github.com/google/boringssl/blob/main/crypto/fipsmodule/aes/asm/aes-gcm-avx2-x86_64.pl) into AWS-LC.
Call-outs:
The
aesni-gcm-avx2.plin this PR is mostly identical to BoringSSL'saes-gcm-avx2-x86_64.plexcept:x86_64-xlate.plwork.BORINGSSL_function_hitindex is set to 9.Testing:
crypto_testpasses andbsslshows expected performance on my Zen 3 desktop.By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license and the ISC license.