Skip to content

Conversation

gkrivor
Copy link

@gkrivor gkrivor commented Sep 2, 2025

Details:

  • Implementation of GraphIterator in ONNX Frontend

Tickets:

  • 156050

@github-actions github-actions bot added category: build OpenVINO cmake script / infra category: ONNX FE OpenVINO ONNX FrontEnd category: CPP API OpenVINO CPP API bindings category: TFL FE OpenVINO TensorFlow Lite FrontEnd labels Sep 2, 2025
@gkrivor gkrivor marked this pull request as ready for review September 3, 2025 10:59
@gkrivor gkrivor requested review from a team as code owners September 3, 2025 10:59
@rkazants rkazants added this to the 2025.4 milestone Sep 3, 2025
@gkrivor gkrivor force-pushed the onnx_gi branch 2 times, most recently from be2b917 to 09fe2e3 Compare September 3, 2025 20:07
@github-actions github-actions bot removed the category: TFL FE OpenVINO TensorFlow Lite FrontEnd label Sep 3, 2025
@gkrivor gkrivor changed the title [DRAFT][ONNX] GraphIterator implementation [ONNX] Added experimental support of GraphIterator interface Sep 4, 2025
@gkrivor gkrivor force-pushed the onnx_gi branch 2 times, most recently from 2971cec to cfcf503 Compare September 8, 2025 18:00
@sys-openvino-ci sys-openvino-ci added the ExternalPR External contributor label Oct 6, 2025
@mvafin mvafin requested a review from Copilot October 6, 2025 09:25
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Adds experimental GraphIterator-based loading/decoding path to the ONNX FrontEnd to allow iterating external or in‑memory ONNX graphs without relying solely on protobuf Graph parsing. Key changes introduce new iterator/decoder abstractions, translation session logic, and adapt control‑flow & constant ops to work with both legacy and iterator modes.

  • Introduces GraphIterator / Decoder abstractions with proto-based implementation (graph_iterator_proto, decoder_proto) and unified InputModel (unify::InputModel).
  • Adds TranslateSession and updates op translators (Loop, If, Scan, Constant, Unsqueeze) to branch on iterator-based decoding.
  • Extends tests and build scripts to exercise new iterator path; updates error expectation and model fixtures.

Reviewed Changes

Copilot reviewed 37 out of 37 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
onnx_import_controlflow.in.cpp Adjusted expected error substrings in a negative test.
bool_init_raw.prototxt Added Identity node and changed model output to new tensor.
graph_iterator.cpp (test) New tests for simple and external GraphIterator usage.
CMakeLists.txt Includes new source files (graph iterator & decoder) in test target.
tensor_external_data.* Added constructor and relaxed path handling for external data.
pooling_factory.* Refactored member m_onnx_node from value to pointer.
translate_session.* Introduces TranslateSession orchestration and graph translation logic.
place.hpp / place.cpp (core) Added unified Place hierarchy for iterator mode.
ops_bridge.* Added direct operator lookup by domain/opset.
op/{unsqueeze,scan,loop,if,constant}.cpp Added iterator-mode branches and behavior adjustments.
input_model.* Added unify::InputModel implementation for GraphIterator path.
frontend.cpp / frontend.hpp Integrated iterator-mode load/convert/decode paths.
core/* (tensor, node, graph_iterator_proto, decoder_proto, etc.) Core iterator & decoder implementations plus node adaptation.
decoder.hpp / graph_iterator.hpp New public ONNX frontend iterator/decoder interfaces.

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment on lines +157 to +164
if (!error_message.empty()) {
auto telemetry = model_onnx->get_telemetry_extension();
if (m_fail_fast) {
if (telemetry && translator == nullptr) {
telemetry->send_event("error_cause", "onnx_" + decoder->get_op_type());
}
throw;
} else {
Copy link

Copilot AI Oct 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

throw; is executed outside the dynamic scope of a catch block (the catch blocks have already completed), leading to undefined behavior and likely std::terminate. Store and rethrow the caught exception (e.g. rethrow the original inside the catch) or throw a new exception (e.g. throw std::runtime_error(error_message);).

Copilot uses AI. Check for mistakes.

Comment on lines +531 to +536
ov::Any Node::get_attribute_any(const std::string& name) const {
if (m_pimpl != nullptr) {
} else if (m_decoder != nullptr) {
return m_decoder->get_attribute(name);
}
return *found_attr;
FRONT_END_NOT_IMPLEMENTED(__FUNCTION__);
Copy link

Copilot AI Oct 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When m_pimpl is non-null the function falls through without returning, triggering the NOT_IMPLEMENTED path and never returning the attribute. Implement returning the stored attribute for the legacy (m_pimpl) path (e.g. return get_attribute(name).get_any();).

Copilot uses AI. Check for mistakes.

@mvafin
Copy link
Contributor

mvafin commented Oct 13, 2025

These changes were merged as #32325
Closing this PR

@mvafin mvafin closed this Oct 13, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

category: build OpenVINO cmake script / infra category: CPP API OpenVINO CPP API bindings category: ONNX FE OpenVINO ONNX FrontEnd ExternalPR External contributor

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants