AMD performances vs Intel on BLAKE3-C-straight, no asm #546
Labels
No labels
announcement
bug
build
CI
dependencies
documentation
duplicate
enhancement
experience feedback
feature request
github_actions
help wanted
install
invalid
Long-term
optimization
portability
question
target-specific
test issue
wontfix
No milestone
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
gh-Cyan4973/xxHash#546
Loading…
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Doing some test I find that the "straight" C (no asm, no SSE etc) implementation of BLAKE3 (in C) runs about 50% faster of SHA-256 on very rough benchmark, for older i7 and just old i7 (Windows 10).
But on AMD 5950X runs 3% slower (of SHA-256), at least in my implementation.
Others hash-checksum does not shows this behavior (broadly respect the performance differences, about 1.5x for i7 8700K and about 2.2x for 2600K)
Short version: BLAKE3 runs much faster (on Intel i7) against SHA256, but (a bit) slower on AMD 5950
Anyone have experience on this?
Thanks for any comments
Maybe
SHAhas been specifically optimized on AMD ?In fact no.
SHA-1 have a rather "smart" implementation with a "cache", but nothing special.
SHA-256 is very straight C++ (in fact there are two SHA-256, the first in C very similar to SHA-1, the second in C++)
You can find here (with BLAKE3, of course)
https://github.com/fcorbelli/zpaqfranz/blob/main/zpaqfranz.cpp
That's not what I meant.
When designing a general purpose CPU, engineers have to target a broad range of workloads in order to announce a certain IPC gain. Some workloads get more attention than others. For example, SPECint tends to get a lot of attention. The assumption here is that maybe AMD paid more attention to
SHA, or rather to the sequence of instructions that is commonly found inSHA, and ensured their cpu was especially well optimized for this sequence.This would be consistent
SHAgetting ax2.8speed increase while all other algorithms have ~x2.2 or less.I did not meant that AMD has a special instruction set for
SHA, such a thing would bring at least an order of magnitude in speed improvement, but be extremely difficult to deploy, due to the specificity of the instruction set.Sure it is possible, but I think the difference is too great.
On Intel CPU, AND AMD, SHA-1 runs (about) 3 time faster than SHA-256
On Intel CPU, BLAKE3 runs (about) 50% faster than SHA-256
On AMD CPU, BLAKE3 runs (about) as fast as SHA-256
SHA-256 AND SHA-1 on AMD runs (~) 1.5x than older Intel SHA-256 and SHA-1
So the AMD chip is (very rough!) 1,5 times faster than Intel overall (on those CPU-bound algos).
BUT
why BLAKE3 on Intel runs just as fast as AMD (in absolute MB/s)?
AMD (running average ~1.5x faster then Intel) should achieve ~400MB/s (or whatever)
Others lighter algo (xxhash, xxh3, wyhash, even CRC-32) do not exhibit this behavior: the AMD chip is faster everywhere in absolute numbers.
Sometimes 1.4x, sometimes 1.6x, sometimes the RAM latency play a bigger role, sometimes the cache etc, it doesn't matter.
Before implementing BLAKE3 (stripped-C version) in my software all things was (about) as expected. In fact OR BLAKE3 (/the gcc compiler) "loves" Intel, or... "hates" AMD.
I have plenty of Intel CPU (mostly Xeons), but not others AMD to make more comparisons