Skip to content

Commit de53055

Browse files
Use radix sort when size is large enough so that one-group sorter wont be needed
1 parent 51ead2b commit de53055

File tree

1 file changed

+2
-2
lines changed
  • dpctl/tensor/libtensor/source/sorting

1 file changed

+2
-2
lines changed

dpctl/tensor/libtensor/source/sorting/topk.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -110,9 +110,9 @@ sycl::event topk_caller(sycl::queue &exec_q,
110110
py::ssize_t axis_inds_offset,
111111
const std::vector<sycl::event> &depends)
112112
{
113-
if constexpr (use_radix_sort<argTy>::value) {
113+
if (use_radix_sort<argTy>::value && (axis_nelems >= 16384)) {
114114
using dpctl::tensor::kernels::topk_radix_impl;
115-
auto ascending = !largest;
115+
const auto ascending = !largest;
116116
return topk_radix_impl<argTy, IndexTy>(
117117
exec_q, iter_nelems, axis_nelems, k, ascending, arg_cp, vals_cp,
118118
inds_cp, iter_arg_offset, iter_vals_offset, iter_inds_offset,

0 commit comments

Comments
 (0)