From 5cfe0c700c27dd5834de5df09c8608cdcd976d1c Mon Sep 17 00:00:00 2001 From: Stefan Weil Date: Tue, 27 Dec 2016 11:14:15 +0100 Subject: [PATCH] lstm: Add AVX / SSE support for Windows Signed-off-by: Stefan Weil --- lstm/weightmatrix.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lstm/weightmatrix.cpp b/lstm/weightmatrix.cpp index 8c7aa4645d..84dd9b77ab 100644 --- a/lstm/weightmatrix.cpp +++ b/lstm/weightmatrix.cpp @@ -29,6 +29,7 @@ # if defined(__linux__) || defined(__MINGW32__) # include # elif defined(_WIN32) +# include # endif #endif #include "dotproductavx.h" @@ -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");