-
Notifications
You must be signed in to change notification settings - Fork 443
Save per-iteration Output Tensor Results #113
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
Conversation
ea8b5ea to
c217107
Compare
Tools/WinMLRunner/WinMLRunner.sln
Outdated
| {81EA9CC6-8A26-4583-B1A4-84740EF815C8} = {81EA9CC6-8A26-4583-B1A4-84740EF815C8} | ||
| EndProjectSection | ||
| EndProject | ||
| Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ClassLibrary1", "..\ClassLibrary1\ClassLibrary1.csproj", "{12E5A5A7-E32C-4D2E-84DC-E937BE0A9DA8}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Was a Csharp project supposed to be added to this solution in the PR with the name: ClassLibrary1?
| <Link> | ||
| <SubSystem>Console</SubSystem> | ||
| <AdditionalDependencies>dxgi.lib;d3d12.lib;windowsapp.lib;%(AdditionalDependencies)</AdditionalDependencies> | ||
| <AdditionalDependencies>dxgi.lib;d3d12.lib;windowsapp.lib;mscoree.lib;%(AdditionalDependencies)</AdditionalDependencies> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is mscoree.lib needed as a dependency? From my understanding this is related to .NET Framework
| <UseDebugLibraries>true</UseDebugLibraries> | ||
| <PlatformToolset>v141</PlatformToolset> | ||
| <CharacterSet>Unicode</CharacterSet> | ||
| <CLRSupport>false</CLRSupport> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we need to specify CLRSupport? Isn't this related to .NET?
11e29f8 to
aecbc38
Compare
laks0209
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.NET framework support has been removed. Please review the new commit.
ae33af0 to
c9de335
Compare
|
Made modifications according to the per-iteration performance dump. Now, the summary.csv file contains the per-iteration performance results and the final result. Please review the latest commit. |
Tools/WinMLRunner/WinMLRunner.sln
Outdated
| {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|x64.ActiveCfg = Release|x64 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When you change this, it builds release when debug is specified.
Tools/WinMLRunner/WinMLRunner.sln
Outdated
| Release|x86 = Release|x86 | ||
| EndGlobalSection | ||
| GlobalSection(ProjectConfigurationPlatforms) = postSolution | ||
| {81EA9CC6-8A26-4583-B1A4-84740EF815C8}.Debug|Any CPU.ActiveCfg = Debug|Win32 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With this change, When we specify Any CPU Debug, it'll build to Win32 Debug
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, Debug|Any CPU.Build.0 is missing. If we click "Build solution" with the configuration: Any Debug | Any CPU, then WinMLRunner won't build.
Tools/WinMLRunner/WinMLRunner.sln
Outdated
| {81EA9CC6-8A26-4583-B1A4-84740EF815C8}.Debug|ARM64.Build.0 = Debug|ARM64 | ||
| {81EA9CC6-8A26-4583-B1A4-84740EF815C8}.Debug|x64.ActiveCfg = Debug|x64 | ||
| {81EA9CC6-8A26-4583-B1A4-84740EF815C8}.Debug|x64.Build.0 = Debug|x64 | ||
| {81EA9CC6-8A26-4583-B1A4-84740EF815C8}.Debug|x64.ActiveCfg = Release|x64 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When you change this, it builds release when debug is specified.
Tools/WinMLRunner/WinMLRunner.sln
Outdated
| {E9D4AC92-8295-4FB4-BF7D-3FAF74B564E8}.Debug|x64.Build.0 = Release|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|Any CPU.ActiveCfg = Release|Win32 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With this change, When we specify Any CPU Release, it'll build to Win32 Release
d5254f3 to
21c5fd3
Compare
|
Can we get some test(s) added to test that this works properly? Thanks! |
Tools/WinMLRunner/BindingUtilities.h
Outdated
| com_ptr<ITensorNative> itn = results.Lookup(desc.Name()).as<ITensorNative>(); | ||
| std::string* Tensor; | ||
| uint32_t uCapacity; | ||
| HRESULT(itn->GetBuffer(reinterpret_cast<BYTE**>(&Tensor), &uCapacity)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not supported for TensorString types. The GetBuffer method will return ERROR_INVALID_FUNCTION here.
Tools/WinMLRunner/BindingUtilities.h
Outdated
| float* Tensor; | ||
| uint32_t uCapacity; | ||
| HRESULT(itn->GetBuffer(reinterpret_cast<BYTE**>(&Tensor), &uCapacity)); | ||
| hash = winrt::impl::hash_data(Tensor, uCapacity); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i dont think the winrt::impl namespace is safe here - the SDK team changes the impl internals quite frequently.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @smk2007 . Do you have any suggestions for hash function? Please feel free to comment/provide alternatives.
Tools/WinMLRunner/Main.cpp
Outdated
| for (uint32_t i = 0; i < numIterations; i++) | ||
| { | ||
| bool captureIterationPerf = (args.PerfCapture() && (!args.IgnoreFirstRun() || i > 0)) || (args.PerIterCapture()); | ||
| bool captureIterationPerf = (args.PerfCapture() && (!args.IgnoreFirstRun() || i > 0)) || args.SaveTensor() || args.PerIterCapture();; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we need to capture performance when we want to save tensor output? What about the scenario when we just want to save tensor?
Tools/WinMLRunner/Main.cpp
Outdated
| try | ||
| { | ||
| model = LoadModel(path, args.PerfCapture() || args.PerIterCapture(), output, args, 0); | ||
| model = LoadModel(path, args.PerfCapture() || args.SaveTensor() || args.PerIterCapture(), output, args, 0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we want to capture load model performance if we only want to save tensor?
Tools/WinMLRunner/Main.cpp
Outdated
| for (auto deviceCreationLocation : deviceCreationLocations) | ||
| { | ||
| if (args.PerfCapture() || args.PerIterCapture()) | ||
| if (args.PerfCapture() || args.SaveTensor() || args.PerIterCapture()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we want to worry about performance when saving tensors?
|
Hey @laks0209, here are some tensor test ideas that @pmbrown1055 and I spoke about: Running WinMLRunner and outputting tensor CSV files and compare against an expected tensor CSV file to make sure values are correct. With combinations of
There may be a % threshold of error tolerance needed |
|
Thanks Ryan for the suggestions/corrections. I will update the code and add test cases as per the conversation. |
7af8c3e to
ac2e9de
Compare
|
Hi @ryanlai2 , Please review the latest commit with the changes and the tests. |
ac2e9de to
7b6cb13
Compare
Tools/WinMLRunner/src/Run.cpp
Outdated
| { | ||
| LearningModel model = nullptr; | ||
| output.PrintLoadingInfo(path); | ||
| model = LoadModelCryptography(path); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we need this for saving output tensor results? Also, won't the below line of code:
model = LearningModel::LoadFromFilePath(path);
overwrite the loading of the model here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have made correction in the latest commit.
| Assert::AreEqual(static_cast<size_t>(2), GetOutputCSVLineCount()); | ||
| } | ||
|
|
||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nit: Whitespace
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Have made correction in the latest commit.
| } | ||
| break; | ||
|
|
||
| case TensorKind::Int64: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we add a test to test this case if we're going to add it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a model that we can test for Int64? To verify that this code path works?
Tools/WinMLRunner/src/Run.cpp
Outdated
| output.PrintLoadingInfo(path); | ||
| model = LoadModelCryptography(path); | ||
|
|
||
| model = LearningModel::LoadFromFilePath(path); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We already load the model below in line 25 so I think this line would be redundant. What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes thats right. Sorry. I have updated it.
fae6075 to
28967ed
Compare
Tools/WinMLRunner/src/OutputHelper.h
Outdated
| } | ||
|
|
||
| void SetDefaultCSVFileNamePerIteration() | ||
| void SetDefaultFolder() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we change this method name to capture the idea that it's for setting the folder for per iterations run data?
Maybe: "SetDefaultPerIterationFolder"?
ryanlai2
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it be possible to include a model that takes Int64 tensorkind as input so that we can test that the codepath works?
b347e38 to
517a544
Compare
517a544 to
253771b
Compare
|
Removed Int64 tensorkind. And have changed the naming of the folder. Please review the latest commit :-) |
files
output tensor and pointer to the dumped output tensor file