Skip to content

Commit

Permalink
lstm: Add AVX / SSE support for Windows
Browse files Browse the repository at this point in the history
Signed-off-by: Stefan Weil <[email protected]>
  • Loading branch information
stweil committed Dec 27, 2016
1 parent b2a0262 commit 5cfe0c7
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions lstm/weightmatrix.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
# if defined(__linux__) || defined(__MINGW32__)
# include <cpuid.h>
# elif defined(_WIN32)
# include <intrin.h>
# endif
#endif
#include "dotproductavx.h"
Expand Down Expand Up @@ -71,6 +72,14 @@ class SIMDDetect {
sse_available_ = (ecx & 0x00080000) != 0;
avx_available_ = (ecx & 0x10000000) != 0;
}
# elif defined(_WIN32)
int cpuInfo[4];
__cpuid(cpuInfo, 0);
if (cpuInfo[0] >= 1) {
__cpuid(cpuInfo, 1);
sse_available_ = (cpuInfo[2] & 0x00080000) != 0;
avx_available_ = (cpuInfo[2] & 0x10000000) != 0;
}
# endif
if (avx_available_) tprintf("Found AVX\n");
if (sse_available_) tprintf("Found SSE\n");
Expand Down

0 comments on commit 5cfe0c7

Please sign in to comment.