Skip to content

[core] Fix issue reported by Coverity in core sub-component #30753

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
May 30, 2025

Conversation

praasz
Copy link
Contributor

@praasz praasz commented May 27, 2025

Details:

  • Fix most of issue in core component

Tickets:

@praasz praasz requested review from a team as code owners May 27, 2025 19:47
@praasz praasz requested review from itikhono and removed request for a team May 27, 2025 19:47
@praasz praasz added this to the 2025.3 milestone May 27, 2025
@github-actions github-actions bot added category: Core OpenVINO Core (aka ngraph) category: transformations OpenVINO Runtime library - Transformations category: CPP API OpenVINO CPP API bindings labels May 27, 2025
@praasz praasz requested a review from mitruska May 30, 2025 12:59
Copy link
Contributor

@mitruska mitruska left a comment

Choose a reason for hiding this comment

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

Overall LGTM, some minor suggestions

@@ -38,10 +38,10 @@ void GroupQueryAttention::validate_and_infer_types() {
const auto& batch_size = q_shape[0];
const auto& sequence_len = q_shape[2];
const auto& head_size = q_shape[3];
const auto& past_sequence_len = get_input_partial_shape(3)[2];
auto kv_shape = PartialShape{batch_size, m_kv_num_heads, get_input_partial_shape(3)[2], head_size};
Copy link
Contributor

Choose a reason for hiding this comment

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

Probably out of scope of this PR, but it's not ensured here that the rank of the shape is static and contains enough dimension to safely access element at index 2.

Copy link
Contributor Author

@praasz praasz May 30, 2025

Choose a reason for hiding this comment

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

Yes is out of scope for this change it was just Coverity issue fix, lets check is separately.

@@ -52,8 +52,9 @@ void GroupQueryAttention::validate_and_infer_types() {
"GroupQueryAttention only suuports f32 and f16");

set_output_type(0, element_type, PartialShape{batch_size, sequence_len, head_size * m_num_heads});
set_output_type(1, element_type, PartialShape{batch_size, m_kv_num_heads, output_kv_len, head_size});
set_output_type(2, element_type, PartialShape{batch_size, m_kv_num_heads, output_kv_len, head_size});
for (auto&& port : {1, 2}) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Isn't auto&& an overkill for the primitive int type here? ;)

Copy link
Contributor Author

@praasz praasz May 30, 2025

Choose a reason for hiding this comment

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

It will auto deduce the type, this is not r-value but it can be.

Comment on lines +374 to +379
if (auto& res_tensor = result->get_input_tensor(0); &res_tensor != &node.get_tensor()) {
// If result input tensor is not the same as node tensor, then we need to move names
// from result input tensor to node tensor
node.get_tensor().set_names(res_tensor.get_names());
res_tensor.set_names({});
}
Copy link
Contributor

Choose a reason for hiding this comment

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

As the check &res_tensor != &node.get_tensor() has been added, would it be possible to cover it with unit test?

Copy link
Contributor Author

@praasz praasz May 30, 2025

Choose a reason for hiding this comment

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

Current tests fail without it, as there is no additional copy of tensor names and set empty names just clear names.

@praasz praasz enabled auto-merge May 30, 2025 16:26
@praasz praasz added this pull request to the merge queue May 30, 2025
Merged via the queue into openvinotoolkit:master with commit ef9c8d9 May 30, 2025
202 checks passed
@praasz praasz deleted the coverity/fix-issues-in-core branch May 30, 2025 23:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category: Core OpenVINO Core (aka ngraph) category: CPP API OpenVINO CPP API bindings category: transformations OpenVINO Runtime library - Transformations
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants