intel/x86-simd-sort

About partial sort/topk

Closed this issue · 5 comments

Hi
Would there be any blocker in order to implement an option to do partial sorting (sometimes called 'topk') ?
https://en.cppreference.com/w/cpp/algorithm/partial_sort
I know it s usually done with heap sort and this project is more into quicksort but still.
Kind
WT
ref:
https://arrayfire.org/docs/group__stat__func__topk.htm#gsc.tab=0
https://pytorch.org/docs/stable/generated/torch.topk.html

Hi, I dont see a blocker, but this wasn't in my to do list. On the top of my head I cant think of an immediate way to implement this in SIMD. Feel free to point me to resources or even better: submit a pull request :)

Edit: Originally posted some code and a question but have since realised it contained a rather egregious mistake. I've removed it to ensure no one tries to run it. Hah.

More pertinently:
I'm wanting the same feature, so I'll have a crack at putting together a pull request. It should be straightforward (now) to implement a reasonably efficient partial sort using the existing functions in the library.

@WilliamTambellini Any feedback on partial/topk sort? Just wanted to know if it was useful or not.

sorry took time, trying ... Tks.