ENH: Use AVX512 FP16 ISA for sorting float16 arrays#23435
Conversation
|
I am not able to explain why we see perf changes to merge sort. Any ideas? |
Hmm, might be compiler optimizations. Merge sort can actually be faster than quicksort when optimized. OTOH, I believe merge sort is now Timsort or radix sort (for small integers). Note that any replacement for merge sort needs to be a stable sort. Might be worth profiling the code or changing the optimization level to see what effect that has. |
This patch only adds vectorized quicksort. The code paths don't seem to interfere with other sorts and so I didn't expect it to affect performance of merge and heap sort. Is that assumption correct? |
|
We sometimes see strange fluctuations. I have never quite figured out why unfortunately. Python has a whole story of having to enable profiling guided optimization to avoid fluctations, although they are in a somewhat different boat since they probaly look more at small overheads than a single core function being optimized differently. |
|
What happens when not using |
without gcc >= 12.x, this patch is essentially ignored and produces identical library as the main branch. Confirmed that it causes NO changes in benchmarks. |
|
Hmm. So we would need to add a CI run with gcc 12+ to make sure this code continues to function? |
yup yup, I'm working on it. |
Would also need to run on Intel SDE with Sapphire Rapids option. |
|
WIll rebase after we merge #23502 |
|
rebased. |
Great. Do the regressions in merge sort still occur? |
|
@mattip Looks like it, spent a lot of time narrowing down why code placement is affecting performance but to no avail :( |
|
Marking for discussion at an upcoming triage meeting for the performance slowdown on unrelated code. |
seiko2plus
left a comment
There was a problem hiding this comment.
LGTM, Thank you!. since this pull-requests only targets Intel Sapphire Rapids and no way to verify it by me or the team due to the lk of hardware, I think its fine to go with the current benchmark even with the understandable downgrades as we discussed on the latest triage meeting.
|
Thanks @r-devulap |
Leverages AVX512 FP16 simd sort from x86-simd-sort to speed up sorting float16 arrays by nearly 3x.