You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Sort may return false result when input structs have all compared fields equal. This in turn may causes inconsistent order or even crashes in some qsort implementations.
The location of the error function is openvino/src/plugins/intel_gpu/src/graph/program.cpp.
According to the following part of the code, when the two input structures are exactly the same, the function may return true instead of false. std::sort(nodes_to_allocate.begin(), nodes_to_allocate.end(), [&po](std::shared_ptr<program_node> const& lhs, std::shared_ptr<program_node> const& rhs) { auto lhs_layout = lhs->get_output_layout(); auto rhs_layout = rhs->get_output_layout(); if (lhs_layout.is_dynamic() && lhs_layout.has_upper_bound()) { lhs_layout.set_tensor(lhs_layout.get_tensor()); } if (rhs_layout.is_dynamic() && rhs_layout.has_upper_bound()) { rhs_layout.set_tensor(rhs_layout.get_tensor()); } if (rhs_layout.is_dynamic() && !rhs_layout.has_upper_bound() && lhs_layout.is_dynamic() && !lhs_layout.has_upper_bound()) { return po.get_processing_number(lhs.get()) < po.get_processing_number(rhs.get()); } if (rhs_layout.is_dynamic()) return true; if (lhs_layout.is_dynamic()) return false; return (lhs_layout.bytes_count() > rhs_layout.bytes_count()); });
The fix is to replace the last two if statements with if (rhs_layout.is_dynamic() && !lhs_layout.is_dynamic()) return true; if (lhs_layout.is_dynamic() && !rhs_layout.is_dynamic()) return false;
Feature Use Case
No response
Issue submission checklist
The feature request or improvement must be related to OpenVINO
The text was updated successfully, but these errors were encountered:
Request Description
Sort may return false result when input structs have all compared fields equal. This in turn may causes inconsistent order or even crashes in some qsort implementations.
The location of the error function is openvino/src/plugins/intel_gpu/src/graph/program.cpp.
According to the following part of the code, when the two input structures are exactly the same, the function may return true instead of false.
std::sort(nodes_to_allocate.begin(), nodes_to_allocate.end(), [&po](std::shared_ptr<program_node> const& lhs, std::shared_ptr<program_node> const& rhs) { auto lhs_layout = lhs->get_output_layout(); auto rhs_layout = rhs->get_output_layout(); if (lhs_layout.is_dynamic() && lhs_layout.has_upper_bound()) { lhs_layout.set_tensor(lhs_layout.get_tensor()); } if (rhs_layout.is_dynamic() && rhs_layout.has_upper_bound()) { rhs_layout.set_tensor(rhs_layout.get_tensor()); } if (rhs_layout.is_dynamic() && !rhs_layout.has_upper_bound() && lhs_layout.is_dynamic() && !lhs_layout.has_upper_bound()) { return po.get_processing_number(lhs.get()) < po.get_processing_number(rhs.get()); } if (rhs_layout.is_dynamic()) return true; if (lhs_layout.is_dynamic()) return false; return (lhs_layout.bytes_count() > rhs_layout.bytes_count()); });
The fix is to replace the last two if statements with
if (rhs_layout.is_dynamic() && !lhs_layout.is_dynamic()) return true; if (lhs_layout.is_dynamic() && !rhs_layout.is_dynamic()) return false;
Feature Use Case
No response
Issue submission checklist
The text was updated successfully, but these errors were encountered: