From 5c480d6fcb2f4ce8f912c4c242c6dcd16f7ce3a6 Mon Sep 17 00:00:00 2001 From: liaogang Date: Fri, 9 Dec 2016 15:15:41 +0800 Subject: [PATCH] Add reference to CPUID --- paddle/utils/CpuId.cpp | 2 +- paddle/utils/CpuId.h | 2 +- paddle/utils/tests/test_SIMDFlags.cpp | 15 ++++++--------- 3 files changed, 8 insertions(+), 11 deletions(-) diff --git a/paddle/utils/CpuId.cpp b/paddle/utils/CpuId.cpp index ab73be9e89..909c347945 100644 --- a/paddle/utils/CpuId.cpp +++ b/paddle/utils/CpuId.cpp @@ -34,7 +34,7 @@ static InitFunction __init_simd_flags( SIMDFlags::SIMDFlags() { unsigned int cpuInfo[4]; - + // CPUID: https://en.wikipedia.org/wiki/CPUID CPUID(cpuInfo, 0x00000001); simd_flags_ |= cpuInfo[3] & (1 << 25) ? SIMD_SSE : SIMD_NONE; simd_flags_ |= cpuInfo[3] & (1 << 26) ? SIMD_SSE2 : SIMD_NONE; diff --git a/paddle/utils/CpuId.h b/paddle/utils/CpuId.h index bb77d37712..59a917c857 100644 --- a/paddle/utils/CpuId.h +++ b/paddle/utils/CpuId.h @@ -61,7 +61,7 @@ private: #define HAS_SSE3 SIMDFlags::instance()->isSSE3() #define HAS_SSSE3 SIMDFlags::instance()->isSSSE3() #define HAS_SSE41 SIMDFlags::instance()->isSSE41() -#define HAS_SSS42 SIMDFlags::instance()->isSSE42() +#define HAS_SSE42 SIMDFlags::instance()->isSSE42() #define HAS_FMA3 SIMDFlags::instance()->isFMA3() #define HAS_FMA4 SIMDFlags::instance()->isFMA4() #define HAS_AVX SIMDFlags::instance()->isAVX() diff --git a/paddle/utils/tests/test_SIMDFlags.cpp b/paddle/utils/tests/test_SIMDFlags.cpp index 583a649b84..382d69a4a6 100644 --- a/paddle/utils/tests/test_SIMDFlags.cpp +++ b/paddle/utils/tests/test_SIMDFlags.cpp @@ -20,17 +20,14 @@ using namespace paddle; // NOLINT TEST(SIMDFlags, gccTest) { #if (defined(__GNUC__) || defined(__GNUG__)) && !(defined(__clang__)) - CHECK(__builtin_cpu_supports("sse") == HAS_SSE); - CHECK(__builtin_cpu_supports("sse2") == HAS_SSE2); - CHECK(__builtin_cpu_supports("sse3") == HAS_SSE3); - CHECK(__builtin_cpu_supports("ssse3")== HAS_SSSE3); + CHECK(__builtin_cpu_supports("sse") == HAS_SSE); + CHECK(__builtin_cpu_supports("sse2") == HAS_SSE2); + CHECK(__builtin_cpu_supports("sse3") == HAS_SSE3); + CHECK(__builtin_cpu_supports("ssse3") == HAS_SSSE3); CHECK(__builtin_cpu_supports("sse4.1")== HAS_SSE41); CHECK(__builtin_cpu_supports("sse4.2")== HAS_SSE42); - CHECK(__builtin_cpu_supports("fma3")== HAS_FMA3); - CHECK(__builtin_cpu_supports("fma4")== HAS_FMA4); - CHECK(__builtin_cpu_supports("avx")== HAS_AVX); - CHECK(__builtin_cpu_supports("avx2")== HAS_AVX2); - CHECK(__builtin_cpu_supports("avx512f")== HAS_AVX512); + CHECK(__builtin_cpu_supports("avx") == HAS_AVX); + CHECK(__builtin_cpu_supports("avx2") == HAS_AVX2); #endif } -- GitLab