nickbabcock / highway-rs

Native Rust port of Google's HighwayHash, which makes use of SIMD instructions for a fast and strong hash function
https://crates.io/crates/highway
MIT License
154 stars 16 forks source link

ARM NEON (AdvSIMD) support #29

Closed valpackett closed 2 years ago

valpackett commented 4 years ago

The Google implementation now has code for NEON SIMD on aarch64 (and 32 but who cares): https://github.com/google/highwayhash/commit/ff5f27d785bda44e1ce0572b7f44943984ced61a

Porting to Rust would likely require adding new intrinsics to rust-simd..

nickbabcock commented 4 years ago

Scanning over their implementation, I believe that rust has all the intrinsics but they are only available on nightly. That probably means that we could detect at build time if we're on nightly and opt into this implementation. The biggest unknowns is how much this would complicate the code and what the best way to test and benchmark this (afaik ec2 graviton instances would probably be the best bet).

I'm typically against nightly rust but I'm open to incorporating this as something one opts into.

valpackett commented 4 years ago

Yeah, currently we usually do this with cargo features, like here in crc32fast.

I might work on this some time later..

ec2 graviton instances would probably be the best bet

Yes.

nickbabcock commented 4 years ago

Very nice, good to see you're familiar with simd, and any contribution would be greatly appreciated.

I believe I was too quick to conclude that all the intrinsics are available. I should make a running list but I've found the following ones missing:

pthariensflame commented 2 years ago

Things here are now much further along and more stable; I’d like to take a stab at implementing this if no one else is already doing it!

nickbabcock commented 2 years ago

Things here are now much further along and more stable; I’d like to take a stab at implementing this if no one else is already doing it!

Sounds great! I wasn't going to touch it until the aarch64 intrinsics reached stable, so feel free to tackle this 👍

nickbabcock commented 2 years ago

@pthariensflame if you made any progress let me know (and if not, no worries). Now that the instructions are on stable, I'm incline to start looking to tackle this.

pthariensflame commented 2 years ago

@pthariensflame if you made any progress let me know (and if not, no worries). Now that the instructions are on stable, I'm incline to start looking to tackle this.

Sorry for the long delay! I was planning to come back to this but if you'd rather do it yourself that's fine; I'd be happy to review whatever you produce too. ❤️ Thanks for reminding me!