Skip to content
Merged
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
24 changes: 20 additions & 4 deletions onnxruntime/core/providers/openvino/ov_versions/capability.cc
Original file line number Diff line number Diff line change
Expand Up @@ -168,17 +168,33 @@ std::vector<std::unique_ptr<ComputeCapability>> GetCapability::Execute() {
auto connected_clusters = GetConnectedClusters(graph_viewer_, ng_clusters);

int no_of_clusters = 0;
std::vector<NodeIndex> prev_cluster;
bool try_next_cluster = false;

for (auto this_cluster : connected_clusters) {
bool omit_subgraph = false;
if (try_next_cluster) {
// no need to check previous cluster
for (auto idx : prev_cluster) {
if ((std::find(this_cluster.begin(), this_cluster.end(), idx)) == this_cluster.end()) {
this_cluster.emplace_back(idx);
}
}
try_next_cluster = false;
}

// If subgraph has less then three, graph is considered trivial unless its an epctx cluster
if (this_cluster.size() < 3) {
if (!try_next_cluster && this_cluster.size() < 3) {
bool is_epctx_node = false;
for (auto node_idx : this_cluster) {
if (graph_viewer_.GetNode(node_idx)->OpType() == "EPContext")
is_epctx_node = true;
}
if (!is_epctx_node)
continue;
if (!is_epctx_node) {
omit_subgraph = true;
prev_cluster = this_cluster;
try_next_cluster = true;
}
}

std::vector<std::string> cluster_graph_inputs, cluster_inputs, cluster_outputs;
Expand All @@ -190,7 +206,7 @@ std::vector<std::unique_ptr<ComputeCapability>> GetCapability::Execute() {
cluster_inputs,
cluster_outputs);

bool omit_subgraph = false;

// Omitting zero dim subgraphs
for (auto index : this_cluster) {
const Node* node = graph_viewer_.GetNode(index);
Expand Down
Loading