Skip to content

Commit

Permalink
Build MicrosoftMLRunner for using WinML nuget and make WinMLRunner on…
Browse files Browse the repository at this point in the history
…ly load from System32 (#348)

* move some headers around

* add nuget

* Refactor bindingutilities and outputhelper into .cpp and header files

* remove dllload.cpp

* Remove windows.ai.machinelearning header

* Fix testing

* Don't change sln

* Fix x86 build

* Added different configurations

* Add preprocessor definitions to separate between headers and namespaces

* Change naming of EXE for nuget builds

* Update OutputHelper.cpp

remove pragma in outputhelper.cpp

* remove pragma from cpp

* Switch between native header and update documentation

* use const cast

* rename nuget to NuGet and address PR comments

Co-authored-by: Ryan Lai <ryalai96@gamil.com>
  • Loading branch information
Ryan Lai and Ryan Lai committed Sep 9, 2020
1 parent 640a30b commit 7f9e191
Show file tree
Hide file tree
Showing 25 changed files with 3,223 additions and 2,824 deletions.
106 changes: 53 additions & 53 deletions Testing/WinMLRunnerTest/WinMLRunnerTest.cpp

Large diffs are not rendered by default.

354 changes: 354 additions & 0 deletions Testing/WinMLRunnerTest/WinMLRunnerTest.vcxproj

Large diffs are not rendered by default.

7 changes: 3 additions & 4 deletions Tools/WinMLRunner/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,9 @@ Run a model on the CPU and GPU separately, and by binding the input to the CPU a
Run a model on the CPU with the input bound to the GPU and loaded as an RGB image:
> WinMLRunner.exe -model c:\\data\\SqueezeNet.onnx -CPU -GPUBoundInput -RGB
## Using Microsoft.AI.Machinelearning NuGet
WinMLRunner can be built to use WinML's NuGet package : Microsoft.AI.Machinelearning NuGet. Simply build with the target configuration "Debug_NuGet" or "Release_NuGet". MicrosoftMLRunner.exe will be created and will use ```Microsoft.AI.MachineLearning.dll``` in the immediate directory of the executuble instead of loading ```Windows.AI.MachineLearning.dll``` from System32. MicrosoftMLRunner is useful to compare performance with an older version or testing a newer version of WinML's NuGet. For more information, please reference [Microsoft.AI.MachineLearning NuGet page](https://www.nuget.org/packages/Microsoft.AI.MachineLearning).

## Default output

**Running a good model:**
Expand Down Expand Up @@ -286,10 +289,6 @@ tracerpt.exe winmllog.etl -o logdump.csv -of CSV
2. Windows Performance Analyzer (from Visual Studio)
* Launch Windows Performance Analyzer and open the winmllog.etl.

## Dynamic DLL Loading

If you want to run WinMLRunner with another version of WinML (e.g. comparing the performance with an older version or testing a newer version), simply place the `windows.ai.machinelearning.dll` and `directml.dll` files in the same folder as WinMLRunner.exe. WinMLRunner will look for for these DLLs first and fall back to `C:/Windows/System32` if it doesn't find them.

## Known issues

- Sequence/Map inputs are not supported yet (the model is just skipped, so it doesn't block other models in a folder);
Expand Down
124 changes: 72 additions & 52 deletions Tools/WinMLRunner/WinMLRunner.sln
Original file line number Diff line number Diff line change
Expand Up @@ -17,60 +17,80 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "WinMLRunnerScenarios", "Win
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|ARM64 = Debug|ARM64
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|ARM64 = Release|ARM64
Release|x64 = Release|x64
Release|x86 = Release|x86
Debug_Inbox|x64 = Debug_Inbox|x64
Debug_Inbox|x86 = Debug_Inbox|x86
Debug_NuGet|x64 = Debug_NuGet|x64
Debug_NuGet|x86 = Debug_NuGet|x86
Release_Inbox|x64 = Release_Inbox|x64
Release_Inbox|x86 = Release_Inbox|x86
Release_NuGet|x64 = Release_NuGet|x64
Release_NuGet|x86 = Release_NuGet|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{E9D4AC92-8295-4FB4-BF7D-3FAF74B564E8}.Debug|ARM64.ActiveCfg = Debug|Win32
{E9D4AC92-8295-4FB4-BF7D-3FAF74B564E8}.Debug|x64.ActiveCfg = Debug|x64
{E9D4AC92-8295-4FB4-BF7D-3FAF74B564E8}.Debug|x64.Build.0 = Debug|x64
{E9D4AC92-8295-4FB4-BF7D-3FAF74B564E8}.Debug|x86.ActiveCfg = Debug|Win32
{E9D4AC92-8295-4FB4-BF7D-3FAF74B564E8}.Debug|x86.Build.0 = Debug|Win32
{E9D4AC92-8295-4FB4-BF7D-3FAF74B564E8}.Release|ARM64.ActiveCfg = Release|Win32
{E9D4AC92-8295-4FB4-BF7D-3FAF74B564E8}.Release|x64.ActiveCfg = Release|x64
{E9D4AC92-8295-4FB4-BF7D-3FAF74B564E8}.Release|x64.Build.0 = Release|x64
{E9D4AC92-8295-4FB4-BF7D-3FAF74B564E8}.Release|x86.ActiveCfg = Release|Win32
{E9D4AC92-8295-4FB4-BF7D-3FAF74B564E8}.Release|x86.Build.0 = Release|Win32
{31653A2F-02CC-4A95-9880-BF86965FB262}.Debug|ARM64.ActiveCfg = Debug|ARM64
{31653A2F-02CC-4A95-9880-BF86965FB262}.Debug|ARM64.Build.0 = Debug|ARM64
{31653A2F-02CC-4A95-9880-BF86965FB262}.Debug|x64.ActiveCfg = Debug|x64
{31653A2F-02CC-4A95-9880-BF86965FB262}.Debug|x64.Build.0 = Debug|x64
{31653A2F-02CC-4A95-9880-BF86965FB262}.Debug|x86.ActiveCfg = Debug|Win32
{31653A2F-02CC-4A95-9880-BF86965FB262}.Debug|x86.Build.0 = Debug|Win32
{31653A2F-02CC-4A95-9880-BF86965FB262}.Release|ARM64.ActiveCfg = Release|ARM64
{31653A2F-02CC-4A95-9880-BF86965FB262}.Release|ARM64.Build.0 = Release|ARM64
{31653A2F-02CC-4A95-9880-BF86965FB262}.Release|x64.ActiveCfg = Release|x64
{31653A2F-02CC-4A95-9880-BF86965FB262}.Release|x64.Build.0 = Release|x64
{31653A2F-02CC-4A95-9880-BF86965FB262}.Release|x86.ActiveCfg = Release|Win32
{31653A2F-02CC-4A95-9880-BF86965FB262}.Release|x86.Build.0 = Release|Win32
{C3BCBEA1-90E6-426F-88AC-64C274BCEF45}.Debug|ARM64.ActiveCfg = Debug|ARM64
{C3BCBEA1-90E6-426F-88AC-64C274BCEF45}.Debug|ARM64.Build.0 = Debug|ARM64
{C3BCBEA1-90E6-426F-88AC-64C274BCEF45}.Debug|x64.ActiveCfg = Debug|x64
{C3BCBEA1-90E6-426F-88AC-64C274BCEF45}.Debug|x64.Build.0 = Debug|x64
{C3BCBEA1-90E6-426F-88AC-64C274BCEF45}.Debug|x86.ActiveCfg = Debug|Win32
{C3BCBEA1-90E6-426F-88AC-64C274BCEF45}.Debug|x86.Build.0 = Debug|Win32
{C3BCBEA1-90E6-426F-88AC-64C274BCEF45}.Release|ARM64.ActiveCfg = Release|ARM64
{C3BCBEA1-90E6-426F-88AC-64C274BCEF45}.Release|ARM64.Build.0 = Release|ARM64
{C3BCBEA1-90E6-426F-88AC-64C274BCEF45}.Release|x64.ActiveCfg = Release|x64
{C3BCBEA1-90E6-426F-88AC-64C274BCEF45}.Release|x64.Build.0 = Release|x64
{C3BCBEA1-90E6-426F-88AC-64C274BCEF45}.Release|x86.ActiveCfg = Release|Win32
{C3BCBEA1-90E6-426F-88AC-64C274BCEF45}.Release|x86.Build.0 = Release|Win32
{C174D45D-C189-475B-B1A7-494939EE7491}.Debug|ARM64.ActiveCfg = Debug|ARM64
{C174D45D-C189-475B-B1A7-494939EE7491}.Debug|ARM64.Build.0 = Debug|ARM64
{C174D45D-C189-475B-B1A7-494939EE7491}.Debug|x64.ActiveCfg = Debug|x64
{C174D45D-C189-475B-B1A7-494939EE7491}.Debug|x64.Build.0 = Debug|x64
{C174D45D-C189-475B-B1A7-494939EE7491}.Debug|x86.ActiveCfg = Debug|Win32
{C174D45D-C189-475B-B1A7-494939EE7491}.Debug|x86.Build.0 = Debug|Win32
{C174D45D-C189-475B-B1A7-494939EE7491}.Release|ARM64.ActiveCfg = Release|ARM64
{C174D45D-C189-475B-B1A7-494939EE7491}.Release|ARM64.Build.0 = Release|ARM64
{C174D45D-C189-475B-B1A7-494939EE7491}.Release|x64.ActiveCfg = Release|x64
{C174D45D-C189-475B-B1A7-494939EE7491}.Release|x64.Build.0 = Release|x64
{C174D45D-C189-475B-B1A7-494939EE7491}.Release|x86.ActiveCfg = Release|Win32
{C174D45D-C189-475B-B1A7-494939EE7491}.Release|x86.Build.0 = Release|Win32
{E9D4AC92-8295-4FB4-BF7D-3FAF74B564E8}.Debug_Inbox|x64.ActiveCfg = Debug|x64
{E9D4AC92-8295-4FB4-BF7D-3FAF74B564E8}.Debug_Inbox|x64.Build.0 = Debug|x64
{E9D4AC92-8295-4FB4-BF7D-3FAF74B564E8}.Debug_Inbox|x86.ActiveCfg = Debug|Win32
{E9D4AC92-8295-4FB4-BF7D-3FAF74B564E8}.Debug_Inbox|x86.Build.0 = Debug|Win32
{E9D4AC92-8295-4FB4-BF7D-3FAF74B564E8}.Debug_NuGet|x64.ActiveCfg = Debug_NuGet|x64
{E9D4AC92-8295-4FB4-BF7D-3FAF74B564E8}.Debug_NuGet|x64.Build.0 = Debug_NuGet|x64
{E9D4AC92-8295-4FB4-BF7D-3FAF74B564E8}.Debug_NuGet|x86.ActiveCfg = Debug_NuGet|Win32
{E9D4AC92-8295-4FB4-BF7D-3FAF74B564E8}.Debug_NuGet|x86.Build.0 = Debug_NuGet|Win32
{E9D4AC92-8295-4FB4-BF7D-3FAF74B564E8}.Release_Inbox|x64.ActiveCfg = Release|x64
{E9D4AC92-8295-4FB4-BF7D-3FAF74B564E8}.Release_Inbox|x64.Build.0 = Release|x64
{E9D4AC92-8295-4FB4-BF7D-3FAF74B564E8}.Release_Inbox|x86.ActiveCfg = Release|Win32
{E9D4AC92-8295-4FB4-BF7D-3FAF74B564E8}.Release_Inbox|x86.Build.0 = Release|Win32
{E9D4AC92-8295-4FB4-BF7D-3FAF74B564E8}.Release_NuGet|x64.ActiveCfg = Release_NuGet|x64
{E9D4AC92-8295-4FB4-BF7D-3FAF74B564E8}.Release_NuGet|x64.Build.0 = Release_NuGet|x64
{E9D4AC92-8295-4FB4-BF7D-3FAF74B564E8}.Release_NuGet|x86.ActiveCfg = Release_NuGet|Win32
{E9D4AC92-8295-4FB4-BF7D-3FAF74B564E8}.Release_NuGet|x86.Build.0 = Release_NuGet|Win32
{31653A2F-02CC-4A95-9880-BF86965FB262}.Debug_Inbox|x64.ActiveCfg = Debug|x64
{31653A2F-02CC-4A95-9880-BF86965FB262}.Debug_Inbox|x64.Build.0 = Debug|x64
{31653A2F-02CC-4A95-9880-BF86965FB262}.Debug_Inbox|x86.ActiveCfg = Debug|Win32
{31653A2F-02CC-4A95-9880-BF86965FB262}.Debug_Inbox|x86.Build.0 = Debug|Win32
{31653A2F-02CC-4A95-9880-BF86965FB262}.Debug_NuGet|x64.ActiveCfg = Debug_NuGet|x64
{31653A2F-02CC-4A95-9880-BF86965FB262}.Debug_NuGet|x64.Build.0 = Debug_NuGet|x64
{31653A2F-02CC-4A95-9880-BF86965FB262}.Debug_NuGet|x86.ActiveCfg = Debug_NuGet|Win32
{31653A2F-02CC-4A95-9880-BF86965FB262}.Debug_NuGet|x86.Build.0 = Debug_NuGet|Win32
{31653A2F-02CC-4A95-9880-BF86965FB262}.Release_Inbox|x64.ActiveCfg = Release|x64
{31653A2F-02CC-4A95-9880-BF86965FB262}.Release_Inbox|x64.Build.0 = Release|x64
{31653A2F-02CC-4A95-9880-BF86965FB262}.Release_Inbox|x86.ActiveCfg = Release|Win32
{31653A2F-02CC-4A95-9880-BF86965FB262}.Release_Inbox|x86.Build.0 = Release|Win32
{31653A2F-02CC-4A95-9880-BF86965FB262}.Release_NuGet|x64.ActiveCfg = Release_NuGet|x64
{31653A2F-02CC-4A95-9880-BF86965FB262}.Release_NuGet|x64.Build.0 = Release_NuGet|x64
{31653A2F-02CC-4A95-9880-BF86965FB262}.Release_NuGet|x86.ActiveCfg = Release_NuGet|Win32
{31653A2F-02CC-4A95-9880-BF86965FB262}.Release_NuGet|x86.Build.0 = Release_NuGet|Win32
{C3BCBEA1-90E6-426F-88AC-64C274BCEF45}.Debug_Inbox|x64.ActiveCfg = Debug|x64
{C3BCBEA1-90E6-426F-88AC-64C274BCEF45}.Debug_Inbox|x64.Build.0 = Debug|x64
{C3BCBEA1-90E6-426F-88AC-64C274BCEF45}.Debug_Inbox|x86.ActiveCfg = Debug|Win32
{C3BCBEA1-90E6-426F-88AC-64C274BCEF45}.Debug_Inbox|x86.Build.0 = Debug|Win32
{C3BCBEA1-90E6-426F-88AC-64C274BCEF45}.Debug_NuGet|x64.ActiveCfg = Debug_NuGet|x64
{C3BCBEA1-90E6-426F-88AC-64C274BCEF45}.Debug_NuGet|x64.Build.0 = Debug_NuGet|x64
{C3BCBEA1-90E6-426F-88AC-64C274BCEF45}.Debug_NuGet|x86.ActiveCfg = Debug_NuGet|Win32
{C3BCBEA1-90E6-426F-88AC-64C274BCEF45}.Debug_NuGet|x86.Build.0 = Debug_NuGet|Win32
{C3BCBEA1-90E6-426F-88AC-64C274BCEF45}.Release_Inbox|x64.ActiveCfg = Release|x64
{C3BCBEA1-90E6-426F-88AC-64C274BCEF45}.Release_Inbox|x64.Build.0 = Release|x64
{C3BCBEA1-90E6-426F-88AC-64C274BCEF45}.Release_Inbox|x86.ActiveCfg = Release|Win32
{C3BCBEA1-90E6-426F-88AC-64C274BCEF45}.Release_Inbox|x86.Build.0 = Release|Win32
{C3BCBEA1-90E6-426F-88AC-64C274BCEF45}.Release_NuGet|x64.ActiveCfg = Release_NuGet|x64
{C3BCBEA1-90E6-426F-88AC-64C274BCEF45}.Release_NuGet|x64.Build.0 = Release_NuGet|x64
{C3BCBEA1-90E6-426F-88AC-64C274BCEF45}.Release_NuGet|x86.ActiveCfg = Release_NuGet|Win32
{C3BCBEA1-90E6-426F-88AC-64C274BCEF45}.Release_NuGet|x86.Build.0 = Release_NuGet|Win32
{C174D45D-C189-475B-B1A7-494939EE7491}.Debug_Inbox|x64.ActiveCfg = Debug|x64
{C174D45D-C189-475B-B1A7-494939EE7491}.Debug_Inbox|x64.Build.0 = Debug|x64
{C174D45D-C189-475B-B1A7-494939EE7491}.Debug_Inbox|x86.ActiveCfg = Debug|Win32
{C174D45D-C189-475B-B1A7-494939EE7491}.Debug_Inbox|x86.Build.0 = Debug|Win32
{C174D45D-C189-475B-B1A7-494939EE7491}.Debug_NuGet|x64.ActiveCfg = Debug_NuGet|x64
{C174D45D-C189-475B-B1A7-494939EE7491}.Debug_NuGet|x64.Build.0 = Debug_NuGet|x64
{C174D45D-C189-475B-B1A7-494939EE7491}.Debug_NuGet|x86.ActiveCfg = Debug_NuGet|Win32
{C174D45D-C189-475B-B1A7-494939EE7491}.Debug_NuGet|x86.Build.0 = Debug_NuGet|Win32
{C174D45D-C189-475B-B1A7-494939EE7491}.Release_Inbox|x64.ActiveCfg = Release|x64
{C174D45D-C189-475B-B1A7-494939EE7491}.Release_Inbox|x64.Build.0 = Release|x64
{C174D45D-C189-475B-B1A7-494939EE7491}.Release_Inbox|x86.ActiveCfg = Release|Win32
{C174D45D-C189-475B-B1A7-494939EE7491}.Release_Inbox|x86.Build.0 = Release|Win32
{C174D45D-C189-475B-B1A7-494939EE7491}.Release_NuGet|x64.ActiveCfg = Release_NuGet|x64
{C174D45D-C189-475B-B1A7-494939EE7491}.Release_NuGet|x64.Build.0 = Release_NuGet|x64
{C174D45D-C189-475B-B1A7-494939EE7491}.Release_NuGet|x86.ActiveCfg = Release_NuGet|Win32
{C174D45D-C189-475B-B1A7-494939EE7491}.Release_NuGet|x86.Build.0 = Release_NuGet|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
Loading

0 comments on commit 7f9e191

Please sign in to comment.