-
-
Notifications
You must be signed in to change notification settings - Fork 10.9k
BLD, SIMD: The meson CPU dispatcher implementation #23096
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
Changes from all commits
Commits
Show all changes
31 commits
Select commit
Hold shift + click to select a range
ab496b3
ENH, SIMD: The meson CPU dispatcher implementation
seiko2plus 9a139d3
Provide compatibility with distutils
seiko2plus 166477d
Extend test_requirements/pyproject to cover meson module
seiko2plus 9421795
BUG: Fix SSE build on meson
seiko2plus 0c3111c
fix the build when it disabled
seiko2plus a78ef6b
enable AVX512_SPR for quicksort
seiko2plus a3058a9
Add support for build option --test-simd
seiko2plus e4b3d72
Fix sdist build
seiko2plus 4203a5b
Pass Opt level 3 to all dispach-able sources
seiko2plus 04b2e2a
Disable SIMD kernels of log/exp/sin/cos on clang-cl
seiko2plus 1917470
CI: Transition x86 specialized tests to Meson from Distutils
seiko2plus 0963fe0
Cleanup the main configration header and improves docs
seiko2plus 481114a
Detect global architecture args
seiko2plus 58239f3
update the meson module name
seiko2plus 2271d02
fix SSE41 flag on Intel-cl
seiko2plus 080e19c
rename method multi_target to multi_targets
seiko2plus 35292aa
Disables mmx when AVX512 is enabled similar to distutils
seiko2plus 077a09f
Add build target AVX512_ICL for simd_qsort
seiko2plus 7ec6933
CI: Allow noblas for SIMD tests
seiko2plus 0beab65
Bybass sort validation for _simd module
seiko2plus f580462
Removes build option boolean warning
seiko2plus de71d9b
removes py_dep from _simd extention
seiko2plus dedd413
fix Initlize typo
seiko2plus a751c20
Minimize the log of CPU optimization
seiko2plus 76327b8
Remove debug log and count on multi_targets() debug
seiko2plus e13ce41
update multi_targets to reduce the number of objects
seiko2plus 9509508
BLD: updates to build and test dependencies
rgommers 371bb76
BLD: add Meson version check, to catch older installed versions early
rgommers 3363fa3
CI: fix doc refguide check failure on CircleCI
rgommers b868d25
Merge branch 'main' into meson_simd
rgommers b1855c0
STY: minor fixes to code comments
rgommers File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
name: MesonBuildTest | ||
description: "checkout repo, build, and test numpy" | ||
runs: | ||
using: composite | ||
steps: | ||
- name: Install dependencies | ||
shell: bash | ||
run: pip install -r build_requirements.txt | ||
- name: Build | ||
shell: 'script -q -e -c "bash --noprofile --norc -eo pipefail {0}"' | ||
env: | ||
TERM: xterm-256color | ||
run: | ||
spin build -- ${MESON_ARGS[@]} | ||
- name: Check build-internal dependencies | ||
shell: bash | ||
run: | ||
ninja -C build -t missingdeps | ||
- name: Check installed test and stub files | ||
shell: bash | ||
run: | ||
python tools/check_installed_files.py $(find ./build-install -path '*/site-packages/numpy') | ||
- name: Test | ||
shell: 'script -q -e -c "bash --noprofile --norc -eo pipefail {0}"' | ||
env: | ||
TERM: xterm-256color | ||
run: | | ||
pip install pytest pytest-xdist hypothesis typing_extensions | ||
spin test -j auto |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
meson-python>=0.10.0 | ||
Cython | ||
meson-python>=0.13.1 | ||
Cython>=3.0 | ||
wheel==0.38.1 | ||
ninja | ||
spin==0.4 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
source_root = meson.project_source_root() | ||
mod_features = import('features') | ||
NEON = mod_features.new( | ||
'NEON', 1, | ||
test_code: files(source_root + '/numpy/distutils/checks/cpu_neon.c')[0] | ||
) | ||
NEON_FP16 = mod_features.new( | ||
'NEON_FP16', 2, implies: NEON, | ||
test_code: files(source_root + '/numpy/distutils/checks/cpu_neon_fp16.c')[0] | ||
) | ||
# FMA | ||
NEON_VFPV4 = mod_features.new( | ||
'NEON_VFPV4', 3, implies: NEON_FP16, | ||
test_code: files(source_root + '/numpy/distutils/checks/cpu_neon_vfpv4.c')[0] | ||
) | ||
# Advanced SIMD | ||
ASIMD = mod_features.new( | ||
'ASIMD', 4, implies: NEON_VFPV4, detect: {'val': 'ASIMD', 'match': 'NEON.*'}, | ||
test_code: files(source_root + '/numpy/distutils/checks/cpu_asimd.c')[0] | ||
) | ||
cpu_family = host_machine.cpu_family() | ||
if cpu_family == 'aarch64' | ||
# hardware baseline | ||
NEON.update(implies: [NEON_FP16, NEON_VFPV4, ASIMD]) | ||
NEON_FP16.update(implies: [NEON, NEON_VFPV4, ASIMD]) | ||
NEON_VFPV4.update(implies: [NEON, NEON_FP16, ASIMD]) | ||
elif cpu_family == 'arm' | ||
NEON.update(args: '-mfpu=neon') | ||
NEON_FP16.update(args: ['-mfp16-format=ieee', {'val': '-mfpu=neon-fp16', 'match': '-mfpu=.*'}]) | ||
NEON_VFPV4.update(args: [{'val': '-mfpu=neon-vfpv4', 'match': '-mfpu=.*'}]) | ||
ASIMD.update(args: [ | ||
{'val': '-mfpu=neon-fp-armv8', 'match': '-mfpu=.*'}, | ||
'-march=armv8-a+simd' | ||
]) | ||
endif | ||
# ARMv8.2 half-precision & vector arithm | ||
ASIMDHP = mod_features.new( | ||
'ASIMDHP', 5, implies: ASIMD, | ||
args: {'val': '-march=armv8.2-a+fp16', 'match': '-march=.*', 'mfilter': '\+.*'}, | ||
test_code: files(source_root + '/numpy/distutils/checks/cpu_asimdhp.c')[0] | ||
) | ||
## ARMv8.2 dot product | ||
ASIMDDP = mod_features.new( | ||
'ASIMDDP', 6, implies: ASIMD, | ||
args: {'val': '-march=armv8.2-a+dotprod', 'match': '-march=.*', 'mfilter': '\+.*'}, | ||
test_code: files(source_root + '/numpy/distutils/checks/cpu_asimddp.c')[0] | ||
) | ||
## ARMv8.2 Single & half-precision Multiply | ||
ASIMDFHM = mod_features.new( | ||
'ASIMDFHM', 7, implies: ASIMDHP, | ||
args: {'val': '-march=armv8.2-a+fp16fml', 'match': '-march=.*', 'mfilter': '\+.*'}, | ||
test_code: files(source_root + '/numpy/distutils/checks/cpu_asimdfhm.c')[0] | ||
) | ||
# TODO: Add support for MSVC | ||
ARM_FEATURES = { | ||
'NEON': NEON, 'NEON_FP16': NEON_FP16, 'NEON_VFPV4': NEON_VFPV4, | ||
'ASIMD': ASIMD, 'ASIMDHP': ASIMDHP, 'ASIMDFHM': ASIMDFHM | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Why is this in
.github/meson_actions/
rather than.github/workflows/
?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.
I just followed the same pattern of
.github/actions
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 doesn't look like an action but more like a regular CI job, so it should be under
workflows/
. This change in other CI files for (e.g.) thesetup-python
action is something I don't quite understand: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.
Okay, I see what this does and looked at the history; it's been like this for quite a while. The multiple levels of indirection and then ending up calling
tools/travis-*.sh
scripts makes debugging difficult, and most of it is just cruft by now. But best to clean it up only after we get rid of thesetup.py
build I think.