-
Notifications
You must be signed in to change notification settings - Fork 103
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
AArch64 implementation #90
Conversation
All tests pass on M1 Mac.
Edit: fallback comparison (thanks liamwhite)
I'm getting a few |
M1 Mac: passes all tests and aes benches, but only on +nightly (because of the |
The There also is a second issue: I will look through the code and see if there is any problem with this approach as-is. However this is also an opportunity, it ought to be possible to design a version which on arm invokes one less call to aes, but produces the same quality output. In the meantime, can either of you run the smhasher test against it as a sanity test? There is a shell script checked into the repo in the smhasher directory. If you run clone_smhasher.sh from that directory, and then build the |
self.enc = aesenc(self.enc, length as u128);
|
I wrote a test: fn test_length_extension<T: Hasher>(hasher: impl Fn() -> T) {
for i in 0..=255u8 {
let v1 = hash(&[i], &hasher);
let v2 = hash(&[i, 0], &hasher);
assert!(v1 != v2, "i: {} -> v1 = {:x}, v2 = {:x}", i, v1, v2);
}
}
mod aes_tests {
#[test]
fn aes_length_extension() {
test_length_extension(|| AHasher::test_with_keys(0, 0));
}
} It passes on aarch64:
(note that it fails the fallback test) How should I change it to get the failure mode you describe? |
The fallback is failing because you are calling |
I was wrong above. There is no issue. The code is robust against what I was proposing there. |
The name of the "nightly" feature feels wrong. If it was automatically enabled when using the +nightly toolkit it would be ok, but it isn't. To use it we have to build with +nightly and select the feature "nightly". Wouldn't it be more descriptive to name it "stdsimd" - i.e. a feature that only can be used in nightly? P.S. I just checked that |
Quite a few crates use a |
Guess it comes down to the intent of the feature flag. If there are more (future) features that could make use of the same flag (like hash brown) it makes sense with a name like "nightly". For an isolated feature it would be better with a more descriptive name, imho. And yes: M1 mac completes all tests on +stable and +nightly. |
Detection of nightly can be handled in the build without requiring users to specify a flag. See: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be good if we could get the SMHasher results also.
M1 Mac, regarding SMHasher: The patch
|
I see the patch does not apply because smhasher directly added support for aHash! |
@eadf What is the status of SMHasher? I don't quite follow from the linked PR. |
It does not build on a M1, the cmake script fails to identify the architecture and the compiler says that it does not support |
In that case I am going to merge this, and open an issue to track it. |
Fixes #84. Not particularly polished.
Passes all tests:
Benchmark (Qualcomm Snapdragon 730G):
... as compared to fallback implementation on 730G:
(main timing difference appears in string benchmark)