-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Support disabling support for the optional type in ORT builds #9745
Conversation
@@ -49,7 +49,6 @@ struct OrtValue { | |||
template <typename T> | |||
const T& Get() const { | |||
ORT_ENFORCE(onnxruntime::DataTypeImpl::GetType<T>() == type_, onnxruntime::DataTypeImpl::GetType<T>(), " != ", type_); | |||
ORT_ENFORCE(IsAllocated(), "OrtValue contains no data"); |
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 call is not needed. In the kernels that support optional type, this call is performed before calling Get(). Even if the check is missed and it runs into a fatal issue (i.e.) the OrtValue has no data, we will know when we de-reference the nullptr in the next line. Seems unnecessary to pay the cost of this check twice.
The hashes for the Optional operators will need to be in a separate file so we can do the same as for the ML ops when they're disabled. Refers to: onnxruntime/test/providers/kernel_def_hash_test.cc:170 in 17f373a. [](commit_id = 17f373a, deletion_comment = False) |
Done |
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.
Description: As title
To disable, use cmake_extra_defines like this :
build.bat --cmake_extra_defines onnxruntime_DISABLE_OPTIONAL_TYPE=1
Motivation and Context
Allow users to cut down on binary size if the optional type is not relevant in their scenario
#8802