shibatch / sleef

SIMD Library for Evaluating Elementary Functions, vectorized libm and DFT
https://sleef.org
Boost Software License 1.0
674 stars 134 forks source link

Installation, Configuration and Usage Under Windows #172

Open RoyiAvital opened 6 years ago

RoyiAvital commented 6 years ago

Hello, I'm trying to install Sleef on Windows. My system is Windows 10 Pro 64 Bit with Visual Studio 2017 (15.5.6).

The problem is Cmake requires a file called CMakeLists.txt.
It seems this file is available in the master branch of GitHub yet it is not part of the Releases.
If one download the ZIP form GitHub Releases or SourceForge he doesn't get the CMakeLists.txt file.

What should I do? Go with Master (Which I assume isn't validated as stable releases) or is the any other way?

Thank You.

shibatch commented 6 years ago

Hello,

Please download the master branch in the git repository.

https://github.com/shibatch/sleef/archive/master.zip

RoyiAvital commented 6 years ago

I downloaded and trying it.

Will cmake -G"Visual Studio 15 2017 Win64" -DBUILD_SHARED_LIBS=FALSE .. work to create Static Linked library in Windows?

By the way, any chance support Intel ICC on Windows (Better OpenMP support)?

Update I tried:

> `cmake -G"Visual Studio 15 2017 Win64" -DBUILD_SHARED_LIBS=FALSE ..`
> `cmake --build . --config Release -- /maxcpucount:1`

It yielded errors.

shibatch commented 6 years ago

For the static lib, I haven't tested. I will test it tomorrow. I don't have a license for using ICC on Windows.

RoyiAvital commented 6 years ago

Is there a way to use GCC on Windows to generate Static Libraries on Windows?

Hopefully you will catch the issues preventing "Static Libraries" on Windows + MSVC.

Thank You.

shibatch commented 6 years ago

GCC on windows does not support the ABI for AVX. At this time, the only way is to use MSVC.

RoyiAvital commented 6 years ago

Will it hit performance or the code is low level to be compiler insensitive?

By the way, ICC is free for Students and Academic use. So you may be able to get it as well.

shibatch commented 6 years ago

I didn't check the performance on windows. I only confirmed that it works correctly.

The licesnse for open source contributors only includes linux versions. The educator license requires icc to be installed in a classroom. My understanding is that there is no free license for windows icc.

RoyiAvital commented 6 years ago

Have a look at Student - https://software.intel.com/en-us/qualify-for-free-software/student. It gives you license to any version.

Once you try the Static Build let me know and I will try it on my system.

Thank You.

shibatch commented 6 years ago

I am not a student anymore. :)

fpetrogalli commented 6 years ago

Once you try the Static Build let me know and I will try it on my system.

@RoyiAvital , thanks for your interest in SLEEF! May I encourage you in submitting a patch that does exactly what you want?

RoyiAvital commented 6 years ago

@fpetrogalli-arm , I wish I had the knowledge to get even close to understand what you do.
I can barely understand what exactly I need :-).

It seems like a great library. Hopefully once you have the Static Lib ready I will be able to try it on. Checking it and trying to report bugs, edge cases, etc... is something I can do and will do.

By the way, as a feature request, could you also add pre compiled LIB's (Windows, macOS, Linux) to the Releases on GitHub?

Thank You.

fpetrogalli commented 6 years ago

@RoyiAvital Nobody is born with knowledge! I am sure you can handle this, you just need to give it a go. What kind of errors do you see when you run that command line?

cmake -G"Visual Studio 15 2017 Win64" -DBUILD_SHARED_LIBS=FALSE .. cmake --build . --config Release -- /maxcpucount:1

Can you past them here? I would try it myself but I don't have a windows/msvc machine.

shibatch commented 6 years ago

The problem with providing precompiled libs for windows is that it depends on the version of MSVC. I need to install every version of MSVC to build the libraries of all versions. I believe building the library yourself is simple enough.

RoyiAvital commented 6 years ago

Hi, The erros were like that:

iutsimd.obj : error LNK2019: unresolved external symbol __imp_Sleef_x86CpuID referenced in function check_featureDP [<PathToSleef>\Sleef\sleef-master\build\src\libm-tester\iutsse4.vcxproj]
  iutsimd.obj : error LNK2019: unresolved external symbol __imp_Sleef_sind2_u35sse4 referenced in function do_test [<PathToSleef>\Sleef\sleef-master\build\src\libm-tester\iutsse4.vcxproj]
  iutsimd.obj : error LNK2019: unresolved external symbol __imp_Sleef_cosd2_u35sse4 referenced in function do_test [<PathToSleef>\Sleef\sleef-master\build\src\libm-tester\iutsse4.vcxproj]
  iutsimd.obj : error LNK2019: unresolved external symbol __imp_Sleef_sincosd2_u35sse4 referenced in function do_test [<PathToSleef>\Sleef\sleef-master\build\src\libm-tester\iutsse4.vcxproj]
  iutsimd.obj : error LNK2019: unresolved external symbol __imp_Sleef_tand2_u35sse4 referenced in function do_test [<PathToSleef>\Sleef\sleef-master\build\src\libm-tester\iutsse4.vcxproj]
  iutsimd.obj : error LNK2019: unresolved external symbol __imp_Sleef_asind2_u35sse4 referenced in function do_test [<PathToSleef>\Sleef\sleef-master\build\src\libm-tester\iutsse4.vcxproj]
  iutsimd.obj : error LNK2019: unresolved external symbol __imp_Sleef_acosd2_u35sse4 referenced in function do_test [<PathToSleef>\Sleef\sleef-master\build\src\libm-tester\iutsse4.vcxproj]
  iutsimd.obj : error LNK2019: unresolved external symbol __imp_Sleef_atand2_u35sse4 referenced in function do_test [<PathToSleef>\Sleef\sleef-master\build\src\libm-tester\iutsse4.vcxproj]
  iutsimd.obj : error LNK2019: unresolved external symbol __imp_Sleef_atan2d2_u35sse4 referenced in function do_test [<PathToSleef>\Sleef\sleef-master\build\src\libm-tester\iutsse4.vcxproj]
  iutsimd.obj : error LNK2019: unresolved external symbol __imp_Sleef_logd2_u35sse4 referenced in function do_test [<PathToSleef>\Sleef\sleef-master\build\src\libm-tester\iutsse4.vcxproj]
  iutsimd.obj : error LNK2019: unresolved external symbol __imp_Sleef_cbrtd2_u35sse4 referenced in function do_test [<PathToSleef>\Sleef\sleef-master\build\src\libm-tester\iutsse4.vcxproj]
  iutsimd.obj : error LNK2019: unresolved external symbol __imp_Sleef_sind2_u10sse4 referenced in function do_test [<PathToSleef>\Sleef\sleef-master\build\src\libm-tester\iutsse4.vcxproj]
  iutsimd.obj : error LNK2019: unresolved external symbol __imp_Sleef_cosd2_u10sse4 referenced in function do_test [<PathToSleef>\Sleef\sleef-master\build\src\libm-tester\iutsse4.vcxproj]
  iutsimd.obj : error LNK2019: unresolved external symbol __imp_Sleef_sincosd2_u10sse4 referenced in function do_test [<PathToSleef>\Sleef\sleef-master\build\src\libm-tester\iutsse4.vcxproj]
  iutsimd.obj : error LNK2019: unresolved external symbol __imp_Sleef_tand2_u10sse4 referenced in function do_test [<PathToSleef>\Sleef\sleef-master\build\src\libm-tester\iutsse4.vcxproj]
  iutsimd.obj : error LNK2019: unresolved external symbol __imp_Sleef_asind2_u10sse4 referenced in function do_test [<PathToSleef>\Sleef\sleef-master\build\src\libm-tester\iutsse4.vcxproj]
  iutsimd.obj : error LNK2019: unresolved external symbol __imp_Sleef_acosd2_u10sse4 referenced in function do_test [<PathToSleef>\Sleef\sleef-master\build\src\libm-tester\iutsse4.vcxproj]
  iutsimd.obj : error LNK2019: unresolved external symbol __imp_Sleef_atand2_u10sse4 referenced in function do_test [<PathToSleef>\Sleef\sleef-master\build\src\libm-tester\iutsse4.vcxproj]
  iutsimd.obj : error LNK2019: unresolved external symbol __imp_Sleef_atan2d2_u10sse4 referenced in function do_test [<PathToSleef>\Sleef\sleef-master\build\src\libm-tester\iutsse4.vcxproj]
  iutsimd.obj : error LNK2019: unresolved external symbol __imp_Sleef_logd2_u10sse4 referenced in function do_test [<PathToSleef>\Sleef\sleef-master\build\src\libm-tester\iutsse4.vcxproj]
  iutsimd.obj : error LNK2019: unresolved external symbol __imp_Sleef_cbrtd2_u10sse4 referenced in function do_test [<PathToSleef>\Sleef\sleef-master\build\src\libm-tester\iutsse4.vcxproj]
  iutsimd.obj : error LNK2019: unresolved external symbol __imp_Sleef_expd2_u10sse4 referenced in function do_test [<PathToSleef>\Sleef\sleef-master\build\src\libm-tester\iutsse4.vcxproj]

But like hundreds of them and for most of the sub compilation tasks (I'm not sure I know what happens there, it seems to compile many sub projects).

Regarding pre built version, since MSVC us now free in the community edition, no reason to support anything but the latest. It will make the entrance fees to use this project much lower. I'd do that for macOS and Linux as well.

shibatch commented 6 years ago

That's because you are trying to build static libs on windows. It seems that I need some modification to make it possible.

carlkl commented 6 years ago

@shibatch, concerning windows doesn't support AVX ABI on windows: There is indeed a problem with gcc on x64 (64bit) but not on 32bit (AFAIK):

[Mingw-w64-public] AVX support is broken in 64-bit mode! Will there ever be a fix? ...quote... Hello, first thanks for interesting in this subject, but sadly I have disappoint you about it, I fear. The cause for the inability to align to 32-byte alignment is neither to seek in gcc, nor in mingw-w64 itself. It is a consequence of the SEH-information required by the x64 ABI (see here as reference either msdn, or ibm's IA64 exception-specification).

As a consequence SIMD instructions requiring explicitly 32-byte aligned memory won't work and have to be replaced be (slower) instructions not requiring explicit alignment. The questions: is sleef affected by this at all?

shibatch commented 6 years ago

Hello @carlkl,

32-bit x86 support is kind of supplemental, and not fully tested on any of operating systems. It should work, but performance would be worse than the 64-bit library due to a smaller number of available registers.

64-bit AVX support is known to be broken.

shibatch commented 6 years ago

@RoyiAvital Building static libs with MSVC should be possible with the following code.

https://github.com/shibatch/sleef/archive/Enable_building_static_libs_on_MSVC.zip

fpetrogalli commented 6 years ago

I have merged the static build on Windows in master (https://github.com/shibatch/sleef/commit/064e002916cbdfca04751b1f875b340b40e3dbe4). @shibatch , thank you for working on this.

@RoyiAvital , does this solve your problems when building on Windows?

RoyiAvital commented 6 years ago

@fpetrogalli-arm , I finished running the script which went well. When linking the library, should I link all .lib files or only one of them?

fpetrogalli commented 6 years ago

When linking the library, should I link all .lib files or only one of them?

You should link the library that you want to use. Which functions are invoking in your code? I have no experience on MSVC, but I suspect that you will have to tell the compiler and the library loader the place where you have installed the library.

For example, on linux if you invoke the following in your code on x86:

#include <sleef.h>

// ...
__m128 In = // some computation
__m128 Out = Sleef_expf4_u10(In);
// ...

You will have to invoke the compiler with a -lsleef command line flag to make sure that your code is linked against libsleef.so. The library file should be located in a directory listed in the environment variable LD_LIBRARY_PATH. I think MSVC have a similar mechanism.

RoyiAvital commented 6 years ago

As you can see there are many libraries:

My question is, should I link all, or just sleef.lib.

Linking mechanism in MSVC is just like GCC.

fpetrogalli commented 6 years ago

I see. The libraries are:

RoyiAvital commented 6 years ago

OK, I managed to make all functions available.

Feature Request / Suggestion You expose functions only if __SSE__ / __AVX__ etc are defined. Those are flags usually used by the Compilers out there. Yet it has issues if I write code using intrinsic on my own (Namely I don't ask compiler for optimization) and want to generate code.

Hence I'd suggest the following:

#ifdef __SSE2__ -> #if defined __SSE2__ || __SLEEF_SSE_2 || _SLEEF_SIMD_FUNCTIONS

Now, the user has choice either use Compiler __SSE2__ which might have other effects or being specific with Sleef.
The __SLEEF_SIMD_FUNCTIONS__ will be the joker, namely will expose all functions for the user.

shibatch commented 6 years ago

@RoyiAvital It does not make sense to expose, for example, avx functions when AVX is not defined. If AVX is not defined, that means that the ABI for calling the AVX functions is not available.

RoyiAvital commented 6 years ago

@shibatch , Well I don't want the compiler to Optimize to AVX (Namely the code won't run on Non AVX system). Yet I want it to generate AVX code. Hence I just include the AVX intrinsics, use AVX intrinsics, compile and it works perfectly. Now I can't do it with Sleef.

Anyhow, on windows I get Error LNK2001 unresolved external symbol __imp_Sleef_expf4_u10sse4. Could it be the library isn't "Behaving well". As other libraries in the project works perfectly.

shibatch commented 6 years ago

That's because MSVC does not automatically define AVX macro. Please manually define it when you use those functions. If you want to use a static lib, you also need to define SLEEF_STATIC_LIBS.

RoyiAvital commented 6 years ago

I defined SLEEF_STATIC_LIBS and then got:

Error   LNK2001 unresolved external symbol Sleef_x86CpuID
shibatch commented 6 years ago

I'll check this tomorrow.

shibatch commented 6 years ago

@RoyiAvital How did you get that error? What source code are you trying to compile?

RoyiAvital commented 6 years ago

@shibatch , I just call the exp function:

y = Sleef_expf4_u10sse4(x);

Where both x and y are __m128.

I think it has to be related to IMPORT / EXPORT thing. Just like setting Static Library macro fixed the other error I had before.

shibatch commented 6 years ago

@RoyiAvital Try this.

https://github.com/shibatch/sleef/archive/Change_libcommon_to_obj.zip

RoyiAvital commented 6 years ago

Seems to work!

shibatch commented 6 years ago

sleef.h is generated when the library is built.

RoyiAvital commented 6 years ago

Yea, I updated my comment. It seems to work now and faster than my previous function.

Kudos!

I really like the fact you give the user full control.

fpetrogalli commented 6 years ago

@RoyiAvital , am I assuming that #174 fixed your problems? Are you happy for me to close this issue?

RoyiAvital commented 6 years ago

So far so good so I guess yes :-).

RoyiAvital commented 6 years ago

@shibatch , By the way, I'm not an expert (Barely even knows what's ABI is). But you mentioned before having issues with GCC and AVX on Windows.

I use GCC (MinGW from https://github.com/StephanTLavavej/mingw-distro by @StephanTLavavej) and it compiles AVX + AVX2 code easily.

shibatch commented 6 years ago

It compiles, but does not work.

RoyiAvital commented 6 years ago

It works perfectly. I compiled DLL which works perfectly. Try the MinGW I linked.

shibatch commented 6 years ago

At least with Cygwin, it does not work. Try running "make test". If it passes all the tests, then it seems working. I googled a little bit, and I could not find a message saying that the situation is improved. You can use it since it is not disabled. It is just not supported or tested.

carlkl commented 6 years ago

@RoyiAvital, did you compiled with the msys2 shell?

RoyiAvital commented 6 years ago

I'm not familiar with the eco system as you. I just have gcc and g++ and I can do what ever I want with them as they were MSVC. They generate DLL's, EXE with SSE, AVX, and AVX2 (I use the Intel Intrinsics directly) which work as any other DLL work.

I haven't tried generating Static libraries though.

I don't use msys2 shell (Don't know even what it is). I just do everything through command line.

With CMake (Which I was exposed through you and moved one of my project to it) I just use MinGW generator with the Distribution above.

RoyiAvital commented 6 years ago

OK, I tested building with my environment. This is the result:

cmake -G"MinGW Makefiles" -DBUILD_SHARED_LIBS=FALSE ..
-- The C compiler identification is GNU 7.2.0
-- Check for working C compiler: C:/Applications/MinGW/bin/gcc.exe
-- Check for working C compiler: C:/Applications/MinGW/bin/gcc.exe -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Setting build type to 'Release' (required for full support).
-- Looking for sys/types.h
-- Looking for sys/types.h - found
-- Looking for stdint.h
-- Looking for stdint.h - found
-- Looking for stddef.h
-- Looking for stddef.h - found
-- Check size of long double
-- Check size of long double - done
-- Performing Test COMPILER_SUPPORTS_LONG_DOUBLE
-- Performing Test COMPILER_SUPPORTS_LONG_DOUBLE - Success
-- Performing Test COMPILER_SUPPORTS_FLOAT128
-- Performing Test COMPILER_SUPPORTS_FLOAT128 - Success
-- Performing Test COMPILER_SUPPORTS_SSE2
-- Performing Test COMPILER_SUPPORTS_SSE2 - Success
-- Performing Test COMPILER_SUPPORTS_SSE4
-- Performing Test COMPILER_SUPPORTS_SSE4 - Success
-- Performing Test COMPILER_SUPPORTS_AVX
-- Performing Test COMPILER_SUPPORTS_AVX - Success
-- Performing Test COMPILER_SUPPORTS_FMA4
-- Performing Test COMPILER_SUPPORTS_FMA4 - Success
-- Performing Test COMPILER_SUPPORTS_AVX2
-- Performing Test COMPILER_SUPPORTS_AVX2 - Success
-- Performing Test COMPILER_SUPPORTS_AVX512F
-- Performing Test COMPILER_SUPPORTS_AVX512F - Success
-- Found OpenMP_C: -fopenmp (found version "4.5")
-- Found OpenMP: TRUE (found version "4.5")
-- Performing Test COMPILER_SUPPORTS_OPENMP
-- Performing Test COMPILER_SUPPORTS_OPENMP - Success
-- Performing Test COMPILER_SUPPORTS_WEAK_ALIASES
-- Performing Test COMPILER_SUPPORTS_WEAK_ALIASES - Success
-- Performing Test COMPILER_SUPPORTS_BUILTIN_MATH
-- Performing Test COMPILER_SUPPORTS_BUILTIN_MATH - Success
-- Unroll target for DP : unroll_0_vecextdp.c;unroll_1_vecextdp.c;unroll_2_vecextdp.c;unroll_3_vecextdp.c;unroll_0_sse2dp.c;unroll_1_sse2dp.c;unroll_2_sse2dp.c;unroll_3_sse2dp.c;unroll_0_avxdp.c;unroll_1_avxdp.c;unroll_2_avxdp.c;unroll_3_avxdp.c;unroll_0_avx2dp.c;unroll_1_avx2dp.c;unroll_2_avx2dp.c;unroll_3_avx2dp.c;unroll_0_avx512fdp.c;unroll_1_avx512fdp.c;unroll_2_avx512fdp.c;unroll_3_avx512fdp.c
-- Unroll target for SP : unroll_0_vecextsp.c;unroll_1_vecextsp.c;unroll_2_vecextsp.c;unroll_3_vecextsp.c;unroll_0_sse2sp.c;unroll_1_sse2sp.c;unroll_2_sse2sp.c;unroll_3_sse2sp.c;unroll_0_avxsp.c;unroll_1_avxsp.c;unroll_2_avxsp.c;unroll_3_avxsp.c;unroll_0_avx2sp.c;unroll_1_avx2sp.c;unroll_2_avx2sp.c;unroll_3_avx2sp.c;unroll_0_avx512fsp.c;unroll_1_avx512fsp.c;unroll_2_avx512fsp.c;unroll_3_avx512fsp.c
-- Unroll target for LD : unroll_0_vecextld.c;unroll_1_vecextld.c;unroll_2_vecextld.c;unroll_3_vecextld.c
-- Unroll target for QP : unroll_0_vecextqp.c;unroll_1_vecextqp.c;unroll_2_vecextqp.c;unroll_3_vecextqp.c
-- Configuring build for SLEEF-v3.1
   Target system: Windows-10.0.14393
   Target processor: AMD64
   Host system: Windows-10.0.14393
   Host processor: AMD64
   Detected C compiler: GNU @ C:/Applications/MinGW/bin/gcc.exe
-- Using option `-Wall -Wno-unused -Wno-attributes -Wno-unused-result -Wno-psabi -ffp-contract=off -fno-math-errno -fno-trapping-math` to compile libsleef
-- Building shared libs : FALSE
-- MPFR : LIB_MPFR-NOTFOUND
-- GMP : LIBGMP-NOTFOUND
-- RUNNING_ON_TRAVIS : 0
-- COMPILER_SUPPORTS_OPENMP : 1
-- A version of SLEEF compatible  with libm and libmvec in GNU libc will be produced (sleefgnuabi.so)
-- Configuring done
-- Generating done
-- Build files have been written to:

I will now try build.

RoyiAvital commented 6 years ago

This is what I typed - cmake --build . --config Release -- /maxcpucount:1.
As I want all function to be Single Threaded (Why would Sleef need Multi Threaded, does it work on arrays?). The error I got was - mingw32-make.exe: *** No rule to make target '/maxcpucount:1'. Stop.

Trying now without /maxcpucount:1.

shibatch commented 6 years ago

On mingw, you should execute "make; make test"

Supporting AVX with mingw or cygwin seems very hard.

https://sourceforge.net/p/mingw-w64/mailman/message/34485783/

RoyiAvital commented 6 years ago

Here is the result:

cmake --build . --config Release --
Scanning dependencies of target mkrename
[  1%] Building C object src/libm/CMakeFiles/mkrename.dir/mkrename.c.obj
[  1%] Linking C executable ..\..\bin\mkrename.exe
[  1%] Built target mkrename
Scanning dependencies of target mkrename_gnuabi
[  1%] Building C object src/libm/CMakeFiles/mkrename_gnuabi.dir/mkrename_gnuabi.c.obj
[  2%] Linking C executable ..\..\bin\mkrename_gnuabi.exe
[  2%] Built target mkrename_gnuabi
[  2%] Generating include/renameavx2_gnuabi.h
Generating renameavx2_gnuabi.h: mkrename_gnuabi "avx2" "d" "4" "8" "__m256d" "__m256" "__m128i" "__m256i" "__AVX2__"
Scanning dependencies of target sleefgnuabiavx2dp
[  3%] Building C object src/libm/CMakeFiles/sleefgnuabiavx2dp.dir/sleefsimddp.c.obj
[  3%] Built target sleefgnuabiavx2dp
Scanning dependencies of target mkmasked_gnuabi
[  4%] Building C object src/libm/CMakeFiles/mkmasked_gnuabi.dir/mkmasked_gnuabi.c.obj
[  4%] Linking C executable ..\..\bin\mkmasked_gnuabi.exe
[  4%] Built target mkmasked_gnuabi
Scanning dependencies of target maskedAVX512F_generated
[  5%] Generating include/masked_avx512f_dp_gnuabi.h
Generating C:/Sleef/sleef-GCC/build/src/libm/include/masked_avx512f_dp_gnuabi.h
[  5%] Generating include/masked_avx512f_sp_gnuabi.h
Generating C:/Sleef/sleef-GCC/build/src/libm/include/masked_avx512f_sp_gnuabi.h
[  5%] Built target maskedAVX512F_generated
[  6%] Generating include/renameavx512f_gnuabi.h
Generating renameavx512f_gnuabi.h: mkrename_gnuabi "avx512f" "e" "8" "16" "__m512d" "__m512" "__m256i" "__m512i" "__AVX512F__"
Scanning dependencies of target sleefgnuabiavx512fsp
[  6%] Building C object src/libm/CMakeFiles/sleefgnuabiavx512fsp.dir/sleefsimdsp.c.obj
C:\Users\UserName\AppData\Local\Temp\2\ccaWUp0W.s: Assembler messages:
C:\Users\UserName\AppData\Local\Temp\2\ccaWUp0W.s:30: Error: invalid register for .seh_savexmm
C:\Users\UserName\AppData\Local\Temp\2\ccaWUp0W.s:32: Error: invalid register for .seh_savexmm
C:\Users\UserName\AppData\Local\Temp\2\ccaWUp0W.s:34: Error: invalid register for .seh_savexmm
C:\Users\UserName\AppData\Local\Temp\2\ccaWUp0W.s:36: Error: invalid register for .seh_savexmm
C:\Users\UserName\AppData\Local\Temp\2\ccaWUp0W.s:38: Error: invalid register for .seh_savexmm
C:\Users\UserName\AppData\Local\Temp\2\ccaWUp0W.s:40: Error: invalid register for .seh_savexmm
C:\Users\UserName\AppData\Local\Temp\2\ccaWUp0W.s:42: Error: invalid register for .seh_savexmm
C:\Users\UserName\AppData\Local\Temp\2\ccaWUp0W.s:44: Error: invalid register for .seh_savexmm
C:\Users\UserName\AppData\Local\Temp\2\ccaWUp0W.s:46: Error: invalid register for .seh_savexmm
C:\Users\UserName\AppData\Local\Temp\2\ccaWUp0W.s:48: Error: invalid register for .seh_savexmm
C:\Users\UserName\AppData\Local\Temp\2\ccaWUp0W.s:50: Error: invalid register for .seh_savexmm
C:\Users\UserName\AppData\Local\Temp\2\ccaWUp0W.s:52: Error: invalid register for .seh_savexmm
C:\Users\UserName\AppData\Local\Temp\2\ccaWUp0W.s:54: Error: invalid register for .seh_savexmm
C:\Users\UserName\AppData\Local\Temp\2\ccaWUp0W.s:56: Error: invalid register for .seh_savexmm
C:\Users\UserName\AppData\Local\Temp\2\ccaWUp0W.s:2387: Error: invalid register for .seh_savexmm
C:\Users\UserName\AppData\Local\Temp\2\ccaWUp0W.s:2389: Error: invalid register for .seh_savexmm
C:\Users\UserName\AppData\Local\Temp\2\ccaWUp0W.s:2391: Error: invalid register for .seh_savexmm
C:\Users\UserName\AppData\Local\Temp\2\ccaWUp0W.s:3154: Error: invalid register for .seh_savexmm
C:\Users\UserName\AppData\Local\Temp\2\ccaWUp0W.s:3156: Error: invalid register for .seh_savexmm
C:\Users\UserName\AppData\Local\Temp\2\ccaWUp0W.s:3158: Error: invalid register for .seh_savexmm
C:\Users\UserName\AppData\Local\Temp\2\ccaWUp0W.s:3160: Error: invalid register for .seh_savexmm
C:\Users\UserName\AppData\Local\Temp\2\ccaWUp0W.s:3162: Error: invalid register for .seh_savexmm
C:\Users\UserName\AppData\Local\Temp\2\ccaWUp0W.s:3164: Error: invalid register for .seh_savexmm
C:\Users\UserName\AppData\Local\Temp\2\ccaWUp0W.s:3166: Error: invalid register for .seh_savexmm
C:\Users\UserName\AppData\Local\Temp\2\ccaWUp0W.s:3448: Error: invalid register for .seh_savexmm
C:\Users\UserName\AppData\Local\Temp\2\ccaWUp0W.s:3450: Error: invalid register for .seh_savexmm
C:\Users\UserName\AppData\Local\Temp\2\ccaWUp0W.s:3452: Error: invalid register for .seh_savexmm
C:\Users\UserName\AppData\Local\Temp\2\ccaWUp0W.s:3454: Error: invalid register for .seh_savexmm
C:\Users\UserName\AppData\Local\Temp\2\ccaWUp0W.s:3456: Error: invalid register for .seh_savexmm
C:\Users\UserName\AppData\Local\Temp\2\ccaWUp0W.s:3458: Error: invalid register for .seh_savexmm
C:\Users\UserName\AppData\Local\Temp\2\ccaWUp0W.s:3460: Error: invalid register for .seh_savexmm
C:\Users\UserName\AppData\Local\Temp\2\ccaWUp0W.s:3462: Error: invalid register for .seh_savexmm
C:\Users\UserName\AppData\Local\Temp\2\ccaWUp0W.s:3464: Error: invalid register for .seh_savexmm
C:\Users\UserName\AppData\Local\Temp\2\ccaWUp0W.s:3466: Error: invalid register for .seh_savexmm
C:\Users\UserName\AppData\Local\Temp\2\ccaWUp0W.s:3763: Error: invalid register for .seh_savexmm
C:\Users\UserName\AppData\Local\Temp\2\ccaWUp0W.s:4279: Error: invalid register for .seh_savexmm
C:\Users\UserName\AppData\Local\Temp\2\ccaWUp0W.s:4281: Error: invalid register for .seh_savexmm
C:\Users\UserName\AppData\Local\Temp\2\ccaWUp0W.s:4283: Error: invalid register for .seh_savexmm
C:\Users\UserName\AppData\Local\Temp\2\ccaWUp0W.s:4484: Error: invalid register for .seh_savexmm
C:\Users\UserName\AppData\Local\Temp\2\ccaWUp0W.s:4697: Error: invalid register for .seh_savexmm
C:\Users\UserName\AppData\Local\Temp\2\ccaWUp0W.s:5798: Error: invalid register for .seh_savexmm
C:\Users\UserName\AppData\Local\Temp\2\ccaWUp0W.s:6056: Error: invalid register for .seh_savexmm
C:\Users\UserName\AppData\Local\Temp\2\ccaWUp0W.s:6058: Error: invalid register for .seh_savexmm
C:\Users\UserName\AppData\Local\Temp\2\ccaWUp0W.s:6855: Error: invalid register for .seh_savexmm
C:\Users\UserName\AppData\Local\Temp\2\ccaWUp0W.s:7026: Error: invalid register for .seh_savexmm
C:\Users\UserName\AppData\Local\Temp\2\ccaWUp0W.s:7028: Error: invalid register for .seh_savexmm
C:\Users\UserName\AppData\Local\Temp\2\ccaWUp0W.s:7255: Error: invalid register for .seh_savexmm
C:\Users\UserName\AppData\Local\Temp\2\ccaWUp0W.s:7257: Error: invalid register for .seh_savexmm
C:\Users\UserName\AppData\Local\Temp\2\ccaWUp0W.s:9456: Error: invalid register for .seh_savexmm
C:\Users\UserName\AppData\Local\Temp\2\ccaWUp0W.s:9458: Error: invalid register for .seh_savexmm
C:\Users\UserName\AppData\Local\Temp\2\ccaWUp0W.s:9460: Error: invalid register for .seh_savexmm
C:\Users\UserName\AppData\Local\Temp\2\ccaWUp0W.s:9462: Error: invalid register for .seh_savexmm
C:\Users\UserName\AppData\Local\Temp\2\ccaWUp0W.s:9464: Error: invalid register for .seh_savexmm
C:\Users\UserName\AppData\Local\Temp\2\ccaWUp0W.s:9466: Error: invalid register for .seh_savexmm
C:\Users\UserName\AppData\Local\Temp\2\ccaWUp0W.s:9468: Error: invalid register for .seh_savexmm
C:\Users\UserName\AppData\Local\Temp\2\ccaWUp0W.s:9722: Error: invalid register for .seh_savexmm
C:\Users\UserName\AppData\Local\Temp\2\ccaWUp0W.s:10109: Error: invalid register for .seh_savexmm
C:\Users\UserName\AppData\Local\Temp\2\ccaWUp0W.s:11645: Error: invalid register for .seh_savexmm
mingw32-make.exe[2]: *** [src\libm\CMakeFiles\sleefgnuabiavx512fsp.dir\build.make:68: src/libm/CMakeFiles/sleefgnuabiavx512fsp.dir/sleefsimdsp.c.obj] Error 1
mingw32-make.exe[1]: *** [CMakeFiles\Makefile2:1513: src/libm/CMakeFiles/sleefgnuabiavx512fsp.dir/all] Error 2
mingw32-make.exe: *** [Makefile:140: all] Error 2

@shibatch , It is really beyond my knowledge. But I can assure you that a code generated in my GCC system is with AVX and AVX2 and working. Though those are DLL's only (I use them to accelerate some functions in MATLAB).

shibatch commented 6 years ago

That's the expected result.

carlkl commented 6 years ago

concerning Windows and AVX: (but not AVX2)

@RoyiAvital, be aware that gcc on windows compiles and links without problems AVX code. However, on 64bit Windows the resulting code may crash. To understand why please follow the link [Mingw-w64-public] AVX support is broken in 64-bit mode! Will there ever be a fix? and read the whole thread.

In short gcc may create 32bit aligned SIMD instructions and that is not supported by the Windows 64bit OS for some reason. MSVC circumvents this problem by using unaligned SIMD instructions instead. GCC doesn't support this workaround.

A different problem problem wich may arise is, that Windows running on a virtual server may tell you, AVX support for the CPU but running AVX code is not supported due to usage of the virtual server. I think this is the reason why many people thin that AVX support is broken on Windows.

carlkl commented 6 years ago

Concerning Error: invalid register for .seh_savexmm

https://gcc.gnu.org/bugzilla/show_bug.cgi?id=65782