From 2deccb573ff2d92c992ca54b5b1ddfe90ae40e72 Mon Sep 17 00:00:00 2001 From: John Ward Date: Fri, 31 Dec 2021 09:40:15 -0500 Subject: [PATCH 1/5] Add missing `const npy_DTYPE0` --- bottleneck/src/reduce_template.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/bottleneck/src/reduce_template.c b/bottleneck/src/reduce_template.c index f80d96ab0..6ef249ae9 100644 --- a/bottleneck/src/reduce_template.c +++ b/bottleneck/src/reduce_template.c @@ -1313,7 +1313,7 @@ REDUCE_ONE(anynan, DTYPE0) { #else for (npy_intp i = 0; (i < loop_count) && (f == 0); i++) { for (npy_intp j = 0; j < LOOP_SIZE; j++) { - ai = pa[vector_offset + i * LOOP_SIZE + j]; + const npy_DTYPE0 ai = pa[vector_offset + i * LOOP_SIZE + j]; f += bn_isnan(ai); } } @@ -1517,7 +1517,7 @@ REDUCE_ONE(allnan, DTYPE0) { #else for (npy_intp i = 0; (i < loop_count) && (f == 0); i++) { for (npy_intp j = 0; j < LOOP_SIZE; j++) { - ai = pa[vector_offset + i * LOOP_SIZE + j]; + const npy_DTYPE0 ai = pa[vector_offset + i * LOOP_SIZE + j]; f += !bn_isnan(ai); } } From 52f498b8dc461adccf9d6c96f04ab916ace9631f Mon Sep 17 00:00:00 2001 From: John Ward Date: Fri, 31 Dec 2021 09:40:52 -0500 Subject: [PATCH 2/5] Remove optional emmintrin header --- bottleneck/src/bn_config.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bottleneck/src/bn_config.py b/bottleneck/src/bn_config.py index 43264c5a6..263540f96 100644 --- a/bottleneck/src/bn_config.py +++ b/bottleneck/src/bn_config.py @@ -11,7 +11,7 @@ ("HAVE_ATTRIBUTE_OPTIMIZE_OPT_3", '__attribute__((optimize("O3")))') ] -OPTIONAL_HEADERS = [("HAVE_SSE2", "emmintrin.h")] +OPTIONAL_HEADERS = [] OPTIONAL_INTRINSICS = [ ("HAVE___BUILTIN_ISNAN", "__builtin_isnan", "0."), From 57e0bf680495c5ec9a29148d4112b1dd32d77034 Mon Sep 17 00:00:00 2001 From: John Ward Date: Fri, 31 Dec 2021 09:57:39 -0500 Subject: [PATCH 3/5] Conditionally use emmintrin header if arch is not arm64 --- bottleneck/src/bn_config.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/bottleneck/src/bn_config.py b/bottleneck/src/bn_config.py index 263540f96..b3f1f7de4 100644 --- a/bottleneck/src/bn_config.py +++ b/bottleneck/src/bn_config.py @@ -3,6 +3,7 @@ """ import os import sys +import platform import textwrap from distutils.command.config import config as Config from typing import List @@ -11,7 +12,9 @@ ("HAVE_ATTRIBUTE_OPTIMIZE_OPT_3", '__attribute__((optimize("O3")))') ] -OPTIONAL_HEADERS = [] +OPTIONAL_HEADERS = ( + [] if platform.machine() == "arm64" else [("HAVE_SSE2", "emmintrin.h")] +) OPTIONAL_INTRINSICS = [ ("HAVE___BUILTIN_ISNAN", "__builtin_isnan", "0."), From eb59f28cb723295499a03b00fdec1ae54c6ad5fb Mon Sep 17 00:00:00 2001 From: John Ward Date: Fri, 31 Dec 2021 10:40:07 -0500 Subject: [PATCH 4/5] Add bc_config header --- bottleneck/include/bn_config.h | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 bottleneck/include/bn_config.h diff --git a/bottleneck/include/bn_config.h b/bottleneck/include/bn_config.h new file mode 100644 index 000000000..e1d46ed38 --- /dev/null +++ b/bottleneck/include/bn_config.h @@ -0,0 +1,6 @@ +#define HAVE_ATTRIBUTE_OPTIMIZE_OPT_3 0 +#define HAVE___BUILTIN_ISNAN 1 +#define HAVE_ISNAN 1 +#define HAVE__ISNAN 0 +/* undef inline */ +typedef int _make_iso_compilers_happy; From 7ce459a383f6fe2fd4e05cb677a9b85c1b0ad270 Mon Sep 17 00:00:00 2001 From: John Ward Date: Fri, 31 Dec 2021 14:26:22 -0500 Subject: [PATCH 5/5] Revert "Add bc_config header" This reverts commit eb59f28cb723295499a03b00fdec1ae54c6ad5fb. --- bottleneck/include/bn_config.h | 6 ------ 1 file changed, 6 deletions(-) delete mode 100644 bottleneck/include/bn_config.h diff --git a/bottleneck/include/bn_config.h b/bottleneck/include/bn_config.h deleted file mode 100644 index e1d46ed38..000000000 --- a/bottleneck/include/bn_config.h +++ /dev/null @@ -1,6 +0,0 @@ -#define HAVE_ATTRIBUTE_OPTIMIZE_OPT_3 0 -#define HAVE___BUILTIN_ISNAN 1 -#define HAVE_ISNAN 1 -#define HAVE__ISNAN 0 -/* undef inline */ -typedef int _make_iso_compilers_happy;