Files
Sayed Adel 822665c9c3 ENH: Modulate dispatched x86 CPU features
**IMPORTANT NOTE**: The default setting for `cpu-baseline`` on x86 has been raised to `x86-64-v2` microarchitecture.
This can be changed to `cpu-baseline=none` during build time to support older CPUs, though manual SIMD optimizations for pre-2009 processors are no longer supported.

This patch reorganizes CPU build options by replacing individual x86 features with microarchitecture levels.
This change aligns with the Google Highway requirements and common Linux distribution practices.

This patch:
- Removes all individual x86 features and replaces them with three microarchitecture
  levels (`X86_V2`, `X86_V3`, `X86_V4`) commonly used by Linux distributions
- Raises the baseline to microarchitecture level 2 (replacing `SSE3`) since all known
  x86 CPUs since 2009 support it. This improves performance and
  reduces binary size
- Updates documentation to to reflect these changes and to fit the current meson build system.
- Corrects the behavior of the `-` operator, which now excludes successor features
  that imply the excluded feature
- Adds redirection via meson for removed feature names to avoid breaking builds
- Removes compiler compatibility workarounds, so features like AVX512 without full mask operations
  will be considered unsupported rather than providing fallbacks

Detailed CPU features changes:
- Removes individual features (`SSE`, `SSE2`, `SSE3`, `SSSE3`, `SSE4_1`, `SSE4_2`,
  `POPCNT`) which are now part of the new group `X86_V2`
- Removes AMD legacy features (`XOP`, `FMA4`)
- Removes Xeon Phi support (`AVX512_KNL`, `AVX512_KNM`) which Intel has discontinued
- Removes individual features (`AVX`, `AVX2`, `FMA3`, `F16C`) which are now part
  of the new group `X86_V3`
- Removes individual features `AVX512F`, `AVX512CD` as a result of dropping Xeon Phi support
- Renames group `AVX512_SKX` to `x86_v4` to align with microarchitecture level naming
- Removes groups `AVX512_CLX` and `AVX512_CNL` (features available via `AVX512_ICL`)
- Updates `AVX512_ICL` to include features (`VAES`, `GFNI`, `VPCLMULQDQ`) for alignment
  with Highway

New Feature Group Hierarchy:
```
Name          | Implies     | Includes
--------------|-------------|-----------------------------------------------------------
X86_V2        |             | SSE SSE2 SSE3 SSSE3 SSE4_1 SSE4_2 POPCNT CX16 LAHF
X86_V3        | X86_V2      | AVX AVX2 FMA3 BMI BMI2 LZCNT F16C MOVBE
X86_V4        | X86_V3      | AVX512F AVX512CD AVX512VL AVX512BW AVX512DQ
AVX512_ICL    | X86_V4      | AVX512VBMI AVX512VBMI2 AVX512VNNI AVX512BITALG
              |             | AVX512VPOPCNTDQ AVX512IFMA VAES GFNI VPCLMULQDQ
AVX512_SPR    | AVX512_ICL  | AVX512FP16
```

These groups correspond to CPU generations:
- `X86_V2`: x86-64-v2 microarchitectures (CPUs since 2009)
- `X86_V3`: x86-64-v3 microarchitectures (CPUs since 2015)
- `X86_V4`: x86-64-v4 microarchitectures (AVX-512 capable CPUs)
- `AVX512_ICL`: Intel Ice Lake and similar CPUs
- `AVX512_SPR`: Intel Sapphire Rapids and newer CPUs

Note: On 32-bit x86, `cx16` is excluded from `X86_V2`.
2025-09-13 08:44:03 +03:00

65 lines
2.8 KiB
Plaintext

Test features "X86_V2" : Supported
Test features "X86_V3" : Supported
Test features "X86_V4" : Supported
Test features "AVX512_ICL" : Supported
Test features "AVX512_SPR" : Supported
Configuring npy_cpu_dispatch_config.h using configuration
Message:
CPU Optimization Options
baseline:
Requested : min
Enabled : X86_V2
dispatch:
Requested : max
Enabled : X86_V3 X86_V4 AVX512_ICL AVX512_SPR
Generating multi-targets for "_umath_tests.dispatch.h"
Enabled targets: X86_V3, baseline
Generating multi-targets for "argfunc.dispatch.h"
Enabled targets: X86_V4, X86_V3, baseline
Generating multi-targets for "x86_simd_argsort.dispatch.h"
Enabled targets: X86_V4, X86_V3
Generating multi-targets for "x86_simd_qsort.dispatch.h"
Enabled targets: X86_V4, X86_V3
Generating multi-targets for "x86_simd_qsort_16bit.dispatch.h"
Enabled targets: AVX512_SPR, AVX512_ICL
Generating multi-targets for "highway_qsort.dispatch.h"
Enabled targets:
Generating multi-targets for "highway_qsort_16bit.dispatch.h"
Enabled targets:
Generating multi-targets for "loops_arithm_fp.dispatch.h"
Enabled targets: X86_V3, baseline
Generating multi-targets for "loops_arithmetic.dispatch.h"
Enabled targets: X86_V4, X86_V3, baseline
Generating multi-targets for "loops_comparison.dispatch.h"
Enabled targets: X86_V4, X86_V3, baseline
Generating multi-targets for "loops_exponent_log.dispatch.h"
Enabled targets: X86_V4, X86_V3, baseline
Generating multi-targets for "loops_hyperbolic.dispatch.h"
Enabled targets: X86_V4, X86_V3, baseline
Generating multi-targets for "loops_logical.dispatch.h"
Enabled targets: X86_V4, X86_V3, baseline
Generating multi-targets for "loops_minmax.dispatch.h"
Enabled targets: X86_V4, X86_V3, baseline
Generating multi-targets for "loops_modulo.dispatch.h"
Enabled targets: baseline
Generating multi-targets for "loops_trigonometric.dispatch.h"
Enabled targets: X86_V4, X86_V3, baseline
Generating multi-targets for "loops_umath_fp.dispatch.h"
Enabled targets: X86_V4, baseline
Generating multi-targets for "loops_unary.dispatch.h"
Enabled targets: X86_V4, baseline
Generating multi-targets for "loops_unary_fp.dispatch.h"
Enabled targets: baseline
Generating multi-targets for "loops_unary_fp_le.dispatch.h"
Enabled targets: baseline
Generating multi-targets for "loops_unary_complex.dispatch.h"
Enabled targets: X86_V3, baseline
Generating multi-targets for "loops_autovec.dispatch.h"
Enabled targets: X86_V3, baseline
Generating multi-targets for "loops_half.dispatch.h"
Enabled targets: AVX512_SPR, X86_V4, baseline
WARNING: Project targets '>=1.5.2' but uses feature deprecated since '1.3.0': Source file src/umath/svml/linux/avx512/svml_z0_acos_d_la.s in the 'objects' kwarg is not an object..
Generating multi-targets for "_simd.dispatch.h"
Enabled targets: X86_V3, X86_V4, baseline