Skip to content
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: use cpufeatures to detect sha2 on aarch64 #267

Merged
merged 1 commit into from May 6, 2021

Conversation

tarcieri
Copy link
Member

@tarcieri tarcieri commented May 6, 2021

Uses the newly added aarch64 support in the cpufeatures crate for sha2 CPU feature detection on Linux and macOS/M1.

@tarcieri tarcieri force-pushed the sha2/use-cpufeatures-on-aarch64 branch from 78db9e2 to 2cc2468 Compare May 6, 2021 19:12
@tarcieri
Copy link
Member Author

tarcieri commented May 6, 2021

Confirm that the tests pass and this successfully detects sha2 support on an M1 Mac Mini:

test bench1_10    ... bench:           6 ns/iter (+/- 0) = 1666 MB/s
test bench2_100   ... bench:          47 ns/iter (+/- 2) = 2127 MB/s
test bench3_1000  ... bench:         463 ns/iter (+/- 2) = 2159 MB/s
test bench4_10000 ... bench:       4,639 ns/iter (+/- 30) = 2155 MB/s

@tarcieri
Copy link
Member Author

tarcieri commented May 6, 2021

Unfortunately it doesn't work on Linux because the cpufeatures macro is expanding code containing references to libc, which is a bug.

I will go ahead and extract that code into a small helper function ala the MacOS implementation.

Edit: fix here RustCrypto/utils#398

@tarcieri tarcieri force-pushed the sha2/use-cpufeatures-on-aarch64 branch from 2cc2468 to 55f0432 Compare May 6, 2021 19:35
Uses the newly added `aarch64` support in the `cpufeatures` crate for
`sha2` CPU feature detection on Linux and macOS/M1.
@tarcieri tarcieri force-pushed the sha2/use-cpufeatures-on-aarch64 branch from 55f0432 to 318106c Compare May 6, 2021 20:28
@tarcieri tarcieri merged commit d13936a into master May 6, 2021
@tarcieri tarcieri deleted the sha2/use-cpufeatures-on-aarch64 branch May 6, 2021 20:39
@tarcieri tarcieri mentioned this pull request May 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants