8000 BUG: Mirror VQSORT_ENABLED logic in Quicksort by Mousius · Pull Request #27050 · numpy/numpy · GitHub
[go: up one dir, main page]

Skip to content

BUG: Mirror VQSORT_ENABLED logic in Quicksort #27050

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
Jul 26, 2024

Conversation

Mousius
Copy link
Member
@Mousius Mousius commented Jul 26, 2024

This patch disables Highway VQSort if the same criteria is met as sort/shared-inl.h, to prevent it aborting at runtime.

I'm unsure whether this would look neater using Highway's dynamic dispatch.

This patch disables Highway VQSort if the same criteria is met as sort/shared-inl.h, to prevent it aborting at runtime.

I'm unsure whether this would look neater using Highway's dynamic dispatch.
@charris charris changed the title Mirror VQSORT_ENABLED logic in Quicksort BUG: Mirror VQSORT_ENABLED logic in Quicksort Jul 26, 2024
@charris charris added 00 - Bug 09 - Backport-Candidate PRs tagged should be backported labels Jul 26, 2024
@charris charris added this to the 2.0.2 release milestone Jul 26, 2024
@ngoldbaum
Copy link
Member

When I compile with ASAN, I still see a missing symbol error at import:

_multiarray_umath.cpython-312-darwin.so, 0x0002): symbol not found in flat namespace '__ZN2np7highway10qsort_simd11QSort_ASIMDIdEEvPT_l'

@Mousius
Copy link
Member Author
Mousius commented Jul 26, 2024

When I compile with ASAN, I still see a missing symbol error at import:

_multiarray_umath.cpython-312-darwin.so, 0x0002): symbol not found in flat namespace '__ZN2np7highway10qsort_simd11QSort_ASIMDIdEEvPT_l'

Argh, my Highway branch was updated for another thing, sorry about that! Just synced with what's in main and tested wtih sanitizers locally. Should work now?

@ngoldbaum
Copy link
Member

Nice, this does fix the problem - I can run the sorting tests under ASAN locally using this branch.

@r-devulap you may also want to look this over, but I'll probably merge this in the next day or two assuming the tests pass.

@ngoldbaum ngoldbaum merged commit ade6d5e into numpy:main Jul 26, 2024
66 checks passed
// This replicates VQSORT_ENABLED from hwy/contrib/sort/shared-inl.h
// without checking the scalar target as this is not built within the dynamic
// dispatched sources.
#if (HWY_COMPILER_MSVC && !HWY_IS_DEBUG_BUILD) || \
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why not just use VQSORT_ENABLED instead duplicating the macro?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is included by quicksort.cpp, which isn't dynamically dispatched, meaning the VQSORT_ENABLED flag would be set incorrectly due to having HWY_TARGET == HWY_SCALAR.

@charris
Copy link
Member
charris commented Jul 27, 2024

Note to self: wait on this one.

@charris charris removed the 09 - Backport-Candidate PRs tagged should be backported label Jul 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants
0