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
Sort issue with K64V64 or uint128_t #1581
Comments
The result can be OK in release with more records, because the pivot is really bad, and it reverts to heapsort. |
Any thoughts on this issue ? |
Oops, somehow I missed this issue, sorry about that and thanks for pinging it. I will investigate soon :) |
I have run your code and it looks like there might be a misunderstanding :) Can you confirm it's fine if we switch the assert to |
Sorry, for the bad repro code. |
Oh, interesting, glad you found the root cause. Generally it is a good idea to element-align data (so alignof == sizeof), some platforms can fault otherwise. But I do not yet understand why we would sort incorrectly if unaligned. |
Here is the correct repro code.
For me this is an issue, because i cannot force 16 bytes alignment on the buffer easily. |
When using 128bit sort an assert can occur in the Recurse method:
HWY_DASSERT(bound != 0);
Or the sort is not sorted correctly (we have a signed sort instead).
Small example:
const int nbValues = 1000;
hwy::K64V64 listValues[nbValues];
for (int i = 0; i < nbValues; i++) {
listValues[i].key = i;
listValues[i].value = i - 500;
}
hwy::VQSort(listValues, nbValues, hwy::SortAscending());
for (int i = 1; i < nbValues; i++) {
HWY_DASSERT(listValues[i - 1].value <= listValues[i].value);
}
It is compiled on windows for x64, with clang, and the dispatch used is AVX2.
The text was updated successfully, but these errors were encountered: