Skip to content

Commit a4c59b3

Browse files
Lower the threshold to use sequential sort
The threshold lowered from 64 elements to sort, to 16 elements. This recovers monotonicity of run-times curve. When number of array elements along the axis we sort is less than the threshold, a quadratic complexity insertion sort is used. Too high a value of the threshold (64) made for the artifact, where sorting 63 elements took several times longer than sorting 65 elements. Setting it to 16 recovers monotonicity (sorting 16 elements is not slower than sorting 17 elements).
1 parent 2f327af commit a4c59b3

File tree

1 file changed

+1
-1
lines changed
  • dpctl/tensor/libtensor/include/kernels/sorting

1 file changed

+1
-1
lines changed

dpctl/tensor/libtensor/include/kernels/sorting/sort.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -734,7 +734,7 @@ sycl::event stable_sort_axis1_contig_impl(
734734

735735
auto comp = Comp{};
736736

737-
constexpr size_t sequential_sorting_threshold = 64;
737+
constexpr size_t sequential_sorting_threshold = 16;
738738

739739
if (sort_nelems < sequential_sorting_threshold) {
740740
// equal work-item sorts entire row

0 commit comments

Comments
 (0)