Skip to content

OpenVINO™ is an open source toolkit for optimizing and deploying AI inference

[CPU] Apply 'cppcoreguidelines-init-variables' clang-tidy remarks (#30817)

Arseniy Obolenskiy16ba56b0baf3
diff --git a/src/plugins/intel_cpu/src/.clang-tidy b/src/plugins/intel_cpu/src/.clang-tidy
index 42ada18b2e6..9c95929d3a4 100644
--- a/src/plugins/intel_cpu/src/.clang-tidy
+++ b/src/plugins/intel_cpu/src/.clang-tidy
@@ -8,7 +8,6 @@
# -cppcoreguidelines-avoid-c-arrays. There are a lot of code which uses C-style arrays
# -cppcoreguidelines-avoid-do-while. Just stylistic preference
# -cppcoreguidelines-explicit-virtual-functions. Forbids 'override final' usage
-# -cppcoreguidelines-init-variables. Too many unnecessary initializations
# -cppcoreguidelines-macro-usage. There are macros defined by OV that are matching this check
# -cppcoreguidelines-misleading-capture-default-by-value. Commonly used in the transformations code
# -cppcoreguidelines-non-private-member-variables-in-classes. There are a lot of code which uses protected members directly
@@ -80,7 +79,6 @@ Checks: >
-cppcoreguidelines-avoid-magic-numbers,
-cppcoreguidelines-avoid-non-const-global-variables,
-cppcoreguidelines-explicit-virtual-functions,
- -cppcoreguidelines-init-variables,
-cppcoreguidelines-macro-usage,
-cppcoreguidelines-misleading-capture-default-by-value,
-cppcoreguidelines-narrowing-conversions,
diff --git a/src/plugins/intel_cpu/src/cpu_map_scheduling.cpp b/src/plugins/intel_cpu/src/cpu_map_scheduling.cpp
index 5f9aa54de5e..ff8852760b8 100644
--- a/src/plugins/intel_cpu/src/cpu_map_scheduling.cpp
+++ b/src/plugins/intel_cpu/src/cpu_map_scheduling.cpp
@@ -77,7 +77,7 @@ bool check_cpu_pinning(const bool cpu_pinning,
const bool cpu_pinning_changed,
const bool cpu_reservation,
const std::vector<std::vector<int>>& streams_info_table) {
- bool result_value;
+ bool result_value = false;
#if defined(__APPLE__)
result_value = false;
diff --git a/src/plugins/intel_cpu/src/dnnl_extension_utils.cpp b/src/plugins/intel_cpu/src/dnnl_extension_utils.cpp
index d604b3c976f..93ea173684f 100644
--- a/src/plugins/intel_cpu/src/dnnl_extension_utils.cpp
+++ b/src/plugins/intel_cpu/src/dnnl_extension_utils.cpp
@@ -239,7 +239,7 @@ DnnlMemoryDescPtr DnnlExtensionUtils::query_md(const const_dnnl_primitive_desc_t
}
std::string DnnlExtensionUtils::query_impl_info_str(const const_dnnl_primitive_desc_t& pd) {
- const char* res;
+ const char* res = nullptr;
dnnl_status_t status = dnnl_primitive_desc_query(pd, dnnl_query_impl_info_str, 0, reinterpret_cast<void*>(&res));
if (status != dnnl_success) {
OPENVINO_THROW("query_impl_info_str failed.");
diff --git a/src/plugins/intel_cpu/src/emitters/snippets/x64/kernel_executors/brgemm_base.cpp b/src/plugins/intel_cpu/src/emitters/snippets/x64/kernel_executors/brgemm_base.cpp
index c82f843c046..19b5d0737fc 100644
--- a/src/plugins/intel_cpu/src/emitters/snippets/x64/kernel_executors/brgemm_base.cpp
+++ b/src/plugins/intel_cpu/src/emitters/snippets/x64/kernel_executors/brgemm_base.cpp
@@ -17,7 +17,6 @@
#include <oneapi/dnnl/dnnl.hpp>
#include <sstream>
#include <string>
-#include <tuple>
#include "common/primitive_hashing_utils.hpp"
#include "common/utils.hpp"
@@ -120,11 +119,7 @@ void BrgemmBaseKernelExecutor::update_config(const ov::snippets::lowered::Expres
const ov::snippets::lowered::LinearIRCPtr& linear_ir,
BrgemmBaseKernelConfig& config) {
// update M/N/K/beta
- int64_t M;
- int64_t N;
- int64_t K;
- int64_t beta;
- std::tie(M, N, K, beta) = BrgemmKernelExecutorHelper::get_runtime_brgemm_params(expr, linear_ir);
+ auto [M, N, K, beta] = BrgemmKernelExecutorHelper::get_runtime_brgemm_params(expr, linear_ir);
const auto LDA = snippets::utils::get_dim_stride(expr->get_input_port(0));
const auto LDC = snippets::utils::get_dim_stride(expr->get_output_port(0));
diff --git a/src/plugins/intel_cpu/src/emitters/snippets/x64/kernel_executors/brgemm_copy_b.cpp b/src/plugins/intel_cpu/src/emitters/snippets/x64/kernel_executors/brgemm_copy_b.cpp
index 42b993b6735..008b746fa20 100644
--- a/src/plugins/intel_cpu/src/emitters/snippets/x64/kernel_executors/brgemm_copy_b.cpp
+++ b/src/plugins/intel_cpu/src/emitters/snippets/x64/kernel_executors/brgemm_copy_b.cpp
@@ -408,10 +408,10 @@ void BrgemmCopyBKernelExecutor::update_config(const ov::snippets::lowered::Expre
}
};
- size_t K_dim;
- size_t K_blk;
- size_t N_dim;
- size_t N_blk;
+ size_t K_dim = 0;
+ size_t K_blk = 0;
+ size_t N_dim = 0;
+ size_t N_blk = 0;
// Dimension K
init(K_dim, K_blk, 1);
// Dimension N
diff --git a/src/plugins/intel_cpu/src/emitters/snippets/x64/verbose.cpp b/src/plugins/intel_cpu/src/emitters/snippets/x64/verbose.cpp
index afc92ae9cae..27b5c372365 100644
--- a/src/plugins/intel_cpu/src/emitters/snippets/x64/verbose.cpp
+++ b/src/plugins/intel_cpu/src/emitters/snippets/x64/verbose.cpp
@@ -47,7 +47,7 @@ std::string vector_to_string(const T& v) {
std::string get_emitter_type_name(const jit_emitter* emitter) {
std::string name = typeid(*emitter).name();
# ifndef _WIN32
- int status;
+ int status = 0;
std::unique_ptr<char, void (*)(void*)> demangled_name(abi::__cxa_demangle(name.c_str(), nullptr, nullptr, &status),
std::free);
name = demangled_name.get();
diff --git a/src/plugins/intel_cpu/src/emitters/tpp/common/kernel_executors/brgemm.cpp b/src/plugins/intel_cpu/src/emitters/tpp/common/kernel_executors/brgemm.cpp
index ffc23f1050e..a49b0fac5da 100644
--- a/src/plugins/intel_cpu/src/emitters/tpp/common/kernel_executors/brgemm.cpp
+++ b/src/plugins/intel_cpu/src/emitters/tpp/common/kernel_executors/brgemm.cpp
@@ -139,11 +139,7 @@ std::shared_ptr<BrgemmTppCompiledKernel> BrgemmKernelExecutor::compile_kernel(co
void BrgemmKernelExecutor::update_config(const ov::snippets::lowered::ExpressionPtr& expr,
const ov::snippets::lowered::LinearIRCPtr& linear_ir,
BrgemmKernelConfig& config) const {
- int64_t M;
- int64_t N;
- int64_t K;
- int64_t beta;
- std::tie(M, N, K, beta) = BrgemmKernelExecutorHelper::get_runtime_brgemm_params(expr, linear_ir);
+ auto [M, N, K, beta] = BrgemmKernelExecutorHelper::get_runtime_brgemm_params(expr, linear_ir);
const auto& tpp_mod = std::dynamic_pointer_cast<tpp::modifier::TensorProcessingPrimitive>(expr->get_node());
auto replace_full_dim = [](size_t dim, size_t replace_dim) {
if (ov::snippets::utils::is_full_dim_value(dim)) {
diff --git a/src/plugins/intel_cpu/src/nodes/adaptive_pooling.cpp b/src/plugins/intel_cpu/src/nodes/adaptive_pooling.cpp
index bfbcdbe5afe..cc7f6bc9586 100644
--- a/src/plugins/intel_cpu/src/nodes/adaptive_pooling.cpp
+++ b/src/plugins/intel_cpu/src/nodes/adaptive_pooling.cpp
@@ -220,12 +220,12 @@ void AdaptivePooling::execute([[maybe_unused]] const dnnl::stream& strm) {
std::function<void(const float*, float*, int, int, int, size_t)> pool;
auto poolMax = [&](const float* srcData, float* dstData, int od, int oh, int ow, size_t spatIndOff) {
- size_t dStart;
- size_t dEnd;
- size_t hStart;
- size_t hEnd;
- size_t wStart;
- size_t wEnd;
+ size_t dStart = 0;
+ size_t dEnd = 0;
+ size_t hStart = 0;
+ size_t hEnd = 0;
+ size_t wStart = 0;
+ size_t wEnd = 0;
setBinBorders(&dStart, &dEnd, od, ID, OD);
setBinBorders(&hStart, &hEnd, oh, IH, OH);
setBinBorders(&wStart, &wEnd, ow, IW, OW);
@@ -246,12 +246,12 @@ void AdaptivePooling::execute([[maybe_unused]] const dnnl::stream& strm) {
};
auto poolAvg =
[&](const float* srcData, float* dstData, int od, int oh, int ow, [[maybe_unused]] size_t spatIndOff) {
- size_t dStart;
- size_t dEnd;
- size_t hStart;
- size_t hEnd;
- size_t wStart;
- size_t wEnd;
+ size_t dStart = 0;
+ size_t dEnd = 0;
+ size_t hStart = 0;
+ size_t hEnd = 0;
+ size_t wStart = 0;
+ size_t wEnd = 0;
setBinBorders(&dStart, &dEnd, od, ID, OD);
setBinBorders(&hStart, &hEnd, oh, IH, OH);
setBinBorders(&wStart, &wEnd, ow, IW, OW);
diff --git a/src/plugins/intel_cpu/src/nodes/bin_conv.cpp b/src/plugins/intel_cpu/src/nodes/bin_conv.cpp
index 57f1977b47e..ecb2fa8012a 100644
--- a/src/plugins/intel_cpu/src/nodes/bin_conv.cpp
+++ b/src/plugins/intel_cpu/src/nodes/bin_conv.cpp
@@ -776,22 +776,22 @@ private:
auto vmm_dst = Vmm(1 + r * jcp_.ur_w * jcp_.nb_oc_blocking + jj);
if (isa == x64::avx512_core) {
- size_t o_off;
- if (jcp_.with_dw_conv) {
- o_off = jj * jcp_.oc_block;
- } else {
- o_off = jj * jcp_.oc * jcp_.ngroups;
- }
+ size_t o_off = [&] {
+ if (jcp_.with_dw_conv) {
+ return jj * jcp_.oc_block;
+ }
+ return jj * jcp_.oc * jcp_.ngroups;
+ }();
uni_vmovups(ptr[reg_output + o_off * jcp_.typesize_out], vmm_dst | ktail_mask);
} else {
for (int oc = 0; oc < tail_size; oc++) {
- size_t o_off;
- if (jcp_.with_dw_conv) {
- o_off = jj * jcp_.oc_block + oc + r * (jcp_.oc_block / 2);
- } else {
- o_off = jj * jcp_.oc * jcp_.ngroups + r * (jcp_.oc_block / 2) + oc;
- }
+ size_t o_off = [&] {
+ if (jcp_.with_dw_conv) {
+ return jj * jcp_.oc_block + oc + r * (jcp_.oc_block / 2);
+ }
+ return jj * jcp_.oc * jcp_.ngroups + r * (jcp_.oc_block / 2) + oc;
+ }();
store_dst(ptr[reg_output + o_off * jcp_.typesize_out], vmm_dst, true);
@@ -811,7 +811,7 @@ private:
for (int jj = 0; jj < ur_w; jj++) {
auto vmm_dst = Vmm(1 + r * jcp_.ur_w * jcp_.nb_oc_blocking + ur_w * ii + jj);
- size_t o_off;
+ size_t o_off = 0;
if (jcp_.with_dw_conv) {
o_off = (static_cast<size_t>(ii) * jcp_dw_conv_.kh * jcp_.ow + jj) * jcp_.oc_block +
r * (jcp_.oc_block / 2);
@@ -1369,7 +1369,7 @@ void BinaryConvolution::executeReference(const uint8_t* src,
widx = with_groups ? g * w_str[0] + oc * w_str[1] + ic * w_str[2] + kh * w_str[3] + kw * w_str[4]
: oc * w_str[0] + ic * w_str[1] + kh * w_str[2] + kw * w_str[3];
- uint8_t s;
+ uint8_t s = 0;
if (ih < 0 || ih >= IH || iw < 0 || iw >= IW) {
if (pad_value == 0) {
continue;
@@ -1392,20 +1392,20 @@ void BinaryConvolution::executeReference(const uint8_t* src,
int32_t a = 0;
ker(a, g, mb, oc, oh, ow);
- float base_value;
- if (pad_value == 0.0F) {
- const int i_left_overflow = nstl::max(0, (padL - ow * KSW));
- const int i_right_overflow = nstl::max(IW, (ow * KSW + (KW - 1) * (KDW + 1) - padL + 1)) - IW;
- const int kw_padding = KW - div_up(i_left_overflow, (KDW + 1)) - div_up(i_right_overflow, (KDW + 1));
+ auto base_value = [&]() -> float {
+ if (pad_value == 0.0F) {
+ const int i_left_overflow = nstl::max(0, (padL - ow * KSW));
+ const int i_right_overflow = nstl::max(IW, (ow * KSW + (KW - 1) * (KDW + 1) - padL + 1)) - IW;
+ const int kw_padding = KW - div_up(i_left_overflow, (KDW + 1)) - div_up(i_right_overflow, (KDW + 1));
- const int i_top_overflow = nstl::max(0, (padT - oh * KSH));
- const int i_bottom_overflow = nstl::max(IH, (oh * KSH + (KH - 1) * (KDH + 1) - padT + 1)) - IH;
- const int kh_padding = KH - div_up(i_top_overflow, (KDH + 1)) - div_up(i_bottom_overflow, (KDH + 1));
+ const int i_top_overflow = nstl::max(0, (padT - oh * KSH));
+ const int i_bottom_overflow = nstl::max(IH, (oh * KSH + (KH - 1) * (KDH + 1) - padT + 1)) - IH;
+ const int kh_padding = KH - div_up(i_top_overflow, (KDH + 1)) - div_up(i_bottom_overflow, (KDH + 1));
- base_value = IC * kh_padding * kw_padding;
- } else {
- base_value = IC * KH * KW;
- }
+ return IC * kh_padding * kw_padding;
+ }
+ return IC * KH * KW;
+ }();
float a_fp = base_value - static_cast<float>(2 * a);
diff --git a/src/plugins/intel_cpu/src/nodes/color_convert.cpp b/src/plugins/intel_cpu/src/nodes/color_convert.cpp
index 1ffadf3d156..133a0fb8393 100644
--- a/src/plugins/intel_cpu/src/nodes/color_convert.cpp
+++ b/src/plugins/intel_cpu/src/nodes/color_convert.cpp
@@ -993,7 +993,7 @@ const VectorDims& ColorConvert::Converter::inputDims(size_t idx) const {
}
bool ColorConvert::isSupportedOperation(const std::shared_ptr<const ov::Node>& op, std::string& errorMessage) noexcept {
- Algorithm alg;
+ Algorithm alg{};
std::tie(alg, errorMessage) = getAlgorithmFor(op);
return alg != Algorithm::Default;
}
diff --git a/src/plugins/intel_cpu/src/nodes/common/cpu_convert.cpp b/src/plugins/intel_cpu/src/nodes/common/cpu_convert.cpp
index c192ced62b8..25b0ccce61d 100644
--- a/src/plugins/intel_cpu/src/nodes/common/cpu_convert.cpp
+++ b/src/plugins/intel_cpu/src/nodes/common/cpu_convert.cpp
@@ -446,36 +446,29 @@ private:
template <typename T, typename U>
const std::tuple<U, U>& Range<T, U>::fit(const ov::element::Type& prec) {
if (prec.is_real()) {
- double lbound;
- double ubound;
- switch (prec) {
- case ov::element::f8e4m3:
- lbound = static_cast<double>(std::numeric_limits<ov::float8_e4m3>::lowest());
- ubound = static_cast<double>(std::numeric_limits<ov::float8_e4m3>::max());
- break;
- case ov::element::f8e5m2:
- lbound = static_cast<double>(std::numeric_limits<ov::float8_e5m2>::lowest());
- ubound = static_cast<double>(std::numeric_limits<ov::float8_e5m2>::max());
- break;
- case ov::element::bf16:
- lbound = static_cast<double>(std::numeric_limits<ov::intel_cpu::bfloat16_t>::lowest());
- ubound = static_cast<double>(std::numeric_limits<ov::intel_cpu::bfloat16_t>::max());
- break;
- case ov::element::f16:
- lbound = static_cast<double>(std::numeric_limits<ov::float16>::lowest());
- ubound = static_cast<double>(std::numeric_limits<ov::float16>::max());
- break;
- case ov::element::f32:
- lbound = static_cast<double>(std::numeric_limits<float>::lowest());
- ubound = static_cast<double>(std::numeric_limits<float>::max());
- break;
- case ov::element::f64:
- lbound = std::numeric_limits<double>::lowest();
- ubound = std::numeric_limits<double>::max();
- break;
- default:
- OPENVINO_THROW("Unsupported precision");
- }
+ auto [lbound, ubound] = [&]() {
+ switch (prec) {
+ case ov::element::f8e4m3:
+ return std::make_tuple(static_cast<double>(std::numeric_limits<ov::float8_e4m3>::lowest()),
+ static_cast<double>(std::numeric_limits<ov::float8_e4m3>::max()));
+ case ov::element::f8e5m2:
+ return std::make_tuple(static_cast<double>(std::numeric_limits<ov::float8_e5m2>::lowest()),
+ static_cast<double>(std::numeric_limits<ov::float8_e5m2>::max()));
+ case ov::element::bf16:
+ return std::make_tuple(static_cast<double>(std::numeric_limits<ov::intel_cpu::bfloat16_t>::lowest()),
+ static_cast<double>(std::numeric_limits<ov::intel_cpu::bfloat16_t>::max()));
+ case ov::element::f16:
+ return std::make_tuple(static_cast<double>(std::numeric_limits<ov::float16>::lowest()),
+ static_cast<double>(std::numeric_limits<ov::float16>::max()));
+ case ov::element::f32:
+ return std::make_tuple(static_cast<double>(std::numeric_limits<float>::lowest()),
+ static_cast<double>(std::numeric_limits<float>::max()));
+ case ov::element::f64:
+ return std::make_tuple(std::numeric_limits<double>::lowest(), std::numeric_limits<double>::max());
+ default:
+ OPENVINO_THROW("Unsupported precision");
+ }
+ }();
// If U is integral, its range always less than float, so not need update _range
// Else it will be overflow, for example static_cast double to int64_t:
// int64_t ubound = 9223372036854775807
@@ -486,48 +479,39 @@ const std::tuple<U, U>& Range<T, U>::fit(const ov::element::Type& prec) {
std::get<1>(_range) = static_cast<U>(std::min(static_cast<double>(std::get<1>(_range)), ubound));
}
} else {
- int64_t lbound;
- uint64_t ubound;
- switch (prec) {
- case ov::element::boolean:
- lbound = static_cast<int64_t>(std::numeric_limits<bool>::lowest());
- ubound = static_cast<uint64_t>(std::numeric_limits<bool>::max());
- break;
- case ov::element::u8:
- lbound = static_cast<int64_t>(std::numeric_limits<uint8_t>::lowest());
- ubound = static_cast<uint64_t>(std::numeric_limits<uint8_t>::max());
- break;
- case ov::element::i8:
- lbound = static_cast<int64_t>(std::numeric_limits<int8_t>::lowest());
- ubound = static_cast<uint64_t>(std::numeric_limits<int8_t>::max());
- break;
- case ov::element::u16:
- lbound = static_cast<int64_t>(std::numeric_limits<uint16_t>::lowest());
- ubound = static_cast<uint64_t>(std::numeric_limits<uint16_t>::max());
- break;
- case ov::element::i16:
- lbound = static_cast<int64_t>(std::numeric_limits<int16_t>::lowest());
- ubound = static_cast<uint64_t>(std::numeric_limits<int16_t>::max());
- break;
- case ov::element::u32:
- lbound = static_cast<int64_t>(std::numeric_limits<uint32_t>::lowest());
- ubound = static_cast<uint64_t>(std::numeric_limits<uint32_t>::max());
- break;
- case ov::element::i32:
- lbound = static_cast<int64_t>(std::numeric_limits<int32_t>::lowest());
- ubound = static_cast<uint64_t>(std::numeric_limits<int32_t>::max());
- break;
- case ov::element::u64:
- lbound = static_cast<int64_t>(std::numeric_limits<uint64_t>::lowest());
- ubound = static_cast<uint64_t>(std::numeric_limits<uint64_t>::max());
- break;
- case ov::element::i64:
- lbound = static_cast<int64_t>(std::numeric_limits<int64_t>::lowest());
- ubound = static_cast<uint64_t>(std::numeric_limits<int64_t>::max());
- break;
- default:
- OPENVINO_THROW("Unsupported precision");
- }
+ auto [lbound, ubound] = [&]() {
+ switch (prec) {
+ case ov::element::boolean:
+ return std::make_tuple(static_cast<int64_t>(std::numeric_limits<bool>::lowest()),
+ static_cast<uint64_t>(std::numeric_limits<bool>::max()));
+ case ov::element::u8:
+ return std::make_tuple(static_cast<int64_t>(std::numeric_limits<uint8_t>::lowest()),
+ static_cast<uint64_t>(std::numeric_limits<uint8_t>::max()));
+ case ov::element::i8:
+ return std::make_tuple(static_cast<int64_t>(std::numeric_limits<int8_t>::lowest()),
+ static_cast<uint64_t>(std::numeric_limits<int8_t>::max()));
+ case ov::element::u16:
+ return std::make_tuple(static_cast<int64_t>(std::numeric_limits<uint16_t>::lowest()),
+ static_cast<uint64_t>(std::numeric_limits<uint16_t>::max()));
+ case ov::element::i16:
+ return std::make_tuple(static_cast<int64_t>(std::numeric_limits<int16_t>::lowest()),
+ static_cast<uint64_t>(std::numeric_limits<int16_t>::max()));
+ case ov::element::u32:
+ return std::make_tuple(static_cast<int64_t>(std::numeric_limits<uint32_t>::lowest()),
+ static_cast<uint64_t>(std::numeric_limits<uint32_t>::max()));
+ case ov::element::i32:
+ return std::make_tuple(static_cast<int64_t>(std::numeric_limits<int32_t>::lowest()),
+ static_cast<uint64_t>(std::numeric_limits<int32_t>::max()));
+ case ov::element::u64:
+ return std::make_tuple(static_cast<int64_t>(std::numeric_limits<uint64_t>::lowest()),
+ static_cast<uint64_t>(std::numeric_limits<uint64_t>::max()));
+ case ov::element::i64:
+ return std::make_tuple(static_cast<int64_t>(std::numeric_limits<int64_t>::lowest()),
+ static_cast<uint64_t>(std::numeric_limits<int64_t>::max()));
+ default:
+ OPENVINO_THROW("Unsupported precision");
+ }
+ }();
using ltype = std::conditional_t<std::is_floating_point<U>::value, double, int64_t>;
using utype = std::conditional_t<std::is_floating_point<U>::value, double, uint64_t>;
std::get<0>(_range) =
@@ -562,9 +546,7 @@ struct ConvertPrecision<std::tuple<src_t, dst_t>> {
void operator()(ConvertContext& ctx) {
auto src = static_cast<const src_t*>(ctx.srcPtr);
auto dst = static_cast<dst_t*>(ctx.dstPtr);
- src_t lbound;
- src_t ubound;
- std::tie(lbound, ubound) = ctx.range<src_t>();
+ auto [lbound, ubound] = ctx.range<src_t>();
// Align with the behavior of ngraph ref and jit implementation. Conversion from f8e4m3-inf
// to float should output float-inf instead of f8e4m3-max. Proper handling of special values
@@ -579,11 +561,11 @@ struct ConvertPrecision<std::tuple<src_t, dst_t>> {
}
if (std::is_integral<src_t>::value || ctx.interimPrc.is_real() || std::is_integral<dst_t>::value) {
- parallel_for(ctx.size, [&](size_t i) {
+ parallel_for(ctx.size, [&, lbound = lbound, ubound = ubound](size_t i) {
dst[i] = static_cast<dst_t>(std::max(std::min(src[i], ubound), lbound));
});
} else {
- parallel_for(ctx.size, [&](size_t i) {
+ parallel_for(ctx.size, [&, lbound = lbound, ubound = ubound](size_t i) {
dst[i] = static_cast<dst_t>(std::trunc(std::max(std::min(src[i], ubound), lbound)));
});
}
@@ -603,10 +585,8 @@ struct ConvertPrecision<std::tuple<float, ov::intel_cpu::bfloat16_t>> {
dst[i] = static_cast<ov::intel_cpu::bfloat16_t>(src[i]);
});
} else {
- float lbound;
- float ubound;
- std::tie(lbound, ubound) = ctx.range<float>();
- parallel_for(ctx.size, [&](size_t i) {
+ auto [lbound, ubound] = ctx.range<float>();
+ parallel_for(ctx.size, [&, lbound = lbound, ubound = ubound](size_t i) {
dst[i] = static_cast<ov::intel_cpu::bfloat16_t>(std::trunc(std::max(std::min(src[i], ubound), lbound)));
});
}
@@ -626,10 +606,8 @@ struct ConvertPrecision<std::tuple<ov::intel_cpu::bfloat16_t, float>> {
dst[i] = static_cast<float>(src[i]);
});
} else {
- float lbound;
- float ubound;
- std::tie(lbound, ubound) = ctx.range<ov::intel_cpu::bfloat16_t>();
- parallel_for(ctx.size, [&](size_t i) {
+ auto [lbound, ubound] = static_cast<std::tuple<float, float>>(ctx.range<ov::intel_cpu::bfloat16_t>());
+ parallel_for(ctx.size, [&, lbound = lbound, ubound = ubound](size_t i) {
dst[i] = std::trunc(std::max(std::min(static_cast<float>(src[i]), ubound), lbound));
});
}
@@ -649,12 +627,10 @@ struct ConvertPrecision<std::tuple<src_t, ov::float16>> {
const size_t iterations = ov::intel_cpu::div_up(ctx.size, batch);
typedef float batch_type[batch];
- src_t lbound;
- src_t ubound;
- std::tie(lbound, ubound) = ctx.range<src_t>();
+ auto [lbound, ubound] = ctx.range<src_t>();
if (std::is_integral<src_t>::value) {
- parallel_for(iterations, [&](size_t i) {
+ parallel_for(iterations, [&, lbound = lbound, ubound = ubound](size_t i) {
batch_type tmp;
const size_t offset = i * batch;
const size_t current_batch_size = std::min(ctx.size - offset, batch);
@@ -678,7 +654,7 @@ struct ConvertPrecision<std::tuple<src_t, ov::float16>> {
}
});
} else {
- parallel_for(iterations, [&](size_t i) {
+ parallel_for(iterations, [&, lbound = lbound, ubound = ubound](size_t i) {
batch_type tmp;
const size_t offset = i * batch;
const size_t current_batch_size = std::min(ctx.size - offset, batch);
@@ -703,12 +679,10 @@ struct ConvertPrecision<std::tuple<ov::float16, dst_t>> {
const size_t iterations = ov::intel_cpu::div_up(ctx.size, batch);
typedef float batch_type[batch];
- float lbound;
- float ubound;
- std::tie(lbound, ubound) = ctx.range<ov::float16>();
+ auto [lbound, ubound] = static_cast<std::tuple<float, float>>(ctx.range<ov::float16>());
if (std::is_integral<dst_t>::value) {
- parallel_for(iterations, [&](size_t i) {
+ parallel_for(iterations, [&, lbound = lbound, ubound = ubound](size_t i) {
batch_type tmp;
const size_t offset = i * batch;
const size_t current_batch_size = std::min(ctx.size - offset, batch);
@@ -732,7 +706,7 @@ struct ConvertPrecision<std::tuple<ov::float16, dst_t>> {
}
});
} else {
- parallel_for(iterations, [&](size_t i) {
+ parallel_for(iterations, [&, lbound = lbound, ubound = ubound](size_t i) {
batch_type tmp;
const size_t offset = i * batch;
const size_t current_batch_size = std::min(ctx.size - offset, batch);
@@ -757,14 +731,12 @@ struct ConvertPrecision<std::tuple<ov::float16, ov::float16>> {
const size_t iterations = ov::intel_cpu::div_up(ctx.size, batch);
typedef float batch_type[batch];
- float lbound;
- float ubound;
- std::tie(lbound, ubound) = ctx.range<ov::float16>();
+ auto [lbound, ubound] = static_cast<std::tuple<float, float>>(ctx.range<ov::float16>());
if (ctx.interimPrc.is_real()) {
cpu_memcpy(dst, src, ctx.size * sizeof(ov::float16));
} else {
- parallel_for(iterations, [&](size_t i) {
+ parallel_for(iterations, [&, lbound = lbound, ubound = ubound](size_t i) {
batch_type tmp;
const size_t offset = i * batch;
const size_t current_batch_size = std::min(ctx.size - offset, batch);
diff --git a/src/plugins/intel_cpu/src/nodes/def_conv.cpp b/src/plugins/intel_cpu/src/nodes/def_conv.cpp
index e2c88690335..581da77d70a 100644
--- a/src/plugins/intel_cpu/src/nodes/def_conv.cpp
+++ b/src/plugins/intel_cpu/src/nodes/def_conv.cpp
@@ -993,7 +993,7 @@ void DeformableConvolution::DefConvExecutor::prepareSamplingWeights(const float*
const float offset_w = data_offset_ptr[data_offset_w_index];
float map_h = h_in + kh * (KDH + 1) + offset_h;
float map_w = w_in + kw * (KDW + 1) + offset_w;
- bool skip_compute;
+ bool skip_compute = false;
if (with_bi_pad) {
skip_compute = static_cast<int>(map_w) <= -1 || static_cast<int>(map_w) >= IW ||
static_cast<int>(map_h) <= -1 || static_cast<int>(map_h) >= IH;
diff --git a/src/plugins/intel_cpu/src/nodes/depth_to_space.cpp b/src/plugins/intel_cpu/src/nodes/depth_to_space.cpp
index d5abe0694c9..48f02b25990 100644
--- a/src/plugins/intel_cpu/src/nodes/depth_to_space.cpp
+++ b/src/plugins/intel_cpu/src/nodes/depth_to_space.cpp
@@ -275,8 +275,8 @@ DepthToSpace::DepthToSpaceExecutor::DepthToSpaceExecutor(const DepthToSpaceAttrs
};
if (isBlocked) {
- size_t orderShiftForBlocks;
- size_t orderShiftForDims;
+ size_t orderShiftForBlocks = 0;
+ size_t orderShiftForDims = 0;
if (attrs.mode == Mode::BLOCKS_FIRST) {
orderShiftForBlocks = 1;
orderShiftForDims = attrs.nSpatialDims + 2;
diff --git a/src/plugins/intel_cpu/src/nodes/detection_output.cpp b/src/plugins/intel_cpu/src/nodes/detection_output.cpp
index 2c0d204bbff..a84afa2014f 100644
--- a/src/plugins/intel_cpu/src/nodes/detection_output.cpp
+++ b/src/plugins/intel_cpu/src/nodes/detection_output.cpp
@@ -12,6 +12,7 @@
#include <mutex>
#include <oneapi/dnnl/dnnl_common.hpp>
#include <string>
+#include <tuple>
#include <utility>
#include <vector>
@@ -374,8 +375,8 @@ void DetectionOutput::execute([[maybe_unused]] const dnnl::stream& strm) {
confFilterCF(pconfReorder, pindices, pbuffer, pdetections, n);
}
- const float* pboxes;
- const float* psizes;
+ const float* pboxes = nullptr;
+ const float* psizes = nullptr;
if (isShareLoc) {
pboxes = decodedBboxesData + n * 4 * priorsNum;
psizes = bboxSizesData + n * priorsNum;
@@ -808,24 +809,20 @@ inline void DetectionOutput::decodeBBoxes(const float* priorData,
float priorCenterX = (priorXMin + priorXMax) / 2.0F;
float priorCenterY = (priorYMin + priorYMax) / 2.0F;
- float decodeBboxCenterX;
- float decodeBboxCenterY;
- float decodeBboxWidth;
- float decodeBboxHeight;
-
- if (varianceEncodedInTarget) {
- // variance is encoded in target, we simply need to restore the offset predictions.
- decodeBboxCenterX = locXMin * priorWidth + priorCenterX;
- decodeBboxCenterY = locYMin * priorHeight + priorCenterY;
- decodeBboxWidth = std::exp(locXMax) * priorWidth;
- decodeBboxHeight = std::exp(locYMax) * priorHeight;
- } else {
+ auto [decodeBboxCenterX, decodeBboxCenterY, decodeBboxWidth, decodeBboxHeight] = [&] {
+ if (varianceEncodedInTarget) {
+ // variance is encoded in target, we simply need to restore the offset predictions.
+ return std::tuple{locXMin * priorWidth + priorCenterX,
+ locYMin * priorHeight + priorCenterY,
+ std::exp(locXMax) * priorWidth,
+ std::exp(locYMax) * priorHeight};
+ }
// variance is encoded in bbox, we need to scale the offset accordingly.
- decodeBboxCenterX = varianceData[p * 4 + 0] * locXMin * priorWidth + priorCenterX;
- decodeBboxCenterY = varianceData[p * 4 + 1] * locYMin * priorHeight + priorCenterY;
- decodeBboxWidth = std::exp(varianceData[p * 4 + 2] * locXMax) * priorWidth;
- decodeBboxHeight = std::exp(varianceData[p * 4 + 3] * locYMax) * priorHeight;
- }
+ return std::tuple{varianceData[p * 4 + 0] * locXMin * priorWidth + priorCenterX,
+ varianceData[p * 4 + 1] * locYMin * priorHeight + priorCenterY,
+ std::exp(varianceData[p * 4 + 2] * locXMax) * priorWidth,
+ std::exp(varianceData[p * 4 + 3] * locYMax) * priorHeight};
+ }();
newXMin = decodeBboxCenterX - decodeBboxWidth / 2.0F;
newYMin = decodeBboxCenterY - decodeBboxHeight / 2.0F;
diff --git a/src/plugins/intel_cpu/src/nodes/dft.cpp b/src/plugins/intel_cpu/src/nodes/dft.cpp
index d998fdea1ec..bb95533b2de 100644
--- a/src/plugins/intel_cpu/src/nodes/dft.cpp
+++ b/src/plugins/intel_cpu/src/nodes/dft.cpp
@@ -297,7 +297,7 @@ void DFT::execute([[maybe_unused]] const dnnl::stream& strm) {
size_t nComplex = outputShape[0];
if (IsPowerOfTwo(nComplex)) {
std::vector<float> outputData(nComplex * 2);
- const float* resultBufPtr;
+ const float* resultBufPtr = nullptr;
fft(dst, outputData.data(), nComplex * 2, inverse, true, &resultBufPtr);
@@ -339,7 +339,7 @@ void DFT::dftNd(float* output,
parallelIterationCounter,
outputShape,
outputStrides);
- const float* resultBufPtr;
+ const float* resultBufPtr = nullptr;
fft(gatheredData.data(), gatheredData.data() + outputLen, outputLen, inverse, false, &resultBufPtr);
applyBufferND(resultBufPtr,
output,
@@ -421,7 +421,7 @@ void DFT::fft(float* inBuffer,
};
}
- size_t blockSize;
+ size_t blockSize = 0;
size_t nextIterationBlockSize = dataLength;
for (size_t numBlocks = 1; numBlocks < nComplex; numBlocks *= 2) {
blockSize = nextIterationBlockSize;
diff --git a/src/plugins/intel_cpu/src/nodes/eltwise.cpp b/src/plugins/intel_cpu/src/nodes/eltwise.cpp
index 6fee1939100..c46ea7dcb46 100644
--- a/src/plugins/intel_cpu/src/nodes/eltwise.cpp
+++ b/src/plugins/intel_cpu/src/nodes/eltwise.cpp
@@ -465,8 +465,8 @@ struct EltwiseKey {
if (result) {
if (implType == EltwiseImplType::optimizedShapeAgnostic) {
- bool broadcast;
- bool rhsBroadcast;
+ bool broadcast = false;
+ bool rhsBroadcast = false;
for (size_t i = 0; i < inpDims.size(); ++i) {
broadcast = (inpDims[i].back() == 1);
rhsBroadcast = (rhs.inpDims[i].back() == 1);
@@ -1129,7 +1129,7 @@ public:
for (size_t iwork = start; iwork < end; ++iwork) {
std::vector<T> src_f(this->_inputNum);
- T* dst_ptr_f;
+ T* dst_ptr_f = nullptr;
this->init_ptr(args_ptrs, dims_out, counters, iwork, src_f, dst_ptr_f);
switch (this->_opData.algo) {
@@ -1284,7 +1284,7 @@ public:
for (size_t iwork = start; iwork < end; ++iwork) {
std::vector<T> src_f(this->_inputNum);
- T* dst_ptr_f;
+ T* dst_ptr_f = nullptr;
this->init_ptr(args_ptrs, dims_out, counters, iwork, src_f, dst_ptr_f);
switch (this->_opData.algo) {
diff --git a/src/plugins/intel_cpu/src/nodes/executors/acl/acl_ie_scheduler.cpp b/src/plugins/intel_cpu/src/nodes/executors/acl/acl_ie_scheduler.cpp
index 2afc0247c09..1fd8955b27b 100644
--- a/src/plugins/intel_cpu/src/nodes/executors/acl/acl_ie_scheduler.cpp
+++ b/src/plugins/intel_cpu/src/nodes/executors/acl/acl_ie_scheduler.cpp
@@ -51,15 +51,15 @@ void ACLScheduler::schedule_custom(ICPPKernel* kernel, const Hints& hints, const
const unsigned int num_iterations = m * n;
const auto num_threads = get_num_threads(num_iterations);
- unsigned m_threads, n_threads;
- std::tie(m_threads, n_threads) = scheduler_utils::split_2d(num_threads, m, n);
+ auto [m_threads, n_threads] = scheduler_utils::split_2d(num_threads, m, n);
+
unsigned int max_parallelism = std::min<unsigned int>(m, m_threads) * std::min<unsigned int>(n, n_threads);
if (max_parallelism < num_threads) {
m_threads = std::min<unsigned int>(m, m_threads);
n_threads = std::min<unsigned int>(n, n_threads);
}
- ov::parallel_for(m_threads * n_threads, [&](int wid) {
+ ov::parallel_for(m_threads * n_threads, [&, m_threads = m_threads, n_threads = n_threads](int wid) {
int mi = wid / n_threads;
int ni = wid % n_threads;
Window win = max_window.split_window(Window::DimX, mi, m_threads).split_window(Window::DimY, ni, n_threads);
diff --git a/src/plugins/intel_cpu/src/nodes/executors/acl/acl_mvn.cpp b/src/plugins/intel_cpu/src/nodes/executors/acl/acl_mvn.cpp
index d7e13e50fb9..4315edc8310 100644
--- a/src/plugins/intel_cpu/src/nodes/executors/acl/acl_mvn.cpp
+++ b/src/plugins/intel_cpu/src/nodes/executors/acl/acl_mvn.cpp
@@ -17,7 +17,7 @@ bool AclMVNExecutor::init(const MVNAttrs& mvnAttrs,
auto srcDims = srcDescs[0]->getShape().getStaticDims();
auto dstDims = dstDescs[0]->getShape().getStaticDims();
- size_t X, Y;
+ size_t X = 0, Y = 0;
if (mvnAttrs.initAcrossChannels_) {
if (srcDims.size() >= 2u) {
Y = srcDims[0];
diff --git a/src/plugins/intel_cpu/src/nodes/executors/dnnl/dnnl_convolution_primitive.cpp b/src/plugins/intel_cpu/src/nodes/executors/dnnl/dnnl_convolution_primitive.cpp
index 71e2f2c1d9a..01b23b16a2c 100644
--- a/src/plugins/intel_cpu/src/nodes/executors/dnnl/dnnl_convolution_primitive.cpp
+++ b/src/plugins/intel_cpu/src/nodes/executors/dnnl/dnnl_convolution_primitive.cpp
@@ -931,12 +931,7 @@ bool DnnlConvolutionPrimitive::isNspcAvailable(const ConvConfig& config) {
auto outDims = config.descs.at(ARG_DST)->getShape().getDims();
auto ndims = inpDims.size();
- size_t groupNum;
- size_t groupIC;
- size_t groupOC;
- size_t IC;
-
- std::tie(groupNum, groupIC, groupOC, IC) = getChannelParams(config);
+ auto [groupNum, groupIC, groupOC, IC] = getChannelParams(config);
bool isDepthWise = config.attrs.isGrouped && 1 == groupOC && 1 == groupIC;
diff --git a/src/plugins/intel_cpu/src/nodes/executors/interpolate.cpp b/src/plugins/intel_cpu/src/nodes/executors/interpolate.cpp
index 820f2311246..c4180ef42eb 100644
--- a/src/plugins/intel_cpu/src/nodes/executors/interpolate.cpp
+++ b/src/plugins/intel_cpu/src/nodes/executors/interpolate.cpp
@@ -247,24 +247,24 @@ void ov::intel_cpu::InterpolateExecutor::buildTblLinearOnnx(const VectorDims& sr
int scale = dnnl::impl::cpu::x64::mayiuse(dnnl::impl::cpu::x64::sse41) ? srcDataSize : 1;
for (int oz = 0; oz < OD; oz++) {
- int izF;
- int izE;
- float weightF;
- float weightE;
+ int izF = 0;
+ int izE = 0;
+ float weightF = NAN;
+ float weightE = NAN;
linearOnnxCF(oz, fz, ID, OD, izF, izE, weightF, weightE);
int idxOz = oz * OH * OW;
for (int oy = 0; oy < OH; oy++) {
- int iyT;
- int iyB;
- float weightT;
- float weightB;
+ int iyT = 0;
+ int iyB = 0;
+ float weightT = NAN;
+ float weightB = NAN;
linearOnnxCF(oy, fy, IH, OH, iyT, iyB, weightT, weightB);
int idxOzOy = idxOz + oy * OW;
for (int ox = 0; ox < OW; ox++) {
- int ixL;
- int ixR;
- float weightL;
- float weightR;
+ int ixL = 0;
+ int ixR = 0;
+ float weightL = NAN;
+ float weightR = NAN;
linearOnnxCF(ox, fx, IW, OW, ixL, ixR, weightL, weightR);
int idxOzOyOx = idxOzOy + ox;
diff --git a/src/plugins/intel_cpu/src/nodes/executors/mlas/mlas_transpose.cpp b/src/plugins/intel_cpu/src/nodes/executors/mlas/mlas_transpose.cpp
index 36e6769d46e..7700503e3e6 100644
--- a/src/plugins/intel_cpu/src/nodes/executors/mlas/mlas_transpose.cpp
+++ b/src/plugins/intel_cpu/src/nodes/executors/mlas/mlas_transpose.cpp
@@ -44,7 +44,7 @@ std::enable_if_t<!has_mlas_transpose<T>::value, void> SimpleTransposeSingleAxisO
int64_t num_writers,
int64_t writes_per_loop,
int64_t writes_per_writer_per_loop) {
- const T* end;
+ const T* end = nullptr;
for (int64_t l = 0; l < num_loops; ++l) {
T* output_for_first_writer = output_data;
for (auto wwpl = 0; wwpl < writes_per_writer_per_loop; ++wwpl) {
@@ -87,7 +87,7 @@ std::enable_if_t<!has_mlas_transpose<T>::value, void> SimpleTransposeSingleAxisI
int64_t num_readers,
int64_t reads_per_loop,
int64_t reads_per_reader_per_loop) {
- T* end;
+ T* end = nullptr;
for (int64_t l = 0; l < num_loops; ++l) {
const T* input_for_first_reader = input_data;
for (auto rrpl = 0; rrpl < reads_per_reader_per_loop; ++rrpl) {
diff --git a/src/plugins/intel_cpu/src/nodes/fake_quantize.cpp b/src/plugins/intel_cpu/src/nodes/fake_quantize.cpp
index 62e0fa91b07..b6dea0bce53 100644
--- a/src/plugins/intel_cpu/src/nodes/fake_quantize.cpp
+++ b/src/plugins/intel_cpu/src/nodes/fake_quantize.cpp
@@ -1503,16 +1503,18 @@ void FakeQuantize::initSupportedPrimitiveDescriptors() {
return;
}
- impl_desc_type impl_type;
- if (mayiuse(cpu::x64::avx512_core)) {
- impl_type = impl_desc_type::jit_avx512;
- } else if (mayiuse(cpu::x64::avx2)) {
- impl_type = impl_desc_type::jit_avx2;
- } else if (mayiuse(cpu::x64::sse41)) {
- impl_type = impl_desc_type::jit_sse42;
- } else {
- impl_type = impl_desc_type::ref;
- }
+ impl_desc_type impl_type = []() {
+ if (mayiuse(cpu::x64::avx512_core)) {
+ return impl_desc_type::jit_avx512;
+ }
+ if (mayiuse(cpu::x64::avx2)) {
+ return impl_desc_type::jit_avx2;
+ }
+ if (mayiuse(cpu::x64::sse41)) {
+ return impl_desc_type::jit_sse42;
+ }
+ return impl_desc_type::ref;
+ }();
if (!mayiuse(cpu::x64::sse41) || getAxis() != 1) {
impl_type = impl_desc_type::ref;
diff --git a/src/plugins/intel_cpu/src/nodes/gather_tree.cpp b/src/plugins/intel_cpu/src/nodes/gather_tree.cpp
index bf986dd2b84..270cbd860ae 100644
--- a/src/plugins/intel_cpu/src/nodes/gather_tree.cpp
+++ b/src/plugins/intel_cpu/src/nodes/gather_tree.cpp
@@ -186,9 +186,9 @@ void GatherTree::GatherTreeExecutor::exec(const MemoryPtr& stepIdxMemPtr,
parallel_for2d(batchSize, beamWidth, [&](size_t batch, size_t beam) {
int32_t maxSequenceInBeam = std::min<int32_t>(maxTime, static_cast<int32_t>(maxSeqLen[batch]));
if (maxSequenceInBeam > 0) {
- int32_t time;
+ int32_t time = (maxTime - 1);
int32_t idx = (maxTime - 1) * bbSize + batch * beamWidth;
- for (time = (maxTime - 1); time >= maxSequenceInBeam; time--, idx -= bbSize) {
+ for (; time >= maxSequenceInBeam; time--, idx -= bbSize) {
finalIdx[idx + beam] = endToken;
}
diff --git a/src/plugins/intel_cpu/src/nodes/interpolate.cpp b/src/plugins/intel_cpu/src/nodes/interpolate.cpp
index 96ca052278a..eb1ff9736d4 100644
--- a/src/plugins/intel_cpu/src/nodes/interpolate.cpp
+++ b/src/plugins/intel_cpu/src/nodes/interpolate.cpp
@@ -414,9 +414,9 @@ private:
// | |
// | | .
// ----
- int f;
- int filterS;
- int filterL;
+ int f = 0;
+ int filterS = 0;
+ int filterL = 0;
int tail_num = jcp_.C % vector_step;
// xpass
if (xPass) {
@@ -3297,24 +3297,24 @@ void Interpolate::InterpolateExecutorBase::buildTblLinearOnnx(const VectorDims&
int scale = mayiuse(cpu::x64::sse41) ? srcDataSize : 1;
for (int oz = 0; oz < OD; oz++) {
- int izF;
- int izE;
- float weightF;
- float weightE;
+ int izF = 0;
+ int izE = 0;
+ float weightF = NAN;
+ float weightE = NAN;
linearOnnxCF(oz, fz, ID, OD, izF, izE, weightF, weightE);
int idxOz = oz * OH * OW;
for (int oy = 0; oy < OH; oy++) {
- int iyT;
- int iyB;
- float weightT;
- float weightB;
+ int iyT = 0;
+ int iyB = 0;
+ float weightT = NAN;
+ float weightB = NAN;
linearOnnxCF(oy, fy, IH, OH, iyT, iyB, weightT, weightB);
int idxOzOy = idxOz + oy * OW;
for (int ox = 0; ox < OW; ox++) {
- int ixL;
- int ixR;
- float weightL;
- float weightR;
+ int ixL = 0;
+ int ixR = 0;
+ float weightL = NAN;
+ float weightR = NAN;
linearOnnxCF(ox, fx, IW, OW, ixL, ixR, weightL, weightR);
int idxOzOyOx = idxOzOy + ox;
@@ -4088,11 +4088,11 @@ void Interpolate::InterpolateRefExecutor::pillowRef(const uint8_t* in_ptr_,
} else if (!xPass && !yPass) {
cpu_memcpy(out_ptr_nc, in_ptr_nc, OH * OW * dstDataSize);
}
- float result;
- int f;
- int filterS;
- int filterL;
- float* weight;
+ float result = NAN;
+ int f = 0;
+ int filterS = 0;
+ int filterL = 0;
+ float* weight = nullptr;
if (xPass) {
for (size_t ih = 0; ih < static_cast<size_t>(IH); ih++) {
for (size_t ow = 0; ow < static_cast<size_t>(OW); ow++) {
@@ -4184,11 +4184,11 @@ void Interpolate::InterpolateRefExecutor::pillowRefNCHWAsNHWC(const uint8_t* in_
cpu_memcpy(out_ptr_b, in_ptr_b, OH * OW * C * dstDataSize);
}
- float result;
- int f;
- int filterS;
- int filterL;
- float* weight;
+ float result = NAN;
+ int f = 0;
+ int filterS = 0;
+ int filterL = 0;
+ float* weight = nullptr;
if (xPass) {
for (size_t ih = 0; ih < static_cast<size_t>(IH); ih++) {
diff --git a/src/plugins/intel_cpu/src/nodes/kernels/scaled_attn/executor_pa.cpp b/src/plugins/intel_cpu/src/nodes/kernels/scaled_attn/executor_pa.cpp
index 1b7dba384d7..cca74f8a95c 100644
--- a/src/plugins/intel_cpu/src/nodes/kernels/scaled_attn/executor_pa.cpp
+++ b/src/plugins/intel_cpu/src/nodes/kernels/scaled_attn/executor_pa.cpp
@@ -2562,7 +2562,7 @@ struct MHAHelper {
// for each weight block, loop through all value block
for (size_t v_blk = 0; v_blk < cur_kv_len_blocks; v_blk++) {
- DATA_TYPE* v_ptr;
+ DATA_TYPE* v_ptr = nullptr;
if (q_is_xf16 || !q_cache_is_same) {
v_ptr = wv_scratch_b.ptr<DATA_TYPE>(v_blk, hk);
} else {
@@ -2903,7 +2903,7 @@ struct MHAHelper {
_weight_bhl.resize<float>({B, H, q_len, rnd_up(max_context_len, std::max(_block_size, size_t{16}))});
// for small batches dynamic scheduler has notable overhead
- bool prefer_static_loop;
+ bool prefer_static_loop = false;
// if less than 2 work items per thread, loop H
bool loop_hk = B * kv_len_in_blocks * Hk > 2 * _nthr;
if (B <= 32) {
@@ -2933,9 +2933,9 @@ struct MHAHelper {
};
auto loop_qk = [&](size_t b, size_t pk_in_blocks, size_t hx) {
auto context_len = static_cast<size_t>(past_lens.ptr<int32_t>()[b]) + 1;
- size_t hk;
- size_t hq_beg;
- size_t hq_end;
+ size_t hk = 0;
+ size_t hq_beg = 0;
+ size_t hq_end = 0;
get_h_params(loop_hk, hx, _h_each_group_len, hq_beg, hq_end, hk);
// kv_len must be valid
@@ -3042,9 +3042,9 @@ struct MHAHelper {
auto loop_wk = [&](size_t b, size_t pv_in_blocks, size_t hx) {
auto context_len = static_cast<size_t>(past_lens.ptr<int32_t>()[b]) + 1;
auto pv = pv_in_blocks * _block_size;
- size_t hk;
- size_t hq_beg;
- size_t hq_end;
+ size_t hk = 0;
+ size_t hq_beg = 0;
+ size_t hq_end = 0;
get_h_params(loop_hk, hx, _h_each_group_len, hq_beg, hq_end, hk);
// kv_len must be valid
@@ -3316,9 +3316,9 @@ struct MHA {
_helper.resize_temporary_weight_buffer(weight_h);
parallel_for2d_dynamic(attn_work_count, loop_hk ? Hk : _helper.H, [&](size_t w, size_t hx) {
- size_t hk;
- size_t hq_beg;
- size_t hq_end;
+ size_t hk = 0;
+ size_t hq_beg = 0;
+ size_t hq_end = 0;
if (loop_hk) {
hk = hx;
hq_beg = hk * _helper._h_each_group_len;
@@ -3810,10 +3810,10 @@ struct AttentionExecutor : public PagedAttentionExecutor {
PlainTensor subsequence_begins;
PlainTensor block_indices;
PlainTensor block_indices_begins;
- float scale;
- size_t sliding_window;
+ float scale = NAN;
+ size_t sliding_window = 0;
PlainTensor alibi_slopes;
- size_t max_context_len;
+ size_t max_context_len = 0;
PlainTensor rotated_block_indices;
PlainTensor rotation_deltas;
PlainTensor rotation_trig_lut;
diff --git a/src/plugins/intel_cpu/src/nodes/kernels/scaled_attn/executor_pa_common.cpp b/src/plugins/intel_cpu/src/nodes/kernels/scaled_attn/executor_pa_common.cpp
index d66bd3a2277..d6964f03ade 100644
--- a/src/plugins/intel_cpu/src/nodes/kernels/scaled_attn/executor_pa_common.cpp
+++ b/src/plugins/intel_cpu/src/nodes/kernels/scaled_attn/executor_pa_common.cpp
@@ -28,8 +28,8 @@ using namespace dnnl::impl::cpu::x64;
void TileConfig::reset(int palette, int _startRow, const std::vector<std::pair<int, int>>& _rows_columnsBytes) {
palette_id = palette;
startRow = _startRow;
- uint64_t i;
- for (i = 0; i < 14; i++) {
+ uint64_t i = 0;
+ for (; i < 14; i++) {
reserved[i] = 0;
}
for (i = 0; i < _rows_columnsBytes.size(); i++) {
diff --git a/src/plugins/intel_cpu/src/nodes/kernels/scaled_attn/mha_single_token.cpp b/src/plugins/intel_cpu/src/nodes/kernels/scaled_attn/mha_single_token.cpp
index b386438fe59..dbc734e541e 100644
--- a/src/plugins/intel_cpu/src/nodes/kernels/scaled_attn/mha_single_token.cpp
+++ b/src/plugins/intel_cpu/src/nodes/kernels/scaled_attn/mha_single_token.cpp
@@ -1448,9 +1448,9 @@ static void mha_single_token_kernel(const ov::intel_cpu::PlainTensor& query,
size_t end{0};
splitter(B * h_group_num * kv_len, nthr, ithr, start, end);
- size_t b;
- size_t h_group;
- size_t pk;
+ size_t b = 0;
+ size_t h_group = 0;
+ size_t pk = 0;
if (start < end) {
parallel_it_init(start, pk, kv_len, b, B, h_group, h_group_num);
if (q_len == 1 && h_each_group_len == 1) {
@@ -1648,9 +1648,9 @@ static void mha_single_token_kernel(const ov::intel_cpu::PlainTensor& query,
memset(buf_attn_score.ptr<T3>(ithr, 0, 0, 0, 0), 0, buf_attn_score.stride(0) * sizeof(T3));
- size_t b;
- size_t h_group;
- size_t pv;
+ size_t b = 0;
+ size_t h_group = 0;
+ size_t pv = 0;
if (start < end) {
parallel_it_init(start, pv, kv_len, b, B, h_group, h_group_num);
if (q_len == 1 && h_each_group_len == 1) {
diff --git a/src/plugins/intel_cpu/src/nodes/kernels/x64/brgemm_kernel.cpp b/src/plugins/intel_cpu/src/nodes/kernels/x64/brgemm_kernel.cpp
index 4b447bb1203..2dd93b1f8b9 100644
--- a/src/plugins/intel_cpu/src/nodes/kernels/x64/brgemm_kernel.cpp
+++ b/src/plugins/intel_cpu/src/nodes/kernels/x64/brgemm_kernel.cpp
@@ -88,7 +88,7 @@ BrgemmKernel::BrgemmKernel(size_t M,
bool isAMXSupported = (is_bf16 && mayiuse(avx512_core_amx)) || (is_f16 && mayiuse(avx512_core_amx_fp16));
bool isBrgWithAMX = isAMXSupported && !is_avx_f16_only;
- size_t vlen;
+ size_t vlen = 0;
if (mayiuse(avx512_core)) {
vlen = cpu_isa_traits<avx512_core>::vlen;
} else {
@@ -186,24 +186,24 @@ void BrgemmKernel::init_brgemm(brgemmCtx& ctx,
const bool is_int8 =
one_of(ctx.dt_in0, data_type::u8, data_type::s8) && one_of(ctx.dt_in1, data_type::u8, data_type::s8);
- cpu_isa_t isa;
- if (use_amx) {
- isa = isa_undef;
- } else if (mayiuse(avx512_core)) {
- if (ctx.dt_in0 == dnnl_data_type_t::dnnl_bf16 && mayiuse(avx512_core_bf16)) {
- isa = avx512_core_bf16;
- } else if (ctx.dt_in0 == dnnl_data_type_t::dnnl_f16 && mayiuse(avx512_core_fp16)) {
- isa = avx512_core_fp16;
- } else {
+ cpu_isa_t isa = [&]() {
+ if (use_amx) {
+ return isa_undef;
+ }
+ if (mayiuse(avx512_core)) {
+ if (ctx.dt_in0 == dnnl_data_type_t::dnnl_bf16 && mayiuse(avx512_core_bf16)) {
+ return avx512_core_bf16;
+ }
+ if (ctx.dt_in0 == dnnl_data_type_t::dnnl_f16 && mayiuse(avx512_core_fp16)) {
+ return avx512_core_fp16;
+ }
if (is_int8) {
- isa = avx512_core_vnni;
- } else {
- isa = avx512_core;
+ return avx512_core_vnni;
}
+ return avx512_core;
}
- } else {
- isa = cpu_isa_t::avx2;
- }
+ return cpu_isa_t::avx2;
+ }();
auto status = brgemm_desc_init(&brgDesc,
isa,
brgemm_addr,
diff --git a/src/plugins/intel_cpu/src/nodes/kernels/x64/mlp_utils.cpp b/src/plugins/intel_cpu/src/nodes/kernels/x64/mlp_utils.cpp
index b08b7b71c49..1efdbc29e69 100644
--- a/src/plugins/intel_cpu/src/nodes/kernels/x64/mlp_utils.cpp
+++ b/src/plugins/intel_cpu/src/nodes/kernels/x64/mlp_utils.cpp
@@ -51,7 +51,7 @@ void llm_mlp_quantize_to_i8(T* psrc,
for (int y = 0; y < rows; y++, psrc += src_stride, pdst += dst_stride) {
int x = 0;
- float f_min, f_max;
+ float f_min = NAN, f_max = NAN;
#if defined(HAVE_AVX512F)
auto v_max = mm512_uni_loadu_ps(psrc + 0);
auto v_min = mm512_uni_loadu_ps(psrc + 0);
@@ -74,8 +74,8 @@ void llm_mlp_quantize_to_i8(T* psrc,
// (q - z) * s = f
// (-128 - z) * s = f_min;
// ( 127 - z) * s = f_max;
- float scale;
- float zp;
+ float scale = NAN;
+ float zp = NAN;
if (f_max == f_min || std::isnan(f_max) || std::isnan(f_min)) {
// special case
p_zp[y] = 0;
diff --git a/src/plugins/intel_cpu/src/nodes/llm_mlp.cpp b/src/plugins/intel_cpu/src/nodes/llm_mlp.cpp
index aa5daebdaa9..9531dd525c8 100644
--- a/src/plugins/intel_cpu/src/nodes/llm_mlp.cpp
+++ b/src/plugins/intel_cpu/src/nodes/llm_mlp.cpp
@@ -303,8 +303,8 @@ public:
// K reduce is done, results of [M, BN] sub-block is ready in L2.
// combine Gate & Up
- float* ptr_c;
- size_t stride_c;
+ float* ptr_c = nullptr;
+ size_t stride_c = 0;
if (config.gate_up_quantized) {
// dequantize m_C in-place
ptr_c = work.m_C.template ptr<float>();
diff --git a/src/plugins/intel_cpu/src/nodes/multiclass_nms.cpp b/src/plugins/intel_cpu/src/nodes/multiclass_nms.cpp
index ecd6100b6bb..085194b17b3 100644
--- a/src/plugins/intel_cpu/src/nodes/multiclass_nms.cpp
+++ b/src/plugins/intel_cpu/src/nodes/multiclass_nms.cpp
@@ -14,6 +14,7 @@
#include <oneapi/dnnl/dnnl_common.hpp>
#include <queue>
#include <string>
+#include <tuple>
#include <utility>
#include <vector>
@@ -467,26 +468,12 @@ bool MultiClassNms::created() const {
}
float MultiClassNms::intersectionOverUnion(const float* boxesI, const float* boxesJ, const bool normalized) {
- float yminI;
- float xminI;
- float ymaxI;
- float xmaxI;
- float yminJ;
- float xminJ;
- float ymaxJ;
- float xmaxJ;
+ auto [yminI, xminI, ymaxI, xmaxI] =
+ std::tuple<float, float, float, float>{boxesI[0], boxesI[1], boxesI[2], boxesI[3]};
+ auto [yminJ, xminJ, ymaxJ, xmaxJ] =
+ std::tuple<float, float, float, float>{boxesJ[0], boxesJ[1], boxesJ[2], boxesJ[3]};
const auto norm = static_cast<float>(!normalized);
- // to align with reference
- yminI = boxesI[0];
- xminI = boxesI[1];
- ymaxI = boxesI[2];
- xmaxI = boxesI[3];
- yminJ = boxesJ[0];
- xminJ = boxesJ[1];
- ymaxJ = boxesJ[2];
- xmaxJ = boxesJ[3];
-
float areaI = (ymaxI - yminI + norm) * (xmaxI - xminI + norm);
float areaJ = (ymaxJ - yminJ + norm) * (xmaxJ - xminJ + norm);
if (areaI <= 0.F || areaJ <= 0.F) {
diff --git a/src/plugins/intel_cpu/src/nodes/mvn.cpp b/src/plugins/intel_cpu/src/nodes/mvn.cpp
index 95e7bf56bc0..1a4a26e666c 100644
--- a/src/plugins/intel_cpu/src/nodes/mvn.cpp
+++ b/src/plugins/intel_cpu/src/nodes/mvn.cpp
@@ -2075,16 +2075,18 @@ void MVN::initSupportedPrimitiveDescriptors() {
inputPrecision = outputPrecision = ov::element::f32;
#endif // OV_CPU_WITH_ACL
- impl_desc_type impl_type;
- if (mayiuse(cpu::x64::avx512_core)) {
- impl_type = impl_desc_type::jit_avx512;
- } else if (mayiuse(cpu::x64::avx2)) {
- impl_type = impl_desc_type::jit_avx2;
- } else if (mayiuse(cpu::x64::sse41)) {
- impl_type = impl_desc_type::jit_sse42;
- } else {
- impl_type = impl_desc_type::ref;
- }
+ impl_desc_type impl_type = [&]() {
+ if (mayiuse(cpu::x64::avx512_core)) {
+ return impl_desc_type::jit_avx512;
+ }
+ if (mayiuse(cpu::x64::avx2)) {
+ return impl_desc_type::jit_avx2;
+ }
+ if (mayiuse(cpu::x64::sse41)) {
+ return impl_desc_type::jit_sse42;
+ }
+ return impl_desc_type::ref;
+ }();
if (mayiuse(cpu::x64::sse41)) {
// nspc
diff --git a/src/plugins/intel_cpu/src/nodes/non_max_suppression.cpp b/src/plugins/intel_cpu/src/nodes/non_max_suppression.cpp
index 693f7613c51..93b7e413be1 100644
--- a/src/plugins/intel_cpu/src/nodes/non_max_suppression.cpp
+++ b/src/plugins/intel_cpu/src/nodes/non_max_suppression.cpp
@@ -19,6 +19,7 @@
#include <oneapi/dnnl/dnnl_common.hpp>
#include <queue>
#include <string>
+#include <tuple>
#include <utility>
#include <vector>
@@ -900,7 +901,7 @@ void NonMaxSuppression::nmsRotated(const float* boxes,
io_selection_size++;
if (sorted_boxes_size > 1LU) {
sorted_indices_ptr++;
- NMSCandidateStatus candidate_status;
+ NMSCandidateStatus candidate_status = NMSCandidateStatus::SELECTED;
for (size_t candidate_idx = 1LU;
(candidate_idx < sorted_boxes_size) && (io_selection_size < m_output_boxes_per_class);
@@ -946,35 +947,28 @@ void NonMaxSuppression::nmsRotated(const float* boxes,
/////////////// End of Rotated boxes ///////////////
float NonMaxSuppression::intersectionOverUnion(const float* boxesI, const float* boxesJ) {
- float yminI;
- float xminI;
- float ymaxI;
- float xmaxI;
- float yminJ;
- float xminJ;
- float ymaxJ;
- float xmaxJ;
- if (boxEncodingType == NMSBoxEncodeType::CENTER) {
- // box format: x_center, y_center, width, height
- yminI = boxesI[1] - boxesI[3] / 2.F;
- xminI = boxesI[0] - boxesI[2] / 2.F;
- ymaxI = boxesI[1] + boxesI[3] / 2.F;
- xmaxI = boxesI[0] + boxesI[2] / 2.F;
- yminJ = boxesJ[1] - boxesJ[3] / 2.F;
- xminJ = boxesJ[0] - boxesJ[2] / 2.F;
- ymaxJ = boxesJ[1] + boxesJ[3] / 2.F;
- xmaxJ = boxesJ[0] + boxesJ[2] / 2.F;
- } else {
- // box format: y1, x1, y2, x2
- yminI = (std::min)(boxesI[0], boxesI[2]);
- xminI = (std::min)(boxesI[1], boxesI[3]);
- ymaxI = (std::max)(boxesI[0], boxesI[2]);
- xmaxI = (std::max)(boxesI[1], boxesI[3]);
- yminJ = (std::min)(boxesJ[0], boxesJ[2]);
- xminJ = (std::min)(boxesJ[1], boxesJ[3]);
- ymaxJ = (std::max)(boxesJ[0], boxesJ[2]);
- xmaxJ = (std::max)(boxesJ[1], boxesJ[3]);
- }
+ auto [yminI, xminI, ymaxI, xmaxI, yminJ, xminJ, ymaxJ, xmaxJ] = [&] {
+ if (boxEncodingType == NMSBoxEncodeType::CENTER) {
+ // box format: x_center, y_center, width, height
+ return std::tuple{boxesI[1] - boxesI[3] / 2.F,
+ boxesI[0] - boxesI[2] / 2.F,
+ boxesI[1] + boxesI[3] / 2.F,
+ boxesI[0] + boxesI[2] / 2.F,
+ boxesJ[1] - boxesJ[3] / 2.F,
+ boxesJ[0] - boxesJ[2] / 2.F,
+ boxesJ[1] + boxesJ[3] / 2.F,
+ boxesJ[0] + boxesJ[2] / 2.F};
+ }
+ // box format: y1, x1, y2, x2
+ return std::tuple{(std::min)(boxesI[0], boxesI[2]),
+ (std::min)(boxesI[1], boxesI[3]),
+ (std::max)(boxesI[0], boxesI[2]),
+ (std::max)(boxesI[1], boxesI[3]),
+ (std::min)(boxesJ[0], boxesJ[2]),
+ (std::min)(boxesJ[1], boxesJ[3]),
+ (std::max)(boxesJ[0], boxesJ[2]),
+ (std::max)(boxesJ[1], boxesJ[3])};
+ }();
float areaI = (ymaxI - yminI) * (xmaxI - xminI);
float areaJ = (ymaxJ - yminJ) * (xmaxJ - xminJ);
diff --git a/src/plugins/intel_cpu/src/nodes/priorbox.cpp b/src/plugins/intel_cpu/src/nodes/priorbox.cpp
index 3e4c566ccaf..ffa5593e3a8 100644
--- a/src/plugins/intel_cpu/src/nodes/priorbox.cpp
+++ b/src/plugins/intel_cpu/src/nodes/priorbox.cpp
@@ -72,7 +72,7 @@ PriorBox::PriorBox(const std::shared_ptr<ov::Node>& op, const GraphContext::CPtr
fixed_ratio = attrs.fixed_ratio;
density = attrs.density;
- bool exist;
+ bool exist = false;
aspect_ratio.push_back(1.0F);
for (float aspect_ratio_item : attrs.aspect_ratio) {
exist = false;
@@ -182,12 +182,12 @@ void PriorBox::execute([[maybe_unused]] const dnnl::stream& strm) {
}
int64_t idx = 0;
- float center_x;
- float center_y;
- float box_width;
- float box_height;
- float step_x;
- float step_y;
+ float center_x = NAN;
+ float center_y = NAN;
+ float box_width = NAN;
+ float box_height = NAN;
+ float step_x = NAN;
+ float step_y = NAN;
float IWI = 1.0F / static_cast<float>(IW);
float IHI = 1.0F / static_cast<float>(IH);
diff --git a/src/plugins/intel_cpu/src/nodes/proposal.cpp b/src/plugins/intel_cpu/src/nodes/proposal.cpp
index aa8a47db95a..9e014725c5d 100644
--- a/src/plugins/intel_cpu/src/nodes/proposal.cpp
+++ b/src/plugins/intel_cpu/src/nodes/proposal.cpp
@@ -9,6 +9,7 @@
#include <memory>
#include <oneapi/dnnl/dnnl_common.hpp>
#include <string>
+#include <utility>
#include <vector>
#include "cpu_types.h"
@@ -47,15 +48,16 @@ static std::vector<float> generate_anchors(proposal_conf& conf) {
// enumerate all transformed boxes
for (size_t ratio = 0; ratio < num_ratios; ++ratio) {
// transformed width & height for given ratio factors
- float ratio_w;
- float ratio_h;
- if (round_ratios) {
- ratio_w = std::roundf(std::sqrt(base_area / ratios[ratio]));
- ratio_h = std::roundf(ratio_w * ratios[ratio]);
- } else {
- ratio_w = std::sqrt(base_area / ratios[ratio]);
- ratio_h = ratio_w * ratios[ratio];
- }
+ const auto [ratio_w, ratio_h] = [&]() {
+ if (round_ratios) {
+ float rw = std::roundf(std::sqrt(base_area / ratios[ratio]));
+ float rh = std::roundf(rw * ratios[ratio]);
+ return std::make_pair(rw, rh);
+ }
+ float rw = std::sqrt(base_area / ratios[ratio]);
+ float rh = rw * ratios[ratio];
+ return std::make_pair(rw, rh);
+ }();
float* const p_anchors_wm = anchors_ptr + 0 * num_ratios * num_scales + ratio * num_scales;
float* const p_anchors_hm = anchors_ptr + 1 * num_ratios * num_scales + ratio * num_scales;
diff --git a/src/plugins/intel_cpu/src/nodes/psroi_pooling.cpp b/src/plugins/intel_cpu/src/nodes/psroi_pooling.cpp
index bdaf3984c94..f391473515c 100644
--- a/src/plugins/intel_cpu/src/nodes/psroi_pooling.cpp
+++ b/src/plugins/intel_cpu/src/nodes/psroi_pooling.cpp
@@ -154,16 +154,18 @@ void PSROIPooling::initSupportedPrimitiveDescriptors() {
return;
}
- impl_desc_type impl_type;
- if (mayiuse(cpu::x64::avx512_core)) {
- impl_type = impl_desc_type::jit_avx512;
- } else if (mayiuse(cpu::x64::avx2)) {
- impl_type = impl_desc_type::jit_avx2;
- } else if (mayiuse(cpu::x64::sse41)) {
- impl_type = impl_desc_type::jit_sse42;
- } else {
- impl_type = impl_desc_type::ref;
- }
+ impl_desc_type impl_type = [&]() {
+ if (mayiuse(cpu::x64::avx512_core)) {
+ return impl_desc_type::jit_avx512;
+ }
+ if (mayiuse(cpu::x64::avx2)) {
+ return impl_desc_type::jit_avx2;
+ }
+ if (mayiuse(cpu::x64::sse41)) {
+ return impl_desc_type::jit_sse42;
+ }
+ return impl_desc_type::ref;
+ }();
auto dataPrecision = getOriginalInputPrecisionAtPort(0) == ov::element::bf16 ? ov::element::bf16 : ov::element::f32;
@@ -283,15 +285,15 @@ void PSROIPooling::executeAverage(const inputType* srcData,
const int roiBatchInd,
const BlockedMemoryDesc& srcDesc,
const BlockedMemoryDesc& dstDesc) {
- int inBlockSize;
- int outBlockSize;
- int outBlockCount;
- int hInputStride;
- int wInputStride;
- int hOutputStride;
- int wOutputStride;
- uint64_t inputChannelsPadding;
- uint64_t outputChannelsPadding;
+ int inBlockSize = 0;
+ int outBlockSize = 0;
+ int outBlockCount = 0;
+ int hInputStride = 0;
+ int wInputStride = 0;
+ int hOutputStride = 0;
+ int wOutputStride = 0;
+ uint64_t inputChannelsPadding = 0;
+ uint64_t outputChannelsPadding = 0;
unpackParams(srcDesc,
dstDesc,
hInputStride,
@@ -387,15 +389,15 @@ void PSROIPooling::executeBilinear(const inputType* srcData,
const int roiBatchInd,
const BlockedMemoryDesc& srcDesc,
const BlockedMemoryDesc& dstDesc) {
- int inBlockSize;
- int outBlockSize;
- int outBlockCount;
- int hInputStride;
- int wInputStride;
- int hOutputStride;
- int wOutputStride;
- uint64_t inputChannelsPadding;
- uint64_t outputChannelsPadding;
+ int inBlockSize = 0;
+ int outBlockSize = 0;
+ int outBlockCount = 0;
+ int hInputStride = 0;
+ int wInputStride = 0;
+ int hOutputStride = 0;
+ int wOutputStride = 0;
+ uint64_t inputChannelsPadding = 0;
+ uint64_t outputChannelsPadding = 0;
unpackParams(srcDesc,
dstDesc,
hInputStride,
@@ -418,8 +420,8 @@ void PSROIPooling::executeBilinear(const inputType* srcData,
auto bilinearPsroi = [&](int c, int h, int w, int binOffOut, int outBlkRes) {
float accum = 0.0F;
- int binOffIn;
- int inBlkRes;
+ int binOffIn = 0;
+ int inBlkRes = 0;
size_t dstIndex = binOffOut + h * hOutputStride + w * wOutputStride + outBlkRes;
dstData[dstIndex] = 0;
diff --git a/src/plugins/intel_cpu/src/nodes/reduce.cpp b/src/plugins/intel_cpu/src/nodes/reduce.cpp
index d2d675cd53f..d37cc602054 100644
--- a/src/plugins/intel_cpu/src/nodes/reduce.cpp
+++ b/src/plugins/intel_cpu/src/nodes/reduce.cpp
@@ -3669,8 +3669,8 @@ void Reduce::reduce_ref_process(const float* in_ptr,
VectorDims src_strides =
getParentEdgeAt(REDUCE_DATA)->getMemory().getDescWithType<BlockedMemoryDesc>()->getStrides();
parallel_nt(0, [&](const int ithr, const int nthr) {
- int j;
- size_t i;
+ int j = 0;
+ size_t i = 0;
size_t start = 0;
size_t end = 0;
VectorDims dst_counters(process_dst_dims.size(), 0);
diff --git a/src/plugins/intel_cpu/src/nodes/region_yolo.cpp b/src/plugins/intel_cpu/src/nodes/region_yolo.cpp
index 695d2810ebe..ea488fe910b 100644
--- a/src/plugins/intel_cpu/src/nodes/region_yolo.cpp
+++ b/src/plugins/intel_cpu/src/nodes/region_yolo.cpp
@@ -321,16 +321,18 @@ void RegionYolo::initSupportedPrimitiveDescriptors() {
}
}
- impl_desc_type impl_type;
- if (mayiuse(x64::avx512_core)) {
- impl_type = impl_desc_type::jit_avx512;
- } else if (mayiuse(x64::avx2)) {
- impl_type = impl_desc_type::jit_avx2;
- } else if (mayiuse(x64::sse41)) {
- impl_type = impl_desc_type::jit_sse42;
- } else {
- impl_type = impl_desc_type::ref;
- }
+ impl_desc_type impl_type = [&] {
+ if (mayiuse(x64::avx512_core)) {
+ return impl_desc_type::jit_avx512;
+ }
+ if (mayiuse(x64::avx2)) {
+ return impl_desc_type::jit_avx2;
+ }
+ if (mayiuse(x64::sse41)) {
+ return impl_desc_type::jit_sse42;
+ }
+ return impl_desc_type::ref;
+ }();
addSupportedPrimDesc({{LayoutType::ncsp, input_prec}}, {{LayoutType::ncsp, output_prec}}, impl_type);
}
diff --git a/src/plugins/intel_cpu/src/nodes/reverse_sequence.cpp b/src/plugins/intel_cpu/src/nodes/reverse_sequence.cpp
index 91ef8d4696e..29015447e7e 100644
--- a/src/plugins/intel_cpu/src/nodes/reverse_sequence.cpp
+++ b/src/plugins/intel_cpu/src/nodes/reverse_sequence.cpp
@@ -171,7 +171,7 @@ void ReverseSequence::ReverseSequenceExecutor::exec(const MemoryPtr& dataMemPtr,
}
parallel_nt(0, [&](const int ithr, const int nthr) {
- size_t i;
+ size_t i = 0;
size_t start = 0;
size_t end = 0;
size_t srcIdx = 0;
diff --git a/src/plugins/intel_cpu/src/nodes/rms_norm.cpp b/src/plugins/intel_cpu/src/nodes/rms_norm.cpp
index ae861abc0dd..3d97e0e5db2 100644
--- a/src/plugins/intel_cpu/src/nodes/rms_norm.cpp
+++ b/src/plugins/intel_cpu/src/nodes/rms_norm.cpp
@@ -145,14 +145,15 @@ void RMSNorm::initSupportedPrimitiveDescriptors() {
precision = ov::element::f32;
}
- impl_desc_type impl_type;
- if (mayiuse(cpu::x64::avx512_core)) {
- impl_type = impl_desc_type::jit_avx512;
- } else if (mayiuse(cpu::x64::avx2)) {
- impl_type = impl_desc_type::jit_avx2;
- } else {
- impl_type = impl_desc_type::ref;
- }
+ auto impl_type = [&]() {
+ if (mayiuse(cpu::x64::avx512_core)) {
+ return impl_desc_type::jit_avx512;
+ }
+ if (mayiuse(cpu::x64::avx2)) {
+ return impl_desc_type::jit_avx2;
+ }
+ return impl_desc_type::ref;
+ }();
addSupportedPrimDesc({{LayoutType::ncsp, precision}, {LayoutType::ncsp, ov::element::f32}},
{{LayoutType::ncsp, precision}},
diff --git a/src/plugins/intel_cpu/src/nodes/roi_align.cpp b/src/plugins/intel_cpu/src/nodes/roi_align.cpp
index 83aec79b9d8..384c4cdbb5f 100644
--- a/src/plugins/intel_cpu/src/nodes/roi_align.cpp
+++ b/src/plugins/intel_cpu/src/nodes/roi_align.cpp
@@ -834,16 +834,19 @@ void ROIAlign::initSupportedPrimitiveDescriptors() {
config.inConfs.resize(3);
config.outConfs.resize(1);
- impl_desc_type impl_type;
- if (mayiuse(cpu::x64::avx512_core)) {
- impl_type = impl_desc_type::jit_avx512;
- } else if (mayiuse(cpu::x64::avx2)) {
- impl_type = impl_desc_type::jit_avx2;
- } else if (mayiuse(cpu::x64::sse41)) {
- impl_type = impl_desc_type::jit_sse42;
- } else {
- impl_type = impl_desc_type::ref;
- }
+ impl_desc_type impl_type = [&]() {
+ if (mayiuse(cpu::x64::avx512_core)) {
+ return impl_desc_type::jit_avx512;
+ }
+ if (mayiuse(cpu::x64::avx2)) {
+ return impl_desc_type::jit_avx2;
+ }
+ if (mayiuse(cpu::x64::sse41)) {
+ return impl_desc_type::jit_sse42;
+ }
+ return impl_desc_type::ref;
+ }();
+
std::vector<std::pair<LayoutType, LayoutType>> supportedFormats{{LayoutType::ncsp, LayoutType::ncsp}};
if (mayiuse(cpu::x64::sse41)) {
@@ -1071,8 +1074,8 @@ void ROIAlign::executeSpecified() {
auto sampleYLow = static_cast<unsigned int>(sampleY);
auto sampleXLow = static_cast<unsigned int>(sampleX);
- unsigned int sampleYHigh;
- unsigned int sampleXHigh;
+ unsigned int sampleYHigh = 0;
+ unsigned int sampleXHigh = 0;
if (static_cast<int>(sampleYLow) >= H - 1) {
sampleYHigh = sampleYLow = H - 1;
sampleY = static_cast<float>(sampleYLow);
diff --git a/src/plugins/intel_cpu/src/nodes/roi_pooling.cpp b/src/plugins/intel_cpu/src/nodes/roi_pooling.cpp
index 0e03fde2bfb..b7b82d05f63 100644
--- a/src/plugins/intel_cpu/src/nodes/roi_pooling.cpp
+++ b/src/plugins/intel_cpu/src/nodes/roi_pooling.cpp
@@ -470,16 +470,18 @@ void ROIPooling::initSupportedPrimitiveDescriptors() {
}
auto format = mayiuse(avx512_core) ? LayoutType::nCsp16c : LayoutType::nCsp8c;
- impl_desc_type impl_type;
- if (mayiuse(cpu::x64::avx512_core)) {
- impl_type = impl_desc_type::jit_avx512;
- } else if (mayiuse(cpu::x64::avx2)) {
- impl_type = impl_desc_type::jit_avx2;
- } else if (mayiuse(cpu::x64::sse41)) {
- impl_type = impl_desc_type::jit_sse42;
- } else {
- impl_type = impl_desc_type::ref;
- }
+ impl_desc_type impl_type = [&]() {
+ if (mayiuse(cpu::x64::avx512_core)) {
+ return impl_desc_type::jit_avx512;
+ }
+ if (mayiuse(cpu::x64::avx2)) {
+ return impl_desc_type::jit_avx2;
+ }
+ if (mayiuse(cpu::x64::sse41)) {
+ return impl_desc_type::jit_sse42;
+ }
+ return impl_desc_type::ref;
+ }();
refParams.src_prc = getOriginalInputPrecisionAtPort(0);
@@ -652,20 +654,16 @@ private:
auto roi_end_w = static_cast<int>(round(src_roi_ptr[3] * jpp.spatial_scale));
auto roi_end_h = static_cast<int>(round(src_roi_ptr[4] * jpp.spatial_scale));
- int hstart;
- int hend;
- int wstart;
- int wend;
- std::tie(hstart, hend, wstart, wend) = getBordersForMaxMode(roi_start_h,
- roi_end_h,
- roi_start_w,
- roi_end_w,
- jpp.ih,
- oh,
- jpp.iw,
- ow,
- jpp.pooled_h,
- jpp.pooled_w);
+ auto [hstart, hend, wstart, wend] = getBordersForMaxMode(roi_start_h,
+ roi_end_h,
+ roi_start_w,
+ roi_end_w,
+ jpp.ih,
+ oh,
+ jpp.iw,
+ ow,
+ jpp.pooled_h,
+ jpp.pooled_w);
arg.src = &src_data[roi_batch_ind * src_strides[0] + cb * src_strides[1] + hstart * src_strides[2] +
wstart * src_strides[3]];
@@ -681,18 +679,16 @@ private:
float roi_end_w_ = src_roi_ptr[3];
float roi_end_h_ = src_roi_ptr[4];
- float in_x;
- float in_y;
- std::tie(in_x, in_y) = getXYForBilinearMode(roi_start_h_,
- roi_end_h_,
- roi_start_w_,
- roi_end_w_,
- jpp.ih,
- oh,
- jpp.iw,
- ow,
- jpp.pooled_h,
- jpp.pooled_w);
+ auto [in_x, in_y] = getXYForBilinearMode(roi_start_h_,
+ roi_end_h_,
+ roi_start_w_,
+ roi_end_w_,
+ jpp.ih,
+ oh,
+ jpp.iw,
+ ow,
+ jpp.pooled_h,
+ jpp.pooled_w);
if (in_y < 0 || in_y > jpp.ih - 1 || in_x < 0 || in_x > jpp.iw - 1) {
arg.bin_area = 0;
@@ -797,20 +793,16 @@ public:
auto roi_end_w = static_cast<int>(round(src_roi_ptr[3] * jpp.spatial_scale));
auto roi_end_h = static_cast<int>(round(src_roi_ptr[4] * jpp.spatial_scale));
- int hstart;
- int hend;
- int wstart;
- int wend;
- std::tie(hstart, hend, wstart, wend) = getBordersForMaxMode(roi_start_h,
- roi_end_h,
- roi_start_w,
- roi_end_w,
- jpp.ih,
- oh,
- jpp.iw,
- ow,
- jpp.pooled_h,
- jpp.pooled_w);
+ auto [hstart, hend, wstart, wend] = getBordersForMaxMode(roi_start_h,
+ roi_end_h,
+ roi_start_w,
+ roi_end_w,
+ jpp.ih,
+ oh,
+ jpp.iw,
+ ow,
+ jpp.pooled_h,
+ jpp.pooled_w);
for (int cbb_cur = 0; cbb_cur < cb_num; cbb_cur++) {
int ch_blk_cur = cbb * cb_num + cbb_cur;
@@ -843,18 +835,16 @@ public:
float roi_end_w_ = src_roi_ptr[3];
float roi_end_h_ = src_roi_ptr[4];
- float in_x;
- float in_y;
- std::tie(in_x, in_y) = getXYForBilinearMode(roi_start_h_,
- roi_end_h_,
- roi_start_w_,
- roi_end_w_,
- jpp.ih,
- oh,
- jpp.iw,
- ow,
- jpp.pooled_h,
- jpp.pooled_w);
+ auto [in_x, in_y] = getXYForBilinearMode(roi_start_h_,
+ roi_end_h_,
+ roi_start_w_,
+ roi_end_w_,
+ jpp.ih,
+ oh,
+ jpp.iw,
+ ow,
+ jpp.pooled_h,
+ jpp.pooled_w);
if (in_y < 0 || in_y > jpp.ih - 1 || in_x < 0 || in_x > jpp.iw - 1) {
for (int cbb_cur = 0; cbb_cur < cb_num; cbb_cur++) {
@@ -985,8 +975,8 @@ std::pair<float, float> ROIPooling::ROIPoolingExecutor::getXYForBilinearMode(con
float height_scale = (pooled_h > 1 ? ((roi_end_h - roi_start_h) * (ih - 1)) / (pooled_h - 1) : 0);
float width_scale = (pooled_w > 1 ? ((roi_end_w - roi_start_w) * (iw - 1)) / (pooled_w - 1) : 0);
- float in_y;
- float in_x;
+ float in_y = NAN;
+ float in_x = NAN;
// because of nonalgebraic character of floating point operation, some proposals can cause violation of inequality:
// ((end_h - start_h) * (input_h - 1) / (pooled_h - 1)) * (pooled_h - 1) <= (end_h - start_h) * (input_h - 1),
// and as result excess of right limit for proposal value,
diff --git a/src/plugins/intel_cpu/src/nodes/rope.cpp b/src/plugins/intel_cpu/src/nodes/rope.cpp
index 5b9e68defd1..694724e5182 100644
--- a/src/plugins/intel_cpu/src/nodes/rope.cpp
+++ b/src/plugins/intel_cpu/src/nodes/rope.cpp
@@ -362,7 +362,7 @@ struct RoPE::RoPEExecutorQwen : public RoPE::Executor {
auto present_kv_len = t_cos.size(1);
parallel_for3d(batch_size, seq_len, head_cnt, [&](size_t b, size_t p, size_t h) {
- size_t sincos_pos;
+ size_t sincos_pos = 0;
if (gather) {
if (gather.m_rank == 4) {
sincos_pos = gather.at<int32_t>({b, h, p, 0}, true);
diff --git a/src/plugins/intel_cpu/src/nodes/scaled_attn.cpp b/src/plugins/intel_cpu/src/nodes/scaled_attn.cpp
index 08c62ec7290..ee8db1c6705 100644
--- a/src/plugins/intel_cpu/src/nodes/scaled_attn.cpp
+++ b/src/plugins/intel_cpu/src/nodes/scaled_attn.cpp
@@ -458,7 +458,7 @@ struct MHAKernel<ScaledDotProductAttention::KT_ONEDNN, T> {
precision_of<T>::value);
}
auto* w_ptr = reinterpret_cast<T*>(weight_score.ptr<float>(ithr, 0, 0, 0));
- float* fp32_out_ptr;
+ float* fp32_out_ptr = nullptr;
if (is_xf16) {
fp32_out_ptr = has_out_transpose ? &fp32_out.at<float>({b, m_start, h, 0})
: &fp32_out.at<float>({b, h, m_start, 0});
@@ -900,7 +900,7 @@ struct MHASingleToken {
auto B = query.size(0);
auto H = query.size(1);
auto q_len = query.size(2);
- size_t kv_len;
+ size_t kv_len = 0;
kv_len = present_key.size(2);
// aligned to cache line (64bytes=16*sizeof(float)) to avoid false sharing
@@ -974,11 +974,11 @@ struct ScaledDotProductAttention::AttentionExecutor : public ScaledDotProductAtt
PlainTensor attn_mask;
PlainTensor output_emb(output);
float scale_input = 0.0F;
- size_t B;
- size_t L1;
- size_t L0;
- size_t S;
- size_t SV;
+ size_t B = 0;
+ size_t L1 = 0;
+ size_t L0 = 0;
+ size_t S = 0;
+ size_t SV = 0;
// B,L,H*S->B,L,H,S
auto get_reshape_shape = [&config](const PlainTensor& input) {
@@ -1049,8 +1049,8 @@ struct ScaledDotProductAttention::AttentionExecutor : public ScaledDotProductAtt
beam_table.assert_dims({B, L0 + L1});
}
- bool auto_causal;
- bool use_attn_mask;
+ bool auto_causal = false;
+ bool use_attn_mask = false;
if (fuse_causal_attn) {
assert(attn_mask);
attn_mask.assert_dims({B, 1, L1, L0 + L1});
@@ -1690,7 +1690,7 @@ void ScaledDotProductAttention::gatherConcatPastkv(const MemoryPtr& mem_cur_k,
cur_k.reset(mem_cur_k);
auto inputNumber = getOriginalInputsNumber();
auto&& v_dims = getParentEdgeAt(inputNumber - 1)->getMemory().getStaticDims();
- size_t B_state;
+ size_t B_state = 0;
if (!m_config.config.permute_axes.empty()) {
cur_k = cur_k.permute(m_config.config.permute_axes);
B_state = v_dims.at(m_config.config.permute_axes[0]);
diff --git a/src/plugins/intel_cpu/src/nodes/scatter_update.cpp b/src/plugins/intel_cpu/src/nodes/scatter_update.cpp
index 634f7816418..fd713e611a8 100644
--- a/src/plugins/intel_cpu/src/nodes/scatter_update.cpp
+++ b/src/plugins/intel_cpu/src/nodes/scatter_update.cpp
@@ -413,10 +413,10 @@ struct TensorIterator {
m_tensorIter.resize(m_squashed_shape.size(), 0);
getCoordinate(m_tensorIter, start, m_squashed_shape);
- size_t i;
+ size_t i = 0;
size_t dst_idx = 0;
size_t indices_idx = 0;
- for (i = 0; i < static_cast<size_t>(m_squashed_axis); ++i) {
+ for (; i < static_cast<size_t>(m_squashed_axis); ++i) {
dst_idx += m_tensorIter[i] * dataBlockND[i + 1];
indices_idx += m_tensorIter[i] * indicesBlockND[i + 1];
}
diff --git a/src/plugins/intel_cpu/src/nodes/shuffle_channels.cpp b/src/plugins/intel_cpu/src/nodes/shuffle_channels.cpp
index f1ebfe26c1d..1a8ff875b18 100644
--- a/src/plugins/intel_cpu/src/nodes/shuffle_channels.cpp
+++ b/src/plugins/intel_cpu/src/nodes/shuffle_channels.cpp
@@ -108,16 +108,18 @@ void ShuffleChannels::initSupportedPrimitiveDescriptors() {
THROW_CPU_NODE_ERR("has unsupported precision: ", precision.get_type_name());
}
- impl_desc_type impl_type;
- if (mayiuse(cpu::x64::avx512_core)) {
- impl_type = impl_desc_type::jit_avx512;
- } else if (mayiuse(cpu::x64::avx2)) {
- impl_type = impl_desc_type::jit_avx2;
- } else if (mayiuse(cpu::x64::sse41)) {
- impl_type = impl_desc_type::jit_sse42;
- } else {
- impl_type = impl_desc_type::ref;
- }
+ auto impl_type = []() {
+ if (mayiuse(cpu::x64::avx512_core)) {
+ return impl_desc_type::jit_avx512;
+ }
+ if (mayiuse(cpu::x64::avx2)) {
+ return impl_desc_type::jit_avx2;
+ }
+ if (mayiuse(cpu::x64::sse41)) {
+ return impl_desc_type::jit_sse42;
+ }
+ return impl_desc_type::ref;
+ }();
// use ncsp as default for non-quantized networks and nspc for quantized
auto firstCreatorType = context->isGraphQuantized() ? LayoutType::nspc : LayoutType::ncsp;
diff --git a/src/plugins/intel_cpu/src/nodes/space_to_depth.cpp b/src/plugins/intel_cpu/src/nodes/space_to_depth.cpp
index fc3471084f0..c39bc83170f 100644
--- a/src/plugins/intel_cpu/src/nodes/space_to_depth.cpp
+++ b/src/plugins/intel_cpu/src/nodes/space_to_depth.cpp
@@ -275,8 +275,8 @@ SpaceToDepth::SpaceToDepthExecutor::SpaceToDepthExecutor(const SpaceToDepthAttrs
};
if (isBlocked) {
- size_t orderShiftForBlocks;
- size_t orderShiftForDims;
+ size_t orderShiftForBlocks = 0;
+ size_t orderShiftForDims = 0;
if (attrs.mode == Mode::BLOCKS_FIRST) {
orderShiftForBlocks = attrs.nSpatialDims + 2;
orderShiftForDims = 1;
diff --git a/src/plugins/intel_cpu/src/nodes/topk.cpp b/src/plugins/intel_cpu/src/nodes/topk.cpp
index e04ae7a471d..23cd4d96784 100644
--- a/src/plugins/intel_cpu/src/nodes/topk.cpp
+++ b/src/plugins/intel_cpu/src/nodes/topk.cpp
@@ -1979,16 +1979,18 @@ void TopK::initSupportedPrimitiveDescriptors() {
return;
}
- impl_desc_type impl_type;
- if (mayiuse(cpu::x64::avx512_core)) {
- impl_type = impl_desc_type::jit_avx512;
- } else if (mayiuse(cpu::x64::avx2)) {
- impl_type = impl_desc_type::jit_avx2;
- } else if (mayiuse(cpu::x64::sse41)) {
- impl_type = impl_desc_type::jit_sse42;
- } else {
- impl_type = impl_desc_type::ref;
- }
+ impl_desc_type impl_type = [&]() {
+ if (mayiuse(cpu::x64::avx512_core)) {
+ return impl_desc_type::jit_avx512;
+ }
+ if (mayiuse(cpu::x64::avx2)) {
+ return impl_desc_type::jit_avx2;
+ }
+ if (mayiuse(cpu::x64::sse41)) {
+ return impl_desc_type::jit_sse42;
+ }
+ return impl_desc_type::ref;
+ }();
#if defined(OPENVINO_ARCH_X86_64)
jit_mode = mayiuse(cpu::x64::sse41);
@@ -2149,8 +2151,7 @@ void TopK::prepareParams() {
prepare_original_idx();
} else { // reference mode
- int j;
- for (j = src_dims.size() - 1; j >= 0; j--) {
+ for (int j = src_dims.size() - 1; j >= 0; j--) {
if (src_dims[j] != 1) {
break;
}
@@ -2496,16 +2497,14 @@ void TopK::topk_ref_process(const float* src_data,
parallel_for2d(before_num, after_num, [&](int i0, int i1) {
std::vector<float> max_values(top_k + 1);
std::vector<int> max_indexes(top_k + 1);
- float tmp_value;
- int tmp_index;
int s_index = i0 * dim * after_num + i1;
auto swap_func = [&](int index1, int index2) {
- tmp_value = max_values[index1];
+ float tmp_value = max_values[index1];
max_values[index1] = max_values[index2];
max_values[index2] = tmp_value;
- tmp_index = max_indexes[index1];
+ int tmp_index = max_indexes[index1];
max_indexes[index1] = max_indexes[index2];
max_indexes[index2] = tmp_index;
};
diff --git a/src/plugins/intel_cpu/src/plugin.cpp b/src/plugins/intel_cpu/src/plugin.cpp
index 20220027c08..c156d57380e 100644
--- a/src/plugins/intel_cpu/src/plugin.cpp
+++ b/src/plugins/intel_cpu/src/plugin.cpp
@@ -114,7 +114,7 @@ static bool streamsSet(const ov::AnyMap& config) {
void Plugin::get_performance_streams(Config& config, const std::shared_ptr<ov::Model>& model) {
int streams_set = config.streams;
- int streams;
+ int streams = 0;
if (config.streamsChanged) {
streams = streams_set;
} else if (config.hintPerfMode == ov::hint::PerformanceMode::LATENCY) {
@@ -136,7 +136,7 @@ void Plugin::calculate_streams(Config& conf, const std::shared_ptr<ov::Model>& m
const auto model_prefer_name = std::string("MODEL_PREFER_THREADS");
if (imported && model->has_rt_info("intel_cpu_hints_config")) {
// load model_prefer_threads from cache
- int cache_model_prefer;
+ int cache_model_prefer = 0;
const auto& hints_config = model->get_rt_info<ov::AnyMap>("intel_cpu_hints_config");
const auto it_model_prefer = hints_config.find(model_prefer_name);
if (it_model_prefer != hints_config.end()) {
diff --git a/src/plugins/intel_cpu/src/transformations/cpu_opset/common/pass/causal_mask_preprocess_fusion.cpp b/src/plugins/intel_cpu/src/transformations/cpu_opset/common/pass/causal_mask_preprocess_fusion.cpp
index a72dd3ce3b7..ea23b1e80a4 100644
--- a/src/plugins/intel_cpu/src/transformations/cpu_opset/common/pass/causal_mask_preprocess_fusion.cpp
+++ b/src/plugins/intel_cpu/src/transformations/cpu_opset/common/pass/causal_mask_preprocess_fusion.cpp
@@ -87,7 +87,7 @@ template <typename T>
bool is_triu(ov::op::v0::Constant* cmask, size_t rows, size_t columns) {
const auto* ptr = reinterpret_cast<const T*>(cmask->get_data_ptr());
for (size_t y = 0; y < rows; y++, ptr += columns) {
- size_t x;
+ size_t x = 0;
for (x = 0; x <= y; x++) {
if (ptr[x]) {
return false;
diff --git a/src/plugins/intel_cpu/src/transformations/snippets/x64/pass/lowered/brgemm_cpu_blocking.cpp b/src/plugins/intel_cpu/src/transformations/snippets/x64/pass/lowered/brgemm_cpu_blocking.cpp
index 9fb674bc6b3..80c12ac92e3 100644
--- a/src/plugins/intel_cpu/src/transformations/snippets/x64/pass/lowered/brgemm_cpu_blocking.cpp
+++ b/src/plugins/intel_cpu/src/transformations/snippets/x64/pass/lowered/brgemm_cpu_blocking.cpp
@@ -120,10 +120,7 @@ std::tuple<size_t, size_t, size_t> BrgemmCPUBlocking::get_blocking_params(
const auto brgemm = ov::as_type_ptr<ov::intel_cpu::BrgemmCPU>(brgemm_expr->get_node());
assert(brgemm && "BrgemmCPU is expected!");
- size_t m_blk;
- size_t n_blk;
- size_t k_blk;
- std::tie(m_blk, n_blk, k_blk) = BrgemmBlockingBase::get_blocking_params(brgemm_expr);
+ auto [m_blk, n_blk, k_blk] = BrgemmBlockingBase::get_blocking_params(brgemm_expr);
// [TODO]: K,N blocking is functionally enabled, need to turn it on after blocking heuristic is updated to cover
// the low precision cases (ticket: 156014)
if (is_kn_blocking_supported(brgemm->get_type(), brgemm->get_input_element_type(1))) {
diff --git a/src/plugins/intel_cpu/src/transformations/tpp/common/pass/lowered/brgemm_tpp_blocking.cpp b/src/plugins/intel_cpu/src/transformations/tpp/common/pass/lowered/brgemm_tpp_blocking.cpp
index 7bd571ea66a..8fb7042f9dd 100644
--- a/src/plugins/intel_cpu/src/transformations/tpp/common/pass/lowered/brgemm_tpp_blocking.cpp
+++ b/src/plugins/intel_cpu/src/transformations/tpp/common/pass/lowered/brgemm_tpp_blocking.cpp
@@ -41,17 +41,11 @@ std::shared_ptr<snippets::lowered::pass::PassBase> BrgemmTPPBlocking::SetBrgemmB
std::tuple<size_t, size_t, size_t> BrgemmTPPBlocking::get_blocking_params(
const ov::snippets::lowered::ExpressionPtr& brgemm_expr) const {
- size_t m;
- size_t n;
- size_t k;
- std::tie(m, n, k) = get_brgemm_dimensions(brgemm_expr);
+ auto [m, n, k] = get_brgemm_dimensions(brgemm_expr);
OPENVINO_ASSERT(!is_dynamic_value(m) && !is_dynamic_value(n) && !is_dynamic_value(n),
"BrgemmTPP doesn't support dynamic shapes");
- size_t m_blk;
- size_t n_blk;
- size_t k_blk;
- std::tie(m_blk, n_blk, k_blk) = BrgemmBlockingBase::get_blocking_params(brgemm_expr);
+ auto [m_blk, n_blk, k_blk] = BrgemmBlockingBase::get_blocking_params(brgemm_expr);
auto get_projected_blk = [](const size_t dim, const size_t blk) {
return ov::snippets::utils::is_full_dim_value(blk) ? dim : blk;
diff --git a/src/plugins/intel_cpu/src/utils/node_dumper.cpp b/src/plugins/intel_cpu/src/utils/node_dumper.cpp
index a1f8d92cac2..b1bfe1ceadc 100644
--- a/src/plugins/intel_cpu/src/utils/node_dumper.cpp
+++ b/src/plugins/intel_cpu/src/utils/node_dumper.cpp
@@ -46,7 +46,7 @@ static bool shouldBeDumped(const NodePtr& node, const DebugCapsConfig& config, c
if (auto it = dumpFilters.find(DebugCapsConfig::FILTER::BY_EXEC_ID);
it != dumpFilters.end()) { // filter by exec id configured
std::stringstream ss(it->second);
- int id;
+ int id = 0;
bool matched = false;
while (ss >> id) {