Skip to content

Commit 5cfe0c7

Browse files
committed
lstm: Add AVX / SSE support for Windows
Signed-off-by: Stefan Weil <sw@weilnetz.de>
1 parent b2a0262 commit 5cfe0c7

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

lstm/weightmatrix.cpp

+9
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
# if defined(__linux__) || defined(__MINGW32__)
3030
# include <cpuid.h>
3131
# elif defined(_WIN32)
32+
# include <intrin.h>
3233
# endif
3334
#endif
3435
#include "dotproductavx.h"
@@ -71,6 +72,14 @@ class SIMDDetect {
7172
sse_available_ = (ecx & 0x00080000) != 0;
7273
avx_available_ = (ecx & 0x10000000) != 0;
7374
}
75+
# elif defined(_WIN32)
76+
int cpuInfo[4];
77+
__cpuid(cpuInfo, 0);
78+
if (cpuInfo[0] >= 1) {
79+
__cpuid(cpuInfo, 1);
80+
sse_available_ = (cpuInfo[2] & 0x00080000) != 0;
81+
avx_available_ = (cpuInfo[2] & 0x10000000) != 0;
82+
}
7483
# endif
7584
if (avx_available_) tprintf("Found AVX\n");
7685
if (sse_available_) tprintf("Found SSE\n");

0 commit comments

Comments
 (0)