Enable AVX support on Windows 7 SP-1 or later (and if supported by CPU).
This commit is contained in:
parent
9b8ededad0
commit
c104296683
@ -100,20 +100,16 @@ static QList<QRegExp> createRegExpList(const char *const *const regExpList)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* print selected CPU type*/
|
/* print selected CPU type*/
|
||||||
static inline void printCpuTypeFriendlyName(const unsigned int &cpuSupport)
|
#define _CPU_FRIENDLY_NAME(X,Y) case X: return #X " (" Y ")";
|
||||||
|
static inline const char *cpuTypeFriendlyName(const unsigned int &cpuSupport)
|
||||||
{
|
{
|
||||||
switch (cpuSupport)
|
switch (cpuSupport)
|
||||||
{
|
{
|
||||||
case CPU_TYPE_X86_GEN:
|
_CPU_FRIENDLY_NAME(CPU_TYPE_X86_GEN, "i686")
|
||||||
qDebug("Selected CPU type is: x86 (i686)"); break;
|
_CPU_FRIENDLY_NAME(CPU_TYPE_X86_SSE, "i686 + SSE2")
|
||||||
case CPU_TYPE_X86_SSE:
|
_CPU_FRIENDLY_NAME(CPU_TYPE_X86_AVX, "i686 + AVX2")
|
||||||
qDebug("Selected CPU type is: x86 + SSE2"); break;
|
_CPU_FRIENDLY_NAME(CPU_TYPE_X64_SSE, "x86_64")
|
||||||
case CPU_TYPE_X86_AVX:
|
_CPU_FRIENDLY_NAME(CPU_TYPE_X64_AVX, "x86_64 + AVX2")
|
||||||
qDebug("Selected CPU type is: x86 + AVX2"); break;
|
|
||||||
case CPU_TYPE_X64_SSE:
|
|
||||||
qDebug("Selected CPU type is: x64 + SSE2"); break;
|
|
||||||
case CPU_TYPE_X64_AVX:
|
|
||||||
qDebug("Selected CPU type is: x64 + AVX2"); break;
|
|
||||||
default:
|
default:
|
||||||
MUTILS_THROW("CPU support undefined!");
|
MUTILS_THROW("CPU support undefined!");
|
||||||
}
|
}
|
||||||
@ -383,10 +379,15 @@ double InitializationThread::doInit(const size_t threadCount)
|
|||||||
{
|
{
|
||||||
cpuSupport = m_cpuFeatures.x64 ? CPU_TYPE_X64_SSE : CPU_TYPE_X86_SSE;
|
cpuSupport = m_cpuFeatures.x64 ? CPU_TYPE_X64_SSE : CPU_TYPE_X86_SSE;
|
||||||
if ((m_cpuFeatures.features & MUtils::CPUFetaures::FLAG_AVX) && (m_cpuFeatures.features & MUtils::CPUFetaures::FLAG_AVX2))
|
if ((m_cpuFeatures.features & MUtils::CPUFetaures::FLAG_AVX) && (m_cpuFeatures.features & MUtils::CPUFetaures::FLAG_AVX2))
|
||||||
|
{
|
||||||
|
//Note: AVX is supported on Windows 7 SP1 or later
|
||||||
|
const MUtils::OS::Version::os_version_t &osVersion = MUtils::OS::os_version();
|
||||||
|
if ((osVersion >= MUtils::OS::Version::WINDOWS_WIN80) || ((osVersion >= MUtils::OS::Version::WINDOWS_WIN70) && (osVersion.versionSPack >= 1)))
|
||||||
{
|
{
|
||||||
cpuSupport = m_cpuFeatures.x64 ? CPU_TYPE_X64_AVX : CPU_TYPE_X86_AVX;
|
cpuSupport = m_cpuFeatures.x64 ? CPU_TYPE_X64_AVX : CPU_TYPE_X86_AVX;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//Hack to disable x64 on Wine, as x64 binaries won't run under Wine (tested with Wine 1.4 under Ubuntu 12.04 x64)
|
//Hack to disable x64 on Wine, as x64 binaries won't run under Wine (tested with Wine 1.4 under Ubuntu 12.04 x64)
|
||||||
if ((cpuSupport & CPU_TYPE_X64_SSX) && MUtils::OS::running_on_wine())
|
if ((cpuSupport & CPU_TYPE_X64_SSX) && MUtils::OS::running_on_wine())
|
||||||
@ -396,7 +397,7 @@ double InitializationThread::doInit(const size_t threadCount)
|
|||||||
}
|
}
|
||||||
|
|
||||||
//Print the selected CPU type
|
//Print the selected CPU type
|
||||||
printCpuTypeFriendlyName(cpuSupport);
|
qDebug("Selected CPU type is: %s", cpuTypeFriendlyName(cpuSupport));
|
||||||
|
|
||||||
//Allocate queues
|
//Allocate queues
|
||||||
QQueue<QString> queueToolName;
|
QQueue<QString> queueToolName;
|
||||||
@ -768,7 +769,7 @@ void InitializationThread::selfTest(void)
|
|||||||
{
|
{
|
||||||
const unsigned int cpuSupport = CPU[k];
|
const unsigned int cpuSupport = CPU[k];
|
||||||
qDebug("[SELF-TEST]");
|
qDebug("[SELF-TEST]");
|
||||||
printCpuTypeFriendlyName(cpuSupport);
|
qDebug("Testing CPU type: %s", cpuTypeFriendlyName(cpuSupport));
|
||||||
for (int i = 0; g_lamexp_tools[i].pcName || g_lamexp_tools[i].pcHash || g_lamexp_tools[i].uiVersion; ++i)
|
for (int i = 0; g_lamexp_tools[i].pcName || g_lamexp_tools[i].pcHash || g_lamexp_tools[i].uiVersion; ++i)
|
||||||
{
|
{
|
||||||
if (g_lamexp_tools[i].pcName && g_lamexp_tools[i].pcHash && g_lamexp_tools[i].uiVersion)
|
if (g_lamexp_tools[i].pcName && g_lamexp_tools[i].pcHash && g_lamexp_tools[i].uiVersion)
|
||||||
|
Loading…
Reference in New Issue
Block a user