-
-
Notifications
You must be signed in to change notification settings - Fork 11k
ENH: Vectorize np.sort and np.partition with AVX2 #25045
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
Changes from all commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
95f6158
Update x86-simd-sort to latest
125017e
Dont include arg methods on 32-bit platforms
65d6506
Update x86-simd-sort to latest
2766e9b
Revert "Dont include arg methods on 32-bit platforms"
77278fe
Enable np.partition and np.argpartition on 32-bit
d729a49
Update x86-simd-sort to latest
05000e1
Update x86-simd-sort to latest
c2bdc0e
Update x86-simd-sort to latest
a303128
Update x86-simd-sort to latest
9a7e109
avx512 qsort for fp16, fp32 and fp64 require an explicit flag to sort…
d4169da
Dispatch AVX2 qsort and partition
9f1faa1
Separate testing np.partition and np.argpartition
7c39472
update x86-simd-sort to latest
3b6643d
Disable test_shape_base.py::TestTakeAlongAxis::test_argequivalent for…
fb69b5b
Linter fixes
190e80e
Fix rebase bug in meson.build
c9588ca
Split highway and x86-simd-sort dispatch to separate files
0cb29a2
Update x86-simd-sort to latest
a3ca84b
Include highway/x86-simd-sort at compile time
9bde4ae
Remove distutils related dispatch code and create new namespace for h…
b28ed78
Add optional hasnan arguement to avx sorting
675cb07
Add x86_qsort/qselect functions inside anonymous namespace
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
#include "highway_qsort.hpp" | ||
#define VQSORT_ONLY_STATIC 1 | ||
#include "hwy/contrib/sort/vqsort-inl.h" | ||
|
||
namespace np { namespace highway { namespace qsort_simd { | ||
|
||
template<> void NPY_CPU_DISPATCH_CURFX(QSort)(int32_t *arr, intptr_t size) | ||
{ | ||
hwy::HWY_NAMESPACE::VQSortStatic(arr, size, hwy::SortAscending()); | ||
} | ||
template<> void NPY_CPU_DISPATCH_CURFX(QSort)(uint32_t *arr, intptr_t size) | ||
{ | ||
hwy::HWY_NAMESPACE::VQSortStatic(arr, size, hwy::SortAscending()); | ||
} | ||
template<> void NPY_CPU_DISPATCH_CURFX(QSort)(int64_t *arr, intptr_t size) | ||
{ | ||
hwy::HWY_NAMESPACE::VQSortStatic(arr, size, hwy::SortAscending()); | ||
} | ||
template<> void NPY_CPU_DISPATCH_CURFX(QSort)(uint64_t *arr, intptr_t size) | ||
{ | ||
hwy::HWY_NAMESPACE::VQSortStatic(arr, size, hwy::SortAscending()); | ||
} | ||
template<> void NPY_CPU_DISPATCH_CURFX(QSort)(float *arr, intptr_t size) | ||
{ | ||
hwy::HWY_NAMESPACE::VQSortStatic(arr, size, hwy::SortAscending()); | ||
} | ||
template<> void NPY_CPU_DISPATCH_CURFX(QSort)(double *arr, intptr_t size) | ||
{ | ||
hwy::HWY_NAMESPACE::VQSortStatic(arr, size, hwy::SortAscending()); | ||
} | ||
|
||
} } } // np::highway::qsort_simd |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
#ifndef NUMPY_SRC_COMMON_NPYSORT_HWY_SIMD_QSORT_HPP | ||
#define NUMPY_SRC_COMMON_NPYSORT_HWY_SIMD_QSORT_HPP | ||
|
||
#include "common.hpp" | ||
|
||
namespace np { namespace highway { namespace qsort_simd { | ||
|
||
#ifndef NPY_DISABLE_OPTIMIZATION | ||
#include "highway_qsort.dispatch.h" | ||
#endif | ||
NPY_CPU_DISPATCH_DECLARE(template <typename T> void QSort, (T *arr, npy_intp size)) | ||
NPY_CPU_DISPATCH_DECLARE(template <typename T> void QSelect, (T* arr, npy_intp num, npy_intp kth)) | ||
|
||
} } } // np::highway::qsort_simd | ||
|
||
#endif // NUMPY_SRC_COMMON_NPYSORT_HWY_SIMD_QSORT_HPP |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
Submodule x86-simd-sort
updated
77 files
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.