Conversation
* Task 23998197: add winml_lib_core into onnnxruntime.dll * PR feedback build break on perf_test
#2382) this is a big PR. we are going to move it up to layer_dev , which is still a L3 so we are still safe to do work there agile. we are going to move this into the L3 so that ryan can start doing intergration testing. we will pause for a full code review and integration test result prior to going into the L2. >>>> raw comments from previous commits >>> * LearningModelSession is cleaned up to use the adapter, and parts of binding are. * moved everything in the winmladapter made it all nano-com using, WRL to construct objects in the ORT side. base interfaces for everythign for winml to call cleaned up a bunch of winml to use the base interfaces. * more pieces * GetData across the abi. * renamed some namepsace cleaned up OrtValue cleaned up Tensor cleaned up custom ops. everything *but* learnignmodel should be clean * make sure it's building. winml.dll is still a monolith.
everything builds clean. step !
* model moved over. everything builds clean. step ! * weak ref comment
| set(CMAKE_${type}_LINKER_FLAGS_RELWITHDEBINFO "${CMAKE_${type}_LINKER_FLAGS_RELWITHDEBINFO} /OPT:REF,ICF,LBR") | ||
| set(CMAKE_${type}_LINKER_FLAGS_RELWITHDEBINFO "${CMAKE_${type}_LINKER_FLAGS_RELWITHDEBINFO} /INCREMENTAL:NO") | ||
| foreach(type EXE STATIC SHARED) | ||
| if (NOT type MATCHES STATIC) |
There was a problem hiding this comment.
STATIC [](start = 29, length = 6)
does this affect other binaries or just ours? #Closed
There was a problem hiding this comment.
adding the STATIC in here makes it affect all static link libs. it seemed to make sense to apply everywhere. the problem is the linker has to take 2 passes if it needs to use LTCG and you didn't tell it before hand. so all the static link libs where starting their link phase, then resetting once they realized they needed LTCG.
In reply to: 347038839 [](ancestors = 347038839)
cmake/onnxruntime.cmake
Outdated
| ${PROVIDERS_NUPHAR} | ||
| ${PROVIDERS_DML} | ||
| ${PROVIDERS_ACL} | ||
| ${onnxruntime_winml} |
There was a problem hiding this comment.
[](start = 0, length = 1)
spaces #Closed
There was a problem hiding this comment.
| # add it to the onnxruntime shared library | ||
| set(onnxruntime_winml windowsapp.lib -WHOLEARCHIVE:$<TARGET_FILE:winml_lib_core>) | ||
| list(APPEND onnxruntime_EXTERNAL_DEPENDENCIES winml_lib_core) | ||
|
|
There was a problem hiding this comment.
is this going to live here in the final version? seems odd to add things to a different project #Closed
There was a problem hiding this comment.
that was the idea. onnxruntime_EXTERNAL_DEPENDENCIES is a property setup just for this purpose. for other cmake files to add things to the the final shared_lib
In reply to: 347039511 [](ancestors = 347039511)
cmake/winml.cmake
Outdated
| #target_link_libraries(winml_dll PRIVATE onnxruntime_providers_dml) | ||
| #target_link_libraries(winml_dll PRIVATE onnxruntime_session) | ||
| #target_link_libraries(winml_dll PRIVATE onnxruntime_util) | ||
| #target_link_libraries(winml_dll PRIVATE onnx_proto) |
There was a problem hiding this comment.
why not just delete these instead of commenting? #Closed
cmake/winml.cmake
Outdated
| target_link_libraries(winml_dll PRIVATE windowsapp.lib) | ||
| target_link_libraries(winml_dll PRIVATE winml_lib_api) | ||
| target_link_libraries(winml_dll PRIVATE winml_lib_core) | ||
| #target_link_libraries(winml_dll PRIVATE winml_lib_core) |
| #target_link_libraries(winml_dll PRIVATE winml_lib_core) | ||
| target_link_libraries(winml_dll PRIVATE winml_lib_image) | ||
| target_link_libraries(winml_dll PRIVATE winml_lib_telemetry) | ||
| target_link_libraries(winml_dll PRIVATE onecoreuap_apiset.lib) |
There was a problem hiding this comment.
onecoreuap_apiset [](start = 40, length = 17)
intentional? you replaced onecoreuap_apiset.lib with windowsapp.lib
There was a problem hiding this comment.
There was a problem hiding this comment.
| default: | ||
| return E_FAIL; | ||
| } | ||
| } |
There was a problem hiding this comment.
this exists somewhere else, too right? in winml somewhere. can we share it instead of copying it? #Closed
There was a problem hiding this comment.
nm. I see now that you removed it from the winml spot
In reply to: 347040246 [](ancestors = 347040246)
| TensorKind KeyKind, | ||
| ILearningModelFeatureDescriptor ValueDescriptor | ||
| ); | ||
| } |
There was a problem hiding this comment.
do we need to do API review? #Closed
There was a problem hiding this comment.
also can you explain what these new methods are for?
In reply to: 347040835 [](ancestors = 347040835)
There was a problem hiding this comment.
yep. we will need an API review. these new methogs allow creation of feature descriptors outside the runtime (the code comment there). basically before this change you could never create these on their own but had to have the runtime make then inside of models and return them. this change adds a factory so that other people can create them. ORT creates them in this PR. and in the future people like Vision Skills could create then also. it makes them reusable currencies.
In reply to: 347040969 [](ancestors = 347040969,347040835)
| bool& use_fp16); | ||
|
|
||
| void | ||
| OverrideShapeInferenceMethods(); |
There was a problem hiding this comment.
OverrideShapeInferenceMethods [](start = 2, length = 29)
where did this method go? #Closed
There was a problem hiding this comment.
| _winmla::IIOBinding* LearningModelBinding::BindingCollection() { | ||
| _winmla::IIOBinding* p; | ||
| m_lotusBinding.copy_to(&p); | ||
| return p; |
There was a problem hiding this comment.
is this a copy or an add-ref? #Closed
| auto& io_binding = binding_impl->BindingCollection(); | ||
| auto& bound_output_names = io_binding.GetOutputNames(); | ||
| com_ptr<_winmla::IIOBinding> io_binding; | ||
| io_binding.attach(binding_impl->BindingCollection()); |
There was a problem hiding this comment.
|
|
||
| // Invoke run on the ORT session. | ||
| WINML_THROW_IF_NOT_OK(inference_session_->Run(run_options, io_binding)); | ||
| WINML_THROW_IF_FAILED(inference_session_->Run(&run_options, io_binding.get())); |
There was a problem hiding this comment.
WINML_THROW_IF_FAILED [](start = 2, length = 21)
NOT_OK is not the same as FAILED - why this change? #Closed
There was a problem hiding this comment.
nope. not the same. NOT_OK is for status.IsOK() checks. This moved from an InferenceSession (ort type) to a IInferenceSession (com_ptr) and uses HRESULTS now across the ABI. So it had to change from NOT_OK to FAILED.
In reply to: 347042739 [](ancestors = 347042739)
winml/lib/Api.Core/WinMLAdapter.cpp
Outdated
|
|
||
| // class AbiSafeTensor | ||
| // | ||
| class AbiSafeTensor : public Microsoft::WRL::RuntimeClass < |
There was a problem hiding this comment.
AbiSafe [](start = 6, length = 7)
are these names temporary? I don't love the "ABISafe" prefix... #Closed
There was a problem hiding this comment.
winml/lib/Api.Core/WinMLAdapter.cpp
Outdated
| ITensor> { | ||
| private: | ||
| onnxruntime::Tensor& tensor_; // weak ref | ||
| ComPtr<IOrtValue> value_; // strong ref |
There was a problem hiding this comment.
I believe our code convention puts data members at the end of a class, right? #Closed
There was a problem hiding this comment.
probably. i changed it to the top when the classes are coded inside the CPP file (also not something we normally do) . when you put them at the bottom they are much harder to find.
In reply to: 347044267 [](ancestors = 347044267)
winml/lib/Api.Core/WinMLAdapter.cpp
Outdated
| THROW_HR_IF_MSG( | ||
| E_FAIL, | ||
| 0 > file_descriptor, | ||
| "Failed"); //errno |
There was a problem hiding this comment.
can you integrate the file not found change I just made? #Closed
There was a problem hiding this comment.
There was a problem hiding this comment.
i figured it out. the change is here: https://dev.azure.com/microsoft/WindowsAI/_git/WindowsAI/pullrequest/4014934?_a=files&path=%2Fwinml%2Flib%2FCore%2FModelInfo.cpp
In reply to: 347543900 [](ancestors = 347543900,347044532)
winml/lib/Api.Core/WinMLAdapter.cpp
Outdated
| HRESULT STDMETHODCALLTYPE OrtGetWinMLAdapter(IWinMLAdapter** adapter) { | ||
| // make an adapter instance | ||
| Microsoft::WRL::ComPtr<WinMLAdapter> adapterptr = wil::MakeOrThrow<WinMLAdapter>(); | ||
| return adapterptr.CopyTo(__uuidof(IWinMLAdapter), (void **)adapter); |
There was a problem hiding this comment.
(void **) [](start = 54, length = 9)
static_cast? #Closed
There was a problem hiding this comment.
static_cast doesn't work to void ** . fun, right?
https://stackoverflow.com/questions/3625410/c-static-cast-from-float-to-void
In reply to: 347044742 [](ancestors = 347044742)
There was a problem hiding this comment.
reinterpret! that's what I meant. my bad.
In reply to: 347542211 [](ancestors = 347542211,347044742)
…r creating winml objects. fixes model load.
* model moved over. everything builds clean. step ! * weak ref comment * added a wrapper for RoGetActivationFactory to hook back into winml for creating winml objects. fixes model load.
| ${PROVIDERS_NUPHAR} | ||
| ${PROVIDERS_DML} | ||
| ${PROVIDERS_ACL} | ||
| ${onnxruntime_winml} |
There was a problem hiding this comment.
onnxruntime_winml [](start = 6, length = 17)
Should the naming have adapter / core in there? I had to check in winml.cmake to double check which lib(s) were getting included
winml/lib/Api.Core/WinMLAdapter.cpp
Outdated
| } | ||
| std::vector<IOrtValue*>& STDMETHODCALLTYPE GetOutputs() override { | ||
| auto output_inner = binding_->GetOutputs(); | ||
| outputs_.clear(); |
There was a problem hiding this comment.
Also need to clear outputs_weak vector holding a vector of weak ptrs :) #Closed
* model moved over. everything builds clean. step ! * weak ref comment * added a wrapper for RoGetActivationFactory to hook back into winml for creating winml objects. fixes model load. * fixed some lifetime management. fixed the debug build. squeezenet passes using winmlrunner for CPU and GPU * PR feedback. * couple of fixes and coded getmutabledata()
* model moved over. everything builds clean. step ! * weak ref comment * added a wrapper for RoGetActivationFactory to hook back into winml for creating winml objects. fixes model load. * fixed some lifetime management. fixed the debug build. squeezenet passes using winmlrunner for CPU and GPU * PR feedback. * couple of fixes and coded getmutabledata() * fixed 2 more heap corruptions
found a leak in nvidia driver, but skipped it. all winmlapitests pass now
winml/lib/Api.Core/WinMLAdapter.cpp
Outdated
| #include "ImageFeatureDescriptor.h" | ||
| #include "api.image/inc/D3DDeviceCache.h" | ||
|
|
||
| #include "PheonixSingleton.h" |
There was a problem hiding this comment.
Already included "PheonixSingleton.h" up above #Closed
* Register WinML TraceLogging provider on Onnxruntime.dll * Add ifdef to make sure trace logging provider has telemetry option when LAYERING_DONE * No need for ifdef for TraceLoggingOptionMicrosoftTelemetry * PR feedback * Move etw registration into lotus environment constructor and deresgister in lotus environment destructor
* allow building winml cpu without dml.
* fix some more breaks * learning model doesn't need lotusEnvironment and CPU shouldn't include dmlEP headers * move dml checks out of winml and into the adapter * better error handling
* learning model doesn't need lotusEnvironment and CPU shouldn't include dmlEP headers * User/xianz/win ml telemetry (#2410) * add option to enable winml telemetry * add option to enable winml telemetry * clean logs while developping * clean the log of GUID * compile onnxruntime_common with winml telemetry * use option for use_telemetry * rename option winml_use_telemetry to onnxruntime_use_telemetry * little change * Add opset and IR check when loading model (#2413) * Add opset and IR check. * Add test case for future opsets. #2371 * WinML CI (#2412) * Pass flags to build/test WinML in CI * Add initial CMake config for unit tests in WinML * Set winml_unittests standard to C++17 * Add WinML API tests and port them to googletest * Install WinML test collateral * Add LearningModelSessionAPITests ported to googletest * Fix WinML test files encoding * Add GPU tests * Add parameterized test, skip GPU tests * Enable precompiled header * Remove unused code and collateral * Remove brand images * Add dllload.cpp * Remove images not used in API tests * Add LICENSE.md to image collaterals * Add models with licenses * Remove FNS Candy tests * Add API test models * Add ModelInSubdirectory * Install collaterals post-build with copy_if_different, split common lib * fix warnings * Link to gtest_main * fix bad merge
* add missing ir version to dictvectorizer-string.onnx * add missing ir version to relu.onnx * add missing ir version to zipmap*onnx * add IR version to manually generated models * remove an unnecessary ifdef dml
* Add scenario tests * Remove TODO from model license * Add winml_api test dependency
* commetns for dml graph transformer fixed ort value passing using the allocatir info * fixed and coded maps and sequences across the abi
* Support test parameters through CLI arguments * Add WinML do Windows x86/ARM CI builds * Code style fixes * Update googletest Remove GPUTEST macros everywhere now that GTEST_SKIP is supported * Refactor main.cpp * Build scenario tests without DML
temp