-
Notifications
You must be signed in to change notification settings - Fork 57
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
Mark explicit template specializations inline #112
Conversation
1b73813
to
28740e7
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As this includes the inline
for the specializations similar to what I already tested this works.
As for the implementation:
- Why use
X86_SIMD_SORT_INLINE_ONLY
instead ofinline
? Doesn't it make the code less readable? - And as mentioned in the numpy issue: Why keep the templates at all? Overloads are simpler and would allow using the
X86_SIMD_SORT_INLINE
define (or IMO preferably simplystatic
) to create separate instances per TU allowing the Numpy multiple-compilation mode without ODR issues.
@@ -47,14 +48,17 @@ | |||
* Force inline in cygwin to work around a compiler bug. See | |||
* https://github.com/numpy/numpy/pull/22315#issuecomment-1267757584 | |||
*/ | |||
#define X86_SIMD_SORT_INLINE_ONLY inline |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This makes the comment above misplaced as it applies to the define below
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, good point. Will fix the order :)
I think the macro is pretty self-explanatory. Having a macro gives the ability to make modifications to it easily in one place, if ever needed in the future.
Without templates, won't I would need 9 identical copies of all the functions? (qsort, qselect, partialsort, argsort, argselect, etc.) Ex: x86-simd-sort/src/xss-common-qsort.h Line 554 in 7060e3c
|
It is much longer and e.g.
True yes, there it is well suited. I was more referring to functions which basically only have specializations and no base implementation. This seems to have changed. Previously this was related to e.g. Anyway that comment doesn't seem to apply anymore as I missed what was changed in other PRs/commits such as 472c7d0 |
@Flamefire please review if you can :) This alone won't fix the NumPy build, I will have a patch for that soon.