diff options
author | E. Madison Bray <erik.bray@lri.fr> | 2020-10-13 14:32:15 +0200 |
---|---|---|
committer | E. Madison Bray <erik.bray@lri.fr> | 2020-10-13 14:34:15 +0200 |
commit | 3c118aab05ca06f30b2eec8057e2e46db98ad745 (patch) | |
tree | 7206f15067bead7c6b2d72d399b0ca6aa701d0ee | |
parent | 9cc9f776cebf8207c0811ce600b7a76d9f54afa4 (diff) | |
download | numpy-3c118aab05ca06f30b2eec8057e2e46db98ad745.tar.gz |
BUG: Workaround for #14787: on Windows/Cygwin add extra compiler flags
when building the numpy.core._multiarray_umath module
This adds the extra compile args to the extension needed to work around
the bug but only in the known case where the bug is relevant.
-rw-r--r-- | numpy/core/setup.py | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/numpy/core/setup.py b/numpy/core/setup.py index 92dcacede..b3e17baed 100644 --- a/numpy/core/setup.py +++ b/numpy/core/setup.py @@ -102,7 +102,7 @@ def win32_checks(deflist): if a == "Intel" or a == "AMD64": deflist.append('FORCE_NO_LONG_DOUBLE_FORMATTING') -def check_math_capabilities(config, moredefs, mathlibs): +def check_math_capabilities(config, ext, moredefs, mathlibs): def check_func(func_name): return config.check_func(func_name, libraries=mathlibs, decl=True, call=True) @@ -167,6 +167,14 @@ def check_math_capabilities(config, moredefs, mathlibs): for dec, fn in OPTIONAL_FUNCTION_ATTRIBUTES: if config.check_gcc_function_attribute(dec, fn): moredefs.append((fname2def(fn), 1)) + if fn == 'attribute_target_avx512f': + # GH-14787: Work around GCC<8.4 bug when compiling with AVX512 + # support on Windows-based platforms + if (sys.platform in ('win32', 'cygwin') and + config.check_compiler_gcc() and + not config.check_gcc_version_at_least(8, 4)): + ext.extra_compile_args.extend( + ['-ffixed-xmm%s' % n for n in range(16, 32)]) for dec, fn, code, header in OPTIONAL_FUNCTION_ATTRIBUTES_WITH_INTRINSICS: if config.check_gcc_function_attribute_with_intrinsics(dec, fn, code, @@ -434,7 +442,7 @@ def configuration(parent_package='',top_path=None): mathlibs = check_mathlib(config_cmd) moredefs.append(('MATHLIB', ','.join(mathlibs))) - check_math_capabilities(config_cmd, moredefs, mathlibs) + check_math_capabilities(config_cmd, ext, moredefs, mathlibs) moredefs.extend(cocache.check_ieee_macros(config_cmd)[0]) moredefs.extend(cocache.check_complex(config_cmd, mathlibs)[0]) |