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: fix AVX backend #345

Merged
merged 6 commits into from Jan 6, 2022
Merged

sha2: fix AVX backend #345

merged 6 commits into from Jan 6, 2022

Conversation

newpavlov
Copy link
Member

Closes #344

sha2/src/sha512/x86.rs Outdated Show resolved Hide resolved
@elichai
Copy link

elichai commented Jan 6, 2022

This is much nicer!

@elichai
Copy link

elichai commented Jan 6, 2022

On my machine(i9-9980HK) with turbo boost off, ran it a few times to make sure I get consistent result

Before:

test sha256_10    ... bench:          80 ns/iter (+/- 6) = 125 MB/s
test sha256_100   ... bench:         808 ns/iter (+/- 99) = 123 MB/s
test sha256_1000  ... bench:       7,734 ns/iter (+/- 402) = 129 MB/s
test sha256_10000 ... bench:      76,839 ns/iter (+/- 24,415) = 130 MB/s
test sha512_10    ... bench:          42 ns/iter (+/- 1) = 238 MB/s
test sha512_100   ... bench:         405 ns/iter (+/- 12) = 246 MB/s
test sha512_1000  ... bench:       3,532 ns/iter (+/- 587) = 283 MB/s
test sha512_10000 ... bench:      33,786 ns/iter (+/- 651) = 295 MB/s

After:

test sha256_10    ... bench:          80 ns/iter (+/- 1) = 125 MB/s
test sha256_100   ... bench:         789 ns/iter (+/- 11) = 126 MB/s
test sha256_1000  ... bench:       7,727 ns/iter (+/- 28) = 129 MB/s
test sha256_10000 ... bench:      76,364 ns/iter (+/- 1,379) = 130 MB/s
test sha512_10    ... bench:          40 ns/iter (+/- 0) = 250 MB/s
test sha512_100   ... bench:         390 ns/iter (+/- 22) = 256 MB/s
test sha512_1000  ... bench:       3,497 ns/iter (+/- 117) = 285 MB/s
test sha512_10000 ... bench:      33,845 ns/iter (+/- 7,469) = 295 MB/s

@elichai
Copy link

elichai commented Jan 6, 2022

Just ran the same code in #344 and it doesn't crash

$ RUSTFLAGS='-Clink-arg=-fuse-ld=lld -Clinker-plugin-lto' cargo r
    Finished dev [unoptimized + debuginfo] target(s) in 0.01s
     Running `target/debug/wat`
[114, 100, 141, 235, 57, 20, 22, 206, 85, 130, 13, 65, 63, 33, 253, 46, 205, 24, 97, 124, 98, 149, 88, 88, 5, 158, 217, 104, 21, 56, 14, 150, 12, 43, 176, 5, 247, 183, 146, 200, 42, 155, 182, 2, 46, 191, 224, 193, 58, 249, 124, 43, 226, 194, 67, 166, 58, 22, 38, 122, 42, 128, 55, 218]

newpavlov added a commit that referenced this pull request Jan 6, 2022
newpavlov added a commit that referenced this pull request Jan 6, 2022
newpavlov added a commit that referenced this pull request Jan 6, 2022
@newpavlov newpavlov merged commit 4c1d9da into master Jan 6, 2022
@newpavlov newpavlov deleted the sha2_avx_fix branch January 6, 2022 19:27
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.

Bug in Sha512 AVX(2) implementation
2 participants