Skip to content

Commit

Permalink
Enable - disabling ORT optimizations flag in protopipe app (#27182)
Browse files Browse the repository at this point in the history
### Details:
 - Enable - disabling ORT optimizations flag - in protopipe app

Co-authored-by: Maksim Doronin <[email protected]>
  • Loading branch information
SeptimiuIoachimNeagaIntel and Maxim-Doronin authored Oct 29, 2024
1 parent bd6cf01 commit 4d29e2e
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/plugins/intel_npu/tools/protopipe/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,7 @@ The dependency graph in Protopipe is specified by:
- `tag` - **Required**. The unique name of operation.
- `type` - **Optional**. The operation type: _Infer_, _CPU_, _Compound_ (**Default**: _Infer_)
- `repeat_count` - **Optional**. Runs operation over specified number of iterations.
- `opt_level` - **Optional**. Configures optimization level for ONNX Runtime.
- `connections` - The list of connections between operations.

Supported operation types
Expand Down
3 changes: 3 additions & 0 deletions src/plugins/intel_npu/tools/protopipe/src/parser/config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -404,6 +404,9 @@ struct convert<ONNXRTParams> {
if (node["ep"]) {
params.ep = node["ep"].as<ONNXRTParams::EP>();
}
if (node["opt_level"]) {
params.opt_level = node["opt_level"].as<int>();
}
return true;
}
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ struct ONNXRTParams {
};
// NB: std::monostate stands for the default MLAS Execution provider
using EP = std::variant<std::monostate, OpenVINO>;
std::optional<int> opt_level;
EP ep;
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,9 @@ static void cfgExecutionProvider(cv::gapi::onnx::Params<cv::gapi::Generic>& netw
static cv::gapi::GNetPackage getNetPackage(const std::string& tag, const ONNXRTParams& params) {
cv::gapi::onnx::Params<cv::gapi::Generic> network{tag, params.model_path};
network.cfgSessionOptions(params.session_options);
if (params.opt_level.has_value()) {
network.cfgOptLevel(params.opt_level.value());
}
cfgExecutionProvider(network, params.ep);
return cv::gapi::networks(network);
}
Expand Down

0 comments on commit 4d29e2e

Please sign in to comment.