Skip to content

[onnxruntime_perf_test] Dynamic dimension override (-f) not applied when using OpenVINO_RT_NPU device memory #819

@DariaMityagina

Description

@DariaMityagina

Describe the issue

Problem Description:

When using device_memory_name|OpenVINO_RT_NPU, the -f parameter for overriding dynamic dimensions is not being applied to the model output, resulting in shape mismatch errors:

OrtValue shape verification failed. Current shape:{1,1,1} Requested shape:{1,128,768}

Full error message:

2025-09-29 17:20:49.2954095 [E:onnxruntime:, sequential_executor.cc:572 onnxruntime::ExecuteKernel] Non-
zero status code returned while running OpenVINO-EP-subgraph_1 node.
Name:'OpenVINOExecutionProvider_OpenVINO-EP-subgraph_1_0' Status Message:
onnxruntime\onnxruntime\core\framework\execution_frame.cc:162
onnxruntime::IExecutionFrame::GetOrCreateNodeOutputMLValue shape && tensor.Shape() == *shape was false. 
OrtValue shape verification failed. Current shape:{1,1} Requested shape:{32,32}

When device_memory_name|OpenVINO_RT_NPU is excluded from the parameters, the error is not triggered.

Root cause analysis:

The issue appears to be in the logic at ort_test_session.cc#L967-L987

When device_memory_name_ is specified (non-empty), the code sets dynamic dimensions to 1 by default using:

transform_fcn = [](int64_t input) { return (input == -1) ? -input : input; };

However, when device_memory_name_ is empty, it uses:

transform_fcn = [](int64_t input) { return input; };

This means that explicit dimension overrides via the -f flag are not being properly applied when using device memory allocation with OpenVINO_RT_NPU.

To reproduce

The following models can be used as reproducers:

onnxruntime_perf_test -e openvino -m duration -t 30 -o 0 -C "session.disable_cpu_ep_fallback|1" -I -f "batch_size:10" -i "device_type|NPU device_memory_name|OpenVINO_RT_NPU" "image_classification_mobilenetv2_2022apr.onnx"
onnxruntime_perf_test -e openvino -m duration -t 30 -o 0 -C "session.disable_cpu_ep_fallback|1" -I -f "batch_size:10" -i "device_type|NPU device_memory_name|OpenVINO_RT_NPU" "text_detection_cn_ppocrv3_2023may.onnx"

Urgency

No response

Platform

Windows

OS Version

11 Pro

ONNX Runtime Installation

Built from Source

ONNX Runtime Version or Commit ID

ovep-develop branch

ONNX Runtime API

C++

Architecture

X64

Execution Provider

OpenVINO

Execution Provider Library Version

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions