8000 improve configure checks for broken systems by juliantaylor · Pull Request #8141 · numpy/numpy · GitHub
[go: up one dir, main page]

Skip to content

improve configure checks for broken systems #8141

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

Merged
merged 2 commits into from
Oct 13, 2016
Merged
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
4 changes: 2 additions & 2 deletions numpy/core/include/numpy/npy_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@
#endif

/* compile target attributes */
#ifdef HAVE_ATTRIBUTE_TARGET_AVX
#if defined HAVE_ATTRIBUTE_TARGET_AVX && defined HAVE_LINK_AVX
#define NPY_GCC_TARGET_AVX __attribute__((target("avx")))
#else
#define NPY_GCC_TARGET_AVX
#endif
#ifdef HAVE_ATTRIBUTE_TARGET_AVX2
#if defined HAVE_ATTRIBUTE_TARGET_AVX2 && defined HAVE_LINK_AVX2
#define NPY_GCC_TARGET_AVX2 __attribute__((target("avx2")))
#else
#define NPY_GCC_TARGET_AVX2
Expand Down
8000 8 changes: 5 additions & 3 deletions numpy/core/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,12 +152,14 @@ def check_funcs(funcs_name):
for tup in OPTIONAL_INTRINSICS:
headers = None
if len(tup) == 2:
f, args = tup
f, args, m = tup[0], tup[1], fname2def(tup[0])
elif len(tup) == 3:
f, args, headers, m = tup[0], tup[1], [tup[2]], fname2def(tup[0])
else:
f, args, headers = tup[0], tup[1], [tup[2]]
f, args, headers, m = tup[0], tup[1], [tup[2]], fname2def(tup[3])
if config.check_func(f, decl=False, call=True, call_args=args,
headers=headers):
moredefs.append((fname2def(f), 1))
moredefs.append((m, 1))

for dec, fn in OPTIONAL_FUNCTION_ATTRIBUTES:
if config.check_gcc_function_attribute(dec, fn):
Expand Down
11 changes: 9 additions & 2 deletions numpy/core/setup_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ def check_api_version(apiversion, codegen_dir):
]

# optional gcc compiler builtins and their call arguments and optional a
# required header
# required header and definition name (HAVE_ prepended)
# call arguments are required as the compiler will do strict signature checking
OPTIONAL_INTRINSICS = [("__builtin_isnan", '5.'),
("__builtin_isinf", '5.'),
Expand All @@ -125,12 +125,19 @@ def check_api_version(apiversion, codegen_dir):
("__builtin_bswap64", '5u'),
("__builtin_expect", '5, 0'),
("__builtin_mul_overflow", '5, 5, (int*)5'),
("__builtin_cpu_supports", '"sse"'),
# broken on OSX 10.11, make sure its not optimized away
("volatile int r = __builtin_cpu_supports", '"sse"',
"stdio.h", "__BUILTIN_CPU_SUPPORTS"),
("_mm_load_ps", '(float*)0', "xmmintrin.h"), # SSE
("_mm_prefetch", '(float*)0, _MM_HINT_NTA',
"xmmintrin.h"), # SSE
("_mm_load_pd", '(double*)0', "emmintrin.h"), # SSE2
("__builtin_prefetch", "(float*)0, 0, 3"),
# check that the linker can handle avx
("__asm__ volatile", '"vpand %xmm1, %xmm2, %xmm3"',
"stdio.h", "LINK_AVX"),
("__asm__ volatile", '"vpand %ymm1, %ymm2, %ymm3"',
"stdio.h", "LINK_AVX2"),
]

# function attributes
Expand Down
0