Skip to content

WIP: use openmp vector function ABI for sin, cos, exp and log #7865

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

Closed
wants to merge 3 commits into from

Conversation

juliantaylor
Copy link
Contributor

@juliantaylor juliantaylor commented Jul 23, 2016

glibc provides sin, cos, exp, log, pow and sincos with this ABI since 2.22 for sse4 and AVX2.
https://sourceware.org/glibc/wiki/libmvec
In this branch I have added support for the first four which provides significant speedup over the scalar functions.

It is implemented directly via the ABI instead of relying on compiler support to do so automatically. Using the compiler would be nicer (especially since gcc can do auto cloning) but this might be more portable.

There are still a couple issues but it should be testable.

  • the vectorized functions are also less accurate so there are some failures in scipy due to slightly different results
  • no AVX autodetection so you have to build with OPT=-mavx2
  • the glibc implementation uses SSE4 but falls back to the scalar ones if that is not available, this might not be the case for other implementation (e.g. svml) so could be a problem, the branch only checks for sse2 which is all that is needed on the numpy side.
  • npymath now requires a link to libmvec which could be a problem for third parties (but still a hack in linalg_umath which likely will cause a failure in travis)

@juliantaylor juliantaylor force-pushed the vector-math branch 3 times, most recently from d0077f6 to ad7ee06 Compare July 25, 2016 11:14
@juliantaylor
Copy link
Contributor Author

added power support and solved the npymath problem, forgot about the mlib.ini

@homu
Copy link
Contributor

homu commented Oct 13, 2016

☔ The latest upstream changes (presumably #8148) made this pull request unmergeable. Please resolve the merge conflicts.

@charris
Copy link
Member

charris commented Nov 6, 2016

Failed build and needs rebase.

@mattip
Copy link
Member

mattip commented Jul 2, 2019

@juliantaylor it seems we are going in the direction of adding direct support for intrinsics in gh-13368, gh-13885, gh-13516. Should we discuss using external glibc or other packages to do this for us instead?

@mattip
Copy link
Member

mattip commented Mar 1, 2020

Closing, since it seems we will not be able to merge this with our current approach. Please reopen if I am mistaken.

@mattip mattip closed this Mar 1, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants