8000 ENH: Implement the NumPy C SIMD vectorization interface by seiko2plus · Pull Request #16397 · numpy/numpy · GitHub
[go: up one dir, main page]

Skip to content

ENH: Implement the NumPy C SIMD vectorization interface #16397

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 5 commits into from
Jul 10, 2020

Conversation

seiko2plus
Copy link
Member
@seiko2plus seiko2plus commented May 27, 2020

This pullrequest changes


Implement the NumPy C SIMD vectorization interface

"NPYV" or universal intrinsics as NEP-38 define it, are types and functions
intended to simplify the vectorization of code on different platforms.

The current implementations support SIMD extensions SSE, AVX2, AVX512,
VSX and NEON on the top of C definitions that defined by the new
generated header '_cpu_dispatch.h' which included by 'cpu_dispatch.h'.

And covers the following operations:

  • memory load and store
  • zero, setall, set, select, reinterpret
  • boolean conversions
  • (add, sub, mul, div, adds, subs)
  • logical
  • comparison
  • left and right shifting
  • combine, zip

@charris charris added 01 - Enhancement component: SIMD Issues in SIMD (fast instruction sets) code or machinery labels May 28, 2020
@seiko2plus seiko2plus force-pushed the implement_npyv branch 2 times, most recently from 6f47e93 to 999d86c Compare June 18, 2020 07:52
@seiko2plus
Copy link
Member Author

@mattip, Should I move the SIMD module and testing unit into a separated pr?

@mattip
Copy link
Member
mattip commented Jul 1, 2020

Should I move the SIMD module and testing unit into a separated pr?

Yes please.

@seiko2plus seiko2plus force-pushed the < 8000 span class="commit-ref user-select-contain"> implement_npyv branch from 999d86c to 0f30432 Compare July 8, 2020 07:29
  "NPYV" or universal intrinsics as NEP-38 define it, are types and functions
  intended to simplify vectorization of code on different platforms.

  This patch initialize NPYV for SIMD extensions SSE, AVX2, AVX512,
  VSX and NEON on the top of C definitions that defined by the new
  generated header '_cpu_dispatch.h' which included by 'cpu_dispatch.h'.
  implement the following intrinsics for X86 extensions:

    - load, store
    - zero, setall, set, select, reinterpret
    - boolean conversions
    - (add, sub, mul, div, adds, subs)
    - logical
    - comparison
    - left and right shifting
    - combine, zip
  implement the same intrinsics as X86 for NEON
  implement the same intrinsics as X86 for Power/VSX little-endian mode
@seiko2plus
Copy link
Member Author

@mattip, done. I opened a new pr(#16782) contains the SIMD module and testing units

Copy link
Member
@mattip mattip left a comment

Choose a reason for hiding this comment

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

There is a lot here, very impressive. Is this all new code or was it adapted from somewhere else?

Is there a script we can run on each of the directories to verify that all the universal intrinsics are defined for all the variations?

#ifdef NPY_HAVE_NEON
#include "neon/neon.h"
#endif

Copy link
Member
@mattip mattip Jul 8, 2020

Choose a reason for hiding this comment

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

Suggested change
/* Fallback if none of the above have been defined. Disables SIMD features */

Where is NPY_SIMD actually defined?

Copy link
Member Author

Choose a reason for hiding this comment

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

in the extension header, e.g. avx512/avx512.h.

@seiko2plus
Copy link
Member Author
seiko2plus commented Jul 8, 2020

@mattip,

There is a lot here, very impressive. Is this all new code or was it adapted from somewhere else?

No, I wrote it from scratch. I tried to put all my experience on it which mostly I gain it during working on OpenCV.

@seiko2plus
Copy link
Member Author
seiko2plus commented Jul 8, 2020

@mattip,

Is there a script we can run on each of the directories to verify that all the universal intrinsics are defined for all the variations?

I'm not sure what you actually mean, but I guess yes, the SIMD module and the testing unit check test_simd.py in #16782

Co-authored-by: Matti Picus <matti.picus@gmail.com>
@mattip
Copy link
Member
mattip commented Jul 8, 2020

the SIMD module and the testing unit check test_simd.py in #16782

Thanks. LGTM.

@mattip mattip merged commit 58da484 into numpy:master Jul 10, 2020
@seiko2plus seiko2plus deleted the implement_npyv branch January 9, 2021 16:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
01 - Enhancement component: SIMD Issues in SIMD (fast instruction sets) code or machinery
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants
0