diff --git a/LICENSES/XSIMD_LICENSE b/LICENSES/XSIMD_LICENSE new file mode 100644 index 0000000000000..eee7a54bc956b --- /dev/null +++ b/LICENSES/XSIMD_LICENSE @@ -0,0 +1,29 @@ +Copyright (c) 2016, Johan Mabille, Sylvain Corlay, Wolf Vollprecht and Martin Renou +Copyright (c) 2016, QuantStack +Copyright (c) 2018, Serge Guelton +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +* Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +* Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +* Neither the name of the copyright holder nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/meson.build b/meson.build index d2874e85cc3a7..33790ca88fb3f 100644 --- a/meson.build +++ b/meson.build @@ -37,6 +37,7 @@ add_project_arguments( ) cc = meson.get_compiler('c') +cxx = meson.get_compiler('cpp') if cc.get_id() == 'msvc' # Tracking issue: https://github.com/pandas-dev/pandas/issues/63701 # Ignore some MSVC specific warnings: @@ -44,8 +45,9 @@ if cc.get_id() == 'msvc' # C4267: conversion from `size_t` to smaller type. # C4551: occurs due to Cython generating code with (void)func. # https://github.com/cython/cython/issues/3579 + # C4146: unary minus operator applied to unsigned type. Occurs in xsimd. add_project_arguments( - ['/wd4244', '/wd4267', '/wd4551'], + ['/wd4244', '/wd4267', '/wd4551', '/wd4146'], language: ['c', 'cpp'], ) endif diff --git a/pandas/_libs/meson.build b/pandas/_libs/meson.build index 56ff2a01b450c..674901292979d 100644 --- a/pandas/_libs/meson.build +++ b/pandas/_libs/meson.build @@ -53,6 +53,9 @@ _khash_primitive_helper_dep = declare_dependency( m_dep = cc.find_library('m', required: false) fast_float = subproject('fast_float') fast_float_dep = fast_float.get_variable('fast_float_dep') +xsimd_dep = dependency('xsimd', version: '>=14.2') + +subdir('simd') subdir('tslibs') diff --git a/pandas/_libs/simd/meson.build b/pandas/_libs/simd/meson.build new file mode 100644 index 0000000000000..61925a1d90927 --- /dev/null +++ b/pandas/_libs/simd/meson.build @@ -0,0 +1,20 @@ +host_cpu = host_machine.cpu_family() + +simd_config = configuration_data() +if host_cpu == 'aarch64' + simd_target = 'neon' + simd_config.set('PANDAS_HAVE_NEON', 1) +elif host_cpu == 'x86_64' + simd_target = 'sse2' + simd_config.set('PANDAS_HAVE_SSE2', 1) +else + simd_target = 'scalar' + simd_config.set('PANDAS_HAVE_SCALAR', 1) +endif + +configure_file( + output: 'pandas_simd_config.h', + configuration: simd_config, +) + +simd_config_inc = include_directories('.') diff --git a/pyproject.toml b/pyproject.toml index f5c2a5f606c1f..d03232583873c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -38,6 +38,7 @@ license-files = [ "LICENSES/PYUPGRADE_LICENSE", # MIT "LICENSES/SAS7BDAT_LICENSE", # MIT "LICENSES/ULTRAJSON_LICENSE", # BSD-3-Clause AND TCL + "LICENSES/XSIMD_LICENSE", # BSD-3-Clause "subprojects/fast_float-*/LICENSE-APACHE", # Apache-2.0 "subprojects/fast_float-*/LICENSE-BOOST", # BSL "subprojects/fast_float-*/LICENSE-MIT", # MIT diff --git a/subprojects/packagefiles/xsimd/meson.build b/subprojects/packagefiles/xsimd/meson.build new file mode 100644 index 0000000000000..595fb6122ef51 --- /dev/null +++ b/subprojects/packagefiles/xsimd/meson.build @@ -0,0 +1,12 @@ +project( + 'xsimd', + 'cpp', + meson_version: '>=0.58.0', + license: 'BSD-3-Clause', + version: '14.2.0', +) + +xsimd_inc = include_directories('include') + +xsimd_dep = declare_dependency(include_directories: xsimd_inc) +meson.override_dependency('xsimd', xsimd_dep) diff --git a/subprojects/xsimd.wrap b/subprojects/xsimd.wrap new file mode 100644 index 0000000000000..39706456be925 --- /dev/null +++ b/subprojects/xsimd.wrap @@ -0,0 +1,9 @@ +[wrap-file] +directory = xsimd-14.2.0 +source_url = https://github.com/xtensor-stack/xsimd/archive/refs/tags/14.2.0.tar.gz +source_filename = xsimd-14.2.0.tar.gz +source_hash = 21e841ab684b05331e81e7f782431753a029ef7b7d9d6d3ddab837e7782a40ee +patch_directory = xsimd + +[provide] +dependency_names = xsimd