Skip to content
Merged
Changes from 3 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
3 changes: 3 additions & 0 deletions onnxruntime/core/providers/openvino/ov_versions/capability.cc
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,9 @@ std::vector<std::unique_ptr<ComputeCapability>> GetCapability::Execute() {
bool append_node = false;
while (j < total_clusters && !append_node) {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we add the increment part of loop so that the additional check can be removed.

something like
while (++j < total_clusters && !append_node)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi Preetha, I have made that change, thanks for pointing it out

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi Preetha, due to this change of adding the increment part in the loop, an issue was created.

Old logic (larger loop)
In the case where j < total_clusters is true but append node is also true (the loop is not entered), j is not incremented

New logic (shorter loop)
In the case ++j is still < total_clusters but append node is true, the loop is not entered but j is aldready incremented (unlike the first logic).

so, just after the loop, in this block

if (append_node) {
connected_clusters[j].emplace_back(index);
}

incorrect value of j is used which causes some model to fail.

So we cant use "while (++j < total_clusters && !append_node)"

Is there a way to optimize the loop logic but retain the j if we exit the loop due to append_node == true

j = j + 1;
if (j >= total_clusters) {
break;
}
append_node = AddTrivialClusterToNextClusterIfConnected(graph_viewer_, index, connected_clusters[j]);
}
if (append_node) {
Expand Down
Loading