Skip to content

Conversation

@intbf
Copy link

@intbf intbf commented Jan 27, 2026

Description

To stay on the safer side, the ext initializer feature was limited with a 32MB threshold for all ext initializers. We can now remove the artificial condition.

Related to CVS-174613

intbf added 2 commits January 27, 2026 05:30
Remove the 32MB threshold for embedding external initializers in the ONNX model proto. Now, if external weights are present and there is more than one external initializer, data will not be embedded regardless of size. CVS-174613
Refactored the OVEP_ExtInit_Tests to generate and load the ONNX model and large external initializer data only once per test suite, rather than per test case. Model and weights are now stored as static members and cleaned up after all tests. This reduces redundant file I/O and memory usage. Test logic and device probing remain unchanged.
Copy link

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

This PR removes the artificial 32MB threshold for external initializers in the OpenVINO execution provider, allowing the feature to be used more broadly without size limitations.

Changes:

  • Removed the 32MB size threshold check in backend_manager.cc
  • Refactored the test code to use static test suite setup/teardown for better resource management

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
onnxruntime/core/providers/openvino/backend_manager.cc Removed the MAX_EMBEDDED_INITIALIZER_SIZE constant and simplified the condition for using external initializers
onnxruntime/test/providers/openvino/openvino_ep_ext_init.cc Refactored test to use static class members and suite-level setup/teardown, eliminating per-test file operations

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +137 to +139
if (!model_proto.SerializeToOstream(&model_file)) {
throw std::runtime_error("Failed to serialize model");
}
Copy link

Copilot AI Jan 28, 2026

Choose a reason for hiding this comment

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

The error handling pattern is inconsistent - using exceptions in static setup while using ASSERT macros in test body. Consider using ASSERT_TRUE here for consistency with the test framework, or document why exceptions are preferred in SetUpTestSuite.

Copilot uses AI. Check for mistakes.
Comment on lines +146 to +148
if (!weights_file.is_open()) {
throw std::runtime_error("Failed to open weights file");
}
Copy link

Copilot AI Jan 28, 2026

Choose a reason for hiding this comment

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

The error handling pattern is inconsistent - using exceptions in static setup while using ASSERT macros in test body. Consider using ASSERT_TRUE here for consistency with the test framework, or document why exceptions are preferred in SetUpTestSuite.

Copilot uses AI. Check for mistakes.
Comment on lines +158 to +160
if (!model_data_.has_value() || !weights_data_.has_value()) {
throw std::runtime_error("Failed to load model or weights into memory");
}
Copy link

Copilot AI Jan 28, 2026

Choose a reason for hiding this comment

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

The error handling pattern is inconsistent - using exceptions in static setup while using ASSERT macros in test body. Consider using ASSERT_TRUE here for consistency with the test framework, or document why exceptions are preferred in SetUpTestSuite.

Copilot uses AI. Check for mistakes.
Copy link
Author

Choose a reason for hiding this comment

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

what's the common practice in ovep? should I just fail the test when I have some io error?

@MayureshV1 MayureshV1 requested review from Copilot and ericcraw and removed request for ericcraw January 28, 2026 00:24
Copy link

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

Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants