Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion onnxruntime/core/providers/openvino/backend_manager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ BackendManager::BackendManager(SessionContext& session_context,
ptr_stream_t model_stream;
std::unique_ptr<onnx::ModelProto> model_proto;
if (subgraph_context_.is_ep_ctx_graph) {
if (!session_context_.reshape.empty()) {
if (!session_context_.reshape.empty() && !subgraph_context_.is_ep_ctx_ovir_encapsulated) {
std::string exception_str =
"[OpenVINO-EP] Bounded dynamic model execution using provider option reshape_input is not supported for OVEP EPContext model";
ORT_THROW(exception_str);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,8 @@ BasicBackend::BasicBackend(std::unique_ptr<ONNX_NAMESPACE::ModelProto>& model_pr
hw_target,
device_config,
enable_causallm,
model_file_path());
model_file_path(),
session_context_);
} else {
// If the blob is held in an EPContext node, then skip FE+Compile
// and directly move on to creating a backend with the executable blob
Expand Down
8 changes: 7 additions & 1 deletion onnxruntime/core/providers/openvino/ov_interface.cc
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,8 @@ OVExeNetwork OVCore::ImportEPCtxOVIREncapsulation(std::istream& model_stream,
std::string& hw_target,
const ov::AnyMap& device_config,
bool enable_causallm,
std::filesystem::path model_file_path) {
std::filesystem::path model_file_path,
const SessionContext& session_context) {
return OvExceptionBoundary<false>([&]() {
OVExeNetwork exe;

Expand Down Expand Up @@ -259,6 +260,11 @@ OVExeNetwork OVCore::ImportEPCtxOVIREncapsulation(std::istream& model_stream,
// Load the model explicitly with XML contents
std::shared_ptr<ov::Model> model = core.read_model(xml_file_path.string());

if (!session_context.reshape.empty()) {
LOGS_DEFAULT(INFO) << log_tag << "Reshaping OV-IR model to specified shape";
model->reshape(session_context.reshape);
}

if (enable_causallm) {
exe = OVCore::Get()->StatefulCompileModel(model, hw_target, device_config);
} else {
Expand Down
4 changes: 3 additions & 1 deletion onnxruntime/core/providers/openvino/ov_interface.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ class OVCore;
class OVInferRequest;
class OVExeNetwork;
struct ModelBlobWrapper;
struct SessionContext;

typedef ov::Tensor OVTensor;
typedef ov::ProfilingInfo OVProfilingInfo;
Expand Down Expand Up @@ -77,7 +78,8 @@ struct OVCore : WeakSingleton<OVCore> {
std::string& hw_target,
const ov::AnyMap& device_config,
bool enable_causallm,
std::filesystem::path model_file_path);
std::filesystem::path model_file_path,
const SessionContext& session_context);

std::vector<std::string> GetAvailableDevices() const;
std::vector<std::string> GetAvailableDevices(const std::string& device_type) const;
Expand Down
Loading