10000 ENH: Convert loop unary fp into highway by luyahan · Pull Request #26346 · numpy/numpy · GitHub
[go: up one dir, main page]

Skip to content

ENH: Convert loop unary fp into highway #26346

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 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions meson_cpu/x86/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ SSE3 = mod_features.new(
)
SSSE3 = mod_features.new(
'SSSE3', 4, implies: SSE3,
args: '-mssse3',
args: ['-mssse3','-DHWY_WANT_SSSE3=1'],
test_code: files(source_root + '/numpy/distutils/checks/cpu_ssse3.c')[0]
)
SSE41 = mod_features.new(
Expand All @@ -33,7 +33,7 @@ POPCNT = mod_features.new(
test_code: files(source_root + '/numpy/distutils/checks/cpu_popcnt.c')[0]
)
SSE42 = mod_features.new(
'SSE42', 7, implies: POPCNT, args: '-msse4.2',
'SSE42', 7, implies: POPCNT, args: ['-msse4.2', '-DHWY_WANT_SSE4=1'],
test_code: files(source_root + '/numpy/distutils/checks/cpu_sse42.c')[0]
)
# 7-20 left as margin for any extra features
Expand Down Expand Up @@ -196,6 +196,8 @@ if compiler_id == 'msvc'
AVX512_ICL
]
fet.update(args: '')
SSE42.update(args: '-DHWY_WANT_SSE4=1')
SSSE3.update(args: '-DHWY_WANT_SSSE3=1')
endforeach
# MSVC compiler doesn't support the following features independently
FMA3.update(implies: [F16C, AVX2])
Expand Down
11 changes: 7 additions & 4 deletions numpy/_core/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,10 @@ if use_highway
highway_lib = static_library('highway',
[
# required for hwy::Abort symbol
'src/highway/hwy/abort.cc'
'src/highway/hwy/abort.cc',
'src/highway/hwy/per_target.cc',
'src/highway/hwy/targets.cc',
'src/highway/hwy/print.cc'
],
cpp_args: '-DTOOLCHAIN_MISS_ASM_HWCAP_H',
include_directories: ['src/highway'],
Expand Down Expand Up @@ -972,12 +975,12 @@ foreach gen_mtargets : [
],
[
'loops_unary_fp.dispatch.h',
src_file.process('src/umath/loops_unary_fp.dispatch.c.src'),
'src/umath/loops_unary_fp.dispatch.cpp',
[
SSE41, SSE2,
SSE42, SSE2,
VSX2,
ASIMD, NEON,
VXE, VX
VXE, VX, RVV
]
],
[
Expand Down
12 changes: 6 additions & 6 deletions numpy/_core/src/umath/loops_unary_fp.dispatch.c.src
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,9 @@ NPY_FINLINE double c_square_f64(double a)
*/
#if @VCHK@
/**begin repeat1
* #kind = rint, floor, ceil, trunc, sqrt, absolute, square, reciprocal#
* #intr = rint, floor, ceil, trunc, sqrt, abs, square, recip#
* #repl_0w1 = 0*7, 1#
* #kind = reciprocal#
* #intr = recip#
* #repl_0w1 = 1#
*/
/**begin repeat2
* #STYPE = CONTIG, NCONTIG, CONTIG, NCONTIG#
Expand Down Expand Up @@ -199,9 +199,9 @@ static void simd_@TYPE@_@kind@_@STYPE@_@DTYPE@
* #VCHK = NPY_SIMD_F32, NPY_SIMD_F64#
*/
/**begin repeat1
* #kind = rint, floor, ceil, trunc, sqrt, absolute, square, reciprocal#
* #intr = rint, floor, ceil, trunc, sqrt, abs, square, recip#
* #clear = 0, 0, 0, 0, 0, 1, 0, 0#
* #kind = reciprocal#
* #intr = recip#
* #clear = 0#
*/
NPY_NO_EXPORT void NPY_CPU_DISPATCH_CURFX(@TYPE@_@kind@)
(char **args, npy_intp const *dimensions, npy_intp const *steps, void *NPY_UNUSED(func))
Expand Down
Loading
Loading
0