3 ms·
The keyword to look for is "sorting network". See, for example, http://cs.brandeis.edu/~hugues/sorting_networks.html http://cs.brandeis.edu/~hugues/sorting_netw
by ncmncm 7y ago
The keyword to look for is "sorting network". See, for example, http://cs.brandeis.edu/~hugues/sorting_networks.html http://cs.brandeis.edu/~hugues/sorting_networks.html.
There is a 28-step 16-input network there. It admits a direct translation to AVX-512 instructions.
What is usually considered minimal differs from what is best for AVX512. AVX512 is happy to do 16 comparisons at each stage; its efficiency is limited only by the number of stages. Thus, a network that did more comparisons in fewer stages would be faster.