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. |
This gives a big speed improvement on aarch64: RustCrypto/hashes#490 (comment) Differential Revision: https://phabricator.services.mozilla.com/D229400
This gives a big speed improvement on aarch64: RustCrypto/hashes#490 (comment) Differential Revision: https://phabricator.services.mozilla.com/D229400
Adds NEON-enabled backends for SHA2 on
aarch64.Eliminates the need for the
asmfeature onaarch64for SHA-{224, 256} performance and provides a big performance boost for SHA-512, which didn’t benefit from theasmfeature.Before:
After:
(Benchmarks run on my M2 Air laptop, unplugged, on my kitchen table.)