Skip to content

Commit 3834ffc

Browse files
authored
bug fixes in log CPU fallback (microsoft#474)
* upgrade toolset * update command line help string * change "toggle" -> "enable" since it's not a toggle and check the value before logging.
1 parent 8bbc4c8 commit 3834ffc

8 files changed

+43
-40
lines changed

Testing/WinMLRunnerTest/WinMLRunnerTest.vcxproj

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -39,66 +39,66 @@
3939
<ProjectGuid>{E9D4AC92-8295-4FB4-BF7D-3FAF74B564E8}</ProjectGuid>
4040
<Keyword>Win32Proj</Keyword>
4141
<RootNamespace>WinMLRunnerTest</RootNamespace>
42-
<WindowsTargetPlatformVersion>10.0.19041.0</WindowsTargetPlatformVersion>
42+
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
4343
<ProjectSubType>NativeUnitTestProject</ProjectSubType>
4444
</PropertyGroup>
4545
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
4646
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
4747
<ConfigurationType>DynamicLibrary</ConfigurationType>
4848
<UseDebugLibraries>true</UseDebugLibraries>
49-
<PlatformToolset>v142</PlatformToolset>
49+
<PlatformToolset>v143</PlatformToolset>
5050
<CharacterSet>Unicode</CharacterSet>
5151
<UseOfMfc>false</UseOfMfc>
5252
</PropertyGroup>
5353
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug_NuGet|Win32'" Label="Configuration">
5454
<ConfigurationType>DynamicLibrary</ConfigurationType>
5555
<UseDebugLibraries>true</UseDebugLibraries>
56-
<PlatformToolset>v142</PlatformToolset>
56+
<PlatformToolset>v143</PlatformToolset>
5757
<CharacterSet>Unicode</CharacterSet>
5858
<UseOfMfc>false</UseOfMfc>
5959
</PropertyGroup>
6060
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
6161
<ConfigurationType>DynamicLibrary</ConfigurationType>
6262
<UseDebugLibraries>false</UseDebugLibraries>
63-
<PlatformToolset>v142</PlatformToolset>
63+
<PlatformToolset>v143</PlatformToolset>
6464
<WholeProgramOptimization>true</WholeProgramOptimization>
6565
<CharacterSet>Unicode</CharacterSet>
6666
<UseOfMfc>false</UseOfMfc>
6767
</PropertyGroup>
6868
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release_NuGet|Win32'" Label="Configuration">
6969
<ConfigurationType>DynamicLibrary</ConfigurationType>
7070
<UseDebugLibraries>false</UseDebugLibraries>
71-
<PlatformToolset>v142</PlatformToolset>
71+
<PlatformToolset>v143</PlatformToolset>
7272
<WholeProgramOptimization>true</WholeProgramOptimization>
7373
<CharacterSet>Unicode</CharacterSet>
7474
<UseOfMfc>false</UseOfMfc>
7575
</PropertyGroup>
7676
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
7777
<ConfigurationType>DynamicLibrary</ConfigurationType>
7878
<UseDebugLibraries>true</UseDebugLibraries>
79-
<PlatformToolset>v142</PlatformToolset>
79+
<PlatformToolset>v143</PlatformToolset>
8080
<CharacterSet>Unicode</CharacterSet>
8181
<UseOfMfc>false</UseOfMfc>
8282
</PropertyGroup>
8383
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug_NuGet|x64'" Label="Configuration">
8484
<ConfigurationType>DynamicLibrary</ConfigurationType>
8585
<UseDebugLibraries>true</UseDebugLibraries>
86-
<PlatformToolset>v142</PlatformToolset>
86+
<PlatformToolset>v143</PlatformToolset>
8787
<CharacterSet>Unicode</CharacterSet>
8888
<UseOfMfc>false</UseOfMfc>
8989
</PropertyGroup>
9090
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
9191
<ConfigurationType>DynamicLibrary</ConfigurationType>
9292
<UseDebugLibraries>false</UseDebugLibraries>
93-
<PlatformToolset>v142</PlatformToolset>
93+
<PlatformToolset>v143</PlatformToolset>
9494
<WholeProgramOptimization>true</WholeProgramOptimization>
9595
<CharacterSet>Unicode</CharacterSet>
9696
<UseOfMfc>false</UseOfMfc>
9797
</PropertyGroup>
9898
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release_NuGet|x64'" Label="Configuration">
9999
<ConfigurationType>DynamicLibrary</ConfigurationType>
100100
<UseDebugLibraries>false</UseDebugLibraries>
101-
<PlatformToolset>v142</PlatformToolset>
101+
<PlatformToolset>v143</PlatformToolset>
102102
<WholeProgramOptimization>true</WholeProgramOptimization>
103103
<CharacterSet>Unicode</CharacterSet>
104104
<UseOfMfc>false</UseOfMfc>

Tools/WinMLRunner/WinMLRunner.vcxproj

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -61,58 +61,58 @@
6161
<ProjectGuid>{31653A2F-02CC-4A95-9880-BF86965FB262}</ProjectGuid>
6262
<Keyword>Win32Proj</Keyword>
6363
<RootNamespace>WinMLRunner</RootNamespace>
64-
<WindowsTargetPlatformVersion>10.0.19041.0</WindowsTargetPlatformVersion>
64+
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
6565
</PropertyGroup>
6666
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
6767
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
6868
<ConfigurationType>Application</ConfigurationType>
6969
<UseDebugLibraries>true</UseDebugLibraries>
70-
<PlatformToolset>v142</PlatformToolset>
70+
<PlatformToolset>v143</PlatformToolset>
7171
<CharacterSet>Unicode</CharacterSet>
7272
</PropertyGroup>
7373
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug_NuGet|Win32'" Label="Configuration">
7474
<ConfigurationType>Application</ConfigurationType>
7575
<UseDebugLibraries>true</UseDebugLibraries>
76-
<PlatformToolset>v142</PlatformToolset>
76+
<PlatformToolset>v143</PlatformToolset>
7777
<CharacterSet>Unicode</CharacterSet>
7878
</PropertyGroup>
7979
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
8080
<ConfigurationType>Application</ConfigurationType>
8181
<UseDebugLibraries>false</UseDebugLibraries>
82-
<PlatformToolset>v142</PlatformToolset>
82+
<PlatformToolset>v143</PlatformToolset>
8383
<WholeProgramOptimization>true</WholeProgramOptimization>
8484
<CharacterSet>Unicode</CharacterSet>
8585
</PropertyGroup>
8686
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release_NuGet|Win32'" Label="Configuration">
8787
<ConfigurationType>Application</ConfigurationType>
8888
<UseDebugLibraries>false</UseDebugLibraries>
89-
<PlatformToolset>v142</PlatformToolset>
89+
<PlatformToolset>v143</PlatformToolset>
9090
<WholeProgramOptimization>true</WholeProgramOptimization>
9191
<CharacterSet>Unicode</CharacterSet>
9292
</PropertyGroup>
9393
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
9494
<ConfigurationType>Application</ConfigurationType>
9595
<UseDebugLibraries>true</UseDebugLibraries>
96-
<PlatformToolset>v142</PlatformToolset>
96+
<PlatformToolset>v143</PlatformToolset>
9797
<CharacterSet>Unicode</CharacterSet>
9898
</PropertyGroup>
9999
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug_NuGet|x64'" Label="Configuration">
100100
<ConfigurationType>Application</ConfigurationType>
101101
<UseDebugLibraries>true</UseDebugLibraries>
102-
<PlatformToolset>v142</PlatformToolset>
102+
<PlatformToolset>v143</PlatformToolset>
103103
<CharacterSet>Unicode</CharacterSet>
104104
</PropertyGroup>
105105
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
106106
<ConfigurationType>Application</ConfigurationType>
107107
<UseDebugLibraries>false</UseDebugLibraries>
108-
<PlatformToolset>v142</PlatformToolset>
108+
<PlatformToolset>v143</PlatformToolset>
109109
<WholeProgramOptimization>true</WholeProgramOptimization>
110110
<CharacterSet>Unicode</CharacterSet>
111111
</PropertyGroup>
112112
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release_NuGet|x64'" Label="Configuration">
113113
<ConfigurationType>Application</ConfigurationType>
114114
<UseDebugLibraries>false</UseDebugLibraries>
115-
<PlatformToolset>v142</PlatformToolset>
115+
<PlatformToolset>v143</PlatformToolset>
116116
<WholeProgramOptimization>true</WholeProgramOptimization>
117117
<CharacterSet>Unicode</CharacterSet>
118118
</PropertyGroup>

Tools/WinMLRunner/WinMLRunnerScenarios.vcxproj

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -52,58 +52,58 @@
5252
<ProjectGuid>{C174D45D-C189-475B-B1A7-494939EE7491}</ProjectGuid>
5353
<Keyword>Win32Proj</Keyword>
5454
<RootNamespace>WinMLRunnerScenarios</RootNamespace>
55-
<WindowsTargetPlatformVersion>10.0.19041.0</WindowsTargetPlatformVersion>
55+
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
5656
</PropertyGroup>
5757
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
5858
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
5959
<ConfigurationType>StaticLibrary</ConfigurationType>
6060
<UseDebugLibraries>true</UseDebugLibraries>
61-
<PlatformToolset>v142</PlatformToolset>
61+
<PlatformToolset>v143</PlatformToolset>
6262
<CharacterSet>Unicode</CharacterSet>
6363
</PropertyGroup>
6464
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug_NuGet|Win32'" Label="Configuration">
6565
<ConfigurationType>StaticLibrary</ConfigurationType>
6666
<UseDebugLibraries>true</UseDebugLibraries>
67-
<PlatformToolset>v142</PlatformToolset>
67+
<PlatformToolset>v143</PlatformToolset>
6868
<CharacterSet>Unicode</CharacterSet>
6969
</PropertyGroup>
7070
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
7171
<ConfigurationType>StaticLibrary</ConfigurationType>
7272
<UseDebugLibraries>false</UseDebugLibraries>
73-
<PlatformToolset>v142</PlatformToolset>
73+
<PlatformToolset>v143</PlatformToolset>
7474
<WholeProgramOptimization>true</WholeProgramOptimization>
7575
<CharacterSet>Unicode</CharacterSet>
7676
</PropertyGroup>
7777
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release_NuGet|Win32'" Label="Configuration">
7878
<ConfigurationType>StaticLibrary</ConfigurationType>
7979
<UseDebugLibraries>false</UseDebugLibraries>
80-
<PlatformToolset>v142</PlatformToolset>
80+
<PlatformToolset>v143</PlatformToolset>
8181
<WholeProgramOptimization>true</WholeProgramOptimization>
8282
<CharacterSet>Unicode</CharacterSet>
8383
</PropertyGroup>
8484
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
8585
<ConfigurationType>StaticLibrary</ConfigurationType>
8686
<UseDebugLibraries>true</UseDebugLibraries>
87-
<PlatformToolset>v142</PlatformToolset>
87+
<PlatformToolset>v143</PlatformToolset>
8888
<CharacterSet>Unicode</CharacterSet>
8989
</PropertyGroup>
9090
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug_NuGet|x64'" Label="Configuration">
9191
<ConfigurationType>StaticLibrary</ConfigurationType>
9292
<UseDebugLibraries>true</UseDebugLibraries>
93-
<PlatformToolset>v142</PlatformToolset>
93+
<PlatformToolset>v143</PlatformToolset>
9494
<CharacterSet>Unicode</CharacterSet>
9595
</PropertyGroup>
9696
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
9797
<ConfigurationType>StaticLibrary</ConfigurationType>
9898
<UseDebugLibraries>false</UseDebugLibraries>
99-
<PlatformToolset>v142</PlatformToolset>
99+
<PlatformToolset>v143</PlatformToolset>
100100
<WholeProgramOptimization>true</WholeProgramOptimization>
101101
<CharacterSet>Unicode</CharacterSet>
102102
</PropertyGroup>
103103
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release_NuGet|x64'" Label="Configuration">
104104
<ConfigurationType>StaticLibrary</ConfigurationType>
105105
<UseDebugLibraries>false</UseDebugLibraries>
106-
<PlatformToolset>v142</PlatformToolset>
106+
<PlatformToolset>v143</PlatformToolset>
107107
<WholeProgramOptimization>true</WholeProgramOptimization>
108108
<CharacterSet>Unicode</CharacterSet>
109109
</PropertyGroup>

Tools/WinMLRunner/WinMLRunnerStaticLib.vcxproj

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -65,58 +65,58 @@
6565
<ProjectGuid>{C3BCBEA1-90E6-426F-88AC-64C274BCEF45}</ProjectGuid>
6666
<Keyword>Win32Proj</Keyword>
6767
<RootNamespace>WinMLRunnerStaticLib</RootNamespace>
68-
<WindowsTargetPlatformVersion>10.0.19041.0</WindowsTargetPlatformVersion>
68+
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
6969
</PropertyGroup>
7070
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
7171
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
7272
<ConfigurationType>StaticLibrary</ConfigurationType>
7373
<UseDebugLibraries>true</UseDebugLibraries>
74-
<PlatformToolset>v142</PlatformToolset>
74+
<PlatformToolset>v143</PlatformToolset>
7575
<CharacterSet>Unicode</CharacterSet>
7676
</PropertyGroup>
7777
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug_NuGet|Win32'" Label="Configuration">
7878
<ConfigurationType>StaticLibrary</ConfigurationType>
7979
<UseDebugLibraries>true</UseDebugLibraries>
80-
<PlatformToolset>v142</PlatformToolset>
80+
<PlatformToolset>v143</PlatformToolset>
8181
<CharacterSet>Unicode</CharacterSet>
8282
</PropertyGroup>
8383
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
8484
<ConfigurationType>StaticLibrary</ConfigurationType>
8585
<UseDebugLibraries>false</UseDebugLibraries>
86-
<PlatformToolset>v142</PlatformToolset>
86+
<PlatformToolset>v143</PlatformToolset>
8787
<WholeProgramOptimization>true</WholeProgramOptimization>
8888
<CharacterSet>Unicode</CharacterSet>
8989
</PropertyGroup>
9090
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release_NuGet|Win32'" Label="Configuration">
9191
<ConfigurationType>StaticLibrary</ConfigurationType>
9292
<UseDebugLibraries>false</UseDebugLibraries>
93-
<PlatformToolset>v142</PlatformToolset>
93+
<PlatformToolset>v143</PlatformToolset>
9494
<WholeProgramOptimization>true</WholeProgramOptimization>
9595
<CharacterSet>Unicode</CharacterSet>
9696
</PropertyGroup>
9797
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
9898
<ConfigurationType>StaticLibrary</ConfigurationType>
9999
<UseDebugLibraries>true</UseDebugLibraries>
100-
<PlatformToolset>v142</PlatformToolset>
100+
<PlatformToolset>v143</PlatformToolset>
101101
<CharacterSet>Unicode</CharacterSet>
102102
</PropertyGroup>
103103
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug_NuGet|x64'" Label="Configuration">
104104
<ConfigurationType>StaticLibrary</ConfigurationType>
105105
<UseDebugLibraries>true</UseDebugLibraries>
106-
<PlatformToolset>v142</PlatformToolset>
106+
<PlatformToolset>v143</PlatformToolset>
107107
<CharacterSet>Unicode</CharacterSet>
108108
</PropertyGroup>
109109
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
110110
<ConfigurationType>StaticLibrary</ConfigurationType>
111111
<UseDebugLibraries>false</UseDebugLibraries>
112-
<PlatformToolset>v142</PlatformToolset>
112+
<PlatformToolset>v143</PlatformToolset>
113113
<WholeProgramOptimization>true</WholeProgramOptimization>
114114
<CharacterSet>Unicode</CharacterSet>
115115
</PropertyGroup>
116116
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release_NuGet|x64'" Label="Configuration">
117117
<ConfigurationType>StaticLibrary</ConfigurationType>
118118
<UseDebugLibraries>false</UseDebugLibraries>
119-
<PlatformToolset>v142</PlatformToolset>
119+
<PlatformToolset>v143</PlatformToolset>
120120
<WholeProgramOptimization>true</WholeProgramOptimization>
121121
<CharacterSet>Unicode</CharacterSet>
122122
</PropertyGroup>

Tools/WinMLRunner/src/CommandLineArgs.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ void CommandLineArgs::PrintUsage()
7878
std::cout << " -AutoScale <interpolationMode> : Enable image autoscaling and set the interpolation mode [Nearest, "
7979
"Linear, Cubic, Fant]"
8080
<< std::endl;
81+
std::cout << " -LogCPUFallback : output warnings when operators execute on the CPU when the CPU is not the chosen device" << std::endl;
8182
std::cout << std::endl;
8283
std::cout << "Concurrency Options:" << std::endl;
8384
std::cout << " -ConcurrentLoad: load models concurrently" << std::endl;
@@ -395,7 +396,7 @@ CommandLineArgs::CommandLineArgs(const std::vector<std::wstring>& args)
395396
}
396397
else if((_wcsicmp(args[i].c_str(), L"-LogCPUFallback") == 0))
397398
{
398-
ToggleLogCPUFallback(true);
399+
EnableLogCPUFallback();
399400
}
400401
else
401402
{

Tools/WinMLRunner/src/CommandLineArgs.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ class CommandLineArgs
4343
bool IsOutputPerf() const { return m_perfOutput; }
4444
bool IsSaveTensor() const { return m_saveTensor; }
4545
bool IsTimeLimitIterations() const { return m_timeLimitIterations; }
46+
bool IsLogCPUFallbackEnabled() const { return m_logCPUFallback; }
4647
BitmapInterpolationMode AutoScaleInterpMode() const { return m_autoScaleInterpMode; }
4748

4849
const std::vector<std::wstring>& ImagePaths() const { return m_imagePaths; }
@@ -130,7 +131,7 @@ class CommandLineArgs
130131
void ToggleEvaluationDebugOutput(bool debug) { m_evaluation_debug_output = debug; }
131132
void ToggleTerseOutput(bool terseOutput) { m_terseOutput = terseOutput; }
132133
void TogglePerfOutput(bool perfOutput) { m_perfOutput = perfOutput; }
133-
void ToggleLogCPUFallback(bool logCPUFallback) { m_logCPUFallback = logCPUFallback; }
134+
void EnableLogCPUFallback() { m_logCPUFallback = true; }
134135

135136
void SetModelPath(const std::wstring& modelPath) { m_modelPath = modelPath; }
136137
void SetPerIterationDataPath(const std::wstring& perIterationDataPath)

Tools/WinMLRunner/src/EventTraceHelper.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -496,7 +496,7 @@ void EventTraceHelper::ProcessEventTrace(PTRACEHANDLE traceHandle)
496496

497497
void EventTraceHelper::Start()
498498
{
499-
if (!commandArgs.UseGPU())
499+
if (DontLog())
500500
{
501501
return;
502502
}
@@ -556,7 +556,7 @@ void EventTraceHelper::Start()
556556

557557
void EventTraceHelper::Stop()
558558
{
559-
if (!commandArgs.UseGPU())
559+
if (DontLog())
560560
{
561561
return;
562562
}

Tools/WinMLRunner/src/EventTraceHelper.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,5 +31,6 @@ class EventTraceHelper
3131

3232
private:
3333
static void ProcessEventTrace(PTRACEHANDLE traceHandle);
34+
bool DontLog() { return !commandArgs.UseGPU() || !commandArgs.IsLogCPUFallbackEnabled(); }
3435

3536
};

0 commit comments

Comments
 (0)