Skip to content

Lower the threshold to use sequential sort #1866

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Oct 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
* Improved performance of copy-and-cast operations from `numpy.ndarray` to `tensor.usm_ndarray` for contiguous inputs [gh-1829](https://github.com/IntelPython/dpctl/pull/1829)
* Improved performance of copying operation to C-/F-contig array, with optimization for batch of square matrices [gh-1850](https://github.com/IntelPython/dpctl/pull/1850)
* Improved performance of `tensor.argsort` function for all types [gh-1859](https://github.com/IntelPython/dpctl/pull/1859)
* Improved performance of `tensor.sort` and `tensor.argsort` for short arrays in the range [16, 64] elements [gh-1866](https://github.com/IntelPython/dpctl/pull/1866)

### Fixed

Expand Down
4 changes: 3 additions & 1 deletion dpctl/tensor/libtensor/include/kernels/sorting/sort.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -734,7 +734,9 @@ sycl::event stable_sort_axis1_contig_impl(

auto comp = Comp{};

constexpr size_t sequential_sorting_threshold = 64;
// constant chosen experimentally to ensure monotonicity of
// sorting performance, as measured on GPU Max, and Iris Xe
constexpr size_t sequential_sorting_threshold = 16;

if (sort_nelems < sequential_sorting_threshold) {
// equal work-item sorts entire row
Expand Down
Loading