-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
Expand ONNX schema registration/deregistration API #5221
Conversation
bdbf77a
to
0235792
Compare
…ions Signed-off-by: Yu Cong <congyc@amazon.com>
513762b
to
728eb4a
Compare
Hi @jcwchen , I've updated the commit to:
I have several remaining questions. Would really like to get your thoughts on!
|
Also, I think it makes sense to have a static bool variable, e.g. |
… on duplicate Signed-off-by: Yu Cong <congyc@amazon.com>
Hi @jcwchen thanks for the review. I've addressed your suggestion to expand user option. Would appreciate an approval if codes look ready. Thanks a ton! My two remaining questions are: (1) Current schema registration handles are exposed to runtimes via C++ API. How can we expose the some handles to the Python users? |
|
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.
Sorry I think I miss some comments while submitting comments yesterday. Please let me know if I still miss something important. Thank you!
Since the schema map is a static object, and that a runtime may run multi-threaded, do we need mutex to guard operations on the map?
Good point. I think it's good to have from std library.
Found another issue,
|
…TIC_REGISTRATION is OFF Signed-off-by: Yu Cong <congyc@amazon.com>
I thought of having a |
…TRATIION flag handle to python setup.py Signed-off-by: Yu Cong <congyc@amazon.com>
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.
My concern originated from that the map() func that get called at multiple places (e.g. in the getter Schema(...)) declares static SchemaRegisterer here based on __ONNX_DISABLE_STATIC_REGISTRATION's status. This makes me think, when this cmake args is OFF, a runtime should probably not mess with schema registration at all. But I experimented with a unit test, that even when this cmake arg is OFF, it can deregister, query, and register schema without issue. Pls correct me if I'm missing something here. I'll add this UT in PR.
Thank you for elaboration! I got your point now. I think that would be helpful for runtime and so it's good to have.
Looks like the release build's ORT tests failed (not sure why it didn't run before) on "Verify ONNX with ONNX Runtime PyPi package". The failed tests were due to ONNX schema not registered - the ONNX build must have turned on Do we expect the release build to permute to all available cmake bool flags? Or else how did it got turned on in the release tests? [Note: the commit 641cd5a doesn't address the rel build ORT tests failures - i haven't figured out. Help appreciated from devs!!] |
…ATION. Default fail_duplicate_schema_registration to true. Add ONNX_DISABLE_STATIC_REGISTRATION to summary.cmake and flush indentation. Signed-off-by: Yu Cong <congyc@amazon.com>
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.
Looks like the release build's ORT tests failed (not sure why it didn't run before) on "Verify ONNX with ONNX Runtime PyPi package". The failed tests were due to ONNX schema not registered - the ONNX build must have turned on -DONNX_DISABLE_STATIC_REGISTRATION. I took a look but not fully understanding the CI pipeline here. Any thought?
Those release CIs will be triggered only when having run release CIs (I added it recently because this PR is important and I would like to test it in advance). IIUC, this PR didn't change the default behavior for schema registration (ONNX_DISABLE_STATIC_REGISTRATION=OFF and it will register all opset schema). I guess the failure might be irrelevant to this PR. Please let me merge main branch with this PR to see whether it can help resolve those failures.
Such an error happened in other PRs as well. Probably because onnxruntime just has a fresh release (1.15.0) recently. We will have a PR to fix these failures and please just ignore those failures in release CIs for now. Thanks! (Update) The PR to resolve those failures is here: #5261. |
…s from tests. Signed-off-by: Yu Cong <congyc@amazon.com>
Yes, the Windows-CI failures log complains on the tests that involve the missing ops #5261 adds. I am not sure whats' the common practice here. Do we wait on #5261 to merge, then update this one to run release tests before move forward with review? Otherwise I think all comments are addressed and it's in state for review/merge. Thanks! |
It looks like that the only failing Lint test failed due to a Lint installation hiccup. Other PRs seems to be fine with the Lint check. Should/How can we rerun the Lint checker? |
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.
Now it passed all CIs. It will still need approval from @onnx/sig-operators-approvers. It might take some time because some of them are OOF this week. Thank you for waiting.
@@ -49,6 +49,9 @@ | |||
ONNX_NAMESPACE = os.getenv("ONNX_NAMESPACE", "onnx") | |||
ONNX_BUILD_TESTS = bool(os.getenv("ONNX_BUILD_TESTS") == "1") | |||
ONNX_DISABLE_EXCEPTIONS = bool(os.getenv("ONNX_DISABLE_EXCEPTIONS") == "1") | |||
ONNX_DISABLE_STATIC_REGISTRATION = bool( |
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 place where these options are documented?
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 am not aware of any, although these options are identical as the options in CMakeLists.txt:
Lines 25 to 28 in 391f570
option(ONNX_BUILD_TESTS "Build ONNX C++ APIs Tests" OFF) | |
option(ONNX_USE_LITE_PROTO "Use lite protobuf instead of full." OFF) | |
option(ONNX_DISABLE_EXCEPTIONS "Disable exception handling." OFF) | |
option(ONNX_DISABLE_STATIC_REGISTRATION "Disable static registration for onnx operator schemas." OFF) |
which has a simple sentence as description.
Signed-off-by: Yu Cong <congyc@amazon.com> Co-authored-by: Yu Cong <congyc@amazon.com> Co-authored-by: Chun-Wei Chen <jacky82226@gmail.com> Signed-off-by: Aditya Goel <agoel4512@gmail.com>
Description
Motivation and Context
Pull#3266 introduced handle for runtime to specify opset to register. Similarly, it makes sense for a runtime to "offload" the schemas when it's not needed. This aims to (1) reduce runtime memory, and (2) improve the feature completeness for a runtime to control ONNX schema registration as it needs.