Skip to content

Commit

Permalink
[Coverity] GPU Plugin Medium issues (#27761)
Browse files Browse the repository at this point in the history
### Details:
- This PR fixes: 1562334, 1559879, 1559863, 1559854, 1559677, 1559879,
1559863

- 1559461 and 1559460 are related to ov::pass::pattern::matcher in
`decompose_reduce_scalar_output.cpp`
- 1559886 and 1559881 are related to ov::pass::pattern::matcher in
`transpose_fusion.cpp`
- 1559862 is related to ov::pass::pattern::matcher in
`transpose_fusion.cpp`
- 1559698 and 1559691 are related to ov::pass::pattern::matcher in
`bcast_and_pad_zp_buffers.cpp`

- all member variables are initialized in the constructors' initializer
lists of `ov::pass::pattern::matcher` to address 1559461, 1559460,
1559886, 1559881, 1559862, 1559698, 1559691.

### Tickets:
 - [*CVS-153064*](https://jira.devtools.intel.com/browse/CVS-153064)
 - CVS-145082

---------

Co-authored-by: Pavel Durandin <[email protected]>
  • Loading branch information
mhpanah and p-durandin authored Dec 11, 2024
1 parent 8659cd2 commit 9da62a4
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 10 deletions.
39 changes: 32 additions & 7 deletions src/core/include/openvino/pass/pattern/matcher.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,20 +62,45 @@ class OPENVINO_API Matcher {
// Avoid implicit string construction from nullptr.
Matcher(const std::shared_ptr<Node> pattern_node, std::nullptr_t name) = delete;

Matcher() = default;
Matcher(Output<Node>& pattern_node) : m_pattern_node{pattern_node} {}

Matcher(Output<Node>& pattern_node, const std::string& name) : m_pattern_node(pattern_node), m_name{name} {}
Matcher()
: m_match_root{},
m_pattern_node{},
m_pattern_map{},
m_pattern_value_maps{},
m_matched_list{},
m_name{""},
m_strict_mode{false} {}
Matcher(Output<Node>& pattern_node)
: m_match_root{},
m_pattern_node{pattern_node},
m_pattern_map{},
m_pattern_value_maps{},
m_matched_list{},
m_name{""},
m_strict_mode{false} {}

Matcher(Output<Node>& pattern_node, const std::string& name)
: m_match_root{},
m_pattern_node{pattern_node},
m_pattern_map{},
m_pattern_value_maps{},
m_matched_list{},
m_name{name},
m_strict_mode{false} {}

/// \brief Constructs a Matcher object
///
/// \param pattern_node is a pattern sub graph that will be matched against input graphs
/// \param name is a string which is used for logging and disabling a matcher
/// \param strict_mode forces a matcher to consider shapes and ET of nodes
Matcher(const Output<Node>& pattern_node, const std::string& name, bool strict_mode)
: m_pattern_node(pattern_node),
m_name(name),
m_strict_mode(strict_mode) {}
: m_match_root{},
m_pattern_node{pattern_node},
m_pattern_map{},
m_pattern_value_maps{},
m_matched_list{},
m_name{name},
m_strict_mode{strict_mode} {}

// Some matches should start on a node rather than an output. These three constructors
// are transition until we work out the right way to do that.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ namespace cldnn {
struct resample : public primitive_base<resample> {
CLDNN_DECLARE_PRIMITIVE(resample)

resample() : primitive_base("", {}) {}
resample() : primitive_base("", {}), scales_port(0) {}

using InterpolateOp = ov::op::util::InterpolateBase;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ struct convolution_onednn : typed_primitive_onednn_impl<convolution> {

private:
int _zero_point_mask;
dnnl::memory::data_type _wzp_data_type;
dnnl::memory::data_type _wzp_data_type = dnnl::memory::data_type::undef;

protected:
std::unique_ptr<primitive_impl> clone() const override {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -846,9 +846,11 @@ void FullyConnected_bf_tiled::GetUpdateDispatchDataFunc(KernelData& kd) const {
// quantized input is char type
kd.internalBufferSizes.push_back(input_size);
// half type of de_quan_scale and activation sum for each quantized group
OPENVINO_ASSERT(quantize_grp_size != 0, "Error: quantize_grp_size is zero.");
kd.internalBufferSizes.push_back((input_size / quantize_grp_size) * 2 * 2);
}

OPENVINO_ASSERT(quantize_grp_size != 0, "Error: quantize_grp_size is zero.");
kd.kernels[0].params.workGroups.global = {std::max((input_size / quantize_grp_size), (size_t)1), 1, 1};
kd.kernels[0].params.workGroups.local = {16, 1, 1};
}
Expand Down Expand Up @@ -983,6 +985,7 @@ KernelsData FullyConnected_bf_tiled::GetMultiKernelsData(const Params &params,
const auto& fc_params = static_cast<const fully_connected_params&>(params);

size_t quantize_grp_size = get_dynamic_quantize_group_size(fc_params);
OPENVINO_ASSERT(quantize_grp_size != 0, "Error: quantize_grp_size is zero.");

bool bProperInput = fc_params.inputs[0].GetLayout() == dl;
if (!bProperInput && !fc_params.inputs[0].PitchesDifferFromLogicalDims()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ KVCacheFusionMatcher::KVCacheFusionMatcher() {
return false;

// TODO: Support conversion internally
if (concat_node->get_output_element_type(0) != past_node->get_output_element_type(0))
if (!concat_node || concat_node->get_output_element_type(0) != past_node->get_output_element_type(0))
return false;

auto variable = past_node->get_variable();
Expand Down

0 comments on commit 9da62a4

Please sign in to comment.