Thanks to visit codestin.com
Credit goes to github.com

Skip to content

ENH, SIMD: Add C++ wrapper for universal intrinsics #21057

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

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

seiko2plus
Copy link
Member

@seiko2plus seiko2plus commented Feb 14, 2022

Introduces a C++ wrapper for universal intrinsics, providing
a convenient and platform-independent interface to access SIMD
instructions across different architectures support sizeless
SIMD extensions e.g. ARM SVE and simplifies the
development of SIMD a way from C template sources.

Comes with documentation that provides clear explanations and
examples for using the wrapper and its functionalities.

This pr also comes with an example that demonstrates the use of C++
by replacing template c sources of comparison operations.

This pull-requests:

  • Adds C++ wrapper for universal intrinsics
  • Adds reference for universal intrinsics

@seiko2plus seiko2plus added 04 - Documentation component: SIMD Issues in SIMD (fast instruction sets) code or machinery labels Feb 14, 2022
@charris charris closed this Apr 6, 2022
@charris charris reopened this Apr 6, 2022
@seiko2plus seiko2plus force-pushed the npyv_cpp_interface branch 3 times, most recently from 4b0441f to 547edc5 Compare April 29, 2022 05:52
@seiko2plus seiko2plus force-pushed the npyv_cpp_interface branch from 547edc5 to 6613713 Compare June 10, 2022 07:50
@seiko2plus seiko2plus force-pushed the npyv_cpp_interface branch 2 times, most recently from 6dbf0c8 to 57624d5 Compare July 20, 2022 08:52
@seiko2plus seiko2plus force-pushed the npyv_cpp_interface branch 3 times, most recently from 6feaf05 to d60f08f Compare August 3, 2022 01:05
@seiko2plus seiko2plus force-pushed the npyv_cpp_interface branch 8 times, most recently from e792445 to a92b0fb Compare August 8, 2022 02:25
@seiko2plus seiko2plus force-pushed the npyv_cpp_interface branch 7 times, most recently from f4a4fa7 to 961e2f0 Compare August 20, 2022 23:16
@seiko2plus seiko2plus closed this Aug 3, 2023
@seiko2plus seiko2plus reopened this Aug 3, 2023
@seiko2plus
Copy link
Member Author

to rebuild artifact

@seiko2plus seiko2plus closed this Aug 7, 2023
@seiko2plus seiko2plus reopened this Aug 7, 2023
@charris
Copy link
Member

charris commented Aug 23, 2023

@seiko2plus Needs a rebase.

@seiko2plus seiko2plus force-pushed the npyv_cpp_interface branch 2 times, most recently from 9d14e1b to 385f78d Compare December 24, 2023 12:20
@seiko2plus
Copy link
Member Author

close/re-open to rerun CI jobs

@seiko2plus seiko2plus closed this Jan 8, 2024
@seiko2plus seiko2plus reopened this Jan 8, 2024
@r-devulap
Copy link
Member

@seiko2plus How do I access the rendered documentation associated with this PR?

@mattip
Copy link
Member

mattip commented Jan 12, 2024

They are the artifacts of the ci/circleci build, you should be able to see it in the CI summary. The c++ documentation is here

@r-devulap
Copy link
Member

thanks @mattip

  Introduces a C++ wrapper for universal intrinsics, providing
  a convenient and platform-independent interface to access SIMD
  instructions across different architectures, supports sizeless
  SIMD extentions e.g. ARM SVE and simplifies the
  development of SIMD a way from C template sources.

  Comes with documentation provides clear explanations and
  examples for using the wrapper and its functionalities.
  To eliminate C template sources and enable
  support for sizeless SIMD extensions.
@seiko2plus
Copy link
Member Author

made a rebase against the main to pass CI jobs

@manodeep
Copy link

I am looking into ways of adding vectorisation into astropy and it would be useful to be able to use the universal intrinsics through these C++ wrappers. Are there any plans to get this work merged into numpy?

@r-devulap
Copy link
Member

r-devulap commented Sep 12, 2024

@manodeep We are dropping this PR in favor of google highway which is a well-established open-source solution addressing the same problem. See #25781 and https://numpy.org/neps/nep-0054-simd-cpp-highway.html.

Is there a reason why you cannot use highway or other open source solutions for universal intrinsics (xsimd, as another example)?

@manodeep
Copy link

manodeep commented Sep 13, 2024

@r-devulap Thanks for the quick response! I saw the discussion about incorporating some highway functionality in a separate PR but didn't realise the entire numpy simd infrastructure was getting replaced by highway!

I was hoping to use the numpy insights regarding the simd infrastructure. Is there any work already underway to port over the simd infra to highway?

Separately and out of curiosity, given google's track record of canning projects, are there any mid- to long-term assurances about highway's continued development/maintenance? Apparently, highway is already not supported (ref: NEP 54), so the question is invalid.

@r-devulap
Copy link
Member

was hoping to use the numpy insights regarding the simd infrastructure. Is there any work already underway to port over the simd infra to highway?

highway has everything you need to write platform agnostic code: (1) static universal intrinsics or hwy ops to write your SIMD code and (2) generate the dynamic dispatch code to run appropriate cpuid check to run the best version. See https://google.github.io/highway/en/master/README.html#examples for examples.

Numpy currently has its own infrastructure for dynamic dispatch and uses highway only for universal intrinsics part (although this might change in the future).

@manodeep
Copy link

Ahh great - thank you @r-devulap

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.

6 participants