Repository navigation
Improve MD5 with SIMD - #105161
Improve MD5 with SIMD#105161
Conversation
|
Workflow [PR], commit [021ec77] Summary: ✅ AI ReviewSummaryThis PR replaces Final Verdict
|
|
Thanks! I like the implementation. This is exactly what I wanted in #58394, see "Data parallel implementation of hash functions for fixed-size strings", but I was afraid of temporary copies to align widths. Hope after we merge this, we will extend it to SipHash, SHA-1, and SHA-2. |
|
@jh0x @alexey-milovidov I opened a small follow-up against this branch for AArch64 ASIMD, using the same dependency-free The idea is to keep the direction of this PR, but cover ARM / Apple / Linux AArch64 without adding ISA-L Crypto. I validated it locally on Linux arm64 against OpenSSL for RFC-style vectors, 55/56/63/64/65-byte padding boundaries, partial 8-row batches, mixed sizes, and multi-batch execution. Standalone backend benchmark on Apple M4 Pro / Linux arm64 showed about 4x over OpenSSL scalar for the tested row shapes. This is not a full ClickHouse binary benchmark yet, but it looked promising enough to check whether the ARM backend is worth folding into this PR. |
I added one perf test and it doesn't appear in the workflow run:
I don't think so - wasn't looking at this one. I should have a look in the evening with |
|
I added a commit that gets it done without using SSL: @alexey-milovidov On the machine above I get: I should work with |
|
I'd like to test on URL, Referer, Title, SearchPhrase, MobilePhoneModel from ClickBench. |
|
@jh0x @alexey-milovidov can you also please review . One for some tests and other for ARM as dicussed before. https://github.com/jh0x/ClickHouse/pull/1 @alexey-milovidov Also can I help/contribute with SIMD for other hash functions without bringing external dependencies? |
|
@vyalamar, yes, it will be amazing! MD5 is used in legacy scenarios; adding SipHash and SHA-1,2 will be more practical! |
|
It's harder to review PRs in forks, because of less automation... It will be ok, if you create a PR here, that is a superset of commits from this PR, and you can merge commits from each other's PRs. |
|
Sure will do the same. At the gym right now . Will do in few hours. |
|
Need to push one more commit + will bring |
|
@alexey-milovidov since this is close to merge, perhaps will rebase to this and then bring my two PRs. |
LLVM Coverage Report
Changed lines: 94.34% (200/212) · Uncovered code |



Related: #104887
Approach is similar to isa-l but very simplified.
Factored out the function into a separate TU to reduce the clutter.
Also removed OpenSSL dependency for MD5.
Results from:
tests/performance/scripts/perf.py --runs 30 ../ClickHouse3/tests/performance/cryptographic_hashes.xml | egrep '(name|median)' > res_XXX.txt:USE_MULTITARGET_CODEafter register improvement.Results from:
tests/performance/scripts/perf.py --runs 20 ../ClickHouse3/tests/performance/md5.xml | egrep '(name|median)' > res_XXX.txt:Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Add SIMD implementation of MD5 that hashes multiple inputs in parallel using AVX2/AVX512, improving throughput.
Version info
26.5.1.862