Skip to content

Commit e4f8acb

Browse files
TejalKhade28n1harika
authored andcommitted
Cluster Change to avoid Dangling DQLinear
1 parent c0c1ed7 commit e4f8acb

File tree

1 file changed

+19
-3
lines changed

1 file changed

+19
-3
lines changed

onnxruntime/core/providers/openvino/ov_versions/capability.cc

Lines changed: 19 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -166,17 +166,33 @@ std::vector<std::unique_ptr<ComputeCapability>> GetCapability::Execute() {
166166
auto connected_clusters = GetConnectedClusters(graph_viewer_, ng_clusters);
167167

168168
int no_of_clusters = 0;
169+
std::vector<NodeIndex> prev_cluster;
170+
bool try_next_cluster = false;
169171

170172
for (auto this_cluster : connected_clusters) {
173+
bool omit_subgraph = false;
174+
if (try_next_cluster) {
175+
// no need to check previous cluster
176+
for (auto idx : prev_cluster) {
177+
if ((std::find(this_cluster.begin(), this_cluster.end(), idx)) == this_cluster.end()) {
178+
this_cluster.emplace_back(idx);
179+
}
180+
}
181+
try_next_cluster = false;
182+
}
183+
171184
// If subgraph has less then three, graph is considered trivial unless its an epctx cluster
172-
if (this_cluster.size() < 3) {
185+
if (!try_next_cluster && this_cluster.size() < 3) {
173186
bool is_epctx_node = false;
174187
for (auto node_idx : this_cluster) {
175188
if (graph_viewer_.GetNode(node_idx)->OpType() == "EPContext")
176189
is_epctx_node = true;
177190
}
178-
if (!is_epctx_node)
179-
continue;
191+
if (!is_epctx_node) {
192+
omit_subgraph = true;
193+
prev_cluster = this_cluster;
194+
try_next_cluster = true;
195+
}
180196
}
181197

182198
std::vector<std::string> cluster_graph_inputs, cluster_inputs, cluster_outputs;

0 commit comments

Comments
 (0)