Feature SIMD support for Hamming Distance. #160
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I have added full support for SSE2, AVX2, and AVX512 for performance improvement when using Distance Type Hamming.
The code was expanded to the required number of loops per instruction set using macro to UNROLL with bit specification.
The code has been designed to support dimensional data in multiples of 16.
AVX2 uses SSE2 for fraction processing, and AVX512 uses AVX2 and SSE2 for fraction processing.
No fractional processing is performed in SSE2 because it is assumed that no fractional numbers will be produced.
I separately wrote a following test code to test the comparison between the function implemented this time and existing functions and general Hamming functions.
The benchmark results for AVX2 and SSE2 are Error 0, so there should be no major problems with calculation accuracy and speed as shown in the following result.
However, I have not been able to test AVX512 because I do not have a test environment at this time.
Test Code is below:
Test Result: