-
Notifications
You must be signed in to change notification settings - Fork 26
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
Optimize sha256 for aarch64 #27
Conversation
Thank you! @linkmauve |
I can give this a try on an M1 |
Thank you for watching this. BTW, we run Regards. |
Ping... Can I get a review for this, is there any suggestions? Thanks. :) |
@tarcieri |
Yep, been meaning to validate it on an M1. I'll see if I can take a look today. |
Hrmm, interesting. The
I'd say this PR looks good to merge then, but separately we should track an M1 build failure. Edit: opened #28 to track this |
Thanks! |
Hi,
The sha256 is top hotspot for some applications, e.g.
Phase1
infilecoin/lotus
, this patch optimizes it for aarch64.It mainly remove the dependency between
ldr
andadd
in each four rounds by preloadingK
constants into NEON registers.We also take advantages of
load/store pair
andld1
instructions to reduce the instructions executed.Verified with repository
sha2
[1], test commands:cargo +nightly test --features "asm"
,cargo +nightly test --release --features "asm"
.On our aarch64 server (core
tsv110
), we witnessed11.90%
improvements with benches underasm-hashes/sha2
:[1] https://github.com/dgbo/hashes/tree/master/sha2