Skip to content

Commit

Permalink
Merge pull request #314 from evoskuil/master
Browse files Browse the repository at this point in the history
Update msvc system .props and import.props for intrinsics.
  • Loading branch information
evoskuil authored Apr 29, 2024
2 parents 5dab911 + a25bd2c commit b0b924a
Show file tree
Hide file tree
Showing 7 changed files with 113 additions and 34 deletions.
6 changes: 0 additions & 6 deletions props/version4/base/Release.props
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,6 @@
<IntrinsicFunctions>true</IntrinsicFunctions>
<OmitFramePointers>true</OmitFramePointers>
<Optimization>MaxSpeed</Optimization>

<!-- SSE4/AVX2 (also AVX512) -->
<!--TODO: these should be integrated with the HAVE build options.-->
<!--<EnableEnhancedInstructionSet>StreamingSIMDExtensions2</EnableEnhancedInstructionSet>-->
<EnableEnhancedInstructionSet>AdvancedVectorExtensions2</EnableEnhancedInstructionSet>

<!-- Other. -->
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
<StringPooling>true</StringPooling>
Expand Down
43 changes: 42 additions & 1 deletion props/version4/import/libbitcoin-system.import.props
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,36 @@
<ItemGroup Label="BuildOptionsExtension">
<PropertyPageSchema Include="$(MSBuildThisFileDirectory)libbitcoin-system.import.xml" />
</ItemGroup>

<!-- Options -->

<!-- These create non-portability. -->
<!-- These will compile to the target regardless of the compiling platform. -->
<!-- That will result in a crash of test/executable execution if mismatched. -->
<PropertyGroup>
<Option-avx512>false</Option-avx512>
<Option-avx2>true</Option-avx2>
<Option-sse41>true</Option-sse41>
<Option-shani>false</Option-shani>
<Option-neon>false</Option-neon>
</PropertyGroup>
<ItemDefinitionGroup>
<ClCompile>
<!-- order matters -->
<EnableEnhancedInstructionSet Condition="'$(Option-avx2)' == 'true'">AdvancedVectorExtensions2</EnableEnhancedInstructionSet>
<EnableEnhancedInstructionSet Condition="'$(Option-avx512)' == 'true'">AdvancedVectorExtensions512</EnableEnhancedInstructionSet>
</ClCompile>
</ItemDefinitionGroup>

<!-- Messages -->

<Target Name="OptionInfo" BeforeTargets="PrepareForBuild">
<Message Text="Option-avx512 : $(Option-avx512)" Importance="high"/>
<Message Text="Option-avx2 : $(Option-avx2)" Importance="high"/>
<Message Text="Option-sse41 : $(Option-sse41)" Importance="high"/>
<Message Text="Option-shani : $(Option-shani)" Importance="high"/>
<Message Text="Option-neon : $(Option-neon)" Importance="high"/>
</Target>

<!-- Linkage -->

Expand All @@ -18,11 +48,22 @@
<AdditionalIncludeDirectories>$(ProjectDir)..\..\..\..\..\libbitcoin-system\include\;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<!-- WITH_ICU always defined in Visual Studio builds. -->
<!-- NOMINMAX enables use of std::min/max without conflict. -->
<!-- BOOST_EXCEPTION_DISABLE must be set here to be captured by all includes. -->
<!-- WIN32_LEAN_AND_MEAN avoids inclusion of certain headers, winsock.h conflicts with boost and protocol use of winsock2.h. -->
<PreprocessorDefinitions>WITH_ICU;WIN32_LEAN_AND_MEAN;NOMINMAX;_WIN32_WINNT=0x0600;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions Condition="'$(Linkage-libbitcoin-system)' == 'static' Or '$(Linkage-libbitcoin-system)' == 'ltcg'">BC_STATIC;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<ClCompile>
<!-- Enable use of CPU intrinsics. -->
<PreprocessorDefinitions Condition="'$(Option-avx512)' == 'true'">WITH_AVX512;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions Condition="'$(Option-avx2)' == 'true'">WITH_AVX2;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions Condition="'$(Option-sse41)' == 'true'">WITH_SSE41;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions Condition="'$(Option-shani)' == 'true'">WITH_SHANI;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions Condition="'$(Option-neon)' == 'true'">WITH_NEON;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<Link>
<!-- 4099: warns about missing PDB files. -->
<AdditionalOptions>/ignore:4099 %(AdditionalOptions)</AdditionalOptions>
</Link>
<Link>
<AdditionalDependencies Condition="'$(Linkage-libbitcoin-system)' != ''">libbitcoin-system.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
Expand Down
32 changes: 32 additions & 0 deletions props/version4/import/libbitcoin-system.import.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,36 @@
<EnumValue Name="ltcg" DisplayName="Static using link time compile generation (LTCG)" />
</EnumProperty>
</Rule>
<Rule Name="libbitcoin-system-options-uiextension" PageTemplate="tool" DisplayName="Bitcoin System Options" SwitchPrefix="/" Order="1">
<Rule.Categories>
<Category Name="avx512" DisplayName="avx512" />
<Category Name="avx2" DisplayName="avx2" />
<Category Name="sse41" DisplayName="sse41" />
<Category Name="shani" DisplayName="shani" />
<Category Name="neon" DisplayName="neon" />
</Rule.Categories>
<Rule.DataSource>
<DataSource Persistence="ProjectFile" ItemType="" />
</Rule.DataSource>
<EnumProperty Name="Option-avx512" DisplayName="Enable AVX512 Intrinsics" Description="Use AVX512 intrinsics." Category="avx512">
<EnumValue Name="false" DisplayName="No" />
<EnumValue Name="true" DisplayName="Yes" />
</EnumProperty>
<EnumProperty Name="Option-avx2" DisplayName="Enable AVX2 Intrinsics" Description="Use AVX2 intrinsics." Category="avx2">
<EnumValue Name="false" DisplayName="No" />
<EnumValue Name="true" DisplayName="Yes" />
</EnumProperty>
<EnumProperty Name="Option-sse41" DisplayName="Enable SSE4.1 Intrinsics" Description="Use SSE4.1 intrinsics." Category="sse41">
<EnumValue Name="false" DisplayName="No" />
<EnumValue Name="true" DisplayName="Yes" />
</EnumProperty>
<EnumProperty Name="Option-shani" DisplayName="Enable SHA Native Intrinsics" Description="Use SHA native intrinsics." Category="shani">
<EnumValue Name="false" DisplayName="No" />
<EnumValue Name="true" DisplayName="Yes" />
</EnumProperty>
<EnumProperty Name="Option-neon" DisplayName="Enable ARM Neon Intrinsics" Description="Use ARM Neon intrinsics." Category="neon">
<EnumValue Name="false" DisplayName="No" />
<EnumValue Name="true" DisplayName="Yes" />
</EnumProperty>
</Rule>
</ProjectSchemaDefinitions>
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
<!--<Optimization>Disabled</Optimization>-->
<DisableSpecificWarnings>%(DisableSpecificWarnings)</DisableSpecificWarnings>
<EnablePREfast>false</EnablePREfast>
<PreprocessorDefinitions Condition="'$(Option-datagen)' == 'true'">ENABLE_DATAGEN;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions Condition="'$(DefaultLinkage)' == 'dynamic'">BOOST_TEST_DYN_LINK;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
<PostBuildEvent Condition="'$(DebugOrRelease)' == 'release'">
Expand Down Expand Up @@ -57,7 +56,6 @@
<Target Name="LinkageInfo" BeforeTargets="PrepareForBuild">
<Message Text="Linkage-secp256k1 : $(Linkage-secp256k1)" Importance="high"/>
<Message Text="Linkage-_system : $(Linkage-libbitcoin-system)" Importance="high"/>
<!--<Message Text="Linkage-openssl : $(Linkage-openssl)" Importance="high" Condition="'$(Option-datagen)' == 'true'"/>-->
</Target>

</Project>
Original file line number Diff line number Diff line change
@@ -1,15 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<ProjectSchemaDefinitions xmlns="clr-namespace:Microsoft.Build.Framework.XamlTypes;assembly=Microsoft.Build.Framework">
<Rule Name="libbitcoin-system-test-uiextension" PageTemplate="tool" DisplayName="Bitcoin System Test Options" SwitchPrefix="/" Order="1">
<Rule.Categories>
<Category Name="datagen" DisplayName="datagen" />
</Rule.Categories>
<Rule.DataSource>
<DataSource Persistence="ProjectFile" ItemType="" />
</Rule.DataSource>
<EnumProperty Name="Option-datagen" DisplayName="Enable Test Data Generation" Description="Enable the Test Data Generation build option" Category="datagen">
<EnumValue Name="" DisplayName="No" />
<EnumValue Name="true" DisplayName="Yes" />
</EnumProperty>
</Rule>
</ProjectSchemaDefinitions>
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,16 @@
<EnablePREfast>false</EnablePREfast>
<!-- WITH_ICU always defined in Visual Studio builds. -->
<!-- NOMINMAX enables use of std::min/max without conflict. -->
<!-- BOOST_EXCEPTION_DISABLE must be set here to be captured by all includes. -->
<!-- WIN32_LEAN_AND_MEAN avoids inclusion of certain headers, winsock.h conflicts with boost and protocol use of winsock2.h. -->
<PreprocessorDefinitions>WITH_ICU;WIN32_LEAN_AND_MEAN;NOMINMAX;_WIN32_WINNT=0x0600;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions Condition="'$(ConfigurationType)' == 'DynamicLibrary'">BC_DLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions Condition="'$(ConfigurationType)' == 'StaticLibrary'">BC_STATIC;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<!-- Enable use of CPU intrinsics. -->
<PreprocessorDefinitions Condition="'$(Option-avx2)' == 'true'">WITH_AVX2;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions Condition="'$(Option-sse41)' == 'true'">WITH_SSE41;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions Condition="'$(Option-shani)' == 'true'">WITH_SHANI;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions Condition="'$(Option-sse4)' == 'true'">WITH_SSE4;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions Condition="'$(Option-neon)' == 'true'">WITH_NEON;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions Condition="'$(Option-avx512)' == 'true'">WITH_AVX512;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions Condition="'$(Option-avx2)' == 'true'">WITH_AVX2;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions Condition="'$(Option-sse41)' == 'true'">WITH_SSE41;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions Condition="'$(Option-shani)' == 'true'">WITH_SHANI;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions Condition="'$(Option-neon)' == 'true'">WITH_NEON;%(PreprocessorDefinitions)</PreprocessorDefinitions>
</ClCompile>
</ItemDefinitionGroup>

Expand All @@ -50,10 +49,35 @@
<PropertyGroup Condition="'$(DefaultLinkage)' == 'static'">
<Linkage-secp256k1>static</Linkage-secp256k1>
</PropertyGroup>

<!-- Options -->

<!-- These create non-portability. -->
<!-- These will compile to the target regardless of the compiling platform. -->
<!-- That will result in a crash of test/executable execution if mismatched. -->
<PropertyGroup>
<Option-avx512>false</Option-avx512>
<Option-avx2>true</Option-avx2>
<Option-sse41>true</Option-sse41>
<Option-shani>false</Option-shani>
<Option-neon>false</Option-neon>
</PropertyGroup>
<ItemDefinitionGroup>
<ClCompile>
<!-- order matters -->
<EnableEnhancedInstructionSet Condition="'$(Option-avx2)' == 'true'">AdvancedVectorExtensions2</EnableEnhancedInstructionSet>
<EnableEnhancedInstructionSet Condition="'$(Option-avx512)' == 'true'">AdvancedVectorExtensions512</EnableEnhancedInstructionSet>
</ClCompile>
</ItemDefinitionGroup>

<!-- Messages -->

<Target Name="OptionInfo" BeforeTargets="PrepareForBuild">
<Message Text="Option-avx512 : $(Option-avx512)" Importance="high"/>
<Message Text="Option-avx2 : $(Option-avx2)" Importance="high"/>
<Message Text="Option-sse41 : $(Option-sse41)" Importance="high"/>
<Message Text="Option-shani : $(Option-shani)" Importance="high"/>
<Message Text="Option-neon : $(Option-neon)" Importance="high"/>
</Target>

<Target Name="LinkageInfo" BeforeTargets="PrepareForBuild">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,33 +2,33 @@
<ProjectSchemaDefinitions xmlns="clr-namespace:Microsoft.Build.Framework.XamlTypes;assembly=Microsoft.Build.Framework">
<Rule Name="libbitcoin-system-uiextension" PageTemplate="tool" DisplayName="Bitcoin System Options" SwitchPrefix="/" Order="1">
<Rule.Categories>
<Category Name="avx512" DisplayName="avx512" />
<Category Name="avx2" DisplayName="avx2" />
<Category Name="sse41" DisplayName="sse41" />
<Category Name="shani" DisplayName="shani" />
<Category Name="sse4" DisplayName="sse4" />
<Category Name="neon" DisplayName="neon" />
</Rule.Categories>
<Rule.DataSource>
<DataSource Persistence="ProjectFile" ItemType="" />
</Rule.DataSource>
<EnumProperty Name="Option-avx512" DisplayName="Enable AVX512 Intrinsics" Description="Use AVX512 intrinsics." Category="avx512">
<EnumValue Name="false" DisplayName="No" />
<EnumValue Name="true" DisplayName="Yes" />
</EnumProperty>
<EnumProperty Name="Option-avx2" DisplayName="Enable AVX2 Intrinsics" Description="Use AVX2 intrinsics." Category="avx2">
<EnumValue Name="" DisplayName="No" />
<EnumValue Name="false" DisplayName="No" />
<EnumValue Name="true" DisplayName="Yes" />
</EnumProperty>
<EnumProperty Name="Option-sse41" DisplayName="Enable SSE4.1 Intrinsics" Description="Use SSE4.1 intrinsics." Category="sse41">
<EnumValue Name="" DisplayName="No" />
<EnumValue Name="false" DisplayName="No" />
<EnumValue Name="true" DisplayName="Yes" />
</EnumProperty>
<EnumProperty Name="Option-shani" DisplayName="Enable SHA Native Intrinsics" Description="Use SHA native intrinsics." Category="shani">
<EnumValue Name="" DisplayName="No" />
<EnumValue Name="false" DisplayName="No" />
<EnumValue Name="true" DisplayName="Yes" />
</EnumProperty>
<EnumProperty Name="Option-neon" DisplayName="Enable ARM Neon Intrinsics" Description="Use ARM Neon intrinsics." Category="neon">
<EnumValue Name="" DisplayName="No" />
<EnumValue Name="true" DisplayName="Yes" />
</EnumProperty>
<EnumProperty Name="Option-sse4" DisplayName="Enable SSE4" Description="Use SSE4 intrinsics." Category="sse4">
<EnumValue Name="" DisplayName="No" />
<EnumValue Name="false" DisplayName="No" />
<EnumValue Name="true" DisplayName="Yes" />
</EnumProperty>
</Rule>
Expand Down

0 comments on commit b0b924a

Please sign in to comment.