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

feat: add AES hardware acceleration for ARMv8 #5

Closed

Conversation

Blake-Haydon
Copy link

This PR adds AES hardware acceleration ARMv8. This is sometime called neon and has a significant speedup on ARM based machines.

Experimental results for my ARM based machine (DPF of size $N=1,000,000$):

  • Software AES: 9.23 seconds
  • Hardware AES: 0.49 seconds

Roughly a ~18x speedup with no performance degradation on non-ARM machines.

@myl7 myl7 self-assigned this Jan 31, 2024
@myl7
Copy link
Owner

myl7 commented Feb 2, 2024

The PR adds a RUSTFLAGS to improve the out-of-the-box performance, which should be enabled by the aes crate.

But I doubt whether there is a high requirement to embed the flag in this library?
RUSTFLAGS is passed to dependencies so users can alternatively set the flags in their own project (in their .cargo/config.toml, or even setting the env when compiling), which provides more flexibility.
Moreover, RUSTFLAGS like CFLAGS, and unlike features, is harder to be composed. With the flag always on, users who do not want the ARMv8 part can not easily exclude it like --no-default-features.
Finally, the ARMv8 part requires Rust 1.61+, which can be a problem for some old distros, e.g., Debian Bullseye (which is at 1.48).

All in all, I think it is better to require users to set the flag when using the library as a dependency.
I can add some description in the readme to help it.

@myl7 myl7 added the enhancement New feature or request label Feb 2, 2024
@Blake-Haydon
Copy link
Author

Blake-Haydon commented Feb 2, 2024

Very true, adding a comment in the docs is a better approach. I thought that it was worth bringing it up as it is a significant performance improvement for ARM based users.

@Blake-Haydon Blake-Haydon deleted the feat/AES-hardware-accel-ARMv8 branch February 2, 2024 07:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants