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

Second Attempt of VAES #186

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

SchrodingerZhu
Copy link

No description provided.

@SchrodingerZhu
Copy link
Author

SchrodingerZhu commented Nov 21, 2023

Patch will change hash behavior w/ or w/o VAES. Bascially, it increases the batch size to 2x128bits for large enough input and add another two rounds of aesenc before summarizing the values into the hasher states.


Without VAES:
image


With VAES:
image

}
}

pub(crate) fn shuffle_and_add_vec256(base: Vector256, to_add: Vector256) -> Vector256 {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here and below, these should probably have an inline annotation

@@ -160,6 +210,9 @@ impl Hasher for AHasher {
self.hash_in(value.convert());
} else {
if data.len() > 32 {
if data.len() > 128 {
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is sub-optimal. It's handling the >128 case but then the >64 case below is only for 65-128, which could be specialized be more efficient.
I would be tempted to avoid the additional if check if possible as branch mispredictions are more common and costly than show up in benchmarks where the data is predictable. But I don't have a good sense on how much is lost operating on 4 blocks at a time as opposed to 8.

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.

2 participants