Skip to content

Commit

Permalink
[CPU] Fix coverity scan issues in Node class (#28268)
Browse files Browse the repository at this point in the history
### Details:
- Fix performance inefficiencies coverity remarks in Node class
implementation of CPU plugin: 1563144, 1563146

### Tickets:
 - 153687
  • Loading branch information
aobolensk authored Jan 9, 2025
1 parent 91ae987 commit 8a6bac6
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/plugins/intel_cpu/src/node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -337,15 +337,15 @@ void Node::selectPreferPrimitiveDescriptor(const std::vector<impl_desc_type>& pr
bool Node::isOneDimShape(const ov::PartialShape& pshape) {
int value_1_num = 0;
int sz = static_cast<int>(pshape.size());
for (auto s : pshape) {
for (const auto& s : pshape) {
if (s.is_static() && s.get_length() == 1) {
value_1_num++;
}
}
return value_1_num >= sz - 1;
}

bool Node::isReorderRequired(ov::intel_cpu::MemoryDescPtr desc1, ov::intel_cpu::MemoryDescPtr desc2) {
bool Node::isReorderRequired(const ov::intel_cpu::MemoryDescPtr& desc1, const ov::intel_cpu::MemoryDescPtr& desc2) {
bool samePrec = desc1->getPrecision() == desc2->getPrecision();
bool isOneDimShape1 = isOneDimShape(desc1->getShape().toPartialShape());
bool isOneDimShape2 = isOneDimShape(desc2->getShape().toPartialShape());
Expand Down
2 changes: 1 addition & 1 deletion src/plugins/intel_cpu/src/node.h
Original file line number Diff line number Diff line change
Expand Up @@ -752,7 +752,7 @@ class Node {
void selectPreferPrimitiveDescriptor(const std::vector<impl_desc_type>& priority, bool ignoreConstInputs);
void selectPreferPrimitiveDescriptorWithShape(const std::vector<impl_desc_type>& priority, bool ignoreConstInputs);
bool isOneDimShape(const ov::PartialShape& pshape);
bool isReorderRequired(ov::intel_cpu::MemoryDescPtr desc1, ov::intel_cpu::MemoryDescPtr desc2);
bool isReorderRequired(const ov::intel_cpu::MemoryDescPtr& desc1, const ov::intel_cpu::MemoryDescPtr& desc2);
bool isConfigDefined(const NodeConfig& config) const;
virtual bool canBeInPlace() const;

Expand Down

0 comments on commit 8a6bac6

Please sign in to comment.