Enable the GUI to use the "AVX2" binary, if supported on the current machine.
This commit is contained in:
parent
86b4f64f86
commit
e78b144413
@ -1,7 +1,7 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio Version 16
|
||||
VisualStudioVersion = 16.0.30523.141
|
||||
# Visual Studio 15
|
||||
VisualStudioVersion = 15.0.28307.1913
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SlunkCrypt", "frontend\SlunkCrypt.vcxproj", "{86D28793-713E-4CEC-9686-335514AC5EF0}"
|
||||
EndProject
|
||||
@ -34,6 +34,7 @@ Global
|
||||
{86D28793-713E-4CEC-9686-335514AC5EF0}.Release_DLL|x86.ActiveCfg = Release_DLL|Win32
|
||||
{86D28793-713E-4CEC-9686-335514AC5EF0}.Release_DLL|x86.Build.0 = Release_DLL|Win32
|
||||
{86D28793-713E-4CEC-9686-335514AC5EF0}.Release_SSE2|x64.ActiveCfg = Release_SSE2|x64
|
||||
{86D28793-713E-4CEC-9686-335514AC5EF0}.Release_SSE2|x64.Build.0 = Release_SSE2|x64
|
||||
{86D28793-713E-4CEC-9686-335514AC5EF0}.Release_SSE2|x86.ActiveCfg = Release_SSE2|Win32
|
||||
{86D28793-713E-4CEC-9686-335514AC5EF0}.Release_SSE2|x86.Build.0 = Release_SSE2|Win32
|
||||
{86D28793-713E-4CEC-9686-335514AC5EF0}.Release|x64.ActiveCfg = Release|x64
|
||||
@ -49,6 +50,7 @@ Global
|
||||
{A4A3879C-BD2C-4304-AF66-7349CEF7E4C0}.Release_DLL|x86.ActiveCfg = Release_DLL|Win32
|
||||
{A4A3879C-BD2C-4304-AF66-7349CEF7E4C0}.Release_DLL|x86.Build.0 = Release_DLL|Win32
|
||||
{A4A3879C-BD2C-4304-AF66-7349CEF7E4C0}.Release_SSE2|x64.ActiveCfg = Release_SSE2|x64
|
||||
{A4A3879C-BD2C-4304-AF66-7349CEF7E4C0}.Release_SSE2|x64.Build.0 = Release_SSE2|x64
|
||||
{A4A3879C-BD2C-4304-AF66-7349CEF7E4C0}.Release_SSE2|x86.ActiveCfg = Release_SSE2|Win32
|
||||
{A4A3879C-BD2C-4304-AF66-7349CEF7E4C0}.Release_SSE2|x86.Build.0 = Release_SSE2|Win32
|
||||
{A4A3879C-BD2C-4304-AF66-7349CEF7E4C0}.Release|x64.ActiveCfg = Release|x64
|
||||
|
@ -203,7 +203,7 @@
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
<OutDir>$(SolutionDir)bin\static\</OutDir>
|
||||
<IntDir>$(SolutionDir)obj\$(Configuration)\$(PlatformShortName)\$(ProjectName)\</IntDir>
|
||||
<TargetName>slunkcrypt-cli-x64-sse2</TargetName>
|
||||
<TargetName>slunkcrypt-cli-avx2</TargetName>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release_DLL|x64'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
@ -389,7 +389,7 @@
|
||||
<FloatingPointModel>Fast</FloatingPointModel>
|
||||
<DisableSpecificWarnings>4706;4204</DisableSpecificWarnings>
|
||||
<CreateHotpatchableImage>false</CreateHotpatchableImage>
|
||||
<EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet>
|
||||
<EnableEnhancedInstructionSet>AdvancedVectorExtensions2</EnableEnhancedInstructionSet>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>Console</SubSystem>
|
||||
|
@ -35,17 +35,25 @@ namespace com.muldersoft.slunkcrypt.gui.process
|
||||
FileStream executableFile = null;
|
||||
string appBaseDirectory = AppDomain.CurrentDomain.BaseDirectory;
|
||||
CPUFeatures cpuFeatures = CPUFeatures.Features;
|
||||
if (cpuFeatures.x64 && CheckExecutableFile(ref executableFile, appBaseDirectory, "x64"))
|
||||
if (cpuFeatures.x64)
|
||||
{
|
||||
if (cpuFeatures.hasAVX2 && CheckExecutableFile(ref executableFile, appBaseDirectory, "avx2"))
|
||||
{
|
||||
Trace.Assert(executableFile != null);
|
||||
return executableFile;
|
||||
}
|
||||
if (cpuFeatures.sse2 && CheckExecutableFile(ref executableFile, appBaseDirectory, "sse2"))
|
||||
else if (CheckExecutableFile(ref executableFile, appBaseDirectory, "x64"))
|
||||
{
|
||||
Trace.Assert(executableFile != null);
|
||||
return executableFile;
|
||||
}
|
||||
if (CheckExecutableFile(ref executableFile, appBaseDirectory, "i686"))
|
||||
}
|
||||
if (cpuFeatures.hasSSE2 && CheckExecutableFile(ref executableFile, appBaseDirectory, "sse2"))
|
||||
{
|
||||
Trace.Assert(executableFile != null);
|
||||
return executableFile;
|
||||
}
|
||||
else if (CheckExecutableFile(ref executableFile, appBaseDirectory, "i686"))
|
||||
{
|
||||
Trace.Assert(executableFile != null);
|
||||
return executableFile;
|
||||
|
@ -860,7 +860,7 @@ namespace com.muldersoft.slunkcrypt.gui
|
||||
.AppendLine(Environment.OSVersion.VersionString)
|
||||
.AppendLine(string.Format("Operating System Bitness: {0:D}, Process Bitness: {1:D}", Environment.Is64BitOperatingSystem ? 64 : 32, Environment.Is64BitProcess ? 64 : 32))
|
||||
.AppendLine(".NET Runtime Version: " + Environment.Version)
|
||||
.AppendLine(string.Format("CPU Count: {0:D}, Architecture: {1}, SSE2 Support: {2}", Environment.ProcessorCount, cpuFeatures.x64 ? "x64" : "x86", cpuFeatures.sse2 ? "Yes" : "No"))
|
||||
.AppendLine(string.Format("CPU Count: {0:D}, Architecture: {1}, SSE2: {2}, AVX2: {3}", Environment.ProcessorCount, cpuFeatures.x64 ? "x64" : "x86", cpuFeatures.hasSSE2 ? "Yes" : "No", cpuFeatures.hasAVX2 ? "Yes" : "No"))
|
||||
.AppendLine()
|
||||
.AppendLine("Using “Silk” icons, by Mark James")
|
||||
.ToString();
|
||||
|
@ -11,7 +11,8 @@ namespace com.muldersoft.slunkcrypt.gui.process
|
||||
struct CPUFeatures
|
||||
{
|
||||
public readonly bool x64;
|
||||
public readonly bool sse2;
|
||||
public readonly bool hasSSE2;
|
||||
public readonly bool hasAVX2;
|
||||
|
||||
private static readonly Lazy<CPUFeatures> cpuFeatures = new Lazy<CPUFeatures>(DetectFeatures);
|
||||
|
||||
@ -20,21 +21,25 @@ namespace com.muldersoft.slunkcrypt.gui.process
|
||||
get { return cpuFeatures.Value; }
|
||||
}
|
||||
|
||||
public CPUFeatures(bool x64, bool sse2)
|
||||
public CPUFeatures(bool x64, bool sse2, bool avx2)
|
||||
{
|
||||
this.x64 = x64;
|
||||
this.sse2 = sse2;
|
||||
this.hasSSE2 = sse2;
|
||||
this.hasAVX2 = avx2;
|
||||
}
|
||||
|
||||
private static CPUFeatures DetectFeatures()
|
||||
{
|
||||
try
|
||||
{
|
||||
return new CPUFeatures(CPU.Architecture.Equals(CPUArchitecture.CPU_ARCH_X64), CPU.Capabilities.HasFlag(CPUCapabilities.CPU_SSE2));
|
||||
return new CPUFeatures(
|
||||
CPU.Architecture.Equals(CPUArchitecture.CPU_ARCH_X64),
|
||||
CPU.Capabilities.HasFlag(CPUCapabilities.CPU_SSE2),
|
||||
CPU.Capabilities.HasFlag(CPUCapabilities.CPU_AVX2));
|
||||
}
|
||||
catch
|
||||
{
|
||||
return new CPUFeatures(false, false); /*fallback*/
|
||||
return new CPUFeatures(false, false, false); /*fallback*/
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -188,7 +188,7 @@
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
<OutDir>$(SolutionDir)bin\static\</OutDir>
|
||||
<IntDir>$(SolutionDir)obj\$(Configuration)\$(PlatformShortName)\$(ProjectName)\</IntDir>
|
||||
<TargetName>libslunkcrypt-1-x64-sse2</TargetName>
|
||||
<TargetName>libslunkcrypt-1-avx2</TargetName>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release_DLL|x64'">
|
||||
<LinkIncremental>false</LinkIncremental>
|
||||
@ -382,7 +382,7 @@
|
||||
<FloatingPointModel>Fast</FloatingPointModel>
|
||||
<DisableSpecificWarnings>4706;4204</DisableSpecificWarnings>
|
||||
<CreateHotpatchableImage>false</CreateHotpatchableImage>
|
||||
<EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet>
|
||||
<EnableEnhancedInstructionSet>AdvancedVectorExtensions2</EnableEnhancedInstructionSet>
|
||||
</ClCompile>
|
||||
<Link>
|
||||
<SubSystem>
|
||||
|
@ -15,7 +15,6 @@ if not exist "%MSVC_PATH%\Auxiliary\Build\vcvarsall.bat" (
|
||||
for %%p in (x86,x64) do (
|
||||
call "%MSVC_PATH%\Auxiliary\Build\vcvarsall.bat" %%p
|
||||
for %%c in (Release,Release_SSE2) do (
|
||||
if not "%%p::%%c" == "x64::Release_SSE2" (
|
||||
%ECHO% white "\n------------------------------------------------------------------------------"
|
||||
%ECHO% white "Clean [%%p:%%c]"
|
||||
%ECHO% white "------------------------------------------------------------------------------\n"
|
||||
@ -28,7 +27,6 @@ for %%p in (x86,x64) do (
|
||||
if not "!ERRORLEVEL!"=="0" goto:BuildFailed
|
||||
)
|
||||
)
|
||||
)
|
||||
|
||||
%ECHO% green "\nBuild completed successfully.\n"
|
||||
pause
|
||||
|
Loading…
Reference in New Issue
Block a user