-
Notifications
You must be signed in to change notification settings - Fork 57
CVS-167480 : Update ORT Error Codes handling during OV Import & Compilation flow #842
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
base: ovep-develop
Are you sure you want to change the base?
Conversation
714c56f to
5de6981
Compare
5de6981 to
f4fc10a
Compare
|
@MayureshV1 & @javier-intel please review & merge this PR too in conjunction to PR https://github.com/intel-innersource/frameworks.ai.onnxruntime.staging/pull/182 |
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.
Pull Request Overview
This PR implements structured error code handling for OpenVINO execution provider by encoding ORT error codes in exception messages during model import and compilation flows. The changes enable differentiation between import failures (ORT_INVALID_GRAPH) and compilation failures (ORT_EP_FAIL).
- Added error code parameter to OvExceptionBoundary template function with default ORT_EP_FAIL
- Encoded error codes as message prefix using "
|message" pattern - Updated compute function to extract and use encoded error codes from exceptions
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
File
Description
onnxruntime/core/providers/openvino/ov_interface.cc
Added error code parameter to exception boundary with message encoding; specified ORT_INVALID_GRAPH for import failures
onnxruntime/core/providers/openvino/openvino_execution_provider.cc
Added error code extraction logic in compute function to parse encoded error codes from exception messages
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| return code; | ||
| return static_cast<int>(common::EP_FAIL); | ||
| }; | ||
| return common::Status(common::ONNXRUNTIME, get_error_code(ex.what()), ex.what()); |
Copilot
AI
Nov 6, 2025
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.
The error message returned includes the encoded prefix (e.g., '1234|message'), which will be displayed to users. Consider extracting only the message portion after the '|' delimiter when constructing the Status to provide cleaner error messages.
| return common::Status(common::ONNXRUNTIME, get_error_code(ex.what()), ex.what()); | |
| auto get_error_message = [](std::string_view msg) { | |
| if (auto pos = msg.find('|'); pos != std::string_view::npos) | |
| return std::string(msg.substr(pos + 1)); | |
| return std::string(msg); | |
| }; | |
| return common::Status(common::ONNXRUNTIME, get_error_code(ex.what()), get_error_message(ex.what())); |
| if (auto pos = msg.find('|'); pos != std::string_view::npos) | ||
| if (int code = 0; std::from_chars(msg.data(), msg.data() + pos, code).ec == std::errc{}) | ||
| return code; |
Copilot
AI
Nov 6, 2025
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.
[nitpick] The nested if statements make the error code extraction logic difficult to read. Consider using early returns or splitting into separate conditions for better clarity.
| if (auto pos = msg.find('|'); pos != std::string_view::npos) | |
| if (int code = 0; std::from_chars(msg.data(), msg.data() + pos, code).ec == std::errc{}) | |
| return code; | |
| auto pos = msg.find('|'); | |
| if (pos == std::string_view::npos) { | |
| return static_cast<int>(common::EP_FAIL); | |
| } | |
| int code = 0; | |
| auto result = std::from_chars(msg.data(), msg.data() + pos, code); | |
| if (result.ec == std::errc{}) { | |
| return code; | |
| } |
|
@ankitm3k .. Can you consider porting the goodness from the previous effort that was put in to report these error codes. This also gives us the option to report out granular errors from the lower stack whom we worked with to get it implemented. |
This PR enables exceptions handling during compilation failure raising ORT_EP_FAIL Error Code & Import Flow failure raises ORT_INVALID_GRAPH Error Code.
JIRA -
https://jira.devtools.intel.com/browse/CVS-167480