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
sha2: Add aarch64 backends for SHA2. #490
Conversation
Neat! I hadn't thought about using inline ASM as a sort of "polyfill" for using unstable intrinsics on stable Rust before. This is something we should consider doing elsewhere we use unstable aarch64 intrinsics, such as in the |
Update the cross version to fix the CI failures. |
What should I bump it to? |
1.59 |
Can you compare performance after addition of the options? The resulting assembly is somewhat different. Number of instructions is the same, so hopefully it's only reordering which may even improve performance. |
No real difference. Before:
After:
|
Thank you! |
Now that this is merged, what’s the remaining work to drop the |
We would need to migrate the x86-64 implementation from it to inline asm. IIRC it's still a bit faster than our software fallback. |
I ask b/c I was running some related benchmarks on a GCE With
Without
Definitely within the margin of error. Maybe on a different CPU? |
You are getting results for the SHA-NI and AVX2 backends (the asm backend is treated as a replacement for the software backend, thus it has lower priority). On my laptop after I disabled them I get:
|
Ah, gotcha. Thanks for clearing that up. |
Adds NEON-enabled backends for SHA2 on
aarch64
.Eliminates the need for the
asm
feature onaarch64
for SHA-{224, 256} performance and provides a big performance boost for SHA-512, which didn’t benefit from theasm
feature.Before:
After:
(Benchmarks run on my M2 Air laptop, unplugged, on my kitchen table.)