Skip to content

Port C# key hardware intrinsics APIs for SSE from SIMD native algorithms #562

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 43 commits into from
Aug 6, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
ff5ae22
Implemented SSE support and software fallbacks for key intrinsics
briancylui Jun 29, 2018
8fc9b18
Implemented unit tests for key intrinsics with passing results
briancylui Jun 29, 2018
8e8090d
Implemented performance tests on some key intrinsics with BenchmarkDo…
briancylui Jun 29, 2018
6b3660c
Fixed array pinning issues and solved unreported latency of NativeDotSU
briancylui Jun 30, 2018
aa5ee2a
Minor syntax change for style consistency in fixed statements
briancylui Jul 1, 2018
f096eb5
Implemented performance tests for all key intrinsics
briancylui Jul 1, 2018
40def43
Simulated user performance with large inputs
briancylui Jul 3, 2018
a8f2726
Allow CpuMath to reference C# Hardware Intrinsics APIs.
eerhardt Jul 10, 2018
9355547
Added files for the hierarchical framework to prepare for multi-targe…
briancylui Jul 11, 2018
e617f05
Removed the redundant CpuMathUtils.cs file.
briancylui Jul 12, 2018
94751d1
Cleaned up the primitive build constant for featuring intrinsics
briancylui Jul 17, 2018
7a55fcc
Created a new helper class holding C# implementations of SSE intrinsi…
briancylui Jul 17, 2018
f76a028
Minor change in naming of variables
briancylui Jul 18, 2018
b84047a
Implemented more SSE intrinsics
briancylui Jul 19, 2018
bdd41dd
Changed version number of .NET Core App as target framework
briancylui Jul 19, 2018
55dffa5
Cleaned up unit test file that needs to be split into two for multi-t…
briancylui Jul 19, 2018
a636173
Fixed seed in performance tests
briancylui Jul 19, 2018
27a042a
Cleaned up unreferenced namespaces
briancylui Jul 19, 2018
27e79a2
Split unit tests into two projects for multi-targetting
briancylui Jul 19, 2018
2d8f373
Cleaned up new intrinsics that are not yet tested to prepare for PR
briancylui Jul 19, 2018
6c3a3e7
Minor style changes
briancylui Jul 20, 2018
8f1ef4c
Added the solution package that includes multi-targeting with UseIntr…
briancylui Jul 20, 2018
cf1e0d0
Included all files in the CpuMath project for display in Visual Studi…
briancylui Jul 20, 2018
f0f81a5
Removed irrelevant build line from CpuMath
briancylui Jul 20, 2018
29ef073
Response to PR review
briancylui Jul 30, 2018
584bb45
Removed deprecated src\Native\CpuMath working folder
briancylui Jul 30, 2018
7d1f6d1
Removed unnecessary references in unit tests
briancylui Jul 30, 2018
4191c6b
Minor style changes
briancylui Jul 30, 2018
aa28480
Fixed SLN file
briancylui Jul 30, 2018
4e50945
Merge with dotnet/master
briancylui Jul 30, 2018
6ef42da
Fixed build error with netcoreapp3.0 not supported
briancylui Jul 30, 2018
ff83d66
Minor style fixes
briancylui Jul 31, 2018
2537f2d
Skip netcoreapp3.0 projects when not building for intrinsics
briancylui Jul 31, 2018
fa821aa
Merge with dotnet/master
briancylui Jul 31, 2018
c6f5f85
Exclude netcoreapp3.0 tests from running by overriding VSTest target
briancylui Jul 31, 2018
0a50f46
Second response to PR feedback
briancylui Jul 31, 2018
946d425
Removed NETCoreAppMaximumVersion tags with modification
briancylui Aug 1, 2018
f3ff9b4
Moved VSTest targets to Empty.targets, and parsed -Intrinsics configs…
briancylui Aug 2, 2018
f7f5fef
Modified VectorSum to fix perf results
briancylui Aug 3, 2018
5a42d5d
Modified VectorSum to comply with latest C# language updates
briancylui Aug 3, 2018
2d8fe26
Response to PR feedback: added a comment and removed unnecessary MSBu…
briancylui Aug 3, 2018
980db82
Made private functions for SSE intrinsics inline
briancylui Aug 3, 2018
3ff5c0b
Fix merge conflicts
briancylui Aug 3, 2018
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -114,4 +114,11 @@
<PublicSign Condition="'$(OS)' != 'Windows_NT'">true</PublicSign>
</PropertyGroup>

<PropertyGroup>
<UseIntrinsics Condition="'$(UseIntrinsics)' == ''">$(Configuration.EndsWith('-Intrinsics'))</UseIntrinsics>
</PropertyGroup>

<PropertyGroup>
<CustomAfterMicrosoftCommonTargets>$(RepoRoot)build\AfterCommonTargets.targets</CustomAfterMicrosoftCommonTargets>
</PropertyGroup>
</Project>
34 changes: 34 additions & 0 deletions Microsoft.ML.sln
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,13 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.ML.CodeAnalyzer",
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.ML.CodeAnalyzer.Tests", "test\Microsoft.ML.CodeAnalyzer.Tests\Microsoft.ML.CodeAnalyzer.Tests.csproj", "{3E4ABF07-7970-4BE6-B45B-A13D3C397545}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.ML.CpuMath.PerformanceTests", "test\Microsoft.ML.CpuMath.PerformanceTests\Microsoft.ML.CpuMath.PerformanceTests.csproj", "{7333EDEF-4144-405C-A5EC-6F42201857D8}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.ML.CpuMath.UnitTests.netstandard", "test\Microsoft.ML.CpuMath.UnitTests.netstandard\Microsoft.ML.CpuMath.UnitTests.netstandard.csproj", "{A0E562A9-0E6D-470D-B180-6EB44BA84D60}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.ML.CpuMath.UnitTests.netcoreapp", "test\Microsoft.ML.CpuMath.UnitTests.netcoreapp\Microsoft.ML.CpuMath.UnitTests.netcoreapp.csproj", "{5F81A2A4-73AD-494C-B387-07D605EC8826}"
EndProject

Project("{F2A71F9B-5D33-465A-A702-920D77279786}") = "Microsoft.ML.FSharp.Tests", "test\Microsoft.ML.FSharp.Tests\Microsoft.ML.FSharp.Tests.fsproj", "{802233D6-8CC0-46AD-9F23-FEE1E9AED9B3}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.ML.ImageAnalytics", "src\Microsoft.ML.ImageAnalytics\Microsoft.ML.ImageAnalytics.csproj", "{00E38F77-1E61-4CDF-8F97-1417D4E85053}"
Expand Down Expand Up @@ -335,6 +342,30 @@ Global
{3E4ABF07-7970-4BE6-B45B-A13D3C397545}.Release|Any CPU.Build.0 = Release|Any CPU
{3E4ABF07-7970-4BE6-B45B-A13D3C397545}.Release-Intrinsics|Any CPU.ActiveCfg = Release|Any CPU
{3E4ABF07-7970-4BE6-B45B-A13D3C397545}.Release-Intrinsics|Any CPU.Build.0 = Release|Any CPU
{7333EDEF-4144-405C-A5EC-6F42201857D8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{7333EDEF-4144-405C-A5EC-6F42201857D8}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7333EDEF-4144-405C-A5EC-6F42201857D8}.Debug-Intrinsics|Any CPU.ActiveCfg = Debug|Any CPU
{7333EDEF-4144-405C-A5EC-6F42201857D8}.Debug-Intrinsics|Any CPU.Build.0 = Debug|Any CPU
{7333EDEF-4144-405C-A5EC-6F42201857D8}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7333EDEF-4144-405C-A5EC-6F42201857D8}.Release|Any CPU.Build.0 = Release|Any CPU
{7333EDEF-4144-405C-A5EC-6F42201857D8}.Release-Intrinsics|Any CPU.ActiveCfg = Release|Any CPU
{7333EDEF-4144-405C-A5EC-6F42201857D8}.Release-Intrinsics|Any CPU.Build.0 = Release|Any CPU
{A0E562A9-0E6D-470D-B180-6EB44BA84D60}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A0E562A9-0E6D-470D-B180-6EB44BA84D60}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A0E562A9-0E6D-470D-B180-6EB44BA84D60}.Debug-Intrinsics|Any CPU.ActiveCfg = Debug|Any CPU
{A0E562A9-0E6D-470D-B180-6EB44BA84D60}.Debug-Intrinsics|Any CPU.Build.0 = Debug|Any CPU
{A0E562A9-0E6D-470D-B180-6EB44BA84D60}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A0E562A9-0E6D-470D-B180-6EB44BA84D60}.Release|Any CPU.Build.0 = Release|Any CPU
{A0E562A9-0E6D-470D-B180-6EB44BA84D60}.Release-Intrinsics|Any CPU.ActiveCfg = Release|Any CPU
{A0E562A9-0E6D-470D-B180-6EB44BA84D60}.Release-Intrinsics|Any CPU.Build.0 = Release|Any CPU
{5F81A2A4-73AD-494C-B387-07D605EC8826}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{5F81A2A4-73AD-494C-B387-07D605EC8826}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5F81A2A4-73AD-494C-B387-07D605EC8826}.Debug-Intrinsics|Any CPU.ActiveCfg = Debug|Any CPU
{5F81A2A4-73AD-494C-B387-07D605EC8826}.Debug-Intrinsics|Any CPU.Build.0 = Debug|Any CPU
{5F81A2A4-73AD-494C-B387-07D605EC8826}.Release|Any CPU.ActiveCfg = Release|Any CPU
{5F81A2A4-73AD-494C-B387-07D605EC8826}.Release|Any CPU.Build.0 = Release|Any CPU
{5F81A2A4-73AD-494C-B387-07D605EC8826}.Release-Intrinsics|Any CPU.ActiveCfg = Release|Any CPU
{5F81A2A4-73AD-494C-B387-07D605EC8826}.Release-Intrinsics|Any CPU.Build.0 = Release|Any CPU
{802233D6-8CC0-46AD-9F23-FEE1E9AED9B3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{802233D6-8CC0-46AD-9F23-FEE1E9AED9B3}.Debug|Any CPU.Build.0 = Debug|Any CPU
{802233D6-8CC0-46AD-9F23-FEE1E9AED9B3}.Debug-Intrinsics|Any CPU.ActiveCfg = Debug|Any CPU
Expand Down Expand Up @@ -395,6 +426,9 @@ Global
{001F3B4E-FBE4-4001-AFD2-A6A989CD1C25} = {09EADF06-BE25-4228-AB53-95AE3E15B530}
{DCF46B79-1FDB-4DBA-A263-D3D64E3AAA27} = {09EADF06-BE25-4228-AB53-95AE3E15B530}
{BF66A305-DF10-47E4-8D81-42049B149D2B} = {D3D38B03-B557-484D-8348-8BADEE4DF592}
{7333EDEF-4144-405C-A5EC-6F42201857D8} = {AED9C836-31E3-4F3F-8ABC-929555D3F3C4}
{A0E562A9-0E6D-470D-B180-6EB44BA84D60} = {AED9C836-31E3-4F3F-8ABC-929555D3F3C4}
{5F81A2A4-73AD-494C-B387-07D605EC8826} = {AED9C836-31E3-4F3F-8ABC-929555D3F3C4}
{B4E55B2D-2A92-46E7-B72F-E76D6FD83440} = {7F13E156-3EBA-4021-84A5-CD56BA72F99E}
{3E4ABF07-7970-4BE6-B45B-A13D3C397545} = {AED9C836-31E3-4F3F-8ABC-929555D3F3C4}
{802233D6-8CC0-46AD-9F23-FEE1E9AED9B3} = {AED9C836-31E3-4F3F-8ABC-929555D3F3C4}
Expand Down
3 changes: 2 additions & 1 deletion build.proj
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,8 @@
<Target Name="RestoreProjects" Condition="'$(RestoreDuringBuild)'=='true'">
<Message Importance="High" Text="Restoring all projects..." />
<MSBuild Projects="@(Project)"
Targets="Restore" />
Targets="Restore"
Properties="MSBuildWarningsAsMessages=NU1503" />
</Target>

<Target Name="BuildNative"
Expand Down
13 changes: 13 additions & 0 deletions build/AfterCommonTargets.targets
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<Project>
<PropertyGroup>
<MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects>
</PropertyGroup>

<!--
We use netcoreapp3.0 for C# intrinsics, but 3.0 isn't supported in CI or in normal development
environments yet. So when we are targeting netcoreapp3.0, but aren't building for intrinsics,
we need to skip the project.
-->
<Import Condition="'$(UseIntrinsics)' != 'true' and '$(TargetFramework)' == 'netcoreapp3.0'"
Project="$(RepoRoot)build\Empty.targets" />
</Project>
29 changes: 29 additions & 0 deletions build/Empty.targets
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<Project>
<PropertyGroup>
<MSBuildAllProjects>$(MSBuildAllProjects);$(MSBuildThisFileFullPath)</MSBuildAllProjects>
<!--
In the SDK ImportAfter folder, this property is declared to point to Microsoft.TestPlatform.targets, which is the file containing the original VSTest target.
Since the Microsoft.TestPlatform.targets are in the ImportAfter folder, they would be imported after this file hence our empty VSTest target would be overriden,
in order to be able to override this target, we set the VSTestTargets property to an inexistent file path, so nothing will be imported and that way we successfully
overrode the VSTest target.
-->
<VSTestTargets>ignore.targets</VSTestTargets>
</PropertyGroup>

<!--
Copied from https://github.com/dotnet/arcade/blob/master/src/Microsoft.DotNet.Arcade.Sdk/tools/Empty.targets

Import this file to suppress all targets while allowing the project to participate in the build.
Workaround for https://github.com/dotnet/sdk/issues/2071.

The targets defined here are not sufficient for the project to be open in Visual Studio without issues though.
-->

<Target Name="_IsProjectRestoreSupported"/>
<Target Name="_CheckForInvalidConfigurationAndPlatform"/>
<Target Name="Restore"/>
<Target Name="Build"/>
<Target Name="Test"/>
<Target Name="VSTest"/>
<Target Name="Pack"/>
</Project>
Loading