Skip to content

Commit fc0b54e

Browse files
authored
Fixed Coverity issues found in NPUW (#27552)
### Details: - *Fixed `AUTO_CAUSES_COPY` issues found in NPUW by Coverity* ### Tickets: - *EISW-146516*
1 parent e69b138 commit fc0b54e

File tree

6 files changed

+12
-15
lines changed

6 files changed

+12
-15
lines changed

src/plugins/intel_npu/src/plugin/npuw/just_sync_infer_request.cpp

-3
Original file line numberDiff line numberDiff line change
@@ -783,9 +783,6 @@ void ov::npuw::JustInferRequest::unsafe_infer(std::size_t real_idx) {
783783

784784
// Now copy the views from the output full-nway tensor to the output tensors
785785
for (std::size_t out_idx = 0u; out_idx < num_outputs; out_idx++) {
786-
const auto& oport = comp_model_desc.compiled_model->outputs()[out_idx];
787-
auto spatial_tensor_shape = oport.get_shape();
788-
789786
auto in_view = ov::npuw::util::view(m_spatial_io[real_idx].output_tails.at(out_idx),
790787
spatial.out_dim,
791788
0,

src/plugins/intel_npu/src/plugin/npuw/partitioning/patterns/compute.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -247,8 +247,8 @@ DQMatMulConv::DQMatMulConv(const std::shared_ptr<ov::npuw::online::Snapshot>& sn
247247
auto callback = [=](ov::pass::pattern::Matcher& m) {
248248
auto& node_to_output = m.get_pattern_value_map();
249249

250-
auto matched_node_param = node_to_output.at(param);
251-
auto matched_node_param2 = node_to_output.at(param2);
250+
const auto& matched_node_param = node_to_output.at(param);
251+
const auto& matched_node_param2 = node_to_output.at(param2);
252252

253253
auto matched_node_transpose_in = node_to_output.at(transpose_in).get_node_shared_ptr();
254254
auto matched_node_transpose_out = node_to_output.at(transpose_out).get_node_shared_ptr();

src/plugins/intel_npu/src/plugin/npuw/partitioning/patterns/dcoff.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -709,7 +709,7 @@ DCOFFPassReshape4::DCOFFPassReshape4(DCOffMode dcoff_mode, ov::element::Type dco
709709
auto matched_paramA = std::static_pointer_cast<ov::op::v0::Parameter>(matched_nodeA);
710710
auto matched_paramC = std::static_pointer_cast<ov::op::v0::Parameter>(matched_nodeC);
711711

712-
auto matched_out_mulply = node_to_output.at(mulply);
712+
const auto& matched_out_mulply = node_to_output.at(mulply);
713713

714714
if (ov::element::i4 == matched_paramA->get_element_type() &&
715715
(ov::element::f16 == matched_paramC->get_element_type() ||

src/plugins/intel_npu/src/plugin/npuw/partitioning/patterns/opt.cpp

+6-6
Original file line numberDiff line numberDiff line change
@@ -166,8 +166,8 @@ DQMatMulCWi::DQMatMulCWi(Context::Ref ctx) {
166166
auto matched_node_cvtw = node_to_output.at(qcvtw).get_node_shared_ptr();
167167
auto matched_node_muls = node_to_output.at(qmuls).get_node_shared_ptr();
168168
auto matched_node_mmi = node_to_output.at(qmmi).get_node_shared_ptr();
169-
auto matched_node_qcoeff_out = uat::_(node_to_output).at_or_at_or_at(qcvtc, reshapec, qcoeff);
170-
auto matched_node_muls_out = uat::_(node_to_output).at_or_at(qcvtm, qmuls);
169+
auto& matched_node_qcoeff_out = uat::_(node_to_output).at_or_at_or_at(qcvtc, reshapec, qcoeff);
170+
auto& matched_node_muls_out = uat::_(node_to_output).at_or_at(qcvtm, qmuls);
171171

172172
if (!ctx.get().mm_dq_full) {
173173
const auto& matm_mul_out_shape = matched_matmul->get_output_shape(0);
@@ -1432,7 +1432,7 @@ SliceLastMatmul::SliceLastMatmul() {
14321432
auto callback = [=](ov::pass::pattern::Matcher& m) {
14331433
auto& node_to_output = m.get_pattern_value_map();
14341434

1435-
auto matched_out_matmul = node_to_output.at(matmul);
1435+
auto& matched_out_matmul = node_to_output.at(matmul);
14361436

14371437
auto shape = matched_out_matmul.get_node()->input(0).get_shape();
14381438

@@ -1468,7 +1468,7 @@ SliceLastMatmulAdd::SliceLastMatmulAdd() {
14681468
auto callback = [=](ov::pass::pattern::Matcher& m) {
14691469
auto& node_to_output = m.get_pattern_value_map();
14701470

1471-
auto matched_out_matmul = node_to_output.at(matmul);
1471+
auto& matched_out_matmul = node_to_output.at(matmul);
14721472

14731473
auto shape = matched_out_matmul.get_node()->input(0).get_shape();
14741474

@@ -1504,7 +1504,7 @@ SliceLastMatmulTranspose::SliceLastMatmulTranspose() {
15041504
auto callback = [=](ov::pass::pattern::Matcher& m) {
15051505
auto& node_to_output = m.get_pattern_value_map();
15061506

1507-
auto matched_out_matmul = node_to_output.at(matmul);
1507+
auto& matched_out_matmul = node_to_output.at(matmul);
15081508

15091509
auto shape = matched_out_matmul.get_node()->input(0).get_shape();
15101510

@@ -1542,7 +1542,7 @@ SliceLastMatmulMultiply::SliceLastMatmulMultiply() {
15421542
auto callback = [=](ov::pass::pattern::Matcher& m) {
15431543
auto& node_to_output = m.get_pattern_value_map();
15441544

1545-
auto matched_out_matmul = node_to_output.at(matmul);
1545+
auto& matched_out_matmul = node_to_output.at(matmul);
15461546

15471547
auto shape = matched_out_matmul.get_node()->input(0).get_shape();
15481548

src/plugins/intel_npu/src/plugin/npuw/spatial.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ ov::npuw::runtime::spatial::AttentionMask::AttentionMask(std::size_t param_idx,
1313
ov::npuw::runtime::spatial::Selector::Ptr ov::npuw::runtime::spatial::AttentionMask::find(
1414
const ov::ISyncInferRequest& rq) {
1515
auto is_attn_mask = [](const ov::Output<const ov::Node>& p) {
16-
const auto shape = p.get_shape();
16+
const auto& shape = p.get_shape();
1717
return p.get_node()->get_friendly_name() == "attention_mask" &&
1818
(shape.size() == 1 || (shape.size() == 2 && shape[0] == 1));
1919
};

src/plugins/intel_npu/src/plugin/npuw/util.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,7 @@ ov::SoPtr<ov::ITensor> ov::npuw::util::view(const ov::SoPtr<ov::ITensor>& src,
336336
view_shape.push_back(to[d] - from[d]);
337337
}
338338

339-
const auto strides = src->get_strides();
339+
const auto& strides = src->get_strides();
340340
uint8_t* ptr = static_cast<uint8_t*>(src->data());
341341

342342
// Shift PTR according to the strides
@@ -352,7 +352,7 @@ ov::SoPtr<ov::ITensor> ov::npuw::util::view(const ov::SoPtr<ov::ITensor>& src,
352352
std::size_t dim,
353353
std::size_t offset,
354354
std::size_t len) {
355-
const auto shape = src->get_shape();
355+
const auto& shape = src->get_shape();
356356
View view_start = View(shape.size(), 0u);
357357
View view_end = shape;
358358
view_start[dim] = offset;

0 commit comments

Comments
 (0)