-
Notifications
You must be signed in to change notification settings - Fork 59
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
Can I use this lib to output the original index of these sorted data #8
Comments
Hi, If you pass in the array and array of indices initialized to [0, 1, 2, 3, .. n] as arguments for key-value pair, PR #2 can be adapted to what you want. We have to add benchmarks to compare this to your implementation of std::sort to know how much we actually benefit from this. |
Thank you very much for this useful information and your contribute to this lib, PR #2 works well in my project, there's only one issue that avx512_qsort_kv(float*keys, uint16_t *indexes, int64_t arrsize) is not support yet, performance of current avx512_qsort_kv(double *keys, uint64_t *indexes, int64_t arrsize) is a little worse than my simple bubble sorting. Hope that avx512_qsort_kv(float*keys, uint16_t *indexes, int64_t arrsize) will be much better than my current implementation. Thanks again! |
@xiangyunzhou do you mind sharing your bubble sort so we can compare and add it to benchmarks? If a simple bubble sort performs as much, then what would be the point of all the complicated code. |
@r-devulap below is my implementation and UT in my project. I want to get the top 32 index of 400 sorting by a float pfWeight. icpx with flags: -march=icelake-server and -O3.
|
Have you tried benchmarking for a larger array? The code size of AVX512 qsort is fairly large when compared to std::sort or your bubble sort. If you are sorting an array of just 400 elements, there might be a big front end penalty for AVX512 qsort which might offset all benefits you get from it (not sure if this is true but just wondering if that is why you are not seeing any perf gains). |
I have tried to increase the array from 400 to 20480, seems still no benefit from AVX512 qsort. I start to get benefit from the AVX512 qsort when I increase the top items from 32 to 128. |
This lib looks awesome!
But I have a requirement to output the original index of these sorted data, for example the input array is {300 200 400 99 150 50 230 250}, then the sorted result should be {50 99 150 200 230 250 300 400}, and I want to get the original index as output {5, 3, 4, 1, 6, 7, 0, 2}.
Currently, I use the std::sort with a lambda to implement this require, but the performance is not good.
The text was updated successfully, but these errors were encountered: