Skip to content

Commit 7f9e191

Browse files
Ryan LaiRyan Lai
Ryan Lai
and
Ryan Lai
authored
Build MicrosoftMLRunner for using WinML nuget and make WinMLRunner only 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 <[email protected]>
1 parent 640a30b commit 7f9e191

25 files changed

+3223
-2824
lines changed

Testing/WinMLRunnerTest/WinMLRunnerTest.cpp

+53-53
Large diffs are not rendered by default.

Testing/WinMLRunnerTest/WinMLRunnerTest.vcxproj

+354
Large diffs are not rendered by default.

Tools/WinMLRunner/README.md

+3-4
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,9 @@ Run a model on the CPU and GPU separately, and by binding the input to the CPU a
8383
Run a model on the CPU with the input bound to the GPU and loaded as an RGB image:
8484
> WinMLRunner.exe -model c:\\data\\SqueezeNet.onnx -CPU -GPUBoundInput -RGB
8585
86+
## Using Microsoft.AI.Machinelearning NuGet
87+
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).
88+
8689
## Default output
8790

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

289-
## Dynamic DLL Loading
290-
291-
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.
292-
293292
## Known issues
294293

295294
- Sequence/Map inputs are not supported yet (the model is just skipped, so it doesn't block other models in a folder);

Tools/WinMLRunner/WinMLRunner.sln

+72-52
Original file line numberDiff line numberDiff line change
@@ -17,60 +17,80 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "WinMLRunnerScenarios", "Win
1717
EndProject
1818
Global
1919
GlobalSection(SolutionConfigurationPlatforms) = preSolution
20-
Debug|ARM64 = Debug|ARM64
21-
Debug|x64 = Debug|x64
22-
Debug|x86 = Debug|x86
23-
Release|ARM64 = Release|ARM64
24-
Release|x64 = Release|x64
25-
Release|x86 = Release|x86
20+
Debug_Inbox|x64 = Debug_Inbox|x64
21+
Debug_Inbox|x86 = Debug_Inbox|x86
22+
Debug_NuGet|x64 = Debug_NuGet|x64
23+
Debug_NuGet|x86 = Debug_NuGet|x86
24+
Release_Inbox|x64 = Release_Inbox|x64
25+
Release_Inbox|x86 = Release_Inbox|x86
26+
Release_NuGet|x64 = Release_NuGet|x64
27+
Release_NuGet|x86 = Release_NuGet|x86
2628
EndGlobalSection
2729
GlobalSection(ProjectConfigurationPlatforms) = postSolution
28-
{E9D4AC92-8295-4FB4-BF7D-3FAF74B564E8}.Debug|ARM64.ActiveCfg = Debug|Win32
29-
{E9D4AC92-8295-4FB4-BF7D-3FAF74B564E8}.Debug|x64.ActiveCfg = Debug|x64
30-
{E9D4AC92-8295-4FB4-BF7D-3FAF74B564E8}.Debug|x64.Build.0 = Debug|x64
31-
{E9D4AC92-8295-4FB4-BF7D-3FAF74B564E8}.Debug|x86.ActiveCfg = Debug|Win32
32-
{E9D4AC92-8295-4FB4-BF7D-3FAF74B564E8}.Debug|x86.Build.0 = Debug|Win32
33-
{E9D4AC92-8295-4FB4-BF7D-3FAF74B564E8}.Release|ARM64.ActiveCfg = Release|Win32
34-
{E9D4AC92-8295-4FB4-BF7D-3FAF74B564E8}.Release|x64.ActiveCfg = Release|x64
35-
{E9D4AC92-8295-4FB4-BF7D-3FAF74B564E8}.Release|x64.Build.0 = Release|x64
36-
{E9D4AC92-8295-4FB4-BF7D-3FAF74B564E8}.Release|x86.ActiveCfg = Release|Win32
37-
{E9D4AC92-8295-4FB4-BF7D-3FAF74B564E8}.Release|x86.Build.0 = Release|Win32
38-
{31653A2F-02CC-4A95-9880-BF86965FB262}.Debug|ARM64.ActiveCfg = Debug|ARM64
39-
{31653A2F-02CC-4A95-9880-BF86965FB262}.Debug|ARM64.Build.0 = Debug|ARM64
40-
{31653A2F-02CC-4A95-9880-BF86965FB262}.Debug|x64.ActiveCfg = Debug|x64
41-
{31653A2F-02CC-4A95-9880-BF86965FB262}.Debug|x64.Build.0 = Debug|x64
42-
{31653A2F-02CC-4A95-9880-BF86965FB262}.Debug|x86.ActiveCfg = Debug|Win32
43-
{31653A2F-02CC-4A95-9880-BF86965FB262}.Debug|x86.Build.0 = Debug|Win32
44-
{31653A2F-02CC-4A95-9880-BF86965FB262}.Release|ARM64.ActiveCfg = Release|ARM64
45-
{31653A2F-02CC-4A95-9880-BF86965FB262}.Release|ARM64.Build.0 = Release|ARM64
46-
{31653A2F-02CC-4A95-9880-BF86965FB262}.Release|x64.ActiveCfg = Release|x64
47-
{31653A2F-02CC-4A95-9880-BF86965FB262}.Release|x64.Build.0 = Release|x64
48-
{31653A2F-02CC-4A95-9880-BF86965FB262}.Release|x86.ActiveCfg = Release|Win32
49-
{31653A2F-02CC-4A95-9880-BF86965FB262}.Release|x86.Build.0 = Release|Win32
50-
{C3BCBEA1-90E6-426F-88AC-64C274BCEF45}.Debug|ARM64.ActiveCfg = Debug|ARM64
51-
{C3BCBEA1-90E6-426F-88AC-64C274BCEF45}.Debug|ARM64.Build.0 = Debug|ARM64
52-
{C3BCBEA1-90E6-426F-88AC-64C274BCEF45}.Debug|x64.ActiveCfg = Debug|x64
53-
{C3BCBEA1-90E6-426F-88AC-64C274BCEF45}.Debug|x64.Build.0 = Debug|x64
54-
{C3BCBEA1-90E6-426F-88AC-64C274BCEF45}.Debug|x86.ActiveCfg = Debug|Win32
55-
{C3BCBEA1-90E6-426F-88AC-64C274BCEF45}.Debug|x86.Build.0 = Debug|Win32
56-
{C3BCBEA1-90E6-426F-88AC-64C274BCEF45}.Release|ARM64.ActiveCfg = Release|ARM64
57-
{C3BCBEA1-90E6-426F-88AC-64C274BCEF45}.Release|ARM64.Build.0 = Release|ARM64
58-
{C3BCBEA1-90E6-426F-88AC-64C274BCEF45}.Release|x64.ActiveCfg = Release|x64
59-
{C3BCBEA1-90E6-426F-88AC-64C274BCEF45}.Release|x64.Build.0 = Release|x64
60-
{C3BCBEA1-90E6-426F-88AC-64C274BCEF45}.Release|x86.ActiveCfg = Release|Win32
61-
{C3BCBEA1-90E6-426F-88AC-64C274BCEF45}.Release|x86.Build.0 = Release|Win32
62-
{C174D45D-C189-475B-B1A7-494939EE7491}.Debug|ARM64.ActiveCfg = Debug|ARM64
63-
{C174D45D-C189-475B-B1A7-494939EE7491}.Debug|ARM64.Build.0 = Debug|ARM64
64-
{C174D45D-C189-475B-B1A7-494939EE7491}.Debug|x64.ActiveCfg = Debug|x64
65-
{C174D45D-C189-475B-B1A7-494939EE7491}.Debug|x64.Build.0 = Debug|x64
66-
{C174D45D-C189-475B-B1A7-494939EE7491}.Debug|x86.ActiveCfg = Debug|Win32
67-
{C174D45D-C189-475B-B1A7-494939EE7491}.Debug|x86.Build.0 = Debug|Win32
68-
{C174D45D-C189-475B-B1A7-494939EE7491}.Release|ARM64.ActiveCfg = Release|ARM64
69-
{C174D45D-C189-475B-B1A7-494939EE7491}.Release|ARM64.Build.0 = Release|ARM64
70-
{C174D45D-C189-475B-B1A7-494939EE7491}.Release|x64.ActiveCfg = Release|x64
71-
{C174D45D-C189-475B-B1A7-494939EE7491}.Release|x64.Build.0 = Release|x64
72-
{C174D45D-C189-475B-B1A7-494939EE7491}.Release|x86.ActiveCfg = Release|Win32
73-
{C174D45D-C189-475B-B1A7-494939EE7491}.Release|x86.Build.0 = Release|Win32
30+
{E9D4AC92-8295-4FB4-BF7D-3FAF74B564E8}.Debug_Inbox|x64.ActiveCfg = Debug|x64
31+
{E9D4AC92-8295-4FB4-BF7D-3FAF74B564E8}.Debug_Inbox|x64.Build.0 = Debug|x64
32+
{E9D4AC92-8295-4FB4-BF7D-3FAF74B564E8}.Debug_Inbox|x86.ActiveCfg = Debug|Win32
33+
{E9D4AC92-8295-4FB4-BF7D-3FAF74B564E8}.Debug_Inbox|x86.Build.0 = Debug|Win32
34+
{E9D4AC92-8295-4FB4-BF7D-3FAF74B564E8}.Debug_NuGet|x64.ActiveCfg = Debug_NuGet|x64
35+
{E9D4AC92-8295-4FB4-BF7D-3FAF74B564E8}.Debug_NuGet|x64.Build.0 = Debug_NuGet|x64
36+
{E9D4AC92-8295-4FB4-BF7D-3FAF74B564E8}.Debug_NuGet|x86.ActiveCfg = Debug_NuGet|Win32
37+
{E9D4AC92-8295-4FB4-BF7D-3FAF74B564E8}.Debug_NuGet|x86.Build.0 = Debug_NuGet|Win32
38+
{E9D4AC92-8295-4FB4-BF7D-3FAF74B564E8}.Release_Inbox|x64.ActiveCfg = Release|x64
39+
{E9D4AC92-8295-4FB4-BF7D-3FAF74B564E8}.Release_Inbox|x64.Build.0 = Release|x64
40+
{E9D4AC92-8295-4FB4-BF7D-3FAF74B564E8}.Release_Inbox|x86.ActiveCfg = Release|Win32
41+
{E9D4AC92-8295-4FB4-BF7D-3FAF74B564E8}.Release_Inbox|x86.Build.0 = Release|Win32
42+
{E9D4AC92-8295-4FB4-BF7D-3FAF74B564E8}.Release_NuGet|x64.ActiveCfg = Release_NuGet|x64
43+
{E9D4AC92-8295-4FB4-BF7D-3FAF74B564E8}.Release_NuGet|x64.Build.0 = Release_NuGet|x64
44+
{E9D4AC92-8295-4FB4-BF7D-3FAF74B564E8}.Release_NuGet|x86.ActiveCfg = Release_NuGet|Win32
45+
{E9D4AC92-8295-4FB4-BF7D-3FAF74B564E8}.Release_NuGet|x86.Build.0 = Release_NuGet|Win32
46+
{31653A2F-02CC-4A95-9880-BF86965FB262}.Debug_Inbox|x64.ActiveCfg = Debug|x64
47+
{31653A2F-02CC-4A95-9880-BF86965FB262}.Debug_Inbox|x64.Build.0 = Debug|x64
48+
{31653A2F-02CC-4A95-9880-BF86965FB262}.Debug_Inbox|x86.ActiveCfg = Debug|Win32
49+
{31653A2F-02CC-4A95-9880-BF86965FB262}.Debug_Inbox|x86.Build.0 = Debug|Win32
50+
{31653A2F-02CC-4A95-9880-BF86965FB262}.Debug_NuGet|x64.ActiveCfg = Debug_NuGet|x64
51+
{31653A2F-02CC-4A95-9880-BF86965FB262}.Debug_NuGet|x64.Build.0 = Debug_NuGet|x64
52+
{31653A2F-02CC-4A95-9880-BF86965FB262}.Debug_NuGet|x86.ActiveCfg = Debug_NuGet|Win32
53+
{31653A2F-02CC-4A95-9880-BF86965FB262}.Debug_NuGet|x86.Build.0 = Debug_NuGet|Win32
54+
{31653A2F-02CC-4A95-9880-BF86965FB262}.Release_Inbox|x64.ActiveCfg = Release|x64
55+
{31653A2F-02CC-4A95-9880-BF86965FB262}.Release_Inbox|x64.Build.0 = Release|x64
56+
{31653A2F-02CC-4A95-9880-BF86965FB262}.Release_Inbox|x86.ActiveCfg = Release|Win32
57+
{31653A2F-02CC-4A95-9880-BF86965FB262}.Release_Inbox|x86.Build.0 = Release|Win32
58+
{31653A2F-02CC-4A95-9880-BF86965FB262}.Release_NuGet|x64.ActiveCfg = Release_NuGet|x64
59+
{31653A2F-02CC-4A95-9880-BF86965FB262}.Release_NuGet|x64.Build.0 = Release_NuGet|x64
60+
{31653A2F-02CC-4A95-9880-BF86965FB262}.Release_NuGet|x86.ActiveCfg = Release_NuGet|Win32
61+
{31653A2F-02CC-4A95-9880-BF86965FB262}.Release_NuGet|x86.Build.0 = Release_NuGet|Win32
62+
{C3BCBEA1-90E6-426F-88AC-64C274BCEF45}.Debug_Inbox|x64.ActiveCfg = Debug|x64
63+
{C3BCBEA1-90E6-426F-88AC-64C274BCEF45}.Debug_Inbox|x64.Build.0 = Debug|x64
64+
{C3BCBEA1-90E6-426F-88AC-64C274BCEF45}.Debug_Inbox|x86.ActiveCfg = Debug|Win32
65+
{C3BCBEA1-90E6-426F-88AC-64C274BCEF45}.Debug_Inbox|x86.Build.0 = Debug|Win32
66+
{C3BCBEA1-90E6-426F-88AC-64C274BCEF45}.Debug_NuGet|x64.ActiveCfg = Debug_NuGet|x64
67+
{C3BCBEA1-90E6-426F-88AC-64C274BCEF45}.Debug_NuGet|x64.Build.0 = Debug_NuGet|x64
68+
{C3BCBEA1-90E6-426F-88AC-64C274BCEF45}.Debug_NuGet|x86.ActiveCfg = Debug_NuGet|Win32
69+
{C3BCBEA1-90E6-426F-88AC-64C274BCEF45}.Debug_NuGet|x86.Build.0 = Debug_NuGet|Win32
70+
{C3BCBEA1-90E6-426F-88AC-64C274BCEF45}.Release_Inbox|x64.ActiveCfg = Release|x64
71+
{C3BCBEA1-90E6-426F-88AC-64C274BCEF45}.Release_Inbox|x64.Build.0 = Release|x64
72+
{C3BCBEA1-90E6-426F-88AC-64C274BCEF45}.Release_Inbox|x86.ActiveCfg = Release|Win32
73+
{C3BCBEA1-90E6-426F-88AC-64C274BCEF45}.Release_Inbox|x86.Build.0 = Release|Win32
74+
{C3BCBEA1-90E6-426F-88AC-64C274BCEF45}.Release_NuGet|x64.ActiveCfg = Release_NuGet|x64
75+
{C3BCBEA1-90E6-426F-88AC-64C274BCEF45}.Release_NuGet|x64.Build.0 = Release_NuGet|x64
76+
{C3BCBEA1-90E6-426F-88AC-64C274BCEF45}.Release_NuGet|x86.ActiveCfg = Release_NuGet|Win32
77+
{C3BCBEA1-90E6-426F-88AC-64C274BCEF45}.Release_NuGet|x86.Build.0 = Release_NuGet|Win32
78+
{C174D45D-C189-475B-B1A7-494939EE7491}.Debug_Inbox|x64.ActiveCfg = Debug|x64
79+
{C174D45D-C189-475B-B1A7-494939EE7491}.Debug_Inbox|x64.Build.0 = Debug|x64
80+
{C174D45D-C189-475B-B1A7-494939EE7491}.Debug_Inbox|x86.ActiveCfg = Debug|Win32
81+
{C174D45D-C189-475B-B1A7-494939EE7491}.Debug_Inbox|x86.Build.0 = Debug|Win32
82+
{C174D45D-C189-475B-B1A7-494939EE7491}.Debug_NuGet|x64.ActiveCfg = Debug_NuGet|x64
83+
{C174D45D-C189-475B-B1A7-494939EE7491}.Debug_NuGet|x64.Build.0 = Debug_NuGet|x64
84+
{C174D45D-C189-475B-B1A7-494939EE7491}.Debug_NuGet|x86.ActiveCfg = Debug_NuGet|Win32
85+
{C174D45D-C189-475B-B1A7-494939EE7491}.Debug_NuGet|x86.Build.0 = Debug_NuGet|Win32
86+
{C174D45D-C189-475B-B1A7-494939EE7491}.Release_Inbox|x64.ActiveCfg = Release|x64
87+
{C174D45D-C189-475B-B1A7-494939EE7491}.Release_Inbox|x64.Build.0 = Release|x64
88+
{C174D45D-C189-475B-B1A7-494939EE7491}.Release_Inbox|x86.ActiveCfg = Release|Win32
89+
{C174D45D-C189-475B-B1A7-494939EE7491}.Release_Inbox|x86.Build.0 = Release|Win32
90+
{C174D45D-C189-475B-B1A7-494939EE7491}.Release_NuGet|x64.ActiveCfg = Release_NuGet|x64
91+
{C174D45D-C189-475B-B1A7-494939EE7491}.Release_NuGet|x64.Build.0 = Release_NuGet|x64
92+
{C174D45D-C189-475B-B1A7-494939EE7491}.Release_NuGet|x86.ActiveCfg = Release_NuGet|Win32
93+
{C174D45D-C189-475B-B1A7-494939EE7491}.Release_NuGet|x86.Build.0 = Release_NuGet|Win32
7494
EndGlobalSection
7595
GlobalSection(SolutionProperties) = preSolution
7696
HideSolutionNode = FALSE

0 commit comments

Comments
 (0)