From 4c97add06371bf80f3bc02e0cfb0ee83737b909c Mon Sep 17 00:00:00 2001 From: Sayed Adel Date: Sat, 13 Jun 2020 18:15:41 +0200 Subject: ENH: [3/7] enable multi-platform SIMD compiler optimizations - Put `CCompilerOpt` in action through add two command line arguments that passed directly to `CCompilerOpt`'s parameters which explained as follows: * `--cpu-baseline` minimal set of required optimizations, default is 'min' which provides the minimum CPU features that can safely run on a wide range of users platforms. * `--cpu-dispatch` dispatched set of additional optimizations, default is 'max-xop-fma4' which enables all CPU features, except for AMD legacy features. the new arguments can be reached from `build`, `build_clib`, `build_ext`, if `build_clib` or `build_ext` are not specified by the user the arguments of `build` will be used, which also hold the default values. - Activate the new compiler dispatcher that comes with `CCompilerOpt`, through adding a hock inside `build_clib` and `build_ext` that works as a filter taking any C source files ends with `.dispatch.c` and pass it directly to `CCompilerOpt` and then take returned objects and linked to the final C lib. - Add a third command-line argument `--disable-optimization` which explicitly disable the whole new infrastructure, also It adds a new compiler definition called `NPY_DISABLE_OPTIMIZATION`. when `--disable-optimization` is enabled the dispatch-able sources that end with `.dispatch.c` will be treated as a normal C sources, also due to this disabling any C headers that generated by `CCompilerOpt` must guard it with `NPY_DISABLE_OPTIMIZATION`, otherwise, it will definitely break the build. - New auto-generated C header located at `core/include/numpy/_cpu_dispatch.h`, the new header contains all definitions and headers of CPU features that enabled according to specified configuration in `--cpu-baseline` and `--cpu-dispatch`. --- .gitignore | 1 + 1 file changed, 1 insertion(+) (limited to '.gitignore') diff --git a/.gitignore b/.gitignore index 302968a14..2a77f4f83 100644 --- a/.gitignore +++ b/.gitignore @@ -130,6 +130,7 @@ numpy/core/src/common/npy_cpu_features.c numpy/core/src/common/npy_partition.h numpy/core/src/common/npy_sort.h numpy/core/src/common/templ_common.h +numpy/core/src/common/_cpu_dispatch.h numpy/core/src/multiarray/_multiarray_tests.c numpy/core/src/multiarray/arraytypes.c numpy/core/src/multiarray/einsum.c -- cgit v1.2.1