diff --git a/paddle/utils/CpuId.cpp b/paddle/utils/CpuId.cpp index 734b2e09246a56358160f9d1d090e10266bee2fa..ae1fb40f04fe919f35f241bd9c7a8733fbe6de3e 100644 --- a/paddle/utils/CpuId.cpp +++ b/paddle/utils/CpuId.cpp @@ -14,6 +14,8 @@ limitations under the License. */ #ifdef _WIN32 +#include + /// for MSVC #define CPUID(info, x) __cpuidex(info, x, 0) @@ -49,7 +51,7 @@ SIMDFlags::SIMDFlags() { simd_flags_ |= cpuInfo[2] & (1 << 16) ? SIMD_FMA4 : SIMD_NONE; } -SIMDFlags* SIMDFlags::instance() { +const SIMDFlags* SIMDFlags::instance() { static SIMDFlags instance; return &instance; } diff --git a/paddle/utils/CpuId.h b/paddle/utils/CpuId.h index d15e58d1dddde3263826d22c0a26915a1f09ca71..19096332b62fc7854b56e5cd2afb57de708c53a0 100644 --- a/paddle/utils/CpuId.h +++ b/paddle/utils/CpuId.h @@ -11,7 +11,6 @@ limitations under the License. */ #pragma once -#include #include "DisableCopy.h" namespace paddle { @@ -22,7 +21,7 @@ public: SIMDFlags(); - static SIMDFlags* instance(); + static const SIMDFlags* instance(); inline bool isSSE() const { return simd_flags_ & SIMD_SSE; } inline bool isSSE2() const { return simd_flags_ & SIMD_SSE2; }