Skip to content

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

[CPU] Apply 'readability-*' clang-tidy remarks (#30769)

Arseniy Obolenskiyd1c65e2d8ab9
diff --git a/src/plugins/intel_cpu/src/.clang-tidy b/src/plugins/intel_cpu/src/.clang-tidy
index a99796f9a52..c3c2a4f101a 100644
--- a/src/plugins/intel_cpu/src/.clang-tidy
+++ b/src/plugins/intel_cpu/src/.clang-tidy
@@ -3,10 +3,6 @@
### NOTE:
# The 'Checks: >' is a multiline string here. Comment must not be moved into the string.
#
-### Scopes to be enabled:
-#
-# readability-*,
-#
### Checks that are turned off for a reason:
#
# -cppcoreguidelines-avoid-c-arrays. There are a lot of code which uses C-style arrays
@@ -52,8 +48,18 @@
# -misc-header-include-cycle,
# -misc-non-private-member-variables-in-classes,
# -misc-use-anonymous-namespace,
-# -readability-magic-numbers, cppcoreguidelines-avoid-magic-numbers
+# -readability-avoid-nested-conditional-operator
+# -readability-avoid-return-with-void-value
+# -readability-const-return-type
+# -readability-convert-member-functions-to-static
# -readability-function-cognitive-complexity. Reasonable way to enforce splitting complex code into simple functions
+# -readability-inconsistent-declaration-parameter-name
+# -readability-isolate-declaration
+# -readability-magic-numbers, cppcoreguidelines-avoid-magic-numbers
+# -readability-simplify-boolean-expr
+# -readability-static-accessed-through-instance
+# -readability-suspicious-call-argument
+# -readability-use-anyofallof
# Remove warning disablement after CI pipeline migrates to C++17 from C++20 for:
# -modernize-use-constraints,
# -modernize-use-std-numbers
@@ -66,10 +72,7 @@ Checks: >
google-*,
modernize-*,
misc-*,
- readability-container-size-empty,
- readability-else-after-return,
- readability-implicit-bool-conversion,
- readability-qualified-auto,
+ readability-*,
-bugprone-easily-swappable-parameters,
-bugprone-exception-escape,
-bugprone-implicit-widening-of-multiplication-result,
@@ -79,6 +82,7 @@ Checks: >
-cppcoreguidelines-avoid-c-arrays,
-cppcoreguidelines-avoid-const-or-ref-data-members,
-cppcoreguidelines-avoid-do-while,
+ -cppcoreguidelines-avoid-magic-numbers,
-cppcoreguidelines-avoid-non-const-global-variables,
-cppcoreguidelines-explicit-virtual-functions,
-cppcoreguidelines-init-variables,
@@ -111,11 +115,20 @@ Checks: >
-misc-no-recursion,
-misc-non-private-member-variables-in-classes,
-misc-use-anonymous-namespace,
+ -readability-avoid-nested-conditional-operator,
+ -readability-avoid-return-with-void-value,
+ -readability-const-return-type,
+ -readability-convert-member-functions-to-static,
+ -readability-function-cognitive-complexity,
-readability-identifier-length,
+ -readability-inconsistent-declaration-parameter-name,
+ -readability-isolate-declaration,
-readability-magic-numbers,
- -cppcoreguidelines-avoid-magic-numbers,
+ -readability-simplify-boolean-expr,
+ -readability-static-accessed-through-instance,
+ -readability-suspicious-call-argument,
-readability-uppercase-literal-suffix,
- -readability-function-cognitive-complexity,
+ -readability-use-anyofallof,
# Treat warnings as errors
WarningsAsErrors: '*'
# Use clang-format for applied fixes
@@ -153,8 +166,7 @@ CheckOptions:
.*/selective_build.h;
src/plugins/intel_cpu/src/emitters/plugin/aarch64/jit_emitter.hpp;
src/plugins/intel_cpu/src/emitters/plugin/aarch64/jit_emitter.cpp;
-### To be considered to enable:
# Reasonable way to enforce splitting complex code into simple functions
-# - key: google-readability-function-size.StatementThreshold
-# value: "800"
+ - key: readability-function-size.StatementThreshold
+ value: "800"
---
diff --git a/src/plugins/intel_cpu/src/compiled_model.cpp b/src/plugins/intel_cpu/src/compiled_model.cpp
index 1d3872761e7..07cb29ab36a 100644
--- a/src/plugins/intel_cpu/src/compiled_model.cpp
+++ b/src/plugins/intel_cpu/src/compiled_model.cpp
@@ -192,7 +192,7 @@ CompiledModel::GraphGuard::Lock CompiledModel::get_graph() const {
try {
GraphContext::Ptr ctx;
{
- std::lock_guard<std::mutex> lock{*m_mutex.get()};
+ std::lock_guard<std::mutex> lock{*m_mutex};
auto isQuantizedFlag = (m_cfg.lpTransformsMode == Config::On) &&
ov::pass::low_precision::LowPrecision::isFunctionQuantized(m_model);
ctx = std::make_shared<GraphContext>(m_cfg,
diff --git a/src/plugins/intel_cpu/src/config.cpp b/src/plugins/intel_cpu/src/config.cpp
index e8624f09d18..0ae72decc03 100644
--- a/src/plugins/intel_cpu/src/config.cpp
+++ b/src/plugins/intel_cpu/src/config.cpp
@@ -177,7 +177,7 @@ void Config::readProperties(const ov::AnyMap& prop, const ModelType modelType) {
". Expected only true/false.");
}
} else if (key == ov::intel_cpu::sparse_weights_decompression_rate.name()) {
- float val_f = 0.0f;
+ float val_f = 0.0F;
try {
val_f = val.as<float>();
} catch (const ov::Exception&) {
@@ -185,7 +185,7 @@ void Config::readProperties(const ov::AnyMap& prop, const ModelType modelType) {
ov::intel_cpu::sparse_weights_decompression_rate.name(),
". Expected only float numbers");
}
- if (val_f < 0.f || val_f > 1.f) {
+ if (val_f < 0.F || val_f > 1.F) {
OPENVINO_THROW("Wrong value for property key ",
ov::intel_cpu::sparse_weights_decompression_rate.name(),
". Sparse rate must be in range [0.0f,1.0f]");
@@ -523,12 +523,12 @@ void Config::updateProperties() {
return;
}
- if (collectPerfCounters == true) {
+ if (collectPerfCounters) {
_config.insert({ov::enable_profiling.name(), "YES"});
} else {
_config.insert({ov::enable_profiling.name(), "NO"});
}
- if (exclusiveAsyncRequests == true) {
+ if (exclusiveAsyncRequests) {
_config.insert({ov::internal::exclusive_async_requests.name(), "YES"});
} else {
_config.insert({ov::internal::exclusive_async_requests.name(), "NO"});
diff --git a/src/plugins/intel_cpu/src/cpu_memory.cpp b/src/plugins/intel_cpu/src/cpu_memory.cpp
index 8f9ef0c0d10..064d4545992 100644
--- a/src/plugins/intel_cpu/src/cpu_memory.cpp
+++ b/src/plugins/intel_cpu/src/cpu_memory.cpp
@@ -58,7 +58,7 @@ BlockedMemoryDescPtr IMemory::getDescWithType<BlockedMemoryDesc, 0, 0>() const {
namespace {
inline void setSubnormalsToZeroAndbf16Saturation(float* data, size_t size, bool ftz, bool bf16saturation) {
auto* u32data = reinterpret_cast<uint32_t*>(data);
- auto* floatdata = reinterpret_cast<float*>(data);
+ auto* floatdata = data;
if (ftz && bf16saturation) {
for (size_t i = 0; i < size; ++i) {
if ((u32data[i] & (0xFF << 23)) == 0) {
@@ -292,7 +292,7 @@ bool MemoryBlockWithReuse::hasExtBuffer() const noexcept {
void MemoryBlockWithReuse::free() {
m_data = decltype(m_data)(nullptr, release);
- m_memUpperBound = 0ul;
+ m_memUpperBound = 0UL;
m_useExternalStorage = false;
}
@@ -627,7 +627,7 @@ bool mbind_move(void* data, size_t size, int targetNode) {
mask = -1;
flags = 0;
} else {
- mask = 1ul << realNode;
+ mask = 1UL << realNode;
flags = MPOL_MF_MOVE | MPOL_MF_STRICT;
}
diff --git a/src/plugins/intel_cpu/src/cpu_streams_calculation.cpp b/src/plugins/intel_cpu/src/cpu_streams_calculation.cpp
index d593e70d9ff..ddd98479d1a 100644
--- a/src/plugins/intel_cpu/src/cpu_streams_calculation.cpp
+++ b/src/plugins/intel_cpu/src/cpu_streams_calculation.cpp
@@ -52,8 +52,6 @@ void sort_table_by_numa_node_id(const int current_numa_node, std::vector<std::ve
}
}
}
-
- return;
};
std::vector<std::vector<int>> get_streams_info_table(
@@ -220,9 +218,8 @@ std::vector<std::vector<int>> get_streams_info_table(
}
}
- if (((input_streams_changed == false) &&
- (input_perf_hint == ov::util::to_string(ov::hint::PerformanceMode::LATENCY))) ||
- ((input_streams_changed == true) && (input_streams == 1))) {
+ if (((!input_streams_changed) && (input_perf_hint == ov::util::to_string(ov::hint::PerformanceMode::LATENCY))) ||
+ ((input_streams_changed) && (input_streams == 1))) {
n_streams = 1;
stream_info[NUMBER_OF_STREAMS] = n_streams;
for (auto& n : proc_socket_table) {
@@ -301,14 +298,14 @@ std::vector<std::vector<int>> get_streams_info_table(
} else {
n_threads =
input_threads > 0 ? std::min(proc_type_table[0][ALL_PROC], input_threads) : proc_type_table[0][ALL_PROC];
- if ((input_streams_changed == true) && (input_streams > 0)) {
+ if ((input_streams_changed) && (input_streams > 0)) {
n_streams = input_infer_requests > 0 ? std::min(input_infer_requests, input_streams) : input_streams;
if (n_streams >= n_threads) {
n_streams = n_threads;
n_threads_per_stream = 1;
} else {
n_threads_per_stream =
- std::min(static_cast<int>(n_threads / n_streams),
+ std::min((n_threads / n_streams),
proc_type_table[0][MAIN_CORE_PROC] == 0 ? proc_type_table[0][EFFICIENT_CORE_PROC]
: proc_type_table[0][MAIN_CORE_PROC]);
check_threads_per_stream();
@@ -336,20 +333,20 @@ std::vector<std::vector<int>> get_streams_info_table(
} else if (proc_type_table.size() == 1) {
n_threads_per_stream = n_proc;
} else {
- n_threads_per_stream = (n_proc > 16) ? 4 : std::max(1, static_cast<int>(n_proc / 4));
+ n_threads_per_stream = (n_proc > 16) ? 4 : std::max(1, (n_proc / 4));
}
- n_streams = static_cast<int>(n_threads / n_threads_per_stream);
+ n_streams = (n_threads / n_threads_per_stream);
if ((input_infer_requests > 0) && (n_streams > input_infer_requests)) {
n_streams = input_infer_requests;
if (proc_type_table.size() == 1) {
- n_threads_per_stream = std::min(static_cast<int>(n_threads / n_streams), n_proc);
+ n_threads_per_stream = std::min((n_threads / n_streams), n_proc);
} else {
- n_threads_per_stream = static_cast<int>(n_threads / n_streams);
+ n_threads_per_stream = (n_threads / n_streams);
}
} else {
while ((n_streams * 2 <= n_threads_per_stream) && (n_threads_per_stream > 1)) {
- n_threads_per_stream = static_cast<int>(n_threads_per_stream / 2);
- n_streams = static_cast<int>(n_threads / n_threads_per_stream);
+ n_threads_per_stream = (n_threads_per_stream / 2);
+ n_streams = (n_threads / n_threads_per_stream);
}
}
} else if ((1 == model_prefer_threads) &&
@@ -358,8 +355,8 @@ std::vector<std::vector<int>> get_streams_info_table(
(proc_type_table[0][MAIN_CORE_PROC] > 0) && (n_threads > proc_type_table[0][MAIN_CORE_PROC])) {
n_streams = (n_threads >= proc_type_table[0][MAIN_CORE_PROC] + proc_type_table[0][EFFICIENT_CORE_PROC] +
proc_type_table[0][LP_EFFICIENT_CORE_PROC])
- ? static_cast<int>(n_threads - proc_type_table[0][EFFICIENT_CORE_PROC] / 2 -
- proc_type_table[0][LP_EFFICIENT_CORE_PROC] / 2)
+ ? (n_threads - proc_type_table[0][EFFICIENT_CORE_PROC] / 2 -
+ proc_type_table[0][LP_EFFICIENT_CORE_PROC] / 2)
: static_cast<int>(proc_type_table[0][MAIN_CORE_PROC] +
(n_threads - proc_type_table[0][MAIN_CORE_PROC]) / 2);
n_streams = input_infer_requests > 0 ? std::min(n_streams, input_infer_requests) : n_streams;
@@ -371,10 +368,10 @@ std::vector<std::vector<int>> get_streams_info_table(
n_streams = ((n_threads + model_threads - 1) / model_threads);
if ((input_infer_requests > 0) && (n_streams > input_infer_requests)) {
n_streams = input_infer_requests;
- n_threads_per_stream = static_cast<int>(n_threads / n_streams);
+ n_threads_per_stream = (n_threads / n_streams);
check_threads_per_stream();
} else {
- n_threads_per_stream = model_threads > 0 ? model_threads : static_cast<int>(n_threads / n_streams);
+ n_threads_per_stream = model_threads > 0 ? model_threads : (n_threads / n_streams);
}
}
}
@@ -592,25 +589,25 @@ int get_model_prefer_threads(const int num_streams,
}
#else
const auto isa = dnnl::get_effective_cpu_isa();
- float isaSpecificThreshold = 1.0f;
+ float isaSpecificThreshold = 1.0F;
switch (isa) {
case dnnl::cpu_isa::sse41:
- isaSpecificThreshold = 0.5f;
+ isaSpecificThreshold = 0.5F;
break;
case dnnl::cpu_isa::avx2:
case dnnl::cpu_isa::avx512_core:
- isaSpecificThreshold = 1.0f;
+ isaSpecificThreshold = 1.0F;
break;
case dnnl::cpu_isa::avx512_core_vnni:
case dnnl::cpu_isa::avx2_vnni:
case dnnl::cpu_isa::avx2_vnni_2:
- isaSpecificThreshold = 2.0f;
+ isaSpecificThreshold = 2.0F;
break;
case dnnl::cpu_isa::avx512_core_amx:
- isaSpecificThreshold = 4.0f;
+ isaSpecificThreshold = 4.0F;
break;
default:
- isaSpecificThreshold = 1.0f;
+ isaSpecificThreshold = 1.0F;
}
// the more "capable" the CPU in general, the more streams we may want to keep to keep it utilized
const float memThresholdAssumeLimitedForISA = ov::MemBandwidthPressure::LIMITED / isaSpecificThreshold;
diff --git a/src/plugins/intel_cpu/src/dnnl_extension_utils.cpp b/src/plugins/intel_cpu/src/dnnl_extension_utils.cpp
index 030ed170c0a..d604b3c976f 100644
--- a/src/plugins/intel_cpu/src/dnnl_extension_utils.cpp
+++ b/src/plugins/intel_cpu/src/dnnl_extension_utils.cpp
@@ -65,7 +65,7 @@ uint8_t DnnlExtensionUtils::sizeOfDataType(dnnl::memory::data_type dataType) {
std::optional<dnnl::memory::data_type> DnnlExtensionUtils::ElementTypeToDataType(
const ov::element::Type& elementType,
- DnnlExtensionUtils::nothrow_tag) noexcept {
+ DnnlExtensionUtils::nothrow_tag /*unused*/) noexcept {
switch (elementType) {
case ov::element::f32:
return memory::data_type::f32;
@@ -105,7 +105,7 @@ std::optional<dnnl::memory::data_type> DnnlExtensionUtils::ElementTypeToDataType
}
dnnl::memory::data_type DnnlExtensionUtils::ElementTypeToDataType(const ov::element::Type& elementType,
- DnnlExtensionUtils::throw_tag) {
+ DnnlExtensionUtils::throw_tag /*unused*/) {
auto&& result = ElementTypeToDataType(elementType, nothrow_tag{});
OPENVINO_ASSERT(result, "CPU plugin does not support ", elementType.to_string(), " for use with oneDNN.");
return result.value();
diff --git a/src/plugins/intel_cpu/src/dnnl_postops_composer.cpp b/src/plugins/intel_cpu/src/dnnl_postops_composer.cpp
index b281afc6ac4..50614a327b2 100644
--- a/src/plugins/intel_cpu/src/dnnl_postops_composer.cpp
+++ b/src/plugins/intel_cpu/src/dnnl_postops_composer.cpp
@@ -145,15 +145,15 @@ bool DnnlPostOpsComposer::appendAttrPostOps(const ActivationPostOp& postOp,
if (postOp.type() == ActivationPostOp::Type::powerstatic) {
const auto& scale = postOp.beta();
const auto& shift = postOp.gamma();
- if (scale != 1.0f && shift != 0.0f) {
+ if (scale != 1.0F && shift != 0.0F) {
return appendLinear({scale}, {shift}, isLastPostOp, allowBinary);
}
- if (scale != 1.0f) { // Multiply if has scales
+ if (scale != 1.0F) { // Multiply if has scales
return appendScale({scale}, isLastPostOp, allowBinary);
}
- if (shift != 0.0f) { // Add only if has shifts
+ if (shift != 0.0F) { // Add only if has shifts
return appendShift({shift}, allowBinary);
}
@@ -199,12 +199,12 @@ bool DnnlPostOpsComposer::appendAttrPostOps(const ScaleShiftPostOp& postOp, bool
static float roundHalfToEven(float f) {
const float RHAFZ = std::round(f); // r is round-half-away-from-zero
const float d = RHAFZ - f; // f + d -> RHAFZ
- if ((d != 0.5f) && (d != -0.5f)) {
+ if ((d != 0.5F) && (d != -0.5F)) {
return RHAFZ;
}
// already even +/-1.5 -> +/-2
- if (std::fmod(RHAFZ, 2.0f) == 0.0f) {
+ if (std::fmod(RHAFZ, 2.0F) == 0.0F) {
return RHAFZ;
}
@@ -285,7 +285,7 @@ static OptimizedFormula updateOptimizedFormula(const FakeQuantizePostOp& postOp,
// per-channel input shift, this threshold was chosen carefully
// to recorver the per-Tensor nature w/o mistaking a real
// per-channel FQ.
- if (isPerTensor(inputShift, inputShift[0], 0.00005f)) {
+ if (isPerTensor(inputShift, inputShift[0], 0.00005F)) {
f.ish.resize(OC);
for (auto& v : f.ish) {
v = inputShift[0];
@@ -349,7 +349,7 @@ static OptimizedFormula updateOptimizedFormula(const FakeQuantizePostOp& postOp,
f.shrinkLength();
- if (f.osc.size() == 1 && f.osc[0] == 1.0f && f.osh.size() == 1 && f.osh[0] == std::trunc(f.osh[0])) {
+ if (f.osc.size() == 1 && f.osc[0] == 1.0F && f.osh.size() == 1 && f.osh[0] == std::trunc(f.osh[0])) {
// if outputScale == 1.0f and outputShift is interger, it can be further optimized
// x = clip2(round(x * inputScale + ish),c2lo,c2hi)*osc + osh
// = clip2(round(x * inputScale + ish),c2lo,c2hi) + osh
@@ -371,8 +371,8 @@ static OptimizedFormula updateOptimizedFormula(const FakeQuantizePostOp& postOp,
// we can save an additional eltwise linear for negligible shift
if (f.ish.size() == 1 && f.clo.size() == 1 && f.chi.size() == 1) {
auto range = (f.chi[0] - f.clo[0]);
- if (abs(f.ish[0]) < range * 0.00001f) {
- f.ish[0] = 0.0f;
+ if (abs(f.ish[0]) < range * 0.00001F) {
+ f.ish[0] = 0.0F;
}
}
@@ -407,10 +407,10 @@ bool DnnlPostOpsComposer::appendAttrPostOps(const FakeQuantizePostOp& postOp,
bool skipRoundClipOutputLinear = false;
if (isLastPostOp && (postOp.levels() == 256) && f.clo.size() == 1 && f.chi.size() == 1 && f.osc.empty() &&
f.osh.empty()) {
- if (outDataType == dnnl::memory::data_type::u8 && f.clo[0] <= 0.0f && f.chi[0] >= 255.0f) {
+ if (outDataType == dnnl::memory::data_type::u8 && f.clo[0] <= 0.0F && f.chi[0] >= 255.0F) {
skipRoundClipOutputLinear = true;
}
- if (outDataType == dnnl::memory::data_type::s8 && f.clo[0] <= -128.0f && f.chi[0] >= 127.0f) {
+ if (outDataType == dnnl::memory::data_type::s8 && f.clo[0] <= -128.0F && f.chi[0] >= 127.0F) {
skipRoundClipOutputLinear = true;
}
}
@@ -449,7 +449,7 @@ bool DnnlPostOpsComposer::appendAttrPostOps(const FakeQuantizePostOp& postOp,
}
void DnnlPostOpsComposer::updateWeiScales() {
- if (wei_scale_mask == 0 && wei_scale_values[0] == 1.0f) {
+ if (wei_scale_mask == 0 && wei_scale_values[0] == 1.0F) {
return;
}
@@ -464,7 +464,7 @@ void DnnlPostOpsComposer::updateWeiScales() {
}
void DnnlPostOpsComposer::updateDestScales() {
- if (dst_scale_val == 1.0f) {
+ if (dst_scale_val == 1.0F) {
return;
}
@@ -519,7 +519,7 @@ bool DnnlPostOpsComposer::appendScale(const std::vector<float>& scale, bool isLa
bool fuseIntoWeiScale = false;
// Use dest scale when last post-ops is per-tensor quantization.
if ((isINT8 && isLastPostOp && scale.size() == 1)) {
- dst_scale_val = 1.0f / scale[0];
+ dst_scale_val = 1.0F / scale[0];
updateDestScales();
return true;
}
@@ -606,8 +606,8 @@ bool DnnlPostOpsComposer::appendScale(const std::vector<float>& scale, bool isLa
bool DnnlPostOpsComposer::appendShift(const std::vector<float>& shift, bool allowBinary) {
if (shift.size() == 1) {
- if (shift[0] != 0.0f) {
- appendEltwise(dnnl::algorithm::eltwise_linear, 1.0f, shift[0]);
+ if (shift[0] != 0.0F) {
+ appendEltwise(dnnl::algorithm::eltwise_linear, 1.0F, shift[0]);
}
} else {
if (!allowBinary) {
@@ -623,7 +623,7 @@ bool DnnlPostOpsComposer::appendLinear(const std::vector<float>& scale,
bool isLastPostOp,
bool allowBinary) {
if (scale.size() == 1 && shift.size() == 1) {
- if (shift[0] == 0.0f) {
+ if (shift[0] == 0.0F) {
return appendScale(scale, isLastPostOp, allowBinary);
}
appendEltwise(dnnl::algorithm::eltwise_linear, scale[0], shift[0]);
@@ -856,8 +856,8 @@ void DnnlPostOpsComposer::appendAttrPostOpsLegacy(const ActivationPostOp& postOp
// d = s^alpha + s*beta + gamma
if (postOp.type() == ActivationPostOp::Type::powerstatic) {
ops.append_eltwise(dnnl::algorithm::eltwise_linear, postOp.beta(), postOp.gamma());
- if (postOp.alpha() != 1.0f) {
- ops.append_eltwise(dnnl::algorithm::eltwise_pow, 1.0f, postOp.alpha());
+ if (postOp.alpha() != 1.0F) {
+ ops.append_eltwise(dnnl::algorithm::eltwise_pow, 1.0F, postOp.alpha());
}
return;
}
@@ -943,13 +943,13 @@ void DnnlPostOpsComposer::appendAttrPostOpsLegacy(const FakeQuantizePostOp& post
std::fill(binarizationThresholds.begin() + 1,
binarizationThresholds.begin() + realAxisSize,
binarizationThresholds[0]);
- std::fill(binarizationThresholds.begin() + realAxisSize, binarizationThresholds.end(), 0.f);
+ std::fill(binarizationThresholds.begin() + realAxisSize, binarizationThresholds.end(), 0.F);
}
if (postOp.isOutputHighBroadcast()) {
std::fill(binarizationOutputMask.begin() + 1,
binarizationOutputMask.begin() + realAxisSize,
binarizationOutputMask[0]);
- std::fill(binarizationThresholds.begin() + realAxisSize, binarizationThresholds.end(), 0.f);
+ std::fill(binarizationThresholds.begin() + realAxisSize, binarizationThresholds.end(), 0.F);
}
return ops.append_binarization(dnnl::algorithm::binarization_depthwise,
@@ -984,22 +984,22 @@ void DnnlPostOpsComposer::appendAttrPostOpsLegacy(const FakeQuantizePostOp& post
std::array<bool, 6> all_default = {false};
all_default[0] = std::all_of(cropLow.cbegin(), cropLow.cend(), [](float val) {
- return val == 0.f;
+ return val == 0.F;
});
all_default[1] = std::all_of(cropHigh.cbegin(), cropHigh.cend(), [](float val) {
- return val == 0.f;
+ return val == 0.F;
});
all_default[2] = std::all_of(inputScale.cbegin(), inputScale.cend(), [](float val) {
- return val == 1.f;
+ return val == 1.F;
});
all_default[3] = std::all_of(inputShift.cbegin(), inputShift.cend(), [](float val) {
- return val == 0.f;
+ return val == 0.F;
});
all_default[4] = std::all_of(outputScale.cbegin(), outputScale.cend(), [](float val) {
- return val == 1.f;
+ return val == 1.F;
});
all_default[5] = std::all_of(outputShift.cbegin(), outputShift.cend(), [](float val) {
- return val == 0.f;
+ return val == 0.F;
});
std::array<size_t, 6> offsets = {0};
@@ -1082,11 +1082,7 @@ DnnlPrimitiveAttrs DnnlPostOpsComposer::compose() {
}
}
- if (hasSubsequentSum && hasSubsequentFQ) {
- return false;
- }
-
- return true;
+ return !(hasSubsequentSum && hasSubsequentFQ);
};
auto round = i == 0 ? doRounding() : true;
diff --git a/src/plugins/intel_cpu/src/dnnl_postops_composer_legacy.cpp b/src/plugins/intel_cpu/src/dnnl_postops_composer_legacy.cpp
index 1c2f68a2abf..e456009fee8 100644
--- a/src/plugins/intel_cpu/src/dnnl_postops_composer_legacy.cpp
+++ b/src/plugins/intel_cpu/src/dnnl_postops_composer_legacy.cpp
@@ -68,7 +68,7 @@ DnnlPostOpsComposerLegacy::DnnlPostOpsComposerLegacy(const dnnl::engine& engine,
}
void DnnlPostOpsComposerLegacy::updateWeiScales() {
- if (wei_scale_mask == 0 && wei_scale_values[0] == 1.0f) {
+ if (wei_scale_mask == 0 && wei_scale_values[0] == 1.0F) {
return;
}
@@ -82,7 +82,7 @@ void DnnlPostOpsComposerLegacy::updateWeiScales() {
}
void DnnlPostOpsComposerLegacy::updateDestScales() {
- if (dst_scale_val == 1.0f) {
+ if (dst_scale_val == 1.0F) {
return;
}
@@ -213,8 +213,8 @@ bool DnnlPostOpsComposerLegacy::appendScale(const std::vector<float>& scale, boo
bool DnnlPostOpsComposerLegacy::appendShift(const std::vector<float>& shift, bool allowBinary) {
if (shift.size() == 1) {
- if (shift[0] != 0.0f) {
- appendEltwise(dnnl::algorithm::eltwise_linear, 1.0f, shift[0]);
+ if (shift[0] != 0.0F) {
+ appendEltwise(dnnl::algorithm::eltwise_linear, 1.0F, shift[0]);
}
} else {
if (!allowBinary) {
@@ -230,7 +230,7 @@ bool DnnlPostOpsComposerLegacy::appendLinear(const std::vector<float>& scale,
bool isLastPostOp,
bool allowBinary) {
if (scale.size() == 1 && shift.size() == 1) {
- if (shift[0] == 0.0f) {
+ if (shift[0] == 0.0F) {
return appendScale(scale, isLastPostOp, allowBinary);
}
appendEltwise(dnnl::algorithm::eltwise_linear, scale[0], shift[0]);
diff --git a/src/plugins/intel_cpu/src/edge.cpp b/src/plugins/intel_cpu/src/edge.cpp
index 70245d13f17..d6700cc22be 100644
--- a/src/plugins/intel_cpu/src/edge.cpp
+++ b/src/plugins/intel_cpu/src/edge.cpp
@@ -38,7 +38,7 @@ Edge::Edge(const NodePtr& parent, const NodePtr& child, int pr_port, int ch_port
parent_port(pr_port),
child_port(ch_port) {}
-const NodePtr Edge::getParent() const {
+NodePtr Edge::getParent() const {
auto parentPtr = parent.lock();
if (!parentPtr) {
OPENVINO_THROW("Edge contains empty parent node");
@@ -46,7 +46,7 @@ const NodePtr Edge::getParent() const {
return parentPtr;
}
-const NodePtr Edge::getChild() const {
+NodePtr Edge::getChild() const {
auto childPtr = child.lock();
if (!childPtr) {
OPENVINO_THROW("Edge contains empty child node");
@@ -250,11 +250,7 @@ static inline bool isPhycicalMemCompatible(const MemoryDesc& lhsMemDesc, const M
// order check
auto lhsOrderClean = getCleanDim(lhsBlockMemDesc->getOrder(), lhsBlockDims);
auto rhsOrderClean = getCleanDim(rhsBlockMemDesc->getOrder(), rhsBlockDims);
- if (!dimsEqualStrong(lhsOrderClean, rhsOrderClean)) {
- return false;
- }
-
- return true;
+ return dimsEqualStrong(lhsOrderClean, rhsOrderClean);
}
Edge::ReorderStatus Edge::needReorder() {
@@ -532,7 +528,7 @@ EdgePtr Edge::getSharedEdge() const {
return memoryFromEdgePtr;
}
-EdgePtr Edge::getSharedEdge(std::nothrow_t) const {
+EdgePtr Edge::getSharedEdge(std::nothrow_t /*unused*/) const {
return memoryFromEdge.lock();
}
diff --git a/src/plugins/intel_cpu/src/edge.h b/src/plugins/intel_cpu/src/edge.h
index e7da863d89c..df871aea374 100644
--- a/src/plugins/intel_cpu/src/edge.h
+++ b/src/plugins/intel_cpu/src/edge.h
@@ -71,8 +71,8 @@ public:
void reuse(MemoryPtr ptr);
void validate();
- const std::shared_ptr<Node> getParent() const;
- const std::shared_ptr<Node> getChild() const;
+ std::shared_ptr<Node> getParent() const;
+ std::shared_ptr<Node> getChild() const;
const IMemory& getMemory();
MemoryPtr getMemoryPtr() const;
diff --git a/src/plugins/intel_cpu/src/emitters/plugin/aarch64/jit_eltwise_emitters.cpp b/src/plugins/intel_cpu/src/emitters/plugin/aarch64/jit_eltwise_emitters.cpp
index d7ab5a2d4b2..4c4e6f8fb8e 100644
--- a/src/plugins/intel_cpu/src/emitters/plugin/aarch64/jit_eltwise_emitters.cpp
+++ b/src/plugins/intel_cpu/src/emitters/plugin/aarch64/jit_eltwise_emitters.cpp
@@ -383,7 +383,7 @@ size_t jit_elu_emitter::get_inputs_count() const {
}
size_t jit_elu_emitter::get_aux_vecs_count() const {
- return std::max(exp_emitter->get_aux_vecs_count() + 1ull, 2ull);
+ return std::max(exp_emitter->get_aux_vecs_count() + 1ULL, 2ULL);
}
size_t jit_elu_emitter::get_aux_gprs_count() const {
@@ -420,7 +420,7 @@ void jit_elu_emitter::emit_isa(const std::vector<size_t>& in_vec_idxs, const std
h->fmul(vmm_aux0.s, vmm_dst.s, vmm_aux0.s);
// combine with mask
- h->fcmgt(vmm_dst.s, vmm_aux1.s, 0.f);
+ h->fcmgt(vmm_dst.s, vmm_aux1.s, 0.F);
h->bsl(vmm_dst.b16, vmm_aux1.b16, vmm_aux0.b16);
}
@@ -1168,7 +1168,7 @@ void jit_hswish_emitter::register_table_entries() {
push_arg_entry_of("zero", 0x00000000, true);
push_arg_entry_of("three", 0x40400000, true);
push_arg_entry_of("six", 0x40c00000, true);
- push_arg_entry_of("one_sixth", dnnl::impl::float2int(1.f / 6.f), true);
+ push_arg_entry_of("one_sixth", dnnl::impl::float2int(1.F / 6.F), true);
}
std::set<std::vector<element::Type>> jit_hswish_emitter::get_supported_precisions(
@@ -1944,7 +1944,7 @@ void jit_mish_emitter::emit_isa(const std::vector<size_t>& in_vec_idxs, const st
exp_emitter->emit_code({vmm_aux2.getIdx()}, {vmm_aux2.getIdx()}, aux_vec_idxs, aux_gpr_idxs);
// (e^x+1)^2
- h->fmov(vmm_aux0.s, 1.f);
+ h->fmov(vmm_aux0.s, 1.F);
h->fadd(vmm_aux2.s, vmm_aux2.s, vmm_aux0.s);
h->fmul(vmm_dst.s, vmm_aux2.s, vmm_aux2.s);
@@ -2142,8 +2142,8 @@ jit_power_static_emitter::jit_power_static_emitter(dnnl::impl::cpu::aarch64::jit
}
power = powerStaticNode->get_power();
- scale = 1.f;
- shift = 0.f;
+ scale = 1.F;
+ shift = 0.F;
prepare_table();
}
@@ -2201,7 +2201,7 @@ void jit_power_static_emitter::emit_isa(const std::vector<size_t>& in_vec_idxs,
using TReg = typename dnnl::impl::cpu::aarch64::cpu_isa_traits<isa>::TReg;
auto dst = TReg(out_vec_idxs[0]);
- if (power == 0.f) {
+ if (power == 0.F) {
h->fmov(dst.s, 1.);
return;
}
@@ -2212,21 +2212,21 @@ void jit_power_static_emitter::emit_isa(const std::vector<size_t>& in_vec_idxs,
};
auto aux = TReg(aux_vec_idxs[0]);
- if (scale != 1.f) {
+ if (scale != 1.F) {
auto adr = table_val2("scale");
h->ld1r(aux.s, adr);
h->fmul(dst.s, src().s, aux.s);
get_from_dst = true;
}
- if (shift != 0.f) {
+ if (shift != 0.F) {
auto adr = table_val2("shift");
h->ld1r(aux.s, adr);
h->fadd(dst.s, src().s, aux.s);
get_from_dst = true;
}
- if (power == 1.f) {
+ if (power == 1.F) {
if (!get_from_dst && (in_vec_idxs[0] != dst.getIdx())) {
h->mov(dst.b16, src().b16);
}
@@ -2403,7 +2403,7 @@ jit_relu_emitter::jit_relu_emitter(dnnl::impl::cpu::aarch64::jit_generator* host
if (const auto leaky_relu = ov::as_type_ptr<LeakyReluNode>(node)) {
alpha = leaky_relu->get_slope();
} else if (ov::is_type<ov::op::v0::Relu>(node)) {
- alpha = 0.f;
+ alpha = 0.F;
} else {
OV_CPU_JIT_EMITTER_THROW("Can't cast to LeakyReluNode or ReluNode");
}
@@ -2411,7 +2411,7 @@ jit_relu_emitter::jit_relu_emitter(dnnl::impl::cpu::aarch64::jit_generator* host
}
bool jit_relu_emitter::is_relu() const {
- return alpha == 0.f;
+ return alpha == 0.F;
}
jit_relu_emitter::jit_relu_emitter(dnnl::impl::cpu::aarch64::jit_generator* host,
@@ -2470,7 +2470,7 @@ void jit_relu_emitter::emit_isa(const std::vector<size_t>& in_vec_idxs, const st
h->ld1r(vtemp1.s, table_val2("alpha")); // load alpha
h->fmul(vtemp2.s, vsrc.s, vtemp1.s); // vtemp = alpha * x
- h->fcmle(vtemp1.s, vsrc.s, 0.0f); // vmask = (x > 0) ? 1 : 0
+ h->fcmle(vtemp1.s, vsrc.s, 0.0F); // vmask = (x > 0) ? 1 : 0
h->bif(vtemp2.b16, vsrc.b16, vtemp1.b16); // vtemp2 = (x > 0) ? x : alpha * x
h->mov(vdst.b16, vtemp2.b16); // dst = (x > 0) ? x : alpha * x
}
@@ -3101,7 +3101,7 @@ jit_swish_emitter::jit_swish_emitter(dnnl::impl::cpu::aarch64::jit_generator* ho
if (swish == nullptr) {
OV_CPU_JIT_EMITTER_THROW("Can't cast to SwishNode");
}
- beta = static_cast<float>(swish->get_alpha());
+ beta = swish->get_alpha();
prepare_table();
sigmoid_emitter = std::make_unique<jit_sigmoid_emitter>(h, host_isa, node);
diff --git a/src/plugins/intel_cpu/src/emitters/plugin/aarch64/jit_emitter.cpp b/src/plugins/intel_cpu/src/emitters/plugin/aarch64/jit_emitter.cpp
index 198b1c4ff13..80abad71ead 100644
--- a/src/plugins/intel_cpu/src/emitters/plugin/aarch64/jit_emitter.cpp
+++ b/src/plugins/intel_cpu/src/emitters/plugin/aarch64/jit_emitter.cpp
@@ -65,7 +65,7 @@ void jit_emitter::emit_code_impl(const std::vector<size_t>& in_idxs,
void jit_emitter::emit_data() const {
h->align(64);
- h->L(*l_table.get());
+ h->L(*l_table);
// Assumption: entries can be inserted with dd, so they should be 4 bytes.
static_assert(sizeof(table_entry_val_t) == 4);
@@ -93,11 +93,11 @@ size_t jit_emitter::get_aux_gprs_count() const {
return 0;
}
-size_t jit_emitter::get_max_vecs_count() const {
+size_t jit_emitter::get_max_vecs_count() {
return 32;
}
-int32_t jit_emitter::get_vec_length() const {
+int32_t jit_emitter::get_vec_length() {
return 16;
}
diff --git a/src/plugins/intel_cpu/src/emitters/plugin/aarch64/jit_emitter.hpp b/src/plugins/intel_cpu/src/emitters/plugin/aarch64/jit_emitter.hpp
index d190f11fc27..52d50849872 100644
--- a/src/plugins/intel_cpu/src/emitters/plugin/aarch64/jit_emitter.hpp
+++ b/src/plugins/intel_cpu/src/emitters/plugin/aarch64/jit_emitter.hpp
@@ -73,8 +73,8 @@ public:
const std::shared_ptr<ov::Node>& node = nullptr);
protected:
- size_t get_max_vecs_count() const;
- int32_t get_vec_length() const;
+ static size_t get_max_vecs_count();
+ static int32_t get_vec_length();
mutable std::vector<size_t> aux_vec_idxs;
mutable std::vector<size_t> aux_gpr_idxs;
diff --git a/src/plugins/intel_cpu/src/emitters/plugin/x64/jit_dnnl_emitters.cpp b/src/plugins/intel_cpu/src/emitters/plugin/x64/jit_dnnl_emitters.cpp
index b2e9a79a99f..b1037804d17 100644
--- a/src/plugins/intel_cpu/src/emitters/plugin/x64/jit_dnnl_emitters.cpp
+++ b/src/plugins/intel_cpu/src/emitters/plugin/x64/jit_dnnl_emitters.cpp
@@ -58,17 +58,17 @@ jit_dnnl_emitter::jit_dnnl_emitter(jit_generator* host,
void jit_dnnl_emitter::set_injector() {
if (host_isa_ == cpu::x64::sse41) {
eltwise_injector_sse42 =
- std::make_shared<jit_uni_eltwise_injector<cpu::x64::sse41>>(h, kind, alpha, beta, 1.f, data_type::f32);
+ std::make_shared<jit_uni_eltwise_injector<cpu::x64::sse41>>(h, kind, alpha, beta, 1.F, data_type::f32);
} else if (host_isa_ == cpu::x64::avx2) {
eltwise_injector_avx2 =
- std::make_shared<jit_uni_eltwise_injector<cpu::x64::avx2>>(h, kind, alpha, beta, 1.f, data_type::f32);
+ std::make_shared<jit_uni_eltwise_injector<cpu::x64::avx2>>(h, kind, alpha, beta, 1.F, data_type::f32);
} else if (host_isa_ == cpu::x64::avx512_core) {
eltwise_injector_avx512_core =
std::make_shared<jit_uni_eltwise_injector<cpu::x64::avx512_core>>(h,
kind,
alpha,
beta,
- 1.f,
+ 1.F,
data_type::f32);
} else {
OV_CPU_JIT_EMITTER_THROW("Unsupported ISA ", host_isa_);
diff --git a/src/plugins/intel_cpu/src/emitters/plugin/x64/jit_eltwise_emitters.cpp b/src/plugins/intel_cpu/src/emitters/plugin/x64/jit_eltwise_emitters.cpp
index 96a9a432b99..963af3527d1 100644
--- a/src/plugins/intel_cpu/src/emitters/plugin/x64/jit_eltwise_emitters.cpp
+++ b/src/plugins/intel_cpu/src/emitters/plugin/x64/jit_eltwise_emitters.cpp
@@ -828,7 +828,8 @@ void jit_power_dynamic_emitter::emit_isa(const std::vector<size_t>& in_vec_idxs,
auto vmm_src1 = Vmm(in_vec_idxs[1]);
auto vmm_dst = Vmm(out_vec_idxs[0]);
- auto xmm0 = Xmm(0), xmm1 = Xmm(1);
+ auto xmm0 = Xmm(0);
+ auto xmm1 = Xmm(1);
// caller obligation to save gprs as callee may use them
size_t gpr_size = 8;
@@ -1708,8 +1709,8 @@ jit_power_static_emitter::jit_power_static_emitter(x64::jit_generator* host,
}
power = powerStaticNode->get_power();
- scale = 1.f;
- shift = 0.f;
+ scale = 1.F;
+ shift = 0.F;
prepare_table();
}
@@ -1757,9 +1758,10 @@ void jit_power_static_emitter::emit_isa(const std::vector<size_t>& in_vec_idxs,
auto vmm_dst = Vmm(out_vec_idxs[0]);
auto vmm_aux0 = Vmm(aux_vec_idxs[0]);
- auto xmm0 = Xmm(0), xmm1 = Xmm(1);
+ auto xmm0 = Xmm(0);
+ auto xmm1 = Xmm(1);
- if (scale != 1.f || shift != 0.f) {
+ if (scale != 1.F || shift != 0.F) {
if (isa == x64::sse41) {
h->uni_vmovups(vmm_aux0, table_val("scale"));
h->uni_vmulps(vmm_aux0, vmm_aux0, vmm_src0);
@@ -1781,11 +1783,11 @@ void jit_power_static_emitter::emit_isa(const std::vector<size_t>& in_vec_idxs,
}
}
- if (power == 1.f) {
- } else if (power == 0.5f || power == -0.5f) {
+ if (power == 1.F) {
+ } else if (power == 0.5F || power == -0.5F) {
h->uni_vsqrtps(vmm_dst, vmm_dst);
- if (power < 0.f) {
+ if (power < 0.F) {
h->uni_vmovups(vmm_aux0, table_val("one"));
if (isa == x64::sse41) {
h->uni_vdivps(vmm_aux0, vmm_aux0, vmm_dst);
@@ -1807,7 +1809,7 @@ void jit_power_static_emitter::emit_isa(const std::vector<size_t>& in_vec_idxs,
ipower = ipower >> 1;
}
- if (power < 0.f) {
+ if (power < 0.F) {
h->uni_vmovups(vmm_aux0, table_val("one"));
if (isa == x64::sse41) {
h->uni_vdivps(vmm_aux0, vmm_aux0, vmm_dst);
@@ -1907,7 +1909,7 @@ void jit_power_static_emitter::register_table_entries() {
push_arg_entry_of("power", x64::float2int(power), true);
push_arg_entry_of("scale", x64::float2int(scale), true);
push_arg_entry_of("shift", x64::float2int(shift), true);
- push_arg_entry_of("one", x64::float2int(1.f), true);
+ push_arg_entry_of("one", x64::float2int(1.F), true);
}
size_t jit_power_static_emitter::aux_vecs_count() const {
@@ -2144,7 +2146,7 @@ void jit_exp_emitter::emit_isa(const std::vector<size_t>& in_vec_idxs, const std
h->uni_vaddps(vmm_dst, vmm_dst, table_val("half"));
// tmp = floorf(fx)
- const auto _op_floor = 1u;
+ const auto _op_floor = 1U;
h->uni_vroundps(vmm_aux1, vmm_dst, _op_floor);
// keep vmm_dst = fx for further computations
@@ -2301,7 +2303,7 @@ void jit_erf_emitter::register_table_entries() {
}
size_t jit_erf_emitter::aux_vecs_count() const {
- return 4ul;
+ return 4UL;
}
void jit_erf_emitter::emit_data() const {
diff --git a/src/plugins/intel_cpu/src/emitters/plugin/x64/jit_emitter.cpp b/src/plugins/intel_cpu/src/emitters/plugin/x64/jit_emitter.cpp
index bd50d663c56..8a329d200b0 100644
--- a/src/plugins/intel_cpu/src/emitters/plugin/x64/jit_emitter.cpp
+++ b/src/plugins/intel_cpu/src/emitters/plugin/x64/jit_emitter.cpp
@@ -231,7 +231,7 @@ void jit_emitter::emitter_postamble() const {
void jit_emitter::emit_data() const {
h->align(64);
- h->L(*l_table.get());
+ h->L(*l_table);
// Assumption: entries can be inserted with dd, so they should be 4 bytes.
static_assert(sizeof(table_entry_val_t) == 4);
diff --git a/src/plugins/intel_cpu/src/emitters/plugin/x64/jit_load_store_emitters.cpp b/src/plugins/intel_cpu/src/emitters/plugin/x64/jit_load_store_emitters.cpp
index d7202fa61b4..d1d646e8ac1 100644
--- a/src/plugins/intel_cpu/src/emitters/plugin/x64/jit_load_store_emitters.cpp
+++ b/src/plugins/intel_cpu/src/emitters/plugin/x64/jit_load_store_emitters.cpp
@@ -1293,7 +1293,7 @@ void jit_store_emitter::store_dword_to_word_extension(const Xbyak::Reg64& reg,
if (store_num == 16) {
h->vmovdqu16(ptr[reg + offset], ymm);
} else {
- data_idx = static_cast<int>(ymm.getIdx());
+ data_idx = ymm.getIdx();
store_bytes<Vmm>(reg, offset, store_num * 2);
}
} else {
@@ -1314,7 +1314,7 @@ void jit_store_emitter::store_dword_to_word_extension(const Xbyak::Reg64& reg,
uni_vcvtneps2bf16_->emit_code({static_cast<size_t>(vmm.getIdx())}, {static_cast<size_t>(xmm.getIdx())});
}
- data_idx = static_cast<int>(xmm.getIdx());
+ data_idx = xmm.getIdx();
store_bytes<Vmm>(reg, offset, store_num * 2);
}
} else if (is_f16) {
@@ -1329,7 +1329,7 @@ void jit_store_emitter::store_dword_to_word_extension(const Xbyak::Reg64& reg,
if (store_num == 16) {
h->vmovdqu16(ptr[reg + offset], ymm);
} else {
- data_idx = static_cast<int>(ymm.getIdx());
+ data_idx = ymm.getIdx();
store_bytes<Vmm>(reg, offset, store_num * 2);
}
} else if (mayiuse(cpu::x64::avx2)) {
@@ -1341,7 +1341,7 @@ void jit_store_emitter::store_dword_to_word_extension(const Xbyak::Reg64& reg,
if (store_num == 8) {
h->uni_vmovdqu16(ptr[reg + offset], xmm);
} else {
- data_idx = static_cast<int>(xmm.getIdx());
+ data_idx = xmm.getIdx();
store_bytes<Vmm>(reg, offset, store_num * 2);
}
} else {
diff --git a/src/plugins/intel_cpu/src/emitters/plugin/x64/utils.cpp b/src/plugins/intel_cpu/src/emitters/plugin/x64/utils.cpp
index a9404ee39a5..7f37a7e0863 100644
--- a/src/plugins/intel_cpu/src/emitters/plugin/x64/utils.cpp
+++ b/src/plugins/intel_cpu/src/emitters/plugin/x64/utils.cpp
@@ -52,7 +52,7 @@ struct regs_to_spill {
static std::vector<Xbyak::Reg> get(const std::set<snippets::Reg>& live_regs) {
std::vector<Xbyak::Reg> regs_to_spill;
auto push_if_live = [&live_regs, &regs_to_spill](Xbyak::Reg&& reg) {
- if (live_regs.empty() || (live_regs.count(Xbyak2SnippetsReg(reg)) != 0u)) {
+ if (live_regs.empty() || (live_regs.count(Xbyak2SnippetsReg(reg)) != 0U)) {
regs_to_spill.emplace_back(reg);
}
};
diff --git a/src/plugins/intel_cpu/src/emitters/snippets/aarch64/cpu_generator.cpp b/src/plugins/intel_cpu/src/emitters/snippets/aarch64/cpu_generator.cpp
index 1c39de03623..b4776923814 100644
--- a/src/plugins/intel_cpu/src/emitters/snippets/aarch64/cpu_generator.cpp
+++ b/src/plugins/intel_cpu/src/emitters/snippets/aarch64/cpu_generator.cpp
@@ -123,7 +123,7 @@ public:
~jit_snippet() override = default;
- jit_snippet() : jit_generator() {}
+ jit_snippet() = default;
void generate() override {}
};
diff --git a/src/plugins/intel_cpu/src/emitters/snippets/x64/cpu_generator.cpp b/src/plugins/intel_cpu/src/emitters/snippets/x64/cpu_generator.cpp
index 6750fa6973f..d1cc45fe30c 100644
--- a/src/plugins/intel_cpu/src/emitters/snippets/x64/cpu_generator.cpp
+++ b/src/plugins/intel_cpu/src/emitters/snippets/x64/cpu_generator.cpp
@@ -116,7 +116,6 @@
# include "emitters/snippets/x64/jit_perf_count_rdtsc_emitters.hpp"
# include "emitters/snippets/x64/jit_segfault_detector_emitter.hpp"
# include "emitters/snippets/x64/verbose.hpp"
-# include "transformations/snippets/x64/op/perf_count_rdtsc.hpp"
#endif
#ifdef SNIPPETS_LIBXSMM_TPP
diff --git a/src/plugins/intel_cpu/src/emitters/snippets/x64/jit_loop_emitters.cpp b/src/plugins/intel_cpu/src/emitters/snippets/x64/jit_loop_emitters.cpp
index 839a496e5f4..e211811922a 100644
--- a/src/plugins/intel_cpu/src/emitters/snippets/x64/jit_loop_emitters.cpp
+++ b/src/plugins/intel_cpu/src/emitters/snippets/x64/jit_loop_emitters.cpp
@@ -65,7 +65,7 @@ public:
private:
dnnl::impl::cpu::x64::jit_generator* m_h;
std::vector<size_t>& m_pool_gpr_idxs;
- Reg64 m_aux_gpr_idx{};
+ Reg64 m_aux_gpr_idx;
bool m_is_preserved = false;
};
} // namespace
diff --git a/src/plugins/intel_cpu/src/emitters/snippets/x64/kernel_executors/brgemm.cpp b/src/plugins/intel_cpu/src/emitters/snippets/x64/kernel_executors/brgemm.cpp
index 319c19c873e..5da85e2db2d 100644
--- a/src/plugins/intel_cpu/src/emitters/snippets/x64/kernel_executors/brgemm.cpp
+++ b/src/plugins/intel_cpu/src/emitters/snippets/x64/kernel_executors/brgemm.cpp
@@ -33,8 +33,7 @@ BrgemmKernelConfig::BrgemmKernelConfig(const element::Type& in0_dtype,
const element::Type& in1_dtype,
bool is_with_comp,
dnnl::impl::cpu::x64::cpu_isa_t primitive_isa)
- : BrgemmBaseKernelConfig(),
- m_static_params(std::make_shared<StaticParams>(in0_dtype, in1_dtype, is_with_comp, primitive_isa)) {
+ : m_static_params(std::make_shared<StaticParams>(in0_dtype, in1_dtype, is_with_comp, primitive_isa)) {
m_hash = compute_hash();
}
diff --git a/src/plugins/intel_cpu/src/emitters/snippets/x64/kernel_executors/brgemm_amx.cpp b/src/plugins/intel_cpu/src/emitters/snippets/x64/kernel_executors/brgemm_amx.cpp
index b6cae4bdcba..b149eac7c52 100644
--- a/src/plugins/intel_cpu/src/emitters/snippets/x64/kernel_executors/brgemm_amx.cpp
+++ b/src/plugins/intel_cpu/src/emitters/snippets/x64/kernel_executors/brgemm_amx.cpp
@@ -48,8 +48,7 @@ namespace ov::intel_cpu::x64 {
BrgemmAMXKernelConfig::BrgemmAMXKernelConfig(const element::Type& in0_dtype,
const element::Type& in1_dtype,
dnnl::impl::cpu::x64::cpu_isa_t primitive_isa)
- : BrgemmBaseKernelConfig(),
- m_static_params(std::make_shared<StaticParams>(in0_dtype, in1_dtype, primitive_isa)) {
+ : m_static_params(std::make_shared<StaticParams>(in0_dtype, in1_dtype, primitive_isa)) {
m_hash = compute_hash();
}
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 a7c794300cc..bb5e0217c3c 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
@@ -106,7 +106,10 @@ 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, 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);
const auto LDA = snippets::utils::get_dim_stride(expr->get_input_port(0));
@@ -145,7 +148,7 @@ void BrgemmBaseKernelExecutor::create_brgemm_kernel(std::shared_ptr<brgemm_kerne
false,
false,
cpu::x64::brgemm_row_major,
- 1.f,
+ 1.F,
beta,
LDA,
LDB,
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 c9974cc90ab..42b993b6735 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
@@ -29,7 +29,6 @@
#include "dnnl_extension_utils.h"
#include "emitters/plugin/x64/utils.hpp"
#include "emitters/snippets/cpu_kernel_executor_table.hpp"
-#include "emitters/snippets/repacked_input.hpp"
#include "emitters/utils.hpp"
#include "openvino/core/except.hpp"
#include "openvino/core/type/element_type.hpp"
@@ -177,11 +176,10 @@ std::string BrgemmCopyBKernelConfig::StaticParams::to_string() const {
# undef PRINT
#endif
-BrgemmCopyBKernel::BrgemmCopyBKernel() : RepackedInputKernel(), jit_generator(jit_name()), ker_(nullptr) {}
+BrgemmCopyBKernel::BrgemmCopyBKernel() : jit_generator(jit_name()), ker_(nullptr) {}
BrgemmCopyBKernel::BrgemmCopyBKernel(const BrgemmCopyBKernelConfig& conf)
- : RepackedInputKernel(),
- jit_generator(jit_name()),
+ : jit_generator(jit_name()),
is_with_comp(conf.is_with_comp()),
is_transpose(conf.is_transposed_B()),
wei_data_size(dnnl_data_type_size(conf.get_wei_dt())),
@@ -211,7 +209,7 @@ void BrgemmCopyBKernel::operator()(const void* args) const {
void BrgemmCopyBKernel::init_brgemm_copy_b_kernel(
std::unique_ptr<dnnl::impl::cpu::x64::matmul::jit_brgemm_matmul_copy_b_t>& kernel,
- const BrgemmCopyBKernelConfig& conf) const {
+ const BrgemmCopyBKernelConfig& conf) {
matmul::brgemm_matmul_conf_t brgCopyKernelConf;
brgCopyKernelConf.src_dt = conf.get_src_dt();
brgCopyKernelConf.wei_dt = conf.get_wei_dt();
@@ -410,7 +408,10 @@ void BrgemmCopyBKernelExecutor::update_config(const ov::snippets::lowered::Expre
}
};
- size_t K_dim, K_blk, N_dim, N_blk;
+ size_t K_dim;
+ size_t K_blk;
+ size_t N_dim;
+ size_t N_blk;
// Dimension K
init(K_dim, K_blk, 1);
// Dimension N
diff --git a/src/plugins/intel_cpu/src/emitters/snippets/x64/kernel_executors/brgemm_copy_b.hpp b/src/plugins/intel_cpu/src/emitters/snippets/x64/kernel_executors/brgemm_copy_b.hpp
index 8c11e31a615..ff24f3933d9 100644
--- a/src/plugins/intel_cpu/src/emitters/snippets/x64/kernel_executors/brgemm_copy_b.hpp
+++ b/src/plugins/intel_cpu/src/emitters/snippets/x64/kernel_executors/brgemm_copy_b.hpp
@@ -180,8 +180,9 @@ private:
size_t N,
size_t K);
- void init_brgemm_copy_b_kernel(std::unique_ptr<dnnl::impl::cpu::x64::matmul::jit_brgemm_matmul_copy_b_t>& kernel,
- const BrgemmCopyBKernelConfig& conf) const;
+ static void init_brgemm_copy_b_kernel(
+ std::unique_ptr<dnnl::impl::cpu::x64::matmul::jit_brgemm_matmul_copy_b_t>& kernel,
+ const BrgemmCopyBKernelConfig& conf);
std::set<snippets::Reg> get_live_regs() const;
diff --git a/src/plugins/intel_cpu/src/emitters/tpp/aarch64/jit_brgemm_emitter.cpp b/src/plugins/intel_cpu/src/emitters/tpp/aarch64/jit_brgemm_emitter.cpp
index 245177f38d8..23dfeaab381 100644
--- a/src/plugins/intel_cpu/src/emitters/tpp/aarch64/jit_brgemm_emitter.cpp
+++ b/src/plugins/intel_cpu/src/emitters/tpp/aarch64/jit_brgemm_emitter.cpp
@@ -73,11 +73,11 @@ void jit_brgemm_emitter::emit_impl(const std::vector<size_t>& in, const std::vec
restore_context(exclude);
}
-const uintptr_t jit_brgemm_emitter::get_compiled_kernel_ptr() const {
+uintptr_t jit_brgemm_emitter::get_compiled_kernel_ptr() const {
return reinterpret_cast<const uintptr_t>(m_kernel_executor.get());
}
-const uintptr_t jit_brgemm_emitter::get_execute_function_ptr() const {
+uintptr_t jit_brgemm_emitter::get_execute_function_ptr() {
return reinterpret_cast<const uintptr_t>(BrgemmKernelExecutor::execute);
}
diff --git a/src/plugins/intel_cpu/src/emitters/tpp/aarch64/jit_brgemm_emitter.hpp b/src/plugins/intel_cpu/src/emitters/tpp/aarch64/jit_brgemm_emitter.hpp
index 1b7102a2005..42eb243736d 100644
--- a/src/plugins/intel_cpu/src/emitters/tpp/aarch64/jit_brgemm_emitter.hpp
+++ b/src/plugins/intel_cpu/src/emitters/tpp/aarch64/jit_brgemm_emitter.hpp
@@ -32,8 +32,8 @@ protected:
const std::vector<size_t>& pool_vec_idxs = {},
const std::vector<size_t>& pool_gpr_idxs = {}) const override;
- const uintptr_t get_execute_function_ptr() const;
- const uintptr_t get_compiled_kernel_ptr() const;
+ static uintptr_t get_execute_function_ptr();
+ uintptr_t get_compiled_kernel_ptr() const;
std::shared_ptr<ov::intel_cpu::tpp::BrgemmKernelExecutor> m_kernel_executor = nullptr;
};
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 76bcd1782a7..ffc23f1050e 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
@@ -35,8 +35,7 @@
namespace ov::intel_cpu::tpp {
BrgemmKernelConfig::BrgemmKernelConfig(const element::Type& in0_dtype, const element::Type& in1_dtype)
- : BrgemmGenericKernelConfig(),
- m_static_params(std::make_shared<StaticParams>(in0_dtype, in1_dtype)) {}
+ : m_static_params(std::make_shared<StaticParams>(in0_dtype, in1_dtype)) {}
bool BrgemmKernelConfig::operator==(const BrgemmKernelConfig& rhs) const {
return BrgemmGenericKernelConfig::operator==(rhs) &&
@@ -70,7 +69,7 @@ BrgemmKernelConfig::StaticParams::StaticParams(const element::Type& in0_dtype, c
m_prefetching_flags(false),
m_hash(compute_hash()) {}
-size_t BrgemmKernelConfig::StaticParams::compute_hash() {
+size_t BrgemmKernelConfig::StaticParams::compute_hash() const {
size_t seed = 0;
HASH(m_type_in0);
HASH(m_type_in1);
@@ -140,7 +139,10 @@ 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, 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);
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) {
diff --git a/src/plugins/intel_cpu/src/emitters/tpp/common/kernel_executors/brgemm.hpp b/src/plugins/intel_cpu/src/emitters/tpp/common/kernel_executors/brgemm.hpp
index d244b471e90..17ed0828c6a 100644
--- a/src/plugins/intel_cpu/src/emitters/tpp/common/kernel_executors/brgemm.hpp
+++ b/src/plugins/intel_cpu/src/emitters/tpp/common/kernel_executors/brgemm.hpp
@@ -78,7 +78,7 @@ private:
[[nodiscard]] size_t hash() const {
return m_hash;
}
- size_t compute_hash();
+ size_t compute_hash() const;
#ifdef SNIPPETS_DEBUG_CAPS
[[nodiscard]] std::string to_string() const;
diff --git a/src/plugins/intel_cpu/src/emitters/tpp/x64/jit_equation_emitter.cpp b/src/plugins/intel_cpu/src/emitters/tpp/x64/jit_equation_emitter.cpp
index 3c6dbbf0113..5d8d9bb83c0 100644
--- a/src/plugins/intel_cpu/src/emitters/tpp/x64/jit_equation_emitter.cpp
+++ b/src/plugins/intel_cpu/src/emitters/tpp/x64/jit_equation_emitter.cpp
@@ -54,7 +54,8 @@ EquationTppEmitter::EquationTppEmitter(jit_generator* h, cpu_isa_t isa, const Ex
const auto op_metadata = libxsmm_create_meqn_op_metadata(m_equation_id, -1);
const auto sing_attr =
libxsmm_create_matrix_arg_attributes(LIBXSMM_MATRIX_ARG_TYPE_SINGULAR, LIBXSMM_MATRIX_ARG_SET_TYPE_NONE, 0, 0);
- libxsmm_blasint M, N;
+ libxsmm_blasint M;
+ libxsmm_blasint N;
for (const auto& op_desc : eq_tpp->get_op_descs()) {
switch (op_desc.get_arity()) {
case tpp::op::OpDescTPP::ARITY::BINARY: {
diff --git a/src/plugins/intel_cpu/src/graph.cpp b/src/plugins/intel_cpu/src/graph.cpp
index 7a1eb33facc..f0f13c0f0cc 100644
--- a/src/plugins/intel_cpu/src/graph.cpp
+++ b/src/plugins/intel_cpu/src/graph.cpp
@@ -422,7 +422,7 @@ void Graph::Configure([[maybe_unused]] bool optimize) {
ResolveEdgeConflicts();
- optimizer.ShareReorders(*this);
+ ov::intel_cpu::GraphOptimizer::ShareReorders(*this);
RemoveDroppedNodes();
SortTopologically();
@@ -1065,7 +1065,9 @@ static MemoryRegions FormMemoryRegions(const EdgeClusters& clusters,
MemoryRegion::AllocType::UNKNOWN};
int64_t boxSize = 0;
- bool isConst = false, isOutput = false, isInput = false;
+ bool isConst = false;
+ bool isOutput = false;
+ bool isInput = false;
for (const auto& edge : clusters[i]) {
const auto& parent = edge->getParent();
@@ -1135,11 +1137,7 @@ static size_t SkipAllocatedClusters(EdgeClusters& clusters) {
auto notAllocatedPartitionEnd = std::partition(clusters.begin(), clusters.end(), [](const EdgeCluster& cluster) {
const auto& baseEdge = cluster.at(0);
- if (baseEdge->getStatus() == Edge::Status::Allocated) {
- return false;
- }
-
- return true;
+ return baseEdge->getStatus() != Edge::Status::Allocated;
});
return std::distance(clusters.begin(), notAllocatedPartitionEnd);
@@ -1457,12 +1455,12 @@ public:
m_wait(wait),
m_node_indx(node_indx),
m_stop_indx(stop_indx) {}
- task* execute(tbb::detail::d1::execution_data&) override {
+ task* execute(tbb::detail::d1::execution_data& /*unused*/) override {
m_body(m_node_indx, m_stop_indx);
m_wait.release();
return nullptr;
}
- task* cancel(tbb::detail::d1::execution_data&) override {
+ task* cancel(tbb::detail::d1::execution_data& /*unused*/) override {
m_wait.release();
return nullptr;
}
diff --git a/src/plugins/intel_cpu/src/graph_dumper.cpp b/src/plugins/intel_cpu/src/graph_dumper.cpp
index 888803cd440..7eccc7b5171 100644
--- a/src/plugins/intel_cpu/src/graph_dumper.cpp
+++ b/src/plugins/intel_cpu/src/graph_dumper.cpp
@@ -158,8 +158,11 @@ std::shared_ptr<ov::Model> dump_graph_as_ie_ngraph_net(const Graph& graph) {
};
auto create_ngraph_node = [&](const NodePtr& node) {
- bool is_input = false, is_output = false, should_be_hold = false;
- size_t input_index = -1, output_index = -1;
+ bool is_input = false;
+ bool is_output = false;
+ bool should_be_hold = false;
+ size_t input_index = -1;
+ size_t output_index = -1;
for (auto&& kvp : graph.inputNodesMap) {
if (kvp.second == node) {
is_input = true;
@@ -323,7 +326,7 @@ void summary_perf(const Graph& graph) {
std::cout << "======= ENABLE_DEBUG_CAPS:OV_CPU_SUMMARY_PERF ======" << '\n';
std::cout << "Summary of " << graph.GetName() << " @" << std::hash<uint64_t>{}(reinterpret_cast<uint64_t>(&graph))
<< '\n';
- std::cout << " Total(us): " << (uint64_t)(total) << '\n';
+ std::cout << " Total(us): " << total << '\n';
std::cout << " Total_avg(us): " << (uint64_t)(total_avg) << '\n';
{
std::cout << " perf_by_type:" << '\n';
diff --git a/src/plugins/intel_cpu/src/graph_optimizer.cpp b/src/plugins/intel_cpu/src/graph_optimizer.cpp
index 5008aabe59b..73b1538a6d2 100644
--- a/src/plugins/intel_cpu/src/graph_optimizer.cpp
+++ b/src/plugins/intel_cpu/src/graph_optimizer.cpp
@@ -248,8 +248,8 @@ void GraphOptimizer::FuseConvMatmulFCDeconvAndDQScales(Graph& graph) {
}
auto parentNode = node->getParentEdgeAt(0)->getParent();
auto scaleNode = node->getParentEdgeAt(1)->getParent();
- if (!(parentNode->getType() == Type::Convolution || parentNode->getType() == Type::MatMul ||
- parentNode->getType() == Type::Deconvolution)) {
+ if (parentNode->getType() != Type::Convolution && parentNode->getType() != Type::MatMul &&
+ parentNode->getType() != Type::Deconvolution) {
return false;
}
if (!scaleNode->isConstant()) {
@@ -909,7 +909,7 @@ void GraphOptimizer::FuseFCAndTransposeOnWeights(Graph& graph) {
const auto& graphNodes = graph.GetNodes();
auto isSuitablePattern = [](const NodePtr& parent) {
- bool res = true && parent->getType() == Type::Transpose && parent->getChildEdges().size() == 1 &&
+ bool res = parent->getType() == Type::Transpose && parent->getChildEdges().size() == 1 &&
parent->getChildEdgeAt(0)->getChild()->getType() == Type::FullyConnected && parent->isConstant();
return res;
};
@@ -1245,10 +1245,10 @@ void GraphOptimizer::FuseConvolutionAndDWConvolution(Graph& graph) {
dimsEqualStrong(inDims[inDims.size() - 1], outDims[outDims.size() - 1]) &&
dimsEqualStrong(inDims[inDims.size() - 2], outDims[outDims.size() - 2]) &&
is1x1Convolution(conv) && // TODO [oneDNN] : fusing is permitted only with 1x1 convolutions
- everyone_is(1u,
+ everyone_is(1U,
static_cast<unsigned int>(strides[strides.size() - 1]),
static_cast<unsigned int>(strides[strides.size() - 2])) &&
- everyone_is(0u,
+ everyone_is(0U,
static_cast<unsigned int>(paddings[paddings.size() - 1]),
static_cast<unsigned int>(paddings[paddings.size() - 2])) &&
!conv->canBeExecutedInInt8();
@@ -1310,20 +1310,20 @@ void GraphOptimizer::FuseConvolutionAndDWConvolution(Graph& graph) {
bool isSupportedParams =
dimsEqualStrong(convChild->outputShapes[0].getDims()[1], convChild->getGroupNum()) &&
convChild->outputShapes[0].getDims()[1] != 1 &&
- everyone_is(3u,
+ everyone_is(3U,
static_cast<unsigned int>(convChild->getWeightDims()[weightRank - 1]),
static_cast<unsigned int>(convChild->getWeightDims()[weightRank - 2])) &&
- everyone_is(1u,
+ everyone_is(1U,
static_cast<unsigned int>(convChild->getPaddingL()[stridesSize - 1]),
static_cast<unsigned int>(convChild->getPaddingL()[stridesSize - 2])) &&
- everyone_is(1u,
+ everyone_is(1U,
static_cast<unsigned int>(convChild->getPaddingR()[stridesSize - 1]),
static_cast<unsigned int>(convChild->getPaddingR()[stridesSize - 2])) &&
- everyone_is(1u,
+ everyone_is(1U,
static_cast<unsigned int>(convChild->getDilation()[stridesSize - 1] + 1),
static_cast<unsigned int>(convChild->getDilation()[stridesSize - 2] + 1)) &&
convChild->getStride()[stridesSize - 1] == convChild->getStride()[stridesSize - 2] && withBias &&
- one_of(convChild->getStride()[stridesSize - 1], 1u, 2u) &&
+ one_of(convChild->getStride()[stridesSize - 1], 1U, 2U) &&
childNode->getOutputShapeAtPort(0).getRank() == 4;
return isSupportedParams;
@@ -1720,7 +1720,7 @@ void GraphOptimizer::FuseConvolutionSumAndConvolutionSumActivation(Graph& graph)
const auto isBranch2Quantized = isBranchQuantized(graphNode->getParentEdgeAt(1)->getParent());
if (isBranch1Quantized || isBranch2Quantized) {
// INT8
- const auto parent1CanBeMerged = parent1->getChildEdges().size() == 1ul;
+ const auto parent1CanBeMerged = parent1->getChildEdges().size() == 1UL;
// if both branches are quantized, then parent1 is selected (result is not changed)
mergedConv = isBranch2Quantized && parent1CanBeMerged ? parent1 : parent2;
@@ -1818,7 +1818,7 @@ void GraphOptimizer::FuseConvolutionSumAndConvolutionSumActivation(Graph& graph)
mergedConv->inputShapes.push_back(sum->getInputShapeAtPort(secondTermPort));
}
- size_t childIdx = 0lu;
+ size_t childIdx = 0LU;
for (; childIdx < peerNode->getChildEdges().size(); childIdx++) {
if (peerNode->getChildEdgeAt(childIdx)->getChild() == sum) {
break;
@@ -2408,7 +2408,7 @@ void GraphOptimizer::FusePerformedAsScaleShiftAndFakeQuantize(Graph& graph) {
std::vector<int> nonConstPorts;
for (size_t i = 0; i < node->getParentEdges().size(); i++) {
const auto& parent = node->getParentEdgeAt(i)->getParent();
- if (!(parent->getType() == Type::Input && parent->isConstant())) {
+ if (parent->getType() != Type::Input || !parent->isConstant()) {
nonConstPorts.push_back(i);
}
}
@@ -2492,7 +2492,7 @@ void GraphOptimizer::FusePerformedAsScaleShiftAndFakeQuantize(Graph& graph) {
shiftsBuffer = makeAlignedBuffer(outputDims[channelPos], shiftsBuffer, 1);
for (float i : scalesBuffer) {
- if (i == 0.f) {
+ if (i == 0.F) {
return false;
}
}
@@ -2524,11 +2524,11 @@ void GraphOptimizer::FusePerformedAsScaleShiftAndFakeQuantize(Graph& graph) {
}
}
- std::vector<float> zeroShift(newInputScale.size(), 0.f);
+ std::vector<float> zeroShift(newInputScale.size(), 0.F);
const auto isSubnormal = [](const float value) {
const auto* u32data = reinterpret_cast<const uint32_t*>(&value);
- return ((*u32data) != 0u) && (((*u32data) & (0xFF << 23)) == 0);
+ return ((*u32data) != 0U) && (((*u32data) & (0xFF << 23)) == 0);
};
for (size_t i = 0; i < newInputScale.size(); i++) {
@@ -2536,14 +2536,14 @@ void GraphOptimizer::FusePerformedAsScaleShiftAndFakeQuantize(Graph& graph) {
newInputScale[i] = isc * scalesBuffer[i];
if (isSubnormal(newInputScale[i])) {
- newInputScale[i] = 0.f;
+ newInputScale[i] = 0.F;
// zero value have to be shifted if it's not in input range
float cl = cropLowData.size() == 1 ? cropLowData[0] : cropLowData[i];
float ch = cropHighData.size() == 1 ? cropHighData[0] : cropHighData[i];
- if (0.f < cl) {
+ if (0.F < cl) {
zeroShift[i] = isc * cl;
}
- if (ch < 0.f) {
+ if (ch < 0.F) {
zeroShift[i] = isc * ch;
}
}
@@ -2555,7 +2555,7 @@ void GraphOptimizer::FusePerformedAsScaleShiftAndFakeQuantize(Graph& graph) {
newInputShift[i] = ish + shiftsBuffer[i] * isc + zeroShift[i];
if (isSubnormal(newInputShift[i])) {
- newInputShift[i] = 0.f;
+ newInputShift[i] = 0.F;
}
}
@@ -3166,11 +3166,7 @@ void GraphOptimizer::RemoveMemoryInputConvert(Graph& graph) {
}
auto parent = node->getParentEdgeAt(0)->getParent();
- if (Type::MemoryInput != parent->getType()) {
- return false;
- }
-
- return true;
+ return Type::MemoryInput == parent->getType();
};
for (const auto& node : graphNodes) {
@@ -3237,10 +3233,7 @@ void GraphOptimizer::MatchSdpaKvCache(Graph& graph) {
OPENVINO_ASSERT(memInputNode, "MemoryInput node ", node->getName(), " has unexpected dynamic type");
auto& memOutputNode = memInputNode->getOutputNode();
auto memOutputParent = memOutputNode.getParentEdgeAt(0)->getParent();
- if (memOutputParent != childSdpa) {
- return false;
- }
- return true;
+ return memOutputParent == childSdpa;
};
for (size_t i = 0; i < graphNodes.size(); i++) {
diff --git a/src/plugins/intel_cpu/src/graph_optimizer.h b/src/plugins/intel_cpu/src/graph_optimizer.h
index 89f893383fb..837073c7772 100644
--- a/src/plugins/intel_cpu/src/graph_optimizer.h
+++ b/src/plugins/intel_cpu/src/graph_optimizer.h
@@ -16,55 +16,55 @@ public:
GraphOptimizer();
public:
- void ApplyCommonGraphOptimizations(Graph& graph);
+ static void ApplyCommonGraphOptimizations(Graph& graph);
void ApplyImplSpecificGraphOptimizations(Graph& graph);
- void ShareReorders(Graph& graph);
+ static void ShareReorders(Graph& graph);
private:
void extracted();
- void FuseConvMatmulFCDeconvAndDQScales(Graph& graph);
- void FuseConvolutionMatMulDeconvAndBias(Graph& graph);
- void FuseDeconvolutionAndSimpleOperation(Graph& graph);
- void FuseMultiplyAndAdd(Graph& graph);
- void MergeEltwiseAndConvert(Graph& graph);
- void MergeConvertAndEltwise(Graph& graph);
- void FuseFCAndConvertOnWeights(Graph& graph);
- void FuseFCAndTransposeOnWeights(Graph& graph);
- void FuseFullyConnectedAndSimpleOperation(Graph& graph);
- void FuseMatMulAndSimpleOperation(Graph& graph);
- void FuseConvolutionAndSimpleOperationThroughMaxPool(Graph& graph);
- void FuseConvolutionAndSimpleOperation(Graph& graph);
- void FuseConvolutionAndDWConvolution(Graph& graph);
- void FusePoolingAndFakeQuantize(Graph& graph);
- void FuseConvolutionSumAndConvolutionSumActivation(Graph& graph);
- void FuseMVNAndSimpleOperation(Graph& graph);
- void FuseInterpolateAndSimpleOperation(Graph& graph);
- void FuseNormalizeL2AndSimpleOperation(Graph& graph);
- void FuseReduceAndSimpleOperation(Graph& graph);
- void FuseGatherAndConvert(Graph& graph);
+ static void FuseConvMatmulFCDeconvAndDQScales(Graph& graph);
+ static void FuseConvolutionMatMulDeconvAndBias(Graph& graph);
+ static void FuseDeconvolutionAndSimpleOperation(Graph& graph);
+ static void FuseMultiplyAndAdd(Graph& graph);
+ static void MergeEltwiseAndConvert(Graph& graph);
+ static void MergeConvertAndEltwise(Graph& graph);
+ static void FuseFCAndConvertOnWeights(Graph& graph);
+ static void FuseFCAndTransposeOnWeights(Graph& graph);
+ static void FuseFullyConnectedAndSimpleOperation(Graph& graph);
+ static void FuseMatMulAndSimpleOperation(Graph& graph);
+ static void FuseConvolutionAndSimpleOperationThroughMaxPool(Graph& graph);
+ static void FuseConvolutionAndSimpleOperation(Graph& graph);
+ static void FuseConvolutionAndDWConvolution(Graph& graph);
+ static void FusePoolingAndFakeQuantize(Graph& graph);
+ static void FuseConvolutionSumAndConvolutionSumActivation(Graph& graph);
+ static void FuseMVNAndSimpleOperation(Graph& graph);
+ static void FuseInterpolateAndSimpleOperation(Graph& graph);
+ static void FuseNormalizeL2AndSimpleOperation(Graph& graph);
+ static void FuseReduceAndSimpleOperation(Graph& graph);
+ static void FuseGatherAndConvert(Graph& graph);
- void DropDoubleReorders(Graph& graph);
- void FuseConvolutionAndZeroPoints(Graph& graph);
+ static void DropDoubleReorders(Graph& graph);
+ static void FuseConvolutionAndZeroPoints(Graph& graph);
void FuseBroadcastAndEltwise(Graph& graph);
- void FuseEltwiseAndSimple(Graph& graph);
- void FusePerformedAsScaleShiftAndFakeQuantize(Graph& graph);
- void FuseClampAndFakeQuantize(Graph& graph);
+ static void FuseEltwiseAndSimple(Graph& graph);
+ static void FusePerformedAsScaleShiftAndFakeQuantize(Graph& graph);
+ static void FuseClampAndFakeQuantize(Graph& graph);
void MergeTransposeAndReorder(Graph& graph);
void MergeReorderAndTranspose(Graph& graph);
- void reshapeRnnSeq(Graph& graph);
- void RemoveSameConvert(Graph& graph);
- void RemoveMemoryInputConvert(Graph& graph);
- void RemoveConvertMemoryOutput(Graph& graph);
- void MatchSdpaKvCache(Graph& graph);
- void DropRedundantMemoryOutput(Graph& graph);
+ static void reshapeRnnSeq(Graph& graph);
+ static void RemoveSameConvert(Graph& graph);
+ static void RemoveMemoryInputConvert(Graph& graph);
+ static void RemoveConvertMemoryOutput(Graph& graph);
+ static void MatchSdpaKvCache(Graph& graph);
+ static void DropRedundantMemoryOutput(Graph& graph);
- bool canBeInplaced(const NodePtr& parentNode, const NodePtr& childNode);
+ static bool canBeInplaced(const NodePtr& parentNode, const NodePtr& childNode);
// Method checks that after the sequential execution of Transpose and Reorder nodes,
// the order of the elements in the memory (physical layout) will not change.
- bool checkAscendingFinalOrder(const VectorDims& transposeOrder,
- const VectorDims& layoutOrder,
- const VectorDims& reorderInOrder,
- const VectorDims& reorderOutOrder);
+ static bool checkAscendingFinalOrder(const VectorDims& transposeOrder,
+ const VectorDims& layoutOrder,
+ const VectorDims& reorderInOrder,
+ const VectorDims& reorderOutOrder);
// Method merges Transpose -> Reshape(optional) -> Reorder sequences which do opposite permutation to each other.
// Reverse order Reorder -> Reshape(optional) -> Transpose is supported too.
// Reshape support has the following limitations:
@@ -89,11 +89,11 @@ private:
// After: [N,C,H,W]acdb==>Reorder(acdb->abc, isOptimized=true)==>[N,L,C]abc
// Note: in some cases (inplace conflicts or transpose with blocked input and non-blocked output) the merged Reorder
// can not be optimized.
- void mergeTransposeReshapeReorder(Graph& graph,
- const NodePtr& transposeNode,
- const NodePtr& reshapeNode,
- const NodePtr& reorderNode,
- const bool reverseOrder);
+ static void mergeTransposeReshapeReorder(Graph& graph,
+ const NodePtr& transposeNode,
+ const NodePtr& reshapeNode,
+ const NodePtr& reorderNode,
+ const bool reverseOrder);
};
} // namespace intel_cpu
diff --git a/src/plugins/intel_cpu/src/infer_request.cpp b/src/plugins/intel_cpu/src/infer_request.cpp
index caf457e964a..141ec0a1799 100644
--- a/src/plugins/intel_cpu/src/infer_request.cpp
+++ b/src/plugins/intel_cpu/src/infer_request.cpp
@@ -193,7 +193,7 @@ void SyncInferRequest::change_default_ptr(Graph& graph) {
for (auto& it : m_input_external_ptr) {
auto inputNodePtr = graph.getInputNodeByIndex(it.first);
OPENVINO_ASSERT(inputNodePtr, "Cannot find input tensor with index: ", it.first);
- if (inputNodePtr->getDstDataAtPort(0) == static_cast<void*>(it.second->data())) {
+ if (inputNodePtr->getDstDataAtPort(0) == it.second->data()) {
continue;
}
const auto& childEdges = inputNodePtr->getChildEdges();
@@ -245,7 +245,7 @@ void SyncInferRequest::change_default_ptr(Graph& graph) {
OPENVINO_ASSERT(output, "Cannot find output tensor with index: ", it.first);
auto parentEdge = output->getParentEdgeAt(0);
void* const outputRawPtr = parentEdge->getMemory().getData();
- if (outputRawPtr == static_cast<void*>(it.second->data())) {
+ if (outputRawPtr == it.second->data()) {
continue;
}
@@ -609,7 +609,6 @@ void SyncInferRequest::init_tensor(const std::size_t& port_index, const ov::ISyn
if (!tensor) {
OPENVINO_THROW("Cannot find tensor with index: ", port_index);
}
- return;
}
void SyncInferRequest::push_input_data(Graph& graph) {
diff --git a/src/plugins/intel_cpu/src/memory_control.cpp b/src/plugins/intel_cpu/src/memory_control.cpp
index 9bf34ec748f..c97b2951dd7 100644
--- a/src/plugins/intel_cpu/src/memory_control.cpp
+++ b/src/plugins/intel_cpu/src/memory_control.cpp
@@ -171,7 +171,6 @@ class MemoryManagerIO : public IMemoryManager {
public:
using BlockType = MemoryBlockWithReuse;
-public:
void insert(const MemoryRegion& reg, [[maybe_unused]] const std::vector<size_t>& syncInds) override {
auto block = make_unique<BlockType>();
CPU_DEBUG_CAP_ENABLE(m_blocks.emplace_back(*block);)
@@ -194,7 +193,6 @@ private:
return "MemoryManagerIO";
}
-private:
MemoryControl::MemorySolution m_solution;
CPU_DEBUG_CAP_ENABLE(std::vector<std::reference_wrapper<BlockType>> m_blocks;)
CPU_DEBUG_CAP_ENABLE(friend MemoryStatisticsRecord dumpStatisticsImpl(const MemoryManagerIO& obj);)
@@ -251,7 +249,6 @@ private:
return "MemoryManagerStatic";
}
-private:
MemoryControl::MemorySolution m_blocks;
std::vector<MemorySolver::Box> m_boxes;
std::shared_ptr<MemoryBlockWithRelease> m_workspace;
@@ -295,7 +292,7 @@ public:
private:
#ifdef CPU_DEBUG_CAPS
using InternalBlock = IndividualMemoryBlockWithRelease;
- std::shared_ptr<InternalBlock> internalBlock(const std::shared_ptr<MemoryBlockWithRelease>& block) {
+ static std::shared_ptr<InternalBlock> internalBlock(const std::shared_ptr<MemoryBlockWithRelease>& block) {
return std::make_shared<InternalBlock>(block);
}
#else
@@ -305,7 +302,6 @@ private:
}
#endif // CPU_DEBUG_CAPS
-private:
void solve() {
ov::MemorySolver::normalize_boxes(m_boxes);
@@ -348,7 +344,6 @@ private:
return "MemoryManagerNonOverlappingSets";
}
-private:
MemoryControl::MemorySolution m_blocks;
std::vector<MemorySolver::Box> m_boxes;
std::unordered_map<MemoryControl::MemorySolution::key_type, std::shared_ptr<InternalBlock>> m_internalBlocks;
@@ -461,7 +456,6 @@ class MemoryControl::RegionHandler {
public:
using Condition = std::function<bool(const MemoryRegion&)>;
-public:
RegionHandler(Condition cond, MemoryManagerPtr memManager)
: m_cond(std::move(cond)),
m_memManager(std::move(memManager)) {}
@@ -503,7 +497,6 @@ private:
#endif // CPU_DEBUG_CAPS
-private:
Condition m_cond;
MemoryManagerPtr m_memManager;
};
@@ -529,28 +522,19 @@ MemoryControl::RegionHandlerPtr buildHandler(F&& f, Args&&... args) {
MemoryControl::MemoryControl(std::string id) : m_id(std::move(id)) {
// init handlers
m_handlers.emplace_back(buildHandler<MemoryManagerStatic>([](const MemoryRegion& reg) {
- if (reg.size < 0 || MemoryRegion::RegionType::VARIABLE != reg.type ||
- MemoryRegion::AllocType::POD != reg.alloc_type) {
- return false;
- }
- return true;
+ return reg.size >= 0 && MemoryRegion::RegionType::VARIABLE == reg.type &&
+ MemoryRegion::AllocType::POD == reg.alloc_type;
}));
// handler for static tensors
m_handlers.emplace_back(buildHandler<MemoryManagerNonOverlappingSets>([](const MemoryRegion& reg) {
- if (reg.size >= 0 || MemoryRegion::RegionType::VARIABLE != reg.type ||
- MemoryRegion::AllocType::POD != reg.alloc_type) {
- return false;
- }
- return true;
+ return reg.size < 0 && MemoryRegion::RegionType::VARIABLE == reg.type &&
+ MemoryRegion::AllocType::POD == reg.alloc_type;
}));
// handler for I/O tensors, so far simply individual blocks
m_handlers.emplace_back(buildHandler<MemoryManagerIO>([](const MemoryRegion& reg) {
- if (MemoryRegion::RegionType::VARIABLE == reg.type || reg.alloc_type != MemoryRegion::AllocType::POD) {
- return false;
- }
- return true;
+ return MemoryRegion::RegionType::VARIABLE != reg.type && reg.alloc_type == MemoryRegion::AllocType::POD;
}));
}
diff --git a/src/plugins/intel_cpu/src/memory_desc/blocked_memory_desc.cpp b/src/plugins/intel_cpu/src/memory_desc/blocked_memory_desc.cpp
index fa72da9a7ce..5b9ccd3060d 100644
--- a/src/plugins/intel_cpu/src/memory_desc/blocked_memory_desc.cpp
+++ b/src/plugins/intel_cpu/src/memory_desc/blocked_memory_desc.cpp
@@ -15,10 +15,6 @@
namespace ov::intel_cpu {
/* c++11 requires to have a definition in cpp file */
-constexpr BlockedMemoryDesc::CmpMask BlockedMemoryDesc::FULL_MASK;
-constexpr BlockedMemoryDesc::CmpMask BlockedMemoryDesc::EMPTY_MASK;
-constexpr BlockedMemoryDesc::CmpMask BlockedMemoryDesc::SKIP_OFFSET_MASK;
-constexpr size_t BlockedMemoryDesc::OFFSET_MASK_POS;
bool BlockedMemoryDesc::isCompatibleInternal(const BlockedMemoryDesc& rhs, CmpMask cmpMask) const {
if (this->getShape() != rhs.getShape() || this->getPrecision() != rhs.getPrecision()) {
diff --git a/src/plugins/intel_cpu/src/memory_desc/dnnl_blocked_memory_desc.cpp b/src/plugins/intel_cpu/src/memory_desc/dnnl_blocked_memory_desc.cpp
index a36977f1a35..e26314b54ca 100644
--- a/src/plugins/intel_cpu/src/memory_desc/dnnl_blocked_memory_desc.cpp
+++ b/src/plugins/intel_cpu/src/memory_desc/dnnl_blocked_memory_desc.cpp
@@ -177,7 +177,7 @@ DnnlBlockedMemoryDesc::DnnlBlockedMemoryDesc(ov::element::Type prc,
if (!strides.empty() && !emptyDesc && std::none_of(strides.begin(), strides.end(), [](size_t x) {
return Shape::UNDEFINED_DIM == x;
})) {
- bool inner_block_are_dense = one_of(strides.back(), 0u, 1u); // stride 1 - is dense case, 0 - broad casted
+ bool inner_block_are_dense = one_of(strides.back(), 0U, 1U); // stride 1 - is dense case, 0 - broad casted
for (size_t i = outer_ndims; i < strides.size() - 1; i++) {
inner_block_are_dense &= (strides[i] == strides[i + 1] * blockedDims[i + 1]);
}
@@ -441,11 +441,7 @@ bool DnnlBlockedMemoryDesc::isBlockedCFormat(size_t blk_size) const {
return false;
}
}
- if (blk_size != UNREACHABLE_DIM && static_cast<int64_t>(blk_size) != desc.get_inner_blks()[0]) {
- return false;
- }
-
- return true;
+ return blk_size == UNREACHABLE_DIM || static_cast<int64_t>(blk_size) == desc.get_inner_blks()[0];
}
bool DnnlBlockedMemoryDesc::isTailCFormat() const {
@@ -595,10 +591,7 @@ bool DnnlBlockedMemoryDesc::isSame(dnnl::memory::format_tag fmt) const {
});
}
- if (actualOrder != refOrder) {
- return false;
- }
- return true;
+ return actualOrder == refOrder;
}
size_t DnnlBlockedMemoryDesc::getMaxMemSize() const {
diff --git a/src/plugins/intel_cpu/src/memory_state.cpp b/src/plugins/intel_cpu/src/memory_state.cpp
index 5ec360485c2..f99cb0c9cba 100644
--- a/src/plugins/intel_cpu/src/memory_state.cpp
+++ b/src/plugins/intel_cpu/src/memory_state.cpp
@@ -23,7 +23,6 @@
#include "memory_desc/cpu_blocked_memory_desc.h"
#include "memory_desc/cpu_memory_desc.h"
#include "memory_desc/cpu_memory_desc_utils.h"
-#include "nodes/common/cpu_convert.h"
#include "nodes/kernels/scaled_attn/attn_quant.hpp"
#include "openvino/core/except.hpp"
#include "openvino/core/parallel.hpp"
@@ -257,7 +256,9 @@ ov::SoPtr<ov::ITensor> VariableStateKVcache::get_state() const {
// sanity check
OPENVINO_ASSERT(actual_internal_order == m_dense_internal_desc->getOrder());
- PlainTensor output, pastkv, beam_table;
+ PlainTensor output;
+ PlainTensor pastkv;
+ PlainTensor beam_table;
output.reset(external_mem);
beam_table.reset(m_hidden_state);
pastkv.reset(m_internal_mem);
@@ -323,7 +324,8 @@ void VariableStateKVcache::set_state_impl(const ov::SoPtr<ov::ITensor>& state) {
Memory external_mem(get_engine(), state_desc, m_state->data());
if (dense_internal_desc->getPrecision() == element::u8) {
- PlainTensor external, internal;
+ PlainTensor external;
+ PlainTensor internal;
auto&& actual_internal_order = m_dense_internal_desc->getOrder();
external.resize(external_mem.getStaticDims(),
state_desc->getPrecision().size(),
diff --git a/src/plugins/intel_cpu/src/mlas/thread_pool.cpp b/src/plugins/intel_cpu/src/mlas/thread_pool.cpp
index 6af523af74a..4ecafef57b3 100644
--- a/src/plugins/intel_cpu/src/mlas/thread_pool.cpp
+++ b/src/plugins/intel_cpu/src/mlas/thread_pool.cpp
@@ -25,7 +25,8 @@ size_t OVMlasThreadPool::DegreeOfParallelism() {
void OVMlasThreadPool::TrySimpleParallelFor(const std::ptrdiff_t total, const std::function<void(std::ptrdiff_t)>& fn) {
ov::parallel_nt_static(threadNum, [&](const size_t ithr, const size_t nthr) {
- std::ptrdiff_t start = 0, end = 0;
+ std::ptrdiff_t start = 0;
+ std::ptrdiff_t end = 0;
ov::splitter(total, nthr, ithr, start, end);
for (std::ptrdiff_t i = start; i < end; i++) {
fn(i);
diff --git a/src/plugins/intel_cpu/src/node.cpp b/src/plugins/intel_cpu/src/node.cpp
index b37e6c61b05..2edb04d7c6d 100644
--- a/src/plugins/intel_cpu/src/node.cpp
+++ b/src/plugins/intel_cpu/src/node.cpp
@@ -233,7 +233,7 @@ void Node::remove() {
drop(childEdges);
}
-bool Node::isEdgesEmpty(const std::vector<EdgeWeakPtr>& edges) const {
+bool Node::isEdgesEmpty(const std::vector<EdgeWeakPtr>& edges) {
for (const auto& edge : edges) {
if (edge.lock()) {
return false;
@@ -858,7 +858,7 @@ bool Node::outputShapeDataDependency() const {
auto port_mask = shapeInference->get_port_mask();
if (EMPTY_PORT_MASK != port_mask) {
for (size_t i = 0; i < getParentEdges().size(); ++i) {
- if (((port_mask & (1 << i)) != 0u) && !getParentEdgeAt(i)->getParent()->isConstant()) {
+ if (((port_mask & (1 << i)) != 0U) && !getParentEdgeAt(i)->getParent()->isConstant()) {
return true;
}
}
@@ -870,12 +870,12 @@ void Node::redefineOutputMemory(const std::vector<VectorDims>& newOutputShapes)
if (newOutputShapes.size() != outputShapes.size()) {
OPENVINO_THROW("Number shapes mismatch with real outputs number for node with name: ", getName());
}
- for (size_t i = 0lu; i < outputShapes.size(); i++) {
+ for (size_t i = 0LU; i < outputShapes.size(); i++) {
redefineOutputMemory(i, newOutputShapes[i]);
}
}
-void Node::redefineOutputMemory(const size_t port, const VectorDims& new_output_shape) {
+void Node::redefineOutputMemory(const size_t port, const VectorDims& new_output_shape) const {
const auto edges = getChildEdgesAtPort(port);
static const VectorDims single_element_shape = {1};
@@ -891,9 +891,9 @@ void Node::redefineOutputMemory(const size_t port, const VectorDims& new_output_
return;
}
- const bool has_zero_dims = std::count(std::begin(new_shape), std::end(new_shape), 0lu) > 0;
+ const bool has_zero_dims = std::count(std::begin(new_shape), std::end(new_shape), 0LU) > 0;
const auto mem_desc = getBaseMemDescAtOutputPort(port)->cloneWithNewDims(new_shape, has_zero_dims);
- for (size_t j = 0lu; j < edges.size(); j++) { // NOLINT(modernize-loop-convert)
+ for (size_t j = 0LU; j < edges.size(); j++) { // NOLINT(modernize-loop-convert)
edges[j]->getMemoryPtr()->redefineDesc(mem_desc);
}
}
@@ -904,7 +904,8 @@ void Node::initSupportedPrimitiveDescriptors() {
}
auto addSupportedPrimitiveDescriptor = [&](const dnnl::primitive_desc& prim_desc) {
- std::vector<PortConfig> inConfs, outConfs;
+ std::vector<PortConfig> inConfs;
+ std::vector<PortConfig> outConfs;
const int inPlaceOutPort = canBeInPlace() ? 0 : -1;
for (size_t i = 0; i < descInputNumbers(); i++) {
@@ -1272,7 +1273,7 @@ Node::ConstantType Node::getConstantType() const {
return constant;
}
-bool Node::isConstant() {
+bool Node::isConstant() const {
return getConstantType() == ConstantType::Const;
}
@@ -1486,7 +1487,7 @@ void Node::initOptimalPrimitiveDescriptor() {
initDescriptor(config);
}
-bool Node::isConfigDefined(const NodeConfig& config) const {
+bool Node::isConfigDefined(const NodeConfig& config) {
for (const auto& configs : {config.inConfs, config.outConfs}) {
for (const auto& dc : configs) {
if (!dc.getMemDesc()->isDefined()) {
@@ -1529,7 +1530,7 @@ bool Node::isFusedWith(Type fusedNodeType) const {
return false;
}
-dnnl::memory::format_tag Node::getWeightsFormatTagByDims(const VectorDims& dims) const {
+dnnl::memory::format_tag Node::getWeightsFormatTagByDims(const VectorDims& dims) {
switch (dims.size()) {
case 1:
return dnnl::memory::format_tag::a;
@@ -1694,7 +1695,7 @@ bool Node::canBePerformedAsScaleShift(const Node* parentNode) const {
if (!eltwise) {
OPENVINO_THROW("Cannot cast ", getName(), " to Eltwise");
}
- return eltwise->getAlpha() == 1.0f;
+ return eltwise->getAlpha() == 1.0F;
}
return false;
};
@@ -1718,7 +1719,8 @@ bool Node::canBePerformedAsScaleShift(const Node* parentNode) const {
// Add (with opposite sign) and Multiply (with inverse value) for legacy dephwise post ops
// This can be avoided after dephwise post ops are gone
std::pair<std::vector<float>, std::vector<float>> Node::getScalesAndShifts(const Node* parentNode) const {
- std::vector<float> scales, shifts;
+ std::vector<float> scales;
+ std::vector<float> shifts;
const auto fillValuesFrom = [&](const NodePtr& constInput, std::vector<float>& buffer) {
auto* constInputNode = dynamic_cast<node::Input*>(constInput.get());
@@ -1729,7 +1731,7 @@ std::pair<std::vector<float>, std::vector<float>> Node::getScalesAndShifts(const
const auto elementsCount = constBlob->getDescWithType<BlockedMemoryDesc>()->getPaddedElementsCount();
buffer.resize(elementsCount);
cpu_convert(constBlob->getData(),
- &buffer[0],
+ buffer.data(),
DnnlExtensionUtils::DataTypeToElementType(constBlob->getDataType()),
ov::element::f32,
elementsCount);
@@ -1757,24 +1759,24 @@ std::pair<std::vector<float>, std::vector<float>> Node::getScalesAndShifts(const
switch (getAlgorithm()) {
case Algorithm::EltwiseAdd: {
- scales.resize(shifts.size(), 1.0f);
+ scales.resize(shifts.size(), 1.0F);
break;
}
case Algorithm::EltwiseSubtract: {
- scales.resize(shifts.size(), 1.0f);
+ scales.resize(shifts.size(), 1.0F);
std::transform(shifts.begin(), shifts.end(), shifts.begin(), [](float shift) {
- return -1.0f * shift;
+ return -1.0F * shift;
});
break;
}
case Algorithm::EltwiseMultiply: {
- shifts.resize(scales.size(), 0.0f);
+ shifts.resize(scales.size(), 0.0F);
break;
}
case Algorithm::EltwiseDivide: {
- shifts.resize(scales.size(), 0.0f);
+ shifts.resize(scales.size(), 0.0F);
std::transform(scales.begin(), scales.end(), scales.begin(), [](float scale) {
- return 1.0f / scale;
+ return 1.0F / scale;
});
break;
}
diff --git a/src/plugins/intel_cpu/src/node.h b/src/plugins/intel_cpu/src/node.h
index 134237390f5..abba62469de 100644
--- a/src/plugins/intel_cpu/src/node.h
+++ b/src/plugins/intel_cpu/src/node.h
@@ -353,7 +353,7 @@ public:
};
ConstantType getConstantType() const;
void updateConstantType();
- bool isConstant();
+ bool isConstant() const;
// return type int supports return -1 in overloading when channel axis doesn't exist
virtual int getFusingAxis() const {
@@ -528,7 +528,7 @@ public:
void updateDynamicParams();
void executeDynamic(const dnnl::stream& strm, int numaId = -1);
virtual void redefineOutputMemory(const std::vector<VectorDims>& newShapes);
- void redefineOutputMemory(const size_t port, const VectorDims& new_output_shape);
+ void redefineOutputMemory(const size_t port, const VectorDims& new_output_shape) const;
bool outputShapeDataDependency() const;
virtual void initSupportedPrimitiveDescriptors();
@@ -810,9 +810,9 @@ protected:
void selectPreferPrimitiveDescriptor(const std::vector<impl_desc_type>& priority, bool ignoreConstInputs);
void selectPreferPrimitiveDescriptorWithShape(const std::vector<impl_desc_type>& priority, bool ignoreConstInputs);
- bool isOneDimShape(const ov::PartialShape& pshape);
- bool isReorderRequired(const ov::intel_cpu::MemoryDescPtr& desc1, const ov::intel_cpu::MemoryDescPtr& desc2);
- bool isConfigDefined(const NodeConfig& config) const;
+ static bool isOneDimShape(const ov::PartialShape& pshape);
+ static bool isReorderRequired(const ov::intel_cpu::MemoryDescPtr& desc1, const ov::intel_cpu::MemoryDescPtr& desc2);
+ static bool isConfigDefined(const NodeConfig& config);
virtual bool canBeInPlace() const;
/* returns default implementaion prioirity */
@@ -823,7 +823,7 @@ protected:
virtual std::vector<dnnl::memory::format_tag> getAvailableFormatsForDims(const Shape& dims) const;
- dnnl::memory::format_tag getWeightsFormatTagByDims(const VectorDims& dims) const;
+ static dnnl::memory::format_tag getWeightsFormatTagByDims(const VectorDims& dims);
/**
* @brief Auxiliary function to get node input precisions
@@ -912,7 +912,7 @@ private:
edges.end());
}
- bool isEdgesEmpty(const std::vector<EdgeWeakPtr>& edges) const;
+ static bool isEdgesEmpty(const std::vector<EdgeWeakPtr>& edges);
std::vector<EdgeWeakPtr> parentEdges;
std::vector<EdgeWeakPtr> childEdges;
diff --git a/src/plugins/intel_cpu/src/nodes/adaptive_pooling.cpp b/src/plugins/intel_cpu/src/nodes/adaptive_pooling.cpp
index fd753cb8ec5..bfbcdbe5afe 100644
--- a/src/plugins/intel_cpu/src/nodes/adaptive_pooling.cpp
+++ b/src/plugins/intel_cpu/src/nodes/adaptive_pooling.cpp
@@ -186,12 +186,13 @@ void AdaptivePooling::execute([[maybe_unused]] const dnnl::stream& strm) {
const auto IH = static_cast<int>(spatialDimsCount >= 2 ? inputDimVector[spatialDimsCount] : 1);
const auto IW = static_cast<int>(inputDimVector[spatialDimsCount + 1]);
- const auto OD = static_cast<int>(spatialDimsCount == 3 ? srcPooledSpatialShapes[0] : 1);
- const auto OH = static_cast<int>(spatialDimsCount >= 2 ? srcPooledSpatialShapes[spatialDimsCount - 2] : 1);
+ const auto OD = (spatialDimsCount == 3 ? srcPooledSpatialShapes[0] : 1);
+ const auto OH = (spatialDimsCount >= 2 ? srcPooledSpatialShapes[spatialDimsCount - 2] : 1);
const auto OW = static_cast<int>(srcPooledSpatialShapes[spatialDimsCount - 1]);
const int iHW = IH * IW;
- const int oDHW = OD * OH * OW, oHW = OH * OW;
+ const int oDHW = OD * OH * OW;
+ const int oHW = OH * OW;
const int chPadding =
blockSize * (isBlkFmt ? srcBlockDesc->getBlockDims()[1] : srcMemory0.getShape().getStaticDims()[1]);
@@ -219,7 +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, dEnd, hStart, hEnd, wStart, wEnd;
+ size_t dStart;
+ size_t dEnd;
+ size_t hStart;
+ size_t hEnd;
+ size_t wStart;
+ size_t wEnd;
setBinBorders(&dStart, &dEnd, od, ID, OD);
setBinBorders(&hStart, &hEnd, oh, IH, OH);
setBinBorders(&wStart, &wEnd, ow, IW, OW);
@@ -240,7 +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, dEnd, hStart, hEnd, wStart, wEnd;
+ size_t dStart;
+ size_t dEnd;
+ size_t hStart;
+ size_t hEnd;
+ size_t wStart;
+ size_t wEnd;
setBinBorders(&dStart, &dEnd, od, ID, OD);
setBinBorders(&hStart, &hEnd, oh, IH, OH);
setBinBorders(&wStart, &wEnd, ow, IW, OW);
@@ -270,7 +281,10 @@ void AdaptivePooling::execute([[maybe_unused]] const dnnl::stream& strm) {
const auto* srcData = src + n * inStrides[0] + blkIdx * inStrides[1];
auto* dstData = dst + n * outStrides[0] + blkIdx * outStrides[1] + od * outStrides[2] + oh * outStrides[3] +
ow * outStrides[4];
- int cStart = 0, cEnd = C, inResidual = 0, outResidual = 0;
+ int cStart = 0;
+ int cEnd = C;
+ int inResidual = 0;
+ int outResidual = 0;
if (!isTailCFmt) {
cStart = blkIdx * blockSize;
cEnd = (blkIdx == blockCount - 1 ? C : cStart + blockSize);
diff --git a/src/plugins/intel_cpu/src/nodes/adaptive_pooling.h b/src/plugins/intel_cpu/src/nodes/adaptive_pooling.h
index 3a9ae546fe7..96881b0e78a 100644
--- a/src/plugins/intel_cpu/src/nodes/adaptive_pooling.h
+++ b/src/plugins/intel_cpu/src/nodes/adaptive_pooling.h
@@ -36,7 +36,11 @@ private:
int spatialDimsCount;
mutable std::vector<Dim> spatialDimsValue = {};
ov::element::Type precision = ov::element::f32;
- inline void setBinBorders(size_t* startPtr, size_t* endPtr, size_t idx, size_t inputLength, size_t outputLength);
+ static inline void setBinBorders(size_t* startPtr,
+ size_t* endPtr,
+ size_t idx,
+ size_t inputLength,
+ size_t outputLength);
protected:
bool needShapeInfer() const override;
diff --git a/src/plugins/intel_cpu/src/nodes/batch_to_space.cpp b/src/plugins/intel_cpu/src/nodes/batch_to_space.cpp
index 2534bfd551a..1ee53160238 100644
--- a/src/plugins/intel_cpu/src/nodes/batch_to_space.cpp
+++ b/src/plugins/intel_cpu/src/nodes/batch_to_space.cpp
@@ -147,7 +147,7 @@ void BatchToSpace::batchToSpaceKernel() {
auto outShape5D = getShape5D(outDims);
auto blockShape = getShape5D(blockShapeIn);
- if (srcDesc->hasLayoutType(LayoutType::nspc) && one_of(srcDesc->getShape().getRank(), 4u, 5u)) {
+ if (srcDesc->hasLayoutType(LayoutType::nspc) && one_of(srcDesc->getShape().getRank(), 4U, 5U)) {
inShape5D.push_back(inShape5D[1]);
inShape5D.erase(inShape5D.begin() + 1);
outShape5D.push_back(outShape5D[1]);
@@ -158,7 +158,7 @@ void BatchToSpace::batchToSpaceKernel() {
auto dstDesc = getChildEdgeAt(0)->getMemory().getDescWithType<BlockedMemoryDesc>();
- const size_t blockSize = blocked ? dstDesc->getBlockDims().back() : 1lu;
+ const size_t blockSize = blocked ? dstDesc->getBlockDims().back() : 1LU;
const size_t blockCountInput = srcDesc->getBlockDims()[1];
const size_t blockCountOutput = dstDesc->getBlockDims()[1];
const auto blockRemainder = inShape5D[1] % blockSize;
@@ -178,7 +178,8 @@ void BatchToSpace::batchToSpaceKernel() {
}
parallel_nt(0, [&](const int ithr, const int nthr) {
- size_t start(0lu), end(0lu);
+ size_t start(0LU);
+ size_t end(0LU);
splitter(workAmount, nthr, ithr, start, end);
std::vector<size_t> indxStart(2, 0);
std::vector<size_t> indxEnd(2, 0);
@@ -195,10 +196,10 @@ void BatchToSpace::batchToSpaceKernel() {
bIdx /= blockShapeIn[dimsSize - 1];
oAdd[3] = bIdx % blockShapeIn[dimsSize - 2] - cropsBeginIn[dimsSize - 2];
bIdx /= blockShapeIn[dimsSize - 2];
- oAdd[2] = dimsSize == 5 ? bIdx % blockShapeIn[2] - cropsBeginIn[2] : 0lu;
+ oAdd[2] = dimsSize == 5 ? bIdx % blockShapeIn[2] - cropsBeginIn[2] : 0LU;
bIdx = dimsSize == 5 ? bIdx / blockShapeIn[2] : bIdx;
oAdd[1] = bIdx % blockShapeIn[1] - cropsBeginIn[1];
- if (srcDesc->hasLayoutType(LayoutType::nspc) && one_of(srcDesc->getShape().getRank(), 4u, 5u)) {
+ if (srcDesc->hasLayoutType(LayoutType::nspc) && one_of(srcDesc->getShape().getRank(), 4U, 5U)) {
oAdd.push_back(oAdd[1]);
oAdd.erase(oAdd.begin() + 1);
}
@@ -212,8 +213,8 @@ void BatchToSpace::batchToSpaceKernel() {
finish[3] = (outShape5D[3] + blockShape[3] - 1 - oAdd[3]) / blockShape[3];
begin[4] = (blockShape[4] - 1 - oAdd[4]) / blockShape[4];
finish[4] = (outShape5D[4] + blockShape[4] - 1 - oAdd[4]) / blockShape[4];
- const int64_t addTmpOC = blocked ? 0lu : oAdd[1];
- const int64_t addTmpOc = blocked ? oAdd[1] : 0lu;
+ const int64_t addTmpOC = blocked ? 0LU : oAdd[1];
+ const int64_t addTmpOc = blocked ? oAdd[1] : 0LU;
const size_t firstI1 = i0 == 0 ? std::max(begin[1], indxStart[1]) : begin[1];
const size_t lastI1 = i0 == indxEnd[0] ? std::min(indxEnd[1] + 1, finish[1]) : finish[1];
@@ -223,7 +224,7 @@ void BatchToSpace::batchToSpaceKernel() {
const int64_t tmpOC = i1 * blockShape[1] + addTmpOC;
const size_t srcIdx1 = srcIdx0 + i1 * inSpatialStep * blockSize;
const size_t dstIdx1 = dstIdx0 + tmpOC * outSpatialStep * blockSize;
- const size_t itEnd = blocked ? ((block - 1) * blockShape[1] + oAdd[1]) / blockSize : 0lu;
+ const size_t itEnd = blocked ? ((block - 1) * blockShape[1] + oAdd[1]) / blockSize : 0LU;
for (size_t i2 = begin[2]; i2 < finish[2]; ++i2) {
const int64_t tmpOd = i2 * blockShape[2] + oAdd[2];
const size_t srcIdx2 = srcIdx1 + i2 * inShape5D[3] * inShape5D[4] * blockSize;
diff --git a/src/plugins/intel_cpu/src/nodes/bin_conv.cpp b/src/plugins/intel_cpu/src/nodes/bin_conv.cpp
index 7ab53d9ec25..57f1977b47e 100644
--- a/src/plugins/intel_cpu/src/nodes/bin_conv.cpp
+++ b/src/plugins/intel_cpu/src/nodes/bin_conv.cpp
@@ -485,7 +485,10 @@ private:
int nbits = 8;
const int inp_mult = dilate_h * div_up(jcp_.ic, nbits);
- Label t_overflow_label, no_t_overflow_label, b_overflow_label, no_b_overflow_label;
+ Label t_overflow_label;
+ Label no_t_overflow_label;
+ Label b_overflow_label;
+ Label no_b_overflow_label;
mov(aux_reg_input, reg_input);
mov(aux_reg_kernel, reg_kernel_base);
@@ -948,7 +951,7 @@ private:
}
// offset = 8
for (size_t d = 0; d < simd_w; ++d) {
- uint32_t val = jcp_.pad_value == 1.0f ? 0xffffffff : 0x00000000;
+ uint32_t val = jcp_.pad_value == 1.0F ? 0xffffffff : 0x00000000;
dd(val);
}
}
@@ -1141,7 +1144,7 @@ void BinaryConvolution::createPrimitive() {
jcp.dilate_w = dilation[1];
jcp.pad_value = pad_value;
- jcp.exclude_pad = jcp.pad_value == 0.0f;
+ jcp.exclude_pad = jcp.pad_value == 0.0F;
jcp.with_dw_conv = false;
jcp.with_binarization = withBinarization;
@@ -1317,7 +1320,7 @@ void BinaryConvolution::executeReference(const uint8_t* src,
uint8_t* dst,
const std::vector<size_t>& s_str,
const std::vector<size_t>& w_str,
- const std::vector<size_t>& d_str) {
+ const std::vector<size_t>& d_str) const {
auto* dst_fp = reinterpret_cast<float*>(dst);
const bool with_groups = jcp.ngroups > 1;
@@ -1371,7 +1374,7 @@ void BinaryConvolution::executeReference(const uint8_t* src,
if (pad_value == 0) {
continue;
}
- s = pad_value == 1.0f ? static_cast<uint8_t>(1) : static_cast<uint8_t>(0);
+ s = pad_value == 1.0F ? static_cast<uint8_t>(1) : static_cast<uint8_t>(0);
} else {
s = extract_bit(src[iidx / nbits], static_cast<uint8_t>(iidx % nbits));
@@ -1390,7 +1393,7 @@ void BinaryConvolution::executeReference(const uint8_t* src,
ker(a, g, mb, oc, oh, ow);
float base_value;
- if (pad_value == 0.0f) {
+ 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));
diff --git a/src/plugins/intel_cpu/src/nodes/bin_conv.h b/src/plugins/intel_cpu/src/nodes/bin_conv.h
index 2b22fc85e61..f6218137d39 100644
--- a/src/plugins/intel_cpu/src/nodes/bin_conv.h
+++ b/src/plugins/intel_cpu/src/nodes/bin_conv.h
@@ -142,7 +142,7 @@ private:
uint8_t* dst,
const std::vector<size_t>& s_str,
const std::vector<size_t>& w_str,
- const std::vector<size_t>& d_str);
+ const std::vector<size_t>& d_str) const;
};
} // namespace node
diff --git a/src/plugins/intel_cpu/src/nodes/broadcast.cpp b/src/plugins/intel_cpu/src/nodes/broadcast.cpp
index 736648bf1ea..06c78231895 100644
--- a/src/plugins/intel_cpu/src/nodes/broadcast.cpp
+++ b/src/plugins/intel_cpu/src/nodes/broadcast.cpp
@@ -106,11 +106,11 @@ void Broadcast::getSupportedDescriptors() {
const auto ndims = repeats.size();
if (broadcastType == NUMPY) {
- for (size_t i = 0lu; i < srcDims.size(); i++) {
- repeats[ndims - 1lu - i] /= srcDims[srcDims.size() - 1lu - i];
+ for (size_t i = 0LU; i < srcDims.size(); i++) {
+ repeats[ndims - 1LU - i] /= srcDims[srcDims.size() - 1LU - i];
}
} else if (broadcastType == EXPLICIT) {
- for (size_t i = 0lu; i < axesMapping.size(); i++) {
+ for (size_t i = 0LU; i < axesMapping.size(); i++) {
repeats[axesMapping[i]] /= srcDims[i];
}
}
@@ -150,8 +150,8 @@ void Broadcast::prepareParams() {
auto dstBlockedDims = getChildEdgeAt(0)->getMemory().getDescWithType<BlockedMemoryDesc>()->getBlockDims();
if (broadcastType == NUMPY) {
- for (size_t i = 0lu; i < srcDims.size(); i++) {
- repeats[ndims - 1lu - i] /= srcDims[srcDims.size() - 1lu - i];
+ for (size_t i = 0LU; i < srcDims.size(); i++) {
+ repeats[ndims - 1LU - i] /= srcDims[srcDims.size() - 1LU - i];
}
} else if (broadcastType == EXPLICIT) {
for (size_t i = 0; i < getInputShapeAtPort(AXES_MAPPING_IDX).getDims()[0]; i++) {
@@ -179,7 +179,7 @@ bool Broadcast::needShapeInfer() const {
return true;
}
const auto* targetShapeData = getSrcDataAtPortAs<const int32_t>(TARGET_SHAPE_IDX);
- for (size_t i = 0lu; i < targetShape.size(); i++) {
+ for (size_t i = 0LU; i < targetShape.size(); i++) {
if (targetShape[i] != targetShapeData[i]) {
return true;
}
@@ -190,7 +190,7 @@ bool Broadcast::needShapeInfer() const {
return true;
}
const auto* axesMappingData = getSrcDataAtPortAs<const int32_t>(AXES_MAPPING_IDX);
- for (size_t i = 0lu; i < axesMapping.size(); i++) {
+ for (size_t i = 0LU; i < axesMapping.size(); i++) {
if (axesMapping[i] != axesMappingData[i]) {
return true;
}
@@ -242,7 +242,7 @@ void Broadcast::plainExecute([[maybe_unused]] const dnnl::stream& strm) {
VectorDims srcAligned(dataDstRank);
VectorDims srcStridesAligned(dataDstRank);
const size_t prefixSize = dataDstRank - dataSrcRank;
- for (size_t i = 0lu; i < dataDstRank; i++) {
+ for (size_t i = 0LU; i < dataDstRank; i++) {
if (i < prefixSize) {
srcAligned[i] = 1;
srcStridesAligned[i] = srcStrides[0];
@@ -257,7 +257,10 @@ void Broadcast::plainExecute([[maybe_unused]] const dnnl::stream& strm) {
auto* dstData = getDstDataAtPortAs<uint8_t>(0);
parallel_nt(0, [&](const int ithr, const int nthr) {
- size_t i = 0lu, srcIdx = 0lu, start = 0lu, end = 0lu;
+ size_t i = 0LU;
+ size_t srcIdx = 0LU;
+ size_t start = 0LU;
+ size_t end = 0LU;
VectorDims counters(dataDstRank, 0);
splitter(workAmountDst, nthr, ithr, start, end);
for (int j = dataDstRank - 1, i = start; j >= 0; j--) {
@@ -265,7 +268,7 @@ void Broadcast::plainExecute([[maybe_unused]] const dnnl::stream& strm) {
i /= dstDims[j];
}
for (size_t iwork = start * dataSize; iwork < end * dataSize; iwork += dataSize) {
- for (i = 0lu, srcIdx = 0lu; i < dataDstRank; ++i) {
+ for (i = 0LU, srcIdx = 0LU; i < dataDstRank; ++i) {
srcIdx += counters[i] ? ((counters[i] % srcAligned[i]) * srcStridesAligned[i]) : 0;
}
diff --git a/src/plugins/intel_cpu/src/nodes/bucketize.cpp b/src/plugins/intel_cpu/src/nodes/bucketize.cpp
index 0fadb2d9484..813781b7fb7 100644
--- a/src/plugins/intel_cpu/src/nodes/bucketize.cpp
+++ b/src/plugins/intel_cpu/src/nodes/bucketize.cpp
@@ -89,10 +89,10 @@ void Bucketize::initSupportedPrimitiveDescriptors() {
impl_desc_type::ref_any);
}
-inline constexpr uint32_t getElementsMask(ov::element::Type precision1,
- ov::element::Type precision2,
- ov::element::Type precision3 = ov::element::dynamic,
- ov::element::Type precision4 = ov::element::dynamic) {
+constexpr uint32_t getElementsMask(ov::element::Type precision1,
+ ov::element::Type precision2,
+ ov::element::Type precision3 = ov::element::dynamic,
+ ov::element::Type precision4 = ov::element::dynamic) {
return static_cast<uint32_t>(ov::element::Type_t(precision1)) |
(static_cast<uint32_t>(ov::element::Type_t(precision2)) << 8) |
(static_cast<uint32_t>(ov::element::Type_t(precision3)) << 16) |
diff --git a/src/plugins/intel_cpu/src/nodes/color_convert.cpp b/src/plugins/intel_cpu/src/nodes/color_convert.cpp
index ef234afb13d..1ffadf3d156 100644
--- a/src/plugins/intel_cpu/src/nodes/color_convert.cpp
+++ b/src/plugins/intel_cpu/src/nodes/color_convert.cpp
@@ -87,18 +87,18 @@ bool Converter::singlePlane() const {
template <typename T>
std::tuple<T, T, T> Converter::yuv_to_rgb(float y, float u, float v) {
- auto c = y - 16.f;
- auto d = u - 128.f;
- auto e = v - 128.f;
+ auto c = y - 16.F;
+ auto d = u - 128.F;
+ auto e = v - 128.F;
auto clip = [](float a) -> T {
if (std::is_integral<T>()) {
- return static_cast<T>(std::min(std::max(std::round(a), 0.f), 255.f));
+ return static_cast<T>(std::min(std::max(std::round(a), 0.F), 255.F));
}
- return static_cast<T>(std::min(std::max(a, 0.f), 255.f));
+ return static_cast<T>(std::min(std::max(a, 0.F), 255.F));
};
- auto r = clip(1.164f * c + 1.596f * e);
- auto g = clip(1.164f * c - 0.391f * d - 0.813f * e);
- auto b = clip(1.164f * c + 2.018f * d);
+ auto r = clip(1.164F * c + 1.596F * e);
+ auto g = clip(1.164F * c - 0.391F * d - 0.813F * e);
+ auto b = clip(1.164F * c + 2.018F * d);
return std::make_tuple(r, g, b);
}
@@ -292,7 +292,7 @@ void jit_uni_converter::store_tail(const variable<T*>& dst,
sptr += step;
store(sptr, c);
- auto copy_size = size * static_cast<size_t>(3u);
+ auto copy_size = size * static_cast<size_t>(3U);
copy<T>(ptr[dst], s.pointer(), copy_size);
}
@@ -366,7 +366,9 @@ void RefConverter::convert(const T* y,
auto uv_index = (h / 2) * width + (w / 2) * 2;
auto u_val = static_cast<float>(uv_ptr[uv_index]);
auto v_val = static_cast<float>(uv_ptr[uv_index + 1]);
- T r, g, b;
+ T r;
+ T g;
+ T b;
std::tie(r, g, b) = yuv_to_rgb<T>(y_val, u_val, v_val);
out[y_index * 3 + _colorFormat[0]] = r;
out[y_index * 3 + _colorFormat[1]] = g;
@@ -439,7 +441,7 @@ void JitConverter<T[N]>::generate() {
auto width = arg(&Params::width);
auto colorFormat = arg(&Params::colorFormat);
- static const float data[8] = {16.f, 128.f, 1.164f, 1.596f, 0.391f, 2.018f, 0.813f, 255.f};
+ static const float data[8] = {16.F, 128.F, 1.164F, 1.596F, 0.391F, 2.018F, 0.813F, 255.F};
_consts = data;
const auto reg_capacity_log = static_cast<size_t>(std::logb(N));
@@ -697,7 +699,9 @@ void RefConverter::convert(const T* y,
auto uv_index = (h / 2) * (width / 2) + w / 2;
auto u_val = static_cast<float>(u_ptr[uv_index]);
auto v_val = static_cast<float>(v_ptr[uv_index]);
- T r, g, b;
+ T r;
+ T g;
+ T b;
std::tie(r, g, b) = yuv_to_rgb<T>(y_val, u_val, v_val);
out[y_index * 3 + _colorFormat[0]] = r;
out[y_index * 3 + _colorFormat[1]] = g;
@@ -774,7 +778,7 @@ void JitConverter<T[N]>::generate() {
auto width = arg(&Params::width);
auto colorFormat = arg(&Params::colorFormat);
- static const float data[8] = {16.f, 128.f, 1.164f, 1.596f, 0.391f, 2.018f, 0.813f, 255.f};
+ static const float data[8] = {16.F, 128.F, 1.164F, 1.596F, 0.391F, 2.018F, 0.813F, 255.F};
_consts = data;
const auto reg_capacity_log = static_cast<size_t>(std::logb(N));
diff --git a/src/plugins/intel_cpu/src/nodes/common/blocked_desc_creator.cpp b/src/plugins/intel_cpu/src/nodes/common/blocked_desc_creator.cpp
index 7f78cb0c415..cb15793a38b 100644
--- a/src/plugins/intel_cpu/src/nodes/common/blocked_desc_creator.cpp
+++ b/src/plugins/intel_cpu/src/nodes/common/blocked_desc_creator.cpp
@@ -20,7 +20,7 @@
namespace ov::intel_cpu {
namespace {
-constexpr size_t channelsPos = 1lu;
+constexpr size_t channelsPos = 1LU;
class PlainFormatCreator : public BlockedDescCreator {
public:
@@ -31,7 +31,7 @@ public:
return {precision, srcShape, srcShape.getDims(), order};
}
[[nodiscard]] size_t getMinimalRank() const override {
- return 0lu;
+ return 0LU;
}
};
@@ -55,7 +55,7 @@ public:
return {precision, srcShape, blkDims, order};
}
[[nodiscard]] size_t getMinimalRank() const override {
- return 3lu;
+ return 3LU;
}
};
@@ -81,7 +81,7 @@ public:
return {precision, srcShape, blkDims, order};
}
[[nodiscard]] size_t getMinimalRank() const override {
- return 3lu;
+ return 3LU;
}
private:
@@ -102,10 +102,7 @@ std::pair<CreatorsMapFilterConstIterator, CreatorsMapFilterConstIterator> Blocke
const CreatorsMap& map,
unsigned int rank) {
auto rankFilter = [rank](const CreatorsMap::value_type& item) {
- if (item.second->getMinimalRank() > rank) {
- return false;
- }
- return true;
+ return item.second->getMinimalRank() <= rank;
};
auto first = CreatorsMapFilterConstIterator(std::move(rankFilter), map.begin(), map.end());
@@ -117,7 +114,7 @@ std::pair<CreatorsMapFilterConstIterator, CreatorsMapFilterConstIterator> Blocke
const CreatorsMap& map,
unsigned rank,
const std::vector<LayoutType>& supportedTypes) {
- unsigned bitMask = 0ul;
+ unsigned bitMask = 0UL;
for (const auto& item : supportedTypes) {
bitMask |= 1 << static_cast<unsigned>(item);
}
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 0d95cea4dcf..c192ced62b8 100644
--- a/src/plugins/intel_cpu/src/nodes/common/cpu_convert.cpp
+++ b/src/plugins/intel_cpu/src/nodes/common/cpu_convert.cpp
@@ -95,7 +95,7 @@ class jit_convert_array : public jit_kernel {
void generate() override {
bool is_fp8 = f8_e4m3_emu_ || f8_e5m2_emu_;
- size_t vlen = is_fp8 ? 16u : 8u;
+ size_t vlen = is_fp8 ? 16U : 8U;
size_t vlen_log2 = is_fp8 ? 4 : 3;
preamble();
@@ -446,7 +446,8 @@ 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, ubound;
+ double lbound;
+ double ubound;
switch (prec) {
case ov::element::f8e4m3:
lbound = static_cast<double>(std::numeric_limits<ov::float8_e4m3>::lowest());
@@ -561,7 +562,8 @@ 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, ubound;
+ src_t lbound;
+ src_t ubound;
std::tie(lbound, ubound) = ctx.range<src_t>();
// Align with the behavior of ngraph ref and jit implementation. Conversion from f8e4m3-inf
@@ -601,7 +603,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, ubound;
+ float lbound;
+ float ubound;
std::tie(lbound, ubound) = ctx.range<float>();
parallel_for(ctx.size, [&](size_t i) {
dst[i] = static_cast<ov::intel_cpu::bfloat16_t>(std::trunc(std::max(std::min(src[i], ubound), lbound)));
@@ -623,7 +626,8 @@ struct ConvertPrecision<std::tuple<ov::intel_cpu::bfloat16_t, float>> {
dst[i] = static_cast<float>(src[i]);
});
} else {
- float lbound, ubound;
+ float lbound;
+ float ubound;
std::tie(lbound, ubound) = ctx.range<ov::intel_cpu::bfloat16_t>();
parallel_for(ctx.size, [&](size_t i) {
dst[i] = std::trunc(std::max(std::min(static_cast<float>(src[i]), ubound), lbound));
@@ -645,7 +649,8 @@ 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, ubound;
+ src_t lbound;
+ src_t ubound;
std::tie(lbound, ubound) = ctx.range<src_t>();
if (std::is_integral<src_t>::value) {
@@ -698,7 +703,8 @@ 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, ubound;
+ float lbound;
+ float ubound;
std::tie(lbound, ubound) = ctx.range<ov::float16>();
if (std::is_integral<dst_t>::value) {
@@ -751,7 +757,8 @@ 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, ubound;
+ float lbound;
+ float ubound;
std::tie(lbound, ubound) = ctx.range<ov::float16>();
if (ctx.interimPrc.is_real()) {
@@ -911,19 +918,19 @@ struct ConvertFrom4BitPrecision<std::tuple<src_t, dst_t>> {
auto dst = static_cast<dst_t*>(ctx.dstPtr);
if (ctx.inType == ov::element::nf4) {
parallel_for(ctx.size, [&](size_t i) {
- dst[i] = static_cast<dst_t>(ConvertNF4::dequantize(get_u4(src[i / 2], (i % 2) != 0u)));
+ dst[i] = static_cast<dst_t>(ConvertNF4::dequantize(get_u4(src[i / 2], (i % 2) != 0U)));
});
} else if (ctx.inType == ov::element::u4) {
parallel_for(ctx.size, [&](size_t i) {
- dst[i] = static_cast<dst_t>(get_u4(src[i / 2], (i % 2) != 0u));
+ dst[i] = static_cast<dst_t>(get_u4(src[i / 2], (i % 2) != 0U));
});
} else if (ctx.inType == ov::element::i4) {
parallel_for(ctx.size, [&](size_t i) {
- dst[i] = static_cast<dst_t>(get_i4(src[i / 2], (i % 2) != 0u));
+ dst[i] = static_cast<dst_t>(get_i4(src[i / 2], (i % 2) != 0U));
});
} else if (ctx.inType == ov::element::f4e2m1) {
parallel_for(ctx.size, [&](size_t i) {
- dst[i] = static_cast<dst_t>(float4_e2m1::from_bits(get_u4(src[i / 2], (i % 2) != 0u)));
+ dst[i] = static_cast<dst_t>(float4_e2m1::from_bits(get_u4(src[i / 2], (i % 2) != 0U)));
});
} else {
OPENVINO_THROW("cpu_convert doesn't support input data type: ", ctx.inType, ". Not implemented.");
@@ -1067,7 +1074,8 @@ void cpu_convert(const void* srcPtr,
const auto* src = static_cast<const uint8_t*>(srcPtr);
auto* dst = static_cast<uint8_t*>(dstPtr);
parallel_nt(0, [&](const size_t ithr, const size_t nthr) {
- size_t start = 0, end = 0;
+ size_t start = 0;
+ size_t end = 0;
splitter(totalSize, nthr, ithr, start, end);
cpu_memcpy(dst + start, src + start, end - start);
});
@@ -1094,13 +1102,13 @@ void cpu_convert(const void* srcPtr,
"> precision to: ",
dstPrc);
}
- } else if (srcPrc.bitwidth() == 4u) {
+ } else if (srcPrc.bitwidth() == 4U) {
ConvertFrom4BitContext ctx{srcPrc, srcPtr, dstPtr, size, false};
OV_SWITCH(intel_cpu, ConvertFrom4BitPrecision, ctx, std::tie(srcPrc, dstPrc), INTEL_CPU_CVT_FROM_4BIT_LIST);
if (!ctx.converted) {
OPENVINO_THROW("cpu_convert can't convert from: ", srcPrc, " precision to: ", dstPrc);
}
- } else if (dstPrc.bitwidth() == 4u) {
+ } else if (dstPrc.bitwidth() == 4U) {
ConvertTo4BitContext ctx{dstPrc, srcPtr, dstPtr, size, false};
OV_SWITCH(intel_cpu, ConvertTo4BitPrecision, ctx, std::tie(srcPrc, dstPrc), INTEL_CPU_CVT_TO_4BIT_LIST);
if (!ctx.converted) {
diff --git a/src/plugins/intel_cpu/src/nodes/common/permute_kernel.cpp b/src/plugins/intel_cpu/src/nodes/common/permute_kernel.cpp
index fd14c887b62..f7e67a10e93 100644
--- a/src/plugins/intel_cpu/src/nodes/common/permute_kernel.cpp
+++ b/src/plugins/intel_cpu/src/nodes/common/permute_kernel.cpp
@@ -210,7 +210,7 @@ void PermuteKernel::execute(const uint8_t* src_data, uint8_t* dst_data) {
RefTransposeExecutor::referenceExecute(src_data, dst_data, jcp, dst_dims[0]);
}
-void PermuteKernel::optimizedExecute(const uint8_t* src_data, uint8_t* dst_data, const int mb) {
+void PermuteKernel::optimizedExecute(const uint8_t* src_data, const uint8_t* dst_data, const int mb) {
VectorDims dst_dims = jcp.dst_block_dims;
const VectorDims dst_strides = jcp.dst_strides;
const VectorDims src_strides = jcp.src_strides;
@@ -259,7 +259,6 @@ void PermuteKernel::optimizedExecute(const uint8_t* src_data, uint8_t* dst_data,
default:
OPENVINO_THROW("Unsupported number of dimensions: " + std::to_string(jcp.n));
}
- return;
}
size_t PermuteParams::hash() const {
diff --git a/src/plugins/intel_cpu/src/nodes/common/permute_kernel.h b/src/plugins/intel_cpu/src/nodes/common/permute_kernel.h
index 3f1cdabd324..d04cb1fa9c1 100644
--- a/src/plugins/intel_cpu/src/nodes/common/permute_kernel.h
+++ b/src/plugins/intel_cpu/src/nodes/common/permute_kernel.h
@@ -70,7 +70,7 @@ public:
}
private:
- void optimizedExecute(const uint8_t* src_data, uint8_t* dst_data, const int mb);
+ void optimizedExecute(const uint8_t* src_data, const uint8_t* dst_data, const int mb);
jit_permute_config_params jcp = {};
std::shared_ptr<jit_uni_permute_kernel> permute_kernel;
diff --git a/src/plugins/intel_cpu/src/nodes/common/softmax.cpp b/src/plugins/intel_cpu/src/nodes/common/softmax.cpp
index cbc75efc93b..368053a7ada 100644
--- a/src/plugins/intel_cpu/src/nodes/common/softmax.cpp
+++ b/src/plugins/intel_cpu/src/nodes/common/softmax.cpp
@@ -48,7 +48,7 @@ struct jit_softmax_config_params {
struct jit_uni_softmax_kernel {
void (*ker_)(const jit_args_softmax*){nullptr};
- void operator()(const jit_args_softmax* args) {
+ void operator()(const jit_args_softmax* args) const {
assert(ker_);
ker_(args);
}
@@ -75,7 +75,7 @@ struct jit_uni_softmax_kernel_f32 : public jit_uni_softmax_kernel, public jit_ge
void generate() override {
exp_injector.reset(
- new jit_uni_eltwise_injector<isa>(this, dnnl::impl::alg_kind::eltwise_exp, 0.f, 0.f, 1.0f, data_type::f32));
+ new jit_uni_eltwise_injector<isa>(this, dnnl::impl::alg_kind::eltwise_exp, 0.F, 0.F, 1.0F, data_type::f32));
if (mayiuse(avx512_core)) {
uni_vcvtneps2bf16 = std::make_unique<jit_uni_vcvtneps2bf16>(this, isa);
@@ -213,7 +213,7 @@ private:
jit_softmax_config_params jcp_;
- inline void load_vector(Vmm vmm_src, const Xbyak::Address& op, ov::element::Type src_dt) {
+ void load_vector(Vmm vmm_src, const Xbyak::Address& op, ov::element::Type src_dt) {
switch (src_dt) {
case ov::element::f32:
uni_vmovups(vmm_src, op);
@@ -226,7 +226,7 @@ private:
assert(!"unknown src_dt");
}
}
- inline void store_vector(const Xbyak::Address& op, Vmm vmm_dst, ov::element::Type dst_dt) {
+ void store_vector(const Xbyak::Address& op, Vmm vmm_dst, ov::element::Type dst_dt) {
auto ymm_dst = Xbyak::Ymm(vmm_dst.getIdx());
switch (dst_dt) {
diff --git a/src/plugins/intel_cpu/src/nodes/common/tile_broadcast_utils.cpp b/src/plugins/intel_cpu/src/nodes/common/tile_broadcast_utils.cpp
index edf1479a01f..f847c4c33de 100644
--- a/src/plugins/intel_cpu/src/nodes/common/tile_broadcast_utils.cpp
+++ b/src/plugins/intel_cpu/src/nodes/common/tile_broadcast_utils.cpp
@@ -80,7 +80,7 @@ void TileBroadcastCommon::fillOptimizedDimsAndSrcStrides(const VectorDims& srcBl
bool TileBroadcastCommon::canBeExecutedInBlockedLayout(VectorDims srcBlockedDims,
VectorDims blockedRepeats,
const size_t elemsInBlock) {
- if (srcBlockedDims.empty() || blockedRepeats.empty() || elemsInBlock == 0lu ||
+ if (srcBlockedDims.empty() || blockedRepeats.empty() || elemsInBlock == 0LU ||
srcBlockedDims[1] == Shape::UNDEFINED_DIM ||
(blockedRepeats[1] != 1 && srcBlockedDims[1] % elemsInBlock != 0)) {
return false;
@@ -90,10 +90,11 @@ bool TileBroadcastCommon::canBeExecutedInBlockedLayout(VectorDims srcBlockedDims
srcBlockedDims.push_back(elemsInBlock);
blockedRepeats.push_back(1);
- VectorDims optimizedDims, optimizedSrcStrides;
+ VectorDims optimizedDims;
+ VectorDims optimizedSrcStrides;
fillOptimizedDimsAndSrcStrides(srcBlockedDims, blockedRepeats, optimizedDims, optimizedSrcStrides);
- constexpr size_t maxNDims = 6lu;
+ constexpr size_t maxNDims = 6LU;
return optimizedDims.size() <= maxNDims;
}
@@ -103,10 +104,11 @@ bool TileBroadcastCommon::canBeExecutedInNSPCLayout(VectorDims srcBlockedDims, V
blockedRepeats.push_back(blockedRepeats[1]);
blockedRepeats.erase(blockedRepeats.begin() + 1);
- VectorDims optimizedDims, optimizedSrcStrides;
+ VectorDims optimizedDims;
+ VectorDims optimizedSrcStrides;
fillOptimizedDimsAndSrcStrides(srcBlockedDims, blockedRepeats, optimizedDims, optimizedSrcStrides);
- constexpr size_t maxNDims = 6lu;
+ constexpr size_t maxNDims = 6LU;
return optimizedDims.size() <= maxNDims;
}
@@ -216,15 +218,16 @@ bool TileBroadcastCommon::prepareOptimizedParams(const Node* node,
}
// for NSPC layouts
if (node->getBaseMemDescAtInputPort(0)->hasLayoutType(LayoutType::nspc) &&
- one_of(node->getBaseMemDescAtInputPort(0)->getShape().getRank(), 4u, 5u)) {
+ one_of(node->getBaseMemDescAtInputPort(0)->getShape().getRank(), 4U, 5U)) {
blockedRepeats.push_back(blockedRepeats[1]);
blockedRepeats.erase(blockedRepeats.begin() + 1);
}
- VectorDims optimizedDims, optimizedSrcStrides;
+ VectorDims optimizedDims;
+ VectorDims optimizedSrcStrides;
fillOptimizedDimsAndSrcStrides(srcBlockedDims, blockedRepeats, optimizedDims, optimizedSrcStrides);
- constexpr size_t maxNDims = 6lu;
+ constexpr size_t maxNDims = 6LU;
if (optimizedDims.size() > maxNDims) {
return false;
}
diff --git a/src/plugins/intel_cpu/src/nodes/composite.cpp b/src/plugins/intel_cpu/src/nodes/composite.cpp
index 606a76d5ecd..73efe8c8a5c 100644
--- a/src/plugins/intel_cpu/src/nodes/composite.cpp
+++ b/src/plugins/intel_cpu/src/nodes/composite.cpp
@@ -120,7 +120,7 @@ int Composite::registerToAllocationContext(int offset, AllocationContext& contex
return m_graph.RegisterToAllocationContext(offset, context);
}
-void Composite::execute(const dnnl::stream&) {
+void Composite::execute(const dnnl::stream& /*strm*/) {
m_graph.Infer();
}
diff --git a/src/plugins/intel_cpu/src/nodes/concat.cpp b/src/plugins/intel_cpu/src/nodes/concat.cpp
index 13863165dcf..9c6badebe9d 100644
--- a/src/plugins/intel_cpu/src/nodes/concat.cpp
+++ b/src/plugins/intel_cpu/src/nodes/concat.cpp
@@ -48,7 +48,7 @@ using namespace dnnl;
namespace ov::intel_cpu::node {
namespace {
-constexpr size_t channelAxis = 1lu;
+constexpr size_t channelAxis = 1LU;
}
bool Concat::neverExecute() const {
@@ -154,7 +154,7 @@ void Concat::initSupportedPrimitiveDescriptors() {
// check if blocked layouts are available the channels size should be evenly divided by the block size to avoid slow
// oneDNN ref implementation and allow inPlace memory usage if possible
if (dstShape.getRank() > channelAxis) {
- for (const auto& item : {std::make_pair(8lu, LayoutType::nCsp8c), std::make_pair(16lu, LayoutType::nCsp16c)}) {
+ for (const auto& item : {std::make_pair(8LU, LayoutType::nCsp8c), std::make_pair(16LU, LayoutType::nCsp16c)}) {
const VectorDims& blkDims = dstShape.getDims();
if (blkDims[channelAxis] == Shape::UNDEFINED_DIM || blkDims[channelAxis] % item.first != 0) {
continue;
@@ -311,7 +311,7 @@ void Concat::selectOptimalPrimitiveDescriptor() {
}
}
- for (const auto& item : {std::make_pair(8lu, LayoutType::nCsp8c), std::make_pair(16lu, LayoutType::nCsp16c)}) {
+ for (const auto& item : {std::make_pair(8LU, LayoutType::nCsp8c), std::make_pair(16LU, LayoutType::nCsp16c)}) {
if (convertTo == item.second) {
if (outDims[channelAxis] == Shape::UNDEFINED_DIM || outDims[1] % item.first != 0) {
convertTo = LayoutType::ncsp;
@@ -647,7 +647,8 @@ void Concat::execRef() {
int nthr = parallel_get_max_threads();
parallel_nt(nthr, [&](int ithr, int nthr) {
for (size_t a = 0; a < srcPtrs.size(); ++a) {
- size_t start = 0, end = 0;
+ size_t start = 0;
+ size_t end = 0;
splitter(nelemToCopy[a], nthr, ithr, start, end);
const uint8_t* i = srcPtrs[a] + start;
uint8_t* o = dstPtr + dstOffset[a] + start;
diff --git a/src/plugins/intel_cpu/src/nodes/concat.h b/src/plugins/intel_cpu/src/nodes/concat.h
index 287b26be563..19f4261c3cf 100644
--- a/src/plugins/intel_cpu/src/nodes/concat.h
+++ b/src/plugins/intel_cpu/src/nodes/concat.h
@@ -53,7 +53,7 @@ private:
bool canOptimizeNspc = false;
bool canOptimize1DCase = false;
void execRef();
- size_t inverseOrder(const VectorDims& order, size_t axis);
+ static size_t inverseOrder(const VectorDims& order, size_t axis);
void execNspcSpecCase();
void exec1DCase();
std::vector<VectorDims> inputStrides;
diff --git a/src/plugins/intel_cpu/src/nodes/conv.cpp b/src/plugins/intel_cpu/src/nodes/conv.cpp
index 08d43b15b83..b1fb130c3c7 100644
--- a/src/plugins/intel_cpu/src/nodes/conv.cpp
+++ b/src/plugins/intel_cpu/src/nodes/conv.cpp
@@ -111,7 +111,7 @@ public:
addEdge(parentNode, currentNode, 0, 0);
auto constantsItr = conv.fusedConstNodes.find(currentNode);
if (constantsItr != conv.fusedConstNodes.end()) {
- size_t inpPort = 1lu;
+ size_t inpPort = 1LU;
for (const auto& item : constantsItr->second) {
addEdge(item, currentNode, 0, inpPort++);
}
@@ -198,7 +198,7 @@ Convolution::Convolution(const std::shared_ptr<ov::Node>& op, const GraphContext
dw_conv_ih(0),
dw_conv_iw(0),
dw_conv_in_dt(memory::data_type::undef),
- groupNum(1lu),
+ groupNum(1LU),
IC(1),
groupIC(1),
groupOC(1) {
diff --git a/src/plugins/intel_cpu/src/nodes/ctc_greedy_decoder.cpp b/src/plugins/intel_cpu/src/nodes/ctc_greedy_decoder.cpp
index e5fc6daab7b..c3b12603c04 100644
--- a/src/plugins/intel_cpu/src/nodes/ctc_greedy_decoder.cpp
+++ b/src/plugins/intel_cpu/src/nodes/ctc_greedy_decoder.cpp
@@ -103,7 +103,7 @@ void CTCGreedyDecoder::execute([[maybe_unused]] const dnnl::stream& strm) {
parallel_for(B, [&](size_t b) {
size_t t = 0;
for (; t < T; t++) {
- if (sequenceMask[B * t + b] == 0.f) {
+ if (sequenceMask[B * t + b] == 0.F) {
break;
}
}
@@ -120,12 +120,14 @@ void CTCGreedyDecoder::execute([[maybe_unused]] const dnnl::stream& strm) {
// At the first stage find the maximum index. At second stage merge if needed.
// Such approach makes parallelization more efficient.
auto threadBody = [&](const int ithr, const int nthr) {
- size_t start(0lu), end(0lu);
+ size_t start(0LU);
+ size_t end(0LU);
splitter(workAmount, nthr, ithr, start, end);
if (start >= end) {
return;
}
- size_t tStart = 0lu, bStart = 0lu;
+ size_t tStart = 0LU;
+ size_t bStart = 0LU;
for (; bStart < B; bStart++) {
tStart += sequenceLengths[bStart];
if (tStart >= start) {
@@ -160,7 +162,7 @@ void CTCGreedyDecoder::execute([[maybe_unused]] const dnnl::stream& strm) {
return;
}
}
- tStart = 0lu;
+ tStart = 0LU;
}
}; // thread body
@@ -172,13 +174,13 @@ void CTCGreedyDecoder::execute([[maybe_unused]] const dnnl::stream& strm) {
const size_t sequenceLength = sequenceLengths[b];
float* shiftedOut = outputSequences + b * T;
for (size_t t = 0; t < sequenceLength; ++t) {
- if (*shiftedOut < blankIndex && !(mergeRepeated && *shiftedOut == prevClassIdx)) {
+ if (*shiftedOut < blankIndex && (!mergeRepeated || *shiftedOut != prevClassIdx)) {
outputSequences[outputIndex++] = *shiftedOut;
}
prevClassIdx = *shiftedOut;
shiftedOut++;
}
- std::fill(outputSequences + outputIndex, outputSequences + (b + 1) * T, -1.f);
+ std::fill(outputSequences + outputIndex, outputSequences + (b + 1) * T, -1.F);
});
}
diff --git a/src/plugins/intel_cpu/src/nodes/ctc_greedy_decoder_seq_len.cpp b/src/plugins/intel_cpu/src/nodes/ctc_greedy_decoder_seq_len.cpp
index 88262979bb8..8c23154dedb 100644
--- a/src/plugins/intel_cpu/src/nodes/ctc_greedy_decoder_seq_len.cpp
+++ b/src/plugins/intel_cpu/src/nodes/ctc_greedy_decoder_seq_len.cpp
@@ -127,12 +127,14 @@ void CTCGreedyDecoderSeqLen::execute([[maybe_unused]] const dnnl::stream& strm)
// At the first stage find the maximum index. At second stage merge if needed.
// Such approach makes parallelization more efficient.
auto threadBody = [&](const int ithr, const int nthr) {
- size_t start(0lu), end(0lu);
+ size_t start(0LU);
+ size_t end(0LU);
splitter(workAmount, nthr, ithr, start, end);
if (start >= end) {
return;
}
- size_t tStart = 0lu, bStart = 0lu;
+ size_t tStart = 0LU;
+ size_t bStart = 0LU;
for (; bStart < B; bStart++) {
tStart += sequenceLengths[bStart];
if (tStart >= start) {
@@ -165,7 +167,7 @@ void CTCGreedyDecoderSeqLen::execute([[maybe_unused]] const dnnl::stream& strm)
return;
}
}
- tStart = 0lu;
+ tStart = 0LU;
}
}; // thread body
@@ -178,7 +180,7 @@ void CTCGreedyDecoderSeqLen::execute([[maybe_unused]] const dnnl::stream& strm)
int* shiftedOut = decodedClasses + b * T;
for (size_t t = 0; t < actualSeqLen; ++t) {
- if (*shiftedOut != blankIndex && !(mergeRepeated && *shiftedOut == prevClassIdx)) {
+ if (*shiftedOut != blankIndex && (!mergeRepeated || *shiftedOut != prevClassIdx)) {
decodedClasses[outputIndex++] = *shiftedOut;
}
prevClassIdx = *shiftedOut;
diff --git a/src/plugins/intel_cpu/src/nodes/ctc_loss.cpp b/src/plugins/intel_cpu/src/nodes/ctc_loss.cpp
index c85182298be..aa65e0838ac 100644
--- a/src/plugins/intel_cpu/src/nodes/ctc_loss.cpp
+++ b/src/plugins/intel_cpu/src/nodes/ctc_loss.cpp
@@ -105,7 +105,8 @@ void CTCLoss::execute([[maybe_unused]] const dnnl::stream& strm) {
std::vector<std::string> errorMsgB(threads_num);
auto threadBody_1 = [&](const int ithr, const int nthr) {
- size_t start(0lu), end(0lu);
+ size_t start(0LU);
+ size_t end(0LU);
splitter(batchNum, nthr, ithr, start, end);
if (start >= end) {
return;
@@ -124,7 +125,7 @@ void CTCLoss::execute([[maybe_unused]] const dnnl::stream& strm) {
}
const size_t actualLogitLen = logitsLength[b];
const size_t actualTargetLen = labelsLength[b];
- size_t decodedTargetLen = 0lu;
+ size_t decodedTargetLen = 0LU;
// Decoding target: merge repeated characters if preprocess_collapse_repeated == True,
// find unique elemnts if unique == True.
@@ -134,7 +135,7 @@ void CTCLoss::execute([[maybe_unused]] const dnnl::stream& strm) {
auto& targetD = targetDB[b];
if (unique) {
std::unordered_set<int> uniqVals;
- for (size_t t = 0lu; t < actualTargetLen; t++) {
+ for (size_t t = 0LU; t < actualTargetLen; t++) {
if (uniqVals.find(target[t]) != uniqVals.end()) {
continue;
}
@@ -147,7 +148,7 @@ void CTCLoss::execute([[maybe_unused]] const dnnl::stream& strm) {
auto prevValue = target[0];
targetD[decodedTargetLen++] = blankIndex;
targetD[decodedTargetLen++] = target[0];
- for (size_t t = 1lu; t < actualTargetLen; t++) {
+ for (size_t t = 1LU; t < actualTargetLen; t++) {
if (target[t] == prevValue) {
continue;
}
@@ -156,7 +157,7 @@ void CTCLoss::execute([[maybe_unused]] const dnnl::stream& strm) {
}
targetD[decodedTargetLen++] = blankIndex;
} else {
- for (size_t t = 0lu; t < actualTargetLen; t++) {
+ for (size_t t = 0LU; t < actualTargetLen; t++) {
targetD[decodedTargetLen++] = blankIndex;
targetD[decodedTargetLen++] = target[t];
}
@@ -174,7 +175,7 @@ void CTCLoss::execute([[maybe_unused]] const dnnl::stream& strm) {
parallel_nt(threads_num, threadBody_1);
if (returnCode != 0) {
- std::string resErr("");
+ std::string resErr;
for (auto& err : errorMsgB) {
if (!err.empty()) {
resErr += err + "\n";
@@ -185,19 +186,22 @@ void CTCLoss::execute([[maybe_unused]] const dnnl::stream& strm) {
const size_t TC = maxTime * classesNum;
- size_t workAmount2 = 0lu;
+ size_t workAmount2 = 0LU;
for (size_t b = 0; b < batchNum; b++) {
workAmount2 += logitsLength[b];
}
auto threadBody_2 = [&](const int ithr, const int nthr) {
- size_t start(0lu), end(0lu);
- size_t sB(0lu), sT(0lu);
+ size_t start(0LU);
+ size_t end(0LU);
+ size_t sB(0LU);
+ size_t sT(0LU);
splitter(workAmount2, nthr, ithr, start, end);
if (start >= end) {
return;
}
- int64_t cw = 0, st = start;
+ int64_t cw = 0;
+ int64_t st = start;
for (; sB < batchNum; sB++) {
cw += logitsLength[sB];
if (cw >= st) {
@@ -218,10 +222,10 @@ void CTCLoss::execute([[maybe_unused]] const dnnl::stream& strm) {
// logProbabilities = logSoftmax = logits[b][t][c] - ln(sum_c(exp(logits[b][t])))
for (size_t t = sT; t < actualLogitLen; t++) {
expSum = 0.0;
- for (size_t c = 0lu; c < classesNum; c++) {
+ for (size_t c = 0LU; c < classesNum; c++) {
expSum += std::exp(logits[btcT + c]);
}
- for (size_t s = 0lu; s < decodedTargetLen; s++) {
+ for (size_t s = 0LU; s < decodedTargetLen; s++) {
logProbabilities[t][s] = logits[btcT + targetD[s]] - std::log(expSum);
}
btcT += classesNum;
@@ -229,7 +233,7 @@ void CTCLoss::execute([[maybe_unused]] const dnnl::stream& strm) {
return;
}
}
- sT = 0lu;
+ sT = 0LU;
} // for batch
}; // threadBody_2
@@ -251,7 +255,8 @@ void CTCLoss::execute([[maybe_unused]] const dnnl::stream& strm) {
};
auto threadBody_3 = [&](const int ithr, const int nthr) {
- size_t start(0lu), end(0lu);
+ size_t start(0LU);
+ size_t end(0LU);
splitter(batchNum, nthr, ithr, start, end);
if (start >= end) {
return;
@@ -266,7 +271,7 @@ void CTCLoss::execute([[maybe_unused]] const dnnl::stream& strm) {
const int decodedTargetLen = decodedTargetLenB[b];
std::vector<std::vector<float>> logBwd(decodedTargetLen, std::vector<float>(actualLogitLen, -float_inf));
for (int s = decodedTargetLen - 2; s < decodedTargetLen; s++) {
- logBwd[s][actualLogitLen - 1] = 0.f;
+ logBwd[s][actualLogitLen - 1] = 0.F;
}
for (int t = actualLogitLen - 2; t >= 0; t--) {
diff --git a/src/plugins/intel_cpu/src/nodes/cum_sum.cpp b/src/plugins/intel_cpu/src/nodes/cum_sum.cpp
index 0dbc10a2156..7d71a7bc60f 100644
--- a/src/plugins/intel_cpu/src/nodes/cum_sum.cpp
+++ b/src/plugins/intel_cpu/src/nodes/cum_sum.cpp
@@ -177,7 +177,8 @@ void CumSum::cumSum(const dataType* input, dataType* output, const VectorDims& s
size_t work_amount_dst =
std::accumulate(iterationRange.begin(), iterationRange.end(), static_cast<size_t>(1), std::multiplies<>());
parallel_nt(0, [&](const int ithr, const int nthr) {
- size_t start = 0, end = 0;
+ size_t start = 0;
+ size_t end = 0;
VectorDims counters(numOfDims - 1, 0);
splitter(work_amount_dst, nthr, ithr, start, end);
@@ -255,8 +256,7 @@ inline void CumSum::parallelItStep(std::vector<size_t>& counters, const std::vec
}
}
-inline size_t CumSum::getStartOffset(const std::vector<size_t>& forStartOffset,
- const std::vector<size_t>& strides) const {
+inline size_t CumSum::getStartOffset(const std::vector<size_t>& forStartOffset, const std::vector<size_t>& strides) {
size_t startOffset = 0;
for (size_t idx = 0; idx < forStartOffset.size(); ++idx) {
startOffset += forStartOffset[idx] * strides[idx];
diff --git a/src/plugins/intel_cpu/src/nodes/cum_sum.h b/src/plugins/intel_cpu/src/nodes/cum_sum.h
index 95d7513cac5..8d51d54325f 100644
--- a/src/plugins/intel_cpu/src/nodes/cum_sum.h
+++ b/src/plugins/intel_cpu/src/nodes/cum_sum.h
@@ -41,11 +41,11 @@ private:
template <bool reverse, bool exclusive, typename dataType>
void cumSum(const dataType* input, dataType* output, const std::vector<size_t>& strides);
- void parallelItInit(size_t start, std::vector<size_t>& counters, const std::vector<size_t>& iterationRange);
+ static void parallelItInit(size_t start, std::vector<size_t>& counters, const std::vector<size_t>& iterationRange);
- inline void parallelItStep(std::vector<size_t>& counters, const std::vector<size_t>& iterationRange);
+ static inline void parallelItStep(std::vector<size_t>& counters, const std::vector<size_t>& iterationRange);
- inline size_t getStartOffset(const std::vector<size_t>& forStartOffset, const std::vector<size_t>& strides) const;
+ static inline size_t getStartOffset(const std::vector<size_t>& forStartOffset, const std::vector<size_t>& strides);
size_t getAxis(const IMemory& _axis, const IMemory& _data) const;
diff --git a/src/plugins/intel_cpu/src/nodes/deconv.cpp b/src/plugins/intel_cpu/src/nodes/deconv.cpp
index c0312fe6370..03c3024380d 100644
--- a/src/plugins/intel_cpu/src/nodes/deconv.cpp
+++ b/src/plugins/intel_cpu/src/nodes/deconv.cpp
@@ -65,9 +65,6 @@
#include <string>
#include <vector>
-#include "openvino/op/convolution.hpp"
-#include "openvino/op/group_conv.hpp"
-
using namespace dnnl;
namespace ov::intel_cpu::node {
@@ -354,7 +351,7 @@ bool Deconvolution::canBeExecutedInInt8() const {
if (std::dynamic_pointer_cast<Input>(getParentEdgeAt(1)->getParent()) == nullptr) {
return false;
}
- if (!one_of(getInputShapeAtPort(0).getRank(), 3ul, 4ul, 5ul)) {
+ if (!one_of(getInputShapeAtPort(0).getRank(), 3UL, 4UL, 5UL)) {
return false;
}
@@ -591,7 +588,8 @@ void Deconvolution::getSupportedDescriptors() {
if (getChildEdges().empty()) {
THROW_CPU_NODE_ERR("has incorrect number of output edges");
}
- VectorDims inDims, outDims;
+ VectorDims inDims;
+ VectorDims outDims;
std::tie(inDims, outDims) = makeDummyInOutShape();
inShape = Shape(inDims);
outShape = Shape(outDims);
@@ -1290,7 +1288,8 @@ void Deconvolution::initSupportedPrimitiveDescriptors() {
return;
}
- VectorDims inDims, outDims;
+ VectorDims inDims;
+ VectorDims outDims;
std::tie(inDims, outDims) = makeDummyInOutShape();
auto tmpInShape = Shape(inDims);
auto tmpOutShape = Shape(outDims);
diff --git a/src/plugins/intel_cpu/src/nodes/def_conv.cpp b/src/plugins/intel_cpu/src/nodes/def_conv.cpp
index 83884cc26ed..e2c88690335 100644
--- a/src/plugins/intel_cpu/src/nodes/def_conv.cpp
+++ b/src/plugins/intel_cpu/src/nodes/def_conv.cpp
@@ -137,29 +137,29 @@ private:
Xbyak::Opmask ktail_mask = Xbyak::Opmask(2);
- inline Xbyak::Address table_val(int index) {
+ Xbyak::Address table_val(int index) {
return ptr[reg_table + index * vlen];
}
- inline Vmm get_vmm_ker(int idx) {
+ Vmm get_vmm_ker(int idx) {
return Vmm(idx + 0);
}
- inline Vmm get_vmm_src(int idx) {
+ Vmm get_vmm_src(int idx) {
return Vmm(idx + 1);
}
- inline Vmm get_vmm_acc(int idx) {
+ Vmm get_vmm_acc(int idx) {
return Vmm(idx + jcp_.ur_w + 1);
}
- inline Ymm get_ymm_acc(int idx) {
+ Ymm get_ymm_acc(int idx) {
return Ymm(idx + jcp_.ur_w + 1);
}
- inline Xmm get_xmm_acc(int idx) {
+ Xmm get_xmm_acc(int idx) {
return Xmm(idx + jcp_.ur_w + 1);
}
Xbyak::Label l_table;
- inline void checkZeroWei(const Xbyak::Xmm& x1, Label& nullifyLabel) {
+ void checkZeroWei(const Xbyak::Xmm& x1, Label& nullifyLabel) {
ptest(x1, x1);
jz(nullifyLabel);
}
@@ -995,14 +995,14 @@ void DeformableConvolution::DefConvExecutor::prepareSamplingWeights(const float*
float map_w = w_in + kw * (KDW + 1) + offset_w;
bool skip_compute;
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);
+ 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;
} else {
- skip_compute = !(map_w >= 0 && map_w < IW && map_h >= 0 && map_h < IH);
+ skip_compute = map_w < 0 || map_w >= IW || map_h < 0 || map_h >= IH;
}
if (!skip_compute) {
// modulations precomp.
- float modulation_scalar = 1.0f;
+ float modulation_scalar = 1.0F;
if (modulation_offset_ptr != nullptr) {
size_t modulation_index =
@@ -1021,7 +1021,8 @@ void DeformableConvolution::DefConvExecutor::prepareSamplingWeights(const float*
float lh = map_h - h_low;
float lw = map_w - w_low;
- float hh = 1 - lh, hw = 1 - lw;
+ float hh = 1 - lh;
+ float hw = 1 - lw;
int h_ind_low = std::max(h_low, 0);
int h_ind_high = std::min(h_high, cur_h_end - 1);
@@ -1042,8 +1043,10 @@ void DeformableConvolution::DefConvExecutor::prepareSamplingWeights(const float*
pSampledCoordsVector[sampledCoordIndex + 2] = h_off_low + w_off_high;
pSampledCoordsVector[sampledCoordIndex + 3] = h_off_low + w_off_low;
- float w22 = hh * hw * modulation_scalar, w21 = hh * lw * modulation_scalar,
- w12 = lh * hw * modulation_scalar, w11 = lh * lw * modulation_scalar;
+ float w22 = hh * hw * modulation_scalar;
+ float w21 = hh * lw * modulation_scalar;
+ float w12 = lh * hw * modulation_scalar;
+ float w11 = lh * lw * modulation_scalar;
pInterpWeightsVector[sampledCoordIndex] = w11;
pInterpWeightsVector[sampledCoordIndex + 1] = w12;
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 46908c77279..d5abe0694c9 100644
--- a/src/plugins/intel_cpu/src/nodes/depth_to_space.cpp
+++ b/src/plugins/intel_cpu/src/nodes/depth_to_space.cpp
@@ -170,10 +170,10 @@ void DepthToSpace::initSupportedPrimitiveDescriptors() {
};
supportedTypes.push_back(LayoutType::nspc);
- if (canUseBlocked(8lu)) {
+ if (canUseBlocked(8LU)) {
supportedTypes.push_back(LayoutType::nCsp8c);
}
- if (canUseBlocked(16lu)) {
+ if (canUseBlocked(16LU)) {
supportedTypes.push_back(LayoutType::nCsp16c);
}
}
@@ -275,7 +275,8 @@ DepthToSpace::DepthToSpaceExecutor::DepthToSpaceExecutor(const DepthToSpaceAttrs
};
if (isBlocked) {
- size_t orderShiftForBlocks, orderShiftForDims;
+ size_t orderShiftForBlocks;
+ size_t orderShiftForDims;
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 04a69a93eb2..2c0d204bbff 100644
--- a/src/plugins/intel_cpu/src/nodes/detection_output.cpp
+++ b/src/plugins/intel_cpu/src/nodes/detection_output.cpp
@@ -178,7 +178,7 @@ void DetectionOutput::initSupportedPrimitiveDescriptors() {
struct ConfidenceComparatorDO {
explicit ConfidenceComparatorDO(const float* confDataIn) : confData(confDataIn) {}
- bool operator()(int idx1, int idx2) {
+ bool operator()(int idx1, int idx2) const {
if (confData[idx1] > confData[idx2]) {
return true;
}
@@ -478,7 +478,7 @@ inline void DetectionOutput::confFilterCF(const float* pconf,
// NMS is per class, keep topk is per image, final output is per class
inline void DetectionOutput::confFilterMX(const float* confData,
const float* ARMConfData,
- float* reorderedConfData,
+ const float* reorderedConfData,
int* indicesData,
int* indicesBufData,
int* detectionsData,
@@ -496,7 +496,7 @@ inline void DetectionOutput::confFilterMX(const float* confData,
float conf = confData[p * classesNum + c];
if (isARMPrior) {
conf =
- (c == backgroundClassId) ? 1.0f : 0.0f; // still need refresh conf due to read from origin conf
+ (c == backgroundClassId) ? 1.0F : 0.0F; // still need refresh conf due to read from origin conf
}
if (conf >= confidenceThreshold && conf > maxConf) {
maxConf = conf;
@@ -542,13 +542,13 @@ inline void DetectionOutput::confFilterMX(const float* confData,
detectionsData[0] = k;
}
-inline void DetectionOutput::getActualPriorNum(const float* priorData, int* numPriorsActual, int n) {
+inline void DetectionOutput::getActualPriorNum(const float* priorData, int* numPriorsActual, int n) const {
numPriorsActual[n] = priorsNum;
if (!normalized) {
int num = 0;
for (; num < priorsNum; ++num) {
float imgId = priorData[num * priorSize];
- if (imgId == -1.f) {
+ if (imgId == -1.F) {
numPriorsActual[n] = num;
break;
}
@@ -558,13 +558,13 @@ inline void DetectionOutput::getActualPriorNum(const float* priorData, int* numP
inline void DetectionOutput::confReorderDense(const float* confData,
const float* ARMConfData,
- float* reorderedConfData) {
+ float* reorderedConfData) const {
if (withAddBoxPred) {
parallel_for2d(imgNum, priorsNum, [&](size_t n, size_t p) {
if (ARMConfData[n * priorsNum * 2 + p * 2 + 1] < objScore) {
for (int c = 0; c < classesNum; ++c) {
reorderedConfData[n * priorsNum * classesNum + c * priorsNum + p] =
- c == backgroundClassId ? 1.0f : 0.0f;
+ c == backgroundClassId ? 1.0F : 0.0F;
}
} else {
for (int c = 0; c < classesNum; ++c) {
@@ -615,7 +615,7 @@ inline void DetectionOutput::confReorderAndFilterSparsityCF(const float* confDat
for (int c = 0; c < classesNum; ++c) {
float conf = confData[confIdxPrior + c];
if (isARMPrior) {
- conf = (c == backgroundClassId) ? 1.0f : 0.0f;
+ conf = (c == backgroundClassId) ? 1.0F : 0.0F;
}
if (conf > confidenceThreshold) {
const int idx = offH + c * confInfoLen;
@@ -701,7 +701,7 @@ inline void DetectionOutput::confReorderAndFilterSparsityMX(const float* confDat
for (int c = 0; c < classesNum; ++c) {
float conf = confData[confIdxPrior + c];
if (withAddBoxPred && isARMPrior) {
- conf = (c == backgroundClassId) ? 1.0f : 0.0f;
+ conf = (c == backgroundClassId) ? 1.0F : 0.0F;
}
if (conf >= confidenceThreshold) {
int idx = off + c * confInfoLen;
@@ -749,13 +749,13 @@ inline void DetectionOutput::decodeBBoxes(const float* priorData,
const float* varianceData,
float* decodedBboxes,
float* decodedBboxSizes,
- int* numPriorsActual,
+ const int* numPriorsActual,
int n,
const int& offs,
const int& priorSize,
bool decodeType,
const int* confInfoH,
- const int* confInfoV) {
+ const int* confInfoV) const {
int prNum = numPriorsActual[n];
if (!decodeType) {
prNum = priorsNum;
@@ -767,10 +767,10 @@ inline void DetectionOutput::decodeBBoxes(const float* priorData,
if (isSparsityWorthwhile && isShareLoc && confInfoV[p] == -1) {
return;
}
- float newXMin = 0.0f;
- float newYMin = 0.0f;
- float newXMax = 0.0f;
- float newYMax = 0.0f;
+ float newXMin = 0.0F;
+ float newYMin = 0.0F;
+ float newXMax = 0.0F;
+ float newYMax = 0.0F;
float priorXMin = priorData[p * priorSize + 0 + offs];
float priorYMin = priorData[p * priorSize + 1 + offs];
@@ -805,11 +805,13 @@ inline void DetectionOutput::decodeBBoxes(const float* priorData,
} else if (codeType == CodeType::CENTER_SIZE) {
float priorWidth = priorXMax - priorXMin;
float priorHeight = priorYMax - priorYMin;
- float priorCenterX = (priorXMin + priorXMax) / 2.0f;
- float priorCenterY = (priorYMin + priorYMax) / 2.0f;
+ float priorCenterX = (priorXMin + priorXMax) / 2.0F;
+ float priorCenterY = (priorYMin + priorYMax) / 2.0F;
- float decodeBboxCenterX, decodeBboxCenterY;
- float decodeBboxWidth, decodeBboxHeight;
+ float decodeBboxCenterX;
+ float decodeBboxCenterY;
+ float decodeBboxWidth;
+ float decodeBboxHeight;
if (varianceEncodedInTarget) {
// variance is encoded in target, we simply need to restore the offset predictions.
@@ -825,17 +827,17 @@ inline void DetectionOutput::decodeBBoxes(const float* priorData,
decodeBboxHeight = std::exp(varianceData[p * 4 + 3] * locYMax) * priorHeight;
}
- newXMin = decodeBboxCenterX - decodeBboxWidth / 2.0f;
- newYMin = decodeBboxCenterY - decodeBboxHeight / 2.0f;
- newXMax = decodeBboxCenterX + decodeBboxWidth / 2.0f;
- newYMax = decodeBboxCenterY + decodeBboxHeight / 2.0f;
+ newXMin = decodeBboxCenterX - decodeBboxWidth / 2.0F;
+ newYMin = decodeBboxCenterY - decodeBboxHeight / 2.0F;
+ newXMax = decodeBboxCenterX + decodeBboxWidth / 2.0F;
+ newYMax = decodeBboxCenterY + decodeBboxHeight / 2.0F;
}
if (clipBeforeNMS) {
- newXMin = (std::max)(0.0f, (std::min)(1.0f, newXMin));
- newYMin = (std::max)(0.0f, (std::min)(1.0f, newYMin));
- newXMax = (std::max)(0.0f, (std::min)(1.0f, newXMax));
- newYMax = (std::max)(0.0f, (std::min)(1.0f, newYMax));
+ newXMin = (std::max)(0.0F, (std::min)(1.0F, newXMin));
+ newYMin = (std::max)(0.0F, (std::min)(1.0F, newYMin));
+ newXMax = (std::max)(0.0F, (std::min)(1.0F, newXMax));
+ newYMax = (std::max)(0.0F, (std::min)(1.0F, newYMax));
}
decodedBboxes[p * 4 + 0] = newXMin;
@@ -863,7 +865,7 @@ static inline float JaccardOverlap(const float* decodedBbox, const float* bboxSi
const float ymax2 = decodedBbox[idx2 * 4 + 3];
if (xmin2 > xmax1 || xmax2 < xmin1 || ymin2 > ymax1 || ymax2 < ymin1) {
- return 0.0f;
+ return 0.0F;
}
float intersectXMin = (std::max)(xmin1, xmin2);
@@ -875,7 +877,7 @@ static inline float JaccardOverlap(const float* decodedBbox, const float* bboxSi
float intersectHeight = intersectYMax - intersectYMin;
if (intersectWidth <= 0 || intersectHeight <= 0) {
- return 0.0f;
+ return 0.0F;
}
float intersectSize = intersectWidth * intersectHeight;
@@ -885,11 +887,11 @@ static inline float JaccardOverlap(const float* decodedBbox, const float* bboxSi
return intersectSize / (bbox1Size + bbox2Size - intersectSize);
}
-inline void DetectionOutput::NMSCF(int* indicesIn,
+inline void DetectionOutput::NMSCF(const int* indicesIn,
int& detections,
int* indicesOut,
const float* bboxes,
- const float* boxSizes) {
+ const float* boxSizes) const {
// nms for this class
int countIn = detections;
detections = 0;
@@ -912,11 +914,11 @@ inline void DetectionOutput::NMSCF(int* indicesIn,
}
}
-inline void DetectionOutput::NMSMX(int* indicesIn,
+inline void DetectionOutput::NMSMX(const int* indicesIn,
int* detections,
int* indicesOut,
const float* bboxes,
- const float* sizes) {
+ const float* sizes) const {
// Input is candidate for image, output is candidate for each class within image
int countIn = detections[0];
detections[0] = 0;
@@ -933,7 +935,7 @@ inline void DetectionOutput::NMSMX(int* indicesIn,
bool keep = true;
for (int k = 0; k < ndetection; ++k) {
const int keptPrior = pindices[k];
- float overlap = 0.0f;
+ float overlap = 0.0F;
if (isShareLoc) {
overlap = JaccardOverlap(bboxes, sizes, prior, keptPrior);
} else {
@@ -951,10 +953,10 @@ inline void DetectionOutput::NMSMX(int* indicesIn,
}
}
-inline void DetectionOutput::generateOutput(float* reorderedConfData,
- int* indicesData,
- int* detectionsData,
- float* decodedBboxesData,
+inline void DetectionOutput::generateOutput(const float* reorderedConfData,
+ const int* indicesData,
+ const int* detectionsData,
+ const float* decodedBboxesData,
float* dstData) {
const auto& outDims = getChildEdgeAt(0)->getMemory().getStaticDims();
const int numResults = outDims[2];
@@ -998,10 +1000,10 @@ inline void DetectionOutput::generateOutput(float* reorderedConfData,
float ymax = isShareLoc ? pboxes[prIdx * 4 + 3] : pboxes[c * 4 * priorsNum + prIdx * 4 + 3];
if (clipAfterNMS) {
- xmin = (std::max)(0.0f, (std::min)(1.0f, xmin));
- ymin = (std::max)(0.0f, (std::min)(1.0f, ymin));
- xmax = (std::max)(0.0f, (std::min)(1.0f, xmax));
- ymax = (std::max)(0.0f, (std::min)(1.0f, ymax));
+ xmin = (std::max)(0.0F, (std::min)(1.0F, xmin));
+ ymin = (std::max)(0.0F, (std::min)(1.0F, ymin));
+ xmax = (std::max)(0.0F, (std::min)(1.0F, xmax));
+ ymax = (std::max)(0.0F, (std::min)(1.0F, ymax));
}
dstData[count * DETECTION_SIZE + 3] = xmin;
diff --git a/src/plugins/intel_cpu/src/nodes/detection_output.h b/src/plugins/intel_cpu/src/nodes/detection_output.h
index 24be1700985..cd0dc3405e6 100644
--- a/src/plugins/intel_cpu/src/nodes/detection_output.h
+++ b/src/plugins/intel_cpu/src/nodes/detection_output.h
@@ -75,15 +75,15 @@ private:
int confInfoLen = 0;
bool isSparsityWorthwhile = false;
- inline void getActualPriorNum(const float* priorData, int* numPriorsActual, int n);
+ inline void getActualPriorNum(const float* priorData, int* numPriorsActual, int n) const;
- inline void confReorderDense(const float* confData, const float* ARMConfData, float* reorderedConfData);
+ inline void confReorderDense(const float* confData, const float* ARMConfData, float* reorderedConfData) const;
inline void confFilterCF(const float* pConf, int* pindices, int* pbuffer, int* detectionsData, const int& n);
inline void confFilterMX(const float* confData,
const float* ARMConfData,
- float* reorderedConfData,
+ const float* reorderedConfData,
int* indicesData,
int* indicesBufData,
int* detectionsData,
@@ -108,24 +108,32 @@ private:
const float* variance_data,
float* decoded_bboxes,
float* decoded_bbox_sizes,
- int* num_priors_actual,
+ const int* num_priors_actual,
int n,
const int& offs,
const int& pr_size,
bool decodeType = true,
const int* conf_info_h = nullptr,
- const int* conf_info_v = nullptr); // decodeType is false after ARM
-
- inline void NMSCF(int* indicesIn, int& detections, int* indicesOut, const float* bboxes, const float* boxSizes);
-
- inline void NMSMX(int* indicesIn, int* detections, int* indicesOut, const float* bboxes, const float* sizes);
-
- inline void topk(const int* indicesIn, int* indicesOut, const float* conf, int n, int k);
-
- inline void generateOutput(float* reorderedConfData,
- int* indicesData,
- int* detectionsData,
- float* decodedBboxesData,
+ const int* conf_info_v = nullptr) const; // decodeType is false after ARM
+
+ inline void NMSCF(const int* indicesIn,
+ int& detections,
+ int* indicesOut,
+ const float* bboxes,
+ const float* boxSizes) const;
+
+ inline void NMSMX(const int* indicesIn,
+ int* detections,
+ int* indicesOut,
+ const float* bboxes,
+ const float* sizes) const;
+
+ static inline void topk(const int* indicesIn, int* indicesOut, const float* conf, int n, int k);
+
+ inline void generateOutput(const float* reorderedConfData,
+ const int* indicesData,
+ const int* detectionsData,
+ const float* decodedBboxesData,
float* dstData);
std::vector<float> decodedBboxes;
diff --git a/src/plugins/intel_cpu/src/nodes/dft.cpp b/src/plugins/intel_cpu/src/nodes/dft.cpp
index 6232f272fa3..d998fdea1ec 100644
--- a/src/plugins/intel_cpu/src/nodes/dft.cpp
+++ b/src/plugins/intel_cpu/src/nodes/dft.cpp
@@ -206,7 +206,7 @@ void copyDataToOutputWithSignalSize(const float* input,
std::accumulate(inputShape.begin(), inputShape.end(), static_cast<size_t>(1), std::multiplies<>());
auto totalOutput =
std::accumulate(outputShape.begin(), outputShape.end(), static_cast<size_t>(1), std::multiplies<>());
- std::fill_n(output, totalOutput, 0.f);
+ std::fill_n(output, totalOutput, 0.F);
size_t lastChangedDim = 0;
for (size_t index = inputShape.size() - 1; index > 0; --index) {
if (inputShape[index] != outputShape[index]) {
@@ -448,7 +448,7 @@ void DFT::fft(float* inBuffer,
void DFT::naiveDFT(float* data, size_t dataLength, bool inverse) const {
std::vector<float> outputBuffer(dataLength);
const size_t nComplex = dataLength / 2;
- const float reciprocalNComplex = 1.0f / nComplex;
+ const float reciprocalNComplex = 1.0F / nComplex;
auto twiddlesIter = twiddlesMapDFT.find(nComplex);
if (twiddlesIter == twiddlesMapDFT.end()) {
THROW_CPU_NODE_ERR("Twiddles for nComplex=", nComplex, " not found");
@@ -475,8 +475,8 @@ void DFT::naiveDFT(float* data, size_t dataLength, bool inverse) const {
};
} else {
blockIteration = [&](size_t k) {
- float sumReal = 0.0f;
- float sumImag = 0.0f;
+ float sumReal = 0.0F;
+ float sumImag = 0.0F;
for (size_t n = 0; n < nComplex; ++n) {
const auto* complexRef = &twiddles[2 * (k * nComplex + n)];
float complexReal = *complexRef;
@@ -503,12 +503,12 @@ void DFT::naiveDFT(float* data, size_t dataLength, bool inverse) const {
cpu_memcpy(data, outputBuffer.data(), dataLength * sizeof(float));
}
-std::vector<float> DFT::generateTwiddlesDFT(size_t n_complex, bool inverse) const {
+std::vector<float> DFT::generateTwiddlesDFT(size_t n_complex, bool inverse) {
std::vector<float> twiddles(n_complex * n_complex * 2);
const float inverseMultiplier = inverse ? 1 : -1;
parallel_for(n_complex, [&](const size_t k) {
for (size_t n = 0; n < n_complex; ++n) {
- float phase = 2.0f * PI * static_cast<float>(n * k) / static_cast<float>(n_complex);
+ float phase = 2.0F * PI * static_cast<float>(n * k) / static_cast<float>(n_complex);
auto complexReal = std::cos(phase);
auto complexImag = std::sin(phase) * inverseMultiplier;
twiddles[2 * (k * n_complex + n)] = complexReal;
@@ -524,8 +524,8 @@ void DFT::updateTwiddlesFFT(size_t n_complex, bool inverse) {
twiddlesFFT.reserve((n_complex - 1) * 2);
if (twiddlesFFT.empty()) {
- twiddlesFFT.emplace_back(1.0f); // cos(0)
- twiddlesFFT.emplace_back(-0.0f); // -sin(0)
+ twiddlesFFT.emplace_back(1.0F); // cos(0)
+ twiddlesFFT.emplace_back(-0.0F); // -sin(0)
} else {
for (size_t i = numBlocks; i < twiddlesFFT.size() / 2; i += numBlocks) {
numBlocks *= 2;
diff --git a/src/plugins/intel_cpu/src/nodes/dft.h b/src/plugins/intel_cpu/src/nodes/dft.h
index b86b5ed4cd2..9b2d1c0f96a 100644
--- a/src/plugins/intel_cpu/src/nodes/dft.h
+++ b/src/plugins/intel_cpu/src/nodes/dft.h
@@ -56,7 +56,7 @@ private:
const float** resultBuf) const;
void naiveDFT(float* data, size_t dataLength, bool inverse) const;
- std::vector<float> generateTwiddlesDFT(size_t n_complex, bool inverse) const;
+ static std::vector<float> generateTwiddlesDFT(size_t n_complex, bool inverse);
void updateTwiddlesFFT(size_t n_complex, bool inverse);
std::unique_ptr<jit_uni_dft_kernel> dftKernel = nullptr;
diff --git a/src/plugins/intel_cpu/src/nodes/eltwise.cpp b/src/plugins/intel_cpu/src/nodes/eltwise.cpp
index d3a570493ca..e21e2f77ef7 100644
--- a/src/plugins/intel_cpu/src/nodes/eltwise.cpp
+++ b/src/plugins/intel_cpu/src/nodes/eltwise.cpp
@@ -266,7 +266,7 @@ const std::map<const ov::DiscreteTypeInfo, Eltwise::Initializer>& Eltwise::getIn
node.algorithm = Algorithm::EltwiseRelu;
node.onednnAlgorithm = dnnl::algorithm::eltwise_relu;
node.alpha = leakyRelu->get_slope();
- node.beta = 0.0f;
+ node.beta = 0.0F;
}},
{ov::op::v0::Gelu::get_type_info_static(), []([[maybe_unused]] const std::shared_ptr<ov::Node>& op, Eltwise& node) {
node.algorithm = Algorithm::EltwiseGeluErf;
@@ -335,8 +335,8 @@ const std::map<const ov::DiscreteTypeInfo, Eltwise::Initializer>& Eltwise::getIn
{ov::op::v4::HSwish::get_type_info_static(), []([[maybe_unused]] const std::shared_ptr<ov::Node>& op, Eltwise& node) {
// since v3.0 version, oneDNN has flexible implementation of hardswish, ov still uses the one with
// hardcoded alpha and beta
- node.alpha = 1.f / 6.f;
- node.beta = 0.5f;
+ node.alpha = 1.F / 6.F;
+ node.beta = 0.5F;
node.algorithm = Algorithm::EltwiseHswish;
node.onednnAlgorithm = dnnl::algorithm::eltwise_hardswish;
}},
@@ -371,7 +371,7 @@ const std::map<const ov::DiscreteTypeInfo, Eltwise::Initializer>& Eltwise::getIn
}},
{ov::op::v4::SoftPlus::get_type_info_static(), []([[maybe_unused]] const std::shared_ptr<ov::Node>& op, Eltwise& node) {
node.algorithm = Algorithm::EltwiseSoftRelu;
- node.alpha = 1.f;
+ node.alpha = 1.F;
node.onednnAlgorithm = dnnl::algorithm::eltwise_soft_relu;
}},
{ov::op::v9::SoftSign::get_type_info_static(), []([[maybe_unused]] const std::shared_ptr<ov::Node>& op, Eltwise& node) {
@@ -465,7 +465,8 @@ struct EltwiseKey {
if (result) {
if (implType == EltwiseImplType::optimizedShapeAgnostic) {
- bool broadcast, rhsBroadcast;
+ bool broadcast;
+ bool rhsBroadcast;
for (size_t i = 0; i < inpDims.size(); ++i) {
broadcast = (inpDims[i].back() == 1);
rhsBroadcast = (rhs.inpDims[i].back() == 1);
@@ -783,7 +784,8 @@ public:
}
}
parallel_nt(m_threads_num, [&](const int ithr, const int nthr) {
- size_t start = 0, end = 0;
+ size_t start = 0;
+ size_t end = 0;
splitter(_schedulerWorkAmount, nthr, ithr, start, end);
std::vector<size_t> counters(dims_out.size() - 1, 0);
@@ -942,7 +944,7 @@ private:
std::unique_ptr<jit_uni_eltwise_kernel> _pKernel;
size_t _schedulerWorkAmount = 0;
size_t _batchDimIdx = 0;
- size_t m_threads_num = 0lu;
+ size_t m_threads_num = 0LU;
public:
static const int optimalTensorRank = 6;
@@ -1113,11 +1115,12 @@ public:
std::make_shared<ref_eltwise_scalar_fwd_t>(static_cast<dnnl_alg_kind_t>(this->_opData.onednnAlgorithm),
this->_opData.alpha,
this->_opData.beta,
- 1.f);
+ 1.F);
}
parallel_nt(0, [&](const int ithr, const int nthr) {
- size_t start = 0, end = 0;
+ size_t start = 0;
+ size_t end = 0;
splitter(this->_fullWorkAmount, nthr, ithr, start, end);
std::vector<size_t> counters(dims_out.size(), 0);
@@ -1186,7 +1189,7 @@ public:
*dst_ptr_f = expf(src_f[0]);
break;
case Algorithm::EltwiseSquaredDifference:
- *dst_ptr_f = powf((src_f[0] - src_f[1]), 2.f);
+ *dst_ptr_f = powf((src_f[0] - src_f[1]), 2.F);
break;
case Algorithm::EltwisePowerDynamic:
*dst_ptr_f = powf(src_f[0], src_f[1]);
@@ -1267,11 +1270,12 @@ public:
std::make_shared<ref_eltwise_scalar_fwd_t>(static_cast<dnnl_alg_kind_t>(this->_opData.onednnAlgorithm),
this->_opData.alpha,
this->_opData.beta,
- 1.f);
+ 1.F);
}
parallel_nt(0, [&](const int ithr, const int nthr) {
- size_t start = 0, end = 0;
+ size_t start = 0;
+ size_t end = 0;
splitter(this->_fullWorkAmount, nthr, ithr, start, end);
std::vector<size_t> counters(dims_out.size(), 0);
@@ -1836,10 +1840,10 @@ void Eltwise::initSupportedPrimitiveDescriptors() {
return {config, impl_type};
};
- bool isChannelsFirstApplicable = one_of(getOutputShapeAtPort(0).getRank(), 1u, 2u, 3u, 4u, 5u);
+ bool isChannelsFirstApplicable = one_of(getOutputShapeAtPort(0).getRank(), 1U, 2U, 3U, 4U, 5U);
for (size_t i = 0; i < getParentEdges().size(); i++) {
isChannelsFirstApplicable =
- isChannelsFirstApplicable && one_of(getInputShapeAtPort(i).getRank(), 1u, 2u, 3u, 4u, 5u);
+ isChannelsFirstApplicable && one_of(getInputShapeAtPort(i).getRank(), 1U, 2U, 3U, 4U, 5U);
isChannelsFirstApplicable = isChannelsFirstApplicable &&
implication(getInputShapeAtPort(i).getRank() != 1,
getOutputShapeAtPort(0).getRank() == getInputShapeAtPort(i).getRank());
@@ -1848,12 +1852,12 @@ void Eltwise::initSupportedPrimitiveDescriptors() {
#if defined(OPENVINO_ARCH_ARM64)
bool isBlockedApplicable = (!useJitExecutor) && one_of(getOutputShapeAtPort(0).getRank(), 1u, 3u, 4u, 5u);
#else
- bool isBlockedApplicable = one_of(getOutputShapeAtPort(0).getRank(), 1u, 3u, 4u, 5u);
+ bool isBlockedApplicable = one_of(getOutputShapeAtPort(0).getRank(), 1U, 3U, 4U, 5U);
#endif
for (size_t i = 0; i < getParentEdges().size(); i++) {
const auto& inShape = getInputShapeAtPort(i);
- isBlockedApplicable = isBlockedApplicable && one_of(inShape.getRank(), 1u, 3u, 4u, 5u);
+ isBlockedApplicable = isBlockedApplicable && one_of(inShape.getRank(), 1U, 3U, 4U, 5U);
isBlockedApplicable =
isBlockedApplicable &&
implication(inShape.getRank() != 1, getOutputShapeAtPort(0).getRank() == inShape.getRank());
@@ -2255,9 +2259,9 @@ void Eltwise::appendPostOpsImpl(dnnl::post_ops& ops,
if (getAlgorithm() == Algorithm::EltwisePowerStatic) {
// d = s*beta + gamma
ops.append_eltwise(dnnl::algorithm::eltwise_linear, getBeta(), getGamma());
- if (getAlpha() != 1.0f) {
+ if (getAlpha() != 1.0F) {
// d = 1 * s^alpha
- ops.append_eltwise(dnnl::algorithm::eltwise_pow, 1.0f, getAlpha());
+ ops.append_eltwise(dnnl::algorithm::eltwise_pow, 1.0F, getAlpha());
}
return;
}
@@ -2390,11 +2394,11 @@ bool Eltwise::appendAttrPostOps(DnnlPostOpsComposerLegacy& dnnlpoc,
case Algorithm::EltwiseMulAdd:
return dnnlpoc.appendLinear(scales, shifts, isLastPostOp, allowBinary);
case Algorithm::EltwisePowerStatic:
- if (beta != 1.0f && gamma != 0.0f) {
+ if (beta != 1.0F && gamma != 0.0F) {
return dnnlpoc.appendLinear(scales, shifts, isLastPostOp, allowBinary);
- } else if (beta != 1.0f) { // Multiply if has scales
+ } else if (beta != 1.0F) { // Multiply if has scales
return dnnlpoc.appendScale(scales, isLastPostOp, allowBinary);
- } else if (gamma != 0.0f) { // Add only if has shifts
+ } else if (gamma != 0.0F) { // Add only if has shifts
return dnnlpoc.appendShift(shifts, allowBinary);
}
break;
@@ -2440,7 +2444,7 @@ bool Eltwise::canFuseParent(const NodePtr& parentNode) const {
return true;
}
-bool Eltwise::canFuseConvert(const NodePtr& convertNode) const {
+bool Eltwise::canFuseConvert(const NodePtr& convertNode) {
if (!one_of(convertNode->getOriginalOutputPrecisionAtPort(0),
ov::element::i8,
ov::element::u8,
diff --git a/src/plugins/intel_cpu/src/nodes/eltwise.h b/src/plugins/intel_cpu/src/nodes/eltwise.h
index 8a913f6e398..816f1173ec9 100644
--- a/src/plugins/intel_cpu/src/nodes/eltwise.h
+++ b/src/plugins/intel_cpu/src/nodes/eltwise.h
@@ -53,7 +53,7 @@ public:
void execute(const dnnl::stream& strm) override;
bool created() const override;
bool canBeInPlace() const override;
- bool canFuseConvert(const NodePtr& convertNode) const;
+ bool canFuseConvert(const NodePtr& convertNode);
bool canFuseParent(const NodePtr& parentNode) const;
bool canFuse(const NodePtr& node) const override;
void appendPostOps(dnnl::post_ops& ops,
@@ -170,7 +170,7 @@ private:
const int channelAxis = 1);
void appendMemory(const std::vector<float>& data, MemoryPtr& memPtr, std::vector<MemoryPtr>& postOpsMem);
- void appendMemory(const std::vector<float>& data, MemoryPtr& memPtr, std::vector<const void*>& postOpsMem);
+ static void appendMemory(const std::vector<float>& data, MemoryPtr& memPtr, std::vector<const void*>& postOpsMem);
bool canUseEltwiseExecPtr = false;
EltwiseAttrs eltwiseAttrs;
diff --git a/src/plugins/intel_cpu/src/nodes/embedding_bag.cpp b/src/plugins/intel_cpu/src/nodes/embedding_bag.cpp
index 814477c9e20..67bd24c4d81 100644
--- a/src/plugins/intel_cpu/src/nodes/embedding_bag.cpp
+++ b/src/plugins/intel_cpu/src/nodes/embedding_bag.cpp
@@ -44,8 +44,8 @@ EmbeddingBag::EmbeddingBag(const std::shared_ptr<ov::Node>& op,
}
void EmbeddingBag::prepareParams(const VectorDims& indexStaticShape) {
- _embDepth = 1lu;
- for (size_t i = 1lu; i < indexStaticShape.size(); i++) {
+ _embDepth = 1LU;
+ for (size_t i = 1LU; i < indexStaticShape.size(); i++) {
_embDepth *= indexStaticShape[i];
}
}
@@ -63,15 +63,16 @@ void EmbeddingBag::processData(const T* srcData,
auto* dstData = outMemory->getDataAs<T>();
auto threadBody = [&](const int ithr, const int nthr) {
- size_t start(0lu), end(0lu);
+ size_t start(0LU);
+ size_t end(0LU);
splitter(outputBagsNum, nthr, ithr, start, end);
if (start >= end) {
return;
}
- size_t indicesSize = 0lu;
+ size_t indicesSize = 0LU;
const int* indices = nullptr;
- int weightsIdx = 0lu;
+ int weightsIdx = 0LU;
bool withWeights = _withWeights;
for (size_t obi = start; obi < end; obi++) {
@@ -81,24 +82,24 @@ void EmbeddingBag::processData(const T* srcData,
if (indices != nullptr) {
withWeights = withWeights & _withWeights;
- size_t inIdx = 0lu;
+ size_t inIdx = 0LU;
if (static_cast<size_t>(indices[inIdx]) >= inDataDims[0]) {
OPENVINO_THROW(msgPrefix + "' has invalid embedding bag index: " + std::to_string(indices[inIdx]));
}
size_t srcIndex = indices[inIdx] * _embDepth;
if (withWeights) {
- for (size_t i = 0lu; i < _embDepth; i++) {
+ for (size_t i = 0LU; i < _embDepth; i++) {
dstData[dstIndex + i] = srcData[srcIndex + i] * weightsData[weightsIdx];
}
weightsIdx++;
} else {
- for (size_t i = 0lu; i < _embDepth; i++) {
+ for (size_t i = 0LU; i < _embDepth; i++) {
dstData[dstIndex + i] = srcData[srcIndex + i];
}
}
- for (inIdx = 1lu; inIdx < indicesSize; inIdx++) {
+ for (inIdx = 1LU; inIdx < indicesSize; inIdx++) {
if (static_cast<size_t>(indices[inIdx]) >= inDataDims[0]) {
OPENVINO_THROW(msgPrefix +
"' has invalid embedding bag index: " + std::to_string(indices[inIdx]));
@@ -106,23 +107,23 @@ void EmbeddingBag::processData(const T* srcData,
size_t srcIndex = indices[inIdx] * _embDepth;
if (withWeights) {
- for (size_t i = 0lu; i < _embDepth; i++) {
+ for (size_t i = 0LU; i < _embDepth; i++) {
dstData[dstIndex + i] += srcData[srcIndex + i] * weightsData[weightsIdx];
}
weightsIdx++;
} else {
- for (size_t i = 0lu; i < _embDepth; i++) {
+ for (size_t i = 0LU; i < _embDepth; i++) {
dstData[dstIndex + i] += srcData[srcIndex + i];
}
}
}
if (_reduction == Reduction::MEAN) {
- for (size_t i = 0lu; i < _embDepth; i++) {
+ for (size_t i = 0LU; i < _embDepth; i++) {
dstData[dstIndex + i] /= indicesSize;
}
}
} else {
- for (size_t i = 0lu; i < _embDepth; i++) {
+ for (size_t i = 0LU; i < _embDepth; i++) {
dstData[dstIndex + i] = 0;
}
}
diff --git a/src/plugins/intel_cpu/src/nodes/embedding_bag_offsets.cpp b/src/plugins/intel_cpu/src/nodes/embedding_bag_offsets.cpp
index a16ef3d36b2..a20c091262e 100644
--- a/src/plugins/intel_cpu/src/nodes/embedding_bag_offsets.cpp
+++ b/src/plugins/intel_cpu/src/nodes/embedding_bag_offsets.cpp
@@ -50,7 +50,7 @@ bool EmbeddingBagOffset::isSupportedOperation(const std::shared_ptr<const ov::No
EmbeddingBagOffset::EmbeddingBagOffset(const std::shared_ptr<ov::Node>& op, const GraphContext::CPtr& context)
: Node(op, context, NgraphShapeInferFactory(op)),
- EmbeddingBag(op, 3lu, 1lu, 4lu, 3lu) {
+ EmbeddingBag(op, 3LU, 1LU, 4LU, 3LU) {
std::string errorMessage;
if (!isSupportedOperation(op, errorMessage)) {
OPENVINO_THROW_NOT_IMPLEMENTED(errorMessage);
@@ -70,11 +70,11 @@ EmbeddingBagOffset::EmbeddingBagOffset(const std::shared_ptr<ov::Node>& op, cons
ov::as_string(offsets_op->get_reduction()));
}
}
- if (getInputShapeAtPort(INDICES_IDX).getRank() != 1ul) {
+ if (getInputShapeAtPort(INDICES_IDX).getRank() != 1UL) {
THROW_CPU_NODE_ERR("has indices data with invalid rank.");
}
- if (getInputShapeAtPort(OFFSETS_IDX).getRank() != 1ul) {
+ if (getInputShapeAtPort(OFFSETS_IDX).getRank() != 1UL) {
THROW_CPU_NODE_ERR("offsets data has invalid rank.");
}
}
@@ -140,7 +140,7 @@ void EmbeddingBagOffset::getIndices(size_t embIndex,
size_t& size,
int& weightsIdx,
bool& withWeight) {
- if (static_cast<size_t>(embIndex) >= _offsetsLen) {
+ if (embIndex >= _offsetsLen) {
THROW_CPU_NODE_ERR("Invalid embedding bag index.");
}
if (static_cast<size_t>(offsetsData_[embIndex]) >= _indicesLen) {
@@ -148,23 +148,23 @@ void EmbeddingBagOffset::getIndices(size_t embIndex,
}
indices = nullptr;
- size = 0lu;
+ size = 0LU;
withWeight = _withWeights;
- if (embIndex == _offsetsLen - 1lu) {
+ if (embIndex == _offsetsLen - 1LU) {
size = _indicesLen - offsetsData_[embIndex];
} else {
- size = offsetsData_[embIndex + 1lu] - offsetsData_[embIndex];
+ size = offsetsData_[embIndex + 1LU] - offsetsData_[embIndex];
}
- if (size != 0lu) {
+ if (size != 0LU) {
indices = indicesData_ + offsetsData_[embIndex];
} else {
// Empty or default bag
withWeight = false;
if (defaultIndices_) {
indices = defaultIndices_;
- size = 1lu;
+ size = 1LU;
}
return;
}
diff --git a/src/plugins/intel_cpu/src/nodes/embedding_bag_packed.cpp b/src/plugins/intel_cpu/src/nodes/embedding_bag_packed.cpp
index fd397b92369..21e849f9888 100644
--- a/src/plugins/intel_cpu/src/nodes/embedding_bag_packed.cpp
+++ b/src/plugins/intel_cpu/src/nodes/embedding_bag_packed.cpp
@@ -50,7 +50,7 @@ bool EmbeddingBagPacked::isSupportedOperation(const std::shared_ptr<const ov::No
EmbeddingBagPacked::EmbeddingBagPacked(const std::shared_ptr<ov::Node>& op, const GraphContext::CPtr& context)
: Node(op, context, NgraphShapeInferFactory(op)),
- EmbeddingBag(op, 2lu, 1lu, 2lu, 3lu) {
+ EmbeddingBag(op, 2LU, 1LU, 2LU, 3LU) {
std::string errorMessage;
if (!isSupportedOperation(op, errorMessage)) {
OPENVINO_THROW_NOT_IMPLEMENTED(errorMessage);
@@ -70,7 +70,7 @@ EmbeddingBagPacked::EmbeddingBagPacked(const std::shared_ptr<ov::Node>& op, cons
ov::as_string(packed_op->get_reduction()));
}
}
- if (getInputShapeAtPort(INDICES_IDX).getRank() != 2ul) {
+ if (getInputShapeAtPort(INDICES_IDX).getRank() != 2UL) {
THROW_CPU_NODE_ERR("has indices data with invalid rank.");
}
}
@@ -127,7 +127,7 @@ void EmbeddingBagPacked::getIndices(size_t embIndex,
size_t& size,
int& weightsIdx,
bool& withWeight) {
- if (static_cast<size_t>(embIndex) >= _batch * _indicesPerBag) {
+ if (embIndex >= _batch * _indicesPerBag) {
THROW_CPU_NODE_ERR("Invalid embedding bag index.");
}
diff --git a/src/plugins/intel_cpu/src/nodes/embedding_segments_sum.cpp b/src/plugins/intel_cpu/src/nodes/embedding_segments_sum.cpp
index efadd77c8da..d67fa93d5fa 100644
--- a/src/plugins/intel_cpu/src/nodes/embedding_segments_sum.cpp
+++ b/src/plugins/intel_cpu/src/nodes/embedding_segments_sum.cpp
@@ -45,17 +45,17 @@ bool EmbeddingSegmentsSum::isSupportedOperation(const std::shared_ptr<const ov::
EmbeddingSegmentsSum::EmbeddingSegmentsSum(const std::shared_ptr<ov::Node>& op, const GraphContext::CPtr& context)
: Node(op, context, NgraphShapeInferFactory(op)),
- EmbeddingBag(op, 4lu, 1lu, 5lu, 4lu) {
+ EmbeddingBag(op, 4LU, 1LU, 5LU, 4LU) {
std::string errorMessage;
if (!isSupportedOperation(op, errorMessage)) {
OPENVINO_THROW_NOT_IMPLEMENTED(errorMessage);
}
_reduction = Reduction::SUM;
- if (getInputShapeAtPort(INDICES_IDX).getRank() != 1ul) {
+ if (getInputShapeAtPort(INDICES_IDX).getRank() != 1UL) {
THROW_CPU_NODE_ERR("has indices data with invalid rank: ", getInputShapeAtPort(INDICES_IDX).getRank());
}
- if (getInputShapeAtPort(SEGMENT_ID_IDX).getRank() != 1ul) {
+ if (getInputShapeAtPort(SEGMENT_ID_IDX).getRank() != 1UL) {
THROW_CPU_NODE_ERR("has invalid segmentID data rank: ", getInputShapeAtPort(SEGMENT_ID_IDX).getRank());
}
}
@@ -143,7 +143,7 @@ void EmbeddingSegmentsSum::getIndices(size_t embIndex,
// Empty bag
if (size == 0) {
- size = 1lu;
+ size = 1LU;
withWeight = false;
if (defaultIndices_) {
indices = defaultIndices_;
diff --git a/src/plugins/intel_cpu/src/nodes/executors/common/ref_opt_transpose.cpp b/src/plugins/intel_cpu/src/nodes/executors/common/ref_opt_transpose.cpp
index 5408bf9453a..48118b40d49 100644
--- a/src/plugins/intel_cpu/src/nodes/executors/common/ref_opt_transpose.cpp
+++ b/src/plugins/intel_cpu/src/nodes/executors/common/ref_opt_transpose.cpp
@@ -123,9 +123,9 @@ void RefOptimizedTransposeExecutor::exec(const std::vector<MemoryCPtr>& src, con
TransposeOptimizedEmitter,
ctx,
dataSize,
- OV_CASE(1u, element_type_traits<ov::element::u8>::value_type),
- OV_CASE(2u, element_type_traits<ov::element::u16>::value_type),
- OV_CASE(4u, element_type_traits<ov::element::i32>::value_type));
+ OV_CASE(1U, element_type_traits<ov::element::u8>::value_type),
+ OV_CASE(2U, element_type_traits<ov::element::u16>::value_type),
+ OV_CASE(4U, element_type_traits<ov::element::i32>::value_type));
}
bool RefOptimizedTransposeExecutor::init([[maybe_unused]] const TransposeParams& transposeParams,
diff --git a/src/plugins/intel_cpu/src/nodes/executors/common/ref_transpose.cpp b/src/plugins/intel_cpu/src/nodes/executors/common/ref_transpose.cpp
index a6581fc5ff4..bf1fd438054 100644
--- a/src/plugins/intel_cpu/src/nodes/executors/common/ref_transpose.cpp
+++ b/src/plugins/intel_cpu/src/nodes/executors/common/ref_transpose.cpp
@@ -64,7 +64,8 @@ void RefTransposeExecutor::referenceExecute(const uint8_t* src_data,
};
parallel_nt(0, [&](const int ithr, const int nthr) {
- size_t start = 0, end = 0;
+ size_t start = 0;
+ size_t end = 0;
VectorDims indexes(ndims, 0);
splitter(work_amount, nthr, ithr, start, end);
diff --git a/src/plugins/intel_cpu/src/nodes/executors/convolution_implementations.cpp b/src/plugins/intel_cpu/src/nodes/executors/convolution_implementations.cpp
index d20ac63b3c5..32162f06ce1 100644
--- a/src/plugins/intel_cpu/src/nodes/executors/convolution_implementations.cpp
+++ b/src/plugins/intel_cpu/src/nodes/executors/convolution_implementations.cpp
@@ -103,11 +103,7 @@ bool MatchesMemoryFormatFilter(const executor::Config<Attrs>& config,
const auto desc = DnnlBlockedMemoryDesc(config.descs.at(ARG_DST)->getShape(),
dnnl::memory::data_type::f32,
filter.output.front());
- if (!desc.hasLayoutType(layoutConfig.back())) {
- return false;
- }
-
- return true;
+ return desc.hasLayoutType(layoutConfig.back());
}
// to keep OV_CPU_INSTANCE macros aligned
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 19425940001..394f2dcd944 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
@@ -941,11 +941,7 @@ bool DnnlConvolutionPrimitive::isNspcAvailable(const ConvConfig& config) {
if (isDepthWise) {
// 1d equivalent cases are painfully slow
- if (inpDims.size() == 3 || 1 == inpDims[inpDims.size() - 2]) {
- return false;
- }
-
- return true;
+ return inpDims.size() != 3 && 1 != inpDims[inpDims.size() - 2];
}
// it was empirically observed that the nspc convolutions perform much slower than the blocked ones if the
@@ -962,7 +958,7 @@ bool DnnlConvolutionPrimitive::isNspcAvailable(const ConvConfig& config) {
auto paddingRreversItr = config.attrs.paddingR.crbegin();
for (size_t i = 0; i < spatialRank; ++i) {
- is1x1 = true && *(weightDimsReversItr++) == 1 && *(strideReversItr++) == 1 && *(paddingLreversItr++) == 0 &&
+ is1x1 = *(weightDimsReversItr++) == 1 && *(strideReversItr++) == 1 && *(paddingLreversItr++) == 0 &&
*(paddingRreversItr++) == 0;
}
}
@@ -979,11 +975,11 @@ bool DnnlConvolutionPrimitive::isNspcAvailable(const ConvConfig& config) {
}
}
- unsigned thresholdNumChannels = 128u; // for avx and below
+ unsigned thresholdNumChannels = 128U; // for avx and below
if (is1x1) {
- thresholdNumChannels = 2048u;
+ thresholdNumChannels = 2048U;
} else if (mayiuse(impl::cpu::x64::avx512_core)) {
- thresholdNumChannels = 512u;
+ thresholdNumChannels = 512U;
}
size_t OC = outDims[1];
diff --git a/src/plugins/intel_cpu/src/nodes/executors/fullyconnected_implementations.cpp b/src/plugins/intel_cpu/src/nodes/executors/fullyconnected_implementations.cpp
index 594300fc9e7..e907ad6912d 100644
--- a/src/plugins/intel_cpu/src/nodes/executors/fullyconnected_implementations.cpp
+++ b/src/plugins/intel_cpu/src/nodes/executors/fullyconnected_implementations.cpp
@@ -221,7 +221,7 @@ const std::vector<ExecutorImplementation<FCAttrs>>& getImplementations() {
// M = 1, K = (IC*H*W), when M = 1 it should not be efficient since acts as a vector multiply
// if layout is nchw/nChw16c: brg1x1 not support. Although jit supports, it should have similar
// problems with the above.
- VERIFY(one_of(srcRank(config), 2u, 3u), UNSUPPORTED_SRC_RANK);
+ VERIFY(one_of(srcRank(config), 2U, 3U), UNSUPPORTED_SRC_RANK);
VERIFY(weiRank(config) == 2, UNSUPPORTED_WEI_RANK);
// brg convolution does not support stride
VERIFY(getOffset0(config.descs.at(ARG_DST)) == 0, UNSUPPORTED_DST_STRIDES);
diff --git a/src/plugins/intel_cpu/src/nodes/executors/interpolate.cpp b/src/plugins/intel_cpu/src/nodes/executors/interpolate.cpp
index 75920244977..820f2311246 100644
--- a/src/plugins/intel_cpu/src/nodes/executors/interpolate.cpp
+++ b/src/plugins/intel_cpu/src/nodes/executors/interpolate.cpp
@@ -77,16 +77,20 @@ void ov::intel_cpu::InterpolateExecutor::buildTblNN(const VectorDims& srcDimPad5
[[maybe_unused]] InterpolateLayoutType layout,
InterpolateNearestMode nearestMode) {
const int dimSize = dataRank;
- float fz = (dimSize == 5) ? dataScales[dimSize - 3] : 1.f;
+ float fz = (dimSize == 5) ? dataScales[dimSize - 3] : 1.F;
float fy = dataScales[dimSize - 2];
float fx = dataScales[dimSize - 1];
- size_t ID = srcDimPad5d[2], IH = srcDimPad5d[3], IW = srcDimPad5d[4];
- size_t OD = dstDim5d[2], OH = dstDim5d[3], OW = dstDim5d[4];
+ size_t ID = srcDimPad5d[2];
+ size_t IH = srcDimPad5d[3];
+ size_t IW = srcDimPad5d[4];
+ size_t OD = dstDim5d[2];
+ size_t OH = dstDim5d[3];
+ size_t OW = dstDim5d[4];
indexTable.resize(OD + OH + OW);
- bool isDDownsample = (fz < 1) ? true : false;
- bool isHDownsample = (fy < 1) ? true : false;
- bool isWDownsample = (fx < 1) ? true : false;
+ bool isDDownsample = fz < 1;
+ bool isHDownsample = fy < 1;
+ bool isWDownsample = fx < 1;
for (int oz = 0; oz < static_cast<int>(OD); oz++) {
float iz = coordTransToInput(oz, fz, ID, OD);
indexTable[oz] = nearestRound(iz, isDDownsample, nearestMode);
@@ -111,16 +115,16 @@ float ov::intel_cpu::InterpolateExecutor::coordTransToInput(int outCoord,
float scale,
int inShape,
int outShape) const {
- if (scale == 1.0f || (inShape == outShape)) {
+ if (scale == 1.0F || (inShape == outShape)) {
return outCoord;
}
switch (interpAttrs.coordTransMode) {
case InterpolateCoordTransMode::half_pixel: {
- return (outCoord + 0.5f) / scale - 0.5f;
+ return (outCoord + 0.5F) / scale - 0.5F;
}
case InterpolateCoordTransMode::pytorch_half_pixel: {
if (outShape > 1) {
- return (outCoord + 0.5f) / scale - 0.5f;
+ return (outCoord + 0.5F) / scale - 0.5F;
}
return 0;
}
@@ -128,7 +132,7 @@ float ov::intel_cpu::InterpolateExecutor::coordTransToInput(int outCoord,
return static_cast<float>(outCoord) / scale;
}
case InterpolateCoordTransMode::tf_half_pixel_for_nn: {
- return (outCoord + 0.5f) / scale;
+ return (outCoord + 0.5F) / scale;
}
case InterpolateCoordTransMode::align_corners: {
if (outShape > 1) {
@@ -145,10 +149,10 @@ float ov::intel_cpu::InterpolateExecutor::coordTransToInput(int outCoord,
int ov::intel_cpu::InterpolateExecutor::nearestRound(float originCoord,
bool isDownsample,
- InterpolateNearestMode nearestMode) const {
+ InterpolateNearestMode nearestMode) {
switch (nearestMode) {
case InterpolateNearestMode::round_prefer_floor: {
- if (originCoord == (static_cast<int>(originCoord) + 0.5f)) {
+ if (originCoord == (static_cast<int>(originCoord) + 0.5F)) {
return static_cast<int>(std::floor(originCoord));
}
return static_cast<int>(std::round(originCoord));
@@ -184,15 +188,15 @@ void ov::intel_cpu::InterpolateExecutor::linearOnnxCF(int outCoord,
float& weight0,
float& weight1) {
float inCoord = coordTransToInput(outCoord, scale, inShape, outShape);
- inCoord = std::max(0.0f, std::min(inCoord, static_cast<float>(inShape - 1)));
+ inCoord = std::max(0.0F, std::min(inCoord, static_cast<float>(inShape - 1)));
index0 = std::min(static_cast<int>(inCoord), inShape - 1);
index1 = std::min(index0 + 1, inShape - 1);
weight1 = std::fabs(inCoord - index0);
weight0 = std::fabs(inCoord - index1);
if (index0 == index1) {
- weight0 = 0.5f;
- weight1 = 0.5f;
+ weight0 = 0.5F;
+ weight1 = 0.5F;
}
}
@@ -201,11 +205,15 @@ void ov::intel_cpu::InterpolateExecutor::buildTblLinearOnnx(const VectorDims& sr
const std::vector<float>& dataScales,
InterpolateLayoutType layout) {
int dimSize = dataRank;
- float fz = (spatialDimSize > 2) ? dataScales[dimSize - 3] : 1.f;
- float fy = (spatialDimSize > 1) ? dataScales[dimSize - 2] : 1.f;
+ float fz = (spatialDimSize > 2) ? dataScales[dimSize - 3] : 1.F;
+ float fy = (spatialDimSize > 1) ? dataScales[dimSize - 2] : 1.F;
float fx = dataScales[dimSize - 1];
- int ID = srcDimPad5d[2], IH = srcDimPad5d[3], IW = srcDimPad5d[4];
- int OD = dstDim5d[2], OH = dstDim5d[3], OW = dstDim5d[4];
+ int ID = srcDimPad5d[2];
+ int IH = srcDimPad5d[3];
+ int IW = srcDimPad5d[4];
+ int OD = dstDim5d[2];
+ int OH = dstDim5d[3];
+ int OW = dstDim5d[4];
std::vector<int*> indexPtr(MAX_INPUT_INTERPOLATE, nullptr);
std::vector<float*> weightPtr(MAX_INPUT_INTERPOLATE, nullptr);
@@ -218,7 +226,7 @@ void ov::intel_cpu::InterpolateExecutor::buildTblLinearOnnx(const VectorDims& sr
int scratchLen = rnd_up(eltInGrid * OW * OH * OD, 16);
indexTable.resize(idxType * scratchLen);
- indexPtr[0] = static_cast<int*>(&indexTable[0]);
+ indexPtr[0] = static_cast<int*>(indexTable.data());
indexPtr[1] = static_cast<int*>(&indexTable[OW * OH * OD]);
weightPtr[0] = reinterpret_cast<float*>(&indexTable[scratchLen]);
weightPtr[1] = reinterpret_cast<float*>(&indexTable[scratchLen + OW * OH * OD]);
@@ -239,18 +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, izE;
- float weightF, weightE;
+ int izF;
+ int izE;
+ float weightF;
+ float weightE;
linearOnnxCF(oz, fz, ID, OD, izF, izE, weightF, weightE);
int idxOz = oz * OH * OW;
for (int oy = 0; oy < OH; oy++) {
- int iyT, iyB;
- float weightT, weightB;
+ int iyT;
+ int iyB;
+ float weightT;
+ float weightB;
linearOnnxCF(oy, fy, IH, OH, iyT, iyB, weightT, weightB);
int idxOzOy = idxOz + oy * OW;
for (int ox = 0; ox < OW; ox++) {
- int ixL, ixR;
- float weightL, weightR;
+ int ixL;
+ int ixR;
+ float weightL;
+ float weightR;
linearOnnxCF(ox, fx, IW, OW, ixL, ixR, weightL, weightR);
int idxOzOyOx = idxOzOy + ox;
@@ -281,7 +295,7 @@ void ov::intel_cpu::InterpolateExecutor::buildTblLinearOnnx(const VectorDims& sr
size_t scratchLen = rnd_up(OW + OW + OH + OH + OD + OD, 16);
int idxType = 2;
indexTable.resize(idxType * scratchLen);
- indexPtr[0] = static_cast<int*>(&indexTable[0]);
+ indexPtr[0] = static_cast<int*>(indexTable.data());
indexPtr[1] = static_cast<int*>(&indexTable[OW]);
indexPtr[2] = static_cast<int*>(&indexTable[2 * OW]);
indexPtr[3] = static_cast<int*>(&indexTable[2 * OW + OH]);
@@ -317,20 +331,24 @@ void ov::intel_cpu::InterpolateExecutor::buildTblLinear(const VectorDims& srcDim
int kernel_width,
bool antialias) {
int dimSize = dataRank;
- float fz = (dimSize == 5) ? dataScales[dimSize - 3] : 1.f;
+ float fz = (dimSize == 5) ? dataScales[dimSize - 3] : 1.F;
float fy = dataScales[dimSize - 2];
float fx = dataScales[dimSize - 1];
- size_t ID = srcDimPad5d[2], IH = srcDimPad5d[3], IW = srcDimPad5d[4];
- size_t OD = dstDim5d[2], OH = dstDim5d[3], OW = dstDim5d[4];
-
- if (!(IW == OW && IH == OH && ID == OD)) {
- float ax = antialias ? fx : 1.0f;
- float ay = antialias ? fy : 1.0f;
- float az = antialias ? fz : 1.0f;
-
- int rx = (fx > 1.0f) ? 2 : static_cast<int>(ceil(static_cast<float>(kernel_width) / ax));
- int ry = (fy > 1.0f) ? 2 : static_cast<int>(ceil(static_cast<float>(kernel_width) / ay));
- int rz = (fz > 1.0f) ? 2 : static_cast<int>(ceil(static_cast<float>(kernel_width) / az));
+ size_t ID = srcDimPad5d[2];
+ size_t IH = srcDimPad5d[3];
+ size_t IW = srcDimPad5d[4];
+ size_t OD = dstDim5d[2];
+ size_t OH = dstDim5d[3];
+ size_t OW = dstDim5d[4];
+
+ if (IW != OW || IH != OH || ID != OD) {
+ float ax = antialias ? fx : 1.0F;
+ float ay = antialias ? fy : 1.0F;
+ float az = antialias ? fz : 1.0F;
+
+ int rx = (fx > 1.0F) ? 2 : static_cast<int>(ceil(static_cast<float>(kernel_width) / ax));
+ int ry = (fy > 1.0F) ? 2 : static_cast<int>(ceil(static_cast<float>(kernel_width) / ay));
+ int rz = (fz > 1.0F) ? 2 : static_cast<int>(ceil(static_cast<float>(kernel_width) / az));
int diaOD = 2 * rz + 1;
int diaOH = 2 * ry + 1;
@@ -339,15 +357,15 @@ void ov::intel_cpu::InterpolateExecutor::buildTblLinear(const VectorDims& srcDim
int sizeOH = OH * diaOH;
int sizeOW = OW * diaOW;
indexTable.resize((sizeOD + sizeOH + sizeOW) * 2);
- auto* weightTable = reinterpret_cast<float*>(&indexTable[0]);
- auto* weightOD = static_cast<float*>(&weightTable[0]);
- auto* weightOH = static_cast<float*>(&weightTable[sizeOD]);
- auto* weightOW = static_cast<float*>(&weightTable[sizeOD + sizeOH]);
+ auto* weightTable = reinterpret_cast<float*>(indexTable.data());
+ auto* weightOD = (&weightTable[0]);
+ auto* weightOH = (&weightTable[sizeOD]);
+ auto* weightOW = (&weightTable[sizeOD + sizeOH]);
auto* idxTable = static_cast<int*>(&indexTable[sizeOD + sizeOH + sizeOW]);
- auto* idxOD = static_cast<int*>(&idxTable[0]);
- auto* idxOH = static_cast<int*>(&idxTable[sizeOD]);
- auto* idxOW = static_cast<int*>(&idxTable[sizeOD + sizeOH]);
+ auto* idxOD = (&idxTable[0]);
+ auto* idxOH = (&idxTable[sizeOD]);
+ auto* idxOW = (&idxTable[sizeOD + sizeOH]);
for (int oz = 0; oz < static_cast<int>(OD); oz++) {
float iz = coordTransToInput(oz, fz, ID, OD);
@@ -355,7 +373,7 @@ void ov::intel_cpu::InterpolateExecutor::buildTblLinear(const VectorDims& srcDim
for (int r = iz_r - rz, i = 0; r <= iz_r + rz; r++, i++) {
idxOD[oz * diaOD + i] = r;
if (r < 0 || r >= static_cast<int>(ID)) {
- weightOD[oz * diaOD + i] = 0.f;
+ weightOD[oz * diaOD + i] = 0.F;
} else {
float dz = iz - r;
weightOD[oz * diaOD + i] = az * triangleCoeff(az * dz);
@@ -368,7 +386,7 @@ void ov::intel_cpu::InterpolateExecutor::buildTblLinear(const VectorDims& srcDim
for (int r = iy_r - ry, i = 0; r <= iy_r + ry; r++, i++) {
idxOH[oy * diaOH + i] = r;
if (r < 0 || r >= static_cast<int>(IH)) {
- weightOH[oy * diaOH + i] = 0.f;
+ weightOH[oy * diaOH + i] = 0.F;
} else {
float dy = iy - r;
weightOH[oy * diaOH + i] = ay * triangleCoeff(ay * dy);
@@ -381,7 +399,7 @@ void ov::intel_cpu::InterpolateExecutor::buildTblLinear(const VectorDims& srcDim
for (int r = ix_r - rx, i = 0; r <= ix_r + rx; r++, i++) {
idxOW[ox * diaOW + i] = r;
if (r < 0 || r >= static_cast<int>(IW)) {
- weightOW[ox * diaOW + i] = 0.f;
+ weightOW[ox * diaOW + i] = 0.F;
} else {
float dx = ix - r;
weightOW[ox * diaOW + i] = ax * triangleCoeff(ax * dx);
@@ -393,7 +411,7 @@ void ov::intel_cpu::InterpolateExecutor::buildTblLinear(const VectorDims& srcDim
std::vector<float> ov::intel_cpu::InterpolateExecutor::getCubicCoeffs(float mantissa, float a) {
float m = std::fabs(mantissa);
- std::vector<float> coeffs(4, 0.f);
+ std::vector<float> coeffs(4, 0.F);
coeffs[0] = a * (m - 1.0) * (m - 1.0) * m;
coeffs[1] = ((a + 2.0) * m - (a + 3.0)) * m * m + 1.0;
@@ -413,8 +431,10 @@ void ov::intel_cpu::InterpolateExecutor::buildTblCubic(const VectorDims& srcDimP
int dimSize = dataRank;
float fy = dataScales[dimSize - 2];
float fx = dataScales[dimSize - 1];
- int IH = srcDimPad5d[3], IW = srcDimPad5d[4];
- int OH = dstDim5d[3], OW = dstDim5d[4];
+ int IH = srcDimPad5d[3];
+ int IW = srcDimPad5d[4];
+ int OH = dstDim5d[3];
+ int OW = dstDim5d[4];
// idxNum for index, CUBIC_GRID_LEN for weight
const int idxNum = 1;
@@ -513,7 +533,7 @@ const uint8_t* ov::intel_cpu::InterpolateExecutor::padPreprocess(const std::vect
if (interpAttrs.layout == InterpolateLayoutType::planar) {
srcPadded.resize(inShapePadBlock[0] * srcDataSize, 0);
- auto* src_data_pad = static_cast<uint8_t*>(&srcPadded[0]);
+ auto* src_data_pad = static_cast<uint8_t*>(srcPadded.data());
parallel_for4d(srcDim5d[0], srcDim5d[1], srcDim5d[2], srcDim5d[3], [&](int n, int c, int d, int h) {
const uint8_t* src = src_data_origin + (inShapeBlock[1] * n + inShapeBlock[2] * c +
inShapeBlock[3] * d + inShapeBlock[4] * h) *
@@ -527,7 +547,7 @@ const uint8_t* ov::intel_cpu::InterpolateExecutor::padPreprocess(const std::vect
src_data = src_data_pad;
} else if (interpAttrs.layout == InterpolateLayoutType::by_channel) {
srcPadded.resize(inShapePadBlock[0] * srcDataSize, 0);
- auto* src_data_pad = static_cast<uint8_t*>(&srcPadded[0]);
+ auto* src_data_pad = static_cast<uint8_t*>(srcPadded.data());
parallel_for4d(srcDim5d[0], srcDim5d[2], srcDim5d[3], srcDim5d[4], [&](int n, int d, int h, int w) {
const uint8_t* src = src_data_origin +
(inShapeBlock[1] * n +
@@ -547,7 +567,7 @@ const uint8_t* ov::intel_cpu::InterpolateExecutor::padPreprocess(const std::vect
size_t CB = div_up(srcDimPad5d[1], blkSize);
size_t eltsTotal = srcDimPad5d[0] * CB * srcDimPad5d[2] * srcDimPad5d[3] * srcDimPad5d[4] * blkSize;
srcPadded.resize(eltsTotal * srcDataSize, 0x0);
- auto* src_data_pad = static_cast<uint8_t*>(&srcPadded[0]);
+ auto* src_data_pad = static_cast<uint8_t*>(srcPadded.data());
if ((srcDim5d[0] != srcDimPad5d[0]) || (srcDim5d[1] != srcDimPad5d[1])) {
OPENVINO_THROW("Interpolate executor does not support padding on batch and channel dimensions");
}
diff --git a/src/plugins/intel_cpu/src/nodes/executors/interpolate.hpp b/src/plugins/intel_cpu/src/nodes/executors/interpolate.hpp
index 946d8eab34b..249569463c9 100644
--- a/src/plugins/intel_cpu/src/nodes/executors/interpolate.hpp
+++ b/src/plugins/intel_cpu/src/nodes/executors/interpolate.hpp
@@ -163,7 +163,7 @@ private:
InterpolateLayoutType layout);
[[nodiscard]] float coordTransToInput(int outCoord, float scale, int inShape, int outShape) const;
- [[nodiscard]] int nearestRound(float origin, bool isDownsample, InterpolateNearestMode nearestMode) const;
+ [[nodiscard]] static int nearestRound(float origin, bool isDownsample, InterpolateNearestMode nearestMode);
void linearOnnxCF(int outCoord,
float scale,
int inShape,
@@ -172,7 +172,7 @@ private:
int& index1,
float& weight0,
float& weight1);
- std::vector<float> getCubicCoeffs(float mantissa, float a);
+ static std::vector<float> getCubicCoeffs(float mantissa, float a);
protected:
InterpolateAttrs interpAttrs;
diff --git a/src/plugins/intel_cpu/src/nodes/executors/kleidiai/kleidiai_mm.cpp b/src/plugins/intel_cpu/src/nodes/executors/kleidiai/kleidiai_mm.cpp
index 2919234d77c..2cbc9d3b31c 100644
--- a/src/plugins/intel_cpu/src/nodes/executors/kleidiai/kleidiai_mm.cpp
+++ b/src/plugins/intel_cpu/src/nodes/executors/kleidiai/kleidiai_mm.cpp
@@ -34,25 +34,24 @@ static std::vector<T> normalizeDimsTo2D(const std::vector<T>& dims) {
}
static bool useDynamicQuantizationImpl(const FCAttrs& attrs, const MemoryDescPtr& weightDesc) {
- if (attrs.dynamicQuantizationGroupSize != std::numeric_limits<uint64_t>::max())
+ if (attrs.dynamicQuantizationGroupSize != std::numeric_limits<uint64_t>::max()) {
return false;
+ }
if (!hasIntDotProductSupport()) {
return false;
}
- if (weightDesc->getPrecision() != element::i8)
+ if (weightDesc->getPrecision() != element::i8) {
return false;
+ }
return true;
}
bool MatMulKleidiAIExecutor::supports(const FCConfig& config) {
- if (config.descs.at(ARG_WEI)->getPrecision() != element::f32 &&
- !useDynamicQuantizationImpl(config.attrs, config.descs.at(ARG_WEI)))
- return false;
-
- return true;
+ return !static_cast<bool>(config.descs.at(ARG_WEI)->getPrecision() != element::f32 &&
+ !useDynamicQuantizationImpl(config.attrs, config.descs.at(ARG_WEI)));
}
MatMulKleidiAIExecutor::MatMulKleidiAIExecutor(const FCAttrs& attrs,
diff --git a/src/plugins/intel_cpu/src/nodes/executors/mlas/mlas_gemm.cpp b/src/plugins/intel_cpu/src/nodes/executors/mlas/mlas_gemm.cpp
index d5c5c8c1afc..2daa011e4ed 100644
--- a/src/plugins/intel_cpu/src/nodes/executors/mlas/mlas_gemm.cpp
+++ b/src/plugins/intel_cpu/src/nodes/executors/mlas/mlas_gemm.cpp
@@ -134,12 +134,12 @@ void MlasGemmExecutor::execute(const MemoryArgs& memory) {
M,
N,
K,
- 1.0f,
+ 1.0F,
srcRawMemPtr,
lda,
weiRawMemPtr,
ldb,
- 0.0f,
+ 0.0F,
dstRawMemPtr,
ldc,
biasRawMemPtr);
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 0b9aaaa4a05..36e6769d46e 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
@@ -368,7 +368,7 @@ bool MlasTransposeExecutorBuilder::isSupported([[maybe_unused]] const TransposeP
DEBUG_LOG("MLAS Transpose executor supports NCHW layout only");
return false;
}
- if (!one_of(srcDescs[0]->getPrecision().size(), 1u, 2u, 4u, 8u)) {
+ if (!one_of(srcDescs[0]->getPrecision().size(), 1U, 2U, 4U, 8U)) {
DEBUG_LOG("MLAS Transpose executor supports 1, 2, 4, 8 byte precision sizes");
return false;
}
diff --git a/src/plugins/intel_cpu/src/nodes/executors/mlas/mlas_transpose.hpp b/src/plugins/intel_cpu/src/nodes/executors/mlas/mlas_transpose.hpp
index 43cb9147536..dd270742a26 100644
--- a/src/plugins/intel_cpu/src/nodes/executors/mlas/mlas_transpose.hpp
+++ b/src/plugins/intel_cpu/src/nodes/executors/mlas/mlas_transpose.hpp
@@ -34,8 +34,8 @@ public:
private:
static int64_t calcShapeSize(const Shape& shape, size_t start, size_t end);
static bool IsTransposeMovingSingleAxis(VectorDims permutations, size_t& from, size_t& to);
- void TransposeSingleAxisOutwards(const MemoryCPtr& input, const MemoryPtr& output, size_t from, size_t to);
- void TransposeSingleAxisInwards(const MemoryCPtr& input, const MemoryPtr& output, size_t from, size_t to);
+ static void TransposeSingleAxisOutwards(const MemoryCPtr& input, const MemoryPtr& output, size_t from, size_t to);
+ static void TransposeSingleAxisInwards(const MemoryCPtr& input, const MemoryPtr& output, size_t from, size_t to);
size_t from;
size_t to;
diff --git a/src/plugins/intel_cpu/src/nodes/executors/shl/shl_eltwise.cpp b/src/plugins/intel_cpu/src/nodes/executors/shl/shl_eltwise.cpp
index c262c4193a7..303442d246d 100644
--- a/src/plugins/intel_cpu/src/nodes/executors/shl/shl_eltwise.cpp
+++ b/src/plugins/intel_cpu/src/nodes/executors/shl/shl_eltwise.cpp
@@ -11,19 +11,17 @@
namespace ov::intel_cpu {
bool ShlEltwiseExecutor::isEltwiseAlgorithmSupported(Algorithm algorithm) {
- if (one_of(algorithm, Algorithm::EltwiseAdd,
- Algorithm::EltwiseSubtract,
- Algorithm::EltwiseMultiply,
- Algorithm::EltwiseDivide,
- Algorithm::EltwiseMaximum,
- Algorithm::EltwiseMinimum,
- Algorithm::EltwiseExp,
- Algorithm::EltwiseClamp,
- Algorithm::EltwiseRelu,
- Algorithm::EltwisePrelu)) {
- return true;
- }
- return false;
+ return one_of(algorithm,
+ Algorithm::EltwiseAdd,
+ Algorithm::EltwiseSubtract,
+ Algorithm::EltwiseMultiply,
+ Algorithm::EltwiseDivide,
+ Algorithm::EltwiseMaximum,
+ Algorithm::EltwiseMinimum,
+ Algorithm::EltwiseExp,
+ Algorithm::EltwiseClamp,
+ Algorithm::EltwiseRelu,
+ Algorithm::EltwisePrelu);
}
bool ShlEltwiseExecutorBuilder::isSupported(const EltwiseAttrs& eltwiseAttrs,
@@ -222,8 +220,8 @@ bool ShlEltwiseExecutor::init(const EltwiseAttrs &eltwiseAttrs,
}
void ShlEltwiseExecutor::exec(const std::vector<MemoryCPtr>& src,
- const std::vector<MemoryPtr>& dst,
- [[maybe_unused]] const void* post_ops_data_) {
+ const std::vector<MemoryPtr>& dst,
+ [[maybe_unused]] const void* post_ops_data_) {
for (size_t i = 0; i < src.size(); i++) {
srcTensors[i].setData(src[i]->getData());
}
@@ -233,8 +231,6 @@ void ShlEltwiseExecutor::exec(const std::vector<MemoryCPtr>& src,
OPENVINO_ASSERT(shlExecFunc != nullptr && shlExecFunc() == CSINN_TRUE,
"ShlEltwiseExecutor: failed to execute");
-
- return;
}
} // namespace ov::intel_cpu
diff --git a/src/plugins/intel_cpu/src/nodes/executors/shl/shl_fullyconnected.cpp b/src/plugins/intel_cpu/src/nodes/executors/shl/shl_fullyconnected.cpp
index 3059c08d534..770747adeaf 100644
--- a/src/plugins/intel_cpu/src/nodes/executors/shl/shl_fullyconnected.cpp
+++ b/src/plugins/intel_cpu/src/nodes/executors/shl/shl_fullyconnected.cpp
@@ -13,7 +13,7 @@
namespace ov::intel_cpu {
namespace {
-static MemoryPtr prepareWeightMemory(const MemoryPtr weightsMemory, const ExecutorContext::CPtr context) {
+MemoryPtr prepareWeightMemory(const MemoryPtr weightsMemory, const ExecutorContext::CPtr context) {
DEBUG_LOG("ShlFCExecutor: prepack weights");
auto create = [&]() {
@@ -139,7 +139,8 @@ void ShlFCExecutor::execute(const MemoryArgs& memory) {
const auto nthreads = std::min(static_cast<int>(dim_M), parallel_get_max_threads());
parallel_nt(nthreads, [&](const int ithr, const int nthr) {
- size_t dim_M0 = 0, dim_M1 = 0;
+ size_t dim_M0 = 0;
+ size_t dim_M1 = 0;
splitter(dim_M, nthr, ithr, dim_M0, dim_M1);
const auto M = dim_M1 - dim_M0;
diff --git a/src/plugins/intel_cpu/src/nodes/executors/subgraph.cpp b/src/plugins/intel_cpu/src/nodes/executors/subgraph.cpp
index 2449292660c..12875b2309a 100644
--- a/src/plugins/intel_cpu/src/nodes/executors/subgraph.cpp
+++ b/src/plugins/intel_cpu/src/nodes/executors/subgraph.cpp
@@ -132,7 +132,8 @@ void SubgraphBaseExecutor::parallel_for6d(const initializer_functor& initializer
jit_snippets_call_args call_args;
initializer(call_args, ithr);
- size_t start = 0, end = 0;
+ size_t start = 0;
+ size_t end = 0;
splitter(m_harness_work_amount, nthr, ithr, start, end);
std::vector<size_t> indexes{0, 0, 0, 0, 0};
@@ -170,7 +171,8 @@ void SubgraphBaseExecutor::parallel_forNd(const initializer_functor& initializer
jit_snippets_call_args call_args;
initializer(call_args, ithr);
- size_t start = 0, end = 0;
+ size_t start = 0;
+ size_t end = 0;
splitter(m_harness_work_amount, nthr, ithr, start, end);
std::vector<size_t> indexes(dom.size() - 1, 0);
diff --git a/src/plugins/intel_cpu/src/nodes/executors/x64/subgraph.cpp b/src/plugins/intel_cpu/src/nodes/executors/x64/subgraph.cpp
index f525a5527f9..6075f3a0dbe 100644
--- a/src/plugins/intel_cpu/src/nodes/executors/x64/subgraph.cpp
+++ b/src/plugins/intel_cpu/src/nodes/executors/x64/subgraph.cpp
@@ -34,7 +34,6 @@
#include "utils/general_utils.h"
#if defined(__linux__) && defined(SNIPPETS_DEBUG_CAPS)
-# include <csignal>
# include "emitters/snippets/x64/jit_segfault_detector_emitter.hpp"
std::mutex err_print_lock;
@@ -62,10 +61,11 @@ inline void parallelNd_repacking(const BrgemmCopyBKernel* ker,
const VectorDims& out_str,
const uint8_t* src,
uint8_t* dst) {
- const size_t batch = std::accumulate(dom.rbegin() + 2, dom.rend(), 1lu, std::multiplies<>());
+ const size_t batch = std::accumulate(dom.rbegin() + 2, dom.rend(), 1LU, std::multiplies<>());
parallel_nt_static(0, [&](const int ithr, const int nthr) {
BrgemmCopyBKernel::call_args args;
- size_t start = 0, end = 0;
+ size_t start = 0;
+ size_t end = 0;
splitter(batch, nthr, ithr, start, end);
for (size_t iwork = start; iwork < end; ++iwork) {
const uint8_t* src_u8 = src;
@@ -163,7 +163,7 @@ void SubgraphExecutor::separately_repack_input(const MemoryPtr& src_mem_ptr,
VectorDims dom;
const auto& shape = dst_mem_ptr->getShape().getDims();
OPENVINO_ASSERT(shape.size() <= tensor_rank, "Unsupported shape rank of repacking data");
- init_parallel_domain(shape, tensor_rank, 2lu, dom);
+ init_parallel_domain(shape, tensor_rank, 2LU, dom);
const auto& in_strides = repacked_input.in_offsets();
const auto& out_strides = repacked_input.out_offsets();
@@ -212,7 +212,7 @@ std::vector<MemoryPtr> SubgraphExecutor::prepare_weights(const std::vector<Memor
#if defined(__linux__) && defined(SNIPPETS_DEBUG_CAPS)
// NOLINTBEGIN(misc-include-cleaner) bug in clang-tidy
-void SubgraphExecutor::segfault_detector() {
+void SubgraphExecutor::segfault_detector() const {
if (enabled_segfault_detector) {
__sighandler_t signal_handler = []([[maybe_unused]] int signal) {
std::lock_guard<std::mutex> guard(err_print_lock);
diff --git a/src/plugins/intel_cpu/src/nodes/executors/x64/subgraph.hpp b/src/plugins/intel_cpu/src/nodes/executors/x64/subgraph.hpp
index 08657a2f044..ffff8dd06a8 100644
--- a/src/plugins/intel_cpu/src/nodes/executors/x64/subgraph.hpp
+++ b/src/plugins/intel_cpu/src/nodes/executors/x64/subgraph.hpp
@@ -88,7 +88,7 @@ protected:
#ifdef SNIPPETS_DEBUG_CAPS
bool enabled_segfault_detector = false;
- inline void segfault_detector();
+ inline void segfault_detector() const;
#endif
private:
diff --git a/src/plugins/intel_cpu/src/nodes/experimental_detectron_detection_output.cpp b/src/plugins/intel_cpu/src/nodes/experimental_detectron_detection_output.cpp
index 1a834291752..7668b05aa62 100644
--- a/src/plugins/intel_cpu/src/nodes/experimental_detectron_detection_output.cpp
+++ b/src/plugins/intel_cpu/src/nodes/experimental_detectron_detection_output.cpp
@@ -84,8 +84,8 @@ static void refine_boxes(const float* boxes,
const float ww = x1 - x0 + coordinates_offset;
const float hh = y1 - y0 + coordinates_offset;
// center location of box
- const float ctr_x = x0 + 0.5f * ww;
- const float ctr_y = y0 + 0.5f * hh;
+ const float ctr_x = x0 + 0.5F * ww;
+ const float ctr_y = y0 + 0.5F * hh;
for (int class_idx = 1; class_idx < classes_num; ++class_idx) {
const float dx = deltas[delta_idx({roi_idx, class_idx, 0})] / weights[0];
@@ -101,17 +101,17 @@ static void refine_boxes(const float* boxes,
const float pred_h = std::exp((std::min)(d_log_h, max_delta_log_wh)) * hh;
// update upper-left corner location
- float x0_new = pred_ctr_x - 0.5f * pred_w;
- float y0_new = pred_ctr_y - 0.5f * pred_h;
+ float x0_new = pred_ctr_x - 0.5F * pred_w;
+ float y0_new = pred_ctr_y - 0.5F * pred_h;
// update lower-right corner location
- float x1_new = pred_ctr_x + 0.5f * pred_w - coordinates_offset;
- float y1_new = pred_ctr_y + 0.5f * pred_h - coordinates_offset;
+ float x1_new = pred_ctr_x + 0.5F * pred_w - coordinates_offset;
+ float y1_new = pred_ctr_y + 0.5F * pred_h - coordinates_offset;
// adjust new corner locations to be within the image region,
- x0_new = std::max<float>(0.0f, x0_new);
- y0_new = std::max<float>(0.0f, y0_new);
- x1_new = std::max<float>(0.0f, x1_new);
- y1_new = std::max<float>(0.0f, y1_new);
+ x0_new = std::max<float>(0.0F, x0_new);
+ y0_new = std::max<float>(0.0F, y0_new);
+ x1_new = std::max<float>(0.0F, x1_new);
+ y1_new = std::max<float>(0.0F, y1_new);
// recompute new width & height
const float box_w = x1_new - x0_new + coordinates_offset;
@@ -137,7 +137,7 @@ static bool SortScorePairDescend(const std::pair<float, std::pair<int, int>>& pa
struct ConfidenceComparator {
explicit ConfidenceComparator(const float* conf_data) : _conf_data(conf_data) {}
- bool operator()(int idx1, int idx2) {
+ bool operator()(int idx1, int idx2) const {
if (_conf_data[idx1] > _conf_data[idx2]) {
return true;
}
@@ -166,7 +166,7 @@ static inline float JaccardOverlap(const float* decoded_bbox,
float xmax2 = decoded_bbox[idx2 * 4 + 2];
if (xmin2 > xmax1 || xmax2 < xmin1 || ymin2 > ymax1 || ymax2 < ymin1) {
- return 0.0f;
+ return 0.0F;
}
float intersect_xmin = (std::max)(xmin1, xmin2);
@@ -178,7 +178,7 @@ static inline float JaccardOverlap(const float* decoded_bbox,
float intersect_height = intersect_ymax - intersect_ymin + coordinates_offset;
if (intersect_width <= 0 || intersect_height <= 0) {
- return 0.0f;
+ return 0.0F;
}
float intersect_size = intersect_width * intersect_height;
@@ -320,15 +320,15 @@ void ExperimentalDetectronDetectionOutput::execute([[maybe_unused]] const dnnl::
refine_boxes(boxes,
deltas,
- &deltas_weights_[0],
+ deltas_weights_.data(),
scores,
- &refined_boxes[0],
- &refined_boxes_areas[0],
- &refined_scores[0],
+ refined_boxes.data(),
+ refined_boxes_areas.data(),
+ refined_scores.data(),
rois_num,
classes_num_,
max_delta_log_wh_,
- 1.0f);
+ 1.0F);
// Apply NMS class-wise.
std::vector<int> buffer(rois_num, 0);
@@ -340,7 +340,7 @@ void ExperimentalDetectronDetectionOutput::execute([[maybe_unused]] const dnnl::
nms_cf(&refined_scores[refined_score_idx({class_idx, 0})],
&refined_boxes[refined_box_idx({class_idx, 0, 0})],
&refined_boxes_areas[refined_score_idx({class_idx, 0})],
- &buffer[0],
+ buffer.data(),
&indices[total_detections_num],
detections_per_class[class_idx],
rois_num,
diff --git a/src/plugins/intel_cpu/src/nodes/experimental_detectron_generate_proposals_single_image.cpp b/src/plugins/intel_cpu/src/nodes/experimental_detectron_generate_proposals_single_image.cpp
index dd2d95ea0e9..f5be2b8d557 100644
--- a/src/plugins/intel_cpu/src/nodes/experimental_detectron_generate_proposals_single_image.cpp
+++ b/src/plugins/intel_cpu/src/nodes/experimental_detectron_generate_proposals_single_image.cpp
@@ -84,8 +84,8 @@ void refine_anchors(const float* deltas,
const float ww = x1 - x0 + coordinates_offset;
const float hh = y1 - y0 + coordinates_offset;
// center location of box
- const float ctr_x = x0 + 0.5f * ww;
- const float ctr_y = y0 + 0.5f * hh;
+ const float ctr_x = x0 + 0.5F * ww;
+ const float ctr_y = y0 + 0.5F * hh;
// new center location according to deltas (dx, dy)
const float pred_ctr_x = dx * ww + ctr_x;
@@ -95,17 +95,17 @@ void refine_anchors(const float* deltas,
const float pred_h = std::exp(std::min(d_log_h, max_delta_log_wh)) * hh;
// update upper-left corner location
- x0 = pred_ctr_x - 0.5f * pred_w;
- y0 = pred_ctr_y - 0.5f * pred_h;
+ x0 = pred_ctr_x - 0.5F * pred_w;
+ y0 = pred_ctr_y - 0.5F * pred_h;
// update lower-right corner location
- x1 = pred_ctr_x + 0.5f * pred_w - coordinates_offset;
- y1 = pred_ctr_y + 0.5f * pred_h - coordinates_offset;
+ x1 = pred_ctr_x + 0.5F * pred_w - coordinates_offset;
+ y1 = pred_ctr_y + 0.5F * pred_h - coordinates_offset;
// adjust new corner locations to be within the image region,
- x0 = std::max<float>(0.0f, std::min<float>(x0, img_W - coordinates_offset));
- y0 = std::max<float>(0.0f, std::min<float>(y0, img_H - coordinates_offset));
- x1 = std::max<float>(0.0f, std::min<float>(x1, img_W - coordinates_offset));
- y1 = std::max<float>(0.0f, std::min<float>(y1, img_H - coordinates_offset));
+ x0 = std::max<float>(0.0F, std::min<float>(x0, img_W - coordinates_offset));
+ y0 = std::max<float>(0.0F, std::min<float>(y0, img_H - coordinates_offset));
+ x1 = std::max<float>(0.0F, std::min<float>(x1, img_W - coordinates_offset));
+ y1 = std::max<float>(0.0F, std::min<float>(y1, img_H - coordinates_offset));
// recompute new width & height
const float box_w = x1 - x0 + coordinates_offset;
@@ -221,7 +221,7 @@ void nms_cpu(const int num_boxes,
#endif
for (; tail < num_boxes; ++tail) {
- float res = 0.0f;
+ float res = 0.0F;
const float x0i = x0[box];
const float y0i = y0[box];
@@ -241,8 +241,8 @@ void nms_cpu(const int num_boxes,
const float y1 = std::min<float>(y1i, y1j);
// intersection area
- const float width = std::max<float>(0.0f, x1 - x0 + coordinates_offset);
- const float height = std::max<float>(0.0f, y1 - y0 + coordinates_offset);
+ const float width = std::max<float>(0.0F, x1 - x0 + coordinates_offset);
+ const float height = std::max<float>(0.0F, y1 - y0 + coordinates_offset);
const float area = width * height;
// area of A, B
@@ -286,10 +286,10 @@ void fill_output_blobs(const float* proposals,
if (num_rois < post_nms_topn) {
for (int i = 4 * num_rois; i < 4 * post_nms_topn; i++) {
- rois[i] = 0.f;
+ rois[i] = 0.F;
}
for (int i = num_rois; i < post_nms_topn; i++) {
- scores[i] = 0.f;
+ scores[i] = 0.F;
}
}
}
@@ -328,7 +328,7 @@ ExperimentalDetectronGenerateProposalsSingleImage::ExperimentalDetectronGenerate
pre_nms_topn_ = proposalAttrs.pre_nms_count;
post_nms_topn_ = proposalAttrs.post_nms_count;
- coordinates_offset = 0.0f;
+ coordinates_offset = 0.0F;
roi_indices_.resize(post_nms_topn_);
}
@@ -431,7 +431,7 @@ void ExperimentalDetectronGenerateProposalsSingleImage::execute([[maybe_unused]]
refine_anchors(p_deltas_item,
p_scores_item,
p_anchors_item,
- reinterpret_cast<float*>(&proposals_[0]),
+ reinterpret_cast<float*>(proposals_.data()),
anchors_num,
bottom_H,
bottom_W,
@@ -440,7 +440,7 @@ void ExperimentalDetectronGenerateProposalsSingleImage::execute([[maybe_unused]]
min_box_H,
min_box_W,
static_cast<const float>(std::log(1000. / 16.)),
- 1.0f);
+ 1.0F);
std::partial_sort(proposals_.begin(),
proposals_.begin() + pre_nms_topn,
proposals_.end(),
@@ -448,18 +448,18 @@ void ExperimentalDetectronGenerateProposalsSingleImage::execute([[maybe_unused]]
return (struct1.score > struct2.score);
});
- unpack_boxes(reinterpret_cast<float*>(&proposals_[0]), &unpacked_boxes[0], pre_nms_topn);
+ unpack_boxes(reinterpret_cast<float*>(proposals_.data()), unpacked_boxes.data(), pre_nms_topn);
nms_cpu(pre_nms_topn,
- &is_dead[0],
- &unpacked_boxes[0],
- &roi_indices_[0],
+ is_dead.data(),
+ unpacked_boxes.data(),
+ roi_indices_.data(),
&num_rois,
0,
nms_thresh_,
post_nms_topn_,
coordinates_offset);
- fill_output_blobs(&unpacked_boxes[0],
- &roi_indices_[0],
+ fill_output_blobs(unpacked_boxes.data(),
+ roi_indices_.data(),
p_roi_item,
p_roi_score_item,
pre_nms_topn,
diff --git a/src/plugins/intel_cpu/src/nodes/experimental_detectron_priorgridgenerator.cpp b/src/plugins/intel_cpu/src/nodes/experimental_detectron_priorgridgenerator.cpp
index e7865d2543b..2f2dbe8afad 100644
--- a/src/plugins/intel_cpu/src/nodes/experimental_detectron_priorgridgenerator.cpp
+++ b/src/plugins/intel_cpu/src/nodes/experimental_detectron_priorgridgenerator.cpp
@@ -77,11 +77,11 @@ void ExperimentalDetectronPriorGridGenerator::execute([[maybe_unused]] const dnn
const int layer_width = grid_w_ ? grid_w_ : getParentEdgeAt(INPUT_FEATUREMAP)->getMemory().getStaticDims()[3];
const int layer_height = grid_h_ ? grid_h_ : getParentEdgeAt(INPUT_FEATUREMAP)->getMemory().getStaticDims()[2];
const float step_w =
- (stride_w_ != 0.0f)
+ (stride_w_ != 0.0F)
? stride_w_
: static_cast<float>(getParentEdgeAt(INPUT_IMAGE)->getMemory().getStaticDims()[3]) / layer_width;
const float step_h =
- (stride_h_ != 0.0f)
+ (stride_h_ != 0.0F)
? stride_h_
: static_cast<float>(getParentEdgeAt(INPUT_IMAGE)->getMemory().getStaticDims()[2]) / layer_height;
@@ -91,10 +91,10 @@ void ExperimentalDetectronPriorGridGenerator::execute([[maybe_unused]] const dnn
for (int h = 0; h < layer_height; ++h) {
for (int w = 0; w < layer_width; ++w) {
for (int s = 0; s < num_priors_; ++s) {
- top_data_0[0] = bottom_data_0[4 * s + 0] + step_w * (w + 0.5f);
- top_data_0[1] = bottom_data_0[4 * s + 1] + step_h * (h + 0.5f);
- top_data_0[2] = bottom_data_0[4 * s + 2] + step_w * (w + 0.5f);
- top_data_0[3] = bottom_data_0[4 * s + 3] + step_h * (h + 0.5f);
+ top_data_0[0] = bottom_data_0[4 * s + 0] + step_w * (w + 0.5F);
+ top_data_0[1] = bottom_data_0[4 * s + 1] + step_h * (h + 0.5F);
+ top_data_0[2] = bottom_data_0[4 * s + 2] + step_w * (w + 0.5F);
+ top_data_0[3] = bottom_data_0[4 * s + 3] + step_h * (h + 0.5F);
top_data_0 += 4;
}
}
diff --git a/src/plugins/intel_cpu/src/nodes/experimental_detectron_roifeatureextractor.cpp b/src/plugins/intel_cpu/src/nodes/experimental_detectron_roifeatureextractor.cpp
index 1d768c884d2..df374942f68 100644
--- a/src/plugins/intel_cpu/src/nodes/experimental_detectron_roifeatureextractor.cpp
+++ b/src/plugins/intel_cpu/src/nodes/experimental_detectron_roifeatureextractor.cpp
@@ -115,8 +115,12 @@ void pre_calc_for_bilinear_interpolate(const int height,
T ly = y - y_low;
T lx = x - x_low;
- T hy = static_cast<T>(1) - ly, hx = static_cast<T>(1) - lx;
- T w1 = hy * hx, w2 = hy * lx, w3 = ly * hx, w4 = ly * lx;
+ T hy = static_cast<T>(1) - ly;
+ T hx = static_cast<T>(1) - lx;
+ T w1 = hy * hx;
+ T w2 = hy * lx;
+ T w3 = ly * hx;
+ T w4 = ly * lx;
// save weights and indices
PreCalc<T> pc;
@@ -175,8 +179,8 @@ void ROIAlignForward_cpu_kernel(const int nthreads,
// Force malformed ROIs to be 1x1
T roi_width = (std::max)(roi_end_w - roi_start_w, (T)1.);
T roi_height = (std::max)(roi_end_h - roi_start_h, (T)1.);
- T bin_size_h = static_cast<T>(roi_height) / static_cast<T>(pooled_height);
- T bin_size_w = static_cast<T>(roi_width) / static_cast<T>(pooled_width);
+ T bin_size_h = roi_height / static_cast<T>(pooled_height);
+ T bin_size_w = roi_width / static_cast<T>(pooled_width);
// We use roi_bin_grid to sample the grid and mimic integral
int roi_bin_grid_h = (sampling_ratio > 0)
@@ -234,7 +238,7 @@ void ROIAlignForward_cpu_kernel(const int nthreads,
}
void redistribute_rois(const float* rois, int* level_ids, const int num_rois, const int levels_num) {
- const float canonical_scale = 224.0f;
+ const float canonical_scale = 224.0F;
const int canonical_level = 2;
for (int i = 0; i < num_rois; ++i) {
@@ -247,7 +251,7 @@ void redistribute_rois(const float* rois, int* level_ids, const int num_rois, co
float area = (x1 - x0) * (y1 - y0);
if (area > 0) {
area = std::sqrt(area) / canonical_scale;
- area = std::log2(area + 1e-6f);
+ area = std::log2(area + 1e-6F);
target_level = static_cast<int>(std::floor(area + canonical_level));
target_level = (std::max)(0, (std::min)(levels_num - 1, target_level));
}
@@ -345,11 +349,11 @@ void ExperimentalDetectronROIFeatureExtractor::execute([[maybe_unused]] const dn
}
std::vector<int> level_ids(num_rois, 0);
- redistribute_rois(input_rois, reinterpret_cast<int*>(&level_ids[0]), num_rois, levels_num);
+ redistribute_rois(input_rois, reinterpret_cast<int*>(level_ids.data()), num_rois, levels_num);
std::vector<float> reordered_rois(4 * num_rois, 0);
std::vector<int> original_rois_mapping(num_rois, 0);
- reord(input_rois, &level_ids[0], num_rois, 4, &reordered_rois[0], &original_rois_mapping[0]);
+ reord(input_rois, level_ids.data(), num_rois, 4, reordered_rois.data(), original_rois_mapping.data());
std::vector<int> rois_per_level;
split_points(level_ids, rois_per_level, levels_num + 1);
@@ -364,7 +368,7 @@ void ExperimentalDetectronROIFeatureExtractor::execute([[maybe_unused]] const dn
const int featuremap_width = getParentEdgeAt(INPUT_FEATURES_START + i)->getMemory().getStaticDims()[3];
ROIAlignForward_cpu_kernel<float>(feaxels_per_roi * level_rois_num,
featuremap,
- 1.0f / pyramid_scales_[i],
+ 1.0F / pyramid_scales_[i],
channels_num,
featuremap_height,
featuremap_width,
@@ -378,12 +382,12 @@ void ExperimentalDetectronROIFeatureExtractor::execute([[maybe_unused]] const dn
}
std::vector<int> dummy_mapping(num_rois, 0);
- reord(&output_rois_features_temp[0],
- &original_rois_mapping[0],
+ reord(output_rois_features_temp.data(),
+ original_rois_mapping.data(),
num_rois,
feaxels_per_roi,
output_rois_features,
- &dummy_mapping[0]);
+ dummy_mapping.data());
if (output_rois != nullptr) {
cpu_memcpy(output_rois, input_rois, 4 * num_rois * sizeof(float));
}
diff --git a/src/plugins/intel_cpu/src/nodes/extract_image_patches.cpp b/src/plugins/intel_cpu/src/nodes/extract_image_patches.cpp
index 3b9f7dd5caf..3431c61d306 100644
--- a/src/plugins/intel_cpu/src/nodes/extract_image_patches.cpp
+++ b/src/plugins/intel_cpu/src/nodes/extract_image_patches.cpp
@@ -124,7 +124,7 @@ private:
Opmask k_mask = Xbyak::Opmask(1);
Xbyak::Label gather_index_table;
- inline void load_scalar(Vmm vmm_arg, const Xbyak::Address& op) {
+ void load_scalar(Vmm vmm_arg, const Xbyak::Address& op) {
auto xmm_src = Xmm(vmm_arg.getIdx());
switch (jpp.dtype_size) {
case 4:
@@ -140,7 +140,7 @@ private:
OPENVINO_THROW("The data type of size '", jpp.dtype_size, "' is not supported.");
}
}
- inline void store_scalar(const Xbyak::Address& op, Vmm vmm_arg) {
+ void store_scalar(const Xbyak::Address& op, Vmm vmm_arg) {
auto xmm_dst = Xmm(vmm_arg.getIdx());
switch (jpp.dtype_size) {
case 4:
@@ -157,8 +157,10 @@ private:
}
}
- inline void pad_with_zeros(reg64_t& reg_num_pads_arg, reg64_t& reg_dst_arg) {
- Xbyak::Label main, tail, exit;
+ void pad_with_zeros(reg64_t& reg_num_pads_arg, reg64_t& reg_dst_arg) {
+ Xbyak::Label main;
+ Xbyak::Label tail;
+ Xbyak::Label exit;
L(main);
{
cmp(reg_num_pads_arg, jpp.block_size);
@@ -180,7 +182,7 @@ private:
L(exit);
}
- inline void custom_uni_vgatherdps(const Vmm& vmm_arg, reg64_t& mem_base, const Vmm& mem_offset, Vmm& vmm_mask) {
+ void custom_uni_vgatherdps(const Vmm& vmm_arg, reg64_t& mem_base, const Vmm& mem_offset, Vmm& vmm_mask) {
switch (isa) {
case x64::avx2:
uni_vpcmpeqd(vmm_mask, vmm_mask, vmm_mask);
@@ -198,7 +200,7 @@ private:
}
}
- inline void gather_src2vmm(const Vmm& vmm_arg, reg64_t& mem_base) {
+ void gather_src2vmm(const Vmm& vmm_arg, reg64_t& mem_base) {
switch (jpp.dtype_size) {
case 4:
custom_uni_vgatherdps(vmm, mem_base, vmm_gather_index, vmm_gather_mask);
@@ -212,7 +214,7 @@ private:
}
}
- inline void emulate_gather(const Xbyak::Xmm& xmm_arg, reg64_t& mem_base, int xmm_offset = 0) {
+ void emulate_gather(const Xbyak::Xmm& xmm_arg, reg64_t& mem_base, int xmm_offset = 0) {
const int xmm_size = 16; // bytes
const int xmm_block_size = xmm_size / jpp.dtype_size;
const int offset = xmm_offset * jpp.SW * jpp.dtype_size * xmm_block_size;
@@ -233,14 +235,14 @@ private:
}
}
}
- inline void emulate_gather(const Xbyak::Ymm& ymm_arg, reg64_t& mem_base) {
+ void emulate_gather(const Xbyak::Ymm& ymm_arg, reg64_t& mem_base) {
auto low_xmm = Xbyak::Xmm(ymm_arg.getIdx());
emulate_gather(low_xmm, mem_base, 0);
emulate_gather(xmm_aux, mem_base, 1);
vinserti128(ymm_arg, ymm_arg, xmm_aux, 1);
}
- inline void emulate_gather(const Xbyak::Zmm& zmm_arg, reg64_t& mem_base) {
+ void emulate_gather(const Xbyak::Zmm& zmm_arg, reg64_t& mem_base) {
auto low_xmm = Xbyak::Xmm(zmm_arg.getIdx());
emulate_gather(low_xmm, mem_base, 0);
for (int i = 1; i < 4; i++) {
@@ -254,8 +256,12 @@ private:
// reg_num_pads contains h_lo_pad at this point
sub(reg_oh_count, reg_num_pads);
- Xbyak::Label ih_loop, ih_tail, ih_exit;
- Xbyak::Label iw_loop, iw_tail, iw_exit;
+ Xbyak::Label ih_loop;
+ Xbyak::Label ih_tail;
+ Xbyak::Label ih_exit;
+ Xbyak::Label iw_loop;
+ Xbyak::Label iw_tail;
+ Xbyak::Label iw_exit;
if (jpp.need_padding) {
mul_by_const(reg_num_pads, reg_aux64, jpp.OW);
pad_with_zeros(reg_num_pads, reg_dst);
@@ -333,7 +339,7 @@ bool ExtractImagePatches::isSupportedOperation(const std::shared_ptr<const ov::N
errorMessage = "Does not support pad type: " + ov::as_string(padValue);
return false;
}
- if (!everyone_is(2u,
+ if (!everyone_is(2U,
extImgPatcher->get_sizes().size(),
extImgPatcher->get_strides().size(),
extImgPatcher->get_rates().size())) {
@@ -509,14 +515,14 @@ void ExtractImagePatches::ExtractImagePatchesRefExecutor::executeReference(void*
parallel_for4d(OB, jpp.KH, jpp.KW, IC, [&](const size_t ob, const size_t kh, const size_t kw, const size_t ic) {
const int64_t iw_start = static_cast<int64_t>(kw * RW) - PL;
const int64_t ih_start = static_cast<int64_t>(kh * RH) - PT;
- const size_t ih_lpad = ih_start >= 0 ? 0 : std::ceil(-1.f * ih_start / jpp.SH);
- const size_t iw_lpad = iw_start >= 0 ? 0 : std::ceil(-1.f * iw_start / jpp.SW);
+ const size_t ih_lpad = ih_start >= 0 ? 0 : std::ceil(-1.F * ih_start / jpp.SH);
+ const size_t iw_lpad = iw_start >= 0 ? 0 : std::ceil(-1.F * iw_start / jpp.SW);
const size_t ih_hpad =
- std::ceil((IH - 1.f * ih_start) / jpp.SH) > jpp.OH ? jpp.OH : std::ceil((IH + -1.f * ih_start) / jpp.SH);
- const size_t iw_hpad = std::ceil((jpp.IW - 1.f * iw_start) / jpp.SW) > jpp.OW
+ std::ceil((IH - 1.F * ih_start) / jpp.SH) > jpp.OH ? jpp.OH : std::ceil((IH + -1.F * ih_start) / jpp.SH);
+ const size_t iw_hpad = std::ceil((jpp.IW - 1.F * iw_start) / jpp.SW) > jpp.OW
? jpp.OW
- : std::ceil((jpp.IW - 1.f * iw_start) / jpp.SW);
+ : std::ceil((jpp.IW - 1.F * iw_start) / jpp.SW);
char* my_dst_ptr = dst_data + (ob * ostrides_partial[0] + kh * ostrides_partial[1] + kw * ostrides_partial[2] +
ic * ostrides_partial[3]) *
@@ -569,13 +575,13 @@ void ExtractImagePatches::ExtractImagePatchesJitExecutor::executeOptimizedGeneri
parallel_for4d(OB, jpp.KH, jpp.KW, IC, [&](const size_t ob, const size_t kh, const size_t kw, const size_t ic) {
const int64_t ih_start = kh * RH - PT;
const int64_t iw_start = kw * RW - PL;
- const size_t ih_lpad = ih_start >= 0 ? 0 : std::ceil(-1.f * ih_start / jpp.SH);
- const size_t iw_lpad = iw_start >= 0 ? 0 : std::ceil(-1.f * iw_start / jpp.SW);
+ const size_t ih_lpad = ih_start >= 0 ? 0 : std::ceil(-1.F * ih_start / jpp.SH);
+ const size_t iw_lpad = iw_start >= 0 ? 0 : std::ceil(-1.F * iw_start / jpp.SW);
const size_t ih_hpad =
- std::ceil((IH - 1.f * ih_start) / jpp.SH) > jpp.OH ? jpp.OH : std::ceil((IH - 1.f * ih_start) / jpp.SH);
- const size_t iw_hpad = std::ceil((jpp.IW - 1.f * iw_start) / jpp.SW) > jpp.OW
+ std::ceil((IH - 1.F * ih_start) / jpp.SH) > jpp.OH ? jpp.OH : std::ceil((IH - 1.F * ih_start) / jpp.SH);
+ const size_t iw_hpad = std::ceil((jpp.IW - 1.F * iw_start) / jpp.SW) > jpp.OW
? jpp.OW
- : std::ceil((jpp.IW - 1.f * iw_start) / jpp.SW);
+ : std::ceil((jpp.IW - 1.F * iw_start) / jpp.SW);
size_t dst_offset =
ob * ostrides_partial[0] + kh * ostrides_partial[1] + kw * ostrides_partial[2] + ic * ostrides_partial[3];
@@ -628,8 +634,8 @@ jit_extract_image_patches_params ExtractImagePatches::ExtractImagePatchesExecuto
const int64_t ihStep = kSizes[0] + (rates[0] - 1) * (kSizes[0] - 1);
const int64_t iwStep = kSizes[1] + (rates[1] - 1) * (kSizes[1] - 1);
- int64_t PW = (std::ceil(1.f * jpp.IW / strides[1]) - 1) * strides[1] + iwStep - jpp.IW;
- int64_t PH = (std::ceil(1.f * IH / strides[0]) - 1) * strides[0] + ihStep - IH;
+ int64_t PW = (std::ceil(1.F * jpp.IW / strides[1]) - 1) * strides[1] + iwStep - jpp.IW;
+ int64_t PH = (std::ceil(1.F * IH / strides[0]) - 1) * strides[0] + ihStep - IH;
int64_t increment_sign = 0;
if (padType == ExtImgPatcherPadType::SAME_LOWER) {
diff --git a/src/plugins/intel_cpu/src/nodes/eye.cpp b/src/plugins/intel_cpu/src/nodes/eye.cpp
index 1448785df21..b0055e86ba5 100644
--- a/src/plugins/intel_cpu/src/nodes/eye.cpp
+++ b/src/plugins/intel_cpu/src/nodes/eye.cpp
@@ -27,7 +27,6 @@
#include "openvino/op/eye.hpp"
#include "selective_build.h"
#include "shape_inference/shape_inference_cpu.hpp"
-#include "utils/bfloat16.hpp"
#include "utils/general_utils.h"
namespace ov::intel_cpu::node {
@@ -59,7 +58,7 @@ Eye::Eye(const std::shared_ptr<ov::Node>& op, const GraphContext::CPtr& context)
}
void Eye::getSupportedDescriptors() {
- if (!one_of(getParentEdges().size(), 3u, 4u)) {
+ if (!one_of(getParentEdges().size(), 3U, 4U)) {
THROW_CPU_NODE_ERR("has incorrect number of input edges: ", getParentEdges().size());
}
if (getChildEdges().empty()) {
@@ -126,11 +125,12 @@ void Eye::executeSpecified() {
const size_t onesPerBatchNum =
static_cast<size_t>(shift > 0 ? std::min(countByColumns, static_cast<int64_t>(rowNum))
: std::min(countByRows, static_cast<int64_t>(colNum)));
- const auto dataShift = static_cast<size_t>(shift >= 0 ? shift : -shift * colNum);
+ const auto dataShift = (shift >= 0 ? shift : -shift * colNum);
if (spatialSize >= l2CacheSize) {
parallel_nt(0, [&](const size_t ithr, const size_t nthr) {
- size_t start = 0, end = 0;
+ size_t start = 0;
+ size_t end = 0;
splitter(elementsCount, nthr, ithr, start, end);
memset(dst + start, 0, (end - start) * sizeof(T));
});
@@ -139,7 +139,8 @@ void Eye::executeSpecified() {
}
for (size_t bShift = 0; bShift < batchVolume * spatialCount; bShift += spatialCount) {
parallel_nt(0, [&](const size_t ithr, const size_t nthr) {
- size_t start = 0, end = 0;
+ size_t start = 0;
+ size_t end = 0;
splitter(onesPerBatchNum, nthr, ithr, start, end);
for (size_t j = start; j < end; j++) {
dst[dataShift + j * (colNum + 1) + bShift] = static_cast<T>(1);
@@ -148,7 +149,8 @@ void Eye::executeSpecified() {
}
} else {
parallel_nt(0, [&](const size_t ithr, const size_t nthr) {
- size_t start = 0, end = 0;
+ size_t start = 0;
+ size_t end = 0;
splitter(batchVolume, nthr, ithr, start, end);
memset(dst + start * spatialCount, 0, (end - start) * spatialSize);
if (onesPerBatchNum == 0) {
diff --git a/src/plugins/intel_cpu/src/nodes/fake_quantize.cpp b/src/plugins/intel_cpu/src/nodes/fake_quantize.cpp
index 979a99b1435..62e0fa91b07 100644
--- a/src/plugins/intel_cpu/src/nodes/fake_quantize.cpp
+++ b/src/plugins/intel_cpu/src/nodes/fake_quantize.cpp
@@ -221,22 +221,22 @@ private:
using Vmm =
typename conditional3<isa == cpu::x64::sse41, Xbyak::Xmm, isa == cpu::x64::avx2, Xbyak::Ymm, Xbyak::Zmm>::type;
- inline Vmm vmm_src(int idx) {
+ Vmm vmm_src(int idx) {
return Vmm(idx);
}
- inline Xmm xmm_src(int idx) {
+ Xmm xmm_src(int idx) {
return Xmm(idx);
}
- inline Vmm vmm_wei(int idx) {
+ Vmm vmm_wei(int idx) {
return Vmm(idx + 4);
}
- inline Vmm vmm_mask(int idx) {
+ Vmm vmm_mask(int idx) {
return Vmm(idx + 5);
}
- inline Xmm xmm_wei(int idx) {
+ Xmm xmm_wei(int idx) {
return Xmm(idx + 4);
}
- inline Xmm xmm_mask(int idx) {
+ Xmm xmm_mask(int idx) {
return Xmm(idx + 5);
}
@@ -289,69 +289,69 @@ private:
using Vmm =
typename conditional3<isa == cpu::x64::sse41, Xbyak::Xmm, isa == cpu::x64::avx2, Xbyak::Ymm, Xbyak::Zmm>::type;
- inline Vmm vmm_val(int idx) {
+ Vmm vmm_val(int idx) {
return Vmm(idx + 0);
}
- inline Vmm vmm_crop_low(int idx) {
+ Vmm vmm_crop_low(int idx) {
return Vmm(idx + 2);
}
- inline Vmm vmm_crop_high(int idx) {
+ Vmm vmm_crop_high(int idx) {
return Vmm(idx + 4);
}
- inline Vmm vmm_input_scale(int idx) {
+ Vmm vmm_input_scale(int idx) {
return Vmm(idx + 6);
}
- inline Vmm vmm_input_shift(int idx) {
+ Vmm vmm_input_shift(int idx) {
return Vmm(idx + 8);
}
- inline Vmm vmm_output_scale(int idx) {
+ Vmm vmm_output_scale(int idx) {
return Vmm(idx + 10);
}
- inline Vmm vmm_output_shift(int idx) {
+ Vmm vmm_output_shift(int idx) {
return Vmm(idx + 12);
}
- inline Ymm ymm_val(int idx) {
+ Ymm ymm_val(int idx) {
return Ymm(idx + 0);
}
- inline Ymm ymm_crop_low(int idx) {
+ Ymm ymm_crop_low(int idx) {
return Ymm(idx + 2);
}
- inline Ymm ymm_crop_high(int idx) {
+ Ymm ymm_crop_high(int idx) {
return Ymm(idx + 4);
}
- inline Ymm ymm_input_scale(int idx) {
+ Ymm ymm_input_scale(int idx) {
return Ymm(idx + 6);
}
- inline Ymm ymm_input_shift(int idx) {
+ Ymm ymm_input_shift(int idx) {
return Ymm(idx + 8);
}
- inline Ymm ymm_output_scale(int idx) {
+ Ymm ymm_output_scale(int idx) {
return Ymm(idx + 10);
}
- inline Ymm ymm_output_shift(int idx) {
+ Ymm ymm_output_shift(int idx) {
return Ymm(idx + 12);
}
- inline Xmm xmm_val(int idx) {
+ Xmm xmm_val(int idx) {
return Xmm(idx + 0);
}
- inline Xmm xmm_crop_low(int idx) {
+ Xmm xmm_crop_low(int idx) {
return Xmm(idx + 2);
}
- inline Xmm xmm_crop_high(int idx) {
+ Xmm xmm_crop_high(int idx) {
return Xmm(idx + 4);
}
- inline Xmm xmm_input_scale(int idx) {
+ Xmm xmm_input_scale(int idx) {
return Xmm(idx + 6);
}
- inline Xmm xmm_input_shift(int idx) {
+ Xmm xmm_input_shift(int idx) {
return Xmm(idx + 8);
}
- inline Xmm xmm_output_scale(int idx) {
+ Xmm xmm_output_scale(int idx) {
return Xmm(idx + 10);
}
- inline Xmm xmm_output_shift(int idx) {
+ Xmm xmm_output_shift(int idx) {
return Xmm(idx + 12);
}
@@ -381,7 +381,7 @@ private:
bool do_rounding = true;
bool do_dequantization = true;
- inline void load_broadcasted_vectors_only(size_t idx) {
+ void load_broadcasted_vectors_only(size_t idx) {
const auto& broadcasted = jqp_.broadcasted;
if (broadcasted[static_cast<size_t>(FQ_add_input_type::CROP_LOW)]) {
uni_vbroadcastss(vmm_crop_low(idx), ptr[reg_crop_low]);
@@ -406,7 +406,7 @@ private:
}
template <typename T>
- inline void load_not_broadcasted_vectors_only(size_t idx, size_t offset) {
+ void load_not_broadcasted_vectors_only(size_t idx, size_t offset) {
const auto& broadcasted = jqp_.broadcasted;
if (!broadcasted[static_cast<size_t>(FQ_add_input_type::CROP_LOW)]) {
uni_vmovups(T(vmm_crop_low(idx).getIdx()), ptr[reg_crop_low + offset]);
@@ -430,7 +430,7 @@ private:
}
}
- inline void increase_ptrs_if_not_broadcasted(size_t offset) {
+ void increase_ptrs_if_not_broadcasted(size_t offset) {
const auto& broadcasted = jqp_.broadcasted;
if (!broadcasted[static_cast<size_t>(FQ_add_input_type::CROP_LOW)]) {
add(reg_crop_low, offset);
@@ -454,7 +454,7 @@ private:
}
}
- inline void compute_planar() {
+ void compute_planar() {
int src_type_size = jqp_.src_prc.size();
int dst_type_size = jqp_.dst_prc.size();
@@ -580,7 +580,7 @@ private:
L(exit_label);
}
- inline void compute_generic() {
+ void compute_generic() {
int src_type_size = jqp_.src_prc.size();
int wei_type_size = jqp_.wei_prc.size();
int dst_type_size = jqp_.dst_prc.size();
@@ -830,7 +830,7 @@ private:
L(exit_label);
}
- inline void load_vector(Zmm zmm_src, const Xbyak::Address& op, ov::element::Type src_prc) {
+ void load_vector(Zmm zmm_src, const Xbyak::Address& op, ov::element::Type src_prc) {
switch (src_prc) {
case ov::element::f32:
case ov::element::i32:
@@ -851,7 +851,7 @@ private:
}
}
- inline void load_vector(Ymm ymm_src, const Xbyak::Address& op, ov::element::Type src_prc) {
+ void load_vector(Ymm ymm_src, const Xbyak::Address& op, ov::element::Type src_prc) {
switch (src_prc) {
case ov::element::f32:
case ov::element::i32:
@@ -872,7 +872,7 @@ private:
}
}
- inline void load_vector(Xmm xmm_src, const Xbyak::Address& op, ov::element::Type src_prc) {
+ void load_vector(Xmm xmm_src, const Xbyak::Address& op, ov::element::Type src_prc) {
switch (src_prc) {
case ov::element::f32:
case ov::element::i32:
@@ -893,7 +893,7 @@ private:
}
}
- inline void load_scalar(Xmm xmm_src, const Xbyak::Address& op, ov::element::Type src_prc) {
+ void load_scalar(Xmm xmm_src, const Xbyak::Address& op, ov::element::Type src_prc) {
switch (src_prc) {
case ov::element::f32:
case ov::element::i32:
@@ -916,7 +916,7 @@ private:
}
}
- inline void store_vector(const Xbyak::Address& op, Zmm zmm_dst, ov::element::Type dst_prc) {
+ void store_vector(const Xbyak::Address& op, Zmm zmm_dst, ov::element::Type dst_prc) {
if (dst_prc != ov::element::f32) {
uni_vcvtps2dq(zmm_dst, zmm_dst);
}
@@ -938,7 +938,7 @@ private:
}
}
- inline void store_vector(const Xbyak::Address& op, Ymm ymm_dst, ov::element::Type dst_prc) {
+ void store_vector(const Xbyak::Address& op, Ymm ymm_dst, ov::element::Type dst_prc) {
auto xmm_dst = Xmm(ymm_dst.getIdx());
if (dst_prc != ov::element::f32) {
@@ -973,7 +973,7 @@ private:
}
}
- inline void store_vector(const Xbyak::Address& op, Xmm xmm_dst, ov::element::Type dst_prc) {
+ void store_vector(const Xbyak::Address& op, Xmm xmm_dst, ov::element::Type dst_prc) {
if (dst_prc != ov::element::f32) {
uni_vcvtps2dq(xmm_dst, xmm_dst);
}
@@ -998,7 +998,7 @@ private:
}
}
- inline void store_scalar(const Xbyak::Address& op, Xmm xmm_dst, ov::element::Type dst_prc) {
+ void store_scalar(const Xbyak::Address& op, Xmm xmm_dst, ov::element::Type dst_prc) {
if (dst_prc != ov::element::f32) {
uni_vcvtps2dq(xmm_dst, xmm_dst);
}
@@ -1071,7 +1071,7 @@ bool FakeQuantize::isSupportedOperation(const std::shared_ptr<const ov::Node>& o
* Long term idea: restore limitation for channel axis 1 and
* support fusing of unfolded FQ (see FakeQuantizeDecomposition transformation)
*/
- if (count_not_unit_axis > 1 || !one_of(not_unit_axis, 1u, 2u)) {
+ if (count_not_unit_axis > 1 || !one_of(not_unit_axis, 1U, 2U)) {
errorMessage = "Supports only per-tensor and per-channel quantizations";
return false;
}
@@ -1215,14 +1215,14 @@ FakeQuantize::FakeQuantize(const std::shared_ptr<ov::Node>& op, const GraphConte
if (binarization) {
for (size_t i = 0; i < outputLowAxisSize; i++) {
- if (outputLowData[i] != 1.f && outputLowData[i] != 0.f) {
+ if (outputLowData[i] != 1.F && outputLowData[i] != 0.F) {
binarization = false;
break;
}
}
for (size_t i = 0; i < outputHighAxisSize; i++) {
- if (outputHighData[i] != 1.f && outputHighData[i] != 0.f) {
+ if (outputHighData[i] != 1.F && outputHighData[i] != 0.F) {
binarization = false;
break;
}
@@ -1250,12 +1250,12 @@ FakeQuantize::FakeQuantize(const std::shared_ptr<ov::Node>& op, const GraphConte
}
if (isOutputHighBroadcasted) {
- binarizationOutputMask.push_back(outputHighData[0] == 1.f ? 0xffffffff : 0x00000000);
+ binarizationOutputMask.push_back(outputHighData[0] == 1.F ? 0xffffffff : 0x00000000);
} else {
CPU_NODE_ASSERT(axisSize != -1, "axisSize is not set");
binarizationOutputMask.resize(rnd_up(axisSize, 16));
for (int i = 0; i < axisSize; i++) {
- binarizationOutputMask[i] = outputHighData[i] == 1.f ? 0xffffffff : 0x00000000;
+ binarizationOutputMask[i] = outputHighData[i] == 1.F ? 0xffffffff : 0x00000000;
}
}
} else {
@@ -1315,7 +1315,7 @@ FakeQuantize::FakeQuantize(const std::shared_ptr<ov::Node>& op, const GraphConte
broadcasted[static_cast<size_t>(FQ_add_input_type::OUTPUT_SCALE)] = outputScaleSize == 1;
broadcasted[static_cast<size_t>(FQ_add_input_type::OUTPUT_SHIFT)] = outputShiftSize == 1;
- if (everyone_is(1u,
+ if (everyone_is(1U,
cropLowSize,
cropHighSize,
inputScaleSize,
@@ -1323,7 +1323,7 @@ FakeQuantize::FakeQuantize(const std::shared_ptr<ov::Node>& op, const GraphConte
outputScaleSize,
outputShiftSize)) {
broadcastingPolicy = PerTensor;
- } else if (one_of(1u,
+ } else if (one_of(1U,
cropLowSize,
cropHighSize,
inputScaleSize,
@@ -1379,7 +1379,7 @@ FakeQuantize::FakeQuantize(const std::shared_ptr<ov::Node>& op, const GraphConte
outputScale[i] = (oh - ol) / (levels - 1);
#endif
- if (outputScale[i] != 1.f) {
+ if (outputScale[i] != 1.F) {
quantizationOnly = false;
}
}
@@ -1389,7 +1389,7 @@ FakeQuantize::FakeQuantize(const std::shared_ptr<ov::Node>& op, const GraphConte
outputShift[i] = ol;
- if (outputShift[i] != 0.f) {
+ if (outputShift[i] != 0.F) {
quantizationOnly = false;
}
}
@@ -1407,7 +1407,7 @@ FakeQuantize::FakeQuantize(const std::shared_ptr<ov::Node>& op, const GraphConte
isFakeQuantization = isFakeQuantization && il == ol && ih == oh;
isFakeQuantizationWithScale = isFakeQuantizationWithScale && il != ih && ol != oh &&
- (abs(ol / (oh - ol) - il / (ih - il)) < 0.001f);
+ (abs(ol / (oh - ol) - il / (ih - il)) < 0.001F);
}
if (isFakeQuantizationWithScale) {
@@ -1440,7 +1440,7 @@ std::vector<LayoutType> FakeQuantize::getDataFormats() const {
if (isBinarization()) {
return {LayoutType::nspc};
}
- if (one_of(dims.size(), 4u, 5u)) {
+ if (one_of(dims.size(), 4U, 5U)) {
if (getAxis() == 1) {
auto blkFormat = mayiuse(cpu::x64::avx512_core) ? LayoutType::nCsp16c : LayoutType::nCsp8c;
return {blkFormat, LayoutType::nspc, LayoutType::ncsp};
@@ -1483,7 +1483,7 @@ void FakeQuantize::getSupportedDescriptors() {
}
if (isBinarization()) {
- if (getInputShapeAtPort(0).getRank() != 4ul) {
+ if (getInputShapeAtPort(0).getRank() != 4UL) {
THROW_CPU_NODE_ERR("doesn't support input/output rank != 4");
}
}
@@ -1592,13 +1592,14 @@ void FakeQuantize::prepareParams() {
memory::data_type::f32,
memory::format_tag::x);
constexpr size_t numBinFqIntBlob = 2;
- bool needUpdThr = false, needUpdMask = false;
+ bool needUpdThr = false;
+ bool needUpdMask = false;
if (isInputLowBroadcasted && axisSize != currentAxisSize) {
binarizationThresholds.resize(newPaddedSize);
std::fill(binarizationThresholds.begin() + 1,
binarizationThresholds.begin() + axisSize,
binarizationThresholds[0]);
- std::fill(binarizationThresholds.begin() + axisSize, binarizationThresholds.end(), 0.f);
+ std::fill(binarizationThresholds.begin() + axisSize, binarizationThresholds.end(), 0.F);
needUpdThr = true;
}
@@ -1653,7 +1654,7 @@ void FakeQuantize::createPrimitive() {
const auto& srcMemory = getParentEdgeAt(0)->getMemory();
const auto& srcDesc = srcMemory.getDesc();
- key.jqp.is_planar = srcDesc.hasLayoutType(LayoutType::ncsp) && one_of(srcDesc.getShape().getRank(), 3u, 4u, 5u);
+ key.jqp.is_planar = srcDesc.hasLayoutType(LayoutType::ncsp) && one_of(srcDesc.getShape().getRank(), 3U, 4U, 5U);
key.jqp.op_type = getAlgorithm();
if (isBinarization()) {
@@ -1855,8 +1856,8 @@ void FakeQuantize::executeQuantization(const std::unique_ptr<jit_uni_quantize_ke
const auto& srcDesc = srcMemory->getDesc();
auto srcDims = srcDesc.getShape().getStaticDims();
- bool is_blk_format = !srcDesc.hasLayoutType(LayoutType::nspc) && one_of(srcDesc.getShape().getRank(), 4u, 5u);
- int blk_size = (srcDesc.hasLayoutType(LayoutType::ncsp) && one_of(srcDesc.getShape().getRank(), 3u, 4u, 5u)) ? 1
+ bool is_blk_format = !srcDesc.hasLayoutType(LayoutType::nspc) && one_of(srcDesc.getShape().getRank(), 4U, 5U);
+ int blk_size = (srcDesc.hasLayoutType(LayoutType::ncsp) && one_of(srcDesc.getShape().getRank(), 3U, 4U, 5U)) ? 1
: mayiuse(cpu::x64::avx512_core) ? 16
: 8;
@@ -1871,7 +1872,7 @@ void FakeQuantize::executeQuantization(const std::unique_ptr<jit_uni_quantize_ke
s_str[1] /= blk_size;
}
- if (srcDesc.hasLayoutType(LayoutType::nspc) && one_of(srcDesc.getShape().getRank(), 4u, 5u)) {
+ if (srcDesc.hasLayoutType(LayoutType::nspc) && one_of(srcDesc.getShape().getRank(), 4U, 5U)) {
size_t tmp = s_str[s_str.size() - 1];
for (int i = s_str.size() - 1; i > 1; i--) {
s_str[i] = s_str[i - 1];
@@ -1896,17 +1897,17 @@ void FakeQuantize::executeQuantization(const std::unique_ptr<jit_uni_quantize_ke
arg.from = &src[data_off * src_type_size];
arg.to = &dst[data_off * dst_type_size];
- arg.crop_low = broadcasted[static_cast<size_t>(FQ_add_input_type::CROP_LOW)] ? &cropLow[0] : &cropLow[c];
+ arg.crop_low = broadcasted[static_cast<size_t>(FQ_add_input_type::CROP_LOW)] ? cropLow.data() : &cropLow[c];
arg.crop_high =
- broadcasted[static_cast<size_t>(FQ_add_input_type::CROP_HIGH)] ? &cropHigh[0] : &cropHigh[c];
+ broadcasted[static_cast<size_t>(FQ_add_input_type::CROP_HIGH)] ? cropHigh.data() : &cropHigh[c];
arg.input_scale =
- broadcasted[static_cast<size_t>(FQ_add_input_type::INPUT_SCALE)] ? &inputScale[0] : &inputScale[c];
+ broadcasted[static_cast<size_t>(FQ_add_input_type::INPUT_SCALE)] ? inputScale.data() : &inputScale[c];
arg.input_shift =
- broadcasted[static_cast<size_t>(FQ_add_input_type::INPUT_SHIFT)] ? &inputShift[0] : &inputShift[c];
- arg.output_scale =
- broadcasted[static_cast<size_t>(FQ_add_input_type::OUTPUT_SCALE)] ? &outputScale[0] : &outputScale[c];
- arg.output_shift =
- broadcasted[static_cast<size_t>(FQ_add_input_type::OUTPUT_SHIFT)] ? &outputShift[0] : &outputShift[c];
+ broadcasted[static_cast<size_t>(FQ_add_input_type::INPUT_SHIFT)] ? inputShift.data() : &inputShift[c];
+ arg.output_scale = broadcasted[static_cast<size_t>(FQ_add_input_type::OUTPUT_SCALE)] ? outputScale.data()
+ : &outputScale[c];
+ arg.output_shift = broadcasted[static_cast<size_t>(FQ_add_input_type::OUTPUT_SHIFT)] ? outputShift.data()
+ : &outputShift[c];
arg.src_step = static_cast<size_t>(blk_size) * src_type_size;
arg.dst_step = static_cast<size_t>(blk_size) * dst_type_size;
@@ -1931,17 +1932,17 @@ void FakeQuantize::executeQuantization(const std::unique_ptr<jit_uni_quantize_ke
arg.from = &src[data_off * src_type_size];
arg.to = &dst[data_off * dst_type_size];
- arg.crop_low = broadcasted[static_cast<size_t>(FQ_add_input_type::CROP_LOW)] ? &cropLow[0] : &cropLow[c];
+ arg.crop_low = broadcasted[static_cast<size_t>(FQ_add_input_type::CROP_LOW)] ? cropLow.data() : &cropLow[c];
arg.crop_high =
- broadcasted[static_cast<size_t>(FQ_add_input_type::CROP_HIGH)] ? &cropHigh[0] : &cropHigh[c];
+ broadcasted[static_cast<size_t>(FQ_add_input_type::CROP_HIGH)] ? cropHigh.data() : &cropHigh[c];
arg.input_scale =
- broadcasted[static_cast<size_t>(FQ_add_input_type::INPUT_SCALE)] ? &inputScale[0] : &inputScale[c];
+ broadcasted[static_cast<size_t>(FQ_add_input_type::INPUT_SCALE)] ? inputScale.data() : &inputScale[c];
arg.input_shift =
- broadcasted[static_cast<size_t>(FQ_add_input_type::INPUT_SHIFT)] ? &inputShift[0] : &inputShift[c];
- arg.output_scale =
- broadcasted[static_cast<size_t>(FQ_add_input_type::OUTPUT_SCALE)] ? &outputScale[0] : &outputScale[c];
- arg.output_shift =
- broadcasted[static_cast<size_t>(FQ_add_input_type::OUTPUT_SHIFT)] ? &outputShift[0] : &outputShift[c];
+ broadcasted[static_cast<size_t>(FQ_add_input_type::INPUT_SHIFT)] ? inputShift.data() : &inputShift[c];
+ arg.output_scale = broadcasted[static_cast<size_t>(FQ_add_input_type::OUTPUT_SCALE)] ? outputScale.data()
+ : &outputScale[c];
+ arg.output_shift = broadcasted[static_cast<size_t>(FQ_add_input_type::OUTPUT_SHIFT)] ? outputShift.data()
+ : &outputShift[c];
arg.src_step =
is_blk_format ? static_cast<size_t>(blk_size) * src_type_size : static_cast<size_t>(C) * src_type_size;
@@ -1965,17 +1966,17 @@ void FakeQuantize::executeQuantization(const std::unique_ptr<jit_uni_quantize_ke
arg.from = &src[data_off * src_type_size];
arg.to = &dst[data_off * dst_type_size];
- arg.crop_low = broadcasted[static_cast<size_t>(FQ_add_input_type::CROP_LOW)] ? &cropLow[0] : &cropLow[c];
+ arg.crop_low = broadcasted[static_cast<size_t>(FQ_add_input_type::CROP_LOW)] ? cropLow.data() : &cropLow[c];
arg.crop_high =
- broadcasted[static_cast<size_t>(FQ_add_input_type::CROP_HIGH)] ? &cropHigh[0] : &cropHigh[c];
+ broadcasted[static_cast<size_t>(FQ_add_input_type::CROP_HIGH)] ? cropHigh.data() : &cropHigh[c];
arg.input_scale =
- broadcasted[static_cast<size_t>(FQ_add_input_type::INPUT_SCALE)] ? &inputScale[0] : &inputScale[c];
+ broadcasted[static_cast<size_t>(FQ_add_input_type::INPUT_SCALE)] ? inputScale.data() : &inputScale[c];
arg.input_shift =
- broadcasted[static_cast<size_t>(FQ_add_input_type::INPUT_SHIFT)] ? &inputShift[0] : &inputShift[c];
- arg.output_scale =
- broadcasted[static_cast<size_t>(FQ_add_input_type::OUTPUT_SCALE)] ? &outputScale[0] : &outputScale[c];
- arg.output_shift =
- broadcasted[static_cast<size_t>(FQ_add_input_type::OUTPUT_SHIFT)] ? &outputShift[0] : &outputShift[c];
+ broadcasted[static_cast<size_t>(FQ_add_input_type::INPUT_SHIFT)] ? inputShift.data() : &inputShift[c];
+ arg.output_scale = broadcasted[static_cast<size_t>(FQ_add_input_type::OUTPUT_SCALE)] ? outputScale.data()
+ : &outputScale[c];
+ arg.output_shift = broadcasted[static_cast<size_t>(FQ_add_input_type::OUTPUT_SHIFT)] ? outputShift.data()
+ : &outputShift[c];
arg.src_step =
is_blk_format ? static_cast<size_t>(blk_size) * src_type_size : static_cast<size_t>(C) * src_type_size;
@@ -2018,13 +2019,13 @@ void FakeQuantize::initializePostOpData(const VectorDims& dims, const size_t buf
std::fill(binarizationThresholds.begin() + 1,
binarizationThresholds.begin() + realAxisSize,
binarizationThresholds[0]);
- std::fill(binarizationThresholds.begin() + realAxisSize, binarizationThresholds.end(), 0.f);
+ std::fill(binarizationThresholds.begin() + realAxisSize, binarizationThresholds.end(), 0.F);
}
if (isOutputHighBroadcasted) {
std::fill(binarizationOutputMask.begin() + 1,
binarizationOutputMask.begin() + realAxisSize,
binarizationOutputMask[0]);
- std::fill(binarizationThresholds.begin() + realAxisSize, binarizationThresholds.end(), 0.f);
+ std::fill(binarizationThresholds.begin() + realAxisSize, binarizationThresholds.end(), 0.F);
}
} else {
updateOptimizedFormula(doRounding);
@@ -2049,13 +2050,13 @@ void FakeQuantize::initializePostOpDataLegacy(const VectorDims& dims, const size
std::fill(binarizationThresholds.begin() + 1,
binarizationThresholds.begin() + realAxisSize,
binarizationThresholds[0]);
- std::fill(binarizationThresholds.begin() + realAxisSize, binarizationThresholds.end(), 0.f);
+ std::fill(binarizationThresholds.begin() + realAxisSize, binarizationThresholds.end(), 0.F);
}
if (isOutputHighBroadcasted) {
std::fill(binarizationOutputMask.begin() + 1,
binarizationOutputMask.begin() + realAxisSize,
binarizationOutputMask[0]);
- std::fill(binarizationThresholds.begin() + realAxisSize, binarizationThresholds.end(), 0.f);
+ std::fill(binarizationThresholds.begin() + realAxisSize, binarizationThresholds.end(), 0.F);
}
} else {
@@ -2107,8 +2108,8 @@ void FakeQuantize::appendPostOpsImpl(dnnl::post_ops& ops, const VectorDims& post
if (getAlgorithm() == Algorithm::FQBinarization) {
ops.append_binarization(dnnl::algorithm::binarization_depthwise,
- (const float*)&binarizationThresholds[0],
- reinterpret_cast<const float*>(&binarizationOutputMask[0]));
+ (const float*)binarizationThresholds.data(),
+ reinterpret_cast<const float*>(binarizationOutputMask.data()));
} else {
dnnl::algorithm alg = getAlgorithm() == Algorithm::FQQuantization
? dnnl::algorithm::quantization_quantize
@@ -2123,22 +2124,22 @@ void FakeQuantize::appendPostOpsImpl(dnnl::post_ops& ops, const VectorDims& post
std::array<bool, 6> all_default = {false};
all_default[0] = std::all_of(cropLow.cbegin(), cropLow.cend(), [](float val) {
- return val == 0.f;
+ return val == 0.F;
});
all_default[1] = std::all_of(cropHigh.cbegin(), cropHigh.cend(), [](float val) {
- return val == 0.f;
+ return val == 0.F;
});
all_default[2] = std::all_of(inputScale.cbegin(), inputScale.cend(), [](float val) {
- return val == 1.f;
+ return val == 1.F;
});
all_default[3] = std::all_of(inputShift.cbegin(), inputShift.cend(), [](float val) {
- return val == 0.f;
+ return val == 0.F;
});
all_default[4] = std::all_of(outputScale.cbegin(), outputScale.cend(), [](float val) {
- return val == 1.f;
+ return val == 1.F;
});
all_default[5] = std::all_of(outputShift.cbegin(), outputShift.cend(), [](float val) {
- return val == 0.f;
+ return val == 0.F;
});
std::array<size_t, 6> offsets = {0};
@@ -2178,12 +2179,12 @@ void FakeQuantize::appendPostOps(dnnl::post_ops& ops,
static float roundHalfToEven(float f) {
const float RHAFZ = std::round(f); // r is round-half-away-from-zero
const float d = RHAFZ - f; // f + d -> RHAFZ
- if ((d != 0.5f) && (d != -0.5f)) {
+ if ((d != 0.5F) && (d != -0.5F)) {
return RHAFZ;
}
// already even +/-1.5 -> +/-2
- if (std::fmod(RHAFZ, 2.0f) == 0.0f) {
+ if (std::fmod(RHAFZ, 2.0F) == 0.0F) {
return RHAFZ;
}
@@ -2221,7 +2222,7 @@ void FakeQuantize::updateOptimizedFormula(bool do_rounding) {
// per-channel input shift, this threshold was chosen carefully
// to recorver the per-Tensor nature w/o mistaking a real
// per-channel FQ.
- if (isPerTensor(inputShift, inputShift[0], 0.00005f)) {
+ if (isPerTensor(inputShift, inputShift[0], 0.00005F)) {
f.ish.resize(OC);
for (auto& v : f.ish) {
v = inputShift[0];
@@ -2285,7 +2286,7 @@ void FakeQuantize::updateOptimizedFormula(bool do_rounding) {
f.shrinkLength();
- if (f.osc.size() == 1 && f.osc[0] == 1.0f && f.osh.size() == 1 && f.osh[0] == std::trunc(f.osh[0])) {
+ if (f.osc.size() == 1 && f.osc[0] == 1.0F && f.osh.size() == 1 && f.osh[0] == std::trunc(f.osh[0])) {
// if outputScale == 1.0f and outputShift is interger, it can be further optimized
// x = clip2(round(x * inputScale + ish),c2lo,c2hi)*osc + osh
// = clip2(round(x * inputScale + ish),c2lo,c2hi) + osh
@@ -2307,8 +2308,8 @@ void FakeQuantize::updateOptimizedFormula(bool do_rounding) {
// we can save an additional eltwise linear for negligible shift
if (f.ish.size() == 1 && f.clo.size() == 1 && f.chi.size() == 1) {
auto range = (f.chi[0] - f.clo[0]);
- if (abs(f.ish[0]) < range * 0.00001f) {
- f.ish[0] = 0.0f;
+ if (abs(f.ish[0]) < range * 0.00001F) {
+ f.ish[0] = 0.0F;
}
}
}
@@ -2355,10 +2356,10 @@ bool FakeQuantize::appendAttrPostOps(DnnlPostOpsComposerLegacy& dnnlpoc,
// round & clip2 can be further optimized since saturation will be performed by oneDNN by default
bool skipRoundClipOutputLinear = false;
if (isLastPostOp && (levels == 256) && f.clo.size() == 1 && f.chi.size() == 1 && f.osc.empty() && f.osh.empty()) {
- if (outDataType == memory::data_type::u8 && f.clo[0] <= 0.0f && f.chi[0] >= 255.0f) {
+ if (outDataType == memory::data_type::u8 && f.clo[0] <= 0.0F && f.chi[0] >= 255.0F) {
skipRoundClipOutputLinear = true;
}
- if (outDataType == memory::data_type::s8 && f.clo[0] <= -128.0f && f.chi[0] >= 127.0f) {
+ if (outDataType == memory::data_type::s8 && f.clo[0] <= -128.0F && f.chi[0] >= 127.0F) {
skipRoundClipOutputLinear = true;
}
}
diff --git a/src/plugins/intel_cpu/src/nodes/fake_quantize.h b/src/plugins/intel_cpu/src/nodes/fake_quantize.h
index 0987e36e84c..00b21733564 100644
--- a/src/plugins/intel_cpu/src/nodes/fake_quantize.h
+++ b/src/plugins/intel_cpu/src/nodes/fake_quantize.h
@@ -246,7 +246,10 @@ private:
void executeQuantization(const std::unique_ptr<jit_uni_quantize_kernel>& pKernel) const;
void appendMemory(const size_t dataSize, const void* data, MemoryPtr& memPtr, std::vector<MemoryPtr>& postOpsMem);
- void appendMemory(const size_t dataSize, const void* data, MemoryPtr& memPtr, std::vector<const void*>& postOpsMem);
+ static void appendMemory(const size_t dataSize,
+ const void* data,
+ MemoryPtr& memPtr,
+ std::vector<const void*>& postOpsMem);
template <typename T>
void appendPostOpsImpl(dnnl::post_ops& ops, const VectorDims& postOpDims, std::vector<T>& postOpsMem);
diff --git a/src/plugins/intel_cpu/src/nodes/fullyconnected.cpp b/src/plugins/intel_cpu/src/nodes/fullyconnected.cpp
index 18c6b9a6fb7..7640a525f13 100644
--- a/src/plugins/intel_cpu/src/nodes/fullyconnected.cpp
+++ b/src/plugins/intel_cpu/src/nodes/fullyconnected.cpp
@@ -504,7 +504,7 @@ static bool useSparseWeightsDecompression(const NodePtr& weightsInput,
const float sparseWeiDecompressionRate) {
const auto minSparseRate = sparseWeiDecompressionRate;
- if (minSparseRate == 1.f) {
+ if (minSparseRate == 1.F) {
return false;
}
diff --git a/src/plugins/intel_cpu/src/nodes/gather.cpp b/src/plugins/intel_cpu/src/nodes/gather.cpp
index 977152cfd05..173c8ad2416 100644
--- a/src/plugins/intel_cpu/src/nodes/gather.cpp
+++ b/src/plugins/intel_cpu/src/nodes/gather.cpp
@@ -85,7 +85,7 @@ Gather::Gather(const std::shared_ptr<ov::Node>& op, const GraphContext::CPtr& co
OPENVINO_THROW_NOT_IMPLEMENTED(errorMessage);
}
- if (one_of(op->get_input_size(), 4u, 5u) && op->get_output_size() == 1u) {
+ if (one_of(op->get_input_size(), 4U, 5U) && op->get_output_size() == 1U) {
compressed = true;
} else if (op->get_input_size() != 3 || op->get_output_size() != 1) {
THROW_CPU_NODE_ERR("has incorrect number of input/output edges!");
@@ -98,7 +98,7 @@ Gather::Gather(const std::shared_ptr<ov::Node>& op, const GraphContext::CPtr& co
const auto& idxShape = getInputShapeAtPort(GATHER_INDICES);
isIdxShapeStat = idxShape.isStatic();
const auto indicesRank = idxShape.getRank();
- if (dataSrcRank == 0lu || indicesRank == 0lu) {
+ if (dataSrcRank == 0LU || indicesRank == 0LU) {
THROW_CPU_NODE_ERR("has incorrect input parameters ranks.");
}
@@ -109,11 +109,7 @@ Gather::Gather(const std::shared_ptr<ov::Node>& op, const GraphContext::CPtr& co
// and sets the dontReverseIndices flag.
const auto& rti = op->get_rt_info();
const auto& reverse = rti.find("dontReverseIndices");
- if (reverse == rti.end()) {
- reverseIndexing = true;
- } else {
- reverseIndexing = false;
- }
+ reverseIndexing = reverse == rti.end();
} else if (ov::is_type<ov::op::v7::Gather>(op)) {
batchDims = static_cast<int>(ov::as_type_ptr<ov::op::v7::Gather>(op)->get_batch_dims());
reverseIndexing = false;
@@ -125,7 +121,7 @@ Gather::Gather(const std::shared_ptr<ov::Node>& op, const GraphContext::CPtr& co
if (batchDims < 0) {
batchDims += indicesRank;
}
- if (batchDims < 0 || batchDims > std::min(static_cast<int>(dataSrcRank), static_cast<int>(indicesRank))) {
+ if (batchDims < 0 || batchDims > std::min(dataSrcRank, static_cast<int>(indicesRank))) {
THROW_CPU_NODE_ERR("has incorrect batch_dims ", batchDims, "!");
}
@@ -162,10 +158,10 @@ void Gather::initSupportedPrimitiveDescriptors() {
const auto& dataDims = getInputShapeAtPort(GATHER_DATA).getDims();
if (isAxisInputConst && isDataShapeStat) {
axisDim = dataDims[axis];
- beforeAxisSize = std::accumulate(dataDims.begin(), dataDims.begin() + axis, 1lu, std::multiplies<>());
+ beforeAxisSize = std::accumulate(dataDims.begin(), dataDims.begin() + axis, 1LU, std::multiplies<>());
betweenBatchAndAxisSize =
- std::accumulate(dataDims.begin() + batchDims, dataDims.begin() + axis, 1lu, std::multiplies<>());
- afterAxisSize = std::accumulate(dataDims.begin() + axis + 1, dataDims.end(), 1lu, std::multiplies<>());
+ std::accumulate(dataDims.begin() + batchDims, dataDims.begin() + axis, 1LU, std::multiplies<>());
+ afterAxisSize = std::accumulate(dataDims.begin() + axis + 1, dataDims.end(), 1LU, std::multiplies<>());
afterAxisSizeInBytes = afterAxisSize * dataTypeSize;
afterAxisSizeInBytesOut = afterAxisSize * outTypeSize;
@@ -175,11 +171,11 @@ void Gather::initSupportedPrimitiveDescriptors() {
srcAfterBatchSizeInBytes = betweenBatchAndAxisSize * axisAndAfterAxisSizeInBytes;
}
if (isDataShapeStat) {
- beforeBatchSize = std::accumulate(dataDims.begin(), dataDims.begin() + batchDims, 1lu, std::multiplies<>());
+ beforeBatchSize = std::accumulate(dataDims.begin(), dataDims.begin() + batchDims, 1LU, std::multiplies<>());
}
if (isIdxShapeStat) {
const auto& idxDims = getInputShapeAtPort(GATHER_INDICES).getDims();
- specIndicesSize = std::accumulate(idxDims.begin() + batchDims, idxDims.end(), 1lu, std::multiplies<>());
+ specIndicesSize = std::accumulate(idxDims.begin() + batchDims, idxDims.end(), 1LU, std::multiplies<>());
if (isDataShapeStat) {
specIdxAndAfterAxSize = specIndicesSize * afterAxisSize;
@@ -204,16 +200,16 @@ void Gather::initSupportedPrimitiveDescriptors() {
}
scale_group_size =
getInputShapeAtPort(GATHER_DATA).getElementsCount() / getInputShapeAtPort(GATHER_SCALE).getElementsCount();
- have_scalar_scale = getInputShapeAtPort(GATHER_SCALE).getElementsCount() == 1u;
+ have_scalar_scale = getInputShapeAtPort(GATHER_SCALE).getElementsCount() == 1U;
- if (getOriginalInputsNumber() == 5u) {
+ if (getOriginalInputsNumber() == 5U) {
ov::element::Type zpPrecision = getOriginalInputPrecisionAtPort(GATHER_ZP);
if (zpPrecision != ov::element::f32) {
zpPrecision = ov::element::f32;
}
have_zp = true;
- have_scalar_zp = getInputShapeAtPort(GATHER_ZP).getElementsCount() == 1u;
+ have_scalar_zp = getInputShapeAtPort(GATHER_ZP).getElementsCount() == 1U;
zp_group_size =
getInputShapeAtPort(GATHER_DATA).getElementsCount() / getInputShapeAtPort(GATHER_ZP).getElementsCount();
addSupportedPrimDesc({{LayoutType::ncsp, dataPrecision},
@@ -346,7 +342,7 @@ void Gather::createPrimitive() {
p.idxBatchSumInBytes.resize(dataElPerVec);
p.dataBeforeAxisSumInBytes.resize(dataElPerVec);
p.betweenBatchAndAxisIter = (dstStart / specIndicesSize) % betweenBatchAndAxisSize;
- for (uint64_t j = 0lu; j < dataElPerVec; j++) {
+ for (uint64_t j = 0LU; j < dataElPerVec; j++) {
p.specIdxInBytes[j] = (((dstStart + j) / afterAxisSize) % specIndicesSize) * idxTypeSize;
p.idxBatchSumInBytes[j] =
((dstStart + j) / (betweenBatchAndAxisSize * specIndicesSize * afterAxisSize)) *
@@ -412,10 +408,10 @@ void Gather::prepareParams() {
if (!isDataShapeStat || !isAxisInputConst) {
const auto& dataDims = dataMemPtr->getStaticDims();
axisDim = dataDims[axis];
- beforeBatchSize = std::accumulate(dataDims.begin(), dataDims.begin() + batchDims, 1lu, std::multiplies<>());
+ beforeBatchSize = std::accumulate(dataDims.begin(), dataDims.begin() + batchDims, 1LU, std::multiplies<>());
betweenBatchAndAxisSize =
- std::accumulate(dataDims.begin() + batchDims, dataDims.begin() + axis, 1lu, std::multiplies<>());
- afterAxisSize = std::accumulate(dataDims.begin() + axis + 1, dataDims.end(), 1lu, std::multiplies<>());
+ std::accumulate(dataDims.begin() + batchDims, dataDims.begin() + axis, 1LU, std::multiplies<>());
+ afterAxisSize = std::accumulate(dataDims.begin() + axis + 1, dataDims.end(), 1LU, std::multiplies<>());
afterAxisSizeInBytes = afterAxisSize * dataTypeSize;
afterAxisSizeInBytesOut = afterAxisSize * outTypeSize;
@@ -434,7 +430,7 @@ void Gather::prepareParams() {
if (!isIdxShapeStat) {
const auto& idxDims = idxMemPtr->getStaticDims();
- specIndicesSize = std::accumulate(idxDims.begin() + batchDims, idxDims.end(), 1lu, std::multiplies<>());
+ specIndicesSize = std::accumulate(idxDims.begin() + batchDims, idxDims.end(), 1LU, std::multiplies<>());
specIdxAndAfterAxSize = specIndicesSize * afterAxisSize;
specIdxAndAfterAxSizeB = specIndicesSize * afterAxisSizeInBytes;
@@ -654,7 +650,7 @@ void Gather::initShortParams(threadExecParams& p, const uint64_t start) {
p.afterAxIdxInBytes[i] *= dataTypeSize;
p.afterAxPermMask[i] = idxElPerVec - afterAxisSize + i;
- for (size_t j = 0lu; j < 6lu; j++) {
+ for (size_t j = 0LU; j < 6LU; j++) {
if (static_cast<uint64_t>(p.afterAxPermMask[i]) >= idxElPerVec) {
p.afterAxPermMask[i] -= afterAxisSize;
}
diff --git a/src/plugins/intel_cpu/src/nodes/gather_elements.cpp b/src/plugins/intel_cpu/src/nodes/gather_elements.cpp
index b0ad71575c0..c4249e038ac 100644
--- a/src/plugins/intel_cpu/src/nodes/gather_elements.cpp
+++ b/src/plugins/intel_cpu/src/nodes/gather_elements.cpp
@@ -123,7 +123,8 @@ void GatherElements::directExecution() {
const int outSize = getChildEdgeAt(0)->getMemory().getShape().getElementsCount();
auto threadBody = [&](const int ithr, const int nthr) {
- int start(0lu), end(0lu);
+ int start(0LU);
+ int end(0LU);
splitter(outSize, nthr, ithr, start, end);
if (start >= end) {
return;
diff --git a/src/plugins/intel_cpu/src/nodes/gather_nd.cpp b/src/plugins/intel_cpu/src/nodes/gather_nd.cpp
index 5a6f7a67a49..f45f086e2a0 100644
--- a/src/plugins/intel_cpu/src/nodes/gather_nd.cpp
+++ b/src/plugins/intel_cpu/src/nodes/gather_nd.cpp
@@ -200,7 +200,8 @@ void GatherND::GatherNDExecutor::gatherBlocks(const MemoryPtr& srcMemPtr,
auto* dstData = dstMemPtr->getDataAs<uint8_t>();
parallel_nt(0, [&](const int ithr, const int nthr) {
- size_t start(0lu), end(0lu);
+ size_t start(0LU);
+ size_t end(0LU);
splitter(workAmount, nthr, ithr, start, end);
if (start >= end) {
return;
@@ -215,7 +216,7 @@ void GatherND::GatherNDExecutor::gatherBlocks(const MemoryPtr& srcMemPtr,
for (size_t b = bStart; b < batchSize; b++) {
for (size_t j = cStart; j < cycles; j++) {
- size_t dataIdx = 0lu;
+ size_t dataIdx = 0LU;
for (size_t i = 0; i < sliceRank; i++) {
dataIdx += srcShifts[i] * shiftedIndices[i];
}
@@ -241,7 +242,8 @@ void GatherND::GatherNDExecutor::gatherElementwise(const MemoryPtr& srcMemPtr,
auto* dstData = dstMemPtr->getDataAs<dataType>();
parallel_nt(0, [&](const int ithr, const int nthr) {
- size_t start(0lu), end(0lu);
+ size_t start(0LU);
+ size_t end(0LU);
splitter(workAmount, nthr, ithr, start, end);
if (start >= end) {
return;
@@ -256,8 +258,8 @@ void GatherND::GatherNDExecutor::gatherElementwise(const MemoryPtr& srcMemPtr,
for (size_t b = bStart; b < batchSize; b++) {
for (size_t j = cStart; j < cycles; j++) {
- size_t dataIdx = 0lu;
- for (size_t i = 0lu; i < sliceRank; i++) {
+ size_t dataIdx = 0LU;
+ for (size_t i = 0LU; i < sliceRank; i++) {
dataIdx += srcShifts[i] * shiftedIndices[i];
}
shiftedDstData[0] = shiftedSrcData[dataIdx];
@@ -267,7 +269,7 @@ void GatherND::GatherNDExecutor::gatherElementwise(const MemoryPtr& srcMemPtr,
return;
}
}
- cStart = 0lu;
+ cStart = 0LU;
shiftedSrcData += srcBatchStride;
}
});
diff --git a/src/plugins/intel_cpu/src/nodes/gather_tree.cpp b/src/plugins/intel_cpu/src/nodes/gather_tree.cpp
index 8b3b1f681cf..bf986dd2b84 100644
--- a/src/plugins/intel_cpu/src/nodes/gather_tree.cpp
+++ b/src/plugins/intel_cpu/src/nodes/gather_tree.cpp
@@ -161,7 +161,7 @@ GatherTree::GatherTreeExecutor::GatherTreeExecutor(const VectorDims& stepIdxDims
batchSize{stepIdxDims[1]},
beamWidth{stepIdxDims[2]},
bbSize{batchSize * beamWidth},
- parentIdxSize{std::accumulate(parentIdxDims.cbegin(), parentIdxDims.cend(), 1lu, std::multiplies<>())} {
+ parentIdxSize{std::accumulate(parentIdxDims.cbegin(), parentIdxDims.cend(), 1LU, std::multiplies<>())} {
if (maxTime != static_cast<int32_t>(parentIdxDims[0]) || maxTime != static_cast<int32_t>(dstDims[0]) ||
batchSize != parentIdxDims[1] || batchSize != dstDims[1] || batchSize != maxSeqLenDims[0] ||
beamWidth != parentIdxDims[2] || beamWidth != dstDims[2]) {
@@ -186,7 +186,8 @@ 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, idx = (maxTime - 1) * bbSize + batch * beamWidth;
+ int32_t time;
+ int32_t idx = (maxTime - 1) * bbSize + batch * beamWidth;
for (time = (maxTime - 1); time >= maxSequenceInBeam; time--, idx -= bbSize) {
finalIdx[idx + beam] = endToken;
}
diff --git a/src/plugins/intel_cpu/src/nodes/generate_proposals.cpp b/src/plugins/intel_cpu/src/nodes/generate_proposals.cpp
index 861b48459c6..2cf421a3cc7 100644
--- a/src/plugins/intel_cpu/src/nodes/generate_proposals.cpp
+++ b/src/plugins/intel_cpu/src/nodes/generate_proposals.cpp
@@ -84,8 +84,8 @@ void refine_anchors(const float* deltas,
const float ww = x1 - x0 + coordinates_offset;
const float hh = y1 - y0 + coordinates_offset;
// center location of box
- const float ctr_x = x0 + 0.5f * ww;
- const float ctr_y = y0 + 0.5f * hh;
+ const float ctr_x = x0 + 0.5F * ww;
+ const float ctr_y = y0 + 0.5F * hh;
// new center location according to deltas (dx, dy)
const float pred_ctr_x = dx * ww + ctr_x;
@@ -95,17 +95,17 @@ void refine_anchors(const float* deltas,
const float pred_h = std::exp(std::min(d_log_h, max_delta_log_wh)) * hh;
// update upper-left corner location
- x0 = pred_ctr_x - 0.5f * pred_w;
- y0 = pred_ctr_y - 0.5f * pred_h;
+ x0 = pred_ctr_x - 0.5F * pred_w;
+ y0 = pred_ctr_y - 0.5F * pred_h;
// update lower-right corner location
- x1 = pred_ctr_x + 0.5f * pred_w - coordinates_offset;
- y1 = pred_ctr_y + 0.5f * pred_h - coordinates_offset;
+ x1 = pred_ctr_x + 0.5F * pred_w - coordinates_offset;
+ y1 = pred_ctr_y + 0.5F * pred_h - coordinates_offset;
// adjust new corner locations to be within the image region,
- x0 = std::max<float>(0.0f, std::min<float>(x0, img_W - coordinates_offset));
- y0 = std::max<float>(0.0f, std::min<float>(y0, img_H - coordinates_offset));
- x1 = std::max<float>(0.0f, std::min<float>(x1, img_W - coordinates_offset));
- y1 = std::max<float>(0.0f, std::min<float>(y1, img_H - coordinates_offset));
+ x0 = std::max<float>(0.0F, std::min<float>(x0, img_W - coordinates_offset));
+ y0 = std::max<float>(0.0F, std::min<float>(y0, img_H - coordinates_offset));
+ x1 = std::max<float>(0.0F, std::min<float>(x1, img_W - coordinates_offset));
+ y1 = std::max<float>(0.0F, std::min<float>(y1, img_H - coordinates_offset));
// recompute new width & height
const float box_w = x1 - x0 + coordinates_offset;
@@ -221,7 +221,7 @@ void nms_cpu(const int num_boxes,
#endif
for (; tail < num_boxes; ++tail) {
- float res = 0.0f;
+ float res = 0.0F;
const float x0i = x0[box];
const float y0i = y0[box];
@@ -241,8 +241,8 @@ void nms_cpu(const int num_boxes,
const float y1 = std::min<float>(y1i, y1j);
// intersection area
- const float width = std::max<float>(0.0f, x1 - x0 + coordinates_offset);
- const float height = std::max<float>(0.0f, y1 - y0 + coordinates_offset);
+ const float width = std::max<float>(0.0F, x1 - x0 + coordinates_offset);
+ const float height = std::max<float>(0.0F, y1 - y0 + coordinates_offset);
const float area = width * height;
// area of A, B
@@ -325,7 +325,7 @@ GenerateProposals::GenerateProposals(const std::shared_ptr<ov::Node>& op, const
nms_thresh_ = proposalAttrs.nms_threshold;
pre_nms_topn_ = proposalAttrs.pre_nms_count;
post_nms_topn_ = proposalAttrs.post_nms_count;
- coordinates_offset_ = proposalAttrs.normalized ? 0.f : 1.f;
+ coordinates_offset_ = proposalAttrs.normalized ? 0.F : 1.F;
roi_indices_.resize(post_nms_topn_);
}
@@ -426,9 +426,10 @@ void GenerateProposals::execute([[maybe_unused]] const dnnl::stream& strm) {
// Execute
size_t batch_size = scoreDims[0];
size_t total_num_rois = 0;
- std::vector<float> roi_item, score_item;
+ std::vector<float> roi_item;
+ std::vector<float> score_item;
std::vector<int64_t> roi_num(batch_size);
- auto* p_roi_num = reinterpret_cast<uint8_t*>(&roi_num[0]);
+ auto* p_roi_num = reinterpret_cast<uint8_t*>(roi_num.data());
auto roi_num_type = getOriginalOutputPrecisionAtPort(OUTPUT_ROI_NUM);
const auto roi_num_item_size = roi_num_type == ov::element::i32 ? sizeof(int32_t) : sizeof(int64_t);
for (size_t n = 0; n < batch_size; ++n) {
@@ -452,7 +453,7 @@ void GenerateProposals::execute([[maybe_unused]] const dnnl::stream& strm) {
refine_anchors(p_deltas_item,
p_scores_item,
p_anchors_item,
- reinterpret_cast<float*>(&proposals_[0]),
+ reinterpret_cast<float*>(proposals_.data()),
anchors_num,
bottom_H,
bottom_W,
@@ -469,11 +470,14 @@ void GenerateProposals::execute([[maybe_unused]] const dnnl::stream& strm) {
return (struct1.score > struct2.score);
});
- unpack_boxes(reinterpret_cast<float*>(&proposals_[0]), &unpacked_boxes[0], &is_dead[0], pre_nms_topn);
+ unpack_boxes(reinterpret_cast<float*>(proposals_.data()),
+ unpacked_boxes.data(),
+ is_dead.data(),
+ pre_nms_topn);
nms_cpu(pre_nms_topn,
- &is_dead[0],
- &unpacked_boxes[0],
- &roi_indices_[0],
+ is_dead.data(),
+ unpacked_boxes.data(),
+ roi_indices_.data(),
&num_rois,
0,
nms_thresh_,
@@ -484,8 +488,8 @@ void GenerateProposals::execute([[maybe_unused]] const dnnl::stream& strm) {
roi_item.resize(new_num_rois * 4);
score_item.resize(new_num_rois);
- fill_output_blobs(&unpacked_boxes[0],
- &roi_indices_[0],
+ fill_output_blobs(unpacked_boxes.data(),
+ roi_indices_.data(),
&roi_item[total_num_rois * 4],
&score_item[total_num_rois],
p_roi_num,
@@ -503,9 +507,9 @@ void GenerateProposals::execute([[maybe_unused]] const dnnl::stream& strm) {
auto* p_roi_item = getDstDataAtPortAs<float>(OUTPUT_ROIS);
auto* p_roi_score_item = getDstDataAtPortAs<float>(OUTPUT_SCORES);
auto* p_roi_num_item = getDstDataAtPortAs<uint8_t>(OUTPUT_ROI_NUM);
- memcpy(p_roi_item, &roi_item[0], roi_item.size() * sizeof(float));
- memcpy(p_roi_score_item, &score_item[0], score_item.size() * sizeof(float));
- memcpy(p_roi_num_item, &roi_num[0], getDstMemoryAtPort(OUTPUT_ROI_NUM)->getSize());
+ memcpy(p_roi_item, roi_item.data(), roi_item.size() * sizeof(float));
+ memcpy(p_roi_score_item, score_item.data(), score_item.size() * sizeof(float));
+ memcpy(p_roi_num_item, roi_num.data(), getDstMemoryAtPort(OUTPUT_ROI_NUM)->getSize());
} catch (const std::exception& e) {
THROW_CPU_NODE_ERR(e.what());
}
diff --git a/src/plugins/intel_cpu/src/nodes/grid_sample.cpp b/src/plugins/intel_cpu/src/nodes/grid_sample.cpp
index 03c03c433db..9d9f09d0728 100644
--- a/src/plugins/intel_cpu/src/nodes/grid_sample.cpp
+++ b/src/plugins/intel_cpu/src/nodes/grid_sample.cpp
@@ -157,9 +157,9 @@ void GridSample::createPrimitive() {
std::accumulate(srcDataDims.begin() + 1, srcDataDims.end(), dataTypeSize, std::multiplies<>());
} else {
jcp.dynamicBatch = srcDataDims[0] == Shape::UNDEFINED_DIM;
- jcp.batchNum = jcp.dynamicBatch ? 1lu : srcDataDims[0];
+ jcp.batchNum = jcp.dynamicBatch ? 1LU : srcDataDims[0];
jcp.dynamicChannel = srcDataDims[1] == Shape::UNDEFINED_DIM;
- jcp.cannelNum = jcp.dynamicChannel ? 1lu : srcDataDims[1];
+ jcp.cannelNum = jcp.dynamicChannel ? 1LU : srcDataDims[1];
}
if (x64::mayiuse(x64::avx512_core)) {
@@ -235,7 +235,7 @@ void GridSample::prepareParams() {
auto& p = execParamsPerThread[ithr];
p.workAmount = dstEnd - dstStart;
- if (p.workAmount == 0lu) {
+ if (p.workAmount == 0LU) {
return;
}
@@ -256,23 +256,23 @@ void GridSample::prepareParams() {
p.dstChannelStepB = dstShape[2] * dstShape[3] * dataTypeSize;
p.dataTypeSize[0] = dataTypeSize;
- p.srcHeightSub1F[0] = p.srcHeightF[0] - 1.f;
- p.srcWidthSub1F[0] = p.srcWidthF[0] - 1.f;
- p.srcHeightMul2F[0] = p.srcHeightF[0] * 2.f;
- p.srcWidthMul2F[0] = p.srcWidthF[0] * 2.f;
+ p.srcHeightSub1F[0] = p.srcHeightF[0] - 1.F;
+ p.srcWidthSub1F[0] = p.srcWidthF[0] - 1.F;
+ p.srcHeightMul2F[0] = p.srcHeightF[0] * 2.F;
+ p.srcWidthMul2F[0] = p.srcWidthF[0] * 2.F;
if (interpolationMode == GridSampleInterpolationMode::BICUBIC && srcDataShape[3] >= 4) {
p.srcWidthB[0] = (srcDataShape[3] - 3) * dataTypeSize;
} else {
p.srcWidthB[0] = srcDataShape[3] * dataTypeSize;
}
if (alignCorners) {
- p.srcHeightMul2Sub1F[0] = p.srcHeightF[0] == 1.f ? 1.f : p.srcHeightSub1F[0] * 2.f;
- p.srcWidthMul2Sub1F[0] = p.srcWidthF[0] == 1.f ? 1.f : p.srcWidthSub1F[0] * 2.f;
- p.wDenormCoefF[0] = (p.srcWidthF[0] - 1.f) / 2.f;
- p.hDenormCoefF[0] = (p.srcHeightF[0] - 1.f) / 2.f;
+ p.srcHeightMul2Sub1F[0] = p.srcHeightF[0] == 1.F ? 1.F : p.srcHeightSub1F[0] * 2.F;
+ p.srcWidthMul2Sub1F[0] = p.srcWidthF[0] == 1.F ? 1.F : p.srcWidthSub1F[0] * 2.F;
+ p.wDenormCoefF[0] = (p.srcWidthF[0] - 1.F) / 2.F;
+ p.hDenormCoefF[0] = (p.srcHeightF[0] - 1.F) / 2.F;
} else {
- p.srcHeightMul2Sub1F[0] = p.srcHeightMul2F[0] - 1.f;
- p.srcWidthMul2Sub1F[0] = p.srcWidthMul2F[0] - 1.f;
+ p.srcHeightMul2Sub1F[0] = p.srcHeightMul2F[0] - 1.F;
+ p.srcWidthMul2Sub1F[0] = p.srcWidthMul2F[0] - 1.F;
}
if (!x64::mayiuse(x64::avx512_core)) {
std::fill(p.srcHeightF.begin(), p.srcHeightF.end(), p.srcHeightF[0]);
@@ -301,7 +301,7 @@ void GridSample::execute([[maybe_unused]] const dnnl::stream& strm) {
auto threadBody = [&](const int ithr, [[maybe_unused]] const int nthr) {
const auto& p = execParamsPerThread[ithr];
auto arg = kernel::GridSamplesKernelExecArgs();
- if (p.workAmount == 0lu) {
+ if (p.workAmount == 0LU) {
return;
}
diff --git a/src/plugins/intel_cpu/src/nodes/grn.cpp b/src/plugins/intel_cpu/src/nodes/grn.cpp
index e581bf32220..d7f0e6eff46 100644
--- a/src/plugins/intel_cpu/src/nodes/grn.cpp
+++ b/src/plugins/intel_cpu/src/nodes/grn.cpp
@@ -123,7 +123,7 @@ void GRN::execute([[maybe_unused]] const dnnl::stream& strm) {
for (int c = 0; c < C; c++) {
variance += std::pow(src_data[b * C * H * W + c * H * W + h * W + w], 2);
}
- variance = std::pow(variance + bias, 0.5f);
+ variance = std::pow(variance + bias, 0.5F);
for (int c = 0; c < C; c++) {
dst_data[b * C * H * W + c * H * W + h * W + w] =
src_data[b * C * H * W + c * H * W + h * W + w] / static_cast<float>(variance);
diff --git a/src/plugins/intel_cpu/src/nodes/if.cpp b/src/plugins/intel_cpu/src/nodes/if.cpp
index b83ebb6232f..9b2a4a391f7 100644
--- a/src/plugins/intel_cpu/src/nodes/if.cpp
+++ b/src/plugins/intel_cpu/src/nodes/if.cpp
@@ -248,7 +248,7 @@ void If::prepareAfterMappers(const bool isThen, const dnnl::engine& eng) {
}
}
-std::deque<MemoryPtr> If::getToMemories(const Node* node, const size_t port) const {
+std::deque<MemoryPtr> If::getToMemories(const Node* node, const size_t port) {
std::deque<MemoryPtr> memories;
for (const auto& edge : node->getChildEdgesAtPort(port)) {
memories.push_back(edge->getMemoryPtr());
diff --git a/src/plugins/intel_cpu/src/nodes/if.h b/src/plugins/intel_cpu/src/nodes/if.h
index c8ae2948a37..186eb59317e 100644
--- a/src/plugins/intel_cpu/src/nodes/if.h
+++ b/src/plugins/intel_cpu/src/nodes/if.h
@@ -57,7 +57,7 @@ private:
void prepareBeforeMappers(const bool isThen, const dnnl::engine& eng);
void prepareAfterMappers(const bool isThen, const dnnl::engine& eng);
- std::deque<MemoryPtr> getToMemories(const Node* node, const size_t port) const;
+ static std::deque<MemoryPtr> getToMemories(const Node* node, const size_t port);
struct PortMap {
int from; /**< Index of external/internal out data */
diff --git a/src/plugins/intel_cpu/src/nodes/input.cpp b/src/plugins/intel_cpu/src/nodes/input.cpp
index 332cc0a794d..f998437e546 100644
--- a/src/plugins/intel_cpu/src/nodes/input.cpp
+++ b/src/plugins/intel_cpu/src/nodes/input.cpp
@@ -84,7 +84,8 @@ protected:
size_t step,
const Xbyak::Reg64& end,
std::function<void(const Xbyak::Reg64&)> && fn) {
- Label loop, exit;
+ Label loop;
+ Label exit;
L(loop);
cmp(idx, end);
@@ -174,7 +175,6 @@ protected:
uni_vtestps(b, b); // if (b != 0) CF = 1 else CF = 0
}
-protected:
Label exit, has_target_values, no_target_values;
const Reg64& reg_src = rax;
@@ -442,8 +442,7 @@ void Input::cloneBlobIfRequired() {
return;
}
// Only bf16 inferencePrecision cases need to be checked for saturation
- const bool do_bf16_saturation_check =
- (context->getConfig().inferencePrecision == ov::element::bf16) ? true : false;
+ const bool do_bf16_saturation_check = context->getConfig().inferencePrecision == ov::element::bf16;
#if defined(OPENVINO_ARCH_X86_64)
auto fn = jit_has_subnormals_function();
@@ -702,7 +701,7 @@ void Input::initOptimalPrimitiveDescriptor() {
}
void Input::selectOptimalPrimitiveDescriptor() {
- if (!(m_useParentMemoryDescForOutput && getType() == Type::Output)) {
+ if (!m_useParentMemoryDescForOutput || getType() != Type::Output) {
return Node::selectOptimalPrimitiveDescriptor();
}
diff --git a/src/plugins/intel_cpu/src/nodes/interaction.cpp b/src/plugins/intel_cpu/src/nodes/interaction.cpp
index 7547cab4b0d..1dcb869d6da 100644
--- a/src/plugins/intel_cpu/src/nodes/interaction.cpp
+++ b/src/plugins/intel_cpu/src/nodes/interaction.cpp
@@ -140,12 +140,12 @@ private:
}
# undef GET_OFF
- inline void load(const Vmm& vmm_dst,
- const Xbyak::Reg64& reg_src,
- ov::element::Type src_prc,
- ov::element::Type dst_prc,
- const int& elt_num,
- bool fill) {
+ void load(const Vmm& vmm_dst,
+ const Xbyak::Reg64& reg_src,
+ ov::element::Type src_prc,
+ ov::element::Type dst_prc,
+ const int& elt_num,
+ bool fill) {
const auto seed = load_emitter_params(src_prc, dst_prc, elt_num, fill, "float_min").hash();
if (!emitters[seed]) {
emitters[seed] =
@@ -157,11 +157,11 @@ private:
pool_aux_vmm_idxs,
pool_aux_gpr_idxs);
}
- inline void store(const Xbyak::Reg64& reg_dst,
- const Vmm& vmm_src,
- ov::element::Type src_prc,
- ov::element::Type dst_prc,
- const int& elt_num) {
+ void store(const Xbyak::Reg64& reg_dst,
+ const Vmm& vmm_src,
+ ov::element::Type src_prc,
+ ov::element::Type dst_prc,
+ const int& elt_num) {
const auto seed = store_emitter_params(src_prc, dst_prc, elt_num).hash();
if (!emitters[seed]) {
emitters[seed] = std::make_unique<jit_store_emitter>(this, isa, src_prc, dst_prc, elt_num);
diff --git a/src/plugins/intel_cpu/src/nodes/interpolate.cpp b/src/plugins/intel_cpu/src/nodes/interpolate.cpp
index 0ed39d4b7fc..96ca052278a 100644
--- a/src/plugins/intel_cpu/src/nodes/interpolate.cpp
+++ b/src/plugins/intel_cpu/src/nodes/interpolate.cpp
@@ -105,7 +105,7 @@ struct jit_uni_interpolate_kernel_f32 : public jit_uni_interpolate_kernel, publi
post_op.eltwise.alg,
post_op.eltwise.alpha,
post_op.eltwise.beta,
- 1.f,
+ 1.F,
data_type::f32));
} else if (post_op.is_depthwise()) {
depthwise_injectors.push_back(std::make_shared<jit_uni_depthwise_injector_f32<isa>>(this, post_op));
@@ -317,20 +317,20 @@ private:
}
}
- inline void load(Xbyak::Reg64 reg_src, Vmm vmm_src, const int elt_num, const int offset = 0) {
+ void load(Xbyak::Reg64 reg_src, Vmm vmm_src, const int elt_num, const int offset = 0) {
emit_load(reg_src, vmm_src, jcp_.src_prc, ov::element::f32, elt_num, offset);
}
- inline void load_weights(Xbyak::Reg64 reg_src, Vmm vmm_src, const int elt_num, const int offset = 0) {
+ void load_weights(Xbyak::Reg64 reg_src, Vmm vmm_src, const int elt_num, const int offset = 0) {
emit_load(reg_src, vmm_src, ov::element::f32, ov::element::f32, elt_num, offset);
}
- inline void emit_load(Xbyak::Reg64 reg_src,
- Vmm vmm_src,
- ov::element::Type src_prc,
- ov::element::Type dst_prc,
- const int elt_num,
- const int offset = 0) {
+ void emit_load(Xbyak::Reg64 reg_src,
+ Vmm vmm_src,
+ ov::element::Type src_prc,
+ ov::element::Type dst_prc,
+ const int elt_num,
+ const int offset = 0) {
const auto seed = load_emitter_params(src_prc, dst_prc, elt_num).hash();
if (!emitters[seed]) {
emitters[seed] = std::make_unique<jit_load_emitter>(this, isa, src_prc, dst_prc, elt_num);
@@ -342,7 +342,7 @@ private:
{load_pool_gpr_idxs});
}
- inline void store(Vmm vmm_dst, Xbyak::Reg64 reg_dst, const int elt_num, const int offset = 0) {
+ void store(Vmm vmm_dst, Xbyak::Reg64 reg_dst, const int elt_num, const int offset = 0) {
const auto seed = store_emitter_params(ov::element::f32, jcp_.dst_prc, elt_num).hash();
if (!emitters[seed]) {
emitters[seed] = std::make_unique<jit_store_emitter>(this, isa, ov::element::f32, jcp_.dst_prc, elt_num);
@@ -414,7 +414,9 @@ private:
// | |
// | | .
// ----
- int f, filterS, filterL;
+ int f;
+ int filterS;
+ int filterL;
int tail_num = jcp_.C % vector_step;
// xpass
if (xPass) {
@@ -1094,14 +1096,14 @@ private:
L(tail_loop_end_label);
}
- inline void linear_onnx_worker_1d() {
+ void linear_onnx_worker_1d() {
uni_vmulps(vmm_valTR, vmm_valTR, vmm_weightR);
uni_vfmadd231ps(vmm_valTR, vmm_valTL, vmm_weightL);
}
// weightT * (srcTL * weightL + srcTR * weightR) +
// weightB * (srcBL * weightL + srcBR * weightR)
- inline void linear_onnx_worker_2d() {
+ void linear_onnx_worker_2d() {
uni_vmulps(vmm_valTR, vmm_valTR, vmm_weightR);
uni_vmulps(vmm_valBR, vmm_valBR, vmm_weightR);
uni_vfmadd231ps(vmm_valTR, vmm_valTL, vmm_weightL);
@@ -1220,7 +1222,7 @@ private:
L(tail_loop_end_label);
}
- inline void cubic_c_gathered_matrix(bool is_scalar) {
+ void cubic_c_gathered_matrix(bool is_scalar) {
// y0: (x0 * weightX0 + x1 * weightX1 + x2 * weightX2 + x3 * weightX3) * weightY0
cubic_c_gathered_line(0, vmm_weightY0, is_scalar);
// y1
@@ -1231,7 +1233,7 @@ private:
cubic_c_gathered_line(12, vmm_weightY3, is_scalar);
}
- inline void cubic_c_gathered_line(int index_start, Vmm vmm_weight, bool is_scalar) {
+ void cubic_c_gathered_line(int index_start, Vmm vmm_weight, bool is_scalar) {
uni_vpxor(vmm_dstX, vmm_dstX, vmm_dstX);
cubic_c_gathered_pixel(index_start, vmm_weightX0, is_scalar);
cubic_c_gathered_pixel(index_start + 1, vmm_weightX1, is_scalar);
@@ -1240,7 +1242,7 @@ private:
uni_vfmadd231ps(vmm_val, vmm_dstX, vmm_weight);
}
- inline void cubic_c_gathered_pixel(int i, Vmm vmm_weight, bool is_scalar) {
+ void cubic_c_gathered_pixel(int i, Vmm vmm_weight, bool is_scalar) {
mov(reg_src_aux, reg_src);
mov(reg_index_offset, dword[reg_index + i * jcp_.indices_size]);
add(reg_src_aux, reg_index_offset);
@@ -1471,7 +1473,7 @@ private:
L(tail_loop_end_label);
}
- inline void cubic_planar_line(bool is_scalar) {
+ void cubic_planar_line(bool is_scalar) {
uni_vpxor(vmm_dstX, vmm_dstX, vmm_dstX);
cubic_planar_pixel(0, is_scalar);
cubic_planar_pixel(1, is_scalar);
@@ -1480,7 +1482,7 @@ private:
uni_vfmadd231ps(vmm_val, vmm_dstX, vmm_weightY);
}
- inline void cubic_planar_pixel(int itr, bool is_scalar) {
+ void cubic_planar_pixel(int itr, bool is_scalar) {
// vmm_index_in_x have index for src
if (itr == 0) {
vpsubd(vmm_index_x_itr, vmm_index_in_x, vmm_one);
@@ -1516,7 +1518,7 @@ private:
}
}
- inline void prepare_cubic_planar_table() {
+ void prepare_cubic_planar_table() {
auto broadcast_int = [&](int val) {
for (size_t d = 0; d < vlen / sizeof(int); ++d) {
dd(val);
@@ -1536,18 +1538,18 @@ private:
int mask_gather_avx512 = 0x0000ffff; // 00000000000000001111111111111111
} vals_for_cubic_planar;
- inline Xbyak::Address cubic_planar_table_val(int index) {
+ Xbyak::Address cubic_planar_table_val(int index) {
return ptr[reg_table + index * vlen];
}
// always gather to Vmm, compute with Vmm, store with Xmm if scalar_step
- inline void gather_i32_indices(Vmm vmm_src,
- const Xbyak::Reg64& base,
- int offset,
- Vmm vmm_indices,
- int scale,
- ov::element::Type src_prc,
- bool is_scalar) {
+ void gather_i32_indices(Vmm vmm_src,
+ const Xbyak::Reg64& base,
+ int offset,
+ Vmm vmm_indices,
+ int scale,
+ ov::element::Type src_prc,
+ bool is_scalar) {
Xbyak::Address table_idx = ptr[base + offset + vmm_indices * scale];
if ((isa == cpu::x64::avx512_core) && !is_scalar) {
// [0-15] bit of int to mask
@@ -1756,7 +1758,7 @@ inline VectorDims getBlockND(const VectorDims& shape) {
// w/hw/ncw/nchw/ncdhw to ncdhw
inline VectorDims to5Dim(VectorDims casesDim) {
size_t caseSize = casesDim.size();
- VectorDims dim5(5, 1lu);
+ VectorDims dim5(5, 1LU);
dim5[4] = casesDim[caseSize - 1];
if (caseSize > 1) {
dim5[3] = casesDim[caseSize - 2];
@@ -1772,7 +1774,7 @@ inline VectorDims to5Dim(VectorDims casesDim) {
}
if (caseSize == 3) { // nhw -> ncw
dim5[1] = dim5[3];
- dim5[3] = 1lu;
+ dim5[3] = 1LU;
}
return dim5;
}
@@ -2182,7 +2184,7 @@ void Interpolate::initSupportedPrimitiveDescriptors() {
// support input with rank<=3 only with float precision and planar layout.
// Jit for avx2(gather is available) and ref for no-avx2 machine.
- if (!one_of(dataRank, 4u, 5u)) {
+ if (!one_of(dataRank, 4U, 5U)) {
inputPrecision = ov::element::f32;
}
ov::element::Type outputPrecision = inputPrecision;
@@ -2492,7 +2494,7 @@ void Interpolate::prepareParams() {
std::vector<float> dataScales =
getScales(getPaddedInputShape(srcDims, interpAttrs.padBegin, interpAttrs.padEnd), dstDims);
if (!interpAttrs.NCHWAsNHWC &&
- (getOutputShapeAtPort(0).getRank() > 2 && (dataScales[0] != 1.f || dataScales[1] != 1.f))) {
+ (getOutputShapeAtPort(0).getRank() > 2 && (dataScales[0] != 1.F || dataScales[1] != 1.F))) {
THROW_CPU_NODE_ERR("only supports resize on spatial dimensions(depth, height and width)");
}
@@ -2583,11 +2585,11 @@ void Interpolate::createPrimitive() {
}
inline int clipCoord(int pos, int length) {
- return std::max(static_cast<int>(0), std::min(pos, length - 1));
+ return std::max(0, std::min(pos, length - 1));
}
static inline float triangleCoeff(float x) {
- return (std::max)(0.0f, 1 - std::abs(x));
+ return (std::max)(0.0F, 1 - std::abs(x));
}
void Interpolate::setPostOps(dnnl::primitive_attr& attr, const VectorDims& dims) {
@@ -2636,7 +2638,7 @@ VectorDims Interpolate::getPaddedInputShape(const VectorDims& srcDims,
// scales is a required input, but should not use input scales when "size" case, which may added eps or is a dummy
// value, recalculate scales instead.
std::vector<float> Interpolate::getScales(const VectorDims& srcDimPad, const VectorDims& dstDim) {
- std::vector<float> fullScales(dataRank, 1.f);
+ std::vector<float> fullScales(dataRank, 1.F);
const size_t axesRank = axes.size();
for (size_t i = 0; i < axesRank; i++) {
int axis = axes[i];
@@ -2682,7 +2684,7 @@ void Interpolate::execute([[maybe_unused]] const dnnl::stream& strm) {
if (interpAttrs.layout == InterpolateLayoutType::planar) {
srcPadded.resize(inShapePadBlock[0] * srcDataSize, 0);
- auto* src_data_pad = static_cast<uint8_t*>(&srcPadded[0]);
+ auto* src_data_pad = static_cast<uint8_t*>(srcPadded.data());
parallel_for4d(srcDim5d[0], srcDim5d[1], srcDim5d[2], srcDim5d[3], [&](int n, int c, int d, int h) {
const uint8_t* src = src_data_origin + (inShapeBlock[1] * n + inShapeBlock[2] * c +
inShapeBlock[3] * d + inShapeBlock[4] * h) *
@@ -2696,7 +2698,7 @@ void Interpolate::execute([[maybe_unused]] const dnnl::stream& strm) {
src_data = src_data_pad;
} else if (interpAttrs.layout == InterpolateLayoutType::by_channel) {
srcPadded.resize(inShapePadBlock[0] * srcDataSize, 0);
- auto* src_data_pad = static_cast<uint8_t*>(&srcPadded[0]);
+ auto* src_data_pad = static_cast<uint8_t*>(srcPadded.data());
parallel_for4d(srcDim5d[0], srcDim5d[2], srcDim5d[3], srcDim5d[4], [&](int n, int d, int h, int w) {
const uint8_t* src =
src_data_origin +
@@ -2718,7 +2720,7 @@ void Interpolate::execute([[maybe_unused]] const dnnl::stream& strm) {
size_t CB = div_up(srcDimPad5d[1], blkSize);
size_t eltsTotal = srcDimPad5d[0] * CB * srcDimPad5d[2] * srcDimPad5d[3] * srcDimPad5d[4] * blkSize;
srcPadded.resize(eltsTotal * srcDataSize, 0x0);
- auto* src_data_pad = static_cast<uint8_t*>(&srcPadded[0]);
+ auto* src_data_pad = static_cast<uint8_t*>(srcPadded.data());
if ((srcDim5d[0] != srcDimPad5d[0]) || (srcDim5d[1] != srcDimPad5d[1])) {
THROW_CPU_NODE_ERR("does not support padding on batch and channel dimensions");
}
@@ -2771,7 +2773,7 @@ void Interpolate::InterpolateJitExecutor::NNCGathered(const uint8_t* in_ptr_,
int OD,
int OH,
int OW) {
- auto* index_d = static_cast<int*>(&auxTable[0]);
+ auto* index_d = static_cast<int*>(auxTable.data());
auto* index_h = static_cast<int*>(&auxTable[OD]);
auto* index_w = static_cast<int*>(&auxTable[OD + OH]);
@@ -2792,7 +2794,7 @@ void Interpolate::InterpolateJitExecutor::NNCGathered(const uint8_t* in_ptr_,
auto arg = jit_interpolate_call_args();
arg.dst = out_ptr_dh;
arg.src_ptr[0] = in_ptr_dh;
- arg.index = static_cast<int*>(&(index_w_kernel[0]));
+ arg.index = static_cast<int*>(index_w_kernel.data());
arg.work_amount = C;
arg.oc_off = 0;
arg.post_op_data = post_ops_data_;
@@ -2815,7 +2817,7 @@ void Interpolate::InterpolateJitExecutor::NNCGathered(const uint8_t* in_ptr_,
for (int h = 0; h < OH; h++) { // kernel for blk_size * OW
arg.dst = out_ptr_cbd + blk_size * OW * h * dstDataSize;
arg.src_ptr[0] = in_ptr_cbd + blk_size * IW * index_h[h] * srcDataSize;
- arg.index = static_cast<int*>(&(index_w_kernel[0]));
+ arg.index = static_cast<int*>(index_w_kernel.data());
arg.work_amount = static_cast<size_t>(OW);
arg.oc_off = cb * blk_size * sizeof(float);
arg.post_op_data = post_ops_data_;
@@ -2837,7 +2839,7 @@ void Interpolate::InterpolateJitExecutor::NNPlanar(const uint8_t* in_ptr_,
int OD,
int OH,
int OW) {
- auto* index_d = static_cast<int*>(&auxTable[0]);
+ auto* index_d = static_cast<int*>(auxTable.data());
auto* index_h = static_cast<int*>(&auxTable[OD]);
auto* index_w = static_cast<int*>(&auxTable[OD + OH]);
@@ -2860,7 +2862,7 @@ void Interpolate::InterpolateJitExecutor::NNPlanar(const uint8_t* in_ptr_,
arg.src_ptr[0] = in_ptr;
arg.dst = out_ptr;
arg.index = static_cast<int*>(
- &index_kernel[0]); // need index_h and index_w in kernel, it's in continous memory so one param
+ index_kernel.data()); // need index_h and index_w in kernel, it's in continous memory so one param
arg.oc_off = static_cast<size_t>(c * sizeof(float));
// work_amount is OH(out loop) and OW(inner loop), can get in kernel from jcp.
arg.post_op_data = post_ops_data_;
@@ -2881,7 +2883,7 @@ void Interpolate::InterpolateJitExecutor::linearOnnxPlanar(const uint8_t* in_ptr
int OW) {
// FrontTopLeft:0, FrontTopRight:1, FrontBottomLeft:2, FrontBottomRight:3, EndTopLeft:4, EndTopRight:5,
// EndBottomLeft:6, EndBottomRight:7 weight: Left:0, ritht:1, top:2, bottom:3, front:4, end:5
- auto* index = static_cast<int*>(&auxTable[0]);
+ auto* index = static_cast<int*>(auxTable.data());
int eltInGrid = (spatialDimSize > 2) ? MAX_INPUT_INTERPOLATE : ((spatialDimSize > 1) ? 4 : 2);
int scratchLen = rnd_up(eltInGrid * OW * OH * OD, 16);
auto* weight = reinterpret_cast<float*>(&auxTable[scratchLen]);
@@ -2891,8 +2893,8 @@ void Interpolate::InterpolateJitExecutor::linearOnnxPlanar(const uint8_t* in_ptr
const uint8_t* in_ptr_nc = in_ptr_ + (IH * IW * ID * C * b + IH * IW * ID * c) * srcDataSize;
auto arg = jit_interpolate_call_args();
arg.src_ptr[0] = in_ptr_nc;
- arg.index = static_cast<int*>(&index[0]);
- arg.weight_ptr[0] = static_cast<float*>(&weight[0]);
+ arg.index = (&index[0]);
+ arg.weight_ptr[0] = (&weight[0]);
arg.dst = out_ptr_nc;
arg.work_amount = OW * OH * OD;
arg.oc_off = static_cast<size_t>(c * sizeof(float));
@@ -2916,7 +2918,7 @@ void Interpolate::InterpolateJitExecutor::linearOnnxCGathered(const uint8_t* in_
std::vector<int*> indexPtr(MAX_INPUT_INTERPOLATE, nullptr);
std::vector<float*> weightPtr(MAX_INPUT_INTERPOLATE, nullptr);
size_t scratchLen = rnd_up(OW + OW + OH + OH + OD + OD, 16);
- indexPtr[0] = static_cast<int*>(&auxTable[0]);
+ indexPtr[0] = static_cast<int*>(auxTable.data());
indexPtr[1] = static_cast<int*>(&auxTable[OW]);
indexPtr[2] = static_cast<int*>(&auxTable[2 * OW]);
indexPtr[3] = static_cast<int*>(&auxTable[2 * OW + OH]);
@@ -2930,7 +2932,7 @@ void Interpolate::InterpolateJitExecutor::linearOnnxCGathered(const uint8_t* in_
weightPtr[4] = reinterpret_cast<float*>(&auxTable[scratchLen + 2 * OW + 2 * OH]);
weightPtr[5] = reinterpret_cast<float*>(&auxTable[scratchLen + 2 * OW + 2 * OH + OD]);
- bool isByChannel = (configured_for_layout == by_channel) ? true : false;
+ bool isByChannel = configured_for_layout == by_channel;
int blkSize = mayiuse(cpu::x64::avx512_core) ? 16 : 8;
int CB = isByChannel ? 1 : div_up(C, blkSize);
@@ -2967,12 +2969,12 @@ void Interpolate::InterpolateJitExecutor::linearOnnxCGathered(const uint8_t* in_
arg.src_ptr[5] = in_ptr_net + (indexPtr[1][w] * CGatherLen) * srcDataSize;
arg.src_ptr[6] = in_ptr_neb + (indexPtr[0][w] * CGatherLen) * srcDataSize;
arg.src_ptr[7] = in_ptr_neb + (indexPtr[1][w] * CGatherLen) * srcDataSize;
- arg.weight_ptr[0] = static_cast<float*>(&weightPtr[0][w]);
- arg.weight_ptr[1] = static_cast<float*>(&weightPtr[1][w]);
- arg.weight_ptr[2] = static_cast<float*>(&weightPtr[2][h]);
- arg.weight_ptr[3] = static_cast<float*>(&weightPtr[3][h]);
- arg.weight_ptr[4] = static_cast<float*>(&weightPtr[4][d]);
- arg.weight_ptr[5] = static_cast<float*>(&weightPtr[5][d]);
+ arg.weight_ptr[0] = (&weightPtr[0][w]);
+ arg.weight_ptr[1] = (&weightPtr[1][w]);
+ arg.weight_ptr[2] = (&weightPtr[2][h]);
+ arg.weight_ptr[3] = (&weightPtr[3][h]);
+ arg.weight_ptr[4] = (&weightPtr[4][d]);
+ arg.weight_ptr[5] = (&weightPtr[5][d]);
arg.dst = out_ptr_ndhw;
arg.work_amount = workAmount;
arg.oc_off = 0;
@@ -2992,7 +2994,7 @@ void Interpolate::InterpolateJitExecutor::cubicCGathered(const uint8_t* in_ptr_,
int OH,
int OW) {
const int idxNum = 1;
- auto* xOrigin = static_cast<int*>(&auxTable[0]);
+ auto* xOrigin = static_cast<int*>(auxTable.data());
auto* xFactor = reinterpret_cast<float*>(&auxTable[OW]);
auto* yOrigin = static_cast<int*>(&auxTable[(CUBIC_GRID_LEN + idxNum) * OW]);
auto* yFactor = reinterpret_cast<float*>(&auxTable[(CUBIC_GRID_LEN + idxNum) * OW + OH]);
@@ -3022,10 +3024,10 @@ void Interpolate::InterpolateJitExecutor::cubicCGathered(const uint8_t* in_ptr_,
auto arg = jit_interpolate_call_args();
arg.dst = out_ptr_nhw;
arg.src_ptr[0] = in_ptr_n;
- arg.index = static_cast<int*>(&kernelIndex[0]);
+ arg.index = static_cast<int*>(kernelIndex.data());
// 0 for weight_W, 1 for weight_H
- arg.weight_ptr[0] = static_cast<float*>(&xFactor[w * CUBIC_GRID_LEN]);
- arg.weight_ptr[1] = static_cast<float*>(&yFactor[h * CUBIC_GRID_LEN]);
+ arg.weight_ptr[0] = (&xFactor[w * CUBIC_GRID_LEN]);
+ arg.weight_ptr[1] = (&yFactor[h * CUBIC_GRID_LEN]);
// for by channel, src + step, dst + step, process next step on continuous memory
// for blk, src + IW*IH*blkSize, dst + OW*OH*blkSize, process the blkSize on next CB
@@ -3068,8 +3070,8 @@ void Interpolate::InterpolateJitExecutor::cubicPlanar(const uint8_t* in_ptr_,
arg.src_ptr[0] = in_ptr_nc;
arg.index = xOrigin;
arg.src_ptr[1] = yOrigin;
- arg.src_ptr[2] = static_cast<int*>(&sequenceOH[0]);
- arg.src_ptr[3] = static_cast<int*>(&sequenceOW[0]);
+ arg.src_ptr[2] = (&sequenceOH[0]);
+ arg.src_ptr[3] = (&sequenceOW[0]);
arg.weight_ptr[0] = xFactor;
arg.weight_ptr[1] = yFactor;
arg.work_amount = static_cast<size_t>(OW) * OH;
@@ -3125,16 +3127,20 @@ void Interpolate::InterpolateExecutorBase::buildTblNN(const VectorDims& srcDimPa
[[maybe_unused]] InterpolateLayoutType layout,
InterpolateNearestMode nearestMode) {
const int dimSize = dataRank;
- float fz = (dimSize == 5) ? dataScales[dimSize - 3] : 1.f;
+ float fz = (dimSize == 5) ? dataScales[dimSize - 3] : 1.F;
float fy = dataScales[dimSize - 2];
float fx = dataScales[dimSize - 1];
- size_t ID = srcDimPad5d[2], IH = srcDimPad5d[3], IW = srcDimPad5d[4];
- size_t OD = dstDim5d[2], OH = dstDim5d[3], OW = dstDim5d[4];
+ size_t ID = srcDimPad5d[2];
+ size_t IH = srcDimPad5d[3];
+ size_t IW = srcDimPad5d[4];
+ size_t OD = dstDim5d[2];
+ size_t OH = dstDim5d[3];
+ size_t OW = dstDim5d[4];
auxTable.resize(OD + OH + OW);
- bool isDDownsample = (fz < 1) ? true : false;
- bool isHDownsample = (fy < 1) ? true : false;
- bool isWDownsample = (fx < 1) ? true : false;
+ bool isDDownsample = fz < 1;
+ bool isHDownsample = fy < 1;
+ bool isWDownsample = fx < 1;
for (size_t oz = 0; oz < OD; oz++) {
float iz = coordTransToInput(oz, fz, ID, OD);
auxTable[oz] = nearestRound(iz, isDDownsample, nearestMode);
@@ -3159,16 +3165,16 @@ float Interpolate::InterpolateExecutorBase::coordTransToInput(int outCoord,
float scale,
int inShape,
int outShape) const {
- if (scale == 1.0f || (inShape == outShape)) {
+ if (scale == 1.0F || (inShape == outShape)) {
return outCoord;
}
switch (coordTransMode) {
case InterpolateCoordTransMode::half_pixel: {
- return (outCoord + 0.5f) / scale - 0.5f;
+ return (outCoord + 0.5F) / scale - 0.5F;
}
case InterpolateCoordTransMode::pytorch_half_pixel: {
if (outShape > 1) {
- return (outCoord + 0.5f) / scale - 0.5f;
+ return (outCoord + 0.5F) / scale - 0.5F;
}
return 0;
}
@@ -3176,7 +3182,7 @@ float Interpolate::InterpolateExecutorBase::coordTransToInput(int outCoord,
return static_cast<float>(outCoord) / scale;
}
case InterpolateCoordTransMode::tf_half_pixel_for_nn: {
- return (outCoord + 0.5f) / scale;
+ return (outCoord + 0.5F) / scale;
}
case InterpolateCoordTransMode::align_corners: {
if (outShape > 1) {
@@ -3193,10 +3199,10 @@ float Interpolate::InterpolateExecutorBase::coordTransToInput(int outCoord,
int Interpolate::InterpolateExecutorBase::nearestRound(float originCoord,
bool isDownsample,
- InterpolateNearestMode nearestMode) const {
+ InterpolateNearestMode nearestMode) {
switch (nearestMode) {
case InterpolateNearestMode::round_prefer_floor: {
- if (originCoord == (static_cast<int>(originCoord) + 0.5f)) {
+ if (originCoord == (static_cast<int>(originCoord) + 0.5F)) {
return static_cast<int>(std::floor(originCoord));
}
return static_cast<int>(std::round(originCoord));
@@ -3232,15 +3238,15 @@ void Interpolate::InterpolateExecutorBase::linearOnnxCF(int outCoord,
float& weight0,
float& weight1) {
float inCoord = coordTransToInput(outCoord, scale, inShape, outShape);
- inCoord = std::max(0.0f, std::min(inCoord, static_cast<float>(inShape - 1)));
+ inCoord = std::max(0.0F, std::min(inCoord, static_cast<float>(inShape - 1)));
index0 = std::min(static_cast<int>(inCoord), inShape - 1);
index1 = std::min(index0 + 1, inShape - 1);
weight1 = std::fabs(inCoord - index0);
weight0 = std::fabs(inCoord - index1);
if (index0 == index1) {
- weight0 = 0.5f;
- weight1 = 0.5f;
+ weight0 = 0.5F;
+ weight1 = 0.5F;
}
}
@@ -3249,11 +3255,15 @@ void Interpolate::InterpolateExecutorBase::buildTblLinearOnnx(const VectorDims&
const std::vector<float>& dataScales,
InterpolateLayoutType layout) {
int dimSize = dataRank;
- float fz = (spatialDimSize > 2) ? dataScales[dimSize - 3] : 1.f;
- float fy = (spatialDimSize > 1) ? dataScales[dimSize - 2] : 1.f;
+ float fz = (spatialDimSize > 2) ? dataScales[dimSize - 3] : 1.F;
+ float fy = (spatialDimSize > 1) ? dataScales[dimSize - 2] : 1.F;
float fx = dataScales[dimSize - 1];
- int ID = srcDimPad5d[2], IH = srcDimPad5d[3], IW = srcDimPad5d[4];
- int OD = dstDim5d[2], OH = dstDim5d[3], OW = dstDim5d[4];
+ int ID = srcDimPad5d[2];
+ int IH = srcDimPad5d[3];
+ int IW = srcDimPad5d[4];
+ int OD = dstDim5d[2];
+ int OH = dstDim5d[3];
+ int OW = dstDim5d[4];
std::vector<int*> indexPtr(MAX_INPUT_INTERPOLATE, nullptr);
std::vector<float*> weightPtr(MAX_INPUT_INTERPOLATE, nullptr);
@@ -3266,7 +3276,7 @@ void Interpolate::InterpolateExecutorBase::buildTblLinearOnnx(const VectorDims&
int scratchLen = rnd_up(eltInGrid * OW * OH * OD, 16);
auxTable.resize(idxType * scratchLen);
- indexPtr[0] = static_cast<int*>(&auxTable[0]);
+ indexPtr[0] = static_cast<int*>(auxTable.data());
indexPtr[1] = static_cast<int*>(&auxTable[OW * OH * OD]);
weightPtr[0] = reinterpret_cast<float*>(&auxTable[scratchLen]);
weightPtr[1] = reinterpret_cast<float*>(&auxTable[scratchLen + OW * OH * OD]);
@@ -3287,18 +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, izE;
- float weightF, weightE;
+ int izF;
+ int izE;
+ float weightF;
+ float weightE;
linearOnnxCF(oz, fz, ID, OD, izF, izE, weightF, weightE);
int idxOz = oz * OH * OW;
for (int oy = 0; oy < OH; oy++) {
- int iyT, iyB;
- float weightT, weightB;
+ int iyT;
+ int iyB;
+ float weightT;
+ float weightB;
linearOnnxCF(oy, fy, IH, OH, iyT, iyB, weightT, weightB);
int idxOzOy = idxOz + oy * OW;
for (int ox = 0; ox < OW; ox++) {
- int ixL, ixR;
- float weightL, weightR;
+ int ixL;
+ int ixR;
+ float weightL;
+ float weightR;
linearOnnxCF(ox, fx, IW, OW, ixL, ixR, weightL, weightR);
int idxOzOyOx = idxOzOy + ox;
@@ -3329,7 +3345,7 @@ void Interpolate::InterpolateExecutorBase::buildTblLinearOnnx(const VectorDims&
size_t scratchLen = rnd_up(OW + OW + OH + OH + OD + OD, 16);
int idxType = 2;
auxTable.resize(idxType * scratchLen);
- indexPtr[0] = static_cast<int*>(&auxTable[0]);
+ indexPtr[0] = static_cast<int*>(auxTable.data());
indexPtr[1] = static_cast<int*>(&auxTable[OW]);
indexPtr[2] = static_cast<int*>(&auxTable[2 * OW]);
indexPtr[3] = static_cast<int*>(&auxTable[2 * OW + OH]);
@@ -3365,20 +3381,24 @@ void Interpolate::InterpolateExecutorBase::buildTblLinear(const VectorDims& srcD
int kernel_width,
bool antialias) {
int dimSize = dataRank;
- float fz = (dimSize == 5) ? dataScales[dimSize - 3] : 1.f;
+ float fz = (dimSize == 5) ? dataScales[dimSize - 3] : 1.F;
float fy = dataScales[dimSize - 2];
float fx = dataScales[dimSize - 1];
- size_t ID = srcDimPad5d[2], IH = srcDimPad5d[3], IW = srcDimPad5d[4];
- size_t OD = dstDim5d[2], OH = dstDim5d[3], OW = dstDim5d[4];
-
- if (!(IW == OW && IH == OH && ID == OD)) {
- float ax = antialias ? fx : 1.0f;
- float ay = antialias ? fy : 1.0f;
- float az = antialias ? fz : 1.0f;
-
- int rx = (fx > 1.0f) ? 2 : static_cast<int>(ceil(static_cast<float>(kernel_width) / ax));
- int ry = (fy > 1.0f) ? 2 : static_cast<int>(ceil(static_cast<float>(kernel_width) / ay));
- int rz = (fz > 1.0f) ? 2 : static_cast<int>(ceil(static_cast<float>(kernel_width) / az));
+ size_t ID = srcDimPad5d[2];
+ size_t IH = srcDimPad5d[3];
+ size_t IW = srcDimPad5d[4];
+ size_t OD = dstDim5d[2];
+ size_t OH = dstDim5d[3];
+ size_t OW = dstDim5d[4];
+
+ if (IW != OW || IH != OH || ID != OD) {
+ float ax = antialias ? fx : 1.0F;
+ float ay = antialias ? fy : 1.0F;
+ float az = antialias ? fz : 1.0F;
+
+ int rx = (fx > 1.0F) ? 2 : static_cast<int>(ceil(static_cast<float>(kernel_width) / ax));
+ int ry = (fy > 1.0F) ? 2 : static_cast<int>(ceil(static_cast<float>(kernel_width) / ay));
+ int rz = (fz > 1.0F) ? 2 : static_cast<int>(ceil(static_cast<float>(kernel_width) / az));
int diaOD = 2 * rz + 1;
int diaOH = 2 * ry + 1;
@@ -3387,15 +3407,15 @@ void Interpolate::InterpolateExecutorBase::buildTblLinear(const VectorDims& srcD
int sizeOH = OH * diaOH;
int sizeOW = OW * diaOW;
auxTable.resize((sizeOD + sizeOH + sizeOW) * 2);
- auto* weightTable = reinterpret_cast<float*>(&auxTable[0]);
- auto* weightOD = static_cast<float*>(&weightTable[0]);
- auto* weightOH = static_cast<float*>(&weightTable[sizeOD]);
- auto* weightOW = static_cast<float*>(&weightTable[sizeOD + sizeOH]);
+ auto* weightTable = reinterpret_cast<float*>(auxTable.data());
+ auto* weightOD = (&weightTable[0]);
+ auto* weightOH = (&weightTable[sizeOD]);
+ auto* weightOW = (&weightTable[sizeOD + sizeOH]);
auto* idxTable = static_cast<int*>(&auxTable[sizeOD + sizeOH + sizeOW]);
- auto* idxOD = static_cast<int*>(&idxTable[0]);
- auto* idxOH = static_cast<int*>(&idxTable[sizeOD]);
- auto* idxOW = static_cast<int*>(&idxTable[sizeOD + sizeOH]);
+ auto* idxOD = (&idxTable[0]);
+ auto* idxOH = (&idxTable[sizeOD]);
+ auto* idxOW = (&idxTable[sizeOD + sizeOH]);
for (size_t oz = 0; oz < OD; oz++) {
float iz = coordTransToInput(oz, fz, ID, OD);
@@ -3403,7 +3423,7 @@ void Interpolate::InterpolateExecutorBase::buildTblLinear(const VectorDims& srcD
for (int r = iz_r - rz, i = 0; r <= iz_r + rz; r++, i++) {
idxOD[oz * diaOD + i] = r;
if (r < 0 || r >= static_cast<int>(ID)) {
- weightOD[oz * diaOD + i] = 0.f;
+ weightOD[oz * diaOD + i] = 0.F;
} else {
float dz = iz - r;
weightOD[oz * diaOD + i] = az * triangleCoeff(az * dz);
@@ -3416,7 +3436,7 @@ void Interpolate::InterpolateExecutorBase::buildTblLinear(const VectorDims& srcD
for (int r = iy_r - ry, i = 0; r <= iy_r + ry; r++, i++) {
idxOH[oy * diaOH + i] = r;
if (r < 0 || r >= static_cast<int>(IH)) {
- weightOH[oy * diaOH + i] = 0.f;
+ weightOH[oy * diaOH + i] = 0.F;
} else {
float dy = iy - r;
weightOH[oy * diaOH + i] = ay * triangleCoeff(ay * dy);
@@ -3429,7 +3449,7 @@ void Interpolate::InterpolateExecutorBase::buildTblLinear(const VectorDims& srcD
for (int r = ix_r - rx, i = 0; r <= ix_r + rx; r++, i++) {
idxOW[ox * diaOW + i] = r;
if (r < 0 || r >= static_cast<int>(IW)) {
- weightOW[ox * diaOW + i] = 0.f;
+ weightOW[ox * diaOW + i] = 0.F;
} else {
float dx = ix - r;
weightOW[ox * diaOW + i] = ax * triangleCoeff(ax * dx);
@@ -3441,7 +3461,7 @@ void Interpolate::InterpolateExecutorBase::buildTblLinear(const VectorDims& srcD
std::vector<float> Interpolate::InterpolateExecutorBase::getCubicCoeffs(float mantissa, float a) {
float m = std::fabs(mantissa);
- std::vector<float> coeffs(4, 0.f);
+ std::vector<float> coeffs(4, 0.F);
coeffs[0] = a * (m - 1.0) * (m - 1.0) * m;
coeffs[1] = ((a + 2.0) * m - (a + 3.0)) * m * m + 1.0;
@@ -3461,8 +3481,10 @@ void Interpolate::InterpolateExecutorBase::buildTblCubic(const VectorDims& srcDi
int dimSize = dataRank;
float fy = dataScales[dimSize - 2];
float fx = dataScales[dimSize - 1];
- int IH = srcDimPad5d[3], IW = srcDimPad5d[4];
- int OH = dstDim5d[3], OW = dstDim5d[4];
+ int IH = srcDimPad5d[3];
+ int IW = srcDimPad5d[4];
+ int OH = dstDim5d[3];
+ int OW = dstDim5d[4];
// idxNum for index, CUBIC_GRID_LEN for weight
const int idxNum = 1;
@@ -3522,27 +3544,27 @@ void Interpolate::InterpolateExecutorBase::buildTblCubic(const VectorDims& srcDi
}
float Interpolate::InterpolateExecutorBase::getPillowBilinearCoeffs(float m) {
- if (m < 0.0f) {
+ if (m < 0.0F) {
m = -m;
}
if (m < 1.0) {
- return 1.0f - m;
+ return 1.0F - m;
}
- return 0.0f;
+ return 0.0F;
}
float Interpolate::InterpolateExecutorBase::getPillowBicubicCoeffs(float m) {
- float a = -0.5f;
- if (m < 0.0f) {
+ float a = -0.5F;
+ if (m < 0.0F) {
m = -m;
}
if (m < 1.0) {
return ((a + 2.0) * m - (a + 3.0)) * m * m + 1.0;
}
- if (m < 2.0f) {
+ if (m < 2.0F) {
return (((m - 5) * m + 8) * m - 4) * a;
}
- return 0.0f;
+ return 0.0F;
}
void Interpolate::InterpolateExecutorBase::buildTblPillow(const VectorDims& srcDimPad5d,
@@ -3553,8 +3575,10 @@ void Interpolate::InterpolateExecutorBase::buildTblPillow(const VectorDims& srcD
int dimSize = dataRank;
float fy = dataScales[dimSize - 2];
float fx = dataScales[dimSize - 1];
- int IH = srcDimPad5d[3], IW = srcDimPad5d[4];
- int OH = dstDim5d[3], OW = dstDim5d[4];
+ int IH = srcDimPad5d[3];
+ int IW = srcDimPad5d[4];
+ int OH = dstDim5d[3];
+ int OW = dstDim5d[4];
struct filterArgs {
float (*weightGen)(float m);
@@ -3566,18 +3590,19 @@ void Interpolate::InterpolateExecutorBase::buildTblPillow(const VectorDims& srcD
// pillowScale: e.g. 2.0 means down sample 2 times
auto generateArgs = [&](float pillowScale) -> filterArgs {
filterArgs args;
- float scaleClip = pillowScale < 1.0f ? 1.0f : pillowScale;
- args.ScaleClipReciprocal = 1.0f / scaleClip;
+ float scaleClip = pillowScale < 1.0F ? 1.0F : pillowScale;
+ args.ScaleClipReciprocal = 1.0F / scaleClip;
args.filterRadius = (mode == InterpolateMode::bilinear_pillow) ? PILLOW_BILINEAR_WINDOW_SCALE * scaleClip
: PILLOW_BICUBIC_WINDOW_SCALE * scaleClip;
args.filterLen = static_cast<int>(std::ceil(args.filterRadius) * 2 + 1);
- args.weightGen =
- (mode == InterpolateMode::bilinear_pillow) ? this->getPillowBilinearCoeffs : this->getPillowBicubicCoeffs;
+ args.weightGen = (mode == InterpolateMode::bilinear_pillow)
+ ? ov::intel_cpu::node::Interpolate::InterpolateExecutorBase::getPillowBilinearCoeffs
+ : ov::intel_cpu::node::Interpolate::InterpolateExecutorBase::getPillowBicubicCoeffs;
return args;
};
- filterArgs filterArgsX = generateArgs(1.0f / fx);
- filterArgs filterArgsY = generateArgs(1.0f / fy);
+ filterArgs filterArgsX = generateArgs(1.0F / fx);
+ filterArgs filterArgsY = generateArgs(1.0F / fy);
// index with Run Length Coding(start+len for each ow/oh)
size_t weightLen = filterArgsX.filterLen * OW + filterArgsY.filterLen * OH;
@@ -3600,11 +3625,11 @@ void Interpolate::InterpolateExecutorBase::buildTblPillow(const VectorDims& srcD
int max = 0;
for (int ox = 0; ox < outLen; ox++) {
float ixCenter = coordTransToInput(ox, fScale, inLen, outLen);
- min = static_cast<int>(ixCenter - args.filterRadius + 0.5f);
+ min = static_cast<int>(ixCenter - args.filterRadius + 0.5F);
if (min < 0) {
min = 0;
}
- max = static_cast<int>(ixCenter + args.filterRadius + 0.5f);
+ max = static_cast<int>(ixCenter + args.filterRadius + 0.5F);
if (max > inLen) {
max = inLen;
}
@@ -3631,7 +3656,7 @@ void Interpolate::InterpolateExecutorBase::buildTblPillow(const VectorDims& srcD
// filterlen is maximum possible len, set others to 0 for possible uniform process(vector)
for (; ix < args.filterLen; ix++) {
- weightTbl[offset + ix] = 0.f;
+ weightTbl[offset + ix] = 0.F;
}
}
};
@@ -3650,7 +3675,7 @@ void Interpolate::InterpolateRefExecutor::NNRef(const uint8_t* in_ptr_,
int OD,
int OH,
int OW) {
- auto* index_d = static_cast<int*>(&auxTable[0]);
+ auto* index_d = static_cast<int*>(auxTable.data());
auto* index_h = static_cast<int*>(&auxTable[OD]);
auto* index_w = static_cast<int*>(&auxTable[OD + OH]);
@@ -3689,7 +3714,7 @@ void Interpolate::InterpolateRefExecutor::linearOnnxRef(const uint8_t* in_ptr_,
int eltInGrid = (spatialDimSize > 2) ? MAX_INPUT_INTERPOLATE : ((spatialDimSize > 1) ? 4 : 2);
int scratchLen = rnd_up(eltInGrid * OW * OH * OD, 16);
- indexPtr[0] = static_cast<int*>(&auxTable[0]);
+ indexPtr[0] = static_cast<int*>(auxTable.data());
indexPtr[1] = static_cast<int*>(&auxTable[OW * OH * OD]);
weightPtr[0] = reinterpret_cast<float*>(&auxTable[scratchLen]);
weightPtr[1] = reinterpret_cast<float*>(&auxTable[scratchLen + OW * OH * OD]);
@@ -3778,7 +3803,7 @@ void Interpolate::InterpolateRefExecutor::cubicRef(const uint8_t* in_ptr_,
int OH,
int OW) {
const int idxNum = 1;
- auto* xOrigin = static_cast<int*>(&auxTable[0]);
+ auto* xOrigin = static_cast<int*>(auxTable.data());
auto* xFactor = reinterpret_cast<float*>(&auxTable[OW]);
auto* yOrigin = static_cast<int*>(&auxTable[(CUBIC_GRID_LEN + idxNum) * OW]);
auto* yFactor = reinterpret_cast<float*>(&auxTable[(CUBIC_GRID_LEN + idxNum) * OW + OH]);
@@ -3793,11 +3818,11 @@ void Interpolate::InterpolateRefExecutor::cubicRef(const uint8_t* in_ptr_,
int iy = yOrigin[oy];
int ix = xOrigin[ox];
- float retY = 0.f;
+ float retY = 0.F;
for (int y = iy - 1, i = 0; y <= iy + 2; y++, i++) {
int yInRange = std::max(0, std::min(y, IH - 1));
const float* in_ptr_nch = in_ptr_nc + IW * yInRange;
- float retX = 0.f;
+ float retX = 0.F;
for (int x = ix - 1, j = 0; x <= ix + 2; x++, j++) {
int xInRange = std::max(0, std::min(x, IW - 1));
retX += xFactor[ox * CUBIC_GRID_LEN + j] * in_ptr_nch[xInRange];
@@ -3900,13 +3925,13 @@ void Interpolate::InterpolateRefExecutor::linearInterpolation(const uint8_t* in_
return;
}
- float ax = antialias ? fx : 1.0f;
- float ay = antialias ? fy : 1.0f;
- float az = antialias ? fz : 1.0f;
+ float ax = antialias ? fx : 1.0F;
+ float ay = antialias ? fy : 1.0F;
+ float az = antialias ? fz : 1.0F;
- int rx = (fx > 1.0f) ? 2 : static_cast<int>(ceil(static_cast<float>(kernel_width) / ax));
- int ry = (fy > 1.0f) ? 2 : static_cast<int>(ceil(static_cast<float>(kernel_width) / ay));
- int rz = (fz > 1.0f) ? 2 : static_cast<int>(ceil(static_cast<float>(kernel_width) / az));
+ int rx = (fx > 1.0F) ? 2 : static_cast<int>(ceil(static_cast<float>(kernel_width) / ax));
+ int ry = (fy > 1.0F) ? 2 : static_cast<int>(ceil(static_cast<float>(kernel_width) / ay));
+ int rz = (fz > 1.0F) ? 2 : static_cast<int>(ceil(static_cast<float>(kernel_width) / az));
int diaOD = 2 * rz + 1;
int diaOH = 2 * ry + 1;
@@ -3915,15 +3940,15 @@ void Interpolate::InterpolateRefExecutor::linearInterpolation(const uint8_t* in_
int sizeOH = OH * diaOH;
int sizeOW = OW * diaOW;
- auto* weightTable = reinterpret_cast<float*>(&auxTable[0]);
- auto* weightOD = static_cast<float*>(&weightTable[0]);
- auto* weightOH = static_cast<float*>(&weightTable[sizeOD]);
- auto* weightOW = static_cast<float*>(&weightTable[sizeOD + sizeOH]);
+ auto* weightTable = reinterpret_cast<float*>(auxTable.data());
+ auto* weightOD = (&weightTable[0]);
+ auto* weightOH = (&weightTable[sizeOD]);
+ auto* weightOW = (&weightTable[sizeOD + sizeOH]);
auto* idxTable = static_cast<int*>(&auxTable[sizeOD + sizeOH + sizeOW]);
- auto* idxOD = static_cast<int*>(&idxTable[0]);
- auto* idxOH = static_cast<int*>(&idxTable[sizeOD]);
- auto* idxOW = static_cast<int*>(&idxTable[sizeOD + sizeOH]);
+ auto* idxOD = (&idxTable[0]);
+ auto* idxOH = (&idxTable[sizeOD]);
+ auto* idxOW = (&idxTable[sizeOD + sizeOH]);
parallel_for2d(B, C, [&](size_t b, size_t c) {
const uint8_t* in_ptr_nc = in_ptr_ + (IW * IH * ID * C * b + IW * IH * ID * c) * srcDataSize;
@@ -3933,8 +3958,8 @@ void Interpolate::InterpolateRefExecutor::linearInterpolation(const uint8_t* in_
for (int oy = 0; oy < OH; oy++) {
uint8_t* out_ptr_ncdh = out_ptr_ncd + (OW * oy) * dstDataSize;
for (int ox = 0; ox < OW; ox++) {
- float sum = 0.f;
- float wsum = 0.f;
+ float sum = 0.F;
+ float wsum = 0.F;
// this comment explains the original algo.
// for (int z = iz_r - rz; z <= iz_r + rz; z++) {
@@ -3964,15 +3989,15 @@ void Interpolate::InterpolateRefExecutor::linearInterpolation(const uint8_t* in_
//}
for (int iz = 0; iz < diaOD; iz++) {
- if (weightOD[oz * diaOD + iz] == 0.f) {
+ if (weightOD[oz * diaOD + iz] == 0.F) {
continue;
}
for (int iy = 0; iy < diaOH; iy++) {
- if (weightOH[oy * diaOH + iy] == 0.f) {
+ if (weightOH[oy * diaOH + iy] == 0.F) {
continue;
}
for (int ix = 0; ix < diaOW; ix++) {
- if (weightOW[ox * diaOW + ix] == 0.f) {
+ if (weightOW[ox * diaOW + ix] == 0.F) {
continue;
}
float w =
@@ -3989,8 +4014,8 @@ void Interpolate::InterpolateRefExecutor::linearInterpolation(const uint8_t* in_
}
}
- if (wsum == 0.0f) {
- setValue(out_ptr_ncdh, ox * dstDataSize, 0.f, outputPrec);
+ if (wsum == 0.0F) {
+ setValue(out_ptr_ncdh, ox * dstDataSize, 0.F, outputPrec);
} else {
float dst_value = sum / wsum;
setValue(out_ptr_ncdh, ox * dstDataSize, dst_value, outputPrec);
@@ -4064,21 +4089,23 @@ void Interpolate::InterpolateRefExecutor::pillowRef(const uint8_t* in_ptr_,
cpu_memcpy(out_ptr_nc, in_ptr_nc, OH * OW * dstDataSize);
}
float result;
- int f, filterS, filterL;
+ int f;
+ int filterS;
+ int filterL;
float* weight;
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++) {
filterS = indexX[ow * 2];
filterL = indexX[ow * 2 + 1];
- weight = reinterpret_cast<float*>(&weightX[ow * filterLenX]);
- result = 0.f;
+ weight = (&weightX[ow * filterLenX]);
+ result = 0.F;
for (f = 0; f < filterL; f++) {
float pixel = getValue(in_ptr_nc, (ih * IW + f + filterS) * srcDataSize, inputPrec);
result += pixel * weight[f];
}
if (!isFloatCompatible(outputPrec)) {
- result = static_cast<float>(static_cast<int>(result >= 0.0 ? result + 0.5f : result - 0.5f));
+ result = static_cast<float>(static_cast<int>(result >= 0.0 ? result + 0.5F : result - 0.5F));
}
setValue(xpass_out_ptr_nc, (ih * OW + ow) * dstDataSize, result, outputPrec);
}
@@ -4088,15 +4115,15 @@ void Interpolate::InterpolateRefExecutor::pillowRef(const uint8_t* in_ptr_,
for (size_t oh = 0; oh < static_cast<size_t>(OH); oh++) {
filterS = indexY[oh * 2];
filterL = indexY[oh * 2 + 1];
- weight = reinterpret_cast<float*>(&weightY[oh * filterLenY]);
+ weight = (&weightY[oh * filterLenY]);
for (size_t ow = 0; ow < static_cast<size_t>(OW); ow++) {
- result = 0.f;
+ result = 0.F;
for (f = 0; f < filterL; f++) {
float pixel = getValue(ypass_in_ptr_nc, ((f + filterS) * OW + ow) * srcDataSize, inputPrec);
result += pixel * weight[f];
}
if (!isFloatCompatible(outputPrec)) {
- result = static_cast<float>(static_cast<int>(result >= 0.0 ? result + 0.5f : result - 0.5f));
+ result = static_cast<float>(static_cast<int>(result >= 0.0 ? result + 0.5F : result - 0.5F));
}
setValue(out_ptr_nc, (oh * OW + ow) * dstDataSize, result, outputPrec);
}
@@ -4158,7 +4185,9 @@ void Interpolate::InterpolateRefExecutor::pillowRefNCHWAsNHWC(const uint8_t* in_
}
float result;
- int f, filterS, filterL;
+ int f;
+ int filterS;
+ int filterL;
float* weight;
if (xPass) {
@@ -4166,9 +4195,9 @@ void Interpolate::InterpolateRefExecutor::pillowRefNCHWAsNHWC(const uint8_t* in_
for (size_t ow = 0; ow < static_cast<size_t>(OW); ow++) {
filterS = indexX[ow * 2];
filterL = indexX[ow * 2 + 1];
- weight = reinterpret_cast<float*>(&weightX[ow * filterLenX]);
+ weight = (&weightX[ow * filterLenX]);
for (size_t c = 0; c < static_cast<size_t>(C); c++) {
- result = 0.f;
+ result = 0.F;
for (f = 0; f < filterL; f++) {
float pixel =
getValue(in_ptr_b, ((ih * IW + (f + filterS)) * C + c) * srcDataSize, inputPrec);
@@ -4176,7 +4205,7 @@ void Interpolate::InterpolateRefExecutor::pillowRefNCHWAsNHWC(const uint8_t* in_
}
if (!isFloatCompatible(outputPrec)) {
result =
- static_cast<float>(static_cast<int>(result >= 0.0 ? result + 0.5f : result - 0.5f));
+ static_cast<float>(static_cast<int>(result >= 0.0 ? result + 0.5F : result - 0.5F));
}
setValue(xpass_out_ptr_b, ((ih * OW + ow) * C + c) * dstDataSize, result, outputPrec);
}
@@ -4188,10 +4217,10 @@ void Interpolate::InterpolateRefExecutor::pillowRefNCHWAsNHWC(const uint8_t* in_
for (size_t oh = 0; oh < static_cast<size_t>(OH); oh++) {
filterS = indexY[oh * 2];
filterL = indexY[oh * 2 + 1];
- weight = reinterpret_cast<float*>(&weightY[oh * filterLenY]);
+ weight = (&weightY[oh * filterLenY]);
for (size_t ow = 0; ow < static_cast<size_t>(OW); ow++) {
for (size_t c = 0; c < static_cast<size_t>(C); c++) {
- result = 0.f;
+ result = 0.F;
for (f = 0; f < filterL; f++) {
float pixel =
getValue(ypass_in_ptr_b, (((f + filterS) * OW + ow) * C + c) * srcDataSize, inputPrec);
@@ -4199,7 +4228,7 @@ void Interpolate::InterpolateRefExecutor::pillowRefNCHWAsNHWC(const uint8_t* in_
}
if (!isFloatCompatible(outputPrec)) {
result =
- static_cast<float>(static_cast<int>(result >= 0.0 ? result + 0.5f : result - 0.5f));
+ static_cast<float>(static_cast<int>(result >= 0.0 ? result + 0.5F : result - 0.5F));
}
setValue(out_ptr_b, ((oh * OW + ow) * C + c) * dstDataSize, result, outputPrec);
}
@@ -4332,8 +4361,14 @@ Interpolate::InterpolateJitExecutor::InterpolateJitExecutor(const InterpolateAtt
}
void Interpolate::InterpolateJitExecutor::exec(const uint8_t* in_ptr_, uint8_t* out_ptr_, const void* post_ops_data_) {
- size_t N = srcDimPad5d[0], C = srcDimPad5d[1], ID = srcDimPad5d[2], IH = srcDimPad5d[3], IW = srcDimPad5d[4];
- size_t OD = dstDim5d[2], OH = dstDim5d[3], OW = dstDim5d[4];
+ size_t N = srcDimPad5d[0];
+ size_t C = srcDimPad5d[1];
+ size_t ID = srcDimPad5d[2];
+ size_t IH = srcDimPad5d[3];
+ size_t IW = srcDimPad5d[4];
+ size_t OD = dstDim5d[2];
+ size_t OH = dstDim5d[3];
+ size_t OW = dstDim5d[4];
if (!interpolateKernel) {
OPENVINO_THROW("Can't execute, kernel for Interpolate node is not compiled");
@@ -4381,8 +4416,14 @@ void Interpolate::InterpolateJitExecutor::exec(const uint8_t* in_ptr_, uint8_t*
void Interpolate::InterpolateRefExecutor::exec(const uint8_t* in_ptr_,
uint8_t* out_ptr_,
[[maybe_unused]] const void* post_ops_data_) {
- size_t N = srcDimPad5d[0], C = srcDimPad5d[1], ID = srcDimPad5d[2], IH = srcDimPad5d[3], IW = srcDimPad5d[4];
- size_t OD = dstDim5d[2], OH = dstDim5d[3], OW = dstDim5d[4];
+ size_t N = srcDimPad5d[0];
+ size_t C = srcDimPad5d[1];
+ size_t ID = srcDimPad5d[2];
+ size_t IH = srcDimPad5d[3];
+ size_t IW = srcDimPad5d[4];
+ size_t OD = dstDim5d[2];
+ size_t OH = dstDim5d[3];
+ size_t OW = dstDim5d[4];
switch (mode) {
case InterpolateMode::nearest: {
@@ -4398,11 +4439,11 @@ void Interpolate::InterpolateRefExecutor::exec(const uint8_t* in_ptr_,
break;
}
case InterpolateMode::linear: {
- float fz = (dataRank == 5) ? dataScales[dataRank - 3] : 1.f;
+ float fz = (dataRank == 5) ? dataScales[dataRank - 3] : 1.F;
float fy = dataScales[dataRank - 2];
float fx = dataScales[dataRank - 1];
- bool isDownsample = (fx < 1.f) || (fy < 1.f) || (fz < 1.f);
+ bool isDownsample = (fx < 1.F) || (fy < 1.F) || (fz < 1.F);
int kernel_width = 2;
linearInterpolation(in_ptr_,
out_ptr_,
@@ -4454,7 +4495,7 @@ size_t Interpolate::getSpatialDimsNum(const Dim rank) {
bool Interpolate::canFuse(const NodePtr& node) const {
if (!mayiuse(cpu::x64::sse41) || interpAttrs.mode == InterpolateMode::linear ||
interpAttrs.mode == InterpolateMode::bilinear_pillow || interpAttrs.mode == InterpolateMode::bicubic_pillow ||
- (!one_of(dataRank, 4u, 5u) && !mayiuse(cpu::x64::avx2))) {
+ (!one_of(dataRank, 4U, 5U) && !mayiuse(cpu::x64::avx2))) {
return false;
}
diff --git a/src/plugins/intel_cpu/src/nodes/interpolate.h b/src/plugins/intel_cpu/src/nodes/interpolate.h
index ff5177c7dd6..5e4032754db 100644
--- a/src/plugins/intel_cpu/src/nodes/interpolate.h
+++ b/src/plugins/intel_cpu/src/nodes/interpolate.h
@@ -154,7 +154,7 @@ private:
InterpolateLayoutType layout);
float coordTransToInput(int outCoord, float scale, int inShape, int outShape) const;
- int nearestRound(float origin, bool isDownsample, InterpolateNearestMode nearestMode) const;
+ static int nearestRound(float origin, bool isDownsample, InterpolateNearestMode nearestMode);
void linearOnnxCF(int outCoord,
float scale,
int inShape,
@@ -163,7 +163,7 @@ private:
int& index1,
float& weight0,
float& weight1);
- std::vector<float> getCubicCoeffs(float mantissa, float a);
+ static std::vector<float> getCubicCoeffs(float mantissa, float a);
static float getPillowBilinearCoeffs(float m);
static float getPillowBicubicCoeffs(float m);
inline void create_pillow_working_buf(InterpolateLayoutType layout);
diff --git a/src/plugins/intel_cpu/src/nodes/inverse.cpp b/src/plugins/intel_cpu/src/nodes/inverse.cpp
index 2d2c87475b0..5728291a5c9 100644
--- a/src/plugins/intel_cpu/src/nodes/inverse.cpp
+++ b/src/plugins/intel_cpu/src/nodes/inverse.cpp
@@ -126,13 +126,13 @@ void Inverse::lu_decomposition(const float* data,
std::vector<float>& L,
std::vector<float>& U,
std::vector<size_t>& P,
- size_t b) {
+ size_t b) const {
// Make L identity, U a copy of data and P a range(0, side)
const auto batch_idx = b * m_side_squared;
- std::fill(L.begin(), L.end(), 0.0f);
+ std::fill(L.begin(), L.end(), 0.0F);
if (!m_adjoint) {
- cpu_parallel_memcpy(&U[0], &data[batch_idx], sizeof(float) * m_side_squared);
+ cpu_parallel_memcpy(U.data(), &data[batch_idx], sizeof(float) * m_side_squared);
} else {
parallel_for2d(m_side, m_side, [&](size_t i, size_t j) {
U[j * m_side + i] = data[batch_idx + i * m_side + j];
@@ -140,7 +140,7 @@ void Inverse::lu_decomposition(const float* data,
}
parallel_for(m_side, [&](size_t i) {
- L[i * m_side + i] = 1.0f;
+ L[i * m_side + i] = 1.0F;
P[i] = i;
});
@@ -183,15 +183,19 @@ void Inverse::lu_decomposition(const float* data,
}
}
-void Inverse::lu_solve(float* output, std::vector<float>& L, std::vector<float>& U, std::vector<size_t>& P, size_t b) {
+void Inverse::lu_solve(float* output,
+ std::vector<float>& L,
+ std::vector<float>& U,
+ std::vector<size_t>& P,
+ size_t b) const {
parallel_for(m_side, [&](size_t column) {
- std::vector<float> X(m_side, 0.0f);
- std::vector<float> Y(m_side, 0.0f);
+ std::vector<float> X(m_side, 0.0F);
+ std::vector<float> Y(m_side, 0.0F);
// Forward substitution: Ly = Pb
for (size_t i = 0; i < m_side; ++i) {
if (P[i] == column) {
- Y[i] = 1.0f;
+ Y[i] = 1.0F;
}
const auto i_idx = i * m_side;
for (size_t j = 0; j < i; ++j) {
diff --git a/src/plugins/intel_cpu/src/nodes/inverse.hpp b/src/plugins/intel_cpu/src/nodes/inverse.hpp
index a3249c2cb10..77b9b47f1b6 100644
--- a/src/plugins/intel_cpu/src/nodes/inverse.hpp
+++ b/src/plugins/intel_cpu/src/nodes/inverse.hpp
@@ -59,9 +59,9 @@ private:
std::vector<float>& L,
std::vector<float>& U,
std::vector<size_t>& P,
- size_t b);
+ size_t b) const;
- void lu_solve(float* output, std::vector<float>& L, std::vector<float>& U, std::vector<size_t>& P, size_t b);
+ void lu_solve(float* output, std::vector<float>& L, std::vector<float>& U, std::vector<size_t>& P, size_t b) const;
};
} // namespace ov::intel_cpu::node
diff --git a/src/plugins/intel_cpu/src/nodes/istft.cpp b/src/plugins/intel_cpu/src/nodes/istft.cpp
index af0b4ff46fd..d00b8ff1b38 100644
--- a/src/plugins/intel_cpu/src/nodes/istft.cpp
+++ b/src/plugins/intel_cpu/src/nodes/istft.cpp
@@ -105,11 +105,11 @@ bool ISTFT::created() const {
}
namespace {
-static void transpose_out4d(const uint8_t* in,
- uint8_t* out,
- const VectorDims& in_shape,
- const VectorDims& out_shape,
- size_t elem_size) {
+void transpose_out4d(const uint8_t* in,
+ uint8_t* out,
+ const VectorDims& in_shape,
+ const VectorDims& out_shape,
+ size_t elem_size) {
const std::vector<size_t> axes_order{0, 2, 1, 3};
parallel_for3d(out_shape[0],
out_shape[1],
@@ -147,9 +147,9 @@ void istft_impl(const float* in_data,
const auto signal_length = (num_frames - 1) * frame_step + frame_size;
const int64_t final_signal_length =
length > 0 ? length : (center ? (signal_length - (frame_size & ~1)) : signal_length);
- std::fill(final_result, final_result + batch_size * final_signal_length, 0.f);
+ std::fill(final_result, final_result + batch_size * final_signal_length, 0.F);
- std::vector<float> mid_result(batch_size * signal_length, 0.f);
+ std::vector<float> mid_result(batch_size * signal_length, 0.F);
const auto fft_results_dim = data_shape[data_shape.size() - 3];
OPENVINO_ASSERT(fft_results_dim == static_cast<size_t>((frame_size / 2) + 1));
@@ -175,16 +175,16 @@ void istft_impl(const float* in_data,
// Setting function for the result postprocessing
const auto norm_window_div = [sqrt_frame_size](float a, float b) {
- if (b != 0.f) {
+ if (b != 0.F) {
return (a * sqrt_frame_size) / b;
}
- return 0.f;
+ return 0.F;
};
const auto window_div = [](float a, float b) {
- if (b != 0.f) {
+ if (b != 0.F) {
return a / b;
}
- return 0.f;
+ return 0.F;
};
std::function<float(float, float)> postprocess_func;
if (normalized) {
diff --git a/src/plugins/intel_cpu/src/nodes/kernels/aarch64/brgemm_kernel.cpp b/src/plugins/intel_cpu/src/nodes/kernels/aarch64/brgemm_kernel.cpp
index 7fe35ef980d..e87b6bd7a89 100644
--- a/src/plugins/intel_cpu/src/nodes/kernels/aarch64/brgemm_kernel.cpp
+++ b/src/plugins/intel_cpu/src/nodes/kernels/aarch64/brgemm_kernel.cpp
@@ -75,7 +75,7 @@ BrgemmKernel::BrgemmKernel(size_t M,
auto M_ = m ? M_tail : M < M_blk ? 0 : M_blk;
auto N_ = n ? N_tail : N - N_tail;
auto K_ = k ? K_tail : K - K % K_blk;
- auto beta = (b_accumulate || (k && brgCtxs[getBrgIdx(m, 0, n)].K != 0)) ? 1.0f : 0.0f;
+ auto beta = (b_accumulate || (k && brgCtxs[getBrgIdx(m, 0, n)].K != 0)) ? 1.0F : 0.0F;
brgemmCtx.M = M_;
brgemmCtx.N = N_;
@@ -116,11 +116,11 @@ BrgemmKernel::BrgemmKernel(size_t M,
}
}
-const size_t BrgemmKernel::get_scratch_a_size() const {
+size_t BrgemmKernel::get_scratch_a_size() const {
return packedASize;
}
-const size_t BrgemmKernel::get_scratch_b_size() const {
+size_t BrgemmKernel::get_scratch_b_size() const {
return packedBSize;
}
@@ -136,7 +136,7 @@ void BrgemmKernel::init_brgemm(brgemmCtx& ctx, std::unique_ptr<dnnl::impl::cpu::
ctx.transpose_a,
ctx.transpose_b,
brgemm_row_major,
- 1.f,
+ 1.F,
ctx.beta,
ctx.LDA,
ctx.LDB,
diff --git a/src/plugins/intel_cpu/src/nodes/kernels/aarch64/brgemm_kernel.hpp b/src/plugins/intel_cpu/src/nodes/kernels/aarch64/brgemm_kernel.hpp
index a98809f6942..de4bd030ee1 100644
--- a/src/plugins/intel_cpu/src/nodes/kernels/aarch64/brgemm_kernel.hpp
+++ b/src/plugins/intel_cpu/src/nodes/kernels/aarch64/brgemm_kernel.hpp
@@ -38,9 +38,9 @@ public:
void copy_buffer_b(void* b, void* scratch_b);
// bytes needed to place scratch buffer a
- [[nodiscard]] const size_t get_scratch_a_size() const;
+ [[nodiscard]] size_t get_scratch_a_size() const;
// bytes needed to place scratch buffer b
- [[nodiscard]] const size_t get_scratch_b_size() const;
+ [[nodiscard]] size_t get_scratch_b_size() const;
[[nodiscard]] const size_t get_wsp_size() const {
return 4 * 1024;
}
@@ -71,9 +71,9 @@ private:
size_t getBrgIdx(size_t mIdx, size_t kIdx, size_t nIdx) {
return mIdx * 4 + kIdx * 2 + nIdx;
}
- void init_brgemm(brgemmCtx& ctx, std::unique_ptr<dnnl::impl::cpu::aarch64::brgemm_kernel_t>& brgKernel);
+ static void init_brgemm(brgemmCtx& ctx, std::unique_ptr<dnnl::impl::cpu::aarch64::brgemm_kernel_t>& brgKernel);
// LDA, LDB is used for stride of target memory
- void init_brgemm_copy_a(
+ static void init_brgemm_copy_a(
std::unique_ptr<dnnl::impl::cpu::aarch64::matmul::jit_brgemm_matmul_copy_a_t>& brgCopyKernel,
size_t K,
size_t K_blk,
@@ -83,7 +83,7 @@ private:
bool transpose = false,
size_t copy_A_src_stride = 0);
- void init_brgemm_copy_b(
+ static void init_brgemm_copy_b(
std::unique_ptr<dnnl::impl::cpu::aarch64::matmul::jit_brgemm_matmul_copy_b_t>& brgCopyKernel,
size_t N,
size_t N_blk,
@@ -95,11 +95,11 @@ private:
bool transpose = false,
size_t copy_B_wei_stride = 0);
- void callBrgemm(brgemmCtx& ctx,
- std::unique_ptr<dnnl::impl::cpu::aarch64::brgemm_kernel_t>& brgKernel,
- const void* pin0,
- const void* pin1,
- void* pout,
- void* wsp);
+ static void callBrgemm(brgemmCtx& ctx,
+ std::unique_ptr<dnnl::impl::cpu::aarch64::brgemm_kernel_t>& brgKernel,
+ const void* pin0,
+ const void* pin1,
+ void* pout,
+ void* wsp);
};
} // namespace ov::intel_cpu
diff --git a/src/plugins/intel_cpu/src/nodes/kernels/scaled_attn/attn_memcpy.cpp b/src/plugins/intel_cpu/src/nodes/kernels/scaled_attn/attn_memcpy.cpp
index 59e138b2c4f..8530d153367 100644
--- a/src/plugins/intel_cpu/src/nodes/kernels/scaled_attn/attn_memcpy.cpp
+++ b/src/plugins/intel_cpu/src/nodes/kernels/scaled_attn/attn_memcpy.cpp
@@ -51,8 +51,11 @@ void attn_memcpy_kernel(const ov::intel_cpu::PlainTensor& k_input,
const ov::intel_cpu::PlainTensor& past_k_output,
const ov::intel_cpu::PlainTensor& past_v_output) {
// For compatibility, all input_kvs are permuted to BHLS
- size_t B = k_input.m_dims[0], H = k_input.m_dims[1], L1 = k_input.m_dims[2], S = k_input.m_dims[3],
- SV = v_input.m_dims[3];
+ size_t B = k_input.m_dims[0];
+ size_t H = k_input.m_dims[1];
+ size_t L1 = k_input.m_dims[2];
+ size_t S = k_input.m_dims[3];
+ size_t SV = v_input.m_dims[3];
parallel_for3d(L1, B, H, [&](size_t m, size_t b, size_t h) {
attn_copy(past_k_output.ptr<T2>(b, h, m, 0), k_input.ptr<T>(b, h, m, 0), S);
attn_copy(past_v_output.ptr<T2>(b, h, m, 0), v_input.ptr<T>(b, h, m, 0), SV);
@@ -64,8 +67,11 @@ static void attn_memcpy_kernel(const ov::intel_cpu::PlainTensor& k_input,
const ov::intel_cpu::PlainTensor& past_k_output,
const ov::intel_cpu::PlainTensor& past_v_output) {
// For compatibility, all input_kvs are permuted to BHLS
- size_t B = k_input.m_dims[0], H = k_input.m_dims[1], L1 = k_input.m_dims[2], S = k_input.m_dims[3],
- SV = v_input.m_dims[3];
+ size_t B = k_input.m_dims[0];
+ size_t H = k_input.m_dims[1];
+ size_t L1 = k_input.m_dims[2];
+ size_t S = k_input.m_dims[3];
+ size_t SV = v_input.m_dims[3];
parallel_for3d(L1, B, H, [&](size_t m, size_t b, size_t h) {
std::memcpy(past_k_output.ptr_v(b, h, m, 0), k_input.ptr_v(b, h, m, 0), S * k_input.m_element_size);
std::memcpy(past_v_output.ptr_v(b, h, m, 0), v_input.ptr_v(b, h, m, 0), SV * v_input.m_element_size);
@@ -78,8 +84,11 @@ static void paged_attn_memcpy_kernel(const ov::intel_cpu::PlainTensor& k_input,
const ov::intel_cpu::PlainTensor& past_k_output,
const ov::intel_cpu::PlainTensor& past_v_output,
const ov::intel_cpu::PlainTensor& slot_mapping) {
- size_t B = k_input.m_dims[0], H = k_input.m_dims[1], L1 = k_input.m_dims[2], S = k_input.m_dims[3],
- SV = v_input.m_dims[3];
+ size_t B = k_input.m_dims[0];
+ size_t H = k_input.m_dims[1];
+ size_t L1 = k_input.m_dims[2];
+ size_t S = k_input.m_dims[3];
+ size_t SV = v_input.m_dims[3];
size_t block_size = past_k_output.m_dims[2];
parallel_for3d(B, L1, H, [&](size_t b, size_t m, size_t h) {
auto slot = slot_mapping.ptr<int32_t>(b)[m];
@@ -98,8 +107,11 @@ static void paged_attn_memcpy_kernel(const ov::intel_cpu::PlainTensor& k_input,
const ov::intel_cpu::PlainTensor& past_k_output,
const ov::intel_cpu::PlainTensor& past_v_output,
const ov::intel_cpu::PlainTensor& slot_mapping) {
- size_t B = k_input.m_dims[0], H = k_input.m_dims[1], L1 = k_input.m_dims[2], S = k_input.m_dims[3],
- SV = v_input.m_dims[3];
+ size_t B = k_input.m_dims[0];
+ size_t H = k_input.m_dims[1];
+ size_t L1 = k_input.m_dims[2];
+ size_t S = k_input.m_dims[3];
+ size_t SV = v_input.m_dims[3];
size_t block_size = past_k_output.m_dims[2];
parallel_for3d(B, L1, H, [&](size_t b, size_t m, size_t h) {
auto slot = slot_mapping.ptr<int32_t>(b)[m];
diff --git a/src/plugins/intel_cpu/src/nodes/kernels/scaled_attn/attn_quant.cpp b/src/plugins/intel_cpu/src/nodes/kernels/scaled_attn/attn_quant.cpp
index 0b378b6f243..6a3c45852ea 100644
--- a/src/plugins/intel_cpu/src/nodes/kernels/scaled_attn/attn_quant.cpp
+++ b/src/plugins/intel_cpu/src/nodes/kernels/scaled_attn/attn_quant.cpp
@@ -144,7 +144,7 @@ static void quant_u8(const T* src, uint8_t* dst, size_t n, float& scale, float&
find_minmax(src, n, min, max);
scale = (max - min) / 255;
if (scale == 0) {
- scale = 0.0001f;
+ scale = 0.0001F;
}
zp = -min / scale;
#if defined(HAVE_AVX512F)
@@ -177,7 +177,7 @@ static void quant_u8(const T* src, uint8_t* dst, size_t n, float& scale, float&
#endif
for (; i < n; i++) {
float tmp = src[i];
- tmp = std::max(tmp / scale + zp, 0.0f);
+ tmp = std::max(tmp / scale + zp, 0.0F);
dst[i] = static_cast<uint8_t>(std::round(tmp));
}
}
@@ -243,7 +243,7 @@ static void find_params_by_channel(const T* src,
}
float temp_scale = (max - min) / integer_range;
if (temp_scale == 0) {
- temp_scale = 0.0001f;
+ temp_scale = 0.0001F;
}
float temp_zp = -min / temp_scale;
scale[j] = temp_scale;
@@ -302,7 +302,7 @@ static void quantize_by_channel(const T* src,
for (; j < hidden_dims; j++) {
for (size_t i = 0; i < seq_dim; ++i) {
float tmp = src[i * src_stride + j];
- tmp = std::max(tmp / scale[j] + zp[j], 0.0f);
+ tmp = std::max(tmp / scale[j] + zp[j], 0.0F);
dst[i * dst_stride + j] = static_cast<uint8_t>(std::round(tmp));
}
}
@@ -398,7 +398,7 @@ static void quant_u4(const T* src, void* dst, size_t n, float& scale, float& zp)
auto* dst_ptr = reinterpret_cast<uint8_t*>(dst);
scale = (max - min) / ((1 << 4) - 1);
if (scale == 0) {
- scale = 0.0001f;
+ scale = 0.0001F;
}
zp = -min / scale;
#if defined(HAVE_AVX512F)
@@ -605,7 +605,11 @@ static void attn_quant_mt(const ov::intel_cpu::PlainTensor& k_src,
const size_t key_group_size,
const size_t value_group_size) {
// For compatibility, all input_kvs are permuted to BHLS
- size_t B = k_src.m_dims[0], H = k_src.m_dims[1], L1 = k_src.m_dims[2], S = k_src.m_dims[3], SV = v_src.m_dims[3];
+ size_t B = k_src.m_dims[0];
+ size_t H = k_src.m_dims[1];
+ size_t L1 = k_src.m_dims[2];
+ size_t S = k_src.m_dims[3];
+ size_t SV = v_src.m_dims[3];
if (quant_key_by_channel) {
if (L0 == 0) {
parallel_for3d(ov::intel_cpu::div_up(L1, key_group_size), B, H, [&](size_t group_id, size_t b, size_t h) {
@@ -711,7 +715,9 @@ static void paged_attn_quant_mt(const ov::intel_cpu::PlainTensor& k_src,
const bool quant_value_by_channel,
const size_t key_group_size,
const size_t value_group_size) {
- const size_t B = k_src.m_dims[0], H = k_src.m_dims[1], L1 = k_src.m_dims[2];
+ const size_t B = k_src.m_dims[0];
+ const size_t H = k_src.m_dims[1];
+ const size_t L1 = k_src.m_dims[2];
const size_t block_size = quant_key_by_channel
? k_dst.m_dims[2] - 2 * sizeof(float) * get_sub_byte_multiplier(KEY_DST_PREC)
: k_dst.m_dims[2];
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 0955d711f5f..7748b3f03ce 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
@@ -73,7 +73,7 @@ template <typename T,
std::is_same_v<T, float>)&&(SRC_PREC != ov::element::u8 || SRC_PREC != ov::element::u4),
bool> = true>
static void attn_acc_value_block(float* out,
- float* weight,
+ const float* weight,
T* v,
const size_t S,
const size_t block_size,
@@ -206,7 +206,7 @@ static void attn_acc_value_block(float* out,
}
template <typename T, ov::element::Type_t SRC_PREC, std::enable_if_t<SRC_PREC == ov::element::u8, bool> = true>
static void attn_acc_value_block_by_dim(float* out,
- float* weight,
+ const float* weight,
uint8_t* v,
const size_t S,
const size_t block_size,
@@ -386,7 +386,7 @@ static void attn_acc_value_block_by_dim(float* out,
template <typename T, ov::element::Type_t SRC_PREC, std::enable_if_t<SRC_PREC == ov::element::u4, bool> = true>
static void attn_acc_value_block_by_dim(float* out,
- float* weight,
+ const float* weight,
uint8_t* v_ptr,
const size_t S,
const size_t block_size,
@@ -479,7 +479,7 @@ static void attn_acc_value_block_by_dim(float* out,
template <typename T, ov::element::Type_t SRC_PREC, std::enable_if_t<SRC_PREC == ov::element::u8, bool> = true>
static void attn_acc_value_block_by_channel(float* out,
- float* weight,
+ const float* weight,
void* v,
const size_t S,
const size_t block_size) {
@@ -571,7 +571,7 @@ static void attn_acc_value_block_by_channel(float* out,
template <typename T, ov::element::Type_t SRC_PREC, std::enable_if_t<SRC_PREC == ov::element::u4, bool> = true>
static void attn_acc_value_block_by_channel(float* out,
- float* weight,
+ const float* weight,
void* v,
const size_t S,
const size_t block_size) {
@@ -884,7 +884,7 @@ static void dot_product_block_quantized_by_channel(TA* a,
auto* p_scales = reinterpret_cast<float*>(b);
auto* p_zps = p_scales + n;
for (size_t j = 0; j < block_size; j++) {
- float sum = 0.0f;
+ float sum = 0.0F;
size_t i = 0;
# if defined(HAVE_AVX512F)
auto v512_sum0 = _mm512_set1_ps(0.0f);
@@ -1102,7 +1102,7 @@ static void dot_product_block_quantized_by_channel(TA* a,
auto* p_scales = reinterpret_cast<float*>(b);
auto* p_zps = p_scales + n;
for (size_t j = 0; j < block_size; j++) {
- float sum = 0.0f;
+ float sum = 0.0F;
size_t i = 0;
# if defined(HAVE_AVX512F)
auto v512_sum0 = _mm512_set1_ps(0.0f);
@@ -1430,7 +1430,7 @@ static void dot_product_block_quantized_by_dims(TA* a,
src_offset = 0;
while (dst_offset < n) {
auto* b0 = reinterpret_cast<float*>(b + src_offset);
- float group_sum = 0.0f;
+ float group_sum = 0.0F;
for (size_t i = 0; i < group_size; i++) {
group_sum += a[dst_offset + i] * (b[src_offset + params_offset + i] - b0[1]);
}
@@ -1672,7 +1672,7 @@ static void dot_product_block_quantized_by_dims(TA* a,
src_offset = 0;
while (dst_offset < n) {
auto* b0 = reinterpret_cast<float*>(b + src_offset);
- float group_sum = 0.0f;
+ float group_sum = 0.0F;
for (size_t i = 0; i < group_size; i += 2) {
uint8_t data = b[i / 2 + src_offset + params_offset];
float tmp0 = extract_half_byte(data, static_cast<bool>(i % 2));
@@ -1735,7 +1735,7 @@ static void attn_reduce(T* dst, float* temp, size_t M, size_t S, size_t temp_str
# endif
for (; i < S; i++) {
auto* src = temp + i;
- float sum = 0.0f;
+ float sum = 0.0F;
// sum result from all threads partition
for (size_t m = 0; m < M; m++) {
sum += src[0];
@@ -2273,7 +2273,7 @@ struct MHAHelper {
void resize_temporary_weight_buffer(const size_t& h) {
// resize temporary buffers, weight.size(3) will be aligned to block_size
- _weight.resize<float>({static_cast<size_t>(_nthr), h, _block_size, _new_score_stride});
+ _weight.resize<float>({_nthr, h, _block_size, _new_score_stride});
}
void init(size_t H,
@@ -2316,9 +2316,9 @@ struct MHAHelper {
// std::max(S, SV) here is to ensure by_channel quantize has enough buffer to use
constexpr bool q_is_xf16 = one_of(precision_of<DATA_TYPE>::value, ov::element::bf16, ov::element::f16);
if (_quant_key_bychannel || _quant_value_bychannel) {
- _output.resize<float>({static_cast<size_t>(_nthr), _block_size, H, std::max(S, SV)});
+ _output.resize<float>({_nthr, _block_size, H, std::max(S, SV)});
} else {
- _output.resize<float>({static_cast<size_t>(_nthr), _block_size, H, SV});
+ _output.resize<float>({_nthr, _block_size, H, SV});
}
// TODO: kernel supports stride
@@ -2504,7 +2504,7 @@ struct MHAHelper {
auto new_causal = ncausal;
float* alibi_lookup = nullptr;
if (ncausal > _sliding_window) {
- start_idx = ncausal - static_cast<size_t>(_sliding_window);
+ start_idx = ncausal - _sliding_window;
new_causal = _sliding_window;
}
attn_softmax_kernel<float>(score + start_idx,
@@ -2523,7 +2523,7 @@ struct MHAHelper {
} else {
// alibi may available when _sliding_window is false
float* alibi_lookup = nullptr;
- float alibi_slope = 0.f;
+ float alibi_slope = 0.F;
if (alibi_slopes) {
alibi_slope = alibi_slopes.ptr<float>()[h];
alibi_lookup = _alibi_lookup.ptr<float>() + _alibi_lookup.m_dims[0] - ncausal;
@@ -2813,7 +2813,7 @@ struct MHAHelper {
for (size_t h = hq_beg; h < hq_end; h++) {
// apply attention mask & sofmax
float* alibi_lookup = nullptr;
- float alibi_slope = 0.f;
+ float alibi_slope = 0.F;
if (alibi_slopes) {
alibi_slope = alibi_slopes.ptr<float>()[h];
alibi_lookup = _alibi_lookup.ptr<float>() + _alibi_lookup.m_dims[0] - cur_kv_len;
@@ -2905,7 +2905,7 @@ struct MHAHelper {
// for small batches dynamic scheduler has notable overhead
bool prefer_static_loop;
// if less than 2 work items per thread, loop H
- bool loop_hk = B * kv_len_in_blocks * Hk <= 2 * _nthr ? false : true;
+ bool loop_hk = B * kv_len_in_blocks * Hk > 2 * _nthr;
if (B <= 32) {
prefer_static_loop = true;
// small batch and all batch size is same(like SDPA case)
@@ -2933,7 +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, hq_beg, hq_end;
+ size_t hk;
+ size_t hq_beg;
+ size_t hq_end;
get_h_params(loop_hk, hx, _h_each_group_len, hq_beg, hq_end, hk);
// kv_len must be valid
@@ -2988,7 +2990,7 @@ struct MHAHelper {
auto ncausal = cur_kv_len;
// apply attention mask & sofmax
float* alibi_lookup = nullptr;
- float alibi_slope = 0.f;
+ float alibi_slope = 0.F;
if (alibi_slopes) {
alibi_slope = alibi_slopes.ptr<float>()[h];
alibi_lookup = _alibi_lookup.ptr<float>() + _alibi_lookup.m_dims[0] - cur_kv_len;
@@ -3032,7 +3034,7 @@ struct MHAHelper {
}
// attn_w * V
- _output_bhl.resize<float>({static_cast<size_t>(_nthr), B, q_len, H, SV});
+ _output_bhl.resize<float>({_nthr, B, q_len, H, SV});
// m_attn_w {B, H, q_len, kv_len}
parallel_nt_static(_nthr, [&](const size_t ithr, [[maybe_unused]] const size_t nthr) {
memset(_output_bhl.ptr<float>(ithr, 0, 0, 0, 0), 0, _output_bhl.stride(0) * sizeof(float));
@@ -3042,7 +3044,9 @@ struct MHAHelper {
auto ithr = parallel_get_thread_num();
auto context_len = static_cast<size_t>(past_lens.ptr<int32_t>()[b]) + 1;
auto pv = pv_in_blocks * _block_size;
- size_t hk, hq_beg, hq_end;
+ size_t hk;
+ size_t hq_beg;
+ size_t hq_end;
get_h_params(loop_hk, hx, _h_each_group_len, hq_beg, hq_end, hk);
// kv_len must be valid
@@ -3132,7 +3136,7 @@ struct MHA {
if (q_len == 1) {
attn_items.emplace_back(AttnWorkItem{0, // batch_in_reorder
i, // batch_in_seq
- 1ull, // q_len
+ 1ULL, // q_len
// kv_len in blocks, used in the sort function
kv_len_in_block - 1});
} else {
@@ -3314,7 +3318,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, hq_beg, hq_end;
+ size_t hk;
+ size_t hq_beg;
+ size_t hq_end;
if (loop_hk) {
hk = hx;
hq_beg = hk * _helper._h_each_group_len;
@@ -3353,7 +3359,7 @@ struct MHA {
hq_beg,
hq_end,
hk,
- 1ul,
+ 1UL,
cur_kv_len,
alibi_slopes,
score_output);
@@ -3630,7 +3636,7 @@ struct AttentionExecutor : public PagedAttentionExecutor {
_helper._value_group_size ? v_cache.size(3) / (_helper._value_group_size + value_params_size) : 1;
// check by_hidden_dims parameter of value cache
- if ((value_group_num == 0u) && v_cache.get_precision().is_integral()) {
+ if ((value_group_num == 0U) && v_cache.get_precision().is_integral()) {
OPENVINO_THROW("PagedAttn value cache gets wrong group_size, ",
_helper._value_group_size,
" should be smaller than hidden_dims");
@@ -3641,10 +3647,11 @@ struct AttentionExecutor : public PagedAttentionExecutor {
if (_helper._quant_key_bychannel) {
S = k_cache.size(3);
} else {
- if (!key_group_num)
+ if (!key_group_num) {
OPENVINO_THROW("PagedAttn key cache gets wrong group_size, ",
_helper._key_group_size,
" should be smaller than hidden_dims");
+ }
S = k_cache.size(3) - key_params_size * key_group_num;
_helper._key_group_size = _helper._key_group_size ? _helper._key_group_size : S;
}
@@ -3658,10 +3665,11 @@ struct AttentionExecutor : public PagedAttentionExecutor {
if (_helper._quant_value_bychannel) {
SV = v_cache.size(3);
} else {
- if (!value_group_num)
+ if (!value_group_num) {
OPENVINO_THROW("PagedAttn value cache gets wrong group_size, ",
_helper._value_group_size,
" should be smaller than hidden_dims");
+ }
SV = v_cache.size(3) - value_params_size * value_group_num;
_helper._value_group_size = _helper._value_group_size ? _helper._value_group_size : SV;
}
@@ -3707,8 +3715,8 @@ struct AttentionExecutor : public PagedAttentionExecutor {
subsequence_begins.assert_dims({B_seq + 1});
block_indices.assert_dims({0}, true);
block_indices_begins.assert_dims({B_seq + 1});
- if (scale == 0.0f) {
- scale = 1.0f / sqrt(S);
+ if (scale == 0.0F) {
+ scale = 1.0F / sqrt(S);
}
if (alibi_slopes) {
alibi_slopes.assert_dims({H});
@@ -3795,8 +3803,15 @@ struct AttentionExecutor : public PagedAttentionExecutor {
}
void execute(const std::vector<MemoryPtr>& inputs, const std::vector<MemoryPtr> outputs) override {
- PlainTensor q, k, v, k_cache, v_cache;
- PlainTensor past_lens, subsequence_begins, block_indices, block_indices_begins;
+ PlainTensor q;
+ PlainTensor k;
+ PlainTensor v;
+ PlainTensor k_cache;
+ PlainTensor v_cache;
+ PlainTensor past_lens;
+ PlainTensor subsequence_begins;
+ PlainTensor block_indices;
+ PlainTensor block_indices_begins;
float scale;
size_t sliding_window;
PlainTensor alibi_slopes;
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 fe12099d4de..b386438fe59 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
@@ -391,7 +391,7 @@ template <typename T>
void sum_q_head(T* a, size_t n, size_t group_size, float* out) {
size_t group_id = 0;
while (group_id < n / group_size) {
- float group_sum = 0.0f;
+ float group_sum = 0.0F;
size_t offset = group_id * group_size;
size_t i = 0;
#if defined(HAVE_AVX512F)
@@ -561,7 +561,7 @@ template <typename TA, typename TB>
static float
dot_product(TA* a, TB* b, size_t n, float* scale, float* zp, float* head_sum, [[maybe_unused]] size_t group_size) {
size_t i = 0;
- float sum = 0.0f;
+ float sum = 0.0F;
#if defined(HAVE_AVX512F)
auto vsum0 = _mm512_setzero_ps();
auto vsum1 = _mm512_setzero_ps();
@@ -1262,7 +1262,7 @@ static float dot_product(TA* a, uint8_t* b, size_t n, float* scale, float* zp, f
float group_scale = *(scale + group_id * 2);
float group_zp = *(zp + group_id * 2);
size_t offset = group_id * group_size;
- float group_sum = 0.0f;
+ float group_sum = 0.0F;
for (; i < group_size; i++) {
group_sum += a[i + offset] * (b[i + offset] - group_zp);
}
@@ -1336,7 +1336,7 @@ static void attn_reduce(T* dst, float* temp, size_t M, size_t S, size_t temp_str
#endif
for (; i < S; i++) {
auto* src = temp + i;
- float sum = 0.0f;
+ float sum = 0.0F;
// sum result from all threads partition
for (size_t m = 0; m < M; m++) {
sum += src[0];
@@ -1423,8 +1423,8 @@ static void mha_single_token_kernel(const ov::intel_cpu::PlainTensor& query,
if (h_group_num != H) {
h_each_group_len = H / h_group_num;
}
- if (d_scale == 0.0f) {
- d_scale = 1.0f / sqrt(S);
+ if (d_scale == 0.0F) {
+ d_scale = 1.0F / sqrt(S);
}
auto nthr = parallel_get_max_threads();
auto kv_len = present_key.size(2);
@@ -1444,10 +1444,13 @@ static void mha_single_token_kernel(const ov::intel_cpu::PlainTensor& query,
#endif
parallel_nt_static(nthr, [&](const size_t ithr, const size_t nthr) {
- size_t start{0}, end{0};
+ size_t start{0};
+ size_t end{0};
splitter(B * h_group_num * kv_len, nthr, ithr, start, end);
- size_t b, h_group, pk;
+ size_t b;
+ size_t h_group;
+ size_t pk;
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) {
@@ -1639,12 +1642,15 @@ static void mha_single_token_kernel(const ov::intel_cpu::PlainTensor& query,
buf_attn_score.resize<T3>({static_cast<size_t>(nthr), B, q_len, H, SV});
// buf_attn_w {B, H, q_len, kv_len}
parallel_nt_static(nthr, [&](const size_t ithr, const size_t nthr) {
- size_t start{0}, end{0};
+ size_t start{0};
+ size_t end{0};
splitter(B * h_group_num * kv_len, nthr, ithr, start, end);
memset(buf_attn_score.ptr<T3>(ithr, 0, 0, 0, 0), 0, buf_attn_score.stride(0) * sizeof(T3));
- size_t b, h_group, pv;
+ size_t b;
+ size_t h_group;
+ size_t pv;
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 b5ddd0b1a5b..4b447bb1203 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
@@ -115,7 +115,7 @@ BrgemmKernel::BrgemmKernel(size_t M,
auto M_ = m ? M_tail : M < M_blk ? 0 : M_blk;
auto N_ = n ? N_tail : N - N_tail;
auto K_ = k ? K_tail : K - K % K_blk;
- auto beta = (b_accumulate || (k && brgCtxs[getBrgIdx(m, 0, n)].K != 0)) ? 1.0f : 0.0f;
+ auto beta = (b_accumulate || (k && brgCtxs[getBrgIdx(m, 0, n)].K != 0)) ? 1.0F : 0.0F;
brgemmCtx.M = M_;
brgemmCtx.N = N_;
@@ -171,17 +171,17 @@ BrgemmKernel::BrgemmKernel(size_t M,
}
}
-const size_t BrgemmKernel::get_scratch_a_size() const {
+size_t BrgemmKernel::get_scratch_a_size() const {
return packedASize;
}
-const size_t BrgemmKernel::get_scratch_b_size() const {
+size_t BrgemmKernel::get_scratch_b_size() const {
return packedBSize;
}
void BrgemmKernel::init_brgemm(brgemmCtx& ctx,
std::unique_ptr<dnnl::impl::cpu::x64::brgemm_kernel_t>& brgKernel,
- bool use_amx) {
+ bool use_amx) const {
brgemm_desc_t brgDesc;
const bool is_int8 =
@@ -212,7 +212,7 @@ void BrgemmKernel::init_brgemm(brgemmCtx& ctx,
ctx.transpose_a,
ctx.transpose_b,
brgemm_row_major,
- 1.f,
+ 1.F,
ctx.beta,
ctx.LDA,
ctx.LDB,
diff --git a/src/plugins/intel_cpu/src/nodes/kernels/x64/brgemm_kernel.hpp b/src/plugins/intel_cpu/src/nodes/kernels/x64/brgemm_kernel.hpp
index 1cb66787034..c49004a52e1 100644
--- a/src/plugins/intel_cpu/src/nodes/kernels/x64/brgemm_kernel.hpp
+++ b/src/plugins/intel_cpu/src/nodes/kernels/x64/brgemm_kernel.hpp
@@ -37,9 +37,9 @@ public:
void copy_buffer_b(void* b, void* scratch_b);
// bytes needed to place scratch buffer a
- [[nodiscard]] const size_t get_scratch_a_size() const;
+ [[nodiscard]] size_t get_scratch_a_size() const;
// bytes needed to place scratch buffer b
- [[nodiscard]] const size_t get_scratch_b_size() const;
+ [[nodiscard]] size_t get_scratch_b_size() const;
[[nodiscard]] const size_t get_mblk_size() const {
return matmulOptimalM;
}
@@ -83,7 +83,9 @@ private:
size_t getBrgIdx(size_t mIdx, size_t kIdx, size_t nIdx) {
return mIdx * 4 + kIdx * 2 + nIdx;
}
- void init_brgemm(brgemmCtx& ctx, std::unique_ptr<dnnl::impl::cpu::x64::brgemm_kernel_t>& brgKernel, bool use_amx);
+ void init_brgemm(brgemmCtx& ctx,
+ std::unique_ptr<dnnl::impl::cpu::x64::brgemm_kernel_t>& brgKernel,
+ bool use_amx) const;
// LDA, LDB is used for stride of target memory
void init_brgemm_copy_a(std::unique_ptr<dnnl::impl::cpu::x64::matmul::jit_brgemm_matmul_copy_a_t>& brgCopyKernel,
size_t K,
@@ -106,11 +108,11 @@ private:
bool transpose = false,
size_t copy_B_wei_stride = 0);
- void callBrgemm(brgemmCtx& ctx,
- std::unique_ptr<dnnl::impl::cpu::x64::brgemm_kernel_t>& brgKernel,
- const void* pin0,
- const void* pin1,
- void* pout,
- void* wsp);
+ static void callBrgemm(brgemmCtx& ctx,
+ std::unique_ptr<dnnl::impl::cpu::x64::brgemm_kernel_t>& brgKernel,
+ const void* pin0,
+ const void* pin1,
+ void* pout,
+ void* wsp);
};
} // namespace ov::intel_cpu
diff --git a/src/plugins/intel_cpu/src/nodes/kernels/x64/gather_uni_kernel.cpp b/src/plugins/intel_cpu/src/nodes/kernels/x64/gather_uni_kernel.cpp
index e4f701857d4..740c35a7cc1 100644
--- a/src/plugins/intel_cpu/src/nodes/kernels/x64/gather_uni_kernel.cpp
+++ b/src/plugins/intel_cpu/src/nodes/kernels/x64/gather_uni_kernel.cpp
@@ -123,14 +123,14 @@ void jitUniGatherKernel<isa>::generate() {
mov(regAux1, ptr[regParams + GET_OFF(specIdxB)]);
uni_vmovups(vmmSpecIdxB, ptr[regAux1]);
- if (jcp.beforeAxisSize != 1lu) {
+ if (jcp.beforeAxisSize != 1LU) {
mov(regAux1, ptr[regParams + GET_OFF(dataBeforeAxisSumB)]);
uni_vmovups(vmmSrcBeforeAxisSumB, ptr[regAux1]);
}
- if (jcp.afterAxisSize == 1lu) { // Elementwise case.
+ if (jcp.afterAxisSize == 1LU) { // Elementwise case.
uni_vmovd(reg32SpecIdxSizeB, xmmSpecIdxSizeB);
- if (jcp.beforeAxisSize != 1lu) {
+ if (jcp.beforeAxisSize != 1LU) {
mov(regAux1, ptr[regParams + GET_OFF(axisAndAfterAxisSizeB)]);
uni_vpbroadcastd(vmmAxisAndAfterAxisSizeB, ptr[regAux1]);
}
@@ -148,14 +148,14 @@ void jitUniGatherKernel<isa>::generate() {
mov(regAux1, ptr[regParams + GET_OFF(permIdxMask)]);
uni_vmovups(vmmPermIdxMask, ptr[regAux1]);
}
- if (jcp.beforeAxisSize != 1lu) {
+ if (jcp.beforeAxisSize != 1LU) {
mov(regAux1, ptr[regParams + GET_OFF(beforeAxisDiff)]);
uni_vmovups(vmmBeforeAxDiffB, ptr[regAux1]);
if (jcp.dataTypeSize != 1) {
uni_vpslld(vmmBeforeAxDiffB, vmmBeforeAxDiffB, dataTypeShift); // multiply by data type size
}
}
- if (jcp.batchDims > 0lu) {
+ if (jcp.batchDims > 0LU) {
mov(regAux1, ptr[regParams + GET_OFF(srcAfterBatchSizeB)]);
uni_vpbroadcastd(vmmSrcAfterBatchSizeB, ptr[regAux1]);
}
@@ -180,7 +180,7 @@ void jitUniGatherKernel<isa>::generate() {
mov(regAux1, ptr[regParams + GET_OFF(afterAxisSize)]);
uni_vpbroadcastd(vmmAfterAxisSize, ptr[regAux1]);
- if (jcp.beforeAxisSize != 1lu) {
+ if (jcp.beforeAxisSize != 1LU) {
mov(rSpecIdxAndAfterAxIterB, ptr[regParams + GET_OFF(specIdxAndAfterAxIterB)]);
mov(rSpecIdxAndAfterAxSizeB, ptr[regParams + GET_OFF(specIdxAndAfterAxSizeB)]);
if (jcp.specIdxSize * jcp.afterAxisSize < idxElPerVec) {
@@ -238,7 +238,7 @@ void jitUniGatherKernel<isa>::generate() {
uni_vpbroadcastd(vmmAxisAndAfterAxisSizeB, ptr[regAux1]);
// Formula: srcBeforeAxisSum = ((start / specIndicesSize) % betweenBatchAndAxis) * axisAndAfterAxisSize +
// srcAfterBatchSize * idxBatchSum
- if (jcp.beforeAxisSize != 1lu) {
+ if (jcp.beforeAxisSize != 1LU) {
uni_vpmulld(vmmSrcBeforeAxisSumB, vmmSrcBeforeAxisSumB, vmmAxisAndAfterAxisSizeB);
mov(regAux1, ptr[regParams + GET_OFF(srcAfterBatchSizeB)]);
uni_vpbroadcastd(vAux0, ptr[regAux1]);
@@ -249,12 +249,16 @@ void jitUniGatherKernel<isa>::generate() {
// Formula: idxBatchSum = specIdxSize * (start / afterBatchSize)
uni_vpmulld(vmmIdxBatchSumB, vmmIdxBatchSumB, vmmSpecIdxSizeB);
- Xbyak::Label lBlock, lEnd;
+ Xbyak::Label lBlock;
+ Xbyak::Label lEnd;
mov(regAux2, ptr[regParams + GET_OFF(afterAxSize)]);
cmp(regAux2, 1);
jg(lBlock, T_NEAR);
{
- Xbyak::Label lLessThanVector1, lTail1, lTail2, lE1;
+ Xbyak::Label lLessThanVector1;
+ Xbyak::Label lTail1;
+ Xbyak::Label lTail2;
+ Xbyak::Label lE1;
cmp(regSpecIdxSizeB, vlen);
jl(lLessThanVector1, T_NEAR);
@@ -266,7 +270,7 @@ void jitUniGatherKernel<isa>::generate() {
L(lLessThanVector1);
mov(regAux1, ptr[regParams + GET_OFF(permIdxMask)]);
uni_vmovups(vmmPermIdxMask, ptr[regAux1]);
- if (jcp.beforeAxisSize != 1lu) {
+ if (jcp.beforeAxisSize != 1LU) {
mov(regAux1, ptr[regParams + GET_OFF(beforeAxisDiff)]);
uni_vmovups(vmmBeforeAxDiffB, ptr[regAux1]);
if (jcp.dataTypeSize != 1) {
@@ -298,7 +302,10 @@ void jitUniGatherKernel<isa>::generate() {
uni_vcvtps2dq(vmmAfterAxisIdxB, vmmAfterAxisIdxB);
uni_vpslld(vmmAfterAxisIdxB, vmmAfterAxisIdxB, idxTypeShift); // multiply by indices type size.
- Xbyak::Label lLessThanVector2, lTail3, lTail4, lE2;
+ Xbyak::Label lLessThanVector2;
+ Xbyak::Label lTail3;
+ Xbyak::Label lTail4;
+ Xbyak::Label lE2;
cmp(regAux2, dataElPerVec);
jl(lLessThanVector2, T_NEAR);
@@ -408,7 +415,8 @@ void jitUniGatherKernel<x64::avx2>::calcSrcShiftLong(Vmm* vAuxPool, bool shiftFi
auto& vAux1 = vAuxPool[3];
auto& kAuxMask0 = masksContainer[vAux1.getIdx()];
- Xbyak::Label lIdxStride, lExit;
+ Xbyak::Label lIdxStride;
+ Xbyak::Label lExit;
if (shiftFirst) {
uni_vpaddd(vmmSpecIdxB, vmmSpecIdxB, vmmVecLenB);
}
@@ -416,7 +424,7 @@ void jitUniGatherKernel<x64::avx2>::calcSrcShiftLong(Vmm* vAuxPool, bool shiftFi
add(regIdxIter, vlen);
cmp(regIdxIter, regSpecIdxSizeB);
jge(lIdxStride, T_NEAR);
- if (jcp.batchDims > 0lu) {
+ if (jcp.batchDims > 0LU) {
uni_vpaddd(vDstShifts, vmmIdxBatchSumB, vmmSpecIdxB);
uni_vmovd(reg32Aux1, xmmAuxContainer[vDstShifts.getIdx()]);
} else {
@@ -424,7 +432,7 @@ void jitUniGatherKernel<x64::avx2>::calcSrcShiftLong(Vmm* vAuxPool, bool shiftFi
}
vmovdqu(vDstShifts, ptr[regIndices + regAux1]);
normalizeRawIndices(vDstShifts, kDstMask, kAuxMask0);
- if (jcp.beforeAxisSize != 1lu) {
+ if (jcp.beforeAxisSize != 1LU) {
uni_vpaddd(vDstShifts, vDstShifts, vmmSrcBeforeAxisSumB);
}
jmp(lExit, T_NEAR);
@@ -435,12 +443,12 @@ void jitUniGatherKernel<x64::avx2>::calcSrcShiftLong(Vmm* vAuxPool, bool shiftFi
vpcmpgtd(vAux0, vmmSpecIdxSizeB, vmmSpecIdxB);
vpandn(vAux1, vAux0, vmmSpecIdxSizeB);
uni_vpsubd(vAux1, vmmSpecIdxB, vAux1);
- if (jcp.batchDims > 0lu) {
+ if (jcp.batchDims > 0LU) {
uni_vpaddd(vAux1, vmmIdxBatchSumB, vAux1);
}
uni_vpsubd(vmmSpecIdxB, vmmSpecIdxB, vmmSpecIdxSizeB);
} else {
- if (jcp.batchDims > 0lu) {
+ if (jcp.batchDims > 0LU) {
uni_vpaddd(vAux0, vmmIdxBatchSumB, vmmSpecIdxB);
uniVpGatherDd(vDstShifts, ptr[regIndices + vAux0], kDstMask);
} else {
@@ -453,14 +461,14 @@ void jitUniGatherKernel<x64::avx2>::calcSrcShiftLong(Vmm* vAuxPool, bool shiftFi
vpandn(vAux0, vAux1, vmmSpecIdxSizeB);
uni_vpsubd(vmmSpecIdxB, vmmSpecIdxB, vAux0);
- if (jcp.beforeAxisSize != 1lu) {
+ if (jcp.beforeAxisSize != 1LU) {
uni_vpaddd(vDstShifts, vDstShifts, vmmSrcBeforeAxisSumB);
vpandn(vAux0, vAux1, vmmAxisAndAfterAxisSizeB);
uni_vpaddd(vmmSrcBeforeAxisSumB, vmmSrcBeforeAxisSumB, vAux0);
}
}
- if (jcp.batchDims > 0lu) {
+ if (jcp.batchDims > 0LU) {
Xbyak::Label l1;
inc(regBetweenBatchAndAxisIter);
cmp(regBetweenBatchAndAxisIter, regBetweenBatchAndAxisSize);
@@ -481,7 +489,7 @@ void jitUniGatherKernel<x64::avx2>::calcSrcShiftLong(Vmm* vAuxPool, bool shiftFi
uniVpGatherDd(vDstShifts, ptr[regIndices + vAux1], kDstMask);
normalizeRawIndices(vDstShifts, kDstMask, kAuxMask0);
- if (jcp.beforeAxisSize != 1lu) {
+ if (jcp.beforeAxisSize != 1LU) {
vpandn(vAux0, vAux0, vmmAxisAndAfterAxisSizeB);
uni_vpaddd(vAux0, vAux0, vmmSrcBeforeAxisSumB);
uni_vpaddd(vmmSrcBeforeAxisSumB, vmmSrcBeforeAxisSumB, vmmAxisAndAfterAxisSizeB);
@@ -503,7 +511,8 @@ void jitUniGatherKernel<x64::avx512_core>::calcSrcShiftLong(Vmm* vAuxPool, bool
auto& kAuxMask0 = masksContainer[vAux1.getIdx()];
auto& kAuxMask1 = masksContainer[vAux1.getIdx() + 1];
- Xbyak::Label lIdxStride, lExit;
+ Xbyak::Label lIdxStride;
+ Xbyak::Label lExit;
if (shiftFirst) {
uni_vpaddd(vmmSpecIdxB, vmmSpecIdxB, vmmVecLenB);
}
@@ -511,7 +520,7 @@ void jitUniGatherKernel<x64::avx512_core>::calcSrcShiftLong(Vmm* vAuxPool, bool
add(regIdxIter, vlen);
cmp(regIdxIter, regSpecIdxSizeB);
jge(lIdxStride, T_NEAR);
- if (jcp.batchDims > 0lu) {
+ if (jcp.batchDims > 0LU) {
uni_vpaddd(vDstShifts, vmmIdxBatchSumB, vmmSpecIdxB);
uni_vmovd(reg32Aux1, xmmAuxContainer[vDstShifts.getIdx()]);
} else {
@@ -519,7 +528,7 @@ void jitUniGatherKernel<x64::avx512_core>::calcSrcShiftLong(Vmm* vAuxPool, bool
}
vmovdqu64(vDstShifts, ptr[regIndices + regAux1]);
normalizeRawIndices(vDstShifts, kDstMask, kAuxMask0);
- if (jcp.beforeAxisSize != 1lu) {
+ if (jcp.beforeAxisSize != 1LU) {
uni_vpaddd(vDstShifts, vDstShifts, vmmSrcBeforeAxisSumB);
}
jmp(lExit, T_NEAR);
@@ -528,7 +537,7 @@ void jitUniGatherKernel<x64::avx512_core>::calcSrcShiftLong(Vmm* vAuxPool, bool
vpcmpeqd(kDstMask, vDstShifts, vDstShifts);
if (shiftFirst) {
vpcmpd(kAuxMask1, vmmSpecIdxSizeB, vmmSpecIdxB, 2); // 2 -> LE
- if (jcp.batchDims > 0lu) {
+ if (jcp.batchDims > 0LU) {
uni_vpaddd(vAux1, vmmIdxBatchSumB, vmmSpecIdxB);
uni_vpsubd(vAux1 | kAuxMask1, vAux1, vmmSpecIdxSizeB);
} else {
@@ -537,7 +546,7 @@ void jitUniGatherKernel<x64::avx512_core>::calcSrcShiftLong(Vmm* vAuxPool, bool
}
uni_vpsubd(vmmSpecIdxB, vmmSpecIdxB, vmmSpecIdxSizeB);
} else {
- if (jcp.batchDims > 0lu) {
+ if (jcp.batchDims > 0LU) {
uni_vpaddd(vAux0, vmmIdxBatchSumB, vmmSpecIdxB);
uniVpGatherDd(vDstShifts, ptr[regIndices + vAux0], kDstMask);
} else {
@@ -549,13 +558,13 @@ void jitUniGatherKernel<x64::avx512_core>::calcSrcShiftLong(Vmm* vAuxPool, bool
vpcmpd(kAuxMask1, vAux0, vmmSpecIdxB, 2); // 2 -> LE
uni_vpsubd(vmmSpecIdxB | kAuxMask1, vmmSpecIdxB, vmmSpecIdxSizeB);
- if (jcp.beforeAxisSize != 1lu) {
+ if (jcp.beforeAxisSize != 1LU) {
uni_vpaddd(vDstShifts, vDstShifts, vmmSrcBeforeAxisSumB);
uni_vpaddd(vmmSrcBeforeAxisSumB | kAuxMask1, vmmSrcBeforeAxisSumB, vmmAxisAndAfterAxisSizeB);
}
}
- if (jcp.batchDims > 0lu) {
+ if (jcp.batchDims > 0LU) {
Xbyak::Label l1;
inc(regBetweenBatchAndAxisIter);
cmp(regBetweenBatchAndAxisIter, regBetweenBatchAndAxisSize);
@@ -574,7 +583,7 @@ void jitUniGatherKernel<x64::avx512_core>::calcSrcShiftLong(Vmm* vAuxPool, bool
uniVpGatherDd(vDstShifts, ptr[regIndices + vAux1], kDstMask);
normalizeRawIndices(vDstShifts, kDstMask, kAuxMask0);
- if (jcp.beforeAxisSize != 1lu) {
+ if (jcp.beforeAxisSize != 1LU) {
uni_vpaddd(vDstShifts, vDstShifts, vmmSrcBeforeAxisSumB);
uni_vpaddd(vDstShifts | kAuxMask1, vDstShifts, vmmAxisAndAfterAxisSizeB);
uni_vpaddd(vmmSrcBeforeAxisSumB, vmmSrcBeforeAxisSumB, vmmAxisAndAfterAxisSizeB);
@@ -599,21 +608,21 @@ void jitUniGatherKernel<isa>::calcSrcShiftShort(Vmm* vAuxPool, bool shiftFirst)
auto& vAux0 = vAuxPool[2];
if (shiftFirst) {
- if (jcp.beforeAxisSize != 1lu) {
+ if (jcp.beforeAxisSize != 1LU) {
uni_vpaddd(vmmSrcBeforeAxisSumB, vmmSrcBeforeAxisSumB, vmmBeforeAxDiffB);
}
// No sense to permute if specIdxSize is one of {1, 2, 4, 8, 16}. 0 is reserved for dynamic case.
if (jcp.specIdxSize != 1 && jcp.specIdxSize != 2 && jcp.specIdxSize != 4 && jcp.specIdxSize != 8 &&
jcp.specIdxSize != 16) {
vpermd(vmmSpecIdxB, vmmPermIdxMask, vmmSpecIdxB);
- if (jcp.beforeAxisSize != 1lu) {
+ if (jcp.beforeAxisSize != 1LU) {
vpermd(vmmBeforeAxDiffB, vmmPermIdxMask, vmmBeforeAxDiffB);
}
}
}
vpcmpeqd(kDstMask, vAux0, vAux0);
- if (jcp.batchDims > 0lu) {
+ if (jcp.batchDims > 0LU) {
// Calculate indices batch sum.
uni_vcvtdq2ps(vAux0, vmmSrcBeforeAxisSumB);
uni_vcvtdq2ps(vDstShifts, vmmSrcAfterBatchSizeB);
@@ -631,7 +640,7 @@ void jitUniGatherKernel<isa>::calcSrcShiftShort(Vmm* vAuxPool, bool shiftFirst)
auto& kAuxMask0 = masksContainer[vAux0.getIdx()];
normalizeRawIndices(vDstShifts, kDstMask, kAuxMask0);
- if (jcp.beforeAxisSize != 1lu) {
+ if (jcp.beforeAxisSize != 1LU) {
uni_vpaddd(vDstShifts, vDstShifts, vmmSrcBeforeAxisSumB);
}
}
@@ -661,9 +670,9 @@ void jitUniGatherKernel<isa>::calcSrcShiftShortBlock(Vmm* vAuxPool, bool shiftFi
}
}
- if (jcp.beforeAxisSize != 1lu) {
+ if (jcp.beforeAxisSize != 1LU) {
if (!jcp.dynamicShapes) {
- if (specIdxAndAfterAxisSize > 0lu && specIdxAndAfterAxisSize <= idxElPerVec) {
+ if (specIdxAndAfterAxisSize > 0LU && specIdxAndAfterAxisSize <= idxElPerVec) {
uni_vpaddd(vmmSrcBeforeAxisSumB, vmmSrcBeforeAxisSumB, vmmBeforeAxDiffB);
uni_vmovups(vAux1, vmmSrcBeforeAxisSumB);
if (specIdxAndAfterAxisSize != 1 && specIdxAndAfterAxisSize != 2 && specIdxAndAfterAxisSize != 4 &&
@@ -671,7 +680,8 @@ void jitUniGatherKernel<isa>::calcSrcShiftShortBlock(Vmm* vAuxPool, bool shiftFi
vpermd(vmmBeforeAxDiffB, vmmBeforeAxPermMask, vmmBeforeAxDiffB);
}
} else {
- Xbyak::Label lBeforeAxStep, lBeforeAxStepEnd;
+ Xbyak::Label lBeforeAxStep;
+ Xbyak::Label lBeforeAxStepEnd;
add(rSpecIdxAndAfterAxIterB, idxElPerVec * jcp.dataTypeSize);
cmp(rSpecIdxAndAfterAxIterB, rSpecIdxAndAfterAxSizeB);
jl(lBeforeAxStep, T_NEAR);
@@ -701,7 +711,7 @@ void jitUniGatherKernel<isa>::calcSrcShiftShortBlock(Vmm* vAuxPool, bool shiftFi
}
}
} else {
- if (jcp.beforeAxisSize != 1lu) {
+ if (jcp.beforeAxisSize != 1LU) {
uni_vmovups(vAux1, vmmSrcBeforeAxisSumB);
if (specIdxAndAfterAxisSize > idxElPerVec) {
// Broadcast the last element.
@@ -726,7 +736,7 @@ void jitUniGatherKernel<isa>::calcSrcShiftShortBlock(Vmm* vAuxPool, bool shiftFi
}
vpcmpeqd(kDstMask, vAux0, vAux0);
- if (jcp.batchDims > 0lu) {
+ if (jcp.batchDims > 0LU) {
// Calculate indices batch sum.
uni_vcvtdq2ps(vAux0, vAux1);
uni_vcvtdq2ps(vDstShifts, vmmSrcAfterBatchSizeB);
@@ -744,18 +754,19 @@ void jitUniGatherKernel<isa>::calcSrcShiftShortBlock(Vmm* vAuxPool, bool shiftFi
normalizeRawIndices(vDstShifts, kDstMask, kAuxMask0);
- if (jcp.afterAxisSize != 1lu) {
+ if (jcp.afterAxisSize != 1LU) {
vpmulld(vDstShifts, vDstShifts, vmmAfterAxisSize);
uni_vpaddd(vDstShifts, vDstShifts, vmmAfterAxisIdxB);
}
- if (jcp.beforeAxisSize != 1lu) {
+ if (jcp.beforeAxisSize != 1LU) {
uni_vpaddd(vDstShifts, vDstShifts, vAux1);
}
}
template <x64::cpu_isa_t isa>
void jitUniGatherKernel<isa>::process(bool isShortIdx, bool blocked) {
- Xbyak::Label lTailProc, lEndProc;
+ Xbyak::Label lTailProc;
+ Xbyak::Label lEndProc;
cmp(regWorkAmount, dataElPerVec);
jl(lTailProc, T_NEAR);
if (jcp.dataTypeSize == 4) {
@@ -809,7 +820,8 @@ void jitUniGatherKernel<isa>::store(const Xbyak::Reg64& reg_dst, Vmm& vmmSrc) {
template <x64::cpu_isa_t isa>
void jitUniGatherKernel<isa>::process32b(bool isShortIdx, bool blocked) {
- Xbyak::Label lDstIdxLoop, lTail;
+ Xbyak::Label lDstIdxLoop;
+ Xbyak::Label lTail;
// First iteration
shiftIdxAndGather(vmmAuxContainer, isShortIdx, false, blocked);
@@ -835,9 +847,12 @@ void jitUniGatherKernel<isa>::process32b(bool isShortIdx, bool blocked) {
template <x64::cpu_isa_t isa>
void jitUniGatherKernel<isa>::process16b(bool isShortIdx, bool blocked) {
- Xbyak::Label lDstIdxLoop1, lTail;
+ Xbyak::Label lDstIdxLoop1;
+ Xbyak::Label lTail;
- Vmm vShufMask, vPermMask, vBuff0;
+ Vmm vShufMask;
+ Vmm vPermMask;
+ Vmm vBuff0;
if (isa == x64::avx512_core) {
vPermMask = vmmAuxContainer[7];
vShufMask = vmmAuxContainer[8];
@@ -899,9 +914,13 @@ void jitUniGatherKernel<isa>::process16b(bool isShortIdx, bool blocked) {
template <x64::cpu_isa_t isa>
void jitUniGatherKernel<isa>::process8b(bool isShortIdx, bool blocked) {
- Xbyak::Label lDstIdxLoop1, lTail;
+ Xbyak::Label lDstIdxLoop1;
+ Xbyak::Label lTail;
- Vmm vShufMask, vPermMask, vBuff0, vBuff1;
+ Vmm vShufMask;
+ Vmm vPermMask;
+ Vmm vBuff0;
+ Vmm vBuff1;
if (isa == x64::avx512_core) {
vPermMask = vmmAuxContainer[7];
vShufMask = vmmAuxContainer[8];
diff --git a/src/plugins/intel_cpu/src/nodes/kernels/x64/grid_sample.cpp b/src/plugins/intel_cpu/src/nodes/kernels/x64/grid_sample.cpp
index 127b2f42d63..fccbf8a6cdc 100644
--- a/src/plugins/intel_cpu/src/nodes/kernels/x64/grid_sample.cpp
+++ b/src/plugins/intel_cpu/src/nodes/kernels/x64/grid_sample.cpp
@@ -212,7 +212,7 @@ void GridSampleKernel<isa>::initVectors() {
uni_vmovups(vHDenormCoefF, ptr[rAux]);
}
} else {
- static const float halfArr[8] = {0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f};
+ static const float halfArr[8] = {0.5F, 0.5F, 0.5F, 0.5F, 0.5F, 0.5F, 0.5F, 0.5F};
mov(rAux, reinterpret_cast<uintptr_t>(halfArr));
vHalfF = getVmm();
uni_vmovups(vHalfF, ptr[rAux]);
@@ -229,7 +229,7 @@ void GridSampleKernel<isa>::initVectors() {
if (jcp.interpolationMode == GridSampleInterpolationMode::BICUBIC ||
(jcp.interpolationMode == GridSampleInterpolationMode::BILINEAR &&
jcp.paddingMode != GridSamplePaddingMode::ZEROS)) {
- static const float onesArr[8] = {1.f, 1.f, 1.f, 1.f, 1.f, 1.f, 1.f, 1.f};
+ static const float onesArr[8] = {1.F, 1.F, 1.F, 1.F, 1.F, 1.F, 1.F, 1.F};
mov(rAux, reinterpret_cast<uintptr_t>(onesArr));
vOnesF = getVmm();
uni_vmovups(vOnesF, ptr[rAux]);
@@ -241,10 +241,11 @@ void GridSampleKernel<isa>::process() {
regWorkAmount = getReg64();
// Batch loop
- Xbyak::Label lBatchLoop, lEnd;
+ Xbyak::Label lBatchLoop;
+ Xbyak::Label lEnd;
RegistersPool::Reg<Xbyak::Reg64> regBatch;
- for (uint64_t i = 0lu; i < jcp.batchNum; i++) {
+ for (uint64_t i = 0LU; i < jcp.batchNum; i++) {
if (jcp.dynamicBatch) {
regBatch = getReg64();
mov(regBatch, ptr[regParams + GET_OFF(batchNum)]);
@@ -278,7 +279,8 @@ void GridSampleKernel<isa>::spatialLoop() {
auto vHCoord = getVmm();
auto vWCoord = getVmm();
- Xbyak::Label lSpacialLoop, lTail;
+ Xbyak::Label lSpacialLoop;
+ Xbyak::Label lTail;
L(lSpacialLoop);
{
cmp(regWorkAmount, dataElPerVec);
@@ -426,7 +428,9 @@ void GridSampleKernel<isa>::getCoordinates(const Vmm& vHCoord, const Vmm& vWCoor
template <>
void GridSampleKernel<x64::avx512_core>::getTailCoordinates(const Vmm& vHCoord, const Vmm& vWCoord) {
- Xbyak::Label lEnd, lGridShift, lRest;
+ Xbyak::Label lEnd;
+ Xbyak::Label lGridShift;
+ Xbyak::Label lRest;
auto vAux = getVmm();
auto rAux = getReg64();
@@ -474,7 +478,9 @@ void GridSampleKernel<x64::avx512_core>::getTailCoordinates(const Vmm& vHCoord,
template <>
void GridSampleKernel<x64::avx2>::getTailCoordinates(const Vmm& vHCoord, const Vmm& vWCoord) {
- Xbyak::Label lRest, lGridShift, lEnd;
+ Xbyak::Label lRest;
+ Xbyak::Label lGridShift;
+ Xbyak::Label lEnd;
auto rAux = getReg64();
Vmm vPermMask;
@@ -529,7 +535,8 @@ void GridSampleKernel<x64::avx2>::getTailCoordinates(const Vmm& vHCoord, const V
template <>
void GridSampleKernel<x64::avx>::getTailCoordinates(const Vmm& vHCoord, const Vmm& vWCoord) {
- Xbyak::Label lLoop2End, lEnd;
+ Xbyak::Label lLoop2End;
+ Xbyak::Label lEnd;
Xbyak::Xmm xmmWCoord(vWCoord.getIdx());
Xbyak::Xmm xmmHCoord(vHCoord.getIdx());
@@ -581,7 +588,10 @@ void GridSampleKernel<x64::avx>::getTailCoordinates(const Vmm& vHCoord, const Vm
template <>
void GridSampleKernel<x64::sse41>::getTailCoordinates(const Vmm& vHCoord, const Vmm& vWCoord) {
- Xbyak::Label lRest, lHShuf, lGridShift, lEnd;
+ Xbyak::Label lRest;
+ Xbyak::Label lHShuf;
+ Xbyak::Label lGridShift;
+ Xbyak::Label lEnd;
auto rAux = getReg64();
mov(rAux, regWorkAmount);
@@ -660,7 +670,7 @@ void GridSampleKernel<isa>::denormalizeRawCoordinates(const Vmm& vWCoord, const
halfHolder = getVmm();
vHalfTmp = halfHolder;
static const float halfValues[x64::cpu_isa_traits<x64::avx512_core>::vlen / sizeof(float)] =
- {0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f, 0.5f};
+ {0.5F, 0.5F, 0.5F, 0.5F, 0.5F, 0.5F, 0.5F, 0.5F, 0.5F, 0.5F, 0.5F, 0.5F, 0.5F, 0.5F, 0.5F, 0.5F};
mov(rAux, reinterpret_cast<uintptr_t>(halfValues));
uni_vmovups(vHalfTmp, ptr[rAux]);
}
@@ -1077,11 +1087,11 @@ template <>
void GridSampleKernel<x64::avx2>::bicubicCoefficients(const Vmm& vCoef, const Vmm& vDDim, const uint8_t idx) {
static const size_t elPerVec = x64::cpu_isa_traits<x64::avx2>::vlen / sizeof(float);
;
- static const float const_0_75[elPerVec] = {-0.75f, -0.75f, -0.75f, -0.75f, -0.75f, -0.75f, -0.75f, -0.75f};
- static const float const_1_25[elPerVec] = {1.25f, 1.25f, 1.25f, 1.25f, 1.25f, 1.25f, 1.25f, 1.25f};
- static const float const_1_50[elPerVec] = {1.5f, 1.5f, 1.5f, 1.5f, 1.5f, 1.5f, 1.5f, 1.5f};
- static const float const_2_00[elPerVec] = {2.f, 2.f, 2.f, 2.f, 2.f, 2.f, 2.f, 2.f};
- static const float const_2_25[elPerVec] = {2.25f, 2.25f, 2.25f, 2.25f, 2.25f, 2.25f, 2.25f, 2.25f};
+ static const float const_0_75[elPerVec] = {-0.75F, -0.75F, -0.75F, -0.75F, -0.75F, -0.75F, -0.75F, -0.75F};
+ static const float const_1_25[elPerVec] = {1.25F, 1.25F, 1.25F, 1.25F, 1.25F, 1.25F, 1.25F, 1.25F};
+ static const float const_1_50[elPerVec] = {1.5F, 1.5F, 1.5F, 1.5F, 1.5F, 1.5F, 1.5F, 1.5F};
+ static const float const_2_00[elPerVec] = {2.F, 2.F, 2.F, 2.F, 2.F, 2.F, 2.F, 2.F};
+ static const float const_2_25[elPerVec] = {2.25F, 2.25F, 2.25F, 2.25F, 2.25F, 2.25F, 2.25F, 2.25F};
auto rAux = getReg64();
@@ -1119,11 +1129,11 @@ void GridSampleKernel<x64::avx2>::bicubicCoefficients(const Vmm& vCoef, const Vm
template <>
void GridSampleKernel<x64::avx>::bicubicCoefficients(const Vmm& vCoef, const Vmm& vDDim, const uint8_t idx) {
static const size_t elPerVec = x64::cpu_isa_traits<x64::avx>::vlen / sizeof(float);
- static const float const_0_75[elPerVec] = {-0.75f, -0.75f, -0.75f, -0.75f, -0.75f, -0.75f, -0.75f, -0.75f};
- static const float const_1_25[elPerVec] = {1.25f, 1.25f, 1.25f, 1.25f, 1.25f, 1.25f, 1.25f, 1.25f};
- static const float const_1_50[elPerVec] = {1.5f, 1.5f, 1.5f, 1.5f, 1.5f, 1.5f, 1.5f, 1.5f};
- static const float const_2_00[elPerVec] = {2.f, 2.f, 2.f, 2.f, 2.f, 2.f, 2.f, 2.f};
- static const float const_2_25[elPerVec] = {2.25f, 2.25f, 2.25f, 2.25f, 2.25f, 2.25f, 2.25f, 2.25f};
+ static const float const_0_75[elPerVec] = {-0.75F, -0.75F, -0.75F, -0.75F, -0.75F, -0.75F, -0.75F, -0.75F};
+ static const float const_1_25[elPerVec] = {1.25F, 1.25F, 1.25F, 1.25F, 1.25F, 1.25F, 1.25F, 1.25F};
+ static const float const_1_50[elPerVec] = {1.5F, 1.5F, 1.5F, 1.5F, 1.5F, 1.5F, 1.5F, 1.5F};
+ static const float const_2_00[elPerVec] = {2.F, 2.F, 2.F, 2.F, 2.F, 2.F, 2.F, 2.F};
+ static const float const_2_25[elPerVec] = {2.25F, 2.25F, 2.25F, 2.25F, 2.25F, 2.25F, 2.25F, 2.25F};
auto rAux = getReg64();
auto vAux = getVmm();
@@ -1167,11 +1177,11 @@ template <>
void GridSampleKernel<x64::sse41>::bicubicCoefficients(const Vmm& vCoef, const Vmm& vDDim, const uint8_t idx) {
static const size_t elToAllocate = 2 * x64::cpu_isa_traits<x64::sse41>::vlen / sizeof(float);
// Allocation with a margin for address alignment.
- static const float c_0_75[elToAllocate] = {-0.75f, -0.75f, -0.75f, -0.75f, -0.75f, -0.75f, -0.75f, -0.75f};
- static const float c_1_25[elToAllocate] = {1.25f, 1.25f, 1.25f, 1.25f, 1.25f, 1.25f, 1.25f, 1.25f};
- static const float c_1_50[elToAllocate] = {1.5f, 1.5f, 1.5f, 1.5f, 1.5f, 1.5f, 1.5f, 1.5f};
- static const float c_2_00[elToAllocate] = {2.f, 2.f, 2.f, 2.f, 2.f, 2.f, 2.f, 2.f};
- static const float c_2_25[elToAllocate] = {2.25f, 2.25f, 2.25f, 2.25f, 2.25f, 2.25f, 2.25f, 2.25f};
+ static const float c_0_75[elToAllocate] = {-0.75F, -0.75F, -0.75F, -0.75F, -0.75F, -0.75F, -0.75F, -0.75F};
+ static const float c_1_25[elToAllocate] = {1.25F, 1.25F, 1.25F, 1.25F, 1.25F, 1.25F, 1.25F, 1.25F};
+ static const float c_1_50[elToAllocate] = {1.5F, 1.5F, 1.5F, 1.5F, 1.5F, 1.5F, 1.5F, 1.5F};
+ static const float c_2_00[elToAllocate] = {2.F, 2.F, 2.F, 2.F, 2.F, 2.F, 2.F, 2.F};
+ static const float c_2_25[elToAllocate] = {2.25F, 2.25F, 2.25F, 2.25F, 2.25F, 2.25F, 2.25F, 2.25F};
// Address alignment for XMM.
static const float* const_0_75 = c_0_75 + (reinterpret_cast<int64_t>(c_0_75) % 16) / sizeof(float);
static const float* const_1_25 = c_1_25 + (reinterpret_cast<int64_t>(c_1_25) % 16) / sizeof(float);
@@ -1234,7 +1244,8 @@ void GridSampleKernel<isa>::nearestInterpolation(const Vmm& vWCoord, const Vmm&
uni_vroundps(vWCoord, vWCoord, 0x0); // Round near
uni_vroundps(vHCoord, vHCoord, 0x0); // Round near
- bool useMask = false, zeroFill = false;
+ bool useMask = false;
+ bool zeroFill = false;
if (jcp.paddingMode == GridSamplePaddingMode::ZEROS) {
useMask = zeroFill = true;
zerosPadding(kGatherMask, vHCoord, vWCoord);
@@ -1249,7 +1260,8 @@ void GridSampleKernel<isa>::nearestInterpolation(const Vmm& vWCoord, const Vmm&
hwShiftPs2dq(vSrcShift, vHCoord, vWCoord, vSrcWidthF);
// PER CHANNEL LOOP
- Xbyak::Label lChannelLoopBegin, lChannelLoopEnd;
+ Xbyak::Label lChannelLoopBegin;
+ Xbyak::Label lChannelLoopEnd;
RegistersPool::Reg<Xbyak::Reg64> rChannel;
auto rSrcTmp = getReg64();
auto rDstTmp = getReg64();
@@ -1309,7 +1321,10 @@ void GridSampleKernel<x64::avx512_core>::bilinearInterpolation(const Vmm& vWCoor
auto shift10 = getVmm();
auto shift11 = getVmm();
auto vAux = getVmm();
- RegistersPool::Reg<Vmask> kMask00, kMask01, kMask10, kMask11;
+ RegistersPool::Reg<Vmask> kMask00;
+ RegistersPool::Reg<Vmask> kMask01;
+ RegistersPool::Reg<Vmask> kMask10;
+ RegistersPool::Reg<Vmask> kMask11;
uni_vroundps(shift00, vWCoord, 0x1); // Round floor
uni_vroundps(shift01, vHCoord, 0x1); // Round floor
@@ -1318,7 +1333,8 @@ void GridSampleKernel<x64::avx512_core>::bilinearInterpolation(const Vmm& vWCoor
uni_vaddps(shift10, shift00, vOnesF);
uni_vaddps(shift11, shift01, vOnesF);
- bool useMask = false, zeroFill = false;
+ bool useMask = false;
+ bool zeroFill = false;
if (jcp.paddingMode == GridSamplePaddingMode::ZEROS) {
useMask = zeroFill = true;
kMask00 = getMask();
@@ -1360,7 +1376,8 @@ void GridSampleKernel<x64::avx512_core>::bilinearInterpolation(const Vmm& vWCoor
auto vQ1 = getVmm();
// PER CHANNEL LOOP
- Xbyak::Label lChannelLoopBegin, lChannelLoopEnd;
+ Xbyak::Label lChannelLoopBegin;
+ Xbyak::Label lChannelLoopEnd;
RegistersPool::Reg<Xbyak::Reg64> rChannel;
auto rSrcTmp = getReg64();
auto rDstTmp = getReg64();
@@ -1449,10 +1466,17 @@ void GridSampleKernel<isa>::bilinearInterpolation(const Vmm& vWCoord, const Vmm&
auto& vDX = vWCoord;
auto& vDY = vHCoord;
auto vAux = getVmm();
- Vmm shift00, shift01, shift10, shift11;
- RegistersPool::Reg<Vmm> shift10Holder, shift11Holder;
+ Vmm shift00;
+ Vmm shift01;
+ Vmm shift10;
+ Vmm shift11;
+ RegistersPool::Reg<Vmm> shift10Holder;
+ RegistersPool::Reg<Vmm> shift11Holder;
// For ZEROS padding only.
- RegistersPool::Reg<Vmm> vMask00, vMask01, vMask10, vMask11;
+ RegistersPool::Reg<Vmm> vMask00;
+ RegistersPool::Reg<Vmm> vMask01;
+ RegistersPool::Reg<Vmm> vMask10;
+ RegistersPool::Reg<Vmm> vMask11;
uni_vroundps(vWRound, vWCoord, 0x1); // Round floor
uni_vroundps(vHRound, vHCoord, 0x1); // Round floor
@@ -1471,12 +1495,13 @@ void GridSampleKernel<isa>::bilinearInterpolation(const Vmm& vWCoord, const Vmm&
uni_vaddps(shift11, vHRound, vOnesF);
}
- bool useMask = false, zeroFill = false;
+ bool useMask = false;
+ bool zeroFill = false;
if (jcp.paddingMode == GridSamplePaddingMode::ZEROS) {
useMask = zeroFill = true;
{
auto rAux = getReg64();
- static const float onesArr[8] = {1.f, 1.f, 1.f, 1.f, 1.f, 1.f, 1.f, 1.f};
+ static const float onesArr[8] = {1.F, 1.F, 1.F, 1.F, 1.F, 1.F, 1.F, 1.F};
if (isa == x64::sse41) {
static const float* onesPtr = onesArr + (reinterpret_cast<int64_t>(onesArr) % 16) / sizeof(float);
mov(rAux, reinterpret_cast<uintptr_t>(onesPtr));
@@ -1526,7 +1551,8 @@ void GridSampleKernel<isa>::bilinearInterpolation(const Vmm& vWCoord, const Vmm&
auto vQ1 = getVmm();
// PER CHANNEL LOOP
- Xbyak::Label lChannelLoopBegin, lChannelLoopEnd;
+ Xbyak::Label lChannelLoopBegin;
+ Xbyak::Label lChannelLoopEnd;
RegistersPool::Reg<Xbyak::Reg64> rChannel;
auto rSrcTmp = getReg64();
auto rDstTmp = getReg64();
@@ -1692,7 +1718,8 @@ void GridSampleKernel<x64::avx512_core>::bicubicInterpolation(const Vmm& vWCoord
bicubicCoefficients(vCX[i], vDX, i);
}
- bool useMask = false, zeroFill = false;
+ bool useMask = false;
+ bool zeroFill = false;
if (jcp.paddingMode == GridSamplePaddingMode::ZEROS) {
useMask = zeroFill = true;
wMasks.resize(4);
@@ -1710,7 +1737,8 @@ void GridSampleKernel<x64::avx512_core>::bicubicInterpolation(const Vmm& vWCoord
}
// PER CHANNEL LOOP
- Xbyak::Label lChannelLoopBegin, lChannelLoopEnd;
+ Xbyak::Label lChannelLoopBegin;
+ Xbyak::Label lChannelLoopEnd;
RegistersPool::Reg<Xbyak::Reg64> rChannel;
auto rSrcTmp = getReg64();
auto rDstTmp = getReg64();
@@ -1835,7 +1863,8 @@ void GridSampleKernel<isa>::bicubicInterpolation(const Vmm& vWCoord, const Vmm&
auto rBuff = getReg64();
mov(rBuff, ptr[regParams + GET_OFF(buffer)]);
- bool useMask = false, zeroFill = false;
+ bool useMask = false;
+ bool zeroFill = false;
if (jcp.paddingMode == GridSamplePaddingMode::BORDER) {
auto rAux = getReg64();
@@ -1846,7 +1875,8 @@ void GridSampleKernel<isa>::bicubicInterpolation(const Vmm& vWCoord, const Vmm&
uni_vmovups(vSrcWidthSub1F, ptr[rAux]);
}
- auto vW0 = getVmm(), vW1 = getVmm();
+ auto vW0 = getVmm();
+ auto vW1 = getVmm();
Vmm vW[4] = {vW0, vW1, vHCoord, vWCoord};
for (int w = 0; w < 4; w++) {
borderPadding(vW[w], vWLeft, coord::w);
@@ -1864,7 +1894,7 @@ void GridSampleKernel<isa>::bicubicInterpolation(const Vmm& vWCoord, const Vmm&
}
auto vH = getVmm();
- size_t bufShift = 0lu;
+ size_t bufShift = 0LU;
for (int h = 0; h < 4; h++) {
borderPadding(vH, vHTop, coord::h);
uni_vmulps(vH, vH, vSrcWidthF);
@@ -1894,7 +1924,8 @@ void GridSampleKernel<isa>::bicubicInterpolation(const Vmm& vWCoord, const Vmm&
uni_vmovups(vSrcWidthMul2Sub1F, ptr[rAux]);
}
- auto vW0 = getVmm(), vW1 = getVmm();
+ auto vW0 = getVmm();
+ auto vW1 = getVmm();
Vmm vW[4] = {vW0, vW1, vHCoord, vWCoord};
for (int w = 0; w < 4; w++) {
reflectionPadding(vW[w], vWLeft, coord::w);
@@ -1918,7 +1949,7 @@ void GridSampleKernel<isa>::bicubicInterpolation(const Vmm& vWCoord, const Vmm&
}
auto vH = getVmm();
- size_t bufShift = 0lu;
+ size_t bufShift = 0LU;
for (int h = 0; h < 4; h++) {
reflectionPadding(vH, vHTop, coord::h);
uni_vmulps(vH, vH, vSrcWidthF);
@@ -1952,8 +1983,9 @@ void GridSampleKernel<isa>::bicubicInterpolation(const Vmm& vWCoord, const Vmm&
}
}
- size_t bufShift = 0lu;
- auto vShift = vWCoord, vMaskH = vHCoord;
+ size_t bufShift = 0LU;
+ auto vShift = vWCoord;
+ auto vMaskH = vHCoord;
if (!vDataTypeSizeB.isInitialized()) {
auto rAux = getReg64();
vDataTypeSizeB = getVmm();
@@ -1993,7 +2025,8 @@ void GridSampleKernel<isa>::bicubicInterpolation(const Vmm& vWCoord, const Vmm&
for (int w = 0; w < 4; w++) {
bicubicCoefficients(vCX[w], vDX, w);
}
- auto vCY0 = getVmm(), vCY1 = getVmm();
+ auto vCY0 = getVmm();
+ auto vCY1 = getVmm();
Vmm vCY[4] = {vCY0, vCY1, vHCoord, vWCoord};
for (int h = 0; h < 4; h++) {
bicubicCoefficients(vCY[h], vDY, h);
@@ -2006,7 +2039,8 @@ void GridSampleKernel<isa>::bicubicInterpolation(const Vmm& vWCoord, const Vmm&
auto vAux = getVmm();
// PER CHANNEL LOOP
- Xbyak::Label lChannelLoopBegin, lChannelLoopEnd;
+ Xbyak::Label lChannelLoopBegin;
+ Xbyak::Label lChannelLoopEnd;
RegistersPool::Reg<Xbyak::Reg64> rChannel;
auto rSrcTmp = getReg64();
auto rDstTmp = getReg64();
diff --git a/src/plugins/intel_cpu/src/nodes/kernels/x64/jit_kernel.cpp b/src/plugins/intel_cpu/src/nodes/kernels/x64/jit_kernel.cpp
index ef1dc9a4bda..e66a7cdf854 100644
--- a/src/plugins/intel_cpu/src/nodes/kernels/x64/jit_kernel.cpp
+++ b/src/plugins/intel_cpu/src/nodes/kernels/x64/jit_kernel.cpp
@@ -294,7 +294,7 @@ const Xbyak::Reg64& stack_frame::pointer() const {
}
void stack_frame::clear() const {
- const size_t end = _size & ~static_cast<size_t>(7u);
+ const size_t end = _size & ~static_cast<size_t>(7U);
_kernel.foreach (
0,
diff --git a/src/plugins/intel_cpu/src/nodes/kernels/x64/jit_kernel_base.cpp b/src/plugins/intel_cpu/src/nodes/kernels/x64/jit_kernel_base.cpp
index 5d684bf68dd..1f3d812ded0 100644
--- a/src/plugins/intel_cpu/src/nodes/kernels/x64/jit_kernel_base.cpp
+++ b/src/plugins/intel_cpu/src/nodes/kernels/x64/jit_kernel_base.cpp
@@ -302,8 +302,9 @@ void JitKernelBase::gatherdd(const Xbyak::Ymm& v_dst,
vpgatherdd(v_dst, ptr[rSrcPtr + vSrcShift], vReadMask);
} else {
- auto xmmDst = Xbyak::Xmm(v_dst.getIdx()), xmmSrcShft = Xbyak::Xmm(vSrcShift.getIdx()),
- xmmReadMask = Xbyak::Xmm(vReadMask.getIdx());
+ auto xmmDst = Xbyak::Xmm(v_dst.getIdx());
+ auto xmmSrcShft = Xbyak::Xmm(vSrcShift.getIdx());
+ auto xmmReadMask = Xbyak::Xmm(vReadMask.getIdx());
for (uint8_t i = 0; i < 2; i++) {
gatherdd(xmmDst, rSrcPtr, xmmSrcShft, xmmReadMask, useMask, zeroFill);
@@ -418,7 +419,7 @@ void JitKernelBase::fillRestWorkMask(const Xbyak::Opmask& dstMask, const Xbyak::
void JitKernelBase::fillRestWorkMask(const Xbyak::Xmm& xmmDstMask,
const Xbyak::Reg64& rWorkRest,
const uint64_t typeSize) {
- if (!one_of(typeSize, 1u, 2u, 4u, 8u)) {
+ if (!one_of(typeSize, 1U, 2U, 4U, 8U)) {
OPENVINO_THROW("Could not fill data with type size ", typeSize);
}
Xbyak::Label lEnd;
@@ -447,7 +448,7 @@ void JitKernelBase::fillRestWorkMask(const Xbyak::Xmm& xmmDstMask,
void JitKernelBase::fillRestWorkMask(const Xbyak::Ymm& ymmDstMask,
const Xbyak::Reg64& rWorkRest,
const uint64_t typeSize) {
- if (!one_of(typeSize, 1u, 2u, 4u, 8u)) {
+ if (!one_of(typeSize, 1U, 2U, 4U, 8U)) {
OPENVINO_THROW("Could not fill data with type size ", typeSize);
}
Xbyak::Label lEnd;
@@ -487,7 +488,7 @@ void JitKernelBase::load(const Xbyak::Xmm& v_dst,
const Xbyak::Reg64& rLoadNum,
const size_t typeSize,
const bool zeroFilling) {
- if (!one_of(typeSize, 1u, 2u, 4u, 8u)) {
+ if (!one_of(typeSize, 1U, 2U, 4U, 8U)) {
OPENVINO_THROW("Could not load data with type size ", typeSize);
}
const uint8_t elPerVec = x64::cpu_isa_traits<x64::sse41>::vlen / typeSize;
@@ -519,7 +520,7 @@ void JitKernelBase::load(const Xbyak::Ymm& v_dst,
const Xbyak::Reg64& rLoadNum,
const size_t typeSize,
const bool zeroFilling) {
- if (!one_of(typeSize, 1u, 2u, 4u, 8u)) {
+ if (!one_of(typeSize, 1U, 2U, 4U, 8U)) {
OPENVINO_THROW("Could not load data with type size ", typeSize);
}
const size_t elPerXmm = x64::cpu_isa_traits<x64::sse41>::vlen / typeSize;
@@ -529,12 +530,12 @@ void JitKernelBase::load(const Xbyak::Ymm& v_dst,
}
Xbyak::Xmm xmmDst(v_dst.getIdx());
- for (size_t i = 0lu; i < 2lu; i++) {
+ for (size_t i = 0LU; i < 2LU; i++) {
Xbyak::Label lPerm;
const size_t idx = i * elPerXmm;
const size_t offset0 = idx * typeSize;
- for (size_t j = 0lu; j < elPerXmm; j++) {
+ for (size_t j = 0LU; j < elPerXmm; j++) {
cmp(rLoadNum, j + idx);
jle(i == 0 ? lEnd : lPerm, T_NEAR);
@@ -560,7 +561,7 @@ void JitKernelBase::store(const Xbyak::Address& dstAddr,
const Xbyak::Xmm& v_src,
const Xbyak::Reg64& rToStoreNum,
const size_t typeSize) {
- if (!one_of(typeSize, 1u, 2u, 4u, 8u)) {
+ if (!one_of(typeSize, 1U, 2U, 4U, 8U)) {
OPENVINO_THROW("Could not store data with type size ", typeSize);
}
Xbyak::Label lEnd;
@@ -588,7 +589,7 @@ void JitKernelBase::store(const Xbyak::Address& dstAddr,
const Xbyak::Ymm& v_src,
const Xbyak::Reg64& rToStoreNum,
const size_t typeSize) {
- if (!one_of(typeSize, 1u, 2u, 4u, 8u)) {
+ if (!one_of(typeSize, 1U, 2U, 4U, 8U)) {
OPENVINO_THROW("Could not store data with type size ", typeSize);
}
Xbyak::Label lEnd;
@@ -677,7 +678,8 @@ void JitKernelBase::memMovDD(const Xbyak::Reg64& rDst,
} else if (isValidIsa(x64::avx)) {
const uint8_t typeSize = sizeof(int);
const uint8_t elPerXmm = x64::cpu_isa_traits<x64::sse41>::vlen / typeSize;
- auto xmmReadMask = Xbyak::Xmm(vReadMask.getIdx()), xmmSrcShft = Xbyak::Xmm(vSrcShift.getIdx());
+ auto xmmReadMask = Xbyak::Xmm(vReadMask.getIdx());
+ auto xmmSrcShft = Xbyak::Xmm(vSrcShift.getIdx());
for (uint8_t i = 0; i < 2; i++) {
memMovDD(rDst, rSrc, xmmReadMask, xmmSrcShft, rToStoreNum, useMask, zeroFill);
diff --git a/src/plugins/intel_cpu/src/nodes/kernels/x64/mlp_kernel.cpp b/src/plugins/intel_cpu/src/nodes/kernels/x64/mlp_kernel.cpp
index a8da6b41eab..28eacd4585e 100644
--- a/src/plugins/intel_cpu/src/nodes/kernels/x64/mlp_kernel.cpp
+++ b/src/plugins/intel_cpu/src/nodes/kernels/x64/mlp_kernel.cpp
@@ -332,7 +332,7 @@ repackB(Tdst* dst, ov::float16* src, int N_stride, int N, int K) {
assert(K <= 32);
assert(N <= 16);
int k = 0;
- Tdst zero(0.0f);
+ Tdst zero(0.0F);
for (; k < 32; k += 2) {
int n = 0;
bool is_k0_valid = (k) < K;
@@ -420,7 +420,7 @@ void MKernel::BMatrix::setup(int8_t* ext_buff, int8_t* p_weight, int weight_stri
const int k_step = 64;
auto N_stride = weight_stride_in_bytes / sizeof(int8_t);
- auto* pdst = reinterpret_cast<int8_t*>(ext_buff);
+ auto* pdst = ext_buff;
for (int n = 0; n < N; n += 32) {
auto* src0 = p_weight + n * N_stride;
auto* src1 = p_weight + (n + 16) * N_stride;
@@ -428,9 +428,9 @@ void MKernel::BMatrix::setup(int8_t* ext_buff, int8_t* p_weight, int weight_stri
auto valid_n1 = std::min((N - (n + 16)), 16);
for (int k = 0, blkk = 0; k < K; k += k_step, blkk++) {
auto valid_k = std::min((K - k), k_step);
- repackB(reinterpret_cast<int8_t*>(pdst), src0 + k, N_stride, valid_n0, valid_k);
+ repackB(pdst, src0 + k, N_stride, valid_n0, valid_k);
pdst += 1024;
- repackB(reinterpret_cast<int8_t*>(pdst), src1 + k, N_stride, valid_n1, valid_k);
+ repackB(pdst, src1 + k, N_stride, valid_n1, valid_k);
pdst += 1024;
}
}
@@ -485,14 +485,14 @@ void MKernel::BMatrix::setup(int8_t* ext_buff,
const int k_step = 64;
auto N_stride = weight_stride_in_bytes / sizeof(int8_t);
auto N2 = N / 2;
- auto* pdst = reinterpret_cast<int8_t*>(ext_buff);
+ auto* pdst = ext_buff;
for (int n = 0; n < N2; n += 16) {
auto valid_n0 = std::min((N2 - n), 16);
for (int k = 0; k < K; k += k_step) {
auto valid_k = std::min((K - k), k_step);
- repackB(reinterpret_cast<int8_t*>(pdst), p_weight_B0 + n * N_stride + k, N_stride, valid_n0, valid_k);
+ repackB(pdst, p_weight_B0 + n * N_stride + k, N_stride, valid_n0, valid_k);
pdst += 1024;
- repackB(reinterpret_cast<int8_t*>(pdst), p_weight_B1 + n * N_stride + k, N_stride, valid_n0, valid_k);
+ repackB(pdst, p_weight_B1 + n * N_stride + k, N_stride, valid_n0, valid_k);
pdst += 1024;
}
}
@@ -506,12 +506,12 @@ void MKernel::BMatrix::setup(int8_t* ext_buff,
// but prefetch of next B must be specified by caller.
//
void MKernel::run(int M, // actual M
- uint8_t* pA,
+ const uint8_t* pA,
int strideA, // A [M, K]
BMatrix& repacked_B, // B [N/32, K*32] ov::bfloat16
- uint8_t* pC,
- int strideC, // C [M, N]
- uint8_t* prefetch_B, // prefetch B
+ const uint8_t* pC,
+ int strideC, // C [M, N]
+ const uint8_t* prefetch_B, // prefetch B
bool do_accumulation) {
call_args args;
@@ -539,10 +539,11 @@ void MKernel::run(int M, // actual M
}
}
-void MatrixDynQuantPerRow::quantize(size_t BM, ov::bfloat16* psrc, int src_stride) {
+void MatrixDynQuantPerRow::quantize(size_t BM, ov::bfloat16* psrc, int src_stride) const {
assert(static_cast<int64_t>(BM) <= M);
parallel_nt_static(0, [&](const size_t ithr, const size_t nthr) {
- size_t start{0}, end{0};
+ size_t start{0};
+ size_t end{0};
splitter(BM, nthr, ithr, start, end);
ov::Extensions::Cpu::XARCH::llm_mlp_quantize_bf16_i8(psrc + start * src_stride,
src_stride,
@@ -556,10 +557,11 @@ void MatrixDynQuantPerRow::quantize(size_t BM, ov::bfloat16* psrc, int src_strid
});
}
-void MatrixDynQuantPerRow::quantize(size_t BM, ov::float16* psrc, int src_stride) {
+void MatrixDynQuantPerRow::quantize(size_t BM, ov::float16* psrc, int src_stride) const {
assert(static_cast<int64_t>(BM) <= M);
parallel_nt_static(0, [&](const size_t ithr, const size_t nthr) {
- size_t start{0}, end{0};
+ size_t start{0};
+ size_t end{0};
splitter(BM, nthr, ithr, start, end);
ov::Extensions::Cpu::XARCH::llm_mlp_quantize_f16_i8(psrc + start * src_stride,
src_stride,
@@ -590,9 +592,9 @@ void GateUpCombine::generate() {
auto injector = std::make_shared<jit_uni_eltwise_injector<dnnl::impl::cpu::x64::avx512_core>>(
this,
m_act_alg,
- 1.f,
- 1.0f,
- 1.f,
+ 1.F,
+ 1.0F,
+ 1.F,
data_type::f32,
true, // save_state, true due to additional r15 is used.
Xbyak::Reg64(Xbyak::Operand::R10), // p_table
diff --git a/src/plugins/intel_cpu/src/nodes/kernels/x64/mlp_kernel.hpp b/src/plugins/intel_cpu/src/nodes/kernels/x64/mlp_kernel.hpp
index 969ace9325e..a769358779b 100644
--- a/src/plugins/intel_cpu/src/nodes/kernels/x64/mlp_kernel.hpp
+++ b/src/plugins/intel_cpu/src/nodes/kernels/x64/mlp_kernel.hpp
@@ -128,7 +128,7 @@ public:
// with the help of :
// - m_BM_hint controls dynamic behaviour of the kernel
// - tile config controls behaviour of tileload & TMUL
- void tile_config_M(ov::Extensions::Cpu::TileConfig& tile_cfg, int M);
+ static void tile_config_M(ov::Extensions::Cpu::TileConfig& tile_cfg, int M);
// to save push/pop: do not use `abi_save_gpr_regs`
uint8_t* prefetch_next_A_addr;
@@ -175,12 +175,12 @@ public:
// but prefetch of next B must be specified by caller.
//
void run(int M, // actual M
- uint8_t* pA,
+ const uint8_t* pA,
int strideA, // A [M, K]
BMatrix& repacked_B, // B
- uint8_t* pC,
- int strideC, // C [M, N]
- uint8_t* prefetch_B, // prefetch B
+ const uint8_t* pC,
+ int strideC, // C [M, N]
+ const uint8_t* prefetch_B, // prefetch B
bool do_accumulation);
};
@@ -485,8 +485,8 @@ struct MatrixDynQuantPerRow {
zp = reinterpret_cast<float*>(scale + M);
}
- void quantize(size_t BM, ov::bfloat16* psrc, int src_stride);
- void quantize(size_t BM, ov::float16* psrc, int src_stride);
+ void quantize(size_t BM, ov::bfloat16* psrc, int src_stride) const;
+ void quantize(size_t BM, ov::float16* psrc, int src_stride) const;
};
// combine gate_proj & up_proj using activation algo, then convert to bf16
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 843bbf092e3..b08b7b71c49 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
@@ -74,7 +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, zp;
+ float scale;
+ float zp;
if (f_max == f_min || std::isnan(f_max) || std::isnan(f_min)) {
// special case
p_zp[y] = 0;
@@ -91,11 +92,11 @@ void llm_mlp_quantize_to_i8(T* psrc,
continue;
}
if (asym) {
- scale = (f_max - f_min) / 255.0f;
+ scale = (f_max - f_min) / 255.0F;
zp = 127 - (f_max / scale);
} else {
auto fx = std::max(std::abs(f_max), std::abs(f_min));
- scale = fx / 127.0f;
+ scale = fx / 127.0F;
zp = 0;
}
p_zp[y] = zp;
@@ -144,14 +145,14 @@ void llm_mlp_quantize_f16_i8(ov::float16* psrc,
void llm_mlp_dequantize_i32_f32(int Batch,
int OC,
- int32_t* src,
+ const int32_t* src,
int stride_src,
float* dst,
int stride_dst,
- float* p_src_scale_per_row,
- float* p_src_zp_per_row,
- float* p_wsum_per_oc,
- float* p_wscale_per_oc,
+ const float* p_src_scale_per_row,
+ const float* p_src_zp_per_row,
+ const float* p_wsum_per_oc,
+ const float* p_wscale_per_oc,
bool asym) {
for (int b = 0; b < Batch; b++, src += stride_src, dst += stride_dst) {
float s1 = p_src_scale_per_row[b];
diff --git a/src/plugins/intel_cpu/src/nodes/kernels/x64/mlp_utils.hpp b/src/plugins/intel_cpu/src/nodes/kernels/x64/mlp_utils.hpp
index acb8eab537e..5e2179f69c5 100644
--- a/src/plugins/intel_cpu/src/nodes/kernels/x64/mlp_utils.hpp
+++ b/src/plugins/intel_cpu/src/nodes/kernels/x64/mlp_utils.hpp
@@ -30,13 +30,13 @@ void llm_mlp_quantize_f16_i8(ov::float16* psrc,
bool asym);
void llm_mlp_dequantize_i32_f32(int Batch,
int OC,
- int32_t* src,
+ const int32_t* src,
int stride_src,
float* dst,
int stride_dst,
- float* p_src_scale_per_row,
- float* p_src_zp_per_row,
- float* p_wsum_per_oc,
- float* p_wscale_per_oc,
+ const float* p_src_scale_per_row,
+ const float* p_src_zp_per_row,
+ const float* p_wsum_per_oc,
+ const float* p_wscale_per_oc,
bool asym);
} // namespace ov::Extensions::Cpu::XARCH
diff --git a/src/plugins/intel_cpu/src/nodes/kernels/x64/non_max_suppression.cpp b/src/plugins/intel_cpu/src/nodes/kernels/x64/non_max_suppression.cpp
index 4607d6335d7..00f15faea4d 100644
--- a/src/plugins/intel_cpu/src/nodes/kernels/x64/non_max_suppression.cpp
+++ b/src/plugins/intel_cpu/src/nodes/kernels/x64/non_max_suppression.cpp
@@ -30,7 +30,7 @@ void NonMaxSuppression<isa>::generate() {
std::make_unique<jit_load_emitter>(this, isa, ov::element::f32, ov::element::f32, scalar_step);
exp_injector.reset(
- new x64::jit_uni_eltwise_injector<isa>(this, dnnl::impl::alg_kind::eltwise_exp, 0.f, 0.f, 1.f, data_type::f32));
+ new x64::jit_uni_eltwise_injector<isa>(this, dnnl::impl::alg_kind::eltwise_exp, 0.F, 0.F, 1.F, data_type::f32));
this->preamble();
diff --git a/src/plugins/intel_cpu/src/nodes/kernels/x64/random_uniform.cpp b/src/plugins/intel_cpu/src/nodes/kernels/x64/random_uniform.cpp
index 535bcf08da9..e17085be145 100644
--- a/src/plugins/intel_cpu/src/nodes/kernels/x64/random_uniform.cpp
+++ b/src/plugins/intel_cpu/src/nodes/kernels/x64/random_uniform.cpp
@@ -294,13 +294,14 @@ void PhiloxGenerator<isa>::process() {
std::vector<Vmm> v_res{v_dst_0, v_dst_1};
auto step = vlen;
- if (one_of(m_jcp.out_data_type.size(), 2lu, 4lu)) {
+ if (one_of(m_jcp.out_data_type.size(), 2LU, 4LU)) {
step = vlen * 2 / sizeof(uint32_t);
} else if (m_jcp.out_data_type.size() == 8) {
step = vlen / sizeof(uint32_t);
}
- Xbyak::Label l_loop, l_tail;
+ Xbyak::Label l_loop;
+ Xbyak::Label l_tail;
L(l_loop);
{
cmp(r64_work_amount, step);
@@ -311,7 +312,7 @@ void PhiloxGenerator<isa>::process() {
uni_vmovups(ptr[r64_dst], v_dst_0);
add(r64_dst, vlen);
- if (one_of(m_jcp.out_data_type.size(), 4lu, 8lu)) {
+ if (one_of(m_jcp.out_data_type.size(), 4LU, 8LU)) {
uni_vmovups(ptr[r64_dst], v_dst_1);
add(r64_dst, vlen);
}
@@ -379,7 +380,7 @@ void PhiloxGenerator<isa>::runPhilox(const std::vector<Vmm>& vmm_dst,
uni_vpshufd(vmm_n_0, vmm_n_0, 0b10110001); // {_,n0,_,n0} -> {n0,_,n0,_}
uni_vxorps(vmm_n_0, vmm_n_0, vmm_key); // {n0,_,n0,_} = {n0,_,n0,_} ^ {k0,_,k0,_}
- for (size_t i = 0lu; i < ROUNDS_NUMBER - 1; i++) {
+ for (size_t i = 0LU; i < ROUNDS_NUMBER - 1; i++) {
raiseKey(vmm_k_0, vmm_k_1);
std::swap(vmm_c_1, vmm_aux_0);
@@ -422,7 +423,7 @@ void PhiloxGenerator<isa>::raiseKey(const Vmm& vmm_k_0, const Vmm& vmm_k_1) {
template <>
void PhiloxGenerator<x64::avx512_core>::convert(const std::vector<Vmm>& v_dst, const std::vector<Vmm>& v_src) {
if (m_jcp.out_data_type.size() == 4) {
- for (size_t i = 0lu; i < v_src.size(); i++) {
+ for (size_t i = 0LU; i < v_src.size(); i++) {
const auto& vmm_src = v_src[i];
const auto& vmm_dst = v_dst[i];
@@ -476,7 +477,7 @@ void PhiloxGenerator<x64::avx512_core>::convert(const std::vector<Vmm>& v_dst, c
vsubph(vmm_dst, vmm_dst, v_convert_0);
vfmadd132ph(vmm_dst, v_min, v_range);
} else if (m_jcp.out_data_type == element::bf16 && x64::mayiuse(x64::avx512_core_bf16)) {
- for (size_t i = 0lu; i < v_src.size(); i++) {
+ for (size_t i = 0LU; i < v_src.size(); i++) {
const auto& vmm_dst = v_dst[i];
uni_vandps(vmm_dst, v_src[i], v_convert_1);
@@ -513,7 +514,7 @@ void PhiloxGenerator<x64::avx512_core>::convert(const std::vector<Vmm>& v_dst, c
template <x64::cpu_isa_t isa> // Works for AVX2, SSE41
void PhiloxGenerator<isa>::convert(const std::vector<Vmm>& v_dst, const std::vector<Vmm>& v_src) {
if (m_jcp.out_data_type.size() == 4) {
- for (size_t i = 0lu; i < v_src.size(); i++) {
+ for (size_t i = 0LU; i < v_src.size(); i++) {
auto vmm_src = v_src[i];
auto vmm_dst = v_dst[i];
@@ -640,7 +641,8 @@ void PhiloxGenerator<x64::avx512_core>::tail(const std::vector<Vmm>& vmm_dst) {
template <>
void PhiloxGenerator<x64::avx2>::tail(const std::vector<Vmm>& vmm_dst) {
- Xbyak::Label l_0, l_end;
+ Xbyak::Label l_0;
+ Xbyak::Label l_end;
const auto step = vlen / sizeof(uint32_t);
cmp(r64_work_amount, 0);
@@ -669,7 +671,8 @@ void PhiloxGenerator<x64::avx2>::tail(const std::vector<Vmm>& vmm_dst) {
template <x64::cpu_isa_t isa>
void PhiloxGenerator<isa>::tail(const std::vector<Vmm>& vmm_dst) {
- Xbyak::Label l_0, l_end;
+ Xbyak::Label l_0;
+ Xbyak::Label l_end;
const auto step = vlen / sizeof(uint32_t);
cmp(r64_work_amount, 0);
@@ -754,7 +757,7 @@ void MersenneTwisterGenerator<x64::avx512_core>::initVectors() {
// Initialize constants based on the requested data type
if (m_jcp.out_data_type == element::f32) {
FloatAsBits val;
- val.f = 1.0f / (1 << 24);
+ val.f = 1.0F / (1 << 24);
BROADCAST_CONSTANT(vpbroadcastd, v_divisor, r32_aux, val.u);
BROADCAST_CONSTANT(vpbroadcastd, v_mask, r32_aux, static_cast<uint32_t>((1 << 24) - 1))
@@ -762,7 +765,7 @@ void MersenneTwisterGenerator<x64::avx512_core>::initVectors() {
BROADCAST_PARAM(vpbroadcastd, v_min, r64_aux, GET_MERSENNE_OFFSET(min_ptr))
} else if (m_jcp.out_data_type == element::f16 && x64::mayiuse(x64::avx512_core_fp16)) {
FloatAsBits val;
- val.f = 1.0f / (1 << 11);
+ val.f = 1.0F / (1 << 11);
BROADCAST_CONSTANT(vpbroadcastd, v_divisor, r32_aux, val.u);
BROADCAST_CONSTANT(vpbroadcastd, v_mask, r32_aux, static_cast<uint32_t>((1 << 11) - 1))
@@ -771,7 +774,7 @@ void MersenneTwisterGenerator<x64::avx512_core>::initVectors() {
BROADCAST_PARAM(vpbroadcastw, v_min, r64_aux, GET_MERSENNE_OFFSET(min_ptr))
} else if (m_jcp.out_data_type == element::bf16 && x64::mayiuse(x64::avx512_core_bf16)) {
FloatAsBits val;
- val.f = 1.0f / (1 << 8);
+ val.f = 1.0F / (1 << 8);
BROADCAST_CONSTANT(vpbroadcastd, v_divisor, r32_aux, val.u);
BROADCAST_CONSTANT(vpbroadcastd, v_mask, r32_aux, static_cast<uint32_t>((1 << 8) - 1))
@@ -823,7 +826,7 @@ void MersenneTwisterGenerator<isa>::initVectors() {
INIT_ARR(mask, static_cast<uint32_t>((1 << 24) - 1), r64_aux, uint32_t);
uni_vmovups(v_mask, ptr[r64_aux]);
- INIT_ARR(divisor, static_cast<float>(1.0f / (1 << 24)), r64_aux, float);
+ INIT_ARR(divisor, static_cast<float>(1.0F / (1 << 24)), r64_aux, float);
uni_vmovups(v_divisor, ptr[r64_aux]);
mov(r64_aux, ptr[r64_params + GET_MERSENNE_OFFSET(range_ptr)]);
diff --git a/src/plugins/intel_cpu/src/nodes/kernels/x64/rms_kernel.cpp b/src/plugins/intel_cpu/src/nodes/kernels/x64/rms_kernel.cpp
index 699d126056a..b9adf475970 100644
--- a/src/plugins/intel_cpu/src/nodes/kernels/x64/rms_kernel.cpp
+++ b/src/plugins/intel_cpu/src/nodes/kernels/x64/rms_kernel.cpp
@@ -171,7 +171,7 @@ void jit_rms_kernel<isa>::generate() {
// mean(x^2)
OPENVINO_ASSERT(m_jcp.data_size != 0);
- mov(reg_tmp.cvt32(), float2int(1.0f / m_jcp.data_size));
+ mov(reg_tmp.cvt32(), float2int(1.0F / m_jcp.data_size));
vmovd(xmm_tmp, reg_tmp.cvt32());
vmulss(xmm_rsqrt, xmm_rsqrt, xmm_tmp);
// mean(x^2)+eps
@@ -181,7 +181,7 @@ void jit_rms_kernel<isa>::generate() {
// 1 / sqrt(mean(x^2)+eps) dont's use VRSQRTSS. VRSQRTSS uses approximation and has accuracy issue
vsqrtss(xmm_rsqrt, xmm_rsqrt, xmm_rsqrt);
- mov(reg_tmp.cvt32(), float2int(1.0f));
+ mov(reg_tmp.cvt32(), float2int(1.0F));
vmovd(xmm_tmp, reg_tmp.cvt32());
vdivss(xmm_rsqrt, xmm_tmp, xmm_rsqrt);
diff --git a/src/plugins/intel_cpu/src/nodes/llm_mlp.cpp b/src/plugins/intel_cpu/src/nodes/llm_mlp.cpp
index 7dd3c8dc717..aa5daebdaa9 100644
--- a/src/plugins/intel_cpu/src/nodes/llm_mlp.cpp
+++ b/src/plugins/intel_cpu/src/nodes/llm_mlp.cpp
@@ -415,7 +415,7 @@ struct LLMMLP::Executor : public LLMMLP::ExecutorBase {
});
m_threads_num = parallel_get_max_threads();
- for (size_t ithr = 0lu; ithr < m_threads_num; ithr++) {
+ for (size_t ithr = 0LU; ithr < m_threads_num; ithr++) {
auto C1_size = gate_up.works[ithr].set_C(M, reinterpret_cast<float*>(cur_scratch_base));
auto C2_size = down.works[ithr].set_C(M, reinterpret_cast<float*>(cur_scratch_base));
auto max_C_size = std::max(C1_size, C2_size);
@@ -511,7 +511,7 @@ struct LLMMLP::Executor : public LLMMLP::ExecutorBase {
}
private:
- size_t m_threads_num = 0lu;
+ size_t m_threads_num = 0LU;
};
#else
template <typename T>
diff --git a/src/plugins/intel_cpu/src/nodes/log_softmax.cpp b/src/plugins/intel_cpu/src/nodes/log_softmax.cpp
index e7796be7447..a8812060f45 100644
--- a/src/plugins/intel_cpu/src/nodes/log_softmax.cpp
+++ b/src/plugins/intel_cpu/src/nodes/log_softmax.cpp
@@ -118,7 +118,7 @@ void LogSoftmax::execute([[maybe_unused]] const dnnl::stream& strm) {
const float* srcDataPtr = &srcData[i * reducedAxisSize];
float* dstDataPtr = &dstData[i * reducedAxisSize];
- float reduceProd = 0.0f;
+ float reduceProd = 0.0F;
const float max = *std::max_element(srcDataPtr, srcDataPtr + reducedAxisSize);
for (size_t j = 0; j < reducedAxisSize; ++j) {
reduceProd += expf(srcDataPtr[j] - max);
@@ -134,7 +134,7 @@ void LogSoftmax::execute([[maybe_unused]] const dnnl::stream& strm) {
const float* srcDataPtr = &srcData[k * reducedAxisStride * reducedAxisSize + i];
float* dstDataPtr = &dstData[k * reducedAxisStride * reducedAxisSize + i];
- float reduceProd = 0.0f;
+ float reduceProd = 0.0F;
float max = std::numeric_limits<float>::min();
for (size_t j = 0; j < reducedAxisSize; ++j) {
if (srcDataPtr[j * reducedAxisStride] > max) {
diff --git a/src/plugins/intel_cpu/src/nodes/lora.cpp b/src/plugins/intel_cpu/src/nodes/lora.cpp
index 241cb54ee6d..6e57e2ab2c1 100644
--- a/src/plugins/intel_cpu/src/nodes/lora.cpp
+++ b/src/plugins/intel_cpu/src/nodes/lora.cpp
@@ -141,7 +141,7 @@ void LoRA::createPrimitive() {
m_graph.Activate();
}
-void LoRA::execute(const dnnl::stream&) {
+void LoRA::execute(const dnnl::stream& /*strm*/) {
m_graph.Infer();
}
diff --git a/src/plugins/intel_cpu/src/nodes/mathematics.cpp b/src/plugins/intel_cpu/src/nodes/mathematics.cpp
index cd9f5f5ee23..9224a2086f2 100644
--- a/src/plugins/intel_cpu/src/nodes/mathematics.cpp
+++ b/src/plugins/intel_cpu/src/nodes/mathematics.cpp
@@ -162,10 +162,10 @@ void Math::execute([[maybe_unused]] const dnnl::stream& strm) {
});
break;
case Algorithm::MathHardSigmoid:
- alpha = (alpha == 0.0f) ? 0.2f : alpha;
- beta = (beta == 0.0f) ? 0.5f : beta;
+ alpha = (alpha == 0.0F) ? 0.2F : alpha;
+ beta = (beta == 0.0F) ? 0.5F : beta;
parallel_for(dataSize, [&](size_t i) {
- dst_data[i] = (std::max)(0.f, (std::min)(1.f, alpha * src_data[i] + beta));
+ dst_data[i] = (std::max)(0.F, (std::min)(1.F, alpha * src_data[i] + beta));
});
break;
case Algorithm::MathNegative:
@@ -175,27 +175,27 @@ void Math::execute([[maybe_unused]] const dnnl::stream& strm) {
break;
case Algorithm::MathReciprocal:
parallel_for(dataSize, [&](size_t i) {
- dst_data[i] = 1.0f / src_data[i];
+ dst_data[i] = 1.0F / src_data[i];
});
break;
case Algorithm::MathSelu:
- alpha = (alpha == 0.0f) ? 1.67326f : alpha;
- gamma = (gamma == 0.0f) ? 1.0507f : gamma;
+ alpha = (alpha == 0.0F) ? 1.67326F : alpha;
+ gamma = (gamma == 0.0F) ? 1.0507F : gamma;
parallel_for(dataSize, [&](size_t i) {
float x = src_data[i];
- dst_data[i] = (x > 0.0f) ? (gamma * x) : (gamma * alpha * (std::exp(x) - 1.0f));
+ dst_data[i] = (x > 0.0F) ? (gamma * x) : (gamma * alpha * (std::exp(x) - 1.0F));
});
break;
case Algorithm::MathSign:
parallel_for(dataSize, [&](size_t i) {
- if (src_data[i] > 0.0f) {
- dst_data[i] = 1.0f;
- } else if (src_data[i] < 0.0f) {
- dst_data[i] = -1.0f;
+ if (src_data[i] > 0.0F) {
+ dst_data[i] = 1.0F;
+ } else if (src_data[i] < 0.0F) {
+ dst_data[i] = -1.0F;
} else if (std::isnan(src_data[i])) {
dst_data[i] = src_data[i];
} else {
- dst_data[i] = 0.0f;
+ dst_data[i] = 0.0F;
}
});
break;
@@ -217,7 +217,7 @@ void Math::execute([[maybe_unused]] const dnnl::stream& strm) {
case Algorithm::MathSoftsign:
parallel_for(dataSize, [&](size_t i) {
float x = src_data[i];
- dst_data[i] = x / (1.f + (std::abs)(x));
+ dst_data[i] = x / (1.F + (std::abs)(x));
});
break;
case Algorithm::MathTan:
diff --git a/src/plugins/intel_cpu/src/nodes/matmul.cpp b/src/plugins/intel_cpu/src/nodes/matmul.cpp
index 6c0363d3ad2..d1f59695c8c 100644
--- a/src/plugins/intel_cpu/src/nodes/matmul.cpp
+++ b/src/plugins/intel_cpu/src/nodes/matmul.cpp
@@ -505,7 +505,8 @@ void MatMul::initSupportedPrimitiveDescriptors() {
}
auto addSupportedPrimitiveDescriptor = [&](const dnnl::primitive_desc& prim_desc) {
- std::vector<PortConfig> inConfs, outConfs;
+ std::vector<PortConfig> inConfs;
+ std::vector<PortConfig> outConfs;
const int inPlaceOutPort = canBeInPlace() ? 0 : -1;
for (size_t i = 0; i < descInputNumbers(); i++) {
diff --git a/src/plugins/intel_cpu/src/nodes/matrix_nms.cpp b/src/plugins/intel_cpu/src/nodes/matrix_nms.cpp
index a91f2860a98..af8d0bfcce4 100644
--- a/src/plugins/intel_cpu/src/nodes/matrix_nms.cpp
+++ b/src/plugins/intel_cpu/src/nodes/matrix_nms.cpp
@@ -108,7 +108,7 @@ MatrixNms::MatrixNms(const std::shared_ptr<ov::Node>& op, const GraphContext::CP
m_normalized = attrs.normalized;
if (m_decayFunction == MatrixNmsDecayFunction::LINEAR) {
m_decay_fn = [](float iou, float max_iou, [[maybe_unused]] float sigma) -> float {
- return (1. - iou) / (1. - max_iou + 1e-10f);
+ return (1. - iou) / (1. - max_iou + 1e-10F);
};
} else {
m_decay_fn = [](float iou, float max_iou, float sigma) -> float {
@@ -166,7 +166,7 @@ bool MatrixNms::created() const {
namespace {
-static inline float boxArea(const float* bbox, const bool normalized) {
+inline float boxArea(const float* bbox, const bool normalized) {
if (bbox[2] < bbox[0] || bbox[3] < bbox[1]) {
return static_cast<float>(0.);
}
@@ -178,7 +178,7 @@ static inline float boxArea(const float* bbox, const bool normalized) {
return (width + 1) * (height + 1);
}
-static inline float intersectionOverUnion(const float* bbox1, const float* bbox2, const bool normalized) {
+inline float intersectionOverUnion(const float* bbox1, const float* bbox2, const bool normalized) {
if (bbox2[0] > bbox1[2] || bbox2[2] < bbox1[0] || bbox2[1] > bbox1[3] || bbox2[3] < bbox1[1]) {
return static_cast<float>(0.);
}
@@ -283,7 +283,7 @@ size_t MatrixNms::nmsMatrix(const float* boxesData,
void MatrixNms::prepareParams() {
const auto& boxes_dims = getParentEdgeAt(NMS_BOXES)->getMemory().getStaticDims();
const auto& scores_dims = getParentEdgeAt(NMS_SCORES)->getMemory().getStaticDims();
- if (!(boxes_dims[0] == scores_dims[0] && boxes_dims[1] == scores_dims[2])) {
+ if (boxes_dims[0] != scores_dims[0] || boxes_dims[1] != scores_dims[2]) {
THROW_CPU_NODE_ERR("has incompatible 'boxes' and 'scores' input dmensions");
}
@@ -463,7 +463,7 @@ void MatrixNms::execute([[maybe_unused]] const dnnl::stream& strm) {
}
if (m_outStaticShape) {
- std::fill_n(selectedOutputs + (outputOffset + real_boxes) * 6, (m_maxBoxesPerBatch - real_boxes) * 6, -1.f);
+ std::fill_n(selectedOutputs + (outputOffset + real_boxes) * 6, (m_maxBoxesPerBatch - real_boxes) * 6, -1.F);
std::fill_n(selectedIndices + (outputOffset + real_boxes), m_maxBoxesPerBatch - real_boxes, -1);
outputOffset += m_maxBoxesPerBatch;
originalOffset += real_boxes;
diff --git a/src/plugins/intel_cpu/src/nodes/memory.cpp b/src/plugins/intel_cpu/src/nodes/memory.cpp
index 3c53198ab1b..ec1c35ec41d 100644
--- a/src/plugins/intel_cpu/src/nodes/memory.cpp
+++ b/src/plugins/intel_cpu/src/nodes/memory.cpp
@@ -79,7 +79,6 @@ public:
}
};
-public:
MemoryStub(dnnl::engine eng, MemoryDescPtr pMemDesc)
: m_eng(std::move(eng)),
m_pMemDesc(std::move(pMemDesc)),
@@ -608,7 +607,6 @@ void MemoryInputBase::assignState() {
void MemoryInputBase::bypassAssignState() {
// nothing to do
- return;
}
MemoryInput::MemoryInput(const std::shared_ptr<ov::Node>& op, const GraphContext::CPtr& ctx)
diff --git a/src/plugins/intel_cpu/src/nodes/multiclass_nms.cpp b/src/plugins/intel_cpu/src/nodes/multiclass_nms.cpp
index a6d8e4f5539..ecd6100b6bb 100644
--- a/src/plugins/intel_cpu/src/nodes/multiclass_nms.cpp
+++ b/src/plugins/intel_cpu/src/nodes/multiclass_nms.cpp
@@ -395,7 +395,7 @@ void MultiClassNms::execute([[maybe_unused]] const dnnl::stream& strm) {
const size_t selectedBoxesNum_perBatch = m_maxBoxesPerBatch;
- for (size_t idx = 0lu; idx < validOutputs; idx++) {
+ for (size_t idx = 0LU; idx < validOutputs; idx++) {
m_selected_num[m_filtBoxes[idx].batch_index]++;
}
@@ -451,7 +451,7 @@ void MultiClassNms::execute([[maybe_unused]] const dnnl::stream& strm) {
if (m_outStaticShape) {
std::fill_n(selected_outputs + (output_offset + real_boxes) * 6,
(selectedBoxesNum_perBatch - real_boxes) * 6,
- -1.f);
+ -1.F);
std::fill_n(selected_indices + (output_offset + real_boxes), selectedBoxesNum_perBatch - real_boxes, -1);
output_offset += selectedBoxesNum_perBatch;
original_offset += real_boxes;
@@ -467,8 +467,15 @@ bool MultiClassNms::created() const {
}
float MultiClassNms::intersectionOverUnion(const float* boxesI, const float* boxesJ, const bool normalized) {
- float yminI, xminI, ymaxI, xmaxI, yminJ, xminJ, ymaxJ, xmaxJ;
- const auto norm = static_cast<float>(normalized == false);
+ float yminI;
+ float xminI;
+ float ymaxI;
+ float xmaxI;
+ float yminJ;
+ float xminJ;
+ float ymaxJ;
+ float xmaxJ;
+ const auto norm = static_cast<float>(!normalized);
// to align with reference
yminI = boxesI[0];
@@ -482,12 +489,12 @@ float MultiClassNms::intersectionOverUnion(const float* boxesI, const float* box
float areaI = (ymaxI - yminI + norm) * (xmaxI - xminI + norm);
float areaJ = (ymaxJ - yminJ + norm) * (xmaxJ - xminJ + norm);
- if (areaI <= 0.f || areaJ <= 0.f) {
- return 0.f;
+ if (areaI <= 0.F || areaJ <= 0.F) {
+ return 0.F;
}
- float intersection_area = (std::max)((std::min)(ymaxI, ymaxJ) - (std::max)(yminI, yminJ) + norm, 0.f) *
- (std::max)((std::min)(xmaxI, xmaxJ) - (std::max)(xminI, xminJ) + norm, 0.f);
+ float intersection_area = (std::max)((std::min)(ymaxI, ymaxJ) - (std::max)(yminI, yminJ) + norm, 0.F) *
+ (std::max)((std::min)(xmaxI, xmaxJ) - (std::max)(xminI, xminJ) + norm, 0.F);
return intersection_area / (areaI + areaJ - intersection_area);
}
@@ -503,7 +510,7 @@ void MultiClassNms::nmsWithEta(const float* boxes,
};
auto func = [](float iou, float adaptive_threshold) {
- return iou <= adaptive_threshold ? 1.0f : 0.0f;
+ return iou <= adaptive_threshold ? 1.0F : 0.0F;
};
parallel_for2d(m_numBatches, m_numClasses, [&](int batch_idx, int class_idx) {
diff --git a/src/plugins/intel_cpu/src/nodes/multiclass_nms.hpp b/src/plugins/intel_cpu/src/nodes/multiclass_nms.hpp
index 3dce28268c6..8b3f7f0fb89 100644
--- a/src/plugins/intel_cpu/src/nodes/multiclass_nms.hpp
+++ b/src/plugins/intel_cpu/src/nodes/multiclass_nms.hpp
@@ -106,7 +106,7 @@ private:
const std::string& name,
const std::string& type);
- float intersectionOverUnion(const float* boxesI, const float* boxesJ, const bool normalized);
+ static float intersectionOverUnion(const float* boxesI, const float* boxesJ, const bool normalized);
void nmsWithEta(const float* boxes,
const float* scores,
@@ -124,14 +124,14 @@ private:
const VectorDims& roisnumStrides,
const bool shared);
- const float* slice_class(const int batch_idx,
- const int class_idx,
- const float* dataPtr,
- const VectorDims& dataStrides,
- const bool is_boxes,
- const int* roisnum,
- const VectorDims& roisnumStrides,
- const bool shared);
+ static const float* slice_class(const int batch_idx,
+ const int class_idx,
+ const float* dataPtr,
+ const VectorDims& dataStrides,
+ const bool is_boxes,
+ const int* roisnum,
+ const VectorDims& roisnumStrides,
+ const bool shared);
};
} // namespace ov::intel_cpu::node
diff --git a/src/plugins/intel_cpu/src/nodes/multinomial.cpp b/src/plugins/intel_cpu/src/nodes/multinomial.cpp
index 87146fd871b..1e6dd6f8e81 100644
--- a/src/plugins/intel_cpu/src/nodes/multinomial.cpp
+++ b/src/plugins/intel_cpu/src/nodes/multinomial.cpp
@@ -209,7 +209,7 @@ void Multinomial::execute_convert_type() {
gen.seed(seed);
}
- const auto gen_max = static_cast<float>(gen.max());
+ const auto gen_max = static_cast<float>(std::mt19937::max());
std::generate(m_random_samples.begin(), m_random_samples.end(), [&]() {
return static_cast<P>(static_cast<float>(gen()) / gen_max);
});
diff --git a/src/plugins/intel_cpu/src/nodes/mvn.cpp b/src/plugins/intel_cpu/src/nodes/mvn.cpp
index 381313eac27..95e7bf56bc0 100644
--- a/src/plugins/intel_cpu/src/nodes/mvn.cpp
+++ b/src/plugins/intel_cpu/src/nodes/mvn.cpp
@@ -276,7 +276,7 @@ private:
const int tile_size[kTileNum] = {8, 4, 2, 1};
// nspc across channel
- inline void nspc_ac_ker() {
+ void nspc_ac_ker() {
Xbyak::Label loop_label;
Xbyak::Label loop_end_label;
L(loop_label);
@@ -306,7 +306,7 @@ private:
}
// nspc per channel with unroll
- inline void nspc_pc_ker() {
+ void nspc_pc_ker() {
// 4 unroll vector
// r12, rax, rdx, rbp, r15, rcx and rdi is available
// r13 is available as no fill need for this layout
@@ -584,7 +584,7 @@ private:
L(label_exit);
}
- inline void block_ker() {
+ void block_ker() {
// safe to use abi reg now.
Xbyak::Reg64 reg_src_bk = rcx;
Xbyak::Reg64 reg_work_amount_bk = rdi;
@@ -707,7 +707,7 @@ private:
L(label_exit);
}
- inline void worker_vector_unroll() {
+ void worker_vector_unroll() {
// if mean(sum) for continous data, then fast pass for major part
if (!jcp_.normalize_variance && jcp_.layout == MVNLayoutType::mvn_planar) {
auto vmm_one = Vmm(15);
@@ -773,7 +773,7 @@ private:
L(loop_end_label);
}
- inline void worker_full_size() {
+ void worker_full_size() {
load_emitter[VECTOR]->emit_code({static_cast<size_t>(reg_src.getIdx())},
{static_cast<size_t>(vmm_val.getIdx())},
{},
@@ -797,7 +797,7 @@ private:
}
}
- inline void worker_tails(Xbyak::Reg64& reg_tail_num, const std::function<void(int)>& func) {
+ void worker_tails(Xbyak::Reg64& reg_tail_num, const std::function<void(int)>& func) {
int tile_start_idx = (isa == cpu::x64::avx512_core) ? 0 : ((isa == cpu::x64::avx2) ? 1 : 2);
Label tile_exit[kTileNum];
for (int i = tile_start_idx; i < kTileNum; i++) {
@@ -811,7 +811,7 @@ private:
}
}
- inline void worker_block(int block_num, bool is_zero_pad) {
+ void worker_block(int block_num, bool is_zero_pad) {
if (is_zero_pad) {
switch (block_num) {
case 8:
@@ -906,7 +906,7 @@ private:
}
}
- inline void reduce_sum_store_xmm(Xbyak::Xmm xmm_sum) {
+ void reduce_sum_store_xmm(Xbyak::Xmm xmm_sum) {
uni_vmovshdup(xmm_aux3, xmm_sum); // sum:1,2,3,4; aux3:2,2,4,4
uni_vaddps(xmm_sum, xmm_sum, xmm_aux3); // sum:1+2,2+2,3+4,4+4
uni_vmovhlps(xmm_aux3, xmm_aux3, xmm_sum); // aux3:3+4,4+4,4,4
@@ -918,7 +918,7 @@ private:
}
}
- inline void reduce_sum_store_vmm(int vmm_idx) {
+ void reduce_sum_store_vmm(int vmm_idx) {
if (isa == cpu::x64::sse41) {
reduce_sum_store_xmm(Xmm(vmm_idx));
} else if (isa == cpu::x64::avx2) {
@@ -1155,7 +1155,7 @@ private:
std::vector<std::shared_ptr<jit_uni_depthwise_injector_f32<isa>>> depthwise_injectors;
std::vector<std::shared_ptr<jit_uni_quantization_injector_f32<isa>>> quantization_injectors;
- inline void norm_block_ker() {
+ void norm_block_ker() {
Xbyak::Reg64 reg_src_bk = rax;
Xbyak::Reg64 reg_dst_bk = rdx;
Xbyak::Reg64 reg_work_amount_bk = rdi;
@@ -1252,7 +1252,7 @@ private:
}
// nspc norm per channel with unroll
- inline void norm_nspc_pc_ker() {
+ void norm_nspc_pc_ker() {
// stack used as no more GPR.
const int gpr_size = 8;
sub(rsp, 7 * gpr_size);
@@ -1636,7 +1636,7 @@ private:
add(rsp, 7 * gpr_size);
}
- inline void norm_nspc_ac_ker() {
+ void norm_nspc_ac_ker() {
Xbyak::Reg64 reg_rt_shape_bk = rdx;
Xbyak::Reg64 reg_oc_off_bk = rax;
mov(reg_rt_shape_bk, reg_rt_shape);
@@ -1673,7 +1673,7 @@ private:
L(loop_end_label);
}
- inline void worker_mvn_vector_unroll(Xbyak::Reg64& reg_work_amount) {
+ void worker_mvn_vector_unroll(Xbyak::Reg64& reg_work_amount) {
Xbyak::Label mvn_loop_label;
Xbyak::Label mvn_loop_end_label;
@@ -1700,7 +1700,7 @@ private:
L(mvn_loop_end_label);
}
- inline void worker_mvn_vector() {
+ void worker_mvn_vector() {
load_emitter[VECTOR]->emit_code({static_cast<size_t>(reg_src.getIdx())},
{static_cast<size_t>(vmm_val.getIdx())},
{},
@@ -1719,7 +1719,7 @@ private:
{store_pool_gpr_idxs});
}
- inline void worker_mvn_tails(Xbyak::Reg64& reg_tail_num, const std::function<void(int)>& func) {
+ void worker_mvn_tails(Xbyak::Reg64& reg_tail_num, const std::function<void(int)>& func) {
int tile_start_idx = (isa == cpu::x64::avx512_core) ? 0 : ((isa == cpu::x64::avx2) ? 1 : 2);
Label tile_exit[kTileNum];
for (int i = tile_start_idx; i < kTileNum; i++) {
@@ -1733,7 +1733,7 @@ private:
}
}
- inline void worker_mvn_block(int block_num) {
+ void worker_mvn_block(int block_num) {
switch (block_num) {
case 8:
load_emitter[TAIL8]->emit_code({static_cast<size_t>(reg_src.getIdx())},
@@ -2379,16 +2379,16 @@ void MVN::MVNJitExecutor::mvn_pln(const uint8_t* src_data,
size_t cb = b * C3;
// Calculate mean value for one instance in batch
// Parallel sum for each channel
- float C3inv = 1.f / static_cast<float>(C3);
- float mean_temp = 0.0f;
+ float C3inv = 1.F / static_cast<float>(C3);
+ float mean_temp = 0.0F;
mean_temp = parallel_sum(C, mean_temp, [&](size_t c) -> float {
- float mean_internal = 0.0f;
+ float mean_internal = 0.0F;
size_t cc = cb + c * C2;
auto arg = jit_mvn_call_args();
arg.src = src_data + cc * src_data_size;
- arg.sum = static_cast<float*>(&mean_internal);
- arg.work_amount = static_cast<size_t>(C2 / blk_size); // for vector part
- arg.rt_shape_size = static_cast<size_t>(C2 % blk_size);
+ arg.sum = (&mean_internal);
+ arg.work_amount = (C2 / blk_size); // for vector part
+ arg.rt_shape_size = (C2 % blk_size);
arg.post_op_data = post_ops_data_;
(*mvn_mean_kernel)(&arg);
return mean_internal;
@@ -2399,22 +2399,22 @@ void MVN::MVNJitExecutor::mvn_pln(const uint8_t* src_data,
// calculate variance value for one instance in batch
// parallel sum for each channel
if (mvnAttrs.normalizeVariance_) {
- float variance_temp = 0.0f;
+ float variance_temp = 0.0F;
variance_temp = parallel_sum(C, variance_temp, [&](size_t c) -> float {
- float variance_internal = 0.0f;
+ float variance_internal = 0.0F;
size_t cc = cb + c * C2;
auto arg = jit_mvn_call_args();
arg.src = src_data + cc * src_data_size;
- arg.mean = static_cast<float*>(&mean);
- arg.variance = static_cast<float*>(&variance_internal);
- arg.work_amount = static_cast<size_t>(C2 / blk_size); // vector part
- arg.rt_shape_size = static_cast<size_t>(C2 % blk_size); // for tails
+ arg.mean = (&mean);
+ arg.variance = (&variance_internal);
+ arg.work_amount = (C2 / blk_size); // vector part
+ arg.rt_shape_size = (C2 % blk_size); // for tails
arg.post_op_data = post_ops_data_;
(*mvn_variance_kernel)(&arg);
return variance_internal;
});
- float variance = 1.f;
+ float variance = 1.F;
if (mvnAttrs.epsMode_ == INSIDE_SQRT) {
variance /= sqrtf(variance_temp * C3inv + mvnAttrs.epsValue_);
} else if (mvnAttrs.epsMode_ == OUTSIDE_SQRT) {
@@ -2427,10 +2427,10 @@ void MVN::MVNJitExecutor::mvn_pln(const uint8_t* src_data,
auto arg = jit_mvn_call_args();
arg.src = src_data + cc * src_data_size;
arg.dst = dst_data + cc * dst_data_size;
- arg.mean = static_cast<float*>(&mean);
- arg.variance = static_cast<float*>(&variance);
- arg.work_amount = static_cast<size_t>(C2 / blk_size); // work amount for vector part
- arg.rt_shape_size = static_cast<size_t>(C2 % blk_size); // for tails
+ arg.mean = (&mean);
+ arg.variance = (&variance);
+ arg.work_amount = (C2 / blk_size); // work amount for vector part
+ arg.rt_shape_size = (C2 % blk_size); // for tails
arg.oc_off = sizeof(float) * c;
arg.post_op_data = post_ops_data_;
(*mvn_kernel)(&arg);
@@ -2442,9 +2442,9 @@ void MVN::MVNJitExecutor::mvn_pln(const uint8_t* src_data,
auto arg = jit_mvn_call_args();
arg.src = src_data + cc * src_data_size;
arg.dst = dst_data + cc * dst_data_size;
- arg.mean = static_cast<float*>(&mean);
- arg.work_amount = static_cast<size_t>(C2 / blk_size);
- arg.rt_shape_size = static_cast<size_t>(C2 % blk_size); // for tails
+ arg.mean = (&mean);
+ arg.work_amount = (C2 / blk_size);
+ arg.rt_shape_size = (C2 % blk_size); // for tails
arg.oc_off = sizeof(float) * c;
arg.post_op_data = post_ops_data_;
(*mvn_kernel)(&arg);
@@ -2455,17 +2455,17 @@ void MVN::MVNJitExecutor::mvn_pln(const uint8_t* src_data,
parallel_for2d(N, C, [&](size_t b, size_t c) {
size_t cb = b * C3;
size_t cc = cb + c * C2;
- float C2inv = 1.f / static_cast<float>(C2);
+ float C2inv = 1.F / static_cast<float>(C2);
// mean for this channel
- float mean = 0.f;
+ float mean = 0.F;
// the same arg for three kernels
auto arg = jit_mvn_call_args();
arg.src = src_data + cc * src_data_size;
arg.dst = dst_data + cc * dst_data_size;
- arg.sum = static_cast<float*>(&mean);
- arg.work_amount = static_cast<size_t>(C2 / blk_size);
- arg.rt_shape_size = static_cast<size_t>(C2 % blk_size);
+ arg.sum = (&mean);
+ arg.work_amount = (C2 / blk_size);
+ arg.rt_shape_size = (C2 % blk_size);
arg.oc_off = static_cast<size_t>(c * sizeof(float));
arg.post_op_data = post_ops_data_;
(*mvn_mean_kernel)(&arg);
@@ -2474,22 +2474,22 @@ void MVN::MVNJitExecutor::mvn_pln(const uint8_t* src_data,
if (mvnAttrs.normalizeVariance_) {
// variance for this channel
- float variance = 0.f;
- arg.mean = static_cast<float*>(&mean);
- arg.variance = static_cast<float*>(&variance);
+ float variance = 0.F;
+ arg.mean = (&mean);
+ arg.variance = (&variance);
(*mvn_variance_kernel)(&arg);
if (mvnAttrs.epsMode_ == INSIDE_SQRT) {
- variance = 1.f / sqrtf(variance * C2inv + mvnAttrs.epsValue_);
+ variance = 1.F / sqrtf(variance * C2inv + mvnAttrs.epsValue_);
} else if (mvnAttrs.epsMode_ == OUTSIDE_SQRT) {
- variance = 1.f / (sqrtf(variance * C2inv) + mvnAttrs.epsValue_);
+ variance = 1.F / (sqrtf(variance * C2inv) + mvnAttrs.epsValue_);
}
// mvn for this channel
(*mvn_kernel)(&arg);
} else {
// mvn for this channel
- arg.mean = static_cast<float*>(&mean);
+ arg.mean = (&mean);
(*mvn_kernel)(&arg);
}
});
@@ -2513,13 +2513,13 @@ void MVN::MVNRefExecutor::mvn_ref(const uint8_t* src_data, uint8_t* dst_data, co
size_t cb = b * C3;
if (mvnAttrs.execAcrossChannels_) {
// Parallel sum for each channel for mean
- float C3inv = 1.f / static_cast<float>(C3);
- float mean_temp = 0.0f;
+ float C3inv = 1.F / static_cast<float>(C3);
+ float mean_temp = 0.0F;
mean_temp = parallel_sum(C, mean_temp, [&](size_t c) -> float {
- float mean_internal = 0.0f;
+ float mean_internal = 0.0F;
size_t cc = cb + c * C2;
- for (size_t sp = 0lu; sp < C2; sp++) {
+ for (size_t sp = 0LU; sp < C2; sp++) {
mean_internal += src_data_ptr[cc + sp];
}
return mean_internal;
@@ -2529,68 +2529,68 @@ void MVN::MVNRefExecutor::mvn_ref(const uint8_t* src_data, uint8_t* dst_data, co
if (mvnAttrs.normalizeVariance_) {
// parallel sum for each channel for variance
- float variance_temp = 0.0f;
+ float variance_temp = 0.0F;
variance_temp = parallel_sum(C, variance_temp, [&](size_t c) -> float {
- float variance_internal = 0.0f;
+ float variance_internal = 0.0F;
size_t cc = cb + c * C2;
- for (size_t sp = 0lu; sp < C2; sp++) {
+ for (size_t sp = 0LU; sp < C2; sp++) {
variance_internal += (src_data_ptr[cc + sp] - mean) * (src_data_ptr[cc + sp] - mean);
}
return variance_internal;
});
- float variance = 1.f;
+ float variance = 1.F;
if (mvnAttrs.epsMode_ == INSIDE_SQRT) {
- variance = 1.f / sqrtf(variance_temp * C3inv + mvnAttrs.epsValue_);
+ variance = 1.F / sqrtf(variance_temp * C3inv + mvnAttrs.epsValue_);
} else if (mvnAttrs.epsMode_ == OUTSIDE_SQRT) {
- variance = 1.f / (sqrtf(variance_temp * C3inv) + mvnAttrs.epsValue_);
+ variance = 1.F / (sqrtf(variance_temp * C3inv) + mvnAttrs.epsValue_);
}
parallel_for(C, [&](int c) {
size_t cc = cb + c * C2;
- for (size_t sp = 0lu; sp < C2; sp++) {
+ for (size_t sp = 0LU; sp < C2; sp++) {
dst_data_ptr[cc + sp] = (src_data_ptr[cc + sp] - mean) * variance;
}
});
} else {
parallel_for(C, [&](int c) {
size_t cc = cb + c * C2;
- for (size_t sp = 0lu; sp < C2; sp++) {
+ for (size_t sp = 0LU; sp < C2; sp++) {
dst_data_ptr[cc + sp] = src_data_ptr[cc + sp] - mean;
}
});
}
} else { // per channel
- float C2inv = 1.f / static_cast<float>(C2);
+ float C2inv = 1.F / static_cast<float>(C2);
parallel_for(C, [&](size_t c) {
// mean for this channel
- float mean = 0.f;
+ float mean = 0.F;
size_t cc = cb + c * C2;
- for (size_t sp = 0lu; sp < C2; sp++) {
+ for (size_t sp = 0LU; sp < C2; sp++) {
mean += src_data_ptr[cc + sp];
}
mean *= C2inv;
if (mvnAttrs.normalizeVariance_) {
// variance for this channel
- float variance = 0.f;
- for (size_t sp = 0lu; sp < C2; sp++) {
+ float variance = 0.F;
+ for (size_t sp = 0LU; sp < C2; sp++) {
variance += (src_data_ptr[cc + sp] - mean) * (src_data_ptr[cc + sp] - mean);
}
if (mvnAttrs.epsMode_ == INSIDE_SQRT) {
- variance = 1.f / sqrtf(variance * C2inv + mvnAttrs.epsValue_);
+ variance = 1.F / sqrtf(variance * C2inv + mvnAttrs.epsValue_);
} else if (mvnAttrs.epsMode_ == OUTSIDE_SQRT) {
- variance = 1.f / (sqrtf(variance * C2inv) + mvnAttrs.epsValue_);
+ variance = 1.F / (sqrtf(variance * C2inv) + mvnAttrs.epsValue_);
}
// mvn for this channel
- for (size_t sp = 0lu; sp < C2; sp++) {
+ for (size_t sp = 0LU; sp < C2; sp++) {
dst_data_ptr[cc + sp] = (src_data_ptr[cc + sp] - mean) * variance;
}
} else {
// mvn for this channel
- for (size_t sp = 0lu; sp < C2; sp++) {
+ for (size_t sp = 0LU; sp < C2; sp++) {
dst_data_ptr[cc + sp] = src_data_ptr[cc + sp] - mean;
}
}
@@ -2621,17 +2621,18 @@ void MVN::MVNJitExecutor::mvn_nspc(const uint8_t* src_data,
const size_t threads_num = parallel_get_max_threads();
size_t aux_buffer_size = mvnAttrs.execAcrossChannels_ ? 1 : rnd_up(C, blk_size) + blk_size;
auto b_loop = [&](size_t b) {
- std::vector<float> mean_buffer(aux_buffer_size * threads_num, 0.f);
+ std::vector<float> mean_buffer(aux_buffer_size * threads_num, 0.F);
std::vector<float> variance_buffer;
if (mvnAttrs.normalizeVariance_) {
- variance_buffer.resize(aux_buffer_size * threads_num, 0.f);
+ variance_buffer.resize(aux_buffer_size * threads_num, 0.F);
}
size_t b_offset = b * C * D * H * W;
// kernel_type: 0 for mean, 1 for variance, 2 for normalization
auto worker = [&](const bool across_channel, const int kernel_type) {
parallel_nt(threads_num, [&](const int ithr, const int nthr) {
- size_t start = 0, end = 0;
+ size_t start = 0;
+ size_t end = 0;
splitter(D * H * W, nthr, ithr, start, end);
auto arg = jit_mvn_call_args();
@@ -2639,13 +2640,13 @@ void MVN::MVNJitExecutor::mvn_nspc(const uint8_t* src_data,
if (0 == kernel_type) {
arg.sum = &mean_buffer[aux_buffer_size * ithr];
} else if (1 == kernel_type) {
- arg.mean = &mean_buffer[0];
+ arg.mean = mean_buffer.data();
arg.variance = &variance_buffer[aux_buffer_size * ithr];
} else if (2 == kernel_type) {
arg.dst = dst_data + (b_offset + (start * C)) * dst_data_size;
- arg.mean = &mean_buffer[0];
+ arg.mean = mean_buffer.data();
if (mvnAttrs.normalizeVariance_) {
- arg.variance = &variance_buffer[0];
+ arg.variance = variance_buffer.data();
}
arg.oc_off = 0;
arg.post_op_data = post_ops_data_;
@@ -2673,7 +2674,7 @@ void MVN::MVNJitExecutor::mvn_nspc(const uint8_t* src_data,
};
if (mvnAttrs.execAcrossChannels_) {
- float size_inv = 1.f / static_cast<float>(C * D * H * W);
+ float size_inv = 1.F / static_cast<float>(C * D * H * W);
worker(true, 0);
for (size_t i = 1; i < threads_num; i++) {
mean_buffer[0] += mean_buffer[i];
@@ -2685,14 +2686,14 @@ void MVN::MVNJitExecutor::mvn_nspc(const uint8_t* src_data,
variance_buffer[0] += variance_buffer[i];
}
if (mvnAttrs.epsMode_ == INSIDE_SQRT) {
- variance_buffer[0] = 1.f / sqrtf(variance_buffer[0] * size_inv + mvnAttrs.epsValue_);
+ variance_buffer[0] = 1.F / sqrtf(variance_buffer[0] * size_inv + mvnAttrs.epsValue_);
} else if (mvnAttrs.epsMode_ == OUTSIDE_SQRT) {
- variance_buffer[0] = 1.f / (sqrtf(variance_buffer[0] * size_inv) + mvnAttrs.epsValue_);
+ variance_buffer[0] = 1.F / (sqrtf(variance_buffer[0] * size_inv) + mvnAttrs.epsValue_);
}
}
worker(true, 2);
} else { // for per_channel
- float size_inv = 1.f / static_cast<float>(D * H * W);
+ float size_inv = 1.F / static_cast<float>(D * H * W);
worker(false, 0);
for (size_t i = 1; i < threads_num; i++) {
for (size_t c = 0; c < C; c++) {
@@ -2711,9 +2712,9 @@ void MVN::MVNJitExecutor::mvn_nspc(const uint8_t* src_data,
}
for (size_t c = 0; c < C; c++) {
if (mvnAttrs.epsMode_ == INSIDE_SQRT) {
- variance_buffer[c] = 1.f / sqrtf(variance_buffer[c] * size_inv + mvnAttrs.epsValue_);
+ variance_buffer[c] = 1.F / sqrtf(variance_buffer[c] * size_inv + mvnAttrs.epsValue_);
} else if (mvnAttrs.epsMode_ == OUTSIDE_SQRT) {
- variance_buffer[c] = 1.f / (sqrtf(variance_buffer[c] * size_inv) + mvnAttrs.epsValue_);
+ variance_buffer[c] = 1.F / (sqrtf(variance_buffer[c] * size_inv) + mvnAttrs.epsValue_);
}
}
}
@@ -2757,16 +2758,16 @@ void MVN::MVNJitExecutor::mvn_blk(const uint8_t* src_data,
std::vector<float> mean_buffer(aux_buffer_size * threads_num);
std::vector<float> variance_buffer(aux_buffer_size * threads_num);
- for (size_t b = 0lu; b < N; b++) {
+ for (size_t b = 0LU; b < N; b++) {
size_t b_offset = b * C3;
if (mvnAttrs.execAcrossChannels_) {
// mean for this instance in batch
- float C5inv = 1.f / static_cast<float>(C5);
- float mean_temp = 0.0f;
+ float C5inv = 1.F / static_cast<float>(C5);
+ float mean_temp = 0.0F;
mean_temp = parallel_sum3d(CB, D, H, mean_temp, [&](size_t cb, size_t d, size_t h) -> float {
size_t src_offset = b_offset + cb * C2 + d * C1 + h * C0;
- float mean_internal = 0.0f;
+ float mean_internal = 0.0F;
/////////////////////////////////
// W // |
// // |
@@ -2782,7 +2783,7 @@ void MVN::MVNJitExecutor::mvn_blk(const uint8_t* src_data,
}
auto* mean_buffer_ptr = &mean_buffer[aux_buffer_size * thread_idx];
for (size_t i = 0; i < blk_size; i++) {
- mean_buffer_ptr[i] = 0.f;
+ mean_buffer_ptr[i] = 0.F;
}
auto arg = jit_mvn_call_args();
@@ -2804,20 +2805,20 @@ void MVN::MVNJitExecutor::mvn_blk(const uint8_t* src_data,
if (mvnAttrs.normalizeVariance_) {
// variance: sum((x-mean)*(x-mean)) for one instance in batch
- float variance_temp = 0.0f;
+ float variance_temp = 0.0F;
variance_temp = parallel_sum3d(CB, D, H, variance_temp, [&](size_t cb, size_t d, size_t h) -> float {
size_t src_offset = b_offset + cb * C2 + d * C1 + h * C0;
- float variance_internal = 0.0f;
+ float variance_internal = 0.0F;
auto* variance_buffer_ptr =
&variance_buffer[aux_buffer_size * static_cast<size_t>(parallel_get_thread_num())];
for (size_t i = 0; i < blk_size; i++) {
- variance_buffer_ptr[i] = 0.f;
+ variance_buffer_ptr[i] = 0.F;
}
auto arg = jit_mvn_call_args();
arg.src = src_data + src_offset * src_data_size;
- arg.mean = static_cast<float*>(&mean);
+ arg.mean = (&mean);
arg.variance = variance_buffer_ptr;
arg.work_amount = static_cast<size_t>(W);
arg.rt_shape_size = (C - cb * blk_size) < blk_size ? static_cast<size_t>(C % blk_size) : 0;
@@ -2832,7 +2833,7 @@ void MVN::MVNJitExecutor::mvn_blk(const uint8_t* src_data,
return variance_internal;
});
- float variance = 1.f;
+ float variance = 1.F;
if (mvnAttrs.epsMode_ == INSIDE_SQRT) {
variance /= sqrtf(variance_temp * C5inv + mvnAttrs.epsValue_);
} else if (mvnAttrs.epsMode_ == OUTSIDE_SQRT) {
@@ -2845,8 +2846,8 @@ void MVN::MVNJitExecutor::mvn_blk(const uint8_t* src_data,
auto arg = jit_mvn_call_args();
arg.src = src_data + src_offset * src_data_size;
arg.dst = dst_data + src_offset * dst_data_size;
- arg.mean = static_cast<float*>(&mean);
- arg.variance = static_cast<float*>(&variance);
+ arg.mean = (&mean);
+ arg.variance = (&variance);
arg.work_amount = static_cast<size_t>(W);
arg.rt_shape_size = (C - cb * blk_size) < blk_size ? static_cast<size_t>(C % blk_size) : 0;
arg.oc_off = cb * blk_size * sizeof(float);
@@ -2860,7 +2861,7 @@ void MVN::MVNJitExecutor::mvn_blk(const uint8_t* src_data,
auto arg = jit_mvn_call_args();
arg.src = src_data + src_offset * src_data_size;
arg.dst = dst_data + src_offset * dst_data_size;
- arg.mean = static_cast<float*>(&mean);
+ arg.mean = (&mean);
arg.work_amount = static_cast<size_t>(W);
arg.rt_shape_size = (C - cb * blk_size) < blk_size ? static_cast<size_t>(C % blk_size) : 0;
arg.oc_off = cb * blk_size * sizeof(float);
@@ -2869,9 +2870,9 @@ void MVN::MVNJitExecutor::mvn_blk(const uint8_t* src_data,
});
}
} else { // for per_channel
- float size_inv = 1.f / static_cast<float>(D * H * W);
+ float size_inv = 1.F / static_cast<float>(D * H * W);
for (float& i : mean_buffer) {
- i = 0.f;
+ i = 0.F;
}
// one thread for one C*W size(the same H) to get C size result for the same H, added to last group result
@@ -2907,7 +2908,7 @@ void MVN::MVNJitExecutor::mvn_blk(const uint8_t* src_data,
if (mvnAttrs.normalizeVariance_) {
for (float& i : variance_buffer) {
- i = 0.f;
+ i = 0.F;
}
auto dh_loop = [&](size_t thr_idx, size_t d, size_t h) {
@@ -2939,9 +2940,9 @@ void MVN::MVNJitExecutor::mvn_blk(const uint8_t* src_data,
}
for (size_t c = 0; c < C; c++) {
if (mvnAttrs.epsMode_ == INSIDE_SQRT) {
- variance_buffer[c] = 1.f / sqrtf(variance_buffer[c] * size_inv + mvnAttrs.epsValue_);
+ variance_buffer[c] = 1.F / sqrtf(variance_buffer[c] * size_inv + mvnAttrs.epsValue_);
} else if (mvnAttrs.epsMode_ == OUTSIDE_SQRT) {
- variance_buffer[c] = 1.f / (sqrtf(variance_buffer[c] * size_inv) + mvnAttrs.epsValue_);
+ variance_buffer[c] = 1.F / (sqrtf(variance_buffer[c] * size_inv) + mvnAttrs.epsValue_);
}
}
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 86deb1bff59..693f7613c51 100644
--- a/src/plugins/intel_cpu/src/nodes/non_max_suppression.cpp
+++ b/src/plugins/intel_cpu/src/nodes/non_max_suppression.cpp
@@ -91,16 +91,16 @@ NonMaxSuppression::NonMaxSuppression(const std::shared_ptr<ov::Node>& op, const
if (const auto* nms9 = as_type<const op::v9::NonMaxSuppression>(op.get())) {
boxEncodingType = static_cast<NMSBoxEncodeType>(nms9->get_box_encoding());
m_sort_result_descending = nms9->get_sort_result_descending();
- m_coord_num = 4lu;
+ m_coord_num = 4LU;
} else if (const auto* nmsIe = as_type<const op::internal::NonMaxSuppressionIEInternal>(op.get())) {
boxEncodingType = nmsIe->m_center_point_box ? NMSBoxEncodeType::CENTER : NMSBoxEncodeType::CORNER;
m_sort_result_descending = nmsIe->m_sort_result_descending;
- m_coord_num = 4lu;
+ m_coord_num = 4LU;
} else if (const auto* nms = as_type<const op::v13::NMSRotated>(op.get())) {
m_sort_result_descending = nms->get_sort_result_descending();
m_clockwise = nms->get_clockwise();
m_rotated_boxes = true;
- m_coord_num = 5lu;
+ m_coord_num = 5LU;
} else {
const auto& typeInfo = op->get_type_info();
THROW_CPU_NODE_ERR("doesn't support NMS: ", typeInfo.name, " v", typeInfo.version_id);
@@ -128,7 +128,7 @@ NonMaxSuppression::NonMaxSuppression(const std::shared_ptr<ov::Node>& op, const
valid_outputs_shape.getDims()[1]);
}
- for (size_t i = 0lu; i < op->get_output_size(); i++) {
+ for (size_t i = 0LU; i < op->get_output_size(); i++) {
m_defined_outputs[i] = !op->get_output_target_inputs(i).empty();
}
}
@@ -258,12 +258,12 @@ void NonMaxSuppression::execute([[maybe_unused]] const dnnl::stream& strm) {
size_t max_number_of_boxes = m_output_boxes_per_class * m_batches_num * m_classes_num;
if (inputs_num > NMS_MAX_OUTPUT_BOXES_PER_CLASS) {
auto val = getSrcDataAtPortAs<int32_t>(NMS_MAX_OUTPUT_BOXES_PER_CLASS)[0];
- m_max_output_boxes_per_class = val <= 0l ? 0lu : static_cast<size_t>(val);
+ m_max_output_boxes_per_class = val <= 0L ? 0LU : static_cast<size_t>(val);
m_output_boxes_per_class = std::min(m_max_output_boxes_per_class, m_boxes_num);
max_number_of_boxes = m_output_boxes_per_class * m_batches_num * m_classes_num;
m_filtered_boxes.resize(max_number_of_boxes);
}
- if (m_max_output_boxes_per_class == 0lu) {
+ if (m_max_output_boxes_per_class == 0LU) {
return;
}
@@ -275,7 +275,7 @@ void NonMaxSuppression::execute([[maybe_unused]] const dnnl::stream& strm) {
}
if (inputs_num > NMS_SOFT_NMS_SIGMA) {
m_soft_nms_sigma = getSrcDataAtPortAs<float>(NMS_SOFT_NMS_SIGMA)[0];
- m_scale = (m_soft_nms_sigma > 0.f) ? (-0.5f / m_soft_nms_sigma) : 0.f;
+ m_scale = (m_soft_nms_sigma > 0.F) ? (-0.5F / m_soft_nms_sigma) : 0.F;
}
auto boxes_memory = getSrcMemoryAtPort(NMS_BOXES);
@@ -289,18 +289,18 @@ void NonMaxSuppression::execute([[maybe_unused]] const dnnl::stream& strm) {
if (m_rotated_boxes) {
nmsRotated(boxes, scores, boxes_strides, scores_strides, m_filtered_boxes);
- } else if (m_soft_nms_sigma == 0.f) {
+ } else if (m_soft_nms_sigma == 0.F) {
nmsWithoutSoftSigma(boxes, scores, boxes_strides, scores_strides, m_filtered_boxes);
} else {
nmsWithSoftSigma(boxes, scores, boxes_strides, scores_strides, m_filtered_boxes);
}
size_t start_offset = m_num_filtered_boxes[0][0];
- for (size_t b = 0lu; b < m_num_filtered_boxes.size(); b++) {
+ for (size_t b = 0LU; b < m_num_filtered_boxes.size(); b++) {
size_t batchOffset = b * m_classes_num * m_output_boxes_per_class;
- for (size_t c = (b == 0lu ? 1lu : 0lu); c < m_num_filtered_boxes[b].size(); c++) {
+ for (size_t c = (b == 0LU ? 1LU : 0LU); c < m_num_filtered_boxes[b].size(); c++) {
size_t offset = batchOffset + c * m_output_boxes_per_class;
- for (size_t i = 0lu; i < m_num_filtered_boxes[b][c]; i++) {
+ for (size_t i = 0LU; i < m_num_filtered_boxes[b][c]; i++) {
m_filtered_boxes[start_offset + i] = m_filtered_boxes[offset + i];
}
start_offset += m_num_filtered_boxes[b][c];
@@ -321,7 +321,7 @@ void NonMaxSuppression::execute([[maybe_unused]] const dnnl::stream& strm) {
const size_t valid_outputs = std::min(start_offset, max_number_of_boxes);
- const size_t stride = 3lu;
+ const size_t stride = 3LU;
if (!m_out_static_shape) {
VectorDims new_dims{valid_outputs, stride};
redefineOutputMemory({new_dims, new_dims, {1}});
@@ -331,7 +331,7 @@ void NonMaxSuppression::execute([[maybe_unused]] const dnnl::stream& strm) {
auto* out_ptr = getDstDataAtPortAs<int32_t>(NMS_SELECTED_INDICES);
int32_t* boxes_ptr = &(m_filtered_boxes[0].batch_index);
- size_t idx = 0lu;
+ size_t idx = 0LU;
for (; idx < valid_outputs; idx++) {
memcpy(out_ptr, boxes_ptr, 12);
out_ptr += stride;
@@ -346,7 +346,7 @@ void NonMaxSuppression::execute([[maybe_unused]] const dnnl::stream& strm) {
if (m_defined_outputs[NMS_SELECTED_SCORES]) {
auto* out_ptr = getDstDataAtPortAs<float>(NMS_SELECTED_SCORES);
- size_t idx = 0lu;
+ size_t idx = 0LU;
for (; idx < valid_outputs; idx++) {
out_ptr[0] = static_cast<float>(m_filtered_boxes[idx].batch_index);
out_ptr[1] = static_cast<float>(m_filtered_boxes[idx].class_index);
@@ -355,7 +355,7 @@ void NonMaxSuppression::execute([[maybe_unused]] const dnnl::stream& strm) {
}
if (m_out_static_shape) {
- std::fill(out_ptr, out_ptr + (max_number_of_boxes - idx) * stride, -1.f);
+ std::fill(out_ptr, out_ptr + (max_number_of_boxes - idx) * stride, -1.F);
}
}
@@ -379,7 +379,7 @@ void NonMaxSuppression::nmsWithSoftSigma(const float* boxes,
// < score_threshold if is_soft_suppressed_by_iou is true, hard suppressed by iou_threshold, then soft suppress
auto coeff = [&](float iou) {
if (m_is_soft_suppressed_by_iou && iou > m_iou_threshold) {
- return 0.0f;
+ return 0.0F;
}
return std::exp(m_scale * iou * iou);
};
@@ -407,10 +407,10 @@ void NonMaxSuppression::nmsWithSoftSigma(const float* boxes,
if (maxSeletedBoxNum > 1) {
if (m_jit_kernel) {
#if defined(OPENVINO_ARCH_X86_64)
- std::vector<float> boxCoord0(maxSeletedBoxNum, 0.0f);
- std::vector<float> boxCoord1(maxSeletedBoxNum, 0.0f);
- std::vector<float> boxCoord2(maxSeletedBoxNum, 0.0f);
- std::vector<float> boxCoord3(maxSeletedBoxNum, 0.0f);
+ std::vector<float> boxCoord0(maxSeletedBoxNum, 0.0F);
+ std::vector<float> boxCoord1(maxSeletedBoxNum, 0.0F);
+ std::vector<float> boxCoord2(maxSeletedBoxNum, 0.0F);
+ std::vector<float> boxCoord3(maxSeletedBoxNum, 0.0F);
boxCoord0[0] = boxesPtr[candidateBox.idx * m_coord_num];
boxCoord1[0] = boxesPtr[candidateBox.idx * m_coord_num + 1];
@@ -418,9 +418,9 @@ void NonMaxSuppression::nmsWithSoftSigma(const float* boxes,
boxCoord3[0] = boxesPtr[candidateBox.idx * m_coord_num + 3];
auto arg = kernel::NmsCallArgs();
- arg.iou_threshold = static_cast<float*>(&m_iou_threshold);
- arg.score_threshold = static_cast<float*>(&m_score_threshold);
- arg.scale = static_cast<float*>(&m_scale);
+ arg.iou_threshold = (&m_iou_threshold);
+ arg.score_threshold = (&m_score_threshold);
+ arg.scale = (&m_scale);
while (selectedBoxes.size() < m_output_boxes_per_class && !sorted_boxes.empty()) {
boxInfo candidateBox = sorted_boxes.top();
float origScore = candidateBox.score;
@@ -428,7 +428,7 @@ void NonMaxSuppression::nmsWithSoftSigma(const float* boxes,
int candidateStatus =
NMSCandidateStatus::SELECTED; // 0 for suppressed, 1 for selected, 2 for updated
- arg.score = static_cast<float*>(&candidateBox.score);
+ arg.score = (&candidateBox.score);
arg.selected_boxes_num = selectedBoxes.size() - candidateBox.suppress_begin_index;
arg.selected_boxes_coord[0] =
static_cast<float*>(&boxCoord0[candidateBox.suppress_begin_index]);
@@ -438,8 +438,8 @@ void NonMaxSuppression::nmsWithSoftSigma(const float* boxes,
static_cast<float*>(&boxCoord2[candidateBox.suppress_begin_index]);
arg.selected_boxes_coord[3] =
static_cast<float*>(&boxCoord3[candidateBox.suppress_begin_index]);
- arg.candidate_box = static_cast<const float*>(&boxesPtr[candidateBox.idx * m_coord_num]);
- arg.candidate_status = static_cast<int*>(&candidateStatus);
+ arg.candidate_box = (&boxesPtr[candidateBox.idx * m_coord_num]);
+ arg.candidate_status = (&candidateStatus);
(*m_jit_kernel)(&arg);
if (candidateStatus == NMSCandidateStatus::SUPPRESSED) {
@@ -537,7 +537,7 @@ void NonMaxSuppression::nmsWithoutSoftSigma(const float* boxes,
int io_selection_size = 0;
const size_t sortedBoxSize = sorted_boxes.size();
- if (sortedBoxSize > 0lu) {
+ if (sortedBoxSize > 0LU) {
parallel_sort(sorted_boxes.begin(),
sorted_boxes.end(),
[](const std::pair<float, int>& l, const std::pair<float, int>& r) {
@@ -546,13 +546,13 @@ void NonMaxSuppression::nmsWithoutSoftSigma(const float* boxes,
int offset = batch_idx * m_classes_num * m_output_boxes_per_class + class_idx * m_output_boxes_per_class;
filtBoxes[offset + 0] = FilteredBox(sorted_boxes[0].first, batch_idx, class_idx, sorted_boxes[0].second);
io_selection_size++;
- if (sortedBoxSize > 1lu) {
+ if (sortedBoxSize > 1LU) {
if (m_jit_kernel) {
#if defined(OPENVINO_ARCH_X86_64)
- std::vector<float> boxCoord0(sortedBoxSize, 0.0f);
- std::vector<float> boxCoord1(sortedBoxSize, 0.0f);
- std::vector<float> boxCoord2(sortedBoxSize, 0.0f);
- std::vector<float> boxCoord3(sortedBoxSize, 0.0f);
+ std::vector<float> boxCoord0(sortedBoxSize, 0.0F);
+ std::vector<float> boxCoord1(sortedBoxSize, 0.0F);
+ std::vector<float> boxCoord2(sortedBoxSize, 0.0F);
+ std::vector<float> boxCoord3(sortedBoxSize, 0.0F);
boxCoord0[0] = boxesPtr[sorted_boxes[0].second * m_coord_num];
boxCoord1[0] = boxesPtr[sorted_boxes[0].second * m_coord_num + 1];
@@ -560,22 +560,21 @@ void NonMaxSuppression::nmsWithoutSoftSigma(const float* boxes,
boxCoord3[0] = boxesPtr[sorted_boxes[0].second * m_coord_num + 3];
auto arg = kernel::NmsCallArgs();
- arg.iou_threshold = static_cast<float*>(&m_iou_threshold);
- arg.score_threshold = static_cast<float*>(&m_score_threshold);
- arg.scale = static_cast<float*>(&m_scale);
+ arg.iou_threshold = (&m_iou_threshold);
+ arg.score_threshold = (&m_score_threshold);
+ arg.scale = (&m_scale);
// box start index do not change for hard supresion
- arg.selected_boxes_coord[0] = static_cast<float*>(&boxCoord0[0]);
- arg.selected_boxes_coord[1] = static_cast<float*>(&boxCoord1[0]);
- arg.selected_boxes_coord[2] = static_cast<float*>(&boxCoord2[0]);
- arg.selected_boxes_coord[3] = static_cast<float*>(&boxCoord3[0]);
+ arg.selected_boxes_coord[0] = static_cast<float*>(boxCoord0.data());
+ arg.selected_boxes_coord[1] = static_cast<float*>(boxCoord1.data());
+ arg.selected_boxes_coord[2] = static_cast<float*>(boxCoord2.data());
+ arg.selected_boxes_coord[3] = static_cast<float*>(boxCoord3.data());
for (size_t candidate_idx = 1; (candidate_idx < sortedBoxSize) && (io_selection_size < max_out_box);
candidate_idx++) {
int candidateStatus = NMSCandidateStatus::SELECTED; // 0 for suppressed, 1 for selected
arg.selected_boxes_num = io_selection_size;
- arg.candidate_box =
- static_cast<const float*>(&boxesPtr[sorted_boxes[candidate_idx].second * m_coord_num]);
- arg.candidate_status = static_cast<int*>(&candidateStatus);
+ arg.candidate_box = (&boxesPtr[sorted_boxes[candidate_idx].second * m_coord_num]);
+ arg.candidate_status = (&candidateStatus);
(*m_jit_kernel)(&arg);
if (candidateStatus == NMSCandidateStatus::SELECTED) {
boxCoord0[io_selection_size] = boxesPtr[sorted_boxes[candidate_idx].second * m_coord_num];
@@ -640,8 +639,8 @@ inline float cross_2d(const NonMaxSuppression::Point2D& A, const NonMaxSuppressi
inline void getRotatedVertices(const float* box, NonMaxSuppression::Point2D (&pts)[4], bool clockwise) {
auto theta = clockwise ? box[4] : -box[4];
- auto cos_theta = std::cos(theta) * 0.5f;
- auto sin_theta = std::sin(theta) * 0.5f;
+ auto cos_theta = std::cos(theta) * 0.5F;
+ auto sin_theta = std::sin(theta) * 0.5F;
// y: top --> down; x: left --> right
// Left-Down
@@ -659,30 +658,30 @@ inline void getRotatedVertices(const float* box, NonMaxSuppression::Point2D (&pt
}
inline float polygonArea(const NonMaxSuppression::Point2D (&q)[24], const int64_t& m) {
- if (m <= 2l) {
- return 0.f;
+ if (m <= 2L) {
+ return 0.F;
}
- float area = 0.f;
- auto mlu = static_cast<size_t>(m - 1l);
- for (size_t i = 1lu; i < mlu; i++) {
+ float area = 0.F;
+ auto mlu = static_cast<size_t>(m - 1L);
+ for (size_t i = 1LU; i < mlu; i++) {
area += std::abs(cross_2d(q[i] - q[0], q[i + 1] - q[0]));
}
- return area / 2.f;
+ return area / 2.F;
}
inline size_t convexHullGraham(const NonMaxSuppression::Point2D (&p)[24],
const size_t num_in,
NonMaxSuppression::Point2D (&q)[24]) {
- OPENVINO_ASSERT(num_in >= 2lu);
+ OPENVINO_ASSERT(num_in >= 2LU);
// Step 1:
// Find point with minimum y
// if more than 1 points have the same minimum y,
// pick the one with the minimum x.
- size_t t = 0lu;
- for (size_t i = 1lu; i < num_in; i++) {
+ size_t t = 0LU;
+ for (size_t i = 1LU; i < num_in; i++) {
if (p[i].y < p[t].y || (p[i].y == p[t].y && p[i].x < p[t].x)) {
t = i;
}
@@ -691,7 +690,7 @@ inline size_t convexHullGraham(const NonMaxSuppression::Point2D (&p)[24],
// Step 2:
// Subtract starting point from every points (for sorting in the next step)
- for (size_t i = 0lu; i < num_in; i++) {
+ for (size_t i = 0LU; i < num_in; i++) {
q[i] = p[i] - start;
}
@@ -703,38 +702,38 @@ inline size_t convexHullGraham(const NonMaxSuppression::Point2D (&p)[24],
// (essentially sorting according to angles)
// If the angles are the same, sort according to their distance to origin
float dist[24];
- for (size_t i = 0lu; i < num_in; i++) {
+ for (size_t i = 0LU; i < num_in; i++) {
dist[i] = dot_2d(q[i], q[i]);
}
std::sort(q + 1, q + num_in, [](const NonMaxSuppression::Point2D& A, const NonMaxSuppression::Point2D& B) -> bool {
float temp = cross_2d(A, B);
- if (std::abs(temp) < 1e-6f) {
+ if (std::abs(temp) < 1e-6F) {
return dot_2d(A, A) < dot_2d(B, B);
}
- return temp > 0.f;
+ return temp > 0.F;
});
// compute distance to origin after sort, since the points are now different.
- for (size_t i = 0lu; i < num_in; i++) {
+ for (size_t i = 0LU; i < num_in; i++) {
dist[i] = dot_2d(q[i], q[i]);
}
// Step 4:
// Make sure there are at least 2 points (that don't overlap with each other)
// in the stack
- size_t k = 1lu; // index of the non-overlapped second point
+ size_t k = 1LU; // index of the non-overlapped second point
for (; k < num_in; k++) {
- if (dist[k] > 1e-8f) {
+ if (dist[k] > 1e-8F) {
break;
}
}
if (k == num_in) {
// We reach the end, which means the convex hull is just one point
q[0] = p[t];
- return 1lu;
+ return 1LU;
}
q[1] = q[k];
- size_t m = 2lu; // 2 points in the stack
+ size_t m = 2LU; // 2 points in the stack
// Step 5:
// Finally we can start the scanning process.
// When a non-convex relationship between the 3 points is found
@@ -742,8 +741,8 @@ inline size_t convexHullGraham(const NonMaxSuppression::Point2D (&p)[24],
// we pop the previous point from the stack
// until the 3-point relationship is convex again, or
// until the stack only contains two points
- for (size_t i = k + 1lu; i < num_in; i++) {
- while (m > 1lu && cross_2d(q[i] - q[m - 2], q[m - 1] - q[m - 2]) >= 0) {
+ for (size_t i = k + 1LU; i < num_in; i++) {
+ while (m > 1LU && cross_2d(q[i] - q[m - 2], q[m - 1] - q[m - 2]) >= 0) {
m--;
}
q[m++] = q[i];
@@ -757,21 +756,22 @@ inline size_t getIntersectionPoints(const NonMaxSuppression::Point2D (&pts1)[4],
NonMaxSuppression::Point2D (&intersections)[24]) {
// Line vector
// A line from p1 to p2 is: p1 + (p2-p1)*t, t=[0,1]
- NonMaxSuppression::Point2D vec1[4], vec2[4];
- for (size_t i = 0lu; i < 4lu; i++) {
- vec1[i] = pts1[(i + 1lu) % 4lu] - pts1[i];
- vec2[i] = pts2[(i + 1lu) % 4lu] - pts2[i];
+ NonMaxSuppression::Point2D vec1[4];
+ NonMaxSuppression::Point2D vec2[4];
+ for (size_t i = 0LU; i < 4LU; i++) {
+ vec1[i] = pts1[(i + 1LU) % 4LU] - pts1[i];
+ vec2[i] = pts2[(i + 1LU) % 4LU] - pts2[i];
}
// Line test - test all line combos for intersection
- size_t num = 0lu; // number of intersections
- for (size_t i = 0lu; i < 4lu; i++) {
- for (size_t j = 0lu; j < 4lu; j++) {
+ size_t num = 0LU; // number of intersections
+ for (size_t i = 0LU; i < 4LU; i++) {
+ for (size_t j = 0LU; j < 4LU; j++) {
// Solve for 2x2 Ax=b
float det = cross_2d(vec2[j], vec1[i]);
// This takes care of parallel lines
- if (std::abs(det) <= 1e-14f) {
+ if (std::abs(det) <= 1e-14F) {
continue;
}
@@ -780,7 +780,7 @@ inline size_t getIntersectionPoints(const NonMaxSuppression::Point2D (&pts1)[4],
auto t1 = cross_2d(vec2[j], vec12) / det;
auto t2 = cross_2d(vec1[i], vec12) / det;
- if (t1 >= 0.f && t1 <= 1.f && t2 >= 0.f && t2 <= 1.f) {
+ if (t1 >= 0.F && t1 <= 1.F && t2 >= 0.F && t2 <= 1.F) {
intersections[num++] = pts1[i] + vec1[i] * t1;
}
}
@@ -833,15 +833,16 @@ inline float rotatedBoxesIntersection(const NonMaxSuppression::Point2D (&vertice
const float* box_1,
const bool clockwise) {
// There are up to 4 x 4 + 4 + 4 = 24 intersections (including duplicates) returned
- NonMaxSuppression::Point2D intersect_pts[24], ordered_pts[24];
+ NonMaxSuppression::Point2D intersect_pts[24];
+ NonMaxSuppression::Point2D ordered_pts[24];
NonMaxSuppression::Point2D vertices_1[4];
getRotatedVertices(box_1, vertices_1, clockwise);
auto num = getIntersectionPoints(vertices_0, vertices_1, intersect_pts);
- if (num <= 2lu) {
- return 0.f;
+ if (num <= 2LU) {
+ return 0.F;
}
auto num_convex = convexHullGraham(intersect_pts, num, ordered_pts);
@@ -850,10 +851,10 @@ inline float rotatedBoxesIntersection(const NonMaxSuppression::Point2D (&vertice
inline float NonMaxSuppression::rotatedIntersectionOverUnion(const NonMaxSuppression::Point2D (&vertices_0)[4],
const float area_0,
- const float* box_1) {
+ const float* box_1) const {
const auto area_1 = box_1[2] * box_1[3]; // W x H
- if (area_1 <= 0.f) {
- return 0.f;
+ if (area_1 <= 0.F) {
+ return 0.F;
}
const auto intersection = rotatedBoxesIntersection(vertices_0, box_1, m_clockwise);
@@ -875,16 +876,16 @@ void NonMaxSuppression::nmsRotated(const float* boxes,
std::vector<std::pair<float, size_t>> sorted_indices; // score, box_idx
sorted_indices.reserve(m_boxes_num);
- for (size_t box_idx = 0lu; box_idx < m_boxes_num; box_idx++, scores_ptr++) {
+ for (size_t box_idx = 0LU; box_idx < m_boxes_num; box_idx++, scores_ptr++) {
if (*scores_ptr > m_score_threshold) {
sorted_indices.emplace_back(*scores_ptr, box_idx);
}
}
- size_t io_selection_size = 0lu;
+ size_t io_selection_size = 0LU;
const size_t sorted_boxes_size = sorted_indices.size();
- if (sorted_boxes_size > 0lu) {
+ if (sorted_boxes_size > 0LU) {
parallel_sort(sorted_indices.begin(),
sorted_indices.end(),
[](const std::pair<float, size_t>& l, const std::pair<float, size_t>& r) {
@@ -897,22 +898,22 @@ void NonMaxSuppression::nmsRotated(const float* boxes,
*filtered_boxes_ptr =
FilteredBox(sorted_indices[0].first, batch_idx, class_idx, sorted_indices[0].second);
io_selection_size++;
- if (sorted_boxes_size > 1lu) {
+ if (sorted_boxes_size > 1LU) {
sorted_indices_ptr++;
NMSCandidateStatus candidate_status;
- for (size_t candidate_idx = 1lu;
+ for (size_t candidate_idx = 1LU;
(candidate_idx < sorted_boxes_size) && (io_selection_size < m_output_boxes_per_class);
candidate_idx++, sorted_indices_ptr++) {
candidate_status = NMSCandidateStatus::SELECTED;
const auto* box_0 = boxes_ptr + (*sorted_indices_ptr).second * m_coord_num;
const auto area_0 = box_0[2] * box_0[3]; // W x H
- if (area_0 > 0.f) {
+ if (area_0 > 0.F) {
NonMaxSuppression::Point2D vertices_0[4];
getRotatedVertices(box_0, vertices_0, m_clockwise);
auto* trg_boxes = reinterpret_cast<int32_t*>(&((*filtered_boxes_ptr).box_index));
- for (size_t selected_idx = 0lu; selected_idx < io_selection_size;
+ for (size_t selected_idx = 0LU; selected_idx < io_selection_size;
selected_idx++, trg_boxes -= 4) {
auto iou = rotatedIntersectionOverUnion(vertices_0,
area_0,
@@ -922,7 +923,7 @@ void NonMaxSuppression::nmsRotated(const float* boxes,
break;
}
}
- } else if (0.f > m_iou_threshold) {
+ } else if (0.F > m_iou_threshold) {
candidate_status = NMSCandidateStatus::SUPPRESSED;
}
@@ -945,17 +946,24 @@ void NonMaxSuppression::nmsRotated(const float* boxes,
/////////////// End of Rotated boxes ///////////////
float NonMaxSuppression::intersectionOverUnion(const float* boxesI, const float* boxesJ) {
- float yminI, xminI, ymaxI, xmaxI, yminJ, xminJ, ymaxJ, xmaxJ;
+ 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;
+ 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]);
@@ -970,12 +978,12 @@ float NonMaxSuppression::intersectionOverUnion(const float* boxesI, const float*
float areaI = (ymaxI - yminI) * (xmaxI - xminI);
float areaJ = (ymaxJ - yminJ) * (xmaxJ - xminJ);
- if (areaI <= 0.f || areaJ <= 0.f) {
- return 0.f;
+ if (areaI <= 0.F || areaJ <= 0.F) {
+ return 0.F;
}
- float intersection_area = (std::max)((std::min)(ymaxI, ymaxJ) - (std::max)(yminI, yminJ), 0.f) *
- (std::max)((std::min)(xmaxI, xmaxJ) - (std::max)(xminI, xminJ), 0.f);
+ float intersection_area = (std::max)((std::min)(ymaxI, ymaxJ) - (std::max)(yminI, yminJ), 0.F) *
+ (std::max)((std::min)(xmaxI, xmaxJ) - (std::max)(xminI, xminJ), 0.F);
return intersection_area / (areaI + areaJ - intersection_area);
}
diff --git a/src/plugins/intel_cpu/src/nodes/non_max_suppression.h b/src/plugins/intel_cpu/src/nodes/non_max_suppression.h
index dd0d1d0bcf7..d1bcd0636f1 100644
--- a/src/plugins/intel_cpu/src/nodes/non_max_suppression.h
+++ b/src/plugins/intel_cpu/src/nodes/non_max_suppression.h
@@ -103,7 +103,7 @@ private:
float intersectionOverUnion(const float* boxesI, const float* boxesJ);
- float rotatedIntersectionOverUnion(const Point2D (&vertices_0)[4], const float area_0, const float* box_1);
+ float rotatedIntersectionOverUnion(const Point2D (&vertices_0)[4], const float area_0, const float* box_1) const;
void nmsWithSoftSigma(const float* boxes,
const float* scores,
diff --git a/src/plugins/intel_cpu/src/nodes/normalize.cpp b/src/plugins/intel_cpu/src/nodes/normalize.cpp
index bc346541dd3..a9fb5ceee0a 100644
--- a/src/plugins/intel_cpu/src/nodes/normalize.cpp
+++ b/src/plugins/intel_cpu/src/nodes/normalize.cpp
@@ -207,7 +207,7 @@ private:
Xbyak::Xmm xmm_aux2 = Xbyak::Xmm(3);
Xbyak::Xmm xmm_aux3 = Xbyak::Xmm(4);
- inline void hsum_store(Xbyak::Xmm xmm_sqr_sum) {
+ void hsum_store(Xbyak::Xmm xmm_sqr_sum) {
uni_vmovshdup(xmm_aux3, xmm_sqr_sum); // sqrt_sum:1,2,3,4; aux3:2,2,4,4
uni_vaddps(xmm_sqr_sum, xmm_sqr_sum, xmm_aux3); // sqrt_sum:1+2,2+2,3+4,4+4
uni_vmovhlps(xmm_aux3, xmm_aux3, xmm_sqr_sum); // aux3:3+4,4+4,4,4
@@ -215,7 +215,7 @@ private:
uni_vmovss(ptr[reg_modulo], xmm_sqr_sum);
}
- inline void load_vector(Vmm vmm_src, const Xbyak::Address& op, memory::data_type src_dt) {
+ void load_vector(Vmm vmm_src, const Xbyak::Address& op, memory::data_type src_dt) {
switch (src_dt) {
case memory::data_type::f32:
case memory::data_type::s32:
@@ -354,7 +354,7 @@ private:
std::vector<std::shared_ptr<jit_uni_depthwise_injector_f32<isa>>> depthwise_injectors;
std::vector<std::shared_ptr<jit_uni_quantization_injector_f32<isa>>> quantization_injectors;
- inline void normalize_nchw() {
+ void normalize_nchw() {
if (jcp_.across_spatial) {
uni_vbroadcastss(vmm_fused_factor, ptr[reg_fused_factor]); // for channel_shared: false or true.
}
@@ -419,7 +419,7 @@ private:
L(tail_loop_end_label);
}
- inline void normalize_nhwc() {
+ void normalize_nhwc() {
uni_vbroadcastss(vmm_fused_factor, ptr[reg_fused_factor]);
Xbyak::Label main_loop_label;
@@ -475,7 +475,7 @@ private:
}
// tails with padding as a vector for normalize.
- inline void normalize_blk() {
+ void normalize_blk() {
size_t blk_size = 0;
size_t simd_w = 0;
if (isa == cpu::x64::avx512_core) {
@@ -566,7 +566,7 @@ private:
}
}
- inline void load_vector(Vmm vmm_src, const Xbyak::Address& op, memory::data_type src_dt) {
+ void load_vector(Vmm vmm_src, const Xbyak::Address& op, memory::data_type src_dt) {
switch (src_dt) {
case memory::data_type::f32:
case memory::data_type::s32:
@@ -590,7 +590,7 @@ private:
}
}
- inline void load_scalar(Xmm xmm_src, const Xbyak::Address& op, memory::data_type src_dt) {
+ void load_scalar(Xmm xmm_src, const Xbyak::Address& op, memory::data_type src_dt) {
switch (src_dt) {
case memory::data_type::f32:
case memory::data_type::s32:
@@ -617,7 +617,7 @@ private:
}
}
- inline void store_vector(const Xbyak::Address& op, Vmm vmm_dst, memory::data_type dst_dt) {
+ void store_vector(const Xbyak::Address& op, Vmm vmm_dst, memory::data_type dst_dt) {
auto ymm_dst = Ymm(vmm_dst.getIdx());
auto xmm_dst = Xmm(vmm_dst.getIdx());
@@ -663,7 +663,7 @@ private:
}
}
- inline void store_scalar(const Xbyak::Address& op, Xmm xmm_dst, memory::data_type dst_dt) {
+ void store_scalar(const Xbyak::Address& op, Xmm xmm_dst, memory::data_type dst_dt) {
if (!isFloatCompatible(dst_dt)) {
uni_vcvtps2dq(xmm_dst, xmm_dst);
}
@@ -1063,7 +1063,7 @@ private:
});
}
- size_t workAmount = 0lu;
+ size_t workAmount = 0LU;
};
// *=================* *======* *=================*
@@ -1095,8 +1095,8 @@ public:
size_t dims_size = dims.size();
jcp.n = dims[0];
jcp.c = dims[1];
- jcp.h = (dims_size > 2) ? dims[2] : 1lu;
- jcp.w = (dims_size > 3) ? dims[3] : 1lu;
+ jcp.h = (dims_size > 2) ? dims[2] : 1LU;
+ jcp.w = (dims_size > 3) ? dims[3] : 1LU;
if (mayiuse(cpu::x64::avx512_core)) {
blk_size = 16;
@@ -1144,22 +1144,22 @@ public:
private:
void normalize_nchw(const in_data_t* src_data, out_data_t* dst_data, const void** post_ops_data) {
const size_t spatial_dims = jcp.h * jcp.w;
- for (size_t b = 0lu; b < jcp.n; b++) {
+ for (size_t b = 0LU; b < jcp.n; b++) {
const in_data_t* src_data_b = src_data + b * jcp.c * spatial_dims;
out_data_t* dst_data_b = dst_data + b * jcp.c * spatial_dims;
if (attrs.across_spatial) {
// modulo
- float addition_identity = 0.0f;
- float modulo = 0.0f;
+ float addition_identity = 0.0F;
+ float modulo = 0.0F;
modulo = parallel_sum(jcp.c, addition_identity, [&](int ic) -> float {
const in_data_t* src_data_bc = src_data_b + ic * spatial_dims;
- float modulo_kernel = 0.0f;
- float modulo_tail = 0.0f;
+ float modulo_kernel = 0.0F;
+ float modulo_tail = 0.0F;
size_t tail_start = 0;
auto arg = jit_normalize_call_args();
arg.src = src_data_bc;
- arg.modulo = static_cast<float*>(&modulo_kernel);
+ arg.modulo = (&modulo_kernel);
arg.src_stride = blk_size * sizeof(in_data_t);
arg.work_amount = (spatial_dims) / blk_size;
(*normalize_modulo_kernel)(&arg);
@@ -1173,7 +1173,7 @@ private:
return modulo_kernel + modulo_tail;
});
- float modulo_inv = 1.0f / (std::sqrt(epsApply(modulo, attrs.epsMode, attrs.eps)));
+ float modulo_inv = 1.0F / (std::sqrt(epsApply(modulo, attrs.epsMode, attrs.eps)));
// normalize
parallel_for(jcp.c, [&](size_t ic) {
@@ -1182,7 +1182,7 @@ private:
auto arg = jit_normalize_call_args();
arg.src = src_data_bc;
arg.dst = dst_data_bc;
- arg.fused_factor = static_cast<float*>(&modulo_inv); // broadcast once
+ arg.fused_factor = (&modulo_inv); // broadcast once
arg.oc_off = ic * sizeof(float);
arg.work_amount = static_cast<size_t>(spatial_dims);
arg.post_op_data = post_ops_data;
@@ -1190,7 +1190,7 @@ private:
});
} else { // across_spatial: false
// moduloM
- std::vector<float> moduloM(spatial_dims, 0.f);
+ std::vector<float> moduloM(spatial_dims, 0.F);
size_t blocks_num = div_up(spatial_dims, blk_size);
parallel_for(blocks_num, [&](size_t ib) {
const in_data_t* src_data_b_ib = src_data_b + ib * blk_size;
@@ -1213,7 +1213,7 @@ private:
});
for (size_t m = 0; m < spatial_dims; m++) {
- moduloM[m] = 1.0f / (std::sqrt(epsApply(moduloM[m], attrs.epsMode, attrs.eps)));
+ moduloM[m] = 1.0F / (std::sqrt(epsApply(moduloM[m], attrs.epsMode, attrs.eps)));
}
// normalize
@@ -1223,7 +1223,7 @@ private:
auto arg = jit_normalize_call_args();
arg.src = src_data_bc;
arg.dst = dst_data_bc;
- arg.fused_factor = static_cast<float*>(&moduloM[0]); // ld dynamic
+ arg.fused_factor = static_cast<float*>(moduloM.data()); // ld dynamic
arg.oc_off = ic * sizeof(float);
arg.work_amount = static_cast<size_t>(spatial_dims);
arg.post_op_data = post_ops_data;
@@ -1236,22 +1236,22 @@ private:
void normalize_nhwc(const in_data_t* src_data, out_data_t* dst_data, const void** post_ops_data) {
const size_t spatial_dims = jcp.h * jcp.w;
const size_t c_w_dims = jcp.c * jcp.w;
- for (size_t b = 0lu; b < jcp.n; b++) {
+ for (size_t b = 0LU; b < jcp.n; b++) {
const in_data_t* src_data_b = src_data + b * jcp.c * spatial_dims;
out_data_t* dst_data_b = dst_data + b * jcp.c * spatial_dims;
if (attrs.across_spatial) {
// modulo
float addition_identity = 0;
- float modulo = 0.0f;
+ float modulo = 0.0F;
modulo = parallel_sum(jcp.h, addition_identity, [&](int ih) -> float {
size_t tail_start = 0;
const in_data_t* src_data_bh = src_data_b + ih * c_w_dims;
- float modulo_kernel = 0.f;
- float modulo_tail = 0.f;
+ float modulo_kernel = 0.F;
+ float modulo_tail = 0.F;
auto arg = jit_normalize_call_args();
arg.src = src_data_bh;
- arg.modulo = static_cast<float*>(&modulo_kernel);
+ arg.modulo = (&modulo_kernel);
arg.src_stride = blk_size * sizeof(in_data_t);
arg.work_amount = c_w_dims / blk_size;
(*normalize_modulo_kernel)(&arg);
@@ -1265,7 +1265,7 @@ private:
return modulo_kernel + modulo_tail;
});
- float modulo_inv = 1.0f / (std::sqrt(epsApply(modulo, attrs.epsMode, attrs.eps)));
+ float modulo_inv = 1.0F / (std::sqrt(epsApply(modulo, attrs.epsMode, attrs.eps)));
// normalize
parallel_for2d(jcp.h, jcp.w, [&](int ih, int iw) {
@@ -1274,21 +1274,21 @@ private:
auto arg = jit_normalize_call_args();
arg.src = src_data_bhw;
arg.dst = dst_data_bhw;
- arg.fused_factor = static_cast<float*>(&modulo_inv); // bc static
+ arg.fused_factor = (&modulo_inv); // bc static
arg.oc_off = 0;
- arg.work_amount = static_cast<size_t>(jcp.c);
+ arg.work_amount = jcp.c;
arg.post_op_data = post_ops_data;
(*normalize_kernel)(&arg);
});
} else { // for across_spatial=false
parallel_for2d(jcp.h, jcp.w, [&](int ih, int iw) {
// modulo
- float modulo = 0.f;
+ float modulo = 0.F;
const in_data_t* src_data_bhw = src_data_b + ih * c_w_dims + iw * jcp.c;
out_data_t* dst_data_bhw = dst_data_b + ih * c_w_dims + iw * jcp.c;
auto arg = jit_normalize_call_args();
arg.src = src_data_bhw;
- arg.modulo = static_cast<float*>(&modulo);
+ arg.modulo = (&modulo);
arg.src_stride = blk_size * sizeof(in_data_t);
arg.work_amount = jcp.c / blk_size;
(*normalize_modulo_kernel)(&arg);
@@ -1300,11 +1300,11 @@ private:
modulo += src_data_bhw[c] * src_data_bhw[c];
}
- float modulo_inv = 1.0f / (std::sqrt(epsApply(modulo, attrs.epsMode, attrs.eps)));
+ float modulo_inv = 1.0F / (std::sqrt(epsApply(modulo, attrs.epsMode, attrs.eps)));
// normalize
arg.dst = dst_data_bhw;
- arg.fused_factor = static_cast<float*>(&modulo_inv); // bc static
+ arg.fused_factor = (&modulo_inv); // bc static
arg.work_amount = jcp.c;
arg.oc_off = 0;
arg.post_op_data = post_ops_data;
@@ -1318,22 +1318,22 @@ private:
const size_t CB = div_up(jcp.c, blk_size);
const size_t spatial_dims = jcp.h * jcp.w;
const size_t w_blk_dims = jcp.w * blk_size;
- for (size_t b = 0lu; b < jcp.n; b++) {
+ for (size_t b = 0LU; b < jcp.n; b++) {
const in_data_t* src_data_b = src_data + b * CB * spatial_dims * blk_size;
out_data_t* dst_data_b = dst_data + b * CB * spatial_dims * blk_size;
if (attrs.across_spatial) {
// modulo
- float modulo = 0.0f;
- float addition_identity = 0.0f;
+ float modulo = 0.0F;
+ float addition_identity = 0.0F;
modulo = parallel_sum2d(CB, jcp.h, addition_identity, [&](size_t cb, size_t h) -> float {
// handle W * blk_size data
const in_data_t* src_data_b_cb_h = src_data_b + cb * spatial_dims * blk_size + h * w_blk_dims;
size_t min_cb = (std::min)(blk_size, jcp.c - cb * blk_size);
- float modulo_w_blk = 0.0f;
+ float modulo_w_blk = 0.0F;
if (min_cb == blk_size) {
auto arg = jit_normalize_call_args();
arg.src = src_data_b_cb_h;
- arg.modulo = static_cast<float*>(&modulo_w_blk);
+ arg.modulo = (&modulo_w_blk);
arg.src_stride = blk_size * sizeof(in_data_t);
arg.work_amount = jcp.w;
(*normalize_modulo_kernel)(&arg);
@@ -1348,7 +1348,7 @@ private:
return modulo_w_blk;
});
- float modulo_inv = 1.0f / (std::sqrt(epsApply(modulo, attrs.epsMode, attrs.eps)));
+ float modulo_inv = 1.0F / (std::sqrt(epsApply(modulo, attrs.epsMode, attrs.eps)));
// normalize
parallel_for2d(CB, jcp.h, [&](size_t cb, size_t h) {
@@ -1357,8 +1357,8 @@ private:
auto arg = jit_normalize_call_args();
arg.src = src_data_b_cb_h;
arg.dst = dst_data_b_cb_h;
- arg.fused_factor = static_cast<float*>(&modulo_inv); // broadcast once
- arg.work_amount = static_cast<size_t>(jcp.w);
+ arg.fused_factor = (&modulo_inv); // broadcast once
+ arg.work_amount = jcp.w;
arg.oc_off = cb * blk_size * sizeof(float);
arg.post_op_data = post_ops_data;
(*normalize_kernel)(&arg);
@@ -1366,12 +1366,12 @@ private:
} else { // across_spatial: false
parallel_for2d(jcp.h, jcp.w, [&](size_t ih, size_t iw) {
// modulo
- float modulo = 0.0f;
+ float modulo = 0.0F;
const in_data_t* src_data_bhw = src_data_b + ih * w_blk_dims + iw * blk_size;
out_data_t* dst_data_bhw = dst_data_b + ih * w_blk_dims + iw * blk_size;
auto arg = jit_normalize_call_args();
arg.src = src_data_bhw;
- arg.modulo = static_cast<float*>(&modulo);
+ arg.modulo = (&modulo);
arg.src_stride = blk_size * spatial_dims * sizeof(in_data_t);
arg.work_amount = jcp.c / blk_size; // CB or CB-1
(*normalize_modulo_kernel)(&arg);
@@ -1385,11 +1385,11 @@ private:
}
}
- float modulo_inv = 1.0f / (std::sqrt(epsApply(modulo, attrs.epsMode, attrs.eps)));
+ float modulo_inv = 1.0F / (std::sqrt(epsApply(modulo, attrs.epsMode, attrs.eps)));
// normalize
arg.dst = dst_data_bhw;
- arg.fused_factor = static_cast<float*>(&modulo_inv); // broadcast
+ arg.fused_factor = (&modulo_inv); // broadcast
arg.work_amount = CB;
arg.oc_off = 0;
arg.post_op_data = post_ops_data;
@@ -1399,7 +1399,7 @@ private:
}
}
- size_t blk_size = 1lu;
+ size_t blk_size = 1LU;
jit_normalize_config_params jcp = {};
NormalizeL2Attrs attrs;
@@ -1450,26 +1450,26 @@ private:
size_t dims_size = dims.size();
const size_t N = dims[0];
const size_t C = dims[1];
- const size_t H = (dims_size > 2) ? dims[2] : 1lu;
- const size_t W = (dims_size > 3) ? dims[3] : 1lu;
+ const size_t H = (dims_size > 2) ? dims[2] : 1LU;
+ const size_t W = (dims_size > 3) ? dims[3] : 1LU;
const size_t spatial_dims = H * W;
- for (size_t b = 0lu; b < N; b++) {
+ for (size_t b = 0LU; b < N; b++) {
const in_data_t* src_data_b = src_data + b * C * spatial_dims;
out_data_t* dst_data_b = dst_data + b * C * spatial_dims;
if (attrs.across_spatial) {
// modulo
- float addition_identity = 0.0f;
- float modulo = 0.0f;
+ float addition_identity = 0.0F;
+ float modulo = 0.0F;
modulo = parallel_sum(C, addition_identity, [&](int ic) -> float {
const in_data_t* src_data_bc = src_data_b + ic * spatial_dims;
- float modulo_c = 0.0f;
+ float modulo_c = 0.0F;
for (size_t m = 0; m < spatial_dims; m++) {
modulo_c += src_data_bc[m] * src_data_bc[m];
}
return modulo_c;
});
- float modulo_inv = 1.0f / (std::sqrt(epsApply(modulo, attrs.epsMode, attrs.eps)));
+ float modulo_inv = 1.0F / (std::sqrt(epsApply(modulo, attrs.epsMode, attrs.eps)));
// normalize
parallel_for(C, [&](size_t ic) {
@@ -1487,7 +1487,7 @@ private:
});
} else { // across_spatial: false
// moduloM
- std::vector<float> moduloM(spatial_dims, 0.f);
+ std::vector<float> moduloM(spatial_dims, 0.F);
parallel_for(H, [&](size_t ih) {
size_t offset_h = ih * W;
const in_data_t* src_data_b_ih = src_data_b + offset_h;
@@ -1500,7 +1500,7 @@ private:
});
for (size_t m = 0; m < spatial_dims; m++) {
- moduloM[m] = 1.0f / (std::sqrt(epsApply(moduloM[m], attrs.epsMode, attrs.eps)));
+ moduloM[m] = 1.0F / (std::sqrt(epsApply(moduloM[m], attrs.epsMode, attrs.eps)));
}
// normalize
@@ -1521,7 +1521,7 @@ private:
}
}
- inline void apply_post_ops_scalar(float& dst_value, int index_c, const void** post_ops_data_) {
+ void apply_post_ops_scalar(float& dst_value, int index_c, const void** post_ops_data_) {
const auto& p = (*kernel_attrs.get()).post_ops_;
int eltwise_inj_idx = 0;
int depthwise_inj_idx = 0;
@@ -1535,9 +1535,9 @@ private:
} else if (post_op.is_depthwise()) {
const auto* depthwise_base = *post_ops_data;
const auto* depthwise_weights =
- depthwise_base + post_op.depthwise.offset[post_op.depthwise.scales] + index_c;
+ depthwise_base + post_op.depthwise.offset[dnnl_post_ops::entry_t::depthwise_t::scales] + index_c;
const auto* depthwise_bias =
- depthwise_base + post_op.depthwise.offset[post_op.depthwise.shifts] + index_c;
+ depthwise_base + post_op.depthwise.offset[dnnl_post_ops::entry_t::depthwise_t::shifts] + index_c;
dst_value = depthwise_injectors_ref[depthwise_inj_idx]->compute_scalar(dst_value,
depthwise_weights,
@@ -1558,10 +1558,10 @@ private:
return dataPtr[channelIdx];
};
- float crop_low = dataVal(quant.crop_low);
- float crop_high = dataVal(quant.crop_high);
- float input_scale = dataVal(quant.inp_scale);
- float input_shift = dataVal(quant.inp_shift);
+ float crop_low = dataVal(dnnl_post_ops::entry_t::quantization_t::crop_low);
+ float crop_high = dataVal(dnnl_post_ops::entry_t::quantization_t::crop_high);
+ float input_scale = dataVal(dnnl_post_ops::entry_t::quantization_t::inp_scale);
+ float input_shift = dataVal(dnnl_post_ops::entry_t::quantization_t::inp_shift);
dst_value = nstl::min(crop_high, nstl::max(crop_low, dst_value));
dst_value = dst_value * input_scale + input_shift;
@@ -1571,8 +1571,8 @@ private:
}
if (do_dequantization) {
- float output_scale = dataVal(quant.output_scale);
- float output_shift = dataVal(quant.output_shift);
+ float output_scale = dataVal(dnnl_post_ops::entry_t::quantization_t::output_scale);
+ float output_shift = dataVal(dnnl_post_ops::entry_t::quantization_t::output_shift);
dst_value = dst_value * output_scale + output_shift;
}
diff --git a/src/plugins/intel_cpu/src/nodes/one_hot.cpp b/src/plugins/intel_cpu/src/nodes/one_hot.cpp
index d41e3169c11..61e9a507b89 100644
--- a/src/plugins/intel_cpu/src/nodes/one_hot.cpp
+++ b/src/plugins/intel_cpu/src/nodes/one_hot.cpp
@@ -83,8 +83,8 @@ OneHot::OneHot(const std::shared_ptr<ov::Node>& op, const GraphContext::CPtr& co
THROW_CPU_NODE_ERR("has unsupported 'axis' attribute: ", oneHot->get_axis());
}
- if (!(((1 + srcDims.size()) == dstDims.size()) ||
- (depthNode && (srcDims.size() == 1 && dstDims.size() == 1 && dstDims[0] == depth && srcDims[0] == 1)))) {
+ if (((1 + srcDims.size()) != dstDims.size()) &&
+ (!depthNode || srcDims.size() != 1 || dstDims.size() != 1 || dstDims[0] != depth || srcDims[0] != 1)) {
THROW_CPU_NODE_ERR("has incorrect number of input/output dimensions!");
}
}
diff --git a/src/plugins/intel_cpu/src/nodes/pad.cpp b/src/plugins/intel_cpu/src/nodes/pad.cpp
index 6ec0508bac8..fb047e6bfbc 100644
--- a/src/plugins/intel_cpu/src/nodes/pad.cpp
+++ b/src/plugins/intel_cpu/src/nodes/pad.cpp
@@ -311,7 +311,8 @@ void Pad::PadExecutor::paramsInitialization(const PadAttrs& attrs,
params.attrs.padsEnd.push_back(0);
} else {
auto order = srcBlockMemDesc->getOrder();
- VectorIdxs newPadsBegin(params.attrs.padsBegin.size(), 0), newPadsEnd(params.attrs.padsEnd.size(), 0);
+ VectorIdxs newPadsBegin(params.attrs.padsBegin.size(), 0);
+ VectorIdxs newPadsEnd(params.attrs.padsEnd.size(), 0);
for (size_t i = 0; i < params.attrs.padsBegin.size(); ++i) {
newPadsBegin[i] = params.attrs.padsBegin[order[i]];
newPadsEnd[i] = params.attrs.padsEnd[order[i]];
@@ -367,7 +368,7 @@ void Pad::PadExecutor::workPartition() {
params.lastDstDim = params.dstStrides[std::max(params.attrs.endPadIdx - 1, 0)];
params.nDimsForWork = params.attrs.endPadIdx - std::max(params.attrs.beginPadIdx, 0);
params.nThreads = params.nDimsForWork > 0 ? 0 : 1;
- params.workAmount = params.nDimsForWork > 0 ? params.dstDims[0] : 1lu;
+ params.workAmount = params.nDimsForWork > 0 ? params.dstDims[0] : 1LU;
for (int i = 1; i <= params.attrs.beginPadIdx; ++i) {
params.workAmount *= params.dstDims[i];
params.dstDims[0] *= params.dstDims[i];
@@ -503,7 +504,8 @@ void Pad::PadExecutor::padConstantCommon(const MemoryPtr& srcMemPtr, const Memor
const T* srcData = srcMemPtr->getDataAs<const T>();
parallel_nt(params.nThreads, [&](const int ithr, const int nthr) {
- size_t start = 0, end = 0;
+ size_t start = 0;
+ size_t end = 0;
VectorIdxs indexes(params.nDimsForWork, 0);
splitter(params.workAmount, nthr, ithr, start, end);
@@ -546,7 +548,8 @@ void Pad::PadExecutor::padConstantZero(const MemoryPtr& srcMemPtr, const MemoryP
auto* dstData = dstMemPtr->getDataAs<uint8_t>();
parallel_nt(params.nThreads, [&](const int ithr, const int nthr) {
- size_t start = 0, end = 0;
+ size_t start = 0;
+ size_t end = 0;
VectorIdxs indexes(params.nDimsForWork, 0);
splitter(params.workAmount, nthr, ithr, start, end);
@@ -591,7 +594,8 @@ void Pad::PadExecutor::padEdge(const MemoryPtr& srcMemPtr, const MemoryPtr& dstM
auto* dstData = dstMemPtr->getDataAs<uint8_t>();
parallel_nt(params.nThreads, [&](const int ithr, const int nthr) {
- size_t start = 0, end = 0;
+ size_t start = 0;
+ size_t end = 0;
VectorIdxs indexes(params.nDimsForWork, 0);
splitter(params.workAmount, nthr, ithr, start, end);
@@ -642,7 +646,8 @@ void Pad::PadExecutor::padReflectOrSymmetric(const MemoryPtr& srcMemPtr,
params.shift;
parallel_nt(params.nThreads, [&](const int ithr, const int nthr) {
- size_t start = 0, end = 0;
+ size_t start = 0;
+ size_t end = 0;
VectorIdxs indexes(params.nDimsForWork, 0);
splitter(params.workAmount, nthr, ithr, start, end);
diff --git a/src/plugins/intel_cpu/src/nodes/pooling.cpp b/src/plugins/intel_cpu/src/nodes/pooling.cpp
index 658961bce6b..7ed48d0c55e 100644
--- a/src/plugins/intel_cpu/src/nodes/pooling.cpp
+++ b/src/plugins/intel_cpu/src/nodes/pooling.cpp
@@ -684,7 +684,8 @@ void Pooling::initSupportedPrimitiveDescriptors() {
}
auto addSupportedPrimitiveDescriptor = [&](const dnnl::primitive_desc& prim_desc) {
- std::vector<PortConfig> inConfs, outConfs;
+ std::vector<PortConfig> inConfs;
+ std::vector<PortConfig> outConfs;
const int inPlaceOutPort = canBeInPlace() ? 0 : -1;
for (size_t i = 0; i < descInputNumbers(); i++) {
diff --git a/src/plugins/intel_cpu/src/nodes/priorbox.cpp b/src/plugins/intel_cpu/src/nodes/priorbox.cpp
index 2db4c5217a7..3e4c566ccaf 100644
--- a/src/plugins/intel_cpu/src/nodes/priorbox.cpp
+++ b/src/plugins/intel_cpu/src/nodes/priorbox.cpp
@@ -73,7 +73,7 @@ PriorBox::PriorBox(const std::shared_ptr<ov::Node>& op, const GraphContext::CPtr
density = attrs.density;
bool exist;
- aspect_ratio.push_back(1.0f);
+ aspect_ratio.push_back(1.0F);
for (float aspect_ratio_item : attrs.aspect_ratio) {
exist = false;
@@ -94,7 +94,7 @@ PriorBox::PriorBox(const std::shared_ptr<ov::Node>& op, const GraphContext::CPtr
aspect_ratio.push_back(aspect_ratio_item);
if (flip) {
- aspect_ratio.push_back(1.0f / aspect_ratio_item);
+ aspect_ratio.push_back(1.0F / aspect_ratio_item);
}
}
@@ -109,7 +109,7 @@ PriorBox::PriorBox(const std::shared_ptr<ov::Node>& op, const GraphContext::CPtr
variance.push_back(i);
}
} else if (attrs.variance.empty()) {
- variance.push_back(0.1f);
+ variance.push_back(0.1F);
} else {
THROW_CPU_NODE_ERR("has wrong number of variance values. Not less than 1 and more than 4 variance values.");
}
@@ -172,7 +172,7 @@ void PriorBox::execute([[maybe_unused]] const dnnl::stream& strm) {
if (!scale_all_sizes) {
// mxnet-like PriorBox
if (step_ == -1) {
- step_ = 1.f * IH / H;
+ step_ = 1.F * IH / H;
} else {
step_ *= IH;
}
@@ -182,9 +182,14 @@ void PriorBox::execute([[maybe_unused]] const dnnl::stream& strm) {
}
int64_t idx = 0;
- float center_x, center_y, box_width, box_height, step_x, step_y;
- float IWI = 1.0f / static_cast<float>(IW);
- float IHI = 1.0f / static_cast<float>(IH);
+ float center_x;
+ float center_y;
+ float box_width;
+ float box_height;
+ float step_x;
+ float step_y;
+ float IWI = 1.0F / static_cast<float>(IW);
+ float IHI = 1.0F / static_cast<float>(IH);
if (step_ == 0) {
step_x = static_cast<float>(IW) / W;
@@ -213,8 +218,8 @@ void PriorBox::execute([[maybe_unused]] const dnnl::stream& strm) {
for (int64_t h = 0; h < H; ++h) {
for (int64_t w = 0; w < W; ++w) {
if (step_ == 0) {
- center_x = (w + 0.5f) * step_x;
- center_y = (h + 0.5f) * step_y;
+ center_x = (w + 0.5F) * step_x;
+ center_y = (h + 0.5F) * step_y;
} else {
center_x = (offset + w) * step_;
center_y = (offset + h) * step_;
@@ -222,19 +227,19 @@ void PriorBox::execute([[maybe_unused]] const dnnl::stream& strm) {
for (size_t s = 0; s < fixed_size.size(); ++s) {
auto fixed_size_ = static_cast<size_t>(fixed_size[s]);
- box_width = box_height = fixed_size_ * 0.5f;
+ box_width = box_height = fixed_size_ * 0.5F;
if (!fixed_ratio.empty()) {
for (float ar : fixed_ratio) {
auto density_ = static_cast<int64_t>(density[s]);
auto shift = static_cast<int64_t>(fixed_size[s] / density_);
ar = std::sqrt(ar);
- float box_width_ratio = fixed_size[s] * 0.5f * ar;
- float box_height_ratio = fixed_size[s] * 0.5f / ar;
+ float box_width_ratio = fixed_size[s] * 0.5F * ar;
+ float box_height_ratio = fixed_size[s] * 0.5F / ar;
for (int64_t r = 0; r < density_; ++r) {
for (int64_t c = 0; c < density_; ++c) {
- float center_x_temp = center_x - fixed_size_ / 2.f + shift / 2.f + c * shift;
- float center_y_temp = center_y - fixed_size_ / 2.f + shift / 2.f + r * shift;
+ float center_x_temp = center_x - fixed_size_ / 2.F + shift / 2.F + c * shift;
+ float center_y_temp = center_y - fixed_size_ / 2.F + shift / 2.F + r * shift;
calculate_data(center_x_temp, center_y_temp, box_width_ratio, box_height_ratio, true);
}
}
@@ -245,8 +250,8 @@ void PriorBox::execute([[maybe_unused]] const dnnl::stream& strm) {
auto shift = static_cast<int64_t>(fixed_size[s] / density_);
for (int64_t r = 0; r < density_; ++r) {
for (int64_t c = 0; c < density_; ++c) {
- float center_x_temp = center_x - fixed_size_ / 2.f + shift / 2.f + c * shift;
- float center_y_temp = center_y - fixed_size_ / 2.f + shift / 2.f + r * shift;
+ float center_x_temp = center_x - fixed_size_ / 2.F + shift / 2.F + c * shift;
+ float center_y_temp = center_y - fixed_size_ / 2.F + shift / 2.F + r * shift;
calculate_data(center_x_temp, center_y_temp, box_width, box_height, true);
}
}
@@ -260,12 +265,12 @@ void PriorBox::execute([[maybe_unused]] const dnnl::stream& strm) {
auto density_ = static_cast<int64_t>(density[s]);
auto shift = static_cast<int64_t>(fixed_size[s] / density_);
ar = std::sqrt(ar);
- float box_width_ratio = fixed_size[s] * 0.5f * ar;
- float box_height_ratio = fixed_size[s] * 0.5f / ar;
+ float box_width_ratio = fixed_size[s] * 0.5F * ar;
+ float box_height_ratio = fixed_size[s] * 0.5F / ar;
for (int64_t r = 0; r < density_; ++r) {
for (int64_t c = 0; c < density_; ++c) {
- float center_x_temp = center_x - fixed_size_ / 2.f + shift / 2.f + c * shift;
- float center_y_temp = center_y - fixed_size_ / 2.f + shift / 2.f + r * shift;
+ float center_x_temp = center_x - fixed_size_ / 2.F + shift / 2.F + c * shift;
+ float center_y_temp = center_y - fixed_size_ / 2.F + shift / 2.F + r * shift;
calculate_data(center_x_temp, center_y_temp, box_width_ratio, box_height_ratio, true);
}
}
@@ -274,25 +279,25 @@ void PriorBox::execute([[maybe_unused]] const dnnl::stream& strm) {
}
for (size_t ms_idx = 0; ms_idx < min_size_.size(); ms_idx++) {
- box_width = min_size_[ms_idx] * 0.5f;
- box_height = min_size_[ms_idx] * 0.5f;
+ box_width = min_size_[ms_idx] * 0.5F;
+ box_height = min_size_[ms_idx] * 0.5F;
calculate_data(center_x, center_y, box_width, box_height, false);
if (max_size.size() > ms_idx) {
- box_width = box_height = std::sqrt(min_size_[ms_idx] * max_size[ms_idx]) * 0.5f;
+ box_width = box_height = std::sqrt(min_size_[ms_idx] * max_size[ms_idx]) * 0.5F;
calculate_data(center_x, center_y, box_width, box_height, false);
}
if (scale_all_sizes || (!scale_all_sizes && (ms_idx == min_size_.size() - 1))) {
size_t s_idx = scale_all_sizes ? ms_idx : 0;
for (float ar : aspect_ratio) {
- if (std::fabs(ar - 1.0f) < 1e-6) {
+ if (std::fabs(ar - 1.0F) < 1e-6) {
continue;
}
ar = std::sqrt(ar);
- box_width = min_size_[s_idx] * 0.5f * ar;
- box_height = min_size_[s_idx] * 0.5f / ar;
+ box_width = min_size_[s_idx] * 0.5F * ar;
+ box_height = min_size_[s_idx] * 0.5F / ar;
calculate_data(center_x, center_y, box_width, box_height, false);
}
}
@@ -302,7 +307,7 @@ void PriorBox::execute([[maybe_unused]] const dnnl::stream& strm) {
if (clip) {
parallel_for((H * W * number_of_priors * 4), [&](size_t i) {
- dst_data[i] = (std::min)((std::max)(dst_data[i], 0.0f), 1.0f);
+ dst_data[i] = (std::min)((std::max)(dst_data[i], 0.0F), 1.0F);
});
}
diff --git a/src/plugins/intel_cpu/src/nodes/priorbox_clustered.cpp b/src/plugins/intel_cpu/src/nodes/priorbox_clustered.cpp
index 5d8483536f9..85d5751f21a 100644
--- a/src/plugins/intel_cpu/src/nodes/priorbox_clustered.cpp
+++ b/src/plugins/intel_cpu/src/nodes/priorbox_clustered.cpp
@@ -63,7 +63,7 @@ PriorBoxClustered::PriorBoxClustered(const std::shared_ptr<ov::Node>& op, const
number_of_priors = widths.size();
if (variances.empty()) {
- variances.push_back(0.1f);
+ variances.push_back(0.1F);
}
}
@@ -133,16 +133,16 @@ void PriorBoxClustered::execute([[maybe_unused]] const dnnl::stream& strm) {
float box_width = widths[s];
float box_height = heights[s];
- float xmin = (center_x - box_width / 2.0f) / img_width;
- float ymin = (center_y - box_height / 2.0f) / img_height;
- float xmax = (center_x + box_width / 2.0f) / img_width;
- float ymax = (center_y + box_height / 2.0f) / img_height;
+ float xmin = (center_x - box_width / 2.0F) / img_width;
+ float ymin = (center_y - box_height / 2.0F) / img_height;
+ float xmax = (center_x + box_width / 2.0F) / img_width;
+ float ymax = (center_y + box_height / 2.0F) / img_height;
if (clip) {
- xmin = (std::min)((std::max)(xmin, 0.0f), 1.0f);
- ymin = (std::min)((std::max)(ymin, 0.0f), 1.0f);
- xmax = (std::min)((std::max)(xmax, 0.0f), 1.0f);
- ymax = (std::min)((std::max)(ymax, 0.0f), 1.0f);
+ xmin = (std::min)((std::max)(xmin, 0.0F), 1.0F);
+ ymin = (std::min)((std::max)(ymin, 0.0F), 1.0F);
+ xmax = (std::min)((std::max)(xmax, 0.0F), 1.0F);
+ ymax = (std::min)((std::max)(ymax, 0.0F), 1.0F);
}
const uint64_t idx = h * layer_width * number_of_priors * 4 + w * number_of_priors * 4 + s * 4;
diff --git a/src/plugins/intel_cpu/src/nodes/proposal.cpp b/src/plugins/intel_cpu/src/nodes/proposal.cpp
index 24f8caa64df..aa8a47db95a 100644
--- a/src/plugins/intel_cpu/src/nodes/proposal.cpp
+++ b/src/plugins/intel_cpu/src/nodes/proposal.cpp
@@ -41,8 +41,8 @@ static std::vector<float> generate_anchors(proposal_conf& conf) {
// base box's width & height & center location
const auto base_area = static_cast<float>(base_size * base_size);
- const float half_base_size = base_size * 0.5f;
- const float center = 0.5f * (base_size - coordinates_offset);
+ const float half_base_size = base_size * 0.5F;
+ const float center = 0.5F * (base_size - coordinates_offset);
// enumerate all transformed boxes
for (size_t ratio = 0; ratio < num_ratios; ++ratio) {
@@ -64,8 +64,8 @@ static std::vector<float> generate_anchors(proposal_conf& conf) {
for (size_t scale = 0; scale < num_scales; ++scale) {
// transformed width & height for given scale factors
- const float scale_w = 0.5f * (ratio_w * scales[scale] - coordinates_offset);
- const float scale_h = 0.5f * (ratio_h * scales[scale] - coordinates_offset);
+ const float scale_w = 0.5F * (ratio_w * scales[scale] - coordinates_offset);
+ const float scale_h = 0.5F * (ratio_h * scales[scale] - coordinates_offset);
// (x1, y1, x2, y2) for transformed box
p_anchors_wm[scale] = center - scale_w;
@@ -129,13 +129,13 @@ Proposal::Proposal(const std::shared_ptr<ov::Node>& op, const GraphContext::CPtr
conf.anchors_shape_0 = conf.ratios.size() * conf.scales.size();
if (proposalAttrs.framework == "tensorflow") {
- conf.coordinates_offset = 0.0f;
+ conf.coordinates_offset = 0.0F;
conf.initial_clip = true;
conf.shift_anchors = true;
conf.round_ratios = false;
conf.swap_xy = true;
} else {
- conf.coordinates_offset = 1.0f;
+ conf.coordinates_offset = 1.0F;
conf.initial_clip = false;
conf.shift_anchors = false;
conf.round_ratios = true;
@@ -189,14 +189,14 @@ void Proposal::execute([[maybe_unused]] const dnnl::stream& strm) {
// input image height & width
const float imgHeight = imgInfoData[0];
const float imgWidth = imgInfoData[1];
- if (!std::isnormal(imgHeight) || !std::isnormal(imgWidth) || (imgHeight < 0.f) || (imgWidth < 0.f)) {
+ if (!std::isnormal(imgHeight) || !std::isnormal(imgWidth) || (imgHeight < 0.F) || (imgWidth < 0.F)) {
THROW_CPU_NODE_ERR("image info input must have positive image height and width.");
}
// scale factor for height & width
const float scaleHeight = imgInfoData[2];
const float scaleWidth = imgInfoSize == 4 ? imgInfoData[3] : scaleHeight;
- if (!std::isfinite(scaleHeight) || !std::isfinite(scaleWidth) || (scaleHeight < 0.f) || (scaleWidth < 0.f)) {
+ if (!std::isfinite(scaleHeight) || !std::isfinite(scaleWidth) || (scaleHeight < 0.F) || (scaleWidth < 0.F)) {
THROW_CPU_NODE_ERR("image info input must have non negative scales.");
}
diff --git a/src/plugins/intel_cpu/src/nodes/proposal_imp.cpp b/src/plugins/intel_cpu/src/nodes/proposal_imp.cpp
index b33f55db3c2..3862c4be66e 100644
--- a/src/plugins/intel_cpu/src/nodes/proposal_imp.cpp
+++ b/src/plugins/intel_cpu/src/nodes/proposal_imp.cpp
@@ -66,18 +66,18 @@ static void enumerate_proposals_cpu(const float* bottom4d,
if (initial_clip) {
// adjust new corner locations to be within the image region
- x0 = std::max<float>(0.0f, std::min<float>(x0, img_W));
- y0 = std::max<float>(0.0f, std::min<float>(y0, img_H));
- x1 = std::max<float>(0.0f, std::min<float>(x1, img_W));
- y1 = std::max<float>(0.0f, std::min<float>(y1, img_H));
+ x0 = std::max<float>(0.0F, std::min<float>(x0, img_W));
+ y0 = std::max<float>(0.0F, std::min<float>(y0, img_H));
+ x1 = std::max<float>(0.0F, std::min<float>(x1, img_W));
+ y1 = std::max<float>(0.0F, std::min<float>(y1, img_H));
}
// width & height of box
const float ww = x1 - x0 + coordinates_offset;
const float hh = y1 - y0 + coordinates_offset;
// center location of box
- const float ctr_x = x0 + 0.5f * ww;
- const float ctr_y = y0 + 0.5f * hh;
+ const float ctr_x = x0 + 0.5F * ww;
+ const float ctr_y = y0 + 0.5F * hh;
// new center location according to gradient (dx, dy)
const float pred_ctr_x = dx * ww + ctr_x;
@@ -87,18 +87,18 @@ static void enumerate_proposals_cpu(const float* bottom4d,
const float pred_h = std::exp(d_log_h) * hh;
// update upper-left corner location
- x0 = pred_ctr_x - 0.5f * pred_w;
- y0 = pred_ctr_y - 0.5f * pred_h;
+ x0 = pred_ctr_x - 0.5F * pred_w;
+ y0 = pred_ctr_y - 0.5F * pred_h;
// update lower-right corner location
- x1 = pred_ctr_x + 0.5f * pred_w;
- y1 = pred_ctr_y + 0.5f * pred_h;
+ x1 = pred_ctr_x + 0.5F * pred_w;
+ y1 = pred_ctr_y + 0.5F * pred_h;
// adjust new corner locations to be within the image region,
if (clip_before_nms) {
- x0 = std::max<float>(0.0f, std::min<float>(x0, img_W - coordinates_offset));
- y0 = std::max<float>(0.0f, std::min<float>(y0, img_H - coordinates_offset));
- x1 = std::max<float>(0.0f, std::min<float>(x1, img_W - coordinates_offset));
- y1 = std::max<float>(0.0f, std::min<float>(y1, img_H - coordinates_offset));
+ x0 = std::max<float>(0.0F, std::min<float>(x0, img_W - coordinates_offset));
+ y0 = std::max<float>(0.0F, std::min<float>(y0, img_H - coordinates_offset));
+ x1 = std::max<float>(0.0F, std::min<float>(x1, img_W - coordinates_offset));
+ y1 = std::max<float>(0.0F, std::min<float>(y1, img_H - coordinates_offset));
}
// recompute new width & height
@@ -224,7 +224,7 @@ static void nms_cpu(const int num_boxes,
#endif
for (; tail < num_boxes; ++tail) {
- float res = 0.0f;
+ float res = 0.0F;
const float x0i = x0[box];
const float y0i = y0[box];
@@ -244,8 +244,8 @@ static void nms_cpu(const int num_boxes,
const float y1 = std::min<float>(y1i, y1j);
// intersection area
- const float width = std::max<float>(0.0f, x1 - x0 + coordinates_offset);
- const float height = std::max<float>(0.0f, y1 - y0 + coordinates_offset);
+ const float width = std::max<float>(0.0F, x1 - x0 + coordinates_offset);
+ const float height = std::max<float>(0.0F, y1 - y0 + coordinates_offset);
const float area = width * height;
// area of A, B
@@ -292,10 +292,10 @@ static void retrieve_rois_cpu(const int num_rois,
float y1 = src_y1[index];
if (clip_after_nms) {
- x0 = std::max<float>(0.0f, std::min<float>(x0, img_w));
- y0 = std::max<float>(0.0f, std::min<float>(y0, img_h));
- x1 = std::max<float>(0.0f, std::min<float>(x1, img_w));
- y1 = std::max<float>(0.0f, std::min<float>(y1, img_h));
+ x0 = std::max<float>(0.0F, std::min<float>(x0, img_w));
+ y0 = std::max<float>(0.0F, std::min<float>(y0, img_h));
+ x1 = std::max<float>(0.0F, std::min<float>(x1, img_w));
+ y1 = std::max<float>(0.0F, std::min<float>(y1, img_h));
}
if (normalize) {
@@ -318,7 +318,7 @@ static void retrieve_rois_cpu(const int num_rois,
if (num_rois < post_nms_topn_) {
for (int i = 5 * num_rois; i < 5 * post_nms_topn_; i++) {
- rois[i] = 0.f;
+ rois[i] = 0.F;
}
// marker at end of boxes list
@@ -390,7 +390,7 @@ void proposal_exec(const float* input0,
enumerate_proposals_cpu(p_bottom_item + num_proposals + n * num_proposals * 2,
p_d_anchor_item + n * num_proposals * 4,
anchors,
- reinterpret_cast<float*>(&proposals_[0]),
+ reinterpret_cast<float*>(proposals_.data()),
conf.anchors_shape_0,
bottom_H,
bottom_W,
@@ -412,10 +412,10 @@ void proposal_exec(const float* input0,
return (struct1.score > struct2.score);
});
- unpack_boxes(reinterpret_cast<float*>(&proposals_[0]), &unpacked_boxes[0], pre_nms_topn, store_prob);
+ unpack_boxes(reinterpret_cast<float*>(proposals_.data()), unpacked_boxes.data(), pre_nms_topn, store_prob);
nms_cpu(pre_nms_topn,
- &is_dead[0],
- &unpacked_boxes[0],
+ is_dead.data(),
+ unpacked_boxes.data(),
roi_indices,
&num_rois,
0,
@@ -427,7 +427,7 @@ void proposal_exec(const float* input0,
retrieve_rois_cpu(num_rois,
n,
pre_nms_topn,
- &unpacked_boxes[0],
+ unpacked_boxes.data(),
roi_indices,
p_roi_item + n * conf.post_nms_topn_ * 5,
conf.post_nms_topn_,
diff --git a/src/plugins/intel_cpu/src/nodes/psroi_pooling.cpp b/src/plugins/intel_cpu/src/nodes/psroi_pooling.cpp
index a172d00991e..bdaf3984c94 100644
--- a/src/plugins/intel_cpu/src/nodes/psroi_pooling.cpp
+++ b/src/plugins/intel_cpu/src/nodes/psroi_pooling.cpp
@@ -107,9 +107,9 @@ PSROIPooling::PSROIPooling(const std::shared_ptr<ov::Node>& op, const GraphConte
algorithm = Algorithm::PSROIPoolingBilinear;
}
- outputDim = static_cast<size_t>(psroi->get_output_dim());
+ outputDim = psroi->get_output_dim();
spatialScale = psroi->get_spatial_scale();
- groupSize = static_cast<size_t>(psroi->get_group_size());
+ groupSize = psroi->get_group_size();
mode = psroi->get_mode();
spatialBinsX = static_cast<size_t>(psroi->get_spatial_bins_x());
spatialBinsY = static_cast<size_t>(psroi->get_spatial_bins_y());
@@ -247,7 +247,10 @@ void PSROIPooling::unpackParams(const BlockedMemoryDesc& srcDesc,
outputChannelsPadding = dstDesc.getBlockDims()[1] * outBlockSize;
outBlockCount = outputChannelsPadding / outBlockSize;
- size_t hOutStrIndex = 0, wOutStrIndex = 0, hInStrIndex = 0, wInStrIndex = 0;
+ size_t hOutStrIndex = 0;
+ size_t wOutStrIndex = 0;
+ size_t hInStrIndex = 0;
+ size_t wInStrIndex = 0;
const auto& outOrder = dstDesc.getOrder();
const auto& inOrder = srcDesc.getOrder();
for (size_t i = 0; i < outOrder.size(); i++) {
@@ -280,8 +283,15 @@ void PSROIPooling::executeAverage(const inputType* srcData,
const int roiBatchInd,
const BlockedMemoryDesc& srcDesc,
const BlockedMemoryDesc& dstDesc) {
- int inBlockSize, outBlockSize, outBlockCount, hInputStride, wInputStride, hOutputStride, wOutputStride;
- uint64_t inputChannelsPadding, outputChannelsPadding;
+ int inBlockSize;
+ int outBlockSize;
+ int outBlockCount;
+ int hInputStride;
+ int wInputStride;
+ int hOutputStride;
+ int wOutputStride;
+ uint64_t inputChannelsPadding;
+ uint64_t outputChannelsPadding;
unpackParams(srcDesc,
dstDesc,
hInputStride,
@@ -293,13 +303,13 @@ void PSROIPooling::executeAverage(const inputType* srcData,
outBlockCount,
inputChannelsPadding,
outputChannelsPadding);
- const float roiStartW = static_cast<float>(round(bottomRois[1])) * spatialScale;
- const float roiStartH = static_cast<float>(round(bottomRois[2])) * spatialScale;
- const float roiEndW = static_cast<float>(round(bottomRois[3] + 1.0f)) * spatialScale;
- const float roiEndH = static_cast<float>(round(bottomRois[4] + 1.0f)) * spatialScale;
+ const float roiStartW = round(bottomRois[1]) * spatialScale;
+ const float roiStartH = round(bottomRois[2]) * spatialScale;
+ const float roiEndW = round(bottomRois[3] + 1.0F) * spatialScale;
+ const float roiEndH = round(bottomRois[4] + 1.0F) * spatialScale;
// Force too small ROIs to be 1x1
- const float roiWidth = std::max<float>(roiEndW - roiStartW, 0.1f); // avoid 0
- const float roiHeight = std::max<float>(roiEndH - roiStartH, 0.1f);
+ const float roiWidth = std::max<float>(roiEndW - roiStartW, 0.1F); // avoid 0
+ const float roiHeight = std::max<float>(roiEndH - roiStartH, 0.1F);
auto avgPsroi =
[&]([[maybe_unused]] int c, int h, int w, int binOffIn, int binOffOut, int inBlkRes, int outBlkRes) {
@@ -322,7 +332,7 @@ void PSROIPooling::executeAverage(const inputType* srcData,
size_t dstIndex = binOffOut + h * hOutputStride + w * wOutputStride + outBlkRes;
dstData[dstIndex] = 0;
if (binArea) {
- float outSum = 0.0f;
+ float outSum = 0.0F;
const int heightIndexBound = hEnd * hInputStride;
const int widthIndexBound = wEnd * wInputStride;
for (int hh = hStart * hInputStride; hh < heightIndexBound; hh += hInputStride) {
@@ -377,8 +387,15 @@ void PSROIPooling::executeBilinear(const inputType* srcData,
const int roiBatchInd,
const BlockedMemoryDesc& srcDesc,
const BlockedMemoryDesc& dstDesc) {
- int inBlockSize, outBlockSize, outBlockCount, hInputStride, wInputStride, hOutputStride, wOutputStride;
- uint64_t inputChannelsPadding, outputChannelsPadding;
+ int inBlockSize;
+ int outBlockSize;
+ int outBlockCount;
+ int hInputStride;
+ int wInputStride;
+ int hOutputStride;
+ int wOutputStride;
+ uint64_t inputChannelsPadding;
+ uint64_t outputChannelsPadding;
unpackParams(srcDesc,
dstDesc,
hInputStride,
@@ -400,17 +417,18 @@ void PSROIPooling::executeBilinear(const inputType* srcData,
const int binCount = nh * nw;
auto bilinearPsroi = [&](int c, int h, int w, int binOffOut, int outBlkRes) {
- float accum = 0.0f;
- int binOffIn, inBlkRes;
+ float accum = 0.0F;
+ int binOffIn;
+ int inBlkRes;
size_t dstIndex = binOffOut + h * hOutputStride + w * wOutputStride + outBlkRes;
dstData[dstIndex] = 0;
for (size_t binY = 0; binY < spatialBinsY; binY++) {
const float boxYmin = roiStartH + (binY + 0) * (roiHeight / spatialBinsY);
const float boxYmax = roiStartH + (binY + 1) * (roiHeight / spatialBinsY);
- const float heightScale = nh > 1 ? (boxYmax - boxYmin) * (height - 1) / (pooledHeight - 1) : 0.0f;
+ const float heightScale = nh > 1 ? (boxYmax - boxYmin) * (height - 1) / (pooledHeight - 1) : 0.0F;
const float inY =
- nh > 1 ? (h * heightScale + boxYmin * (height - 1)) : 0.5f * (boxYmin + boxYmax) * (height - 1);
+ nh > 1 ? (h * heightScale + boxYmin * (height - 1)) : 0.5F * (boxYmin + boxYmax) * (height - 1);
for (size_t binX = 0; binX < spatialBinsX; binX++) {
size_t gc = c + (binY * spatialBinsX + binX) * nc;
if (srcDesc.hasLayoutType(LayoutType::nspc)) {
@@ -429,11 +447,11 @@ void PSROIPooling::executeBilinear(const inputType* srcData,
const float boxXmin = roiStartW + (binX + 0) * (roiWidth / spatialBinsX);
const float boxXmax = roiStartW + (binX + 1) * (roiWidth / spatialBinsX);
- const float widthScale = nw > 1 ? (boxXmax - boxXmin) * (width - 1) / (pooledWidth - 1) : 0.0f;
+ const float widthScale = nw > 1 ? (boxXmax - boxXmin) * (width - 1) / (pooledWidth - 1) : 0.0F;
const float inX =
- nw > 1 ? (w * widthScale + boxXmin * (width - 1)) : 0.5f * (boxXmin + boxXmax) * (width - 1);
+ nw > 1 ? (w * widthScale + boxXmin * (width - 1)) : 0.5F * (boxXmin + boxXmax) * (width - 1);
- if (!(inY < 0 || inY > height - 1 || inX < 0 || inX > width - 1)) {
+ if (inY >= 0 && inY <= height - 1 && inX >= 0 && inX <= width - 1) {
const auto topYIndex = static_cast<int>(floorf(inY));
auto bottomYIndex = static_cast<int>(ceilf(inY));
const auto leftXIndex = static_cast<int>(floorf(inX));
@@ -504,13 +522,13 @@ void PSROIPooling::executeBilinearDeformable(const inputType* srcData,
const int channelsEachClass,
const int currentRoi,
const int roiBatchInd) {
- const float roiStartW = static_cast<float>(round(bottomRois[1])) * spatialScale - 0.5f;
- const float roiStartH = static_cast<float>(round(bottomRois[2])) * spatialScale - 0.5f;
- const float roiEndW = static_cast<float>(round(bottomRois[3]) + 1.0f) * spatialScale - 0.5f;
- const float roiEndH = static_cast<float>(round(bottomRois[4]) + 1.0f) * spatialScale - 0.5f;
+ const float roiStartW = round(bottomRois[1]) * spatialScale - 0.5F;
+ const float roiStartH = round(bottomRois[2]) * spatialScale - 0.5F;
+ const float roiEndW = (round(bottomRois[3]) + 1.0F) * spatialScale - 0.5F;
+ const float roiEndH = (round(bottomRois[4]) + 1.0F) * spatialScale - 0.5F;
// Force too small ROIs to be 1x1
- const float roiWidth = std::max<float>(roiEndW - roiStartW, 0.1f); // avoid 0
- const float roiHeight = std::max<float>(roiEndH - roiStartH, 0.1f);
+ const float roiWidth = std::max<float>(roiEndW - roiStartW, 0.1F); // avoid 0
+ const float roiHeight = std::max<float>(roiEndH - roiStartH, 0.1F);
parallel_for3d(nc, nh, nw, [&](int c, int h, int w) {
size_t dstIndex = ((currentRoi * nc + c) * nh + h) * nw + w;
dstData[dstIndex] = 0;
@@ -636,8 +654,8 @@ void PSROIPooling::execute([[maybe_unused]] const dnnl::stream& strm) {
auto inputPrec = getParentEdgeAt(0)->getMemory().getDesc().getPrecision();
auto outputPrec = getChildEdgeAt(0)->getMemory().getDesc().getPrecision();
- if (!((inputPrec == ov::element::bf16 && outputPrec == ov::element::bf16) ||
- (inputPrec == ov::element::f32 && outputPrec == ov::element::f32))) {
+ if ((inputPrec != ov::element::bf16 || outputPrec != ov::element::bf16) &&
+ (inputPrec != ov::element::f32 || outputPrec != ov::element::f32)) {
THROW_CPU_NODE_ERR("has different precisions on input: " + inputPrec.get_type_name() +
" and output: " + outputPrec.get_type_name());
}
diff --git a/src/plugins/intel_cpu/src/nodes/qkv_proj.cpp b/src/plugins/intel_cpu/src/nodes/qkv_proj.cpp
index 73e0f60c9b7..6a5adf746ec 100644
--- a/src/plugins/intel_cpu/src/nodes/qkv_proj.cpp
+++ b/src/plugins/intel_cpu/src/nodes/qkv_proj.cpp
@@ -79,7 +79,7 @@ struct QKVProjection::Executor : public QKVProjection::ExecutorBase {
MemoryPtr m_scratchMem;
uint8_t* m_scratch_base = nullptr;
int m_M = 0;
- size_t m_threads_num = 0lu;
+ size_t m_threads_num = 0LU;
MatrixDynQuantPerRow m_quant_act;
@@ -450,7 +450,7 @@ bool QKVProjection::isSupportedOperation(const std::shared_ptr<const ov::Node>&
}
// NOLINTNEXTLINE(bugprone-integer-division)
float unbalance_ratio = static_cast<float>(concurrency % 3) / static_cast<float>(concurrency / 3);
- if (unbalance_ratio > 0.2f) {
+ if (unbalance_ratio > 0.2F) {
errorMessage = "QKVProjection needs number of cores to be nearly multiple of 3";
return false;
}
diff --git a/src/plugins/intel_cpu/src/nodes/random_uniform.cpp b/src/plugins/intel_cpu/src/nodes/random_uniform.cpp
index 3ecf5c4217d..b5bd040ec33 100644
--- a/src/plugins/intel_cpu/src/nodes/random_uniform.cpp
+++ b/src/plugins/intel_cpu/src/nodes/random_uniform.cpp
@@ -95,7 +95,7 @@ RandomUniform::RandomUniform(const std::shared_ptr<ov::Node>& op, const GraphCon
THROW_CPU_NODE_ERR("Alignment of RandomUniform ", alignment, " is not supported by the CPU plugin.");
}
- for (size_t i = 0lu; i < op->get_input_size(); i++) {
+ for (size_t i = 0LU; i < op->get_input_size(); i++) {
if (is_type<op::v0::Constant>(op->get_input_node_ptr(i))) {
m_const_inputs[i] = true;
}
@@ -163,15 +163,12 @@ void RandomUniform::createPrimitive() {
}
bool RandomUniform::needPrepareParams() const {
- if (m_out_shape != getDstMemoryAtPort(0)->getShape().getStaticDims()) {
- return true;
- }
- return false;
+ return m_out_shape != getDstMemoryAtPort(0)->getShape().getStaticDims();
}
void RandomUniform::prepareParams() {
m_out_shape = getDstMemoryAtPort(0)->getShape().getStaticDims();
- m_output_elements_count = std::accumulate(m_out_shape.begin(), m_out_shape.end(), 1lu, std::multiplies<>());
+ m_output_elements_count = std::accumulate(m_out_shape.begin(), m_out_shape.end(), 1LU, std::multiplies<>());
if (m_algo == PHILOX) {
m_skip_count = m_output_elements_count * SKIP_CONST;
@@ -329,7 +326,8 @@ void RandomUniform::preparePhiloxParams() {
parallel_nt(m_threads_num, [&](const int ithr, const int nthr) {
auto& params = m_philox_thread_params[ithr];
- uint64_t start = 0lu, end = 0lu;
+ uint64_t start = 0LU;
+ uint64_t end = 0LU;
if (m_jit_kernel) {
#if defined(OPENVINO_ARCH_X86_64)
@@ -381,8 +379,8 @@ void RandomUniform::prepareMersenneTwisterParams() {
m_mersenne_twister_thread_params.resize(m_threads_num);
m_mersenne_twister_optimization_enabled =
- !(m_output_prc == element::i64 && (m_max_val.i64 > std::numeric_limits<uint32_t>::max() ||
- m_min_val.i64 > std::numeric_limits<uint32_t>::max()));
+ m_output_prc != element::i64 || (m_max_val.i64 <= std::numeric_limits<uint32_t>::max() &&
+ m_min_val.i64 <= std::numeric_limits<uint32_t>::max());
const auto thread_offset = static_cast<float>(MERSENNE_STATE_N) / static_cast<float>(m_threads_num) /
static_cast<float>(m_uint_storage_capacity_per_thread);
@@ -507,18 +505,18 @@ inline void runPhilox(uint64_t key, uint64_t counter, uint64_t n, uint32_t* res)
inline void convertToOutputTypePhilox(const uint32_t* in, float min, float range, float* out, size_t el_to_copy) {
RandomUniform::OutputType out_val;
- for (size_t i = 0lu; i < el_to_copy; i++) {
- out_val.u32 = 0x3f800000 | (in[i] & 0x7fffffu);
- out[i] = (out_val.f32 - 1.f) * range + min;
+ for (size_t i = 0LU; i < el_to_copy; i++) {
+ out_val.u32 = 0x3f800000 | (in[i] & 0x7fffffU);
+ out[i] = (out_val.f32 - 1.F) * range + min;
}
}
inline void convertToOutputTypePhilox(const uint32_t* in, float16 min, float16 range, float16* out, size_t el_to_copy) {
RandomUniform::OutputType out_val;
- for (size_t i = 0lu; i < el_to_copy; i++) {
+ for (size_t i = 0LU; i < el_to_copy; i++) {
auto x_uint16 = static_cast<uint16_t>(in[i]);
- out_val.u16 = 0x3c00 | (x_uint16 & 0x03ffu);
+ out_val.u16 = 0x3c00 | (x_uint16 & 0x03ffU);
out[i] = (out_val.f16 - static_cast<float16>(1)) * range + min;
}
}
@@ -530,21 +528,21 @@ inline void convertToOutputTypePhilox(const uint32_t* in,
size_t el_to_copy) {
RandomUniform::OutputType out_val;
- for (size_t i = 0lu; i < el_to_copy; i++) {
+ for (size_t i = 0LU; i < el_to_copy; i++) {
auto x_uint16 = static_cast<uint16_t>(in[i]);
- out_val.u16 = 0x3f80 | (x_uint16 & 0x7fu);
+ out_val.u16 = 0x3f80 | (x_uint16 & 0x7fU);
out[i] = (out_val.bf16 - static_cast<bfloat16>(1)) * range + min;
}
}
inline void convertToOutputTypePhilox(const uint32_t* in, int32_t min, int32_t range, int32_t* out, size_t el_to_copy) {
- for (size_t i = 0lu; i < el_to_copy; i++) {
+ for (size_t i = 0LU; i < el_to_copy; i++) {
out[i] = static_cast<int32_t>(in[i] % range + min);
}
}
inline void convertToOutputTypePhilox(const uint32_t* in, int64_t min, int64_t range, int64_t* out, size_t el_to_copy) {
- for (size_t i = 0lu; i < el_to_copy; i++) {
+ for (size_t i = 0LU; i < el_to_copy; i++) {
out[i] = static_cast<int64_t>(((static_cast<uint64_t>(in[i * 2]) << 32) + in[i * 2 + 1]) % range + min);
}
}
@@ -555,7 +553,7 @@ std::pair<uint64_t, uint64_t> RandomUniform::computePhilox(void* out,
[[maybe_unused]] size_t output_elements_count,
const std::pair<uint64_t, uint64_t>& prev_state) {
// When both seed values are equal to zero RandomUniform should generate non-deterministic sequence.
- if (m_global_seed == 0lu && m_op_seed == 0lu) {
+ if (m_global_seed == 0LU && m_op_seed == 0LU) {
m_global_seed = std::random_device{}();
}
@@ -569,7 +567,7 @@ std::pair<uint64_t, uint64_t> RandomUniform::computePhilox(void* out,
#if defined(OPENVINO_ARCH_X86_64)
parallel_nt(m_threads_num, [&](const int ithr, [[maybe_unused]] const int nthr) {
auto& params = m_philox_thread_params[ithr];
- if (params.work_amount == 0lu) {
+ if (params.work_amount == 0LU) {
return;
}
auto n = n_state + params.n_shift;
@@ -590,7 +588,7 @@ std::pair<uint64_t, uint64_t> RandomUniform::computePhilox(void* out,
} else {
auto threadBody = [&](const int ithr, [[maybe_unused]] const int nthr) {
auto& params = m_philox_thread_params[ithr];
- if (params.work_amount == 0lu) {
+ if (params.work_amount == 0LU) {
return;
}
auto n = n_state + params.n_shift;
@@ -689,7 +687,7 @@ inline void convertToOutputTypeMersenne(const uint32_t in1,
const auto divisor = static_cast<float>(1) / (static_cast<uint64_t>(1) << std::numeric_limits<float>::digits);
out[0] = static_cast<float>((in1 & mask) * divisor) * range + min;
- if (elements_remaining >= 2l) {
+ if (elements_remaining >= 2L) {
out[1] = static_cast<float>((in2 & mask) * divisor) * range + min;
}
}
@@ -705,7 +703,7 @@ inline void convertToOutputTypeMersenne(const uint32_t in1,
const auto divisor = static_cast<float>(1) / (static_cast<uint64_t>(1) << std::numeric_limits<float16>::digits);
out[0] = static_cast<float>((in1 & mask) * divisor) * range + min;
- if (elements_remaining >= 2l) {
+ if (elements_remaining >= 2L) {
out[1] = static_cast<float>((in2 & mask) * divisor) * range + min;
}
}
@@ -721,7 +719,7 @@ inline void convertToOutputTypeMersenne(const uint32_t in1,
const auto divisor = static_cast<float>(1) / (1UL << 8);
out[0] = static_cast<float>((in1 & mask) * divisor) * range + min;
- if (elements_remaining >= 2l) {
+ if (elements_remaining >= 2L) {
out[1] = static_cast<float>((in2 & mask) * divisor) * range + min;
}
}
@@ -734,7 +732,7 @@ inline void convertToOutputTypeMersenne(const uint32_t in1,
int64_t elements_remaining,
[[maybe_unused]] bool optimization_enabled) {
out[0] = static_cast<int32_t>(in1 % range + min);
- if (elements_remaining >= 2l) {
+ if (elements_remaining >= 2L) {
out[1] = static_cast<int32_t>(in2 % range + min);
}
}
@@ -747,9 +745,9 @@ inline void convertToOutputTypeMersenne(const uint32_t in1,
int64_t elements_remaining,
bool optimization_enabled) {
if (optimization_enabled) {
- out[0] = static_cast<int64_t>(in1 % range + min);
- if (elements_remaining >= 2l) {
- out[1] = static_cast<int64_t>(in2 % range + min);
+ out[0] = (in1 % range + min);
+ if (elements_remaining >= 2L) {
+ out[1] = (in2 % range + min);
}
} else {
out[0] = static_cast<int64_t>(((static_cast<uint64_t>(in1) << 32) + in2) % range + min);
@@ -759,7 +757,7 @@ inline void convertToOutputTypeMersenne(const uint32_t in1,
void RandomUniform::computeMersenneTwister(void* out, size_t output_elements_count) {
// When both seed values are equal to zero RandomUniform should generate non-deterministic sequence.
- if (m_global_seed == 0lu && m_op_seed == 0lu) {
+ if (m_global_seed == 0LU && m_op_seed == 0LU) {
m_global_seed = std::random_device{}();
}
diff --git a/src/plugins/intel_cpu/src/nodes/range.cpp b/src/plugins/intel_cpu/src/nodes/range.cpp
index e8c4b6a75eb..4c243e447e5 100644
--- a/src/plugins/intel_cpu/src/nodes/range.cpp
+++ b/src/plugins/intel_cpu/src/nodes/range.cpp
@@ -82,14 +82,14 @@ void Range::initSupportedPrimitiveDescriptors() {
std::vector<PortConfigurator> inDataConf;
std::vector<PortConfigurator> outDataConf;
- if (!(getOriginalInputPrecisionAtPort(RANGE_START) == ov::element::i32 &&
- getOriginalInputPrecisionAtPort(RANGE_LIMIT) == ov::element::i32 &&
- getOriginalInputPrecisionAtPort(RANGE_DELTA) == ov::element::i32 &&
- getOriginalOutputPrecisionAtPort(0) == ov::element::i32) &&
- !(getOriginalInputPrecisionAtPort(RANGE_START) == ov::element::f32 &&
- getOriginalInputPrecisionAtPort(RANGE_LIMIT) == ov::element::f32 &&
- getOriginalInputPrecisionAtPort(RANGE_DELTA) == ov::element::f32 &&
- getOriginalOutputPrecisionAtPort(0) == ov::element::f32)) {
+ if ((getOriginalInputPrecisionAtPort(RANGE_START) != ov::element::i32 ||
+ getOriginalInputPrecisionAtPort(RANGE_LIMIT) != ov::element::i32 ||
+ getOriginalInputPrecisionAtPort(RANGE_DELTA) != ov::element::i32 ||
+ getOriginalOutputPrecisionAtPort(0) != ov::element::i32) &&
+ (getOriginalInputPrecisionAtPort(RANGE_START) != ov::element::f32 ||
+ getOriginalInputPrecisionAtPort(RANGE_LIMIT) != ov::element::f32 ||
+ getOriginalInputPrecisionAtPort(RANGE_DELTA) != ov::element::f32 ||
+ getOriginalOutputPrecisionAtPort(0) != ov::element::f32)) {
inDataConf.reserve(inputShapes.size());
for (size_t i = 0; i < inputShapes.size(); ++i) {
inDataConf.emplace_back(LayoutType::ncsp, ov::element::f32);
@@ -131,7 +131,9 @@ void Range::execute([[maybe_unused]] const dnnl::stream& strm) {
template <typename data_t>
size_t Range::getWorkAmount(data_t* startPtr, data_t* stopPtr, data_t* stepPtr) const {
- data_t start = 0, limit = 0, delta = 0;
+ data_t start = 0;
+ data_t limit = 0;
+ data_t delta = 0;
if (startPtr == nullptr) {
startPtr = &start;
}
@@ -156,7 +158,8 @@ size_t Range::getWorkAmount(data_t* startPtr, data_t* stopPtr, data_t* stepPtr)
template <typename data_t>
Range::StatusCode Range::rangeKernel() {
- data_t start = 0, delta = 0;
+ data_t start = 0;
+ data_t delta = 0;
size_t work_amount_dst = getWorkAmount<data_t>(&start, nullptr, &delta);
if (isDynamicNode()) {
VectorDims newOutputShape{work_amount_dst};
@@ -164,7 +167,8 @@ Range::StatusCode Range::rangeKernel() {
}
auto* dst_data = getDstDataAtPortAs<data_t>(0);
parallel_nt(0, [&](const int ithr, const int nthr) {
- size_t iwork = 0, end = 0;
+ size_t iwork = 0;
+ size_t end = 0;
splitter(work_amount_dst, nthr, ithr, iwork, end);
data_t dst_value = start + iwork * delta;
for (; iwork < end; ++iwork, dst_value += delta) {
diff --git a/src/plugins/intel_cpu/src/nodes/rdft.cpp b/src/plugins/intel_cpu/src/nodes/rdft.cpp
index 1a60effd8bc..11e5a937069 100644
--- a/src/plugins/intel_cpu/src/nodes/rdft.cpp
+++ b/src/plugins/intel_cpu/src/nodes/rdft.cpp
@@ -479,7 +479,7 @@ static void fftCopyInverseInputData(float* dst, float* src, size_t inputSize, si
}
}
-static void fftCopyRealInputData(float* dst, float* src, size_t inputSize, bool parallelize) {
+static void fftCopyRealInputData(float* dst, const float* src, size_t inputSize, bool parallelize) {
if (!parallelize) {
for (size_t i = 0; i < inputSize; i++) {
dst[2 * i] = src[i];
@@ -493,7 +493,7 @@ static void fftCopyRealInputData(float* dst, float* src, size_t inputSize, bool
}
}
-static void fftCopyInverseRealOutput(float* dst, float* src, size_t signalSize, bool parallelize) {
+static void fftCopyInverseRealOutput(float* dst, const float* src, size_t signalSize, bool parallelize) {
if (!parallelize) {
for (size_t i = 0; i < signalSize; i++) {
dst[i] = src[2 * i];
@@ -520,11 +520,11 @@ void RDFTExecutor::fft(float* input,
if (inputSize < signalSize || type == real_to_complex) {
if (isInverse) {
- fftCopyInverseInputData(&scratchSpace[0], input, inputSize, signalSize, parallelize);
+ fftCopyInverseInputData(scratchSpace.data(), input, inputSize, signalSize, parallelize);
} else if (type == real_to_complex) {
- fftCopyRealInputData(&scratchSpace[0], input, inputSize, parallelize);
+ fftCopyRealInputData(scratchSpace.data(), input, inputSize, parallelize);
}
- inputPtr = &scratchSpace[0];
+ inputPtr = scratchSpace.data();
}
size_t numBlocks = 0;
@@ -570,7 +570,7 @@ void RDFTExecutor::fft(float* input,
}
twiddlesPtr += numBlocks * 2;
if (numBlocks == 1 && inputPtr == input) {
- inputPtr = &scratchSpace[0];
+ inputPtr = scratchSpace.data();
}
std::swap(inputPtr, outputPtr);
}
@@ -659,7 +659,7 @@ void RDFTExecutor::dftOnAxis(enum dft_type type,
parallel_for(totalWorkSize, [&](size_t i) {
std::vector<size_t> coords(iterationRange.size(), 0);
std::vector<float> gatherScatterBuffer(gatherSize + scatterSize);
- float* gatherBuffer = &gatherScatterBuffer[0];
+ float* gatherBuffer = gatherScatterBuffer.data();
float* scatterBuffer = &gatherScatterBuffer[gatherSize];
coordsFromIndex(i, coords, iterationRange, axis);
gather(gatherBuffer, inputPtr, axis, coords, inputSize, inputStrides);
@@ -677,7 +677,7 @@ void RDFTExecutor::dftOnAxis(enum dft_type type,
} else {
std::vector<size_t> coords(iterationRange.size(), 0);
std::vector<float> gatherScatterBuffer(gatherSize + scatterSize);
- float* gatherBuffer = &gatherScatterBuffer[0];
+ float* gatherBuffer = gatherScatterBuffer.data();
float* scatterBuffer = &gatherScatterBuffer[gatherSize];
for (size_t i = 0; i < totalWorkSize; i++) {
coordsFromIndex(i, coords, iterationRange, axis);
@@ -770,7 +770,7 @@ void RDFTExecutor::irdftNd(float* inputPtr,
size_t outputShapeSize = std::accumulate(outputShape.begin(), outputShape.end(), 1, std::multiplies<>());
if (inputShapeSize > outputShapeSize) {
tmp.resize(inputShapeSize);
- output = &tmp[0];
+ output = tmp.data();
}
std::vector<size_t> inputStrides(originalInputStrides.size());
@@ -978,14 +978,15 @@ private:
return twiddles;
}
- void dftRealToComplex(float* inputPtr,
- const float* twiddlesPtr,
- float* outputPtr,
- size_t inputSize,
- size_t outputSize,
- bool parallelize) {
+ static void dftRealToComplex(const float* inputPtr,
+ const float* twiddlesPtr,
+ float* outputPtr,
+ size_t inputSize,
+ size_t outputSize,
+ bool parallelize) {
auto dftIteration = [&](size_t k) {
- float real = 0, imag = 0;
+ float real = 0;
+ float imag = 0;
for (size_t n = 0; n < inputSize; n++) {
float cos = twiddlesPtr[2 * (k * inputSize + n)];
float sin = twiddlesPtr[2 * (k * inputSize + n) + 1];
@@ -1012,7 +1013,8 @@ private:
size_t outputSize,
bool parallelize) {
auto dftIteration = [&](size_t k) {
- float real = 0, imag = 0;
+ float real = 0;
+ float imag = 0;
for (size_t n = 0; n < inputSize; n++) {
float cos = twiddlesPtr[2 * (k * outputSize + n)];
float sin = twiddlesPtr[2 * (k * outputSize + n) + 1];
diff --git a/src/plugins/intel_cpu/src/nodes/rdft.h b/src/plugins/intel_cpu/src/nodes/rdft.h
index 9250ee3a286..6e10c6ab136 100644
--- a/src/plugins/intel_cpu/src/nodes/rdft.h
+++ b/src/plugins/intel_cpu/src/nodes/rdft.h
@@ -102,7 +102,7 @@ private:
const VectorDims& outputShape,
const VectorDims& outputStrides);
virtual std::vector<float> generateTwiddlesDFT(size_t inputSize, size_t outputSize, enum dft_type type) = 0;
- std::vector<float> generateTwiddlesFFT(size_t N);
+ static std::vector<float> generateTwiddlesFFT(size_t N);
std::vector<float> generateTwiddlesCommon(size_t inputSize, size_t outputSize, enum dft_type type, bool useFFT);
};
diff --git a/src/plugins/intel_cpu/src/nodes/reduce.cpp b/src/plugins/intel_cpu/src/nodes/reduce.cpp
index 212812d6336..d2d675cd53f 100644
--- a/src/plugins/intel_cpu/src/nodes/reduce.cpp
+++ b/src/plugins/intel_cpu/src/nodes/reduce.cpp
@@ -188,9 +188,9 @@ struct jit_uni_reduce_kernel_f32 : public jit_uni_reduce_kernel, public jit_gene
if (jcp_.reduce_mode == Algorithm::ReduceLogSumExp) {
exp_injector = std::make_shared<jit_uni_eltwise_injector<isa>>(this,
alg_kind::eltwise_exp,
- 0.f,
- 0.f,
- 1.f,
+ 0.F,
+ 0.F,
+ 1.F,
data_type::f32);
}
@@ -294,7 +294,7 @@ private:
std::shared_ptr<jit_uni_vcvtneps2bf16> uni_vcvtneps2bf16;
std::shared_ptr<jit_uni_eltwise_injector<isa>> exp_injector;
- inline void reduce_main() {
+ void reduce_main() {
// ================================================================
// ***isa: AVX512***
// ReduceAnd (Logical And)
@@ -508,7 +508,7 @@ private:
L(reduce_main_end_label);
}
- inline void reduce_tail() {
+ void reduce_tail() {
if (jcp_.reduce_mode == Algorithm::ReduceL1) {
uni_vmovups(xmm_aux, table_val(1));
}
@@ -569,12 +569,12 @@ private:
L(reduce_tail_end_label);
}
- inline void init_reg_reduce_stride() {
+ void init_reg_reduce_stride() {
mov(reg_reduce_stride, ptr[reg_params + GET_OFF(reduce_stride)]);
mul_by_const(reg_reduce_stride, reg_tmp_64, jcp_.src_data_size);
}
- inline void reduce_kernel() {
+ void reduce_kernel() {
Xbyak::Label reduce_label;
Xbyak::Label reduce_end_label;
Xbyak::Label reduce_batch_label;
@@ -613,7 +613,7 @@ private:
L(reduce_end_label);
}
- inline void reduce_once() {
+ void reduce_once() {
load_vector(vmm_src, ptr[reg_src], jcp_.src_dt);
reduce_kernel(vmm_src, vmm_dst);
@@ -623,7 +623,7 @@ private:
}
}
- inline void reduce_batch() {
+ void reduce_batch() {
mov(reg_src_aux, reg_src);
mov(reg_work_batch_aux, reg_work_batch);
@@ -648,7 +648,7 @@ private:
L(reduce_batch_loop_end_label);
}
- inline void reduce_gather(Vmm vmm_dst, int offset) {
+ void reduce_gather(Vmm vmm_dst, int offset) {
switch (jcp_.src_dt) {
case memory::data_type::f32:
case memory::data_type::s32:
@@ -688,7 +688,7 @@ private:
reduce_kernel(vmm_src, vmm_dst);
}
- inline void pack_gathered_vector(Vmm vmm_val, Vmm vmm_index, int offset, memory::data_type src_dt) {
+ void pack_gathered_vector(Vmm vmm_val, Vmm vmm_index, int offset, memory::data_type src_dt) {
sub(rsp, vlen);
uni_vmovdqu(ptr[rsp], vmm_index);
size_t repeats = vlen / sizeof(float);
@@ -744,7 +744,7 @@ private:
add(rsp, vlen);
}
- inline void reduce_kernel_tail() {
+ void reduce_kernel_tail() {
Xbyak::Label reduce_label;
Xbyak::Label reduce_end_label;
Xbyak::Label reduce_batch_label;
@@ -801,7 +801,7 @@ private:
L(reduce_end_label);
}
- inline void reduce_once_tail() {
+ void reduce_once_tail() {
load_scalar(xmm_src, ptr[reg_src], jcp_.src_dt);
reduce_kernel_scalar(xmm_src, xmm_dst);
if (jcp_.reduce_mode == Algorithm::ReduceOr) {
@@ -810,7 +810,7 @@ private:
}
}
- inline void reduce_batch_tail() {
+ void reduce_batch_tail() {
mov(reg_src_aux, reg_src);
mov(reg_work_batch_aux, reg_work_batch);
@@ -835,7 +835,7 @@ private:
L(reduce_batch_loop_end_label);
}
- inline void reduce_main_loop() {
+ void reduce_main_loop() {
Xbyak::Label reduce_loop_label;
Xbyak::Label reduce_loop_end_label;
@@ -861,7 +861,7 @@ private:
L(reduce_loop_end_label);
}
- inline void reduce_kernel(Vmm vmm_src, Vmm vmm_dst) {
+ void reduce_kernel(Vmm vmm_src, Vmm vmm_dst) {
switch (jcp_.reduce_mode) {
case Algorithm::ReduceAnd:
if (isa == cpu::x64::avx512_core) {
@@ -915,7 +915,7 @@ private:
}
}
- inline void reduce_kernel_scalar(Xmm xmm_src, Xmm xmm_dst) {
+ void reduce_kernel_scalar(Xmm xmm_src, Xmm xmm_dst) {
switch (jcp_.reduce_mode) {
case Algorithm::ReduceAnd:
uni_cmpneqps(xmm_src, xmm_src, xmm_zero);
@@ -960,14 +960,14 @@ private:
}
}
- inline void load_dst_vector() {
+ void load_dst_vector() {
load_vector(vmm_dst, ptr[reg_dst], jcp_.dst_dt);
if (isa == cpu::x64::sse41) {
load_vector(vmm_dst_aux, ptr[reg_dst + 4 * jcp_.dst_data_size], jcp_.dst_dt);
}
}
- inline void store_dst_vector() {
+ void store_dst_vector() {
if (jcp_.reduce_mode == Algorithm::ReduceOr && isa != cpu::x64::avx512_core) {
uni_cmpneqps(vmm_dst, vmm_dst, vmm_zero);
uni_vandps(vmm_dst, vmm_dst, vmm_aux);
@@ -983,7 +983,7 @@ private:
}
}
- inline void load_vector(Vmm vmm_src, const Xbyak::Address& op, memory::data_type src_dt) {
+ void load_vector(Vmm vmm_src, const Xbyak::Address& op, memory::data_type src_dt) {
switch (src_dt) {
case memory::data_type::f32:
case memory::data_type::s32:
@@ -1011,7 +1011,7 @@ private:
}
}
- inline void load_scalar(Xmm xmm_src, const Xbyak::Address& op, memory::data_type src_dt) {
+ void load_scalar(Xmm xmm_src, const Xbyak::Address& op, memory::data_type src_dt) {
switch (src_dt) {
case memory::data_type::f32:
case memory::data_type::s32:
@@ -1041,7 +1041,7 @@ private:
}
}
- inline void store_vector(const Xbyak::Address& op, Vmm vmm_dst, memory::data_type dst_dt) {
+ void store_vector(const Xbyak::Address& op, Vmm vmm_dst, memory::data_type dst_dt) {
auto xmm_dst = Xmm(vmm_dst.getIdx());
auto ymm_dst = Ymm(vmm_dst.getIdx());
if (jcp_.round_to_zero && !support_intermediate_int) {
@@ -1108,7 +1108,7 @@ private:
}
}
- inline void store_scalar(const Xbyak::Address& op, Xmm xmm_dst, memory::data_type dst_dt) {
+ void store_scalar(const Xbyak::Address& op, Xmm xmm_dst, memory::data_type dst_dt) {
if (jcp_.round_to_zero && !support_intermediate_int) {
uni_vroundps(xmm_dst, xmm_dst, 3);
}
@@ -1147,7 +1147,7 @@ private:
}
}
- inline void horiz_reduce_store(Vmm vmm_dst, memory::data_type dst_dt, bool load_embedded = false) {
+ void horiz_reduce_store(Vmm vmm_dst, memory::data_type dst_dt, bool load_embedded = false) {
if (isa == cpu::x64::sse41) {
horiz_store(vmm_dst, dst_dt, load_embedded);
} else if (isa == cpu::x64::avx2) {
@@ -1169,7 +1169,7 @@ private:
}
}
- inline void horiz_store(Xbyak::Xmm xmm_dst, memory::data_type dst_dt, bool load_embedded) {
+ void horiz_store(Xbyak::Xmm xmm_dst, memory::data_type dst_dt, bool load_embedded) {
uni_vmovshdup(xmm_aux3, xmm_dst); // dst:1,2,3,4; aux3:2,2,4,4
horiz_ps(xmm_dst, xmm_aux3); // dst:f(1,2),f(2,2),f(3,4),f(4,4)
uni_vmovhlps(xmm_aux3, xmm_aux3, xmm_dst); // aux3:f(3,4),f(4,4),4,4
@@ -1181,7 +1181,7 @@ private:
store_scalar(ptr[reg_dst], xmm_dst, dst_dt);
}
- inline void horiz_ps(const Xmm& xmm, const Operand& op) {
+ void horiz_ps(const Xmm& xmm, const Operand& op) {
switch (jcp_.reduce_mode) {
case Algorithm::ReduceAnd:
uni_vandps(xmm, xmm, op);
@@ -1216,11 +1216,11 @@ private:
}
}
- inline bool convert_i32_to_f32(memory::data_type src_dt) {
+ bool convert_i32_to_f32(memory::data_type src_dt) {
return !isFloatCompatible(src_dt) && !support_intermediate_int;
}
- inline bool convert_f32_to_i32(memory::data_type dst_dt) {
+ bool convert_f32_to_i32(memory::data_type dst_dt) {
return !isFloatCompatible(dst_dt) && !support_intermediate_int;
}
@@ -1293,9 +1293,9 @@ struct jit_uni_reduce_post_kernel_f32 : public jit_uni_reduce_post_kernel, publi
if (jcp_.reduce_mode == Algorithm::ReduceLogSum || jcp_.reduce_mode == Algorithm::ReduceLogSumExp) {
log_injector = std::make_shared<jit_uni_eltwise_injector<isa>>(this,
alg_kind::eltwise_log,
- 0.f,
- 0.f,
- 1.f,
+ 0.F,
+ 0.F,
+ 1.F,
data_type::f32);
}
@@ -1415,7 +1415,7 @@ private:
std::vector<std::shared_ptr<jit_uni_depthwise_injector_f32<isa>>> depthwise_injectors;
std::vector<std::shared_ptr<jit_uni_quantization_injector_f32<isa>>> quantization_injectors;
- inline void reduce_post_main() {
+ void reduce_post_main() {
Xbyak::Label reduce_channel_label;
Xbyak::Label reduce_map_label;
if (planar_layout) {
@@ -1566,7 +1566,7 @@ private:
}
}
- inline void reduce_post_tail() {
+ void reduce_post_tail() {
// reduce map for tail in dst memory
// cases: [ReduceL2] [ReduceLogSum] [ReduceLogSumExp] [ReduceMean] in planar layout
if (post_reduce) {
@@ -1701,7 +1701,7 @@ private:
}
}
- inline void reduce_map_kernel(Vmm vmm_dst) {
+ void reduce_map_kernel(Vmm vmm_dst) {
if (jcp_.reduce_mode == Algorithm::ReduceMean) {
uni_vdivps(vmm_dst, vmm_dst, vmm_aux);
} else if (jcp_.reduce_mode == Algorithm::ReduceL2) {
@@ -1711,7 +1711,7 @@ private:
}
}
- inline void reduce_map_kernel_scalar(Xmm xmm_dst) {
+ void reduce_map_kernel_scalar(Xmm xmm_dst) {
if (jcp_.reduce_mode == Algorithm::ReduceMean) {
uni_vdivps(xmm_dst, xmm_dst, xmm_aux);
} else if (jcp_.reduce_mode == Algorithm::ReduceL2) {
@@ -1721,7 +1721,7 @@ private:
}
}
- inline void wrap_load_vector(Vmm vmm_val, size_t offset) {
+ void wrap_load_vector(Vmm vmm_val, size_t offset) {
if (jcp_.fuse_low_precision) {
load_vector(vmm_val, ptr[reg_src + offset * sizeof(float)], memory::data_type::f32);
} else {
@@ -1729,7 +1729,7 @@ private:
}
}
- inline void wrap_load_scalar(Xmm xmm_val, size_t offset) {
+ void wrap_load_scalar(Xmm xmm_val, size_t offset) {
if (jcp_.fuse_low_precision) {
load_scalar(xmm_val, ptr[reg_src + offset * sizeof(float)], memory::data_type::f32);
} else {
@@ -1737,7 +1737,7 @@ private:
}
}
- inline void load_vector(Vmm vmm_src, const Xbyak::Address& op, memory::data_type src_dt) {
+ void load_vector(Vmm vmm_src, const Xbyak::Address& op, memory::data_type src_dt) {
switch (src_dt) {
case memory::data_type::f32:
case memory::data_type::s32:
@@ -1765,7 +1765,7 @@ private:
}
}
- inline void load_scalar(Xmm xmm_src, const Xbyak::Address& op, memory::data_type src_dt) {
+ void load_scalar(Xmm xmm_src, const Xbyak::Address& op, memory::data_type src_dt) {
switch (src_dt) {
case memory::data_type::f32:
case memory::data_type::s32:
@@ -1795,7 +1795,7 @@ private:
}
}
- inline void store_vector(const Xbyak::Address& op, Vmm vmm_dst, memory::data_type dst_dt) {
+ void store_vector(const Xbyak::Address& op, Vmm vmm_dst, memory::data_type dst_dt) {
auto xmm_dst = Xmm(vmm_dst.getIdx());
auto ymm_dst = Ymm(vmm_dst.getIdx());
// If there is post ops fusing, necessary rounding has ready been done, no need to do it again.
@@ -1863,7 +1863,7 @@ private:
}
}
- inline void store_scalar(const Xbyak::Address& op, Xmm xmm_dst, memory::data_type dst_dt) {
+ void store_scalar(const Xbyak::Address& op, Xmm xmm_dst, memory::data_type dst_dt) {
if (!post_ops_fusing && jcp_.round_to_zero) {
uni_vroundps(xmm_dst, xmm_dst, 3);
}
@@ -1902,7 +1902,7 @@ private:
}
}
- inline void horiz_reduce_store(Vmm vmm_dst, memory::data_type dst_dt, bool load_embedded = false) {
+ void horiz_reduce_store(Vmm vmm_dst, memory::data_type dst_dt, bool load_embedded = false) {
if (isa == cpu::x64::sse41) {
horiz_store(vmm_dst, dst_dt, load_embedded);
} else if (isa == cpu::x64::avx2) {
@@ -1924,7 +1924,7 @@ private:
}
}
- inline void horiz_store(Xbyak::Xmm xmm_dst, memory::data_type dst_dt, bool load_embedded) {
+ void horiz_store(Xbyak::Xmm xmm_dst, memory::data_type dst_dt, bool load_embedded) {
uni_vmovshdup(xmm_aux3, xmm_dst); // dst:1,2,3,4; aux3:2,2,4,4
horiz_ps(xmm_dst, xmm_aux3); // dst:f(1,2),f(2,2),f(3,4),f(4,4)
uni_vmovhlps(xmm_aux3, xmm_aux3, xmm_dst); // aux3:f(3,4),f(4,4),4,4
@@ -1944,7 +1944,7 @@ private:
}
}
- inline void horiz_ps(const Xmm& xmm, const Operand& op) {
+ void horiz_ps(const Xmm& xmm, const Operand& op) {
switch (jcp_.reduce_mode) {
case Algorithm::ReduceAnd:
uni_vandps(xmm, xmm, op);
@@ -2601,7 +2601,7 @@ void Reduce::reduce_PLN(const uint8_t* in_ptr, uint8_t* out_ptr) {
work_amount,
1,
0,
- static_cast<int*>(&index_buf[0]));
+ static_cast<int*>(index_buf.data()));
});
size_t tail_start = IK * blk_size;
size_t IT = outer_size - tail_start;
@@ -2615,13 +2615,15 @@ void Reduce::reduce_PLN(const uint8_t* in_ptr, uint8_t* out_ptr) {
} else {
if (ReduceH) {
parallel_for2d(IC, ID, [&](size_t ic, size_t id) {
- size_t oc = ic, od = id;
+ size_t oc = ic;
+ size_t od = id;
GET_PTR_NCD_BASE_PTR_N_PLN;
reduce_kernel_process(in_ptr_ncd, out_ptr_ncd, work_amount, 1);
});
} else {
parallel_for3d(IC, ID, IH, [&](size_t ic, size_t id, size_t ih) {
- size_t oc = ic, od = id;
+ size_t oc = ic;
+ size_t od = id;
GET_PTR_NCD_BASE_PTR_N_PLN;
size_t oh = ih;
GET_PTR_NCDH_PLN;
@@ -2643,7 +2645,7 @@ void Reduce::reduce_PLN(const uint8_t* in_ptr, uint8_t* out_ptr) {
if (ReduceCDW_opt) {
// reduce parallelly in HW dimensions
// step1: ReduceC && ReduceD && !ReduceH && !ReduceW
- uint8_t* prc_ptr_n = &vec_reduceCDW_prc[0];
+ uint8_t* prc_ptr_n = vec_reduceCDW_prc.data();
init_dst_data(prc_ptr_n, prc_size);
size_t IS = IH * IW;
reduce_stride = IS;
@@ -2702,7 +2704,8 @@ void Reduce::reduce_PLN(const uint8_t* in_ptr, uint8_t* out_ptr) {
}
} else if (!ReduceC && !ReduceD && ReduceH && !ReduceW) {
parallel_for2d(IC, ID, [&](size_t ic, size_t id) {
- size_t oc = ic, od = id;
+ size_t oc = ic;
+ size_t od = id;
GET_PTR_NCD_BASE_PTR_N_PLN;
parallel_for(IW / blk_size, [&](size_t ibw) {
size_t obw = ibw;
@@ -2725,10 +2728,11 @@ void Reduce::reduce_PLN(const uint8_t* in_ptr, uint8_t* out_ptr) {
if (IWB > 0) {
// reduce parallelly in D dimension
// step1: !ReduceD && ReduceH && !ReduceW
- uint8_t* prc_ptr_n = &vec_reduceDH_prc[0];
+ uint8_t* prc_ptr_n = vec_reduceDH_prc.data();
init_dst_data(prc_ptr_n, prc_size);
parallel_for2d(ID, IWB, [&](size_t id, size_t iwb) {
- size_t pd = id, pwb = iwb;
+ size_t pd = id;
+ size_t pwb = iwb;
reduce_kernel_process(in_ptr_n + (id * IH * IW + iwb * blk_size) * src_data_size,
prc_ptr_n + (pd * PW + pwb * blk_size) * prc_data_size,
blk_size,
@@ -2739,7 +2743,8 @@ void Reduce::reduce_PLN(const uint8_t* in_ptr, uint8_t* out_ptr) {
reduce_stride = PW;
reduce_kernel_reassign();
parallel_for(IWB, [&](size_t iwb) {
- size_t pwb = iwb, owb = iwb;
+ size_t pwb = iwb;
+ size_t owb = iwb;
reduce_kernel_process(prc_ptr_n + pwb * blk_size * prc_data_size,
out_ptr_n + owb * blk_size * dst_data_size,
blk_size,
@@ -2862,7 +2867,8 @@ void Reduce::reduce_BLK(const uint8_t* in_ptr, uint8_t* out_ptr) {
apply_post_kernel = !apply_division;
}
parallel_for2d(ICB, ID, [&](size_t icb, size_t id) {
- size_t ocb = icb, od = id;
+ size_t ocb = icb;
+ size_t od = id;
GET_PTR_NCD_BASE_PTR_N_BLK;
reduce_kernel_process(in_ptr_ncd, out_ptr_ncd, IH * IW * blk_size);
});
@@ -2904,7 +2910,8 @@ void Reduce::reduce_BLK(const uint8_t* in_ptr, uint8_t* out_ptr) {
} else if (ReduceC && !ReduceD && !ReduceH && !ReduceW) {
reduce_stride = ID * IH * IW * blk_size;
parallel_for3d(ID, IH, IW, [&](size_t id, size_t ih, size_t iw) {
- size_t icb = 0, ocb = 0;
+ size_t icb = 0;
+ size_t ocb = 0;
GET_PTR_NC_BLK;
size_t od = id;
GET_PTR_NCD_BLK;
@@ -3064,7 +3071,7 @@ inline void Reduce::reduce_kernel_process(const uint8_t* in_p,
}
inline void Reduce::reduce_kernel_post_process(uint8_t* out_ptr) {
- const uint8_t* in_ptr = fuse_low_precision ? static_cast<uint8_t*>(&intermediate_buf[0]) : nullptr;
+ const uint8_t* in_ptr = fuse_low_precision ? static_cast<uint8_t*>(intermediate_buf.data()) : nullptr;
const size_t integerDivisor = empty_input ? 1 : IB * IC * ID * IH * IW / (OB * OC * OD * OH * OW);
const auto divisor = static_cast<float>(integerDivisor);
if (layout == ReduceLayoutType::reduce_ncsp) {
@@ -3078,7 +3085,7 @@ inline void Reduce::reduce_kernel_post_process(uint8_t* out_ptr) {
arg.channel_size = OC;
arg.work_amount = OD * OH * OW;
arg.divisor = &divisor;
- arg.post_op_data = static_cast<const void**>(postOpsDataPtrs.data());
+ arg.post_op_data = postOpsDataPtrs.data();
(*reduce_post_kernel)(&arg);
});
} else if (layout == ReduceLayoutType::reduce_nspc) {
@@ -3098,7 +3105,7 @@ inline void Reduce::reduce_kernel_post_process(uint8_t* out_ptr) {
arg.channel_size = OW; // OW is related to nspc-ncsp dimension reinterpret
arg.work_amount = work_amount;
arg.divisor = &divisor;
- arg.post_op_data = static_cast<const void**>(postOpsDataPtrs.data());
+ arg.post_op_data = postOpsDataPtrs.data();
(*reduce_post_kernel)(&arg);
};
@@ -3117,7 +3124,7 @@ inline void Reduce::reduce_kernel_post_process(uint8_t* out_ptr) {
arg.oc_off = ocb * blk_size * sizeof(float);
arg.work_amount = OD * OH * OW * blk_size;
arg.divisor = &divisor;
- arg.post_op_data = static_cast<const void**>(postOpsDataPtrs.data());
+ arg.post_op_data = postOpsDataPtrs.data();
(*reduce_post_kernel)(&arg);
});
}
@@ -3138,7 +3145,7 @@ inline void Reduce::reduce_kernel_restore() {
inline void Reduce::output_info_reassign(uint8_t** out_ptr) {
if (fuse_low_precision) {
tmp_ptr = *out_ptr;
- *out_ptr = static_cast<uint8_t*>(&intermediate_buf[0]);
+ *out_ptr = static_cast<uint8_t*>(intermediate_buf.data());
tmp_prec = output_prec;
output_prec = intermediate_prec;
tmp_data_size = dst_data_size;
@@ -3156,7 +3163,7 @@ inline void Reduce::output_info_restore(uint8_t** out_ptr) {
}
}
-void Reduce::nspc2ncsp(uint8_t* proc_ptr, uint8_t* out_ptr) {
+void Reduce::nspc2ncsp(const uint8_t* proc_ptr, uint8_t* out_ptr) const {
// dimension reinterpret after nspc reusing routine reduce_PLN
// demote -- nspc -- ncsp
// DIM0 -- B -- B
@@ -3197,8 +3204,8 @@ void Reduce::nspc2ncsp(uint8_t* proc_ptr, uint8_t* out_ptr) {
}
});
} else {
- const auto* src_data = reinterpret_cast<const uint8_t*>(proc_ptr);
- auto* dst_data = reinterpret_cast<uint8_t*>(out_ptr);
+ const auto* src_data = proc_ptr;
+ auto* dst_data = out_ptr;
parallel_for2d(DIM0, stride1, [&](size_t b, size_t j) {
auto src_off = b * stride0 + j * DIM1;
auto dst_off = b * stride0 + j;
@@ -3211,7 +3218,7 @@ void Reduce::nspc2ncsp(uint8_t* proc_ptr, uint8_t* out_ptr) {
}
}
-void Reduce::blocked2ncsp(uint8_t* proc_ptr, uint8_t* out_ptr) {
+void Reduce::blocked2ncsp(const uint8_t* proc_ptr, uint8_t* out_ptr) const {
const size_t DIM0 = OB;
const size_t DIM1 = OC;
const size_t DIM2 = OD;
@@ -3264,8 +3271,8 @@ void Reduce::blocked2ncsp(uint8_t* proc_ptr, uint8_t* out_ptr) {
}
});
} else {
- const auto* src_data = reinterpret_cast<const uint8_t*>(proc_ptr);
- auto* dst_data = reinterpret_cast<uint8_t*>(out_ptr);
+ const auto* src_data = proc_ptr;
+ auto* dst_data = out_ptr;
parallel_for2d(DIM0, stride1, [&](size_t b, size_t j) {
auto src_off = b * src_stride0 + j * blk_size;
auto dst_off = b * dst_stride0 + j;
@@ -3322,7 +3329,7 @@ inline void Reduce::init_dst_data(uint8_t* out_ptr, size_t dst_size) {
out_p[i] = static_cast<ov::float16>(1);
});
} else if (output_prec == ov::element::u8) {
- auto* out_p = reinterpret_cast<uint8_t*>(out_ptr);
+ auto* out_p = out_ptr;
parallel_for(dst_size / dst_data_size, [&](size_t i) {
out_p[i] = static_cast<uint8_t>(1);
});
@@ -3355,7 +3362,7 @@ inline void Reduce::init_dst_data(uint8_t* out_ptr, size_t dst_size) {
out_p[i] = std::numeric_limits<ov::float16>::lowest();
});
} else if (output_prec == ov::element::u8) {
- auto* out_p = reinterpret_cast<uint8_t*>(out_ptr);
+ auto* out_p = out_ptr;
parallel_for(dst_size / dst_data_size, [&](size_t i) {
out_p[i] = std::numeric_limits<uint8_t>::min();
});
@@ -3388,7 +3395,7 @@ inline void Reduce::init_dst_data(uint8_t* out_ptr, size_t dst_size) {
out_p[i] = std::numeric_limits<ov::float16>::max();
});
} else if (output_prec == ov::element::u8) {
- auto* out_p = reinterpret_cast<uint8_t*>(out_ptr);
+ auto* out_p = out_ptr;
parallel_for(dst_size / dst_data_size, [&](size_t i) {
out_p[i] = std::numeric_limits<uint8_t>::max();
});
@@ -3582,7 +3589,7 @@ inline void Reduce::reduce_ref(const float* in_ptr, float* out_ptr) {
switch (algorithm) {
case Algorithm::ReduceAnd:
reduce_ref_process(in_ptr, out_ptr, 1, [](float x, float y) -> float {
- return static_cast<float>((x != 0.0f) && (y) != 0.0f);
+ return static_cast<float>((x != 0.0F) && (y) != 0.0F);
});
break;
case Algorithm::ReduceL1:
@@ -3622,7 +3629,7 @@ inline void Reduce::reduce_ref(const float* in_ptr, float* out_ptr) {
break;
case Algorithm::ReduceOr:
reduce_ref_process(in_ptr, out_ptr, 0, [](float x, float y) -> float {
- return static_cast<float>((x != 0.0f) || (y) != 0.0f);
+ return static_cast<float>((x != 0.0F) || (y) != 0.0F);
});
break;
case Algorithm::ReduceProd:
@@ -3649,7 +3656,8 @@ void Reduce::reduce_ref_process(const float* in_ptr,
float* out_ptr,
float init_value,
std::function<float(float, float)> func) {
- size_t work_amount_dst = 1, reduced_dims_work_amount = 1;
+ size_t work_amount_dst = 1;
+ size_t reduced_dims_work_amount = 1;
for (size_t process_dst_dim : process_dst_dims) {
work_amount_dst *= process_dst_dim;
}
@@ -3662,7 +3670,9 @@ void Reduce::reduce_ref_process(const float* in_ptr,
getParentEdgeAt(REDUCE_DATA)->getMemory().getDescWithType<BlockedMemoryDesc>()->getStrides();
parallel_nt(0, [&](const int ithr, const int nthr) {
int j;
- size_t i, start = 0, end = 0;
+ size_t i;
+ size_t start = 0;
+ size_t end = 0;
VectorDims dst_counters(process_dst_dims.size(), 0);
splitter(work_amount_dst, nthr, ithr, start, end);
for (j = process_dst_dims.size() - 1, i = start; j >= 0; j--) {
diff --git a/src/plugins/intel_cpu/src/nodes/reduce.h b/src/plugins/intel_cpu/src/nodes/reduce.h
index 0de3b2ecab6..09718bc01d0 100644
--- a/src/plugins/intel_cpu/src/nodes/reduce.h
+++ b/src/plugins/intel_cpu/src/nodes/reduce.h
@@ -155,8 +155,8 @@ private:
std::function<float(float, float)> func);
void create_reduce_kernel(std::shared_ptr<jit_uni_reduce_kernel>& kernel, const jit_reduce_config_params& jcp);
inline void reduce_ref_map(float* out_ptr, size_t work_amount_dst, size_t reduced_dims_work_amount);
- void nspc2ncsp(uint8_t* proc_ptr, uint8_t* out_ptr);
- void blocked2ncsp(uint8_t* proc_ptr, uint8_t* out_ptr);
+ void nspc2ncsp(const uint8_t* proc_ptr, uint8_t* out_ptr) const;
+ void blocked2ncsp(const uint8_t* proc_ptr, uint8_t* out_ptr) const;
void setPostOps(dnnl::primitive_attr& attr, const VectorDims& postOpDims, bool initWeights = false);
void setJITBeyond5D();
std::vector<int> update_src_dims();
diff --git a/src/plugins/intel_cpu/src/nodes/reference.cpp b/src/plugins/intel_cpu/src/nodes/reference.cpp
index 98f2d5af3e3..f946d705d7d 100644
--- a/src/plugins/intel_cpu/src/nodes/reference.cpp
+++ b/src/plugins/intel_cpu/src/nodes/reference.cpp
@@ -145,14 +145,14 @@ bool Reference::needShapeInfer() const {
ov::TensorVector Reference::prepareInputs() const {
ov::TensorVector inputs;
- for (size_t i = 0lu; i < inputShapes.size(); i++) {
+ for (size_t i = 0LU; i < inputShapes.size(); i++) {
void* srcDataPtr = getSrcDataAtPort(i);
ov::Shape shape = ovCoreNode->get_input_partial_shape(i).rank().get_length() == 0
? ov::Shape{}
: getParentEdgeAt(i)->getMemory().getStaticDims();
if (std::any_of(shape.begin(), shape.end(), [](const size_t dim) {
- return dim == 0lu;
+ return dim == 0LU;
})) {
inputs.emplace_back(ovCoreNode->get_input_element_type(i), shape);
} else {
@@ -165,14 +165,14 @@ ov::TensorVector Reference::prepareInputs() const {
ov::TensorVector Reference::prepareOutputs() const {
ov::TensorVector outputs;
- for (size_t i = 0lu; i < outputShapes.size(); i++) {
+ for (size_t i = 0LU; i < outputShapes.size(); i++) {
void* dstDataPtr = getDstDataAtPort(i);
ov::Shape shape = ovCoreNode->get_output_partial_shape(i).rank().get_length() == 0
? ov::Shape{}
: getChildEdgeAt(i)->getMemory().getStaticDims();
if (std::any_of(shape.begin(), shape.end(), [](const size_t dim) {
- return dim == 0lu;
+ return dim == 0LU;
})) {
outputs.emplace_back(ovCoreNode->get_output_element_type(i), shape);
} else {
diff --git a/src/plugins/intel_cpu/src/nodes/region_yolo.cpp b/src/plugins/intel_cpu/src/nodes/region_yolo.cpp
index 83133b17be6..695d2810ebe 100644
--- a/src/plugins/intel_cpu/src/nodes/region_yolo.cpp
+++ b/src/plugins/intel_cpu/src/nodes/region_yolo.cpp
@@ -66,7 +66,7 @@ struct jit_uni_logistic_kernel_f32 : public jit_uni_logistic_kernel, public jit_
void generate() override {
exp_injector.reset(
- new jit_uni_eltwise_injector<isa>(this, dnnl::impl::alg_kind::eltwise_exp, 0.f, 0.f, 1.f, data_type::f32));
+ new jit_uni_eltwise_injector<isa>(this, dnnl::impl::alg_kind::eltwise_exp, 0.F, 0.F, 1.F, data_type::f32));
if (mayiuse(avx512_core)) {
uni_vcvtneps2bf16 = std::make_unique<jit_uni_vcvtneps2bf16>(this, isa);
@@ -204,7 +204,7 @@ private:
int float_1 = 0x3f800000; // 1 // 1.0f
} vals_for_logistic_activate;
- inline void load_vector(Vmm vmm_src, const Xbyak::Address& op, ov::element::Type src_dt) {
+ void load_vector(Vmm vmm_src, const Xbyak::Address& op, ov::element::Type src_dt) {
switch (src_dt) {
case ov::element::f32:
uni_vmovups(vmm_src, op);
@@ -217,7 +217,7 @@ private:
assert(!"unknown src_dt");
}
}
- inline void store_vector(const Xbyak::Address& op, Vmm vmm_dst, ov::element::Type dst_dt) {
+ void store_vector(const Xbyak::Address& op, Vmm vmm_dst, ov::element::Type dst_dt) {
auto ymm_dst = Xbyak::Ymm(vmm_dst.getIdx());
switch (dst_dt) {
@@ -233,7 +233,7 @@ private:
assert(!"unknown dst_dt");
}
}
- inline void load_scalar(Xbyak::Xmm xmm_src, const Xbyak::Address& op, ov::element::Type src_dt) {
+ void load_scalar(Xbyak::Xmm xmm_src, const Xbyak::Address& op, ov::element::Type src_dt) {
switch (src_dt) {
case ov::element::f32:
uni_vmovss(xmm_src, op);
@@ -246,7 +246,7 @@ private:
assert(!"unknown src_dt");
}
}
- inline void store_scalar(const Xbyak::Address& op, Xbyak::Xmm xmm_dst, ov::element::Type dst_dt) {
+ void store_scalar(const Xbyak::Address& op, Xbyak::Xmm xmm_dst, ov::element::Type dst_dt) {
switch (dst_dt) {
case ov::element::f32:
uni_vmovss(op, xmm_dst);
@@ -425,7 +425,7 @@ void RegionYolo::execute([[maybe_unused]] const dnnl::stream& strm) {
int end_index = 0;
int num_ = 0;
size_t output_size = 0;
- if (do_softmax != 0.0f) {
+ if (do_softmax != 0.0F) {
// Region layer (Yolo v2)
end_index = IW * IH;
num_ = num;
@@ -466,7 +466,7 @@ void RegionYolo::execute([[maybe_unused]] const dnnl::stream& strm) {
}
}
- if (do_softmax != 0.0f) {
+ if (do_softmax != 0.0F) {
int index = IW * IH * (coords + 1);
int batch_offset = inputs_size / num;
for (size_t b = 0; b < B * num; b++) {
diff --git a/src/plugins/intel_cpu/src/nodes/region_yolo.h b/src/plugins/intel_cpu/src/nodes/region_yolo.h
index aeebe3448f8..d01e0d81d6f 100644
--- a/src/plugins/intel_cpu/src/nodes/region_yolo.h
+++ b/src/plugins/intel_cpu/src/nodes/region_yolo.h
@@ -84,7 +84,7 @@ private:
int as_int_value;
};
- inline float logistic_scalar(float src);
+ static inline float logistic_scalar(float src);
inline void calculate_logistic(size_t start_index, int count, uint8_t* dst_data);
};
diff --git a/src/plugins/intel_cpu/src/nodes/reorder.cpp b/src/plugins/intel_cpu/src/nodes/reorder.cpp
index 8524edf543d..25ba57f4cdc 100644
--- a/src/plugins/intel_cpu/src/nodes/reorder.cpp
+++ b/src/plugins/intel_cpu/src/nodes/reorder.cpp
@@ -21,7 +21,6 @@
#include "cache/multi_cache.h"
#include "convert.h"
-#include "cpu/x64/cpu_isa_traits.hpp"
#include "cpu_memory.h"
#include "cpu_types.h"
#include "graph_context.h"
@@ -127,14 +126,14 @@ void Reorder::initSupportedPrimitiveDescriptors() {
}
if (!isOptimized) {
const auto& inShape = getInputShapeAtPort(0);
- if (one_of(inShape.getRank(), 4u, 5u) && config.inConfs[0].getMemDesc()->hasLayoutType(LayoutType::nspc) &&
+ if (one_of(inShape.getRank(), 4U, 5U) && config.inConfs[0].getMemDesc()->hasLayoutType(LayoutType::nspc) &&
config.outConfs[0].getMemDesc()->hasLayoutType(LayoutType::ncsp) &&
config.inConfs[0].getMemDesc()->getPrecision() == ov::element::f32 &&
config.outConfs[0].getMemDesc()->getPrecision() == ov::element::f32) {
// oneDNN JIT reorder shows bad perf for nspc to ncsp reorder case so we fallback on simple c++
// implementation
isNspc2NcspCase = true;
- } else if (!dnnl::impl::cpu::x64::mayiuse(dnnl::impl::cpu::x64::avx2) && one_of(inShape.getRank(), 4u, 5u) &&
+ } else if (!dnnl::impl::cpu::x64::mayiuse(dnnl::impl::cpu::x64::avx2) && one_of(inShape.getRank(), 4U, 5U) &&
config.inConfs[0].getMemDesc()->hasLayoutType(LayoutType::ncsp) &&
config.outConfs[0].getMemDesc()->hasLayoutType(LayoutType::nspc) &&
config.inConfs[0].getMemDesc()->getPrecision() == config.outConfs[0].getMemDesc()->getPrecision() &&
@@ -206,7 +205,6 @@ void Reorder::prepareReorderAsTranspose(const MemoryDescPtr& parentDesc, const M
dnnl::primitive_attr attr;
transposeExecutor = factory->makeExecutor(transposeParams, {parentDesc}, {transposedDesc}, attr);
getSelectedPrimitiveDescriptor()->setImplementationType(transposeExecutor->implType());
- return;
}
void Reorder::prepareParams() {
@@ -472,7 +470,8 @@ void Reorder::execute(const dnnl::stream& strm) {
}
std::string Reorder::getReorderArgs(const MemoryDesc& parentDesc, const MemoryDesc& childDesc) {
- std::string inArgs, outArgs;
+ std::string inArgs;
+ std::string outArgs;
if (parentDesc.getPrecision() != childDesc.getPrecision()) {
inArgs += (inArgs.empty() ? "" : "_") + static_cast<std::string>(parentDesc.getPrecision().get_type_name());
outArgs += (outArgs.empty() ? "" : "_") + static_cast<std::string>(childDesc.getPrecision().get_type_name());
diff --git a/src/plugins/intel_cpu/src/nodes/reshape.cpp b/src/plugins/intel_cpu/src/nodes/reshape.cpp
index c07ecb5a8b1..6b827f61ded 100644
--- a/src/plugins/intel_cpu/src/nodes/reshape.cpp
+++ b/src/plugins/intel_cpu/src/nodes/reshape.cpp
@@ -89,10 +89,7 @@ bool Reshape::needShapeInfer() const {
return true;
}
}
- if (inputShapesModified()) {
- return true;
- }
- return false;
+ return inputShapesModified();
}
void Reshape::getSupportedDescriptors() {
diff --git a/src/plugins/intel_cpu/src/nodes/reverse_sequence.cpp b/src/plugins/intel_cpu/src/nodes/reverse_sequence.cpp
index 434149a8a58..91ef8d4696e 100644
--- a/src/plugins/intel_cpu/src/nodes/reverse_sequence.cpp
+++ b/src/plugins/intel_cpu/src/nodes/reverse_sequence.cpp
@@ -171,7 +171,10 @@ void ReverseSequence::ReverseSequenceExecutor::exec(const MemoryPtr& dataMemPtr,
}
parallel_nt(0, [&](const int ithr, const int nthr) {
- size_t i, start = 0, end = 0, srcIdx = 0;
+ size_t i;
+ size_t start = 0;
+ size_t end = 0;
+ size_t srcIdx = 0;
VectorDims counters(srcDims.size(), 0);
splitter(workAmountDst, nthr, ithr, start, end);
for (int j = srcDims.size() - 1, i = start; j >= 0; --j) {
diff --git a/src/plugins/intel_cpu/src/nodes/rnn.cpp b/src/plugins/intel_cpu/src/nodes/rnn.cpp
index 61f0d295013..62de47085da 100644
--- a/src/plugins/intel_cpu/src/nodes/rnn.cpp
+++ b/src/plugins/intel_cpu/src/nodes/rnn.cpp
@@ -192,7 +192,7 @@ size_t RNNKey::hash() const {
using namespace dnnl::impl;
using namespace dnnl::impl::primitive_hashing;
- size_t seed = 0lu;
+ size_t seed = 0LU;
for (const auto& desc : inDataDescs) {
if (desc != nullptr) {
@@ -220,21 +220,21 @@ bool RNNKey::operator==(const RNNKey& rhs) const {
return false;
}
- for (size_t i = 0lu; i < inDataDescs.size(); i++) {
+ for (size_t i = 0LU; i < inDataDescs.size(); i++) {
if (inDataDescs[i] != rhs.inDataDescs[i] &&
(inDataDescs[i] == nullptr || rhs.inDataDescs[i] == nullptr ||
inDataDescs[i]->getDnnlDesc() != rhs.inDataDescs[i]->getDnnlDesc())) {
return false;
}
}
- for (size_t i = 0lu; i < outDataDescs.size(); i++) {
+ for (size_t i = 0LU; i < outDataDescs.size(); i++) {
if (outDataDescs[i] != rhs.outDataDescs[i] &&
(outDataDescs[i] == nullptr || rhs.outDataDescs[i] == nullptr ||
outDataDescs[i]->getDnnlDesc() != rhs.outDataDescs[i]->getDnnlDesc())) {
return false;
}
}
- for (size_t i = 0lu; i < wDescs.size(); i++) {
+ for (size_t i = 0LU; i < wDescs.size(); i++) {
if (wDescs[i] != rhs.wDescs[i]) {
return false;
}
@@ -301,7 +301,7 @@ bool RNN::isSupportedOperation(const std::shared_ptr<const ov::Node>& op, std::s
auto rnnCellBase = ov::as_type_ptr<const ov::op::util::RNNCellBase>(op);
if (rnnCellBase) {
- if (rnnCellBase->get_clip() != 0.f) {
+ if (rnnCellBase->get_clip() != 0.F) {
errorMessage = "Clipping is not supported for RNN primitive.";
return false;
}
@@ -429,7 +429,7 @@ public:
auto& originOutputShapes = result.dims;
// Graph optimizer makes the same optimization. So this is required to make shapes compatible.
- if (is_sequence && !native_order && originOutputShapes[0].size() == 4lu && originOutputShapes[0][1] == 1lu) {
+ if (is_sequence && !native_order && originOutputShapes[0].size() == 4LU && originOutputShapes[0][1] == 1LU) {
originOutputShapes[0].erase(originOutputShapes[0].begin() + 1);
}
return {std::move(originOutputShapes), result.status};
@@ -639,13 +639,13 @@ void RNN::getSupportedDescriptors() {
}
void RNN::initCell() {
- if (getInputShapeAtPort(0).getRank() != 2lu || getInputShapeAtPort(1).getRank() != 2lu) {
+ if (getInputShapeAtPort(0).getRank() != 2LU || getInputShapeAtPort(1).getRank() != 2LU) {
THROW_CPU_NODE_ERR("has incorrect input ranks. Data rank: ",
getInputShapeAtPort(0).getRank(),
"; Hidden state rank: ",
getInputShapeAtPort(1).getRank());
}
- if (is_augru && getInputShapeAtPort(5).getRank() != 2lu) {
+ if (is_augru && getInputShapeAtPort(5).getRank() != 2LU) {
THROW_CPU_NODE_ERR("has incorrect input ranks. Attention rank: ", getInputShapeAtPort(2).getRank());
}
@@ -659,7 +659,8 @@ void RNN::initCell() {
if (N.isStatic()) {
// Expected shapes.
const auto B = N.minVal;
- const Shape shapeD{B, DC}, shapeS{B, SC};
+ const Shape shapeD{B, DC};
+ const Shape shapeS{B, SC};
if ((getInputShapeAtPort(0).isStatic() && getInputShapeAtPort(0) != shapeD) ||
(getInputShapeAtPort(1).isStatic() && getInputShapeAtPort(1) != shapeS) ||
@@ -736,7 +737,8 @@ void RNN::fillCellDesc() {
const Shape RShape{SC * G, SC};
const Shape BShape{SC * Gb};
- std::vector<MemoryDescPtr> inCandidate, outCandidate;
+ std::vector<MemoryDescPtr> inCandidate;
+ std::vector<MemoryDescPtr> outCandidate;
inCandidate.reserve(getOriginalInputsNumber());
outCandidate.reserve(getOriginalOutputsNumber());
@@ -777,17 +779,17 @@ void RNN::initSequence() {
const auto& inDataShape = getInputShapeAtPort(0);
const auto& outDataShape = getOutputShapeAtPort(0);
- if (inDataShape.getRank() != 3lu || outDataShape.getRank() != 4lu) {
+ if (inDataShape.getRank() != 3LU || outDataShape.getRank() != 4LU) {
THROW_CPU_NODE_ERR("has incorrect input/output shapes. Input data shape: ",
inDataShape.toString(),
" Output shape: ",
outDataShape.toString());
}
- if (!one_of(getOriginalInputsNumber(), 6u, 7u)) {
+ if (!one_of(getOriginalInputsNumber(), 6U, 7U)) {
THROW_CPU_NODE_ERR("has incorrect number of input ports: ", getOriginalInputsNumber());
}
- if (!one_of(getOriginalOutputsNumber(), 2u, 3u)) {
+ if (!one_of(getOriginalOutputsNumber(), 2U, 3U)) {
THROW_CPU_NODE_ERR("has incorrect number of output ports: ", getOriginalOutputsNumber());
}
@@ -846,7 +848,8 @@ void RNN::fillSequenceDesc() {
const Shape RShape{D, G * SC, SC};
const Shape BShape{D, Gb * SC};
- std::vector<MemoryDescPtr> inCandidate, outCandidate;
+ std::vector<MemoryDescPtr> inCandidate;
+ std::vector<MemoryDescPtr> outCandidate;
inCandidate.reserve(getOriginalInputsNumber());
outCandidate.reserve(getOriginalOutputsNumber());
@@ -1078,7 +1081,7 @@ void RNN::fillBiases() {
}
void RNN::prepareMemory(const DnnlMemoryDescPtr& new_desc, size_t idx) {
- if (idx >= 3lu) {
+ if (idx >= 3LU) {
THROW_CPU_NODE_ERR("got invalid weights index: ", idx);
}
@@ -1373,7 +1376,7 @@ void RNN::prepareParams() {
auto dataMemPtr = getSrcMemoryAtPort(0);
const size_t B = dataMemPtr->getShape().getStaticDims()[0];
- const size_t SL = is_cell ? 1lu : dataMemPtr->getShape().getStaticDims()[1];
+ const size_t SL = is_cell ? 1LU : dataMemPtr->getShape().getStaticDims()[1];
const Shape shapeS_4D{L, D, B, SC};
inDataDescs[0] =
diff --git a/src/plugins/intel_cpu/src/nodes/roi_align.cpp b/src/plugins/intel_cpu/src/nodes/roi_align.cpp
index f8fc1695780..83aec79b9d8 100644
--- a/src/plugins/intel_cpu/src/nodes/roi_align.cpp
+++ b/src/plugins/intel_cpu/src/nodes/roi_align.cpp
@@ -188,32 +188,32 @@ private:
}
}
- inline void load(Xbyak::Reg64 reg_src, Vmm vmm_src, const int elt_num, const int offset = 0) {
+ void load(Xbyak::Reg64 reg_src, Vmm vmm_src, const int elt_num, const int offset = 0) {
emit_load(reg_src, vmm_src, jcp_.data_prc, ov::element::f32, elt_num, offset);
}
- inline void load_buffer(Xbyak::Reg64 reg_src, Vmm vmm_src, const int elt_num, const int offset = 0) {
+ void load_buffer(Xbyak::Reg64 reg_src, Vmm vmm_src, const int elt_num, const int offset = 0) {
emit_load(reg_src, vmm_src, ov::element::f32, ov::element::f32, elt_num, offset);
}
- inline void load_idx(Xbyak::Reg64 reg_src, Vmm vmm_src, const int elt_num, const int offset = 0) {
+ void load_idx(Xbyak::Reg64 reg_src, Vmm vmm_src, const int elt_num, const int offset = 0) {
emit_load(reg_src, vmm_src, ov::element::i32, ov::element::i32, elt_num, offset);
}
- inline void store(Vmm vmm_dst, Xbyak::Reg64 reg_dst, const int elt_num, const int offset = 0) {
+ void store(Vmm vmm_dst, Xbyak::Reg64 reg_dst, const int elt_num, const int offset = 0) {
emit_store(vmm_dst, reg_dst, ov::element::f32, jcp_.data_prc, elt_num, offset);
}
- inline void store_buffer(Vmm vmm_dst, Xbyak::Reg64 reg_dst, const int elt_num, const int offset = 0) {
+ void store_buffer(Vmm vmm_dst, Xbyak::Reg64 reg_dst, const int elt_num, const int offset = 0) {
emit_store(vmm_dst, reg_dst, ov::element::f32, ov::element::f32, elt_num, offset);
}
- inline void emit_load(Xbyak::Reg64 reg_src,
- Vmm vmm_src,
- ov::element::Type src_prc,
- ov::element::Type dst_prc,
- const int elt_num,
- const int offset = 0) {
+ void emit_load(Xbyak::Reg64 reg_src,
+ Vmm vmm_src,
+ ov::element::Type src_prc,
+ ov::element::Type dst_prc,
+ const int elt_num,
+ const int offset = 0) {
const auto seed = load_emitter_params(src_prc, dst_prc, elt_num).hash();
if (!emitters[seed]) {
emitters[seed] = std::make_unique<jit_load_emitter>(this, isa, src_prc, dst_prc, elt_num);
@@ -225,12 +225,12 @@ private:
{load_pool_gpr_idxs});
}
- inline void emit_store(Vmm vmm_dst,
- Xbyak::Reg64 reg_dst,
- ov::element::Type src_prc,
- ov::element::Type dst_prc,
- const int elt_num,
- const int offset = 0) {
+ void emit_store(Vmm vmm_dst,
+ Xbyak::Reg64 reg_dst,
+ ov::element::Type src_prc,
+ ov::element::Type dst_prc,
+ const int elt_num,
+ const int offset = 0) {
const auto seed = store_emitter_params(src_prc, dst_prc, elt_num).hash();
if (!emitters[seed]) {
emitters[seed] = std::make_unique<jit_store_emitter>(this, isa, src_prc, dst_prc, elt_num);
@@ -605,7 +605,7 @@ private:
}
// gather f32 data from reg_src with vmm_idx(data_size) to vmm_src with f32 precision
- inline void gather_f32(Vmm& vmm_src, const reg64_t& reg_src, const Vmm& vmm_idx) {
+ void gather_f32(Vmm& vmm_src, const reg64_t& reg_src, const Vmm& vmm_idx) {
constexpr bool is_ymm = std::is_same<Vmm, Xbyak::Ymm>::value;
constexpr bool is_zmm = std::is_same<Vmm, Xbyak::Zmm>::value;
@@ -620,7 +620,7 @@ private:
}
}
- inline void gather_f32_xmm(Xbyak::Xmm xmm_src, const reg64_t reg_src, const Xbyak::Xmm xmm_idx) {
+ void gather_f32_xmm(Xbyak::Xmm xmm_src, const reg64_t reg_src, const Xbyak::Xmm xmm_idx) {
sub(rsp, x_len);
uni_vmovdqu(ptr[rsp], xmm_idx);
for (int i = 0; i < x_step; i++) {
@@ -634,7 +634,7 @@ private:
// gather bf16 data from reg_src with vmm_idx(data_size) to vmm_src with f32 precision
// bf16 is needed from avx512_core
- inline void gather_bf16_to_f32_zmm(Vmm vmm_src, const reg64_t reg_src, const Vmm vmm_idx) {
+ void gather_bf16_to_f32_zmm(Vmm vmm_src, const reg64_t reg_src, const Vmm vmm_idx) {
if (!std::is_same<Vmm, Xbyak::Zmm>::value) {
OPENVINO_THROW("bf16 is only supported from avx512_core platform for ROIAlign node.");
}
@@ -651,7 +651,7 @@ private:
add(rsp, v_len);
}
- inline void gather_bf16_to_f32_xmm(Xbyak::Xmm xmm_src, const reg64_t reg_src, const Xbyak::Xmm xmm_idx) {
+ void gather_bf16_to_f32_xmm(Xbyak::Xmm xmm_src, const reg64_t reg_src, const Xbyak::Xmm xmm_idx) {
sub(rsp, x_len);
uni_vmovdqu(ptr[rsp], xmm_idx);
for (int i = 0; i < x_step; i++) {
@@ -665,7 +665,7 @@ private:
add(rsp, x_len);
}
- inline void horizontal_add_xmm(const Xbyak::Xmm& xmm_dst, const Xbyak::Xmm& xmm_aux) {
+ void horizontal_add_xmm(const Xbyak::Xmm& xmm_dst, const Xbyak::Xmm& xmm_aux) {
uni_vmovshdup(xmm_aux, xmm_dst); // dst:1,2,3,4; aux:2,2,4,4
uni_vaddps(xmm_dst, xmm_dst, xmm_aux); // dst:1+2,2+2,3+4,4+4
uni_vmovhlps(xmm_aux, xmm_aux, xmm_dst); // aux:3+4,4+4,4,4
@@ -673,7 +673,7 @@ private:
}
// horizontal add for vmm_dst, temp1 and temp2 as aux
- inline void horizontal_add() {
+ void horizontal_add() {
auto xmm_dst = Xbyak::Xmm(vmm_dst.getIdx());
auto xmm_temp1 = Xbyak::Xmm(vmm_temp1.getIdx());
auto xmm_temp2 = Xbyak::Xmm(vmm_temp2.getIdx());
@@ -1009,8 +1009,8 @@ void ROIAlign::executeSpecified() {
float roiHeight = y2 - y1;
float roiWidth = x2 - x1;
if (!aligned) {
- roiHeight = std::max(roiHeight, 1.0f);
- roiWidth = std::max(roiWidth, 1.0f);
+ roiHeight = std::max(roiHeight, 1.0F);
+ roiWidth = std::max(roiWidth, 1.0F);
}
float binHeight = roiHeight / pooledH;
float binWidth = roiWidth / pooledW;
@@ -1025,7 +1025,7 @@ void ROIAlign::executeSpecified() {
float sampleDistanceY = binHeight / samplingRatioY;
// prepare arrays for sampling points and weights
size_t paramsSize = BLIParamsNum * numSamplesInBin * binCount;
- weightsTbl[n] = std::vector<float>(paramsSize, 0.f);
+ weightsTbl[n] = std::vector<float>(paramsSize, 0.F);
if (!isPlainFmt) {
srcAddressListTbl[n] = std::vector<size_t>(paramsSize, 0);
} else {
@@ -1045,9 +1045,9 @@ void ROIAlign::executeSpecified() {
for (int xBinInd = 0; xBinInd < pooledW; ++xBinInd) {
// run into bin
for (int ySampleInd = 0; ySampleInd < samplingRatioY; ySampleInd++) {
- float sampleY = y1 + yBinInd * binHeight + sampleDistanceY * (0.5f + ySampleInd);
+ float sampleY = y1 + yBinInd * binHeight + sampleDistanceY * (0.5F + ySampleInd);
for (int xSampleInd = 0; xSampleInd < samplingRatioX; xSampleInd++) {
- float sampleX = x1 + xBinInd * binWidth + sampleDistanceX * (0.5f + xSampleInd);
+ float sampleX = x1 + xBinInd * binWidth + sampleDistanceX * (0.5F + xSampleInd);
if (sampleX < -1.0 || sampleX > W || sampleY < -1.0 || sampleY > H) {
// For this sample we save 4 index of (0,0) and 4 weight of 0
if (!isPlainFmt) {
@@ -1061,7 +1061,7 @@ void ROIAlign::executeSpecified() {
}
}
for (int i = 0; i < BLIParamsNum; i++) {
- weightsTbl[n][idxIter + i] = 0.f;
+ weightsTbl[n][idxIter + i] = 0.F;
}
idxIter += BLIParamsNum;
continue;
@@ -1109,8 +1109,8 @@ void ROIAlign::executeSpecified() {
// weight calculation for bilinear interpolation
auto ly = sampleY - sampleYLow;
auto lx = sampleX - sampleXLow;
- auto hy = 1.0f - ly;
- auto hx = 1.0f - lx;
+ auto hy = 1.0F - ly;
+ auto hx = 1.0F - lx;
weightsTbl[n][idxIter] = hy * hx;
weightsTbl[n][idxIter + 1] = hy * lx;
@@ -1133,7 +1133,7 @@ void ROIAlign::executeSpecified() {
std::vector<float> workingBuf;
int bufSize = rnd_up(C, 16);
size_t threadsNum = parallel_get_max_threads();
- workingBuf.resize(bufSize * threadsNum, 0.f);
+ workingBuf.resize(bufSize * threadsNum, 0.F);
auto rhw_loop = [&](int n, int yBinInd, int xBinInd) {
int numSamplesROI = numSamples[n];
// each sample have 4 values for srcAddressList and weight
@@ -1145,7 +1145,7 @@ void ROIAlign::executeSpecified() {
arg.weights = static_cast<const float*>(&weightsTbl[n][binOffset]);
arg.work_amount = C;
arg.num_samples = numSamplesROI;
- float numSamplesInBinInvert = 1.f / numSamplesROI;
+ float numSamplesInBinInvert = 1.F / numSamplesROI;
arg.scale = static_cast<const float*>(&numSamplesInBinInvert);
auto* threadBuf = static_cast<float*>(
&workingBuf[static_cast<size_t>(parallel_get_thread_num()) * static_cast<size_t>(bufSize)]);
@@ -1176,7 +1176,7 @@ void ROIAlign::executeSpecified() {
// buffer with absolute index
arg.buffer = static_cast<void*>(&srcIndexTbl[n][paramOffset]);
arg.weights = static_cast<const float*>(&weightsTbl[n][paramOffset]);
- float numSamplesInBinInvert = 1.f / numSamplesROI;
+ float numSamplesInBinInvert = 1.F / numSamplesROI;
arg.scale = static_cast<const float*>(&numSamplesInBinInvert);
arg.num_samples = numSamplesROI;
(*roi_align_kernel)(&arg);
@@ -1191,7 +1191,7 @@ void ROIAlign::executeSpecified() {
size_t binOffset = yBinInd * pooledW + xBinInd;
size_t binDstOffset = n * batchOutputStride + cIdx * binCount + binOffset;
int paramOffset = binOffset * BLIParamsNum * numSamplesROI;
- float numSamplesInBinInvert = 1.f / numSamplesROI;
+ float numSamplesInBinInvert = 1.F / numSamplesROI;
float pooledValue = 0;
for (auto binSampleInd = 0; binSampleInd < numSamplesROI; binSampleInd++) {
diff --git a/src/plugins/intel_cpu/src/nodes/roi_align_rotated.cpp b/src/plugins/intel_cpu/src/nodes/roi_align_rotated.cpp
index 6b477dfc830..1d76a03bd6a 100644
--- a/src/plugins/intel_cpu/src/nodes/roi_align_rotated.cpp
+++ b/src/plugins/intel_cpu/src/nodes/roi_align_rotated.cpp
@@ -98,7 +98,7 @@ void ROIAlignRotated::executeImpl() {
clockwiseMode);
}
-void ROIAlignRotated::execute(const dnnl::stream&) {
+void ROIAlignRotated::execute(const dnnl::stream& /*strm*/) {
const ov::element::Type type = getOriginalInputPrecisionAtPort(0);
executeImpl<ov::element::f32>();
diff --git a/src/plugins/intel_cpu/src/nodes/roi_pooling.cpp b/src/plugins/intel_cpu/src/nodes/roi_pooling.cpp
index 324833be726..0e03fde2bfb 100644
--- a/src/plugins/intel_cpu/src/nodes/roi_pooling.cpp
+++ b/src/plugins/intel_cpu/src/nodes/roi_pooling.cpp
@@ -652,7 +652,10 @@ 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, hend, wstart, wend;
+ int hstart;
+ int hend;
+ int wstart;
+ int wend;
std::tie(hstart, hend, wstart, wend) = getBordersForMaxMode(roi_start_h,
roi_end_h,
roi_start_w,
@@ -678,7 +681,8 @@ private:
float roi_end_w_ = src_roi_ptr[3];
float roi_end_h_ = src_roi_ptr[4];
- float in_x, in_y;
+ float in_x;
+ float in_y;
std::tie(in_x, in_y) = getXYForBilinearMode(roi_start_h_,
roi_end_h_,
roi_start_w_,
@@ -793,7 +797,10 @@ 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, hend, wstart, wend;
+ int hstart;
+ int hend;
+ int wstart;
+ int wend;
std::tie(hstart, hend, wstart, wend) = getBordersForMaxMode(roi_start_h,
roi_end_h,
roi_start_w,
@@ -836,7 +843,8 @@ public:
float roi_end_w_ = src_roi_ptr[3];
float roi_end_h_ = src_roi_ptr[4];
- float in_x, in_y;
+ float in_x;
+ float in_y;
std::tie(in_x, in_y) = getXYForBilinearMode(roi_start_h_,
roi_end_h_,
roi_start_w_,
@@ -977,7 +985,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, in_x;
+ float in_y;
+ float in_x;
// 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/roi_pooling.h b/src/plugins/intel_cpu/src/nodes/roi_pooling.h
index 118c508e5a2..213f91a8a30 100644
--- a/src/plugins/intel_cpu/src/nodes/roi_pooling.h
+++ b/src/plugins/intel_cpu/src/nodes/roi_pooling.h
@@ -108,26 +108,26 @@ private:
static std::shared_ptr<ROIPoolingExecutor> createROIPoolingNewExecutor(const jit_roi_pooling_params& jpp);
protected:
- std::tuple<int, int, int, int> getBordersForMaxMode(const int roi_start_h,
- const int roi_end_h,
- const int roi_start_w,
- const int roi_end_w,
+ static std::tuple<int, int, int, int> getBordersForMaxMode(const int roi_start_h,
+ const int roi_end_h,
+ const int roi_start_w,
+ const int roi_end_w,
+ const int ih,
+ const int oh,
+ const int iw,
+ const int ow,
+ const int pooled_h,
+ const int pooled_w);
+ static std::pair<float, float> getXYForBilinearMode(const float roi_start_h,
+ const float roi_end_h,
+ const float roi_start_w,
+ const float roi_end_w,
const int ih,
const int oh,
const int iw,
const int ow,
const int pooled_h,
const int pooled_w);
- std::pair<float, float> getXYForBilinearMode(const float roi_start_h,
- const float roi_end_h,
- const float roi_start_w,
- const float roi_end_w,
- const int ih,
- const int oh,
- const int iw,
- const int ow,
- const int pooled_h,
- const int pooled_w);
private:
template <typename T>
diff --git a/src/plugins/intel_cpu/src/nodes/roll.cpp b/src/plugins/intel_cpu/src/nodes/roll.cpp
index a7df878db17..a4f3fc38538 100644
--- a/src/plugins/intel_cpu/src/nodes/roll.cpp
+++ b/src/plugins/intel_cpu/src/nodes/roll.cpp
@@ -190,7 +190,7 @@ Roll::RollExecutor::RollExecutor(const VectorDims& dataDims,
const VectorDims& dstDims)
: numOfDims{dataDims.size()},
blockSize{dataDims.back()},
- numOfIterations{std::accumulate(dataDims.cbegin(), dataDims.cend(), 1ul, std::multiplies<>()) / blockSize},
+ numOfIterations{std::accumulate(dataDims.cbegin(), dataDims.cend(), 1UL, std::multiplies<>()) / blockSize},
axesLength{axesDims[0]} {
for (size_t i = 0; i < dataDims.size(); ++i) {
if (dataDims[i] != dstDims[i]) {
@@ -213,7 +213,7 @@ void Roll::RollExecutor::exec(const MemoryPtr& dataMemPtr,
const auto* axes = axesMemPtr->getDataAs<const int32_t>();
auto* dst = dstMemPtr->getDataAs<T>();
- std::vector<size_t> shiftsVector(numOfDims, 0ul);
+ std::vector<size_t> shiftsVector(numOfDims, 0UL);
const VectorDims& dataDims = dataMemPtr->getStaticDims();
for (size_t dim = 0; dim < axesLength; ++dim) {
@@ -261,6 +261,4 @@ bool Roll::created() const {
return getType() == Type::Roll;
}
-constexpr std::array<size_t, 3> Roll::supportedPrecisionSizes;
-
} // namespace ov::intel_cpu::node
diff --git a/src/plugins/intel_cpu/src/nodes/rope.cpp b/src/plugins/intel_cpu/src/nodes/rope.cpp
index eb5be64ac67..5b9e68defd1 100644
--- a/src/plugins/intel_cpu/src/nodes/rope.cpp
+++ b/src/plugins/intel_cpu/src/nodes/rope.cpp
@@ -472,7 +472,8 @@ void RoPE::initSupportedPrimitiveDescriptors() {
}
void RoPE::execute(const dnnl::stream& strm) {
- std::vector<MemoryPtr> inputs(getParentEdges().size()), outputs(getChildEdges().size());
+ std::vector<MemoryPtr> inputs(getParentEdges().size());
+ std::vector<MemoryPtr> outputs(getChildEdges().size());
for (size_t i = 0; i < inputs.size(); i++) {
inputs[i] = getSrcMemoryAtPort(i);
}
diff --git a/src/plugins/intel_cpu/src/nodes/scaled_attn.cpp b/src/plugins/intel_cpu/src/nodes/scaled_attn.cpp
index 70882802880..08c62ec7290 100644
--- a/src/plugins/intel_cpu/src/nodes/scaled_attn.cpp
+++ b/src/plugins/intel_cpu/src/nodes/scaled_attn.cpp
@@ -60,7 +60,6 @@
#include "kernels/scaled_attn/softmax.hpp"
#include "kernels/x64/brgemm_kernel.hpp"
#include "nodes/common/cpu_convert.h"
-#include "utils/plain_tensor.hpp"
#include "utils/precision_support.h"
using namespace ov::Extensions::Cpu::XARCH;
@@ -113,19 +112,19 @@ struct MHAKernel {
void softmax(float* a, int len) {
float max = *std::max_element(a, a + len);
- float sum = 0.0f;
+ float sum = 0.0F;
for (int i = 0; i < len; i++) {
a[i] = exp(a[i] - max);
sum += a[i];
}
- float scale = 1.0f / sum;
+ float scale = 1.0F / sum;
for (int i = 0; i < len; i++) {
a[i] *= scale;
}
}
template <typename D>
- void accumulate(float* acc, const D* v, int len, float weight = 1.0f) {
+ void accumulate(float* acc, const D* v, int len, float weight = 1.0F) {
for (int i = 0; i < len; i++) {
acc[i] += static_cast<float>(v[i]) * weight;
}
@@ -153,7 +152,7 @@ struct MHAKernel {
PlainTensor& output_emb,
bool has_out_transpose,
bool auto_causal,
- float d_scale = 0.0f) {
+ float d_scale = 0.0F) {
auto B = query.size(0);
auto H = query.size(1);
auto q_len = query.size(2);
@@ -162,15 +161,15 @@ struct MHAKernel {
auto kv_len = present_key.size(2);
auto Hk = present_key.size(1);
size_t h_each_group_len = H / Hk;
- if (d_scale == 0.0f) {
- d_scale = 1.0f / sqrt(head_size);
+ if (d_scale == 0.0F) {
+ d_scale = 1.0F / sqrt(head_size);
}
auto k_stride_s = present_key.stride(3);
parallel_for2d(B, H, [&](size_t b, size_t h) {
std::vector<float> attn_score(kv_len);
- std::vector<float> word_vec(head_size_v, 0.0f);
+ std::vector<float> word_vec(head_size_v, 0.0F);
for (size_t m = 0; m < q_len; m++) {
// dot-product to get attention scores
@@ -211,10 +210,10 @@ struct MHAKernel {
}
// softmax
- softmax(&attn_score[0], ncausal);
+ softmax(attn_score.data(), ncausal);
// linearly combine value
- word_vec.assign(head_size_v, 0.0f);
+ word_vec.assign(head_size_v, 0.0F);
for (size_t n = 0; n < ncausal; n++) {
auto* v = &present_value.at<T>({b, h / h_each_group_len, n, 0}, true);
accumulate(word_vec.data(), v, head_size_v, attn_score[n]);
@@ -246,7 +245,7 @@ struct MHAKernel<ScaledDotProductAttention::KT_ONEDNN, T> {
size_t wsp_size_per_thread = 0;
using tag = dnnl::memory::format_tag;
using dt = dnnl::memory::data_type;
- size_t m_threads_num = 0lu;
+ size_t m_threads_num = 0LU;
struct brgemmKey {
size_t M;
size_t N;
@@ -370,7 +369,6 @@ struct MHAKernel<ScaledDotProductAttention::KT_ONEDNN, T> {
} else {
fp32_out.resize<float>({B, H, q_len, head_size_v});
}
- return;
}
void execute_brgemm(PlainTensor& query,
@@ -381,7 +379,7 @@ struct MHAKernel<ScaledDotProductAttention::KT_ONEDNN, T> {
PlainTensor& output_emb,
bool has_out_transpose,
bool auto_causal,
- float d_scale = 0.0f) {
+ float d_scale = 0.0F) {
const auto B = query.size(0);
const auto H = query.size(1);
const auto q_len = query.size(2);
@@ -528,10 +526,10 @@ struct MHAKernel<ScaledDotProductAttention::KT_ONEDNN, T> {
PlainTensor& output_emb,
bool has_out_transpose,
bool auto_causal,
- float d_scale = 0.0f) {
+ float d_scale = 0.0F) {
auto head_size = query.size(3);
- if (d_scale == 0.0f) {
- d_scale = 1.0f / sqrt(head_size);
+ if (d_scale == 0.0F) {
+ d_scale = 1.0F / sqrt(head_size);
}
prepare_brgemm_prim(strm, query, present_key, present_value, has_out_transpose);
@@ -699,7 +697,7 @@ struct MHAKernel<ScaledDotProductAttention::KT_MLAS, float> {
size_t m_block_size;
// buffer to hold qk temp
std::vector<PlainTensor> qk_buffers;
- size_t m_threads_num = 0lu;
+ size_t m_threads_num = 0LU;
MHAKernel() = delete;
explicit MHAKernel(GraphContext::CPtr ctx)
@@ -732,7 +730,7 @@ struct MHAKernel<ScaledDotProductAttention::KT_MLAS, float> {
PlainTensor& output_emb,
bool has_out_transpose,
bool auto_causal,
- float d_scale = 0.0f) {
+ float d_scale = 0.0F) {
auto B = query.size(0);
auto H = query.size(1);
auto q_len = query.size(2);
@@ -742,8 +740,8 @@ struct MHAKernel<ScaledDotProductAttention::KT_MLAS, float> {
auto h_group_num = present_key.size(1);
size_t h_each_group_len = H / h_group_num;
- if (d_scale == 0.0f) {
- d_scale = 1.0f / sqrt(head_size);
+ if (d_scale == 0.0F) {
+ d_scale = 1.0F / sqrt(head_size);
}
auto k_stride_s = present_key.stride(3);
@@ -800,12 +798,12 @@ struct MHAKernel<ScaledDotProductAttention::KT_MLAS, float> {
m_cnt,
kv_len,
head_size,
- 1.0f,
+ 1.0F,
q_ptr,
query.stride(2),
k_ptr,
present_key.stride(2),
- 0.f,
+ 0.F,
qk,
qk_m_stride,
1);
@@ -815,12 +813,12 @@ struct MHAKernel<ScaledDotProductAttention::KT_MLAS, float> {
m_cnt,
kv_len,
head_size,
- 1.0f,
+ 1.0F,
q_ptr,
query.stride(2),
k_ptr,
present_key.stride(3),
- 0.f,
+ 0.F,
qk,
qk_m_stride,
1);
@@ -847,12 +845,12 @@ struct MHAKernel<ScaledDotProductAttention::KT_MLAS, float> {
m_cnt,
head_size_v,
kv_len,
- 1.0f,
+ 1.0F,
qk,
qk_m_stride,
v_ptr,
present_value.stride(2),
- 0.f,
+ 0.F,
has_out_transpose ? &output_emb.at<float>({b, m_start, h * head_size_v})
: &output_emb.at<float>({b, h, m_start}),
has_out_transpose ? output_emb.stride(1) : output_emb.stride(2),
@@ -948,7 +946,7 @@ struct ScaledDotProductAttention::AttentionExecutor : public ScaledDotProductAtt
attn_buf.resize<float>(attn_input->getStaticDims());
auto* p = attn_input->getDataAs<uint8_t>();
for (size_t i = 0; i < attn_input->getSize(); i++) {
- attn_buf.ptr<float>()[i] = p[i] ? 0.0f : -FLT_MAX;
+ attn_buf.ptr<float>()[i] = p[i] ? 0.0F : -FLT_MAX;
}
}
@@ -967,15 +965,20 @@ struct ScaledDotProductAttention::AttentionExecutor : public ScaledDotProductAtt
bool is_causal = config.config.is_causal;
bool fuse_concat = config.config.fuse_concat;
auto input_num = inputs.size();
- PlainTensor present_key, present_value;
+ PlainTensor present_key;
+ PlainTensor present_value;
PlainTensor q_input; // f32[B, H, L1, S]
PlainTensor k_input; // f32[B, H|1, L1, S] / [B, H|1, L0+L1, S]
PlainTensor v_input; // f32[B, H|1, L1, S] / [B, H|1, L0+L1, S]
PlainTensor beam_table; // i32[B, max_kvLen]
PlainTensor attn_mask;
PlainTensor output_emb(output);
- float scale_input = 0.0f;
- size_t B, L1, L0, S, SV;
+ float scale_input = 0.0F;
+ size_t B;
+ size_t L1;
+ size_t L0;
+ size_t S;
+ size_t SV;
// B,L,H*S->B,L,H,S
auto get_reshape_shape = [&config](const PlainTensor& input) {
@@ -1336,12 +1339,15 @@ void ScaledDotProductAttention::execute(const dnnl::stream& strm) {
auto orginSDPInputNumber = getOriginalInputsNumber() - (m_config.config.fuse_concat ? 3 : 0);
std::vector<MemoryPtr> inputs(orginSDPInputNumber);
auto output = getDstMemoryAtPort(0);
- MemoryPtr presentk_input, presentv_input, beam_input;
+ MemoryPtr presentk_input;
+ MemoryPtr presentv_input;
+ MemoryPtr beam_input;
for (size_t i = 0; i < orginSDPInputNumber; i++) {
inputs[i] = getSrcMemoryAtPort(i);
}
- PlainTensor k_scale_zp, v_scale_zp;
+ PlainTensor k_scale_zp;
+ PlainTensor v_scale_zp;
if (m_config.config.fuse_concat) {
CPU_NODE_ASSERT(m_k_state && m_v_state, "has null input states");
// initialization will be also completed in this func
@@ -1373,13 +1379,13 @@ bool ScaledDotProductAttention::isSupportedOperation(const std::shared_ptr<const
auto inRank = op->get_input_partial_shape(0).size();
if (sdpaWithTransposeReshapeOp) {
// inRank expect shape of q: [B, L, H*S]
- if (inRank != 3u) {
+ if (inRank != 3U) {
errorMessage = "Doesn't support 'data' input with rank: " + std::to_string(inRank);
return false;
}
} else {
// inRank expect shape of q: [B, H, L, S]
- if (inRank != 4u) {
+ if (inRank != 4U) {
errorMessage = "Doesn't support 'data' input with rank: " + std::to_string(inRank);
return false;
}
@@ -1394,7 +1400,7 @@ bool ScaledDotProductAttention::isSupportedOperation(const std::shared_ptr<const
}
if (orgSDPAInput > 3) {
inRank = op->get_input_partial_shape(3).size();
- if (inRank > 4u) {
+ if (inRank > 4U) {
errorMessage = "Doesn't support 'attention mask' with rank: " + std::to_string(inRank);
return false;
}
@@ -1445,7 +1451,8 @@ void ScaledDotProductAttention::resetBeamTablePastkv(const MemoryPtr& mem_cur_k,
// order aims to permute input shape to BHLS
// real_order aims to permute input shape to LBHS
const std::vector<size_t> real_order = getKVCacheOrder();
- PlainTensor beam_idx, old_beam_table_k;
+ PlainTensor beam_idx;
+ PlainTensor old_beam_table_k;
auto old_hidden_state_k = m_k_state->hidden_state_mem();
beam_idx.reset(mem_beam_idx);
@@ -1505,7 +1512,10 @@ void ScaledDotProductAttention::resetBeamTablePastkv(const MemoryPtr& mem_cur_k,
real_order);
auto new_internal_mem_v = std::make_shared<Memory>(getEngine(), mem_desc_v);
- PlainTensor new_pastk, new_pastv, old_past_k, old_past_v;
+ PlainTensor new_pastk;
+ PlainTensor new_pastv;
+ PlainTensor old_past_k;
+ PlainTensor old_past_v;
new_pastk.reset(new_internal_mem_k);
new_pastv.reset(new_internal_mem_v);
new_pastk = new_pastk.permute(order);
@@ -1531,7 +1541,8 @@ void ScaledDotProductAttention::resetBeamTablePastkv(const MemoryPtr& mem_cur_k,
if (kvcache_precision == ov::element::u8) {
auto& old_scale_zp_k = m_k_state->get_scale_zp();
auto& old_scale_zp_v = m_v_state->get_scale_zp();
- PlainTensor new_scale_zp_k, new_scale_zp_v;
+ PlainTensor new_scale_zp_k;
+ PlainTensor new_scale_zp_v;
auto get_scale_zp_shape = [&](const SDPAQuantParam& quant_param, const size_t hidden_states) {
std::vector<size_t> shape;
if (quant_param.isByChannel) {
@@ -1642,7 +1653,8 @@ void ScaledDotProductAttention::resetBeamTablePastkv(const MemoryPtr& mem_cur_k,
auto new_hidden_state_k = std::make_shared<Memory>(getEngine(), mem_desc);
auto new_hidden_state_v = std::make_shared<Memory>(getEngine(), mem_desc);
- PlainTensor new_beam_table_k, new_beam_table_v;
+ PlainTensor new_beam_table_k;
+ PlainTensor new_beam_table_v;
new_beam_table_k.reset(new_hidden_state_k);
new_beam_table_v.reset(new_hidden_state_v);
@@ -1705,7 +1717,9 @@ void ScaledDotProductAttention::updateBeamTable(const MemoryPtr& mem_beam_idx, s
if (!m_config.config.permute_axes.empty()) {
order = m_config.config.permute_axes;
}
- PlainTensor beam_idx, beam_table_k, beam_table_v;
+ PlainTensor beam_idx;
+ PlainTensor beam_table_k;
+ PlainTensor beam_table_v;
auto hidden_state_k = m_k_state->hidden_state_mem();
auto hidden_state_v = m_v_state->hidden_state_mem();
beam_idx.reset(mem_beam_idx);
@@ -1728,7 +1742,8 @@ void ScaledDotProductAttention::updateBeamTable(const MemoryPtr& mem_beam_idx, s
auto new_hidden_state_k = std::make_shared<Memory>(getEngine(), mem_desc);
auto new_hidden_state_v = std::make_shared<Memory>(getEngine(), mem_desc);
- PlainTensor new_beam_table_k, new_beam_table_v;
+ PlainTensor new_beam_table_k;
+ PlainTensor new_beam_table_v;
new_beam_table_k.reset(new_hidden_state_k);
new_beam_table_v.reset(new_hidden_state_v);
if (L0 > 0 && !is_reset) {
@@ -1842,8 +1857,10 @@ void ScaledDotProductAttention::updatePastkv(const MemoryPtr& mem_cur_k, const M
}
// order aims to pemute input to B, H, L, S, but the real layout of past key value here is L, B, H, S
std::vector<size_t> real_order = {order[2], order[0], order[1], order[3]};
- PlainTensor cur_k, past_k;
- PlainTensor cur_v, past_v;
+ PlainTensor cur_k;
+ PlainTensor past_k;
+ PlainTensor cur_v;
+ PlainTensor past_v;
cur_k.reset(mem_cur_k);
cur_v.reset(mem_cur_v);
cur_k = cur_k.permute(order);
@@ -1888,7 +1905,8 @@ void ScaledDotProductAttention::updatePastkv(const MemoryPtr& mem_cur_k, const M
auto new_internal_mem_k = new_memory(S);
auto new_internal_mem_v = new_memory(SV);
- PlainTensor new_pastk, new_pastv;
+ PlainTensor new_pastk;
+ PlainTensor new_pastv;
new_pastk.reset(new_internal_mem_k);
new_pastv.reset(new_internal_mem_v);
new_pastk = new_pastk.permute(order);
@@ -1911,7 +1929,8 @@ void ScaledDotProductAttention::updatePastkv(const MemoryPtr& mem_cur_k, const M
if (kvcache_precision == ov::element::u8) {
auto& old_scale_zp_k = m_k_state->get_scale_zp();
auto& old_scale_zp_v = m_v_state->get_scale_zp();
- PlainTensor new_scale_zp_k, new_scale_zp_v;
+ PlainTensor new_scale_zp_k;
+ PlainTensor new_scale_zp_v;
auto get_scale_zp_shape = [&](const SDPAQuantParam& quant_param, const size_t hidden_states) {
std::vector<size_t> shape;
if (quant_param.isByChannel) {
@@ -2024,7 +2043,8 @@ void ScaledDotProductAttention::updatePastkv(const MemoryPtr& mem_cur_k, const M
auto&& k_shape = k_mem->getShape();
auto&& v_shape = v_mem->getShape();
if (!k_shape.hasZeroDims() && !v_shape.hasZeroDims()) {
- PlainTensor init_k, init_v;
+ PlainTensor init_k;
+ PlainTensor init_v;
init_k.reset(k_mem);
init_v.reset(v_mem);
init_k = init_k.permute(order);
diff --git a/src/plugins/intel_cpu/src/nodes/scatter_update.cpp b/src/plugins/intel_cpu/src/nodes/scatter_update.cpp
index ab26ff0b57f..634f7816418 100644
--- a/src/plugins/intel_cpu/src/nodes/scatter_update.cpp
+++ b/src/plugins/intel_cpu/src/nodes/scatter_update.cpp
@@ -101,9 +101,9 @@ bool ScatterUpdate::isExecutable() const {
ScatterUpdate::ScatterUpdate(const std::shared_ptr<ov::Node>& op, const GraphContext::CPtr& context)
: Node(op, context, NgraphShapeInferFactory(op)),
- dataSize(0lu),
- indicesSize(0lu),
- axisSize(0lu),
+ dataSize(0LU),
+ indicesSize(0LU),
+ axisSize(0LU),
dataPrec(ov::element::dynamic),
indicesPrec(ov::element::dynamic),
axisPrec(ov::element::dynamic) {
@@ -346,7 +346,7 @@ void ScatterUpdate::executeDynamicImpl(const dnnl::stream& strm) {
execute(strm);
}
-int64_t ScatterUpdate::getIndicesValue(uint8_t* indices, size_t offset) {
+int64_t ScatterUpdate::getIndicesValue(uint8_t* indices, size_t offset) const {
auto* indicesPtr = indices + offset * indicesSize;
int64_t ret = 0;
if (indicesSize == 4) {
@@ -413,7 +413,9 @@ struct TensorIterator {
m_tensorIter.resize(m_squashed_shape.size(), 0);
getCoordinate(m_tensorIter, start, m_squashed_shape);
- size_t i, dst_idx = 0, indices_idx = 0;
+ size_t i;
+ size_t dst_idx = 0;
+ size_t indices_idx = 0;
for (i = 0; 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];
@@ -601,7 +603,8 @@ void ScatterUpdate::scatterElementsUpdate(const MemoryPtr& mem_data,
// process serially along 'axis' dimension because of data dependency brought by duplicated value in indices
parallel_nt(0, [&](const int ithr, const int nthr) {
- size_t start = 0, end = 0;
+ size_t start = 0;
+ size_t end = 0;
splitter(shape_size(squashed_indices_shape), nthr, ithr, start, end);
scatter_elements_update::TensorIterator tensorItr(squashed_indices_shape, axis);
@@ -655,8 +658,8 @@ void ScatterUpdate::scatterElementsUpdate(const MemoryPtr& mem_data,
end - start + 1,
offsets[0]); // one extra to avoid overflow at the last iteration of inner loop
std::vector<size_t> indices_offsets(end - start + 1, offsets[1]);
- size_t* ptr_dst_offset = &dst_offsets[0];
- size_t* ptr_indices_offset = &indices_offsets[0];
+ size_t* ptr_dst_offset = dst_offsets.data();
+ size_t* ptr_indices_offset = indices_offsets.data();
for (size_t worker = start; worker < end; worker++) { // idx = 0
int64_t idxValue = getIndicesValue(indicesPtr, *ptr_indices_offset);
if (idxValue < 0) {
@@ -673,8 +676,8 @@ void ScatterUpdate::scatterElementsUpdate(const MemoryPtr& mem_data,
*++ptr_indices_offset = offsets[1];
}
for (size_t idx = 1; idx < index_dim_size; idx++) {
- ptr_indices_offset = &indices_offsets[0];
- ptr_dst_offset = &dst_offsets[0];
+ ptr_indices_offset = indices_offsets.data();
+ ptr_dst_offset = dst_offsets.data();
for (size_t worker = start; worker < end; worker++) {
auto indices_offset = *ptr_indices_offset + idx * indicesBlock_axisplus1;
int64_t idxValue = getIndicesValue(indicesPtr, indices_offset);
@@ -729,7 +732,8 @@ void ScatterUpdate::scatterElementsUpdate(const MemoryPtr& mem_data,
// process serially along 'axis' dimension because of data dependency brought by duplicated value in indices
parallel_nt(0, [&](const int ithr, const int nthr) {
- size_t start = 0, end = 0;
+ size_t start = 0;
+ size_t end = 0;
splitter(shape_size(squashed_indices_shape), nthr, ithr, start, end);
scatter_elements_update::TensorIterator tensorItr(squashed_indices_shape, axis);
@@ -797,8 +801,8 @@ void ScatterUpdate::scatterElementsUpdate(const MemoryPtr& mem_data,
end - start + 1,
offsets[0]); // one extra to avoid overflow at the last iteration of inner loop
std::vector<size_t> indices_offsets(end - start + 1, offsets[1]);
- size_t* ptr_dst_offset = &dst_offsets[0];
- size_t* ptr_indices_offset = &indices_offsets[0];
+ size_t* ptr_dst_offset = dst_offsets.data();
+ size_t* ptr_indices_offset = indices_offsets.data();
for (size_t worker = start; worker < end; worker++) { // idx = 0
int64_t idxValue = getIndicesValue(indicesPtr, *ptr_indices_offset);
if (idxValue < 0) {
@@ -817,8 +821,8 @@ void ScatterUpdate::scatterElementsUpdate(const MemoryPtr& mem_data,
*++ptr_indices_offset = offsets[1];
}
for (size_t idx = 1; idx < index_dim_size; idx++) {
- ptr_indices_offset = &indices_offsets[0];
- ptr_dst_offset = &dst_offsets[0];
+ ptr_indices_offset = indices_offsets.data();
+ ptr_dst_offset = dst_offsets.data();
for (size_t worker = start; worker < end; worker++) {
auto indices_offset = *ptr_indices_offset + idx * indicesBlock_axisplus1;
int64_t idxValue = getIndicesValue(indicesPtr, indices_offset);
@@ -920,7 +924,8 @@ void ScatterUpdate::execute([[maybe_unused]] const dnnl::stream& strm) {
size_t srcDimAxis = srcDataDim[axis];
std::vector<size_t> indicesBlockND = getBlockND(indicesDim);
parallel_nt(0, [&](const int ithr, const int nthr) {
- size_t start = 0, end = 0;
+ size_t start = 0;
+ size_t end = 0;
splitter(indicesBlockND[0], nthr, ithr, start, end);
for (size_t i = start; i < end; i++) {
int64_t idxValue = getIndicesValue(indicesPtr, i);
@@ -966,7 +971,8 @@ void ScatterUpdate::execute([[maybe_unused]] const dnnl::stream& strm) {
if (srcPtr != dstPtr) {
std::vector<size_t> srcBlockND = getBlockND(srcDataDim);
parallel_nt(0, [&](const int ithr, const int nthr) {
- size_t start = 0, end = 0;
+ size_t start = 0;
+ size_t end = 0;
splitter(srcBlockND[0], nthr, ithr, start, end);
size_t size = (end - start) * dataSize;
start *= dataSize;
diff --git a/src/plugins/intel_cpu/src/nodes/scatter_update.h b/src/plugins/intel_cpu/src/nodes/scatter_update.h
index 45dd39694ae..ab59f9763fd 100644
--- a/src/plugins/intel_cpu/src/nodes/scatter_update.h
+++ b/src/plugins/intel_cpu/src/nodes/scatter_update.h
@@ -130,7 +130,7 @@ private:
const MemoryPtr& indicesMemPtr,
const MemoryPtr& updateMemPtr,
int axis);
- inline int64_t getIndicesValue(uint8_t* indices, size_t offset);
+ inline int64_t getIndicesValue(uint8_t* indices, size_t offset) const;
ScatterUpdateMode scatterUpdateMode = ScatterUpdateMode::ScatterUpdate;
enum { DATA_ID, INDICES_ID, UPDATE_ID, AXIS_ID };
diff --git a/src/plugins/intel_cpu/src/nodes/space_to_batch.cpp b/src/plugins/intel_cpu/src/nodes/space_to_batch.cpp
index 09d7beabeee..6a588be9140 100644
--- a/src/plugins/intel_cpu/src/nodes/space_to_batch.cpp
+++ b/src/plugins/intel_cpu/src/nodes/space_to_batch.cpp
@@ -160,7 +160,7 @@ void SpaceToBatch::SpaceToBatchKernel() {
}
const auto outBlkDims = dstMem->getDescWithType<BlockedMemoryDesc>()->getBlockDims();
- const int64_t blockSize = blocked ? outBlkDims.back() : 1lu;
+ const int64_t blockSize = blocked ? outBlkDims.back() : 1LU;
const int64_t blockCountInput = outBlkDims[1];
const int64_t blockCountOutput = srcMem->getDescWithType<BlockedMemoryDesc>()->getBlockDims()[1];
const int64_t blockRemainder = inShape5D[1] % blockSize;
@@ -179,7 +179,8 @@ void SpaceToBatch::SpaceToBatchKernel() {
const int64_t workAmount = inShape5D[0] * channels;
parallel_nt(0, [&](const int ithr, const int nthr) {
- int64_t start(0lu), end(0lu);
+ int64_t start(0LU);
+ int64_t end(0LU);
splitter(workAmount, nthr, ithr, start, end);
std::vector<int64_t> indxStart(2, 0);
std::vector<int64_t> indxEnd(2, 0);
@@ -199,7 +200,7 @@ void SpaceToBatch::SpaceToBatchKernel() {
bIdx /= blockShapeIn[dimsSize - 1];
oAdd[3] = bIdx % blockShapeIn[dimsSize - 2] - padsBeginIn[dimsSize - 2];
bIdx /= blockShapeIn[dimsSize - 2];
- oAdd[2] = dimsSize == 5 ? bIdx % blockShapeIn[2] - padsBeginIn[2] : 0lu;
+ oAdd[2] = dimsSize == 5 ? bIdx % blockShapeIn[2] - padsBeginIn[2] : 0LU;
bIdx = dimsSize == 5 ? bIdx / blockShapeIn[2] : bIdx;
oAdd[1] = bIdx % blockShapeIn[1] - padsBeginIn[1];
if (srcMem->getDesc().hasLayoutType(LayoutType::nspc)) {
@@ -214,8 +215,8 @@ void SpaceToBatch::SpaceToBatchKernel() {
finish[3] = (outShape5D[3] - 1 - oAdd[3]) / blockShape[3];
begin[4] = (blockShape[4] - 1 - oAdd[4]) / blockShape[4];
finish[4] = (outShape5D[4] - 1 - oAdd[4]) / blockShape[4];
- const int64_t addTmpOC = blocked ? 0lu : oAdd[1];
- const int64_t addTmpOc = blocked ? oAdd[1] : 0lu;
+ const int64_t addTmpOC = blocked ? 0LU : oAdd[1];
+ const int64_t addTmpOc = blocked ? oAdd[1] : 0LU;
indxStart[1] = begin[1] > indxStart[1] ? begin[1] : indxStart[1];
const int64_t lastI1 = i0 == indxEnd[0] ? (indxEnd[1] > finish[1] ? finish[1] : indxEnd[1]) : finish[1];
for (; indxStart[1] < lastI1 + 1; ++indxStart[1]) {
@@ -223,7 +224,7 @@ void SpaceToBatch::SpaceToBatchKernel() {
const int64_t tmpOC = indxStart[1] * blockShape[1] + addTmpOC;
const int64_t srcIdx1 = srcIdx0 + tmpOC * outSpatialStep * blockSize;
const int64_t dstIdx1 = dstIdx0 + indxStart[1] * inSpatialStep * blockSize;
- const int64_t itEnd = blocked ? ((block - 1) * blockShape[1] + oAdd[1]) / blockSize : 0lu;
+ const int64_t itEnd = blocked ? ((block - 1) * blockShape[1] + oAdd[1]) / blockSize : 0LU;
for (int64_t i2 = begin[2]; i2 < finish[2] + 1; ++i2) {
const int64_t tmpOd = i2 * blockShape[2] + oAdd[2];
const int64_t srcIdx2 = srcIdx1 + tmpOd * outShape5D[3] * outShape5D[4] * blockSize;
@@ -256,7 +257,7 @@ void SpaceToBatch::SpaceToBatchKernel() {
}
}
}
- indxStart[1] = 0lu;
+ indxStart[1] = 0LU;
}
});
}
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 fb2829c4a88..fc3471084f0 100644
--- a/src/plugins/intel_cpu/src/nodes/space_to_depth.cpp
+++ b/src/plugins/intel_cpu/src/nodes/space_to_depth.cpp
@@ -168,10 +168,10 @@ void SpaceToDepth::initSupportedPrimitiveDescriptors() {
};
supportedTypes.push_back(LayoutType::nspc);
- if (canUseBlocked(8lu)) {
+ if (canUseBlocked(8LU)) {
supportedTypes.push_back(LayoutType::nCsp8c);
}
- if (canUseBlocked(16lu)) {
+ if (canUseBlocked(16LU)) {
supportedTypes.push_back(LayoutType::nCsp16c);
}
}
@@ -275,7 +275,8 @@ SpaceToDepth::SpaceToDepthExecutor::SpaceToDepthExecutor(const SpaceToDepthAttrs
};
if (isBlocked) {
- size_t orderShiftForBlocks, orderShiftForDims;
+ size_t orderShiftForBlocks;
+ size_t orderShiftForDims;
if (attrs.mode == Mode::BLOCKS_FIRST) {
orderShiftForBlocks = attrs.nSpatialDims + 2;
orderShiftForDims = 1;
diff --git a/src/plugins/intel_cpu/src/nodes/split.cpp b/src/plugins/intel_cpu/src/nodes/split.cpp
index 9919dfff035..d01b388ce04 100644
--- a/src/plugins/intel_cpu/src/nodes/split.cpp
+++ b/src/plugins/intel_cpu/src/nodes/split.cpp
@@ -100,7 +100,7 @@ Split::Split(const std::shared_ptr<ov::Node>& op, const GraphContext::CPtr& cont
void Split::getSupportedDescriptors() {}
void Split::initSupportedPrimitiveDescriptors() {
- constexpr size_t channelsPos = 1lu;
+ constexpr size_t channelsPos = 1LU;
if (!supportedPrimitiveDescriptors.empty()) {
return;
@@ -132,7 +132,7 @@ void Split::initSupportedPrimitiveDescriptors() {
// Support channel blocked format only if we manipulate complete blocks
if (srcShape.getRank() > 2) {
- for (auto item : {std::make_pair(8lu, LayoutType::nCsp8c), std::make_pair(16lu, LayoutType::nCsp16c)}) {
+ for (auto item : {std::make_pair(8LU, LayoutType::nCsp8c), std::make_pair(16LU, LayoutType::nCsp16c)}) {
const auto& blkDims = srcShape.getDims();
if (blkDims[channelsPos] == Shape::UNDEFINED_DIM || blkDims[channelsPos] % item.first != 0) {
continue;
@@ -358,7 +358,7 @@ void Split::initOptimalPrimitiveDescriptor() {
canUseOptimizedNspc2Ncsp = false;
CPU_NODE_ASSERT(!config.inConfs.empty(), "Incorrect number of input configurations");
const auto inConfDesc = config.inConfs[0].getMemDesc();
- if (axis == 1 && one_of(inConfDesc->getShape().getRank(), 4u, 5u) && inConfDesc->hasLayoutType(LayoutType::nspc)) {
+ if (axis == 1 && one_of(inConfDesc->getShape().getRank(), 4U, 5U) && inConfDesc->hasLayoutType(LayoutType::nspc)) {
canUseOptimizedNspc2Ncsp = true;
for (const auto& outConf : config.outConfs) {
if (!outConf.getMemDesc()->hasLayoutType(LayoutType::ncsp)) {
diff --git a/src/plugins/intel_cpu/src/nodes/stft.cpp b/src/plugins/intel_cpu/src/nodes/stft.cpp
index ddaa2dc4e38..d4f28427d58 100644
--- a/src/plugins/intel_cpu/src/nodes/stft.cpp
+++ b/src/plugins/intel_cpu/src/nodes/stft.cpp
@@ -97,11 +97,11 @@ bool STFT::created() const {
}
namespace {
-static void transpose_out4d(const uint8_t* in,
- uint8_t* out,
- const VectorDims& in_shape,
- const VectorDims& out_shape,
- size_t elem_size) {
+void transpose_out4d(const uint8_t* in,
+ uint8_t* out,
+ const VectorDims& in_shape,
+ const VectorDims& out_shape,
+ size_t elem_size) {
const std::vector<size_t> axes_order{0, 2, 1, 3};
parallel_for3d(out_shape[0],
out_shape[1],
diff --git a/src/plugins/intel_cpu/src/nodes/strided_slice.cpp b/src/plugins/intel_cpu/src/nodes/strided_slice.cpp
index 4d67b4b2bfc..f9846794fcd 100644
--- a/src/plugins/intel_cpu/src/nodes/strided_slice.cpp
+++ b/src/plugins/intel_cpu/src/nodes/strided_slice.cpp
@@ -92,7 +92,7 @@ StridedSlice::StridedSlice(const std::shared_ptr<ov::Node>& op, const GraphConte
isAxesSpecified = true;
}
- for (size_t i = 0lu; i < op->get_input_size(); i++) {
+ for (size_t i = 0LU; i < op->get_input_size(); i++) {
isConstantInput[i] = ov::is_type<ov::op::v0::Constant>(op->get_input_node_shared_ptr(i));
if (!isConstantInput[i] && one_of(i, attrs.BEGIN_ID, attrs.END_ID, attrs.STRIDE_ID) &&
!attrs.isSliceScatterOp) {
@@ -196,7 +196,7 @@ static void addHiddenDims(StridedSlice::StridedSliceAttributes& attrs,
std::vector<int> beginTmp(outputRank, 0);
std::vector<int> endTmp(outputRank, -1);
std::vector<int> strideTmp(outputRank, 1);
- size_t i = 0lu;
+ size_t i = 0LU;
for (auto& a : attrs.axes) {
if (a < 0) {
a += outputRank;
@@ -307,10 +307,10 @@ void StridedSlice::initSupportedPrimitiveDescriptors() {
getInputShapeAtPort(attrs.DATA_ID).getRank(),
getOutputShapeAtPort(0).getRank(),
isAxesSpecified);
- if (canUseBlocked(tmpAttrs, 8lu)) {
+ if (canUseBlocked(tmpAttrs, 8LU)) {
supportedTypes.push_back(LayoutType::nCsp8c);
}
- if (canUseBlocked(tmpAttrs, 16lu)) {
+ if (canUseBlocked(tmpAttrs, 16LU)) {
supportedTypes.push_back(LayoutType::nCsp16c);
}
}
@@ -570,7 +570,8 @@ void StridedSlice::StridedSliceCommonExecutor::dimsNormalization() {
dim = dim >= 0 ? dim : shift + dim;
};
- VectorDims newSrcDims, newDstDims;
+ VectorDims newSrcDims;
+ VectorDims newDstDims;
std::vector<int> beginTemp;
std::vector<int> endTemp;
std::vector<int> strideTemp;
@@ -673,7 +674,7 @@ void StridedSlice::StridedSliceCommonExecutor::dimsGluing() {
if (params.attrs.begin[idx] != 0 ||
static_cast<size_t>(params.attrs.end[idx]) != params.srcBlockedDims[idx] - 1 ||
params.attrs.stride[idx] != 1) {
- indexes.push_back(0u == idx ? 0 : idx - 1);
+ indexes.push_back(0U == idx ? 0 : idx - 1);
indexes.push_back(params.attrs.stride[idx] == 1 ? idx : idx + 1);
if (idx != 0 && secondDim.first == 0) {
@@ -796,7 +797,8 @@ void StridedSlice::StridedSliceCommonExecutor::indicesCalculation() {
};
parallel_nt(nThreads, [&](const int ithr, const int nthr) {
- size_t start = 0, end = 0;
+ size_t start = 0;
+ size_t end = 0;
VectorDims coords(params.nDimsForWork, 0);
splitter(workAmount, nthr, ithr, start, end);
parallel_init(start, params.nDimsForWork, params.dstBlockedDims, coords);
@@ -850,7 +852,8 @@ void StridedSlice::StridedSliceCommonExecutor::execStridedSlice(const std::vecto
auto* dstData = dstMemory[0]->getDataAs<uint8_t>();
const uint8_t* srcShiftedData = srcData + srcShift;
parallel_nt(nThreads, [&](const int ithr, const int nthr) {
- size_t start = 0, end = 0;
+ size_t start = 0;
+ size_t end = 0;
splitter(workAmount, nthr, ithr, start, end);
for (size_t iwork = start; iwork < end; ++iwork) {
@@ -871,7 +874,8 @@ void StridedSlice::StridedSliceCommonExecutor::execSliceScatter(const std::vecto
}
uint8_t* dstShiftedData = dstData + srcShift;
parallel_nt(nThreads, [&](const int ithr, const int nthr) {
- size_t start = 0, end = 0;
+ size_t start = 0;
+ size_t end = 0;
splitter(workAmount, nthr, ithr, start, end);
for (size_t iwork = start; iwork < end; ++iwork) {
diff --git a/src/plugins/intel_cpu/src/nodes/subgraph.cpp b/src/plugins/intel_cpu/src/nodes/subgraph.cpp
index 114732cc79e..6f5c75632ff 100644
--- a/src/plugins/intel_cpu/src/nodes/subgraph.cpp
+++ b/src/plugins/intel_cpu/src/nodes/subgraph.cpp
@@ -114,7 +114,7 @@ struct SubgraphKey {
}
std::shared_ptr<SubgraphAttrs> attrs = nullptr;
- std::vector<VectorDims> in_shapes = {};
+ std::vector<VectorDims> in_shapes;
};
struct SubgraphCodeGeneratorKey {
@@ -158,7 +158,7 @@ struct SubgraphShapeInferResultKey {
return body_hash == rhs.body_hash && in_shapes == rhs.in_shapes;
}
- std::vector<VectorDims> in_shapes = {};
+ std::vector<VectorDims> in_shapes;
uint64_t body_hash = 0;
};
@@ -229,7 +229,7 @@ void Subgraph::initSupportedPrimitiveDescriptors() {
const size_t ndims = outputShapes[0].getRank();
// Domain sensitive operations and dynamic Subgraphs support only Planar layout
const bool isOnlyPlanarApplicable = subgraph_attrs->snippet->has_domain_sensitive_ops();
- const bool isChannelsFirstApplicable = dnnl::impl::utils::one_of(ndims, 1u, 2u, 3u, 4u, 5u) && dimRanksAreEqual &&
+ const bool isChannelsFirstApplicable = dnnl::impl::utils::one_of(ndims, 1U, 2U, 3U, 4U, 5U) && dimRanksAreEqual &&
!isOnlyPlanarApplicable && !isDynamic;
// Todo: Subgraphs currently don't support per-channel broadcasting of Blocked descriptors because
// canonicalization can't distinguish between <N, C, H, W, c> and <N, C, D, H, W> cases.
@@ -238,7 +238,7 @@ void Subgraph::initSupportedPrimitiveDescriptors() {
bool isBlockedApplicable = false;
#else
bool isBlockedApplicable =
- dnnl::impl::utils::one_of(ndims, 3u, 4u, 5u) && dimRanksAreEqual && !isOnlyPlanarApplicable && !isDynamic;
+ dnnl::impl::utils::one_of(ndims, 3U, 4U, 5U) && dimRanksAreEqual && !isOnlyPlanarApplicable && !isDynamic;
for (const auto& inShape : inputShapes) {
if (isDynamic && inShape.getRank() != 1) {
@@ -707,7 +707,7 @@ void Subgraph::optimizeIR() {
// Note: temporary disabled. Re-enable after ticket 132833 is resolved
control_flow_config->disable<ov::snippets::lowered::pass::OptimizeDomain>();
- subgraph->set_tile_rank(std::min(2ul, subgraph->infer_master_shape().size()));
+ subgraph->set_tile_rank(std::min(2UL, subgraph->infer_master_shape().size()));
#endif
// Note: minimal JIT work amount is a predefined value that describes the number of kernel iterations (work amount)
diff --git a/src/plugins/intel_cpu/src/nodes/tensoriterator.cpp b/src/plugins/intel_cpu/src/nodes/tensoriterator.cpp
index 52c978b3452..0a1ad2958cd 100644
--- a/src/plugins/intel_cpu/src/nodes/tensoriterator.cpp
+++ b/src/plugins/intel_cpu/src/nodes/tensoriterator.cpp
@@ -117,7 +117,7 @@ public:
auto part_dims = part_blob->getShape().getStaticDims();
auto abs_stride = std::abs(stride);
- auto sign_of_stride = stride < 0.0f ? -1 : 1;
+ auto sign_of_stride = stride < 0.0F ? -1 : 1;
iter_count = full_dims[axis] / abs_stride;
@@ -305,7 +305,7 @@ void DynamicBuffer::init(const dnnl::engine& eng) {
num_execs = 0;
}
-bool DynamicBuffer::check_buffer() {
+bool DynamicBuffer::check_buffer() const {
if (map_rule.stride > 0) {
if (static_cast<ptrdiff_t>(chunk_offset_in_byte + chunk_unit_in_byte) > chunk_stride_in_byte) {
return true;
diff --git a/src/plugins/intel_cpu/src/nodes/tensoriterator.h b/src/plugins/intel_cpu/src/nodes/tensoriterator.h
index aa902dad78e..2bc8e835246 100644
--- a/src/plugins/intel_cpu/src/nodes/tensoriterator.h
+++ b/src/plugins/intel_cpu/src/nodes/tensoriterator.h
@@ -87,7 +87,7 @@ private:
void init(const dnnl::engine& eng);
/* methods for resize and refill buffer */
- bool check_buffer();
+ bool check_buffer() const;
MemoryPtr create_buffer(const dnnl::engine& eng);
void move_buffer(const MemoryPtr& new_buffer);
void move_data();
diff --git a/src/plugins/intel_cpu/src/nodes/tile.cpp b/src/plugins/intel_cpu/src/nodes/tile.cpp
index c64b4b6b93c..c3dcd5d60f5 100644
--- a/src/plugins/intel_cpu/src/nodes/tile.cpp
+++ b/src/plugins/intel_cpu/src/nodes/tile.cpp
@@ -60,7 +60,7 @@ Tile::Tile(const std::shared_ptr<ov::Node>& op, const GraphContext::CPtr& contex
repeats = originRepeats =
ov::as_type<const ov::op::v0::Constant>(op->get_input_node_ptr(TILE_REPEATS))->cast_vector<size_t>();
while (repeats.size() < getInputShapeAtPort(TILE_INPUT).getRank()) {
- repeats.insert(repeats.begin(), 1lu);
+ repeats.insert(repeats.begin(), 1LU);
}
}
}
@@ -85,7 +85,7 @@ void Tile::getSupportedDescriptors() {
THROW_CPU_NODE_ERR("has no output edges.");
}
const auto& dstDims0 = getOutputShapeAtPort(0).getDims();
- for (size_t i = 1lu; i < outputShapes.size(); i++) {
+ for (size_t i = 1LU; i < outputShapes.size(); i++) {
const auto& dstDims = getOutputShapeAtPort(i).getDims();
if (dstDims.size() != dstDims0.size()) {
THROW_CPU_NODE_ERR("has output edges 0 and ",
@@ -139,9 +139,9 @@ void Tile::prepareParams() {
const auto* repeatsData = repeatsMem.getDataAs<const int32_t>();
originRepeats.assign(repeatsData, repeatsData + repeatsMem.getStaticDims()[0]);
- repeats.assign(std::max(originRepeats.size(), getInputShapeAtPort(TILE_INPUT).getRank()), 1lu);
+ repeats.assign(std::max(originRepeats.size(), getInputShapeAtPort(TILE_INPUT).getRank()), 1LU);
const size_t offset = repeats.size() - originRepeats.size();
- for (size_t i = 0lu; i < originRepeats.size(); i++) {
+ for (size_t i = 0LU; i < originRepeats.size(); i++) {
repeats[i + offset] = originRepeats[i];
}
}
@@ -162,7 +162,7 @@ bool Tile::needShapeInfer() const {
return true;
}
const auto* repeatsData = getSrcDataAtPortAs<const int32_t>(TILE_REPEATS);
- for (size_t i = 0lu; i < originRepeats.size(); i++) {
+ for (size_t i = 0LU; i < originRepeats.size(); i++) {
if (originRepeats[i] != static_cast<size_t>(repeatsData[i])) {
return true;
}
diff --git a/src/plugins/intel_cpu/src/nodes/topk.cpp b/src/plugins/intel_cpu/src/nodes/topk.cpp
index 69f2686b64e..e04ae7a471d 100644
--- a/src/plugins/intel_cpu/src/nodes/topk.cpp
+++ b/src/plugins/intel_cpu/src/nodes/topk.cpp
@@ -268,28 +268,28 @@ private:
}
}
- inline void load(Xbyak::Reg64 reg_src, Vmm vmm_src, const int elt_num, const int offset = 0) {
+ void load(Xbyak::Reg64 reg_src, Vmm vmm_src, const int elt_num, const int offset = 0) {
emit_load(reg_src, vmm_src, jcp_.precision, precision_in_reg, elt_num, offset);
}
- inline void load_i32(Xbyak::Reg64 reg_src, Vmm vmm_src, const int elt_num, const int offset = 0) {
+ void load_i32(Xbyak::Reg64 reg_src, Vmm vmm_src, const int elt_num, const int offset = 0) {
emit_load(reg_src, vmm_src, ov::element::i32, ov::element::i32, elt_num, offset);
}
- inline void store(Vmm vmm_dst, Xbyak::Reg64 reg_dst, const int elt_num, const int offset = 0) {
+ void store(Vmm vmm_dst, Xbyak::Reg64 reg_dst, const int elt_num, const int offset = 0) {
emit_store(vmm_dst, reg_dst, precision_in_reg, jcp_.precision, elt_num, offset);
}
- inline void store_i32(Vmm vmm_dst, Xbyak::Reg64 reg_dst, const int elt_num, const int offset = 0) {
+ void store_i32(Vmm vmm_dst, Xbyak::Reg64 reg_dst, const int elt_num, const int offset = 0) {
emit_store(vmm_dst, reg_dst, ov::element::i32, ov::element::i32, elt_num, offset);
}
- inline void emit_load(Xbyak::Reg64 reg_src,
- Vmm vmm_src,
- ov::element::Type src_prc,
- ov::element::Type dst_prc,
- const int elt_num,
- const int offset = 0) {
+ void emit_load(Xbyak::Reg64 reg_src,
+ Vmm vmm_src,
+ ov::element::Type src_prc,
+ ov::element::Type dst_prc,
+ const int elt_num,
+ const int offset = 0) {
const auto seed = load_emitter_params(src_prc, dst_prc, elt_num).hash();
if (!emitters[seed]) {
emitters[seed] = std::make_unique<jit_load_emitter>(this, isa, src_prc, dst_prc, elt_num);
@@ -301,12 +301,12 @@ private:
{load_pool_gpr_idxs});
}
- inline void emit_store(Vmm vmm_dst,
- Xbyak::Reg64 reg_dst,
- ov::element::Type src_prc,
- ov::element::Type dst_prc,
- const int elt_num,
- const int offset = 0) {
+ void emit_store(Vmm vmm_dst,
+ Xbyak::Reg64 reg_dst,
+ ov::element::Type src_prc,
+ ov::element::Type dst_prc,
+ const int elt_num,
+ const int offset = 0) {
const auto seed = store_emitter_params(src_prc, dst_prc, elt_num).hash();
if (!emitters[seed]) {
emitters[seed] = std::make_unique<jit_store_emitter>(this, isa, src_prc, dst_prc, elt_num);
@@ -324,7 +324,7 @@ private:
{store_pool_gpr_idxs});
}
- inline void topk_loop() {
+ void topk_loop() {
if (jcp_.algorithm == TopKAlgorithm::topk_bubble_sort) {
if (jcp_.layout == TopKLayoutType::topk_blocked && jcp_.topk_innermost) {
if (jcp_.top_k == 1 && !jcp_.stable) {
@@ -348,7 +348,7 @@ private:
}
}
- inline void topk_bitonic_vector() {
+ void topk_bitonic_vector() {
Xbyak::Label topk_main_loop_label;
Xbyak::Label topk_main_loop_end_label;
L(topk_main_loop_label);
@@ -379,7 +379,7 @@ private:
}
}
- inline void topk_bitonic(int elt_num) {
+ void topk_bitonic(int elt_num) {
// src => prc
for (int i = 0; i < jcp_.axis_dim; i++) {
load(reg_src, vmm_tmp, elt_num, i * jcp_.sort_stride * jcp_.data_size);
@@ -409,7 +409,7 @@ private:
// prc memory layout: (C) * (N * H * W)
// topk_bitonic_BLK_on_channel: sort (C) * (N * H * W / blk_size * blk_size) elements
// sort (C) * (N * H * W % blk_size) elements in the rear
- inline void topk_bitonic_BLK_on_channel() {
+ void topk_bitonic_BLK_on_channel() {
Xbyak::Label topk_main_loop_label;
Xbyak::Label topk_main_loop_end_label;
L(topk_main_loop_label);
@@ -459,7 +459,7 @@ private:
}
}
- inline void bitonic_sort_vector(int elt_num, bool cmp_val = true) {
+ void bitonic_sort_vector(int elt_num, bool cmp_val = true) {
if (cmp_val) {
mov(reg_i, jcp_.bitonic_idx_cnt);
mov(reg_aux, ptr[reg_params + GET_OFF(bitonic_idx_buf)]);
@@ -485,7 +485,7 @@ private:
L(topk_main_loop_end_label);
}
- inline void bitonic_BLK_on_channel_load(int elt_num) {
+ void bitonic_BLK_on_channel_load(int elt_num) {
for (int i = 0; i < jcp_.axis_dim; i++) {
for (int j = 0; j < elt_num; j++) {
int offset = i / jcp_.blk_size * blk_stride + i % jcp_.blk_size + j * jcp_.blk_size;
@@ -501,7 +501,7 @@ private:
}
}
- inline void bitonic_BLK_on_channel_store(int elt_num) {
+ void bitonic_BLK_on_channel_store(int elt_num) {
for (int i = 0; i < jcp_.top_k; i++) {
for (int j = 0; j < elt_num; j++) {
int offset = i / jcp_.blk_size * blk_stride + i % jcp_.blk_size + j * jcp_.blk_size;
@@ -517,13 +517,13 @@ private:
}
}
- inline void bitonic_get_addr(Xbyak::Reg64 reg_base, int data_size, int offset = 0) {
+ void bitonic_get_addr(Xbyak::Reg64 reg_base, int data_size, int offset = 0) {
mov(reg_aux_idx.cvt32(), ptr[reg_aux + offset]);
mul_by_const(reg_aux_idx, reg_tmp_64, data_size);
add(reg_aux_idx, reg_base);
}
- inline void bitonic_swap_vector(int elt_num, bool cmp_val = true) {
+ void bitonic_swap_vector(int elt_num, bool cmp_val = true) {
bitonic_get_addr(reg_prc, jcp_.data_size, 0);
load(reg_aux_idx, vmm_val_l, elt_num);
@@ -551,7 +551,7 @@ private:
store_i32(vmm_idx_r, reg_aux_idx, elt_num);
}
- inline void topk_heap_sorting() {
+ void topk_heap_sorting() {
mov(reg_heap_seq_idx, ptr[reg_params + GET_OFF(idx_seq_buf)]);
mov(reg_heap_axis_dim, ptr[reg_params + GET_OFF(axis_dim)]);
mov(reg_heap_top_k, ptr[reg_params + GET_OFF(top_k)]);
@@ -652,7 +652,7 @@ private:
}
}
- inline void topk_heap_load(Xbyak::Reg64& reg_end, int s) {
+ void topk_heap_load(Xbyak::Reg64& reg_end, int s) {
Xbyak::Label topk_init_loop_label;
Xbyak::Label topk_init_loop_end_label;
L(topk_init_loop_label);
@@ -685,7 +685,7 @@ private:
L(topk_init_loop_end_label);
}
- inline void topk_heap_extract(bool cmp_val = true) {
+ void topk_heap_extract(bool cmp_val = true) {
Xbyak::Label topk_extract_label;
Xbyak::Label topk_extract_end_label;
mov(reg_i, reg_heap_k_sub_1);
@@ -703,7 +703,7 @@ private:
L(topk_extract_end_label);
}
- inline void heapify_sub_tree(const Xbyak::Reg64& reg_idx, const Xbyak::Reg64& reg_valid, bool cmp_val = true) {
+ void heapify_sub_tree(const Xbyak::Reg64& reg_idx, const Xbyak::Reg64& reg_valid, bool cmp_val = true) {
Xbyak::Label topk_heapify_loop_label;
Xbyak::Label topk_heapify_loop_end_label;
Xbyak::Label topk_lchild_loop_label;
@@ -844,11 +844,11 @@ private:
add(rsp, sizeof(int));
}
- inline bool is_valid_isa(cpu_isa_t cpu_isa) {
+ bool is_valid_isa(cpu_isa_t cpu_isa) {
return mayiuse(cpu_isa);
}
- inline void uni_vpcmpgtd(const Xbyak::Xmm& x1, const Xbyak::Xmm& x2, const Xbyak::Operand& op) {
+ void uni_vpcmpgtd(const Xbyak::Xmm& x1, const Xbyak::Xmm& x2, const Xbyak::Operand& op) {
if (is_valid_isa(cpu::x64::avx)) {
vpcmpgtd(x1, x2, op);
} else {
@@ -859,18 +859,18 @@ private:
}
}
- inline void uni_vpcmpgtd(const Xbyak::Ymm& x1, const Xbyak::Ymm& x2, const Xbyak::Operand& op) {
+ void uni_vpcmpgtd(const Xbyak::Ymm& x1, const Xbyak::Ymm& x2, const Xbyak::Operand& op) {
vpcmpgtd(x1, x2, op);
}
- inline void compare_node_xmm(Xmm xmm_val_a,
- Xmm xmm_idx_a,
- Xmm xmm_val_b,
- Xmm xmm_idx_b,
- Xmm mask,
- unsigned char val_cmp_flg,
- unsigned char idx_cmp_flg,
- bool cmp_val) {
+ void compare_node_xmm(Xmm xmm_val_a,
+ Xmm xmm_idx_a,
+ Xmm xmm_val_b,
+ Xmm xmm_idx_b,
+ Xmm mask,
+ unsigned char val_cmp_flg,
+ unsigned char idx_cmp_flg,
+ bool cmp_val) {
if (isa == cpu::x64::avx512_core) {
if (cmp_val) {
if (isFloatCompatible(data_type)) {
@@ -902,12 +902,12 @@ private:
}
}
- inline void heap_cmp_node(Xmm xmm_val_a, Xmm xmm_idx_a, Xmm xmm_val_b, Xmm xmm_idx_b, bool cmp_val = true) {
+ void heap_cmp_node(Xmm xmm_val_a, Xmm xmm_idx_a, Xmm xmm_val_b, Xmm xmm_idx_b, bool cmp_val = true) {
compare_node_xmm(xmm_val_a, xmm_idx_a, xmm_val_b, xmm_idx_b, xmm_mask, heap_cmp_flg, _cmp_lt_os, cmp_val);
}
// n: node, c: child
- inline void heap_swap_node(Xmm xmm_val_n, Xmm xmm_idx_n, Xmm xmm_val_c, Xmm xmm_idx_c) {
+ void heap_swap_node(Xmm xmm_val_n, Xmm xmm_idx_n, Xmm xmm_val_c, Xmm xmm_idx_c) {
// swap store
store_scalar(ptr[reg_aux], xmm_val_c, data_type);
store_scalar(ptr[reg_aux_idx], xmm_idx_c, memory::data_type::s32);
@@ -915,7 +915,7 @@ private:
store_scalar(ptr[reg_prc_idx], xmm_idx_n, memory::data_type::s32);
}
- inline void heap_swap_root(const Xbyak::Reg64& reg_idx) {
+ void heap_swap_root(const Xbyak::Reg64& reg_idx) {
get_addr_by_reg_idx(reg_aux, reg_dst, reg_idx, jcp_.data_size);
get_addr_by_reg_idx(reg_aux_idx, reg_dst_idx, reg_idx, sizeof(int));
@@ -930,7 +930,7 @@ private:
store_scalar(ptr[reg_dst_idx], xmm_idx_l, memory::data_type::s32);
}
- inline void topk_bubble_vector() {
+ void topk_bubble_vector() {
mov(reg_bubble_block_idx, ptr[reg_params + GET_OFF(idx_block_buf)]);
if (!jcp_.bubble_inplace) {
mov(reg_block_sort_stride, ptr[reg_params + GET_OFF(sort_stride)]);
@@ -992,101 +992,95 @@ private:
}
}
- inline void reg_add(const Xbyak::Reg64& reg_sum, const Xbyak::Reg64& reg_a, const Xbyak::Reg64& reg_b) {
+ void reg_add(const Xbyak::Reg64& reg_sum, const Xbyak::Reg64& reg_a, const Xbyak::Reg64& reg_b) {
mov(reg_sum, reg_a);
add(reg_sum, reg_b);
}
- inline void query_table_by_reg_idx(const Xbyak::Reg64& reg_table,
- const Xbyak::Reg64& reg_idx,
- int offset,
- size_t size) {
+ void query_table_by_reg_idx(const Xbyak::Reg64& reg_table, const Xbyak::Reg64& reg_idx, int offset, size_t size) {
mov(reg_tmp, reg_idx);
add(reg_tmp, offset);
mul_by_const(reg_tmp, reg_tmp_64, size);
add(reg_tmp, reg_table);
}
- inline void table_to_vmm(Vmm vmm_src,
- const Xbyak::Reg64& reg_table,
- const Xbyak::Reg64& reg_idx,
- int offset,
- size_t size) {
+ void table_to_vmm(Vmm vmm_src,
+ const Xbyak::Reg64& reg_table,
+ const Xbyak::Reg64& reg_idx,
+ int offset,
+ size_t size) {
query_table_by_reg_idx(reg_table, reg_idx, offset, size);
uni_vmovdqu(vmm_src, ptr[reg_tmp]);
}
- inline void table_to_xmm(Xmm xmm_src,
- const Xbyak::Reg64& reg_table,
- const Xbyak::Reg64& reg_idx,
- int offset,
- size_t size) {
+ void table_to_xmm(Xmm xmm_src,
+ const Xbyak::Reg64& reg_table,
+ const Xbyak::Reg64& reg_idx,
+ int offset,
+ size_t size) {
query_table_by_reg_idx(reg_table, reg_idx, offset, size);
uni_vmovss(xmm_src, ptr[reg_tmp]);
}
- inline void get_addr_by_reg_idx(const Xbyak::Reg& reg_out,
- const Xbyak::Reg& reg_base,
- const Xbyak::Reg64& reg_in,
- int value) {
+ void get_addr_by_reg_idx(const Xbyak::Reg& reg_out,
+ const Xbyak::Reg& reg_base,
+ const Xbyak::Reg64& reg_in,
+ int value) {
mov(reg_out, reg_in);
mul_by_const(reg_out, reg_tmp_64, value);
add(reg_out, reg_base);
}
- inline void get_addr_by_reg_idx(const Xbyak::Reg& reg_out,
- const Xbyak::Reg& reg_base,
- const Xbyak::Reg64& reg_in,
- int value,
- const Xbyak::Reg64& reg_value) {
+ void get_addr_by_reg_idx(const Xbyak::Reg& reg_out,
+ const Xbyak::Reg& reg_base,
+ const Xbyak::Reg64& reg_in,
+ int value,
+ const Xbyak::Reg64& reg_value) {
mov(reg_out, reg_in);
imul(reg_out, reg_value);
mul_by_const(reg_out, reg_tmp_64, value);
add(reg_out, reg_base);
}
- inline void get_addr_by_reg_idx(const Xbyak::Reg& reg_out,
- const Xbyak::Reg& reg_base,
- const Xbyak::Reg64& reg_in,
- const Xbyak::Reg64& reg_value) {
+ void get_addr_by_reg_idx(const Xbyak::Reg& reg_out,
+ const Xbyak::Reg& reg_base,
+ const Xbyak::Reg64& reg_in,
+ const Xbyak::Reg64& reg_value) {
mov(reg_out, reg_in);
imul(reg_out, reg_value);
add(reg_out, reg_base);
}
- inline void reg_mul_add(const Xbyak::Reg& reg_out, const Xbyak::Reg64& reg_in, int mul_val, int add_val) {
+ void reg_mul_add(const Xbyak::Reg& reg_out, const Xbyak::Reg64& reg_in, int mul_val, int add_val) {
mov(reg_out, reg_in);
mul_by_const(reg_out, reg_tmp_64, mul_val);
add(reg_out, add_val);
}
- inline void reg_mul_add(const Xbyak::Reg& reg_out,
- const Xbyak::Reg& reg_tmp,
- const Xbyak::Reg64& reg_in,
- int mul_val) {
+ void reg_mul_add(const Xbyak::Reg& reg_out, const Xbyak::Reg& reg_tmp, const Xbyak::Reg64& reg_in, int mul_val) {
mov(reg_tmp, reg_in);
mul_by_const(reg_tmp, reg_tmp_64, mul_val);
add(reg_out, reg_tmp);
}
- inline void reg_mul_add(const Xbyak::Reg& reg_out, int mul_val, const Xbyak::Reg64& reg_base) {
+ void reg_mul_add(const Xbyak::Reg& reg_out, int mul_val, const Xbyak::Reg64& reg_base) {
mul_by_const(reg_out, reg_tmp_64, mul_val);
add(reg_out, reg_base);
}
- inline void reg_sub_shr(const Xbyak::Reg& reg_out, const Xbyak::Reg64& reg_in, int sub_val, int shr_val) {
+ void reg_sub_shr(const Xbyak::Reg& reg_out, const Xbyak::Reg64& reg_in, int sub_val, int shr_val) {
mov(reg_out, reg_in);
sub(reg_out, sub_val);
shr(reg_out, shr_val);
}
- inline void reg_sub_mul(const Xbyak::Reg& reg_out, const Xbyak::Reg64& reg_in, int sub_val, int mul_val) {
+ void reg_sub_mul(const Xbyak::Reg& reg_out, const Xbyak::Reg64& reg_in, int sub_val, int mul_val) {
mov(reg_out, reg_in);
sub(reg_out, sub_val);
mul_by_const(reg_out, reg_tmp_64, mul_val);
}
- inline void reg_shl(const Xbyak::Reg& reg_out, int rate) {
+ void reg_shl(const Xbyak::Reg& reg_out, int rate) {
switch (rate) {
case 1:
break;
@@ -1101,7 +1095,7 @@ private:
}
}
- inline void reg_shr(const Xbyak::Reg& reg_out, int rate) {
+ void reg_shr(const Xbyak::Reg& reg_out, int rate) {
switch (rate) {
case 1:
break;
@@ -1116,7 +1110,7 @@ private:
}
}
- inline void reg_div_blk_size(const Xbyak::Reg& reg_out, const Xbyak::Reg64& reg_in, int blk_size) {
+ void reg_div_blk_size(const Xbyak::Reg& reg_out, const Xbyak::Reg64& reg_in, int blk_size) {
mov(reg_out, reg_in);
switch (blk_size) {
case 8:
@@ -1130,7 +1124,7 @@ private:
}
}
- inline void reg_mod_blk_size(const Xbyak::Reg& reg_out, const Xbyak::Reg64& reg_in, int blk_size) {
+ void reg_mod_blk_size(const Xbyak::Reg& reg_out, const Xbyak::Reg64& reg_in, int blk_size) {
mov(reg_out, reg_in);
reg_div_blk_size(reg_tmp_64, reg_in, blk_size);
switch (blk_size) {
@@ -1146,17 +1140,17 @@ private:
sub(reg_out, reg_tmp_64);
}
- inline void reg_calc_offset_by_channel_idx(const Xbyak::Reg& reg_out,
- const Xbyak::Reg64& reg_stride,
- const Xbyak::Reg64& reg_channel_idx,
- int blk_size) {
+ void reg_calc_offset_by_channel_idx(const Xbyak::Reg& reg_out,
+ const Xbyak::Reg64& reg_stride,
+ const Xbyak::Reg64& reg_channel_idx,
+ int blk_size) {
reg_div_blk_size(reg_out, reg_channel_idx, blk_size);
imul(reg_out, reg_stride);
reg_mod_blk_size(reg_tmp, reg_channel_idx, blk_size);
add(reg_out, reg_tmp);
}
- inline void topk_bubble(int elt_num) {
+ void topk_bubble(int elt_num) {
reg_shl(reg_block_sort_stride, jcp_.data_size);
// init dst
@@ -1240,7 +1234,7 @@ private:
reg_shr(reg_block_sort_stride, jcp_.data_size);
}
- inline void topk_bubble_vector_sort(int elt_num, bool cmp_val = true) {
+ void topk_bubble_vector_sort(int elt_num, bool cmp_val = true) {
sub(rsp, sizeof(int64_t));
mov(ptr[rsp], reg_bubble_block_idx);
sub(rsp, sizeof(int));
@@ -1284,7 +1278,7 @@ private:
add(rsp, sizeof(int64_t));
}
- inline void topk_bubble_inplace(int elt_num) {
+ void topk_bubble_inplace(int elt_num) {
// load
for (int i = 0; i < jcp_.top_k; i++) {
load(reg_src, vmm_val(i), elt_num, i * jcp_.sort_stride * jcp_.data_size);
@@ -1317,7 +1311,7 @@ private:
}
}
- inline void topk_bubble_horiz() {
+ void topk_bubble_horiz() {
mov(reg_bubble_axis_dim, ptr[reg_params + GET_OFF(axis_dim)]);
mov(reg_seq_sort_stride, ptr[reg_params + GET_OFF(sort_stride)]);
mov(reg_bubble_seq_idx, ptr[reg_params + GET_OFF(idx_seq_buf)]);
@@ -1398,7 +1392,7 @@ private:
// dst: xmm_val(0) and xmm_idx(0)
// aux: xmm_val(2/3/4) and xmm_idx(2/3/4)
- inline void horiz_process() {
+ void horiz_process() {
if (isa == cpu::x64::sse41) {
horize_top1();
} else if (isa == cpu::x64::avx2) {
@@ -1434,7 +1428,7 @@ private:
// dst: xmm_val(0) and xmm_idx(0)
// aux: xmm_val(3) and xmm_idx(3)
- inline void horize_top1() {
+ void horize_top1() {
uni_vmovshdup(xmm_val(3), xmm_val(0)); // dst:1,2,3,4; aux:2,2,4,4
uni_vmovshdup(xmm_idx(3), xmm_idx(0));
bubble_swap_xmm(xmm_val(0), xmm_idx(0), xmm_val(3), xmm_idx(3)); // dst:f(1,2),f(2,2),f(3,4),f(4,4)
@@ -1443,7 +1437,7 @@ private:
bubble_swap_xmm(xmm_val(0), xmm_idx(0), xmm_val(3), xmm_idx(3)); // dst:f(1,2,3,4),...
}
- inline void topk_bubble_BLK_on_channel_verti() {
+ void topk_bubble_BLK_on_channel_verti() {
if (jcp_.bubble_inplace) {
topk_bubble_BLK_on_channel_inplace();
} else {
@@ -1451,7 +1445,7 @@ private:
}
}
- inline void topk_bubble_BLK_on_channel() {
+ void topk_bubble_BLK_on_channel() {
mov(reg_bubble_seq_idx, ptr[reg_params + GET_OFF(idx_seq_buf)]);
mov(reg_bubble_axis_dim, ptr[reg_params + GET_OFF(axis_dim)]);
mov(reg_seq_sort_stride, ptr[reg_params + GET_OFF(sort_stride)]);
@@ -1563,7 +1557,7 @@ private:
}
}
- inline void topk_bubble_BLK_on_channel_sort(bool cmp_val = true) {
+ void topk_bubble_BLK_on_channel_sort(bool cmp_val = true) {
sub(rsp, sizeof(int));
mov(ptr[rsp], reg_prc.cvt32());
@@ -1603,7 +1597,7 @@ private:
add(rsp, sizeof(int));
}
- inline void topk_bubble_BLK_on_channel_inplace() {
+ void topk_bubble_BLK_on_channel_inplace() {
// load
for (int i = 0; i < jcp_.top_k; i++) {
int offset = i / jcp_.blk_size * blk_stride + i % jcp_.blk_size;
@@ -1639,10 +1633,7 @@ private:
}
}
- inline void bubble_swap_vector(const Xbyak::Reg64& reg_l,
- const Xbyak::Reg64& reg_r,
- int elt_num,
- bool cmp_val = true) {
+ void bubble_swap_vector(const Xbyak::Reg64& reg_l, const Xbyak::Reg64& reg_r, int elt_num, bool cmp_val = true) {
mov(reg_tmp_64, reg_block_sort_stride_byte);
imul(reg_tmp_64, reg_l);
@@ -1709,7 +1700,7 @@ private:
L(topk_store_jmp_label);
}
- inline void swap_vector(Vmm vmm_val_a, Vmm vmm_idx_a, Vmm vmm_val_b, Vmm vmm_idx_b, bool cmp_val = true) {
+ void swap_vector(Vmm vmm_val_a, Vmm vmm_idx_a, Vmm vmm_val_b, Vmm vmm_idx_b, bool cmp_val = true) {
compare_node_xmm(vmm_val_a, vmm_idx_a, vmm_val_b, vmm_idx_b, vmm_mask, cmp_flg, _cmp_nle_us, cmp_val);
if (isa == cpu::x64::avx512_core) {
@@ -1731,7 +1722,7 @@ private:
}
}
- inline void bubble_swap_by_index(const Xbyak::Reg64& reg_l, const Xbyak::Reg64& reg_r, bool cmp_val = true) {
+ void bubble_swap_by_index(const Xbyak::Reg64& reg_l, const Xbyak::Reg64& reg_r, bool cmp_val = true) {
sub(rsp, sizeof(int));
mov(ptr[rsp], reg_i.cvt32());
sub(rsp, sizeof(int));
@@ -1785,7 +1776,7 @@ private:
add(rsp, sizeof(int));
}
- inline void bubble_swap_xmm(Xmm xmm_val_a, Xmm xmm_idx_a, Xmm xmm_val_b, Xmm xmm_idx_b, bool cmp_val = true) {
+ void bubble_swap_xmm(Xmm xmm_val_a, Xmm xmm_idx_a, Xmm xmm_val_b, Xmm xmm_idx_b, bool cmp_val = true) {
compare_node_xmm(xmm_val_a, xmm_idx_a, xmm_val_b, xmm_idx_b, xmm_mask, cmp_flg, _cmp_nle_us, cmp_val);
if (isa == cpu::x64::avx512_core) {
@@ -1807,7 +1798,7 @@ private:
}
}
- inline void load_scalar(Xmm xmm_src, const Xbyak::Address& op, memory::data_type src_dt, bool cvt_dt = false) {
+ void load_scalar(Xmm xmm_src, const Xbyak::Address& op, memory::data_type src_dt, bool cvt_dt = false) {
switch (src_dt) {
case memory::data_type::f32:
case memory::data_type::s32:
@@ -1834,7 +1825,7 @@ private:
}
}
- inline void store_scalar(const Xbyak::Address& op, Xmm xmm_dst, memory::data_type dst_dt, bool cvt_dt = false) {
+ void store_scalar(const Xbyak::Address& op, Xmm xmm_dst, memory::data_type dst_dt, bool cvt_dt = false) {
if (cvt_dt && !isFloatCompatible(dst_dt)) {
uni_vcvtps2dq(xmm_dst, xmm_dst);
}
@@ -2137,7 +2128,7 @@ void TopK::prepareParams() {
const size_t count_xmm = 16; // only 16 vector registers are valid in sse instructions even for avx512_core
if (static_cast<size_t>(top_k) <= count_xmm / 2 - 2) {
algorithm = TopKAlgorithm::topk_bubble_sort;
- bubble_inplace = topk_innermost && top_k == 1 ? false : true;
+ bubble_inplace = !topk_innermost || top_k != 1;
} else if (stable) {
algorithm = TopKAlgorithm::topk_bubble_sort;
bubble_inplace = false;
@@ -2145,7 +2136,7 @@ void TopK::prepareParams() {
algorithm = TopKAlgorithm::topk_heap_sort;
} else {
auto log_axis_dim = log2(axis_dim);
- auto alg_cost_bitonic = static_cast<size_t>((axis_dim / 4.0f) * log_axis_dim * (log_axis_dim + 1));
+ auto alg_cost_bitonic = static_cast<size_t>((axis_dim / 4.0F) * log_axis_dim * (log_axis_dim + 1));
size_t alg_cost_bubble = top_k * (top_k - 1) / 2 + (axis_dim - top_k) * top_k;
if (alg_cost_bitonic < alg_cost_bubble) {
algorithm = TopKAlgorithm::topk_bitonic_sort;
@@ -2396,7 +2387,7 @@ inline void TopK::prepare_original_idx() {
// n: number of valid elements in bitonic sort
// p: pow of 2 number, so that p/2 < n <= p
// empty tail: p-n elements in the rear don't need sorting,
-inline void TopK::bitonic_push_idx(int p, int n, std::vector<int>& vec, int& cnt, bool cmp_val) {
+inline void TopK::bitonic_push_idx(int p, int n, std::vector<int>& vec, int& cnt, bool cmp_val) const {
// memory stride of adjacent elements in sorting
auto sort_stride = static_cast<int>(I);
cnt = 0;
diff --git a/src/plugins/intel_cpu/src/nodes/topk.h b/src/plugins/intel_cpu/src/nodes/topk.h
index fb4fc943ea8..6afe1fa46bc 100644
--- a/src/plugins/intel_cpu/src/nodes/topk.h
+++ b/src/plugins/intel_cpu/src/nodes/topk.h
@@ -113,7 +113,7 @@ private:
size_t work_amount);
inline static int count(const VectorDims& dims, size_t start_ind, size_t end_ind);
inline static int count(const VectorDims& dims, size_t start_ind = 0);
- inline void bitonic_push_idx(int p, int n, std::vector<int>& vec, int& cnt, bool cmp_val = true);
+ inline void bitonic_push_idx(int p, int n, std::vector<int>& vec, int& cnt, bool cmp_val = true) const;
void calc_bitonic_idx(size_t n, int& cnt, bool cmp_val);
void calc_dims_size(const VectorDims& layout_dims);
void topk_ref_process(const float* src_data,
diff --git a/src/plugins/intel_cpu/src/nodes/transpose.cpp b/src/plugins/intel_cpu/src/nodes/transpose.cpp
index 6c0fa9e5d80..2ae664f25b7 100644
--- a/src/plugins/intel_cpu/src/nodes/transpose.cpp
+++ b/src/plugins/intel_cpu/src/nodes/transpose.cpp
@@ -71,7 +71,7 @@ Transpose::Transpose(const std::shared_ptr<ov::Node>& op, const GraphContext::CP
if (order.empty()) {
size_t rank = getInputShapeAtPort(INPUT_DATA_IDX).getRank();
- for (size_t i = 1lu; i <= rank; ++i) {
+ for (size_t i = 1LU; i <= rank; ++i) {
order.emplace_back(rank - i);
}
}
diff --git a/src/plugins/intel_cpu/src/nodes/unique.cpp b/src/plugins/intel_cpu/src/nodes/unique.cpp
index fe8574b6491..fab1b441770 100644
--- a/src/plugins/intel_cpu/src/nodes/unique.cpp
+++ b/src/plugins/intel_cpu/src/nodes/unique.cpp
@@ -60,7 +60,7 @@ Unique::Unique(const std::shared_ptr<ov::Node>& op, const GraphContext::CPtr& co
OPENVINO_THROW_NOT_IMPLEMENTED(errorMessage);
}
- if (!one_of(op->get_input_size(), 1u, 2u) || op->get_output_size() != 4) {
+ if (!one_of(op->get_input_size(), 1U, 2U) || op->get_output_size() != 4) {
THROW_CPU_NODE_ERR("has incorrect number of input/output edges.");
}
@@ -198,7 +198,9 @@ void Unique::flattenTensorExec() {
const size_t inputLen = getSrcMemoryAtPort(IN_DATA)->getSize() / sizeof(T);
std::vector<T> uniDataTmp(inputLen);
auto uniDataTmpPtr = uniDataTmp.data();
- int *firstTmpPtr = nullptr, *inToOutTmpPtr = nullptr, *occurTmpPtr = nullptr;
+ int* firstTmpPtr = nullptr;
+ int* inToOutTmpPtr = nullptr;
+ int* occurTmpPtr = nullptr;
if (definedOutputs[FIRST_UNIQUE_IDX]) {
firstTmpPtr = firstUniTmp.data();
}
@@ -305,7 +307,9 @@ template <typename T>
void Unique::slicedTensorExec() {
auto inDataMemPtr = getSrcMemoryAtPort(IN_DATA);
const auto* srcDataPtr = inDataMemPtr->getDataAs<const T>();
- int *firstTmpPtr = nullptr, *inToOutTmpPtr = nullptr, *occurTmpPtr = nullptr;
+ int* firstTmpPtr = nullptr;
+ int* inToOutTmpPtr = nullptr;
+ int* occurTmpPtr = nullptr;
if (definedOutputs[FIRST_UNIQUE_IDX]) {
firstTmpPtr = firstUniTmp.data();
}
@@ -319,7 +323,7 @@ void Unique::slicedTensorExec() {
const auto& srcDataShape = inDataMemPtr->getStaticDims();
const auto axisDim = srcDataShape[axis];
- int64_t outerLen = 1lu;
+ int64_t outerLen = 1LU;
if (axis > 0) {
outerLen = std::accumulate(srcDataShape.begin(), srcDataShape.begin() + axis, 1, std::multiplies<>());
}
@@ -341,19 +345,19 @@ void Unique::slicedTensorExec() {
std::fill(occurTmpPtr, occurTmpPtr + axisDim, 1);
}
- uniqueLen = 1lu;
- std::vector<size_t> uniqIdx(axisDim, 0lu);
+ uniqueLen = 1LU;
+ std::vector<size_t> uniqIdx(axisDim, 0LU);
// Search for unique slices.
- for (size_t a = 1lu; a < axisDim; a++) {
+ for (size_t a = 1LU; a < axisDim; a++) {
const auto* first1 = srcDataPtr + a * innerLen;
- const auto* last1 = srcDataPtr + (a + 1lu) * innerLen;
+ const auto* last1 = srcDataPtr + (a + 1LU) * innerLen;
bool equal = true;
- size_t uIdx = 0lu;
+ size_t uIdx = 0LU;
// Compare with unique blocks.
for (; uIdx < uniqueLen; uIdx++) {
const auto* first2 = srcDataPtr + uniqIdx[uIdx] * innerLen;
equal = true;
- for (int64_t o = 0lu; o < outerLen; o++) {
+ for (int64_t o = 0LU; o < outerLen; o++) {
equal = std::equal(first1, last1, first2);
if (!equal) {
break;
@@ -387,7 +391,9 @@ void Unique::slicedTensorExec() {
dstDataShape[axis] = uniqueLen;
redefineOutputMemory({dstDataShape, {uniqueLen}, {axisDim}, {uniqueLen}});
- int *firstPtr = nullptr, *inToOutPtr = nullptr, *occurNPtr = nullptr;
+ int* firstPtr = nullptr;
+ int* inToOutPtr = nullptr;
+ int* occurNPtr = nullptr;
if (definedOutputs[FIRST_UNIQUE_IDX]) {
firstPtr = getDstDataAtPortAs<int>(FIRST_UNIQUE_IDX);
}
@@ -405,7 +411,7 @@ void Unique::slicedTensorExec() {
parallel_for(uniqueLen, [&](size_t u) {
const auto* first1 = srcDataPtr + uniqIdx[u] * innerLen;
auto first2 = dstDataPtr + u * innerLen;
- for (int64_t p = 0lu; p < outerLen; p++) {
+ for (int64_t p = 0LU; p < outerLen; p++) {
cpu_memcpy(first2, first1, innerSizeB);
first1 += srcOuterStep;
first2 += dstOuterStep;
@@ -426,10 +432,14 @@ void Unique::slicedTensorExec() {
};
std::vector<OrdEl> colToSort(uniqueLen);
- T *dst1 = dstDataPtr, *dst2 = dstBuff;
- int *first1 = firstPtr, *first2 = firstTmpPtr;
- int *occurN1 = occurNPtr, *occurN2 = occurTmpPtr;
- int *inToOut1 = inToOutPtr, *inToOut2 = inToOutTmpPtr;
+ T* dst1 = dstDataPtr;
+ T* dst2 = dstBuff;
+ int* first1 = firstPtr;
+ int* first2 = firstTmpPtr;
+ int* occurN1 = occurNPtr;
+ int* occurN2 = occurTmpPtr;
+ int* inToOut1 = inToOutPtr;
+ int* inToOut2 = inToOutTmpPtr;
const bool defined3outputs =
definedOutputs[FIRST_UNIQUE_IDX] || definedOutputs[OCCURRENCES_NUM] || definedOutputs[INPUT_TO_UNIQ_IDX];
diff --git a/src/plugins/intel_cpu/src/plugin.cpp b/src/plugins/intel_cpu/src/plugin.cpp
index 3e52f69f0ea..20220027c08 100644
--- a/src/plugins/intel_cpu/src/plugin.cpp
+++ b/src/plugins/intel_cpu/src/plugin.cpp
@@ -112,7 +112,7 @@ static bool streamsSet(const ov::AnyMap& config) {
return config.find(ov::num_streams.name()) != config.end();
}
-void Plugin::get_performance_streams(Config& config, const std::shared_ptr<ov::Model>& model) const {
+void Plugin::get_performance_streams(Config& config, const std::shared_ptr<ov::Model>& model) {
int streams_set = config.streams;
int streams;
if (config.streamsChanged) {
@@ -125,14 +125,14 @@ void Plugin::get_performance_streams(Config& config, const std::shared_ptr<ov::M
streams = streams_set == 1 ? 0 : streams_set;
}
- if (!((0 == streams_set) && config.streamsChanged)) {
+ if ((0 != streams_set) || !config.streamsChanged) {
get_num_streams(streams, model, config);
} else {
config.streamExecutorConfig = IStreamsExecutor::Config{"CPUStreamsExecutor", streams};
}
}
-void Plugin::calculate_streams(Config& conf, const std::shared_ptr<ov::Model>& model, bool imported) const {
+void Plugin::calculate_streams(Config& conf, const std::shared_ptr<ov::Model>& model, bool imported) {
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
diff --git a/src/plugins/intel_cpu/src/plugin.h b/src/plugins/intel_cpu/src/plugin.h
index 21daecf0343..decb942a919 100644
--- a/src/plugins/intel_cpu/src/plugin.h
+++ b/src/plugins/intel_cpu/src/plugin.h
@@ -58,8 +58,8 @@ public:
private:
ov::Any get_ro_property(const std::string& name, const ov::AnyMap& options) const;
- void get_performance_streams(Config& config, const std::shared_ptr<ov::Model>& model) const;
- void calculate_streams(Config& conf, const std::shared_ptr<ov::Model>& model, bool imported = false) const;
+ static void get_performance_streams(Config& config, const std::shared_ptr<ov::Model>& model);
+ static void calculate_streams(Config& conf, const std::shared_ptr<ov::Model>& model, bool imported = false);
Config engConfig;
/* Explicily configured streams have higher priority than performance hints.
So track if streams is set explicitly (not auto-configured) */
diff --git a/src/plugins/intel_cpu/src/shape_inference/custom/convolution.cpp b/src/plugins/intel_cpu/src/shape_inference/custom/convolution.cpp
index 161cbfcccf5..b1d80499a20 100644
--- a/src/plugins/intel_cpu/src/shape_inference/custom/convolution.cpp
+++ b/src/plugins/intel_cpu/src/shape_inference/custom/convolution.cpp
@@ -89,7 +89,7 @@ VectorDims convolution_shape_infer(const VectorDims& data_shape,
}
Result ConvolutionShapeInfer::infer(const std::vector<std::reference_wrapper<const VectorDims>>& input_shapes,
- const std::unordered_map<size_t, MemoryPtr>&) {
+ const std::unordered_map<size_t, MemoryPtr>& /*data_dependency*/) {
assert(input_shapes.size() >= 2);
const auto& data_shape = input_shapes[0].get();
const auto& filters_shape = input_shapes[1].get();
diff --git a/src/plugins/intel_cpu/src/shape_inference/custom/gather.cpp b/src/plugins/intel_cpu/src/shape_inference/custom/gather.cpp
index c9947b3bb87..2d2a9b9fa23 100644
--- a/src/plugins/intel_cpu/src/shape_inference/custom/gather.cpp
+++ b/src/plugins/intel_cpu/src/shape_inference/custom/gather.cpp
@@ -26,7 +26,9 @@ namespace ov::intel_cpu::node {
Result GatherShapeInfer::infer(const std::vector<std::reference_wrapper<const VectorDims>>& input_shapes,
const std::unordered_map<size_t, MemoryPtr>& data_dependency) {
- static constexpr size_t GATHER_DATA = 0, GATHER_INDICES = 1, GATHER_AXIS = 2;
+ static constexpr size_t GATHER_DATA = 0;
+ static constexpr size_t GATHER_INDICES = 1;
+ static constexpr size_t GATHER_AXIS = 2;
const auto& input_shape = input_shapes[GATHER_DATA].get();
// Use VectorDims{} instead of {1} for Scalar
const auto& indices_shape = m_isIndicesScalar ? VectorDims{} : input_shapes[GATHER_INDICES].get();
@@ -53,7 +55,8 @@ Result GatherShapeInfer::infer(const std::vector<std::reference_wrapper<const Ve
}
ShapeInferPtr GatherShapeInferFactory::makeShapeInfer() const {
- static constexpr size_t GATHER_INDICES = 1, GATHER_AXIS = 2;
+ static constexpr size_t GATHER_INDICES = 1;
+ static constexpr size_t GATHER_AXIS = 2;
bool isAxisInputConst = ov::is_type<ov::op::v0::Constant>(m_op->get_input_node_ptr(GATHER_AXIS));
const auto& indicesShape = m_op->get_input_partial_shape(GATHER_INDICES);
if (!indicesShape.rank().is_static()) {
diff --git a/src/plugins/intel_cpu/src/shape_inference/custom/reshape.cpp b/src/plugins/intel_cpu/src/shape_inference/custom/reshape.cpp
index e061a3c0e72..322eb79b404 100644
--- a/src/plugins/intel_cpu/src/shape_inference/custom/reshape.cpp
+++ b/src/plugins/intel_cpu/src/shape_inference/custom/reshape.cpp
@@ -31,7 +31,8 @@ namespace ov::intel_cpu::node {
Result ReshapeShapeInfer::infer(const std::vector<std::reference_wrapper<const VectorDims>>& input_shapes,
const std::unordered_map<size_t, MemoryPtr>& data_dependency) {
- static constexpr size_t RESHAPE_SRC = 0, RESHAPE_PATTERN = 1;
+ static constexpr size_t RESHAPE_SRC = 0;
+ static constexpr size_t RESHAPE_PATTERN = 1;
const auto& inputShape = input_shapes[RESHAPE_SRC].get();
const size_t inputShapeSize = inputShape.size();
const auto& memPtr = data_dependency.at(RESHAPE_PATTERN);
@@ -85,7 +86,8 @@ Result ReshapeShapeInfer::infer(const std::vector<std::reference_wrapper<const V
Result SqueezeShapeInfer::infer(const std::vector<std::reference_wrapper<const VectorDims>>& input_shapes,
const std::unordered_map<size_t, MemoryPtr>& data_dependency) {
- static constexpr size_t SQUEEZE_SRC = 0, SQUEEZE_PATTERN = 1;
+ static constexpr size_t SQUEEZE_SRC = 0;
+ static constexpr size_t SQUEEZE_PATTERN = 1;
const auto& inputShape = input_shapes[SQUEEZE_SRC].get();
const size_t inputShapeSize = inputShape.size();
auto itr = data_dependency.find(SQUEEZE_PATTERN);
@@ -136,7 +138,8 @@ Result SqueezeShapeInfer::infer(const std::vector<std::reference_wrapper<const V
Result UnsqueezeShapeInfer::infer(const std::vector<std::reference_wrapper<const VectorDims>>& input_shapes,
const std::unordered_map<size_t, MemoryPtr>& data_dependency) {
- static constexpr size_t UNSQUEEZE_SRC = 0, UNSQUEEZE_PATTERN = 1;
+ static constexpr size_t UNSQUEEZE_SRC = 0;
+ static constexpr size_t UNSQUEEZE_PATTERN = 1;
const auto& inputShape = input_shapes[UNSQUEEZE_SRC].get();
const size_t inputShapeSize = inputShape.size();
const auto& memPtr = data_dependency.at(UNSQUEEZE_PATTERN);
diff --git a/src/plugins/intel_cpu/src/shape_inference/custom/scaled_attn.cpp b/src/plugins/intel_cpu/src/shape_inference/custom/scaled_attn.cpp
index 5bd69964fbc..18ca82d5b5d 100644
--- a/src/plugins/intel_cpu/src/shape_inference/custom/scaled_attn.cpp
+++ b/src/plugins/intel_cpu/src/shape_inference/custom/scaled_attn.cpp
@@ -56,7 +56,7 @@ public:
auto weight_dims_size = weight_dims.size();
if (attn_mask_dims_size >= 2 && attn_mask_dims_size <= weight_dims_size) {
auto check_broadcast = [](const size_t& target, const size_t& to) -> bool {
- return (target != to && target != 1) ? false : true;
+ return target == to || target == 1;
};
weight_dims[3] = present_v_dims[length_index];
auto offset = weight_dims_size - attn_mask_dims_size;
@@ -112,7 +112,7 @@ private:
ShapeInferPtr SDPAShapeInferFactory::makeShapeInfer() const {
if (auto sdpa = ov::as_type_ptr<const ScaledDotProductAttentionWithKVCache>(m_op)) {
const auto& config = sdpa->get_config();
- if (config.output_BLHxS == false) {
+ if (!config.output_BLHxS) {
return std::make_shared<SDPAShapeInfer>(config);
}
}
diff --git a/src/plugins/intel_cpu/src/shape_inference/custom/strided_slice.cpp b/src/plugins/intel_cpu/src/shape_inference/custom/strided_slice.cpp
index df1f6f9caf6..d650ea405df 100644
--- a/src/plugins/intel_cpu/src/shape_inference/custom/strided_slice.cpp
+++ b/src/plugins/intel_cpu/src/shape_inference/custom/strided_slice.cpp
@@ -42,7 +42,10 @@ StridedSliceShapeInfer::StridedSliceShapeInfer(size_t output_size,
Result StridedSliceShapeInfer::infer(const std::vector<std::reference_wrapper<const VectorDims>>& input_shapes,
const std::unordered_map<size_t, MemoryPtr>& data_dependency) {
// align with intel_cpu::node::StridedSlice
- static constexpr size_t DATA_ID = 0, BEGIN_ID = 1, END_ID = 2, STRIDE_ID = 3;
+ static constexpr size_t DATA_ID = 0;
+ static constexpr size_t BEGIN_ID = 1;
+ static constexpr size_t END_ID = 2;
+ static constexpr size_t STRIDE_ID = 3;
const VectorDims& shapeIn = input_shapes[DATA_ID].get();
const VectorDims& shapeBegin = input_shapes[BEGIN_ID].get();
if (data_dependency.at(BEGIN_ID)->getDesc().getPrecision() != ov::element::i32 ||
@@ -60,7 +63,8 @@ Result StridedSliceShapeInfer::infer(const std::vector<std::reference_wrapper<co
if ((cur_idx >= begin_size) || (shapeIn[in_idx] == 0)) {
return shapeIn[in_idx];
}
- int32_t begin = 0, end = 0;
+ int32_t begin = 0;
+ int32_t end = 0;
if (stridePtr[cur_idx] < 0) {
begin = m_begin_mask_set.count(cur_idx) ? shapeIn[in_idx] : beginPtr[cur_idx];
end = m_end_mask_set.count(cur_idx) ? (-1 - shapeIn[in_idx]) : endPtr[cur_idx];
@@ -83,8 +87,8 @@ Result StridedSliceShapeInfer::infer(const std::vector<std::reference_wrapper<co
for (size_t axis_idx = 0, out_idx = 0, in_idx = 0;
axis_idx < maxAxisSize && in_idx < shapeInSize && out_idx < outputShapeSize;
axis_idx++) {
- newAxis = (m_new_axis_mask_set.count(axis_idx) != 0u);
- shrinkAxis = (m_shrink_axis_mask_set.count(axis_idx) != 0u);
+ newAxis = (m_new_axis_mask_set.count(axis_idx) != 0U);
+ shrinkAxis = (m_shrink_axis_mask_set.count(axis_idx) != 0U);
if (newAxis) {
// from test when shrinkAxis && newAxis, only newAxis is working in NgraphShapeInfer,
// so merge if(newAxis) and if(shrinkAxis && newAxis) together.
diff --git a/src/plugins/intel_cpu/src/shape_inference/shape_inference.cpp b/src/plugins/intel_cpu/src/shape_inference/shape_inference.cpp
index e6b2ecfed5f..38a888e8b09 100644
--- a/src/plugins/intel_cpu/src/shape_inference/shape_inference.cpp
+++ b/src/plugins/intel_cpu/src/shape_inference/shape_inference.cpp
@@ -281,7 +281,7 @@ class ShapeInferBase : public IStaticShapeInfer {
public:
using iface_type = IStaticShapeInfer;
- ShapeInferBase(std::shared_ptr<ov::Node> node) : m_input_ranks{}, m_node{std::move(node)} {
+ ShapeInferBase(std::shared_ptr<ov::Node> node) : m_node{std::move(node)} {
static_assert(std::is_same_v<int64_t, Dimension::value_type>, "Rank type not match to input_ranks type.");
for (size_t i = 0; i < m_node->get_input_size(); ++i) {
const auto& shape = m_node->get_input_partial_shape(i);
@@ -291,7 +291,7 @@ public:
}
std::optional<std::vector<StaticShape>> infer(const std::vector<StaticShapeRef>& input_shapes,
- const ov::ITensorAccessor&) override {
+ const ov::ITensorAccessor& /*tensor_accessor*/) override {
NODE_VALIDATION_CHECK(m_node.get(), !input_shapes.empty(), "Incorrect number of input shapes");
return {std::vector<StaticShape>{input_shapes[0]}};
}
@@ -351,7 +351,7 @@ public:
using ShapeInferBase::ShapeInferBase;
std::optional<std::vector<StaticShape>> infer(const std::vector<StaticShapeRef>& input_shapes,
- const ov::ITensorAccessor&) override {
+ const ov::ITensorAccessor& /*unused*/) override {
return {op::copy_shape_infer(m_node.get(), input_shapes)};
}
};
@@ -364,7 +364,7 @@ public:
using ShapeInferBase::ShapeInferBase;
std::optional<std::vector<StaticShape>> infer(const std::vector<StaticShapeRef>& input_shapes,
- const ov::ITensorAccessor&) override {
+ const ov::ITensorAccessor& /*unused*/) override {
return {op::eltwise_shape_infer(m_node.get(), input_shapes)};
}
};
@@ -443,7 +443,7 @@ public:
using ShapeInferBase::ShapeInferBase;
std::optional<std::vector<StaticShape>> infer(const std::vector<StaticShapeRef>& input_shapes,
- const ov::ITensorAccessor&) override {
+ const ov::ITensorAccessor& /*unused*/) override {
return {shape_infer(static_cast<TOp*>(m_node.get()), input_shapes)};
}
};
@@ -451,10 +451,7 @@ public:
/** @brief Base shape inference object implementing the IStaticShapeInfer with padding support. */
class ShapeInferPaddingBase : public ShapeInferBase {
public:
- ShapeInferPaddingBase(std::shared_ptr<ov::Node> node)
- : ShapeInferBase(std::move(node)),
- m_pads_begin{},
- m_pads_end{} {}
+ ShapeInferPaddingBase(std::shared_ptr<ov::Node> node) : ShapeInferBase(std::move(node)) {}
const ov::CoordinateDiff& get_pads_begin() override {
return m_pads_begin;
@@ -501,7 +498,7 @@ public:
using ShapeInferPaddingBase::ShapeInferPaddingBase;
std::optional<std::vector<StaticShape>> infer(const std::vector<StaticShapeRef>& input_shapes,
- const ov::ITensorAccessor&) override {
+ const ov::ITensorAccessor& /*unused*/) override {
return {shape_infer(static_cast<TOp*>(m_node.get()), input_shapes, m_pads_begin, m_pads_end)};
}
};
diff --git a/src/plugins/intel_cpu/src/shape_inference/static_shape.cpp b/src/plugins/intel_cpu/src/shape_inference/static_shape.cpp
index d0de8b7ee51..4952e9e6cfd 100644
--- a/src/plugins/intel_cpu/src/shape_inference/static_shape.cpp
+++ b/src/plugins/intel_cpu/src/shape_inference/static_shape.cpp
@@ -42,11 +42,11 @@ bool merge_into(StaticShape& dst, const T& src) {
}
//-- Shape as container
-StaticShape::StaticShapeAdapter() : m_dims{} {}
+StaticShape::StaticShapeAdapter() = default;
StaticShape::StaticShapeAdapter(const TDims& dims) : m_dims{dims} {}
StaticShape::StaticShapeAdapter(TDims&& dims) noexcept : m_dims{std::move(dims)} {}
StaticShape::StaticShapeAdapter(const StaticShape& other) : StaticShapeAdapter(*other) {}
-StaticShape::StaticShapeAdapter(const ov::PartialShape&) : m_dims{} {
+StaticShape::StaticShapeAdapter(const ov::PartialShape& /*unused*/) {
partial_shape_convert_throw();
}
@@ -76,7 +76,7 @@ ov::PartialShape StaticShape::to_partial_shape() const {
return shape;
}
-bool StaticShape::merge_rank(const ov::Rank& r) {
+bool StaticShape::merge_rank(const ov::Rank& r) const {
return r.is_dynamic() || (size() == static_cast<size_t>(r.get_length()));
}
@@ -143,7 +143,7 @@ bool StaticShape::broadcast_merge_into(StaticShape& dst,
//-- Shape as reference
StaticShapeRef::StaticShapeAdapter(const StaticShape& shape) : m_dims{&(*shape)} {}
-StaticShapeRef::StaticShapeAdapter(const ov::PartialShape&) {
+StaticShapeRef::StaticShapeAdapter(const ov::PartialShape& /*unused*/) {
partial_shape_convert_throw();
}
@@ -151,7 +151,7 @@ ov::Rank StaticShapeRef::rank() const {
return {static_cast<typename ov::Rank::value_type>(size())};
}
-bool StaticShapeRef::merge_rank(const ov::Rank& r) {
+bool StaticShapeRef::merge_rank(const ov::Rank& r) const {
return r.is_dynamic() || (size() == static_cast<size_t>(r.get_length()));
}
diff --git a/src/plugins/intel_cpu/src/shape_inference/static_shape.hpp b/src/plugins/intel_cpu/src/shape_inference/static_shape.hpp
index 2b01daa3392..6f3e5f51753 100644
--- a/src/plugins/intel_cpu/src/shape_inference/static_shape.hpp
+++ b/src/plugins/intel_cpu/src/shape_inference/static_shape.hpp
@@ -116,7 +116,7 @@ public:
}
[[nodiscard]] ov::Rank rank() const;
- bool merge_rank(const ov::Rank& r);
+ bool merge_rank(const ov::Rank& r) const;
[[nodiscard]] ov::Shape to_shape() const;
[[nodiscard]] ov::Shape get_max_shape() const;
[[nodiscard]] ov::Shape get_min_shape() const;
@@ -264,7 +264,7 @@ public:
}
[[nodiscard]] ov::Rank rank() const;
- bool merge_rank(const ov::Rank& r);
+ bool merge_rank(const ov::Rank& r) const;
[[nodiscard]] ov::Shape to_shape() const;
[[nodiscard]] ov::Shape get_max_shape() const;
[[nodiscard]] ov::Shape get_min_shape() const;
diff --git a/src/plugins/intel_cpu/src/transformations/cpu_opset/arm/pass/mish_decomposition.cpp b/src/plugins/intel_cpu/src/transformations/cpu_opset/arm/pass/mish_decomposition.cpp
index 6902d782e46..8eea56810b5 100644
--- a/src/plugins/intel_cpu/src/transformations/cpu_opset/arm/pass/mish_decomposition.cpp
+++ b/src/plugins/intel_cpu/src/transformations/cpu_opset/arm/pass/mish_decomposition.cpp
@@ -31,7 +31,7 @@ ov::intel_cpu::MishDecomposition::MishDecomposition() {
auto exp = std::make_shared<ov::op::v0::Exp>(mish->input_value(0));
auto add = std::make_shared<ov::op::v1::Add>(
exp,
- op::v0::Constant::create(mish->get_output_element_type(0), ov::Shape{}, {1.0f}));
+ op::v0::Constant::create(mish->get_output_element_type(0), ov::Shape{}, {1.0F}));
auto log = std::make_shared<ov::op::v0::Log>(add);
auto tanh = std::make_shared<ov::op::v0::Tanh>(log);
auto mul = std::make_shared<ov::op::v1::Multiply>(mish->input_value(0), tanh);
diff --git a/src/plugins/intel_cpu/src/transformations/cpu_opset/common/op/sdpa.cpp b/src/plugins/intel_cpu/src/transformations/cpu_opset/common/op/sdpa.cpp
index c96dae23020..2a49c481557 100644
--- a/src/plugins/intel_cpu/src/transformations/cpu_opset/common/op/sdpa.cpp
+++ b/src/plugins/intel_cpu/src/transformations/cpu_opset/common/op/sdpa.cpp
@@ -129,15 +129,15 @@ void ov::intel_cpu::SDPAWithTransposeReshape::validate_and_infer_types() {
const auto& output_ps = q_ps;
NODE_VALIDATION_CHECK(this, m_config.output_BLHxS == true);
NODE_VALIDATION_CHECK(this, m_config.input_BLHxS == true);
- NODE_VALIDATION_CHECK(this, q_ps.size() == 3u);
+ NODE_VALIDATION_CHECK(this, q_ps.size() == 3U);
// permute_axes should be [B, H, L, S]
const auto& permute_axes = this->m_config.permute_axes;
- NODE_VALIDATION_CHECK(this, permute_axes.size() == 4u);
+ NODE_VALIDATION_CHECK(this, permute_axes.size() == 4U);
// order_HS should be [H,S]
const auto& order_HS = this->m_config.order_HS;
- NODE_VALIDATION_CHECK(this, order_HS.size() == 2u);
+ NODE_VALIDATION_CHECK(this, order_HS.size() == 2U);
set_output_type(0, get_input_element_type(0), output_ps);
}
diff --git a/src/plugins/intel_cpu/src/transformations/cpu_opset/common/op/submodel.cpp b/src/plugins/intel_cpu/src/transformations/cpu_opset/common/op/submodel.cpp
index d11aefd6775..320b0ba65ab 100644
--- a/src/plugins/intel_cpu/src/transformations/cpu_opset/common/op/submodel.cpp
+++ b/src/plugins/intel_cpu/src/transformations/cpu_opset/common/op/submodel.cpp
@@ -16,7 +16,7 @@
namespace ov::intel_cpu {
-SubModel::SubModel(const std::shared_ptr<ov::Model>& body) : SubGraphOp() {
+SubModel::SubModel(const std::shared_ptr<ov::Model>& body) {
SubGraphOp::set_function(body);
}
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 f2a8a88b6e0..a72dd3ce3b7 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
@@ -171,7 +171,7 @@ CausalMaskPreprocess::CausalMaskPreprocess() {
1,
1,
}),
- {0.000000f});
+ {0.000000F});
auto eq_Equal =
makePattern<ov::op::v1::Equal>({causal_mask_boolean_slice | causal_mask_boolean_strided_slice, Constant_107278},
{{"auto_broadcast", "numpy"}}); // tensor_array<u8[?,1,8192,..8192]>
@@ -186,7 +186,7 @@ CausalMaskPreprocess::CausalMaskPreprocess() {
1,
1,
}),
- {0.000000f});
+ {0.000000F});
auto eq_Equal_1 = makePattern<ov::op::v1::Equal>({eq_Convert, Constant_107279},
{{"auto_broadcast", "numpy"}}); // tensor_array<u8[?,1,1,?]>
auto mul_LogicalAnd =
diff --git a/src/plugins/intel_cpu/src/transformations/cpu_opset/common/pass/convert_broadcast_to_tiles.cpp b/src/plugins/intel_cpu/src/transformations/cpu_opset/common/pass/convert_broadcast_to_tiles.cpp
index 8c8c68c1de1..907504e1f92 100644
--- a/src/plugins/intel_cpu/src/transformations/cpu_opset/common/pass/convert_broadcast_to_tiles.cpp
+++ b/src/plugins/intel_cpu/src/transformations/cpu_opset/common/pass/convert_broadcast_to_tiles.cpp
@@ -86,7 +86,8 @@ ov::intel_cpu::ConvertBroadcastToTiles::ConvertBroadcastToTiles() {
auto input_shape_it = input_shape.rbegin();
auto output_shape_it = output_shape.rbegin();
while (output_shape_it != output_shape.rend() && input_shape_it != input_shape.rend()) {
- int64_t in_dim = *input_shape_it, out_dim = *output_shape_it;
+ int64_t in_dim = *input_shape_it;
+ int64_t out_dim = *output_shape_it;
if (in_dim != out_dim) {
if (in_dim != 1) {
return false;
diff --git a/src/plugins/intel_cpu/src/transformations/cpu_opset/common/pass/convert_fq_rnn_to_quantized_rnn.cpp b/src/plugins/intel_cpu/src/transformations/cpu_opset/common/pass/convert_fq_rnn_to_quantized_rnn.cpp
index 7205407d59e..88b978fd1a1 100644
--- a/src/plugins/intel_cpu/src/transformations/cpu_opset/common/pass/convert_fq_rnn_to_quantized_rnn.cpp
+++ b/src/plugins/intel_cpu/src/transformations/cpu_opset/common/pass/convert_fq_rnn_to_quantized_rnn.cpp
@@ -194,7 +194,7 @@ ov::intel_cpu::ConvertFqRnnToQuantizedRnn::ConvertFqRnnToQuantizedRnn() {
}
const auto* input_scale_ptr = input_scale_constant->get_data_ptr<float>();
- if (*input_scale_ptr == 0.f) {
+ if (*input_scale_ptr == 0.F) {
OPENVINO_THROW("Cannot handle zero input scale");
}
diff --git a/src/plugins/intel_cpu/src/transformations/cpu_opset/common/pass/convert_matmul_to_fc.cpp b/src/plugins/intel_cpu/src/transformations/cpu_opset/common/pass/convert_matmul_to_fc.cpp
index 34fe90aea54..08d042cabe0 100644
--- a/src/plugins/intel_cpu/src/transformations/cpu_opset/common/pass/convert_matmul_to_fc.cpp
+++ b/src/plugins/intel_cpu/src/transformations/cpu_opset/common/pass/convert_matmul_to_fc.cpp
@@ -95,7 +95,8 @@ ov::intel_cpu::ConvertMatMulToFC::ConvertMatMulToFC() {
auto get_aligned_shapes =
[shape_a, shape_b, rank_a, rank_b, &matmul]() -> std::tuple<bool, ov::PartialShape, ov::PartialShape> {
- ov::PartialShape shape_a_aligned(shape_a), shape_b_aligned(shape_b);
+ ov::PartialShape shape_a_aligned(shape_a);
+ ov::PartialShape shape_b_aligned(shape_b);
size_t max_size = std::max(rank_a, rank_b);
for (size_t i = 0, cnt = max_size - rank_a; i < cnt; ++i) {
shape_a_aligned.insert(shape_a_aligned.begin(), 1);
@@ -150,13 +151,15 @@ ov::intel_cpu::ConvertMatMulToFC::ConvertMatMulToFC() {
};
bool success = true;
- ov::PartialShape shape_a_aligned, shape_b_aligned;
+ ov::PartialShape shape_a_aligned;
+ ov::PartialShape shape_b_aligned;
std::tie(success, shape_a_aligned, shape_b_aligned) = get_aligned_shapes();
if (!success) {
return false;
}
- auto aligned_a_rank = shape_a_aligned.rank(), aligned_b_rank = shape_b_aligned.rank();
+ auto aligned_a_rank = shape_a_aligned.rank();
+ auto aligned_b_rank = shape_b_aligned.rank();
if (aligned_a_rank.is_dynamic() || aligned_b_rank.is_dynamic() || aligned_a_rank.get_length() < 2 ||
aligned_b_rank.get_length() < 2) {
OPENVINO_THROW("MatMul " + matmul->get_friendly_name() + " shapes are inconsistent.");
diff --git a/src/plugins/intel_cpu/src/transformations/cpu_opset/common/pass/convert_to_power_static.cpp b/src/plugins/intel_cpu/src/transformations/cpu_opset/common/pass/convert_to_power_static.cpp
index b133ff449e2..e4bf97e5014 100644
--- a/src/plugins/intel_cpu/src/transformations/cpu_opset/common/pass/convert_to_power_static.cpp
+++ b/src/plugins/intel_cpu/src/transformations/cpu_opset/common/pass/convert_to_power_static.cpp
@@ -102,36 +102,36 @@ std::shared_ptr<ov::Node> convert(const std::shared_ptr<BaseOp>& node) {
if (std::is_same_v<BaseOp, ov::op::v1::Power>) {
return std::make_shared<ov::intel_cpu::PowerStaticNode>(node->input(nonConstPort).get_source_output(),
value,
- 1.0f,
- 0.0f,
+ 1.0F,
+ 0.0F,
node->output(0).get_element_type());
}
if (std::is_same_v<BaseOp, ov::op::v1::Add>) {
return std::make_shared<ov::intel_cpu::PowerStaticNode>(node->input(nonConstPort).get_source_output(),
- 1.0f,
- 1.0f,
+ 1.0F,
+ 1.0F,
value,
node->output(0).get_element_type());
}
if (std::is_same_v<BaseOp, ov::op::v1::Subtract>) {
- float scale = 1.0f;
+ float scale = 1.0F;
float shift = value;
if (constPort == 0) {
- scale *= -1.0f;
+ scale *= -1.0F;
} else {
- shift *= -1.0f;
+ shift *= -1.0F;
}
return std::make_shared<ov::intel_cpu::PowerStaticNode>(node->input(nonConstPort).get_source_output(),
- 1.0f,
+ 1.0F,
scale,
shift,
node->output(0).get_element_type());
}
if (std::is_same_v<BaseOp, ov::op::v1::Multiply>) {
return std::make_shared<ov::intel_cpu::PowerStaticNode>(node->input(nonConstPort).get_source_output(),
- 1.f,
+ 1.F,
value,
- 0.0f,
+ 0.0F,
node->output(0).get_element_type());
}
OPENVINO_THROW("ConvertToPowerStatic: op type is not supported");
diff --git a/src/plugins/intel_cpu/src/transformations/cpu_opset/common/pass/decompose_rms_norm.cpp b/src/plugins/intel_cpu/src/transformations/cpu_opset/common/pass/decompose_rms_norm.cpp
index 33b9b84f4cb..7bb2e64f065 100644
--- a/src/plugins/intel_cpu/src/transformations/cpu_opset/common/pass/decompose_rms_norm.cpp
+++ b/src/plugins/intel_cpu/src/transformations/cpu_opset/common/pass/decompose_rms_norm.cpp
@@ -39,7 +39,7 @@ DecomposeRMSNorm::DecomposeRMSNorm() {
auto data_precision = node->get_input_element_type(0);
auto scale = node->input_value(1);
- auto power_const = ov::op::v0::Constant::create(data_precision, {}, std::vector<float>{2.f});
+ auto power_const = ov::op::v0::Constant::create(data_precision, {}, std::vector<float>{2.F});
auto power = std::make_shared<ov::op::v1::Power>(data, power_const);
auto mean_axes = ov::op::v0::Constant::create(ov::element::i32, ov::Shape{1}, {-1});
auto mean = std::make_shared<ov::op::v1::ReduceMean>(power, mean_axes, true);
diff --git a/src/plugins/intel_cpu/src/transformations/cpu_opset/common/pass/move_readvalue_inputs_to_subgraph.cpp b/src/plugins/intel_cpu/src/transformations/cpu_opset/common/pass/move_readvalue_inputs_to_subgraph.cpp
index 0a006fb5a0d..85d12f76b02 100644
--- a/src/plugins/intel_cpu/src/transformations/cpu_opset/common/pass/move_readvalue_inputs_to_subgraph.cpp
+++ b/src/plugins/intel_cpu/src/transformations/cpu_opset/common/pass/move_readvalue_inputs_to_subgraph.cpp
@@ -35,7 +35,7 @@ ov::intel_cpu::MoveReadValueInputsToSubgraph::MoveReadValueInputsToSubgraph() {
ov::matcher_pass_callback callback = [=](Matcher& m) {
const auto& pattern_map = m.get_pattern_value_map();
auto readvalue = as_type_ptr<ov::op::v6::ReadValue>(pattern_map.at(readvalue_pattern).get_node_shared_ptr());
- if (!readvalue || readvalue->get_input_size() != 1u) {
+ if (!readvalue || readvalue->get_input_size() != 1U) {
return false;
}
diff --git a/src/plugins/intel_cpu/src/transformations/cpu_opset/common/pass/permute_slice_n_interpolation.cpp b/src/plugins/intel_cpu/src/transformations/cpu_opset/common/pass/permute_slice_n_interpolation.cpp
index 2def8ef7d87..b9bb1de4d4b 100644
--- a/src/plugins/intel_cpu/src/transformations/cpu_opset/common/pass/permute_slice_n_interpolation.cpp
+++ b/src/plugins/intel_cpu/src/transformations/cpu_opset/common/pass/permute_slice_n_interpolation.cpp
@@ -81,7 +81,7 @@ intel_cpu::PermuteSliceAndInterpolation::PermuteSliceAndInterpolation() {
copy_runtime_info(interpolate, new_interpolate);
auto slice_inputs = slice->input_values();
- auto new_slice_axes = std::make_shared<op::v0::Constant>(element::i64, ov::Shape{1}, 1lu);
+ auto new_slice_axes = std::make_shared<op::v0::Constant>(element::i64, ov::Shape{1}, 1LU);
slice_inputs[0] = new_interpolate;
slice_inputs[4] = new_slice_axes;
diff --git a/src/plugins/intel_cpu/src/transformations/cpu_opset/common/pass/stateful_sdpa_fusion.cpp b/src/plugins/intel_cpu/src/transformations/cpu_opset/common/pass/stateful_sdpa_fusion.cpp
index e7dc3913d41..1929ad108f6 100644
--- a/src/plugins/intel_cpu/src/transformations/cpu_opset/common/pass/stateful_sdpa_fusion.cpp
+++ b/src/plugins/intel_cpu/src/transformations/cpu_opset/common/pass/stateful_sdpa_fusion.cpp
@@ -77,10 +77,18 @@ StatefulSDPAFusion::StatefulSDPAFusion() {
auto concat_k = makePattern<ov::op::v0::Concat>({gather_input_k, cur_k}, {{"axis", axis_seq_len}});
auto concat_v = makePattern<ov::op::v0::Concat>({gather_input_v, cur_v}, {{"axis", axis_seq_len}});
- std::shared_ptr<Node> reshape_k, reshape_v, unsqueeze_k, unsqueeze_v;
- std::shared_ptr<Node> computed_bcst_k, computed_bcst_v, multiply_k, multiply_v;
- std::shared_ptr<Node> mq_reshape_k, mq_reshape_v;
- std::shared_ptr<Node> computed_bcst3_k, computed_bcst3_v;
+ std::shared_ptr<Node> reshape_k;
+ std::shared_ptr<Node> reshape_v;
+ std::shared_ptr<Node> unsqueeze_k;
+ std::shared_ptr<Node> unsqueeze_v;
+ std::shared_ptr<Node> computed_bcst_k;
+ std::shared_ptr<Node> computed_bcst_v;
+ std::shared_ptr<Node> multiply_k;
+ std::shared_ptr<Node> multiply_v;
+ std::shared_ptr<Node> mq_reshape_k;
+ std::shared_ptr<Node> mq_reshape_v;
+ std::shared_ptr<Node> computed_bcst3_k;
+ std::shared_ptr<Node> computed_bcst3_v;
auto multi_query_bcst = [](const std::shared_ptr<Node>& kv) {
auto reshape_kv = makePattern<ov::op::v1::Reshape>({kv, any_input()});
auto unsqueeze_kv = makePattern<ov::op::v0::Unsqueeze>({kv, any_input()});
@@ -89,7 +97,7 @@ StatefulSDPAFusion::StatefulSDPAFusion() {
auto node = ov::as_type_ptr<ov::op::v0::Constant>(output.get_node_shared_ptr());
const auto& bcst_arg = node->cast_vector<float>();
return std::all_of(bcst_arg.begin(), bcst_arg.end(), [](float i) {
- return i == 1.0f;
+ return i == 1.0F;
});
};
auto constant_bcst = wrap_type<ov::op::v0::Constant>(check_one);
@@ -209,8 +217,10 @@ StatefulSDPAFusion::StatefulSDPAFusion() {
}
}
- ov::op::v6::Assign *assign_k_node = nullptr, *assign_v_node = nullptr;
- ov::op::v0::Convert *assign_cvt_k_node = nullptr, *assign_cvt_v_node = nullptr;
+ ov::op::v6::Assign* assign_k_node = nullptr;
+ ov::op::v6::Assign* assign_v_node = nullptr;
+ ov::op::v0::Convert* assign_cvt_k_node = nullptr;
+ ov::op::v0::Convert* assign_cvt_v_node = nullptr;
if (!find_assign(concat_k_node, assign_k_node, assign_cvt_k_node)) {
return false;
}
diff --git a/src/plugins/intel_cpu/src/transformations/cpu_opset/x64/op/interaction.cpp b/src/plugins/intel_cpu/src/transformations/cpu_opset/x64/op/interaction.cpp
index 54688325ef1..fd7b74fa372 100644
--- a/src/plugins/intel_cpu/src/transformations/cpu_opset/x64/op/interaction.cpp
+++ b/src/plugins/intel_cpu/src/transformations/cpu_opset/x64/op/interaction.cpp
@@ -59,7 +59,6 @@ void ov::intel_cpu::InteractionNode::validate_and_infer_types() {
output_shape[0] = batch;
output_shape[1] = output_feature_size;
set_output_type(0, output_type, output_shape);
- return;
}
bool ov::intel_cpu::InteractionNode::visit_attributes(ov::AttributeVisitor& visitor) {
diff --git a/src/plugins/intel_cpu/src/transformations/cpu_opset/x64/pass/convert_to_interaction.cpp b/src/plugins/intel_cpu/src/transformations/cpu_opset/x64/pass/convert_to_interaction.cpp
index e00809bb2f5..db30e316421 100644
--- a/src/plugins/intel_cpu/src/transformations/cpu_opset/x64/pass/convert_to_interaction.cpp
+++ b/src/plugins/intel_cpu/src/transformations/cpu_opset/x64/pass/convert_to_interaction.cpp
@@ -118,7 +118,7 @@ ov::intel_cpu::FuseFQtoInteraction::FuseFQtoInteraction() {
auto fq_node = ov::as_type_ptr<ov::op::v0::FakeQuantize>(pattern_to_output.at(fq_m).get_node_shared_ptr());
OPENVINO_ASSERT(fq_node != nullptr, "FakeQuantize node is not found");
std::vector<float> fq_scale;
- fq_scale = simplifyToScale(fq_node, 0.001f);
+ fq_scale = simplifyToScale(fq_node, 0.001F);
if (fq_scale.empty()) {
return false;
}
diff --git a/src/plugins/intel_cpu/src/transformations/cpu_opset/x64/pass/qkv_proj_fusion.cpp b/src/plugins/intel_cpu/src/transformations/cpu_opset/x64/pass/qkv_proj_fusion.cpp
index 4054731b0e2..0061c86c728 100644
--- a/src/plugins/intel_cpu/src/transformations/cpu_opset/x64/pass/qkv_proj_fusion.cpp
+++ b/src/plugins/intel_cpu/src/transformations/cpu_opset/x64/pass/qkv_proj_fusion.cpp
@@ -83,7 +83,7 @@ ov::intel_cpu::QKVProjFusion::QKVProjFusion() {
// maybe a ShapeOf
continue;
}
- if (mm->get_transpose_a() != false || mm->get_transpose_b() != true) {
+ if (mm->get_transpose_a() || !mm->get_transpose_b()) {
return false;
}
diff --git a/src/plugins/intel_cpu/src/transformations/snippets/aarch64/pass/snippets_mark_skipped.cpp b/src/plugins/intel_cpu/src/transformations/snippets/aarch64/pass/snippets_mark_skipped.cpp
index eaf78573a5e..da8188fd2f5 100644
--- a/src/plugins/intel_cpu/src/transformations/snippets/aarch64/pass/snippets_mark_skipped.cpp
+++ b/src/plugins/intel_cpu/src/transformations/snippets/aarch64/pass/snippets_mark_skipped.cpp
@@ -45,7 +45,7 @@
namespace ov::intel_cpu {
namespace {
-static const int DEFAULT_AXIS = 1;
+const int DEFAULT_AXIS = 1;
NodeFusingType GetNodeFusingType(const std::shared_ptr<const Node>& node) {
const auto& rt = node->get_rt_info();
const auto rinfo = rt.find("MayBeFusedInPlugin");
diff --git a/src/plugins/intel_cpu/src/transformations/snippets/x64/op/brgemm_copy_b.hpp b/src/plugins/intel_cpu/src/transformations/snippets/x64/op/brgemm_copy_b.hpp
index 839ee5db63b..5386bfcc0e7 100644
--- a/src/plugins/intel_cpu/src/transformations/snippets/x64/op/brgemm_copy_b.hpp
+++ b/src/plugins/intel_cpu/src/transformations/snippets/x64/op/brgemm_copy_b.hpp
@@ -83,7 +83,7 @@ public:
private:
void custom_constructor_validate_and_infer_types(const std::vector<size_t>& layout_input = {});
- void validate_element_type(const ov::element::Type& element_type);
+ static void validate_element_type(const ov::element::Type& element_type);
BRGEMM_TYPE m_type = BRGEMM_TYPE::REPACKING_ONLY;
element::Type m_src_type = ov::element::dynamic; // src element type of the corresponding BRGEMM
diff --git a/src/plugins/intel_cpu/src/transformations/snippets/x64/op/brgemm_cpu.cpp b/src/plugins/intel_cpu/src/transformations/snippets/x64/op/brgemm_cpu.cpp
index 4135f2c6c55..c97e885f0c8 100644
--- a/src/plugins/intel_cpu/src/transformations/snippets/x64/op/brgemm_cpu.cpp
+++ b/src/plugins/intel_cpu/src/transformations/snippets/x64/op/brgemm_cpu.cpp
@@ -35,8 +35,7 @@ BrgemmCPU::BrgemmCPU(const Output<Node>& A,
const std::vector<size_t>& layout_a,
const std::vector<size_t>& layout_b,
const std::vector<size_t>& layout_c)
- : Brgemm(),
- m_type(type) {
+ : m_type(type) {
// We call default ctor of Brgemm class to avoid incorrect shape infer in constructor_validate_and_type_infer() call
set_arguments({A, B});
set_output_size(1);
@@ -58,8 +57,7 @@ BrgemmCPU::BrgemmCPU(const Output<Node>& A,
const std::vector<size_t>& layout_a,
const std::vector<size_t>& layout_b,
const std::vector<size_t>& layout_c)
- : Brgemm(),
- m_type(type) {
+ : m_type(type) {
set_arguments({A, B, scratch});
set_output_size(1);
ctor_initialize(std::set<size_t>{0, 1, 2}, std::set<size_t>{0});
@@ -79,8 +77,7 @@ BrgemmCPU::BrgemmCPU(const Output<Node>& A,
const std::vector<size_t>& layout_a,
const std::vector<size_t>& layout_b,
const std::vector<size_t>& layout_c)
- : Brgemm(),
- m_type(type) {
+ : m_type(type) {
set_arguments({A, B});
set_output_size(1);
m_input_ports = {{0, desc_a}, {1, desc_b}};
@@ -99,8 +96,7 @@ BrgemmCPU::BrgemmCPU(const Output<Node>& A,
const std::vector<size_t>& layout_a,
const std::vector<size_t>& layout_b,
const std::vector<size_t>& layout_c)
- : Brgemm(),
- m_type(type) {
+ : m_type(type) {
set_arguments({A, B, scratch});
set_output_size(1);
m_input_ports = {{0, desc_a}, {1, desc_b}, {2, desc_scratch}};
diff --git a/src/plugins/intel_cpu/src/transformations/snippets/x64/op/perf_count_rdtsc.cpp b/src/plugins/intel_cpu/src/transformations/snippets/x64/op/perf_count_rdtsc.cpp
index c0beb97fcc2..b7671673d60 100644
--- a/src/plugins/intel_cpu/src/transformations/snippets/x64/op/perf_count_rdtsc.cpp
+++ b/src/plugins/intel_cpu/src/transformations/snippets/x64/op/perf_count_rdtsc.cpp
@@ -17,7 +17,7 @@ using namespace ov;
using namespace ov::intel_cpu;
/////////////////////////PerfCountRdtscBegin//////////////////////
-PerfCountRdtscBegin::PerfCountRdtscBegin() : PerfCountBeginBase() {
+PerfCountRdtscBegin::PerfCountRdtscBegin() {
validate_and_infer_types_except_PerfCountEnd();
}
diff --git a/src/plugins/intel_cpu/src/transformations/snippets/x64/pass/enforce_precision.cpp b/src/plugins/intel_cpu/src/transformations/snippets/x64/pass/enforce_precision.cpp
index 8eba9acd03b..1a6ada34399 100644
--- a/src/plugins/intel_cpu/src/transformations/snippets/x64/pass/enforce_precision.cpp
+++ b/src/plugins/intel_cpu/src/transformations/snippets/x64/pass/enforce_precision.cpp
@@ -70,7 +70,7 @@ bool EnforcePrecision::run_on_model(const std::shared_ptr<ov::Model>& f) {
}
auto port_has_to_be_handled = false;
- for (auto index = 0ull; index < supported_precisions.size(); ++index) {
+ for (auto index = 0ULL; index < supported_precisions.size(); ++index) {
if ((supported_precisions[index] == target) && (actual_precisions[index] == source)) {
// actual input precision has to be enforced: at least one port has to be handled
port_has_to_be_handled = true;
@@ -104,7 +104,7 @@ bool EnforcePrecision::run_on_model(const std::shared_ptr<ov::Model>& f) {
op->set_argument(input_index, convert);
};
- for (auto index = 0ull; index < supported_precisions_to_enforce.size(); ++index) {
+ for (auto index = 0ULL; index < supported_precisions_to_enforce.size(); ++index) {
if ((supported_precisions_to_enforce[index] == target) || (actual_precisions[index] == source)) {
const auto op_parent =
ov::as_type_ptr<snippets::op::ConvertSaturation>(op->get_input_node_shared_ptr(index));
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 1de4e88d5af..9df0e7a8d97 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
@@ -69,7 +69,9 @@ 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, n_blk, k_blk;
+ 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);
// [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)
diff --git a/src/plugins/intel_cpu/src/transformations/snippets/x64/pass/lowered/fuse_load_store_and_convert.hpp b/src/plugins/intel_cpu/src/transformations/snippets/x64/pass/lowered/fuse_load_store_and_convert.hpp
index b2ba00ccacb..eea4b855822 100644
--- a/src/plugins/intel_cpu/src/transformations/snippets/x64/pass/lowered/fuse_load_store_and_convert.hpp
+++ b/src/plugins/intel_cpu/src/transformations/snippets/x64/pass/lowered/fuse_load_store_and_convert.hpp
@@ -27,10 +27,10 @@ public:
snippets::lowered::LinearIR::constExprIt end) override;
private:
- bool fuse_load_convert(snippets::lowered::LinearIR& linear_ir,
- snippets::lowered::LinearIR::constExprIt& convert_it);
- bool fuse_store_convert(snippets::lowered::LinearIR& linear_ir,
- snippets::lowered::LinearIR::constExprIt& convert_it);
+ static bool fuse_load_convert(snippets::lowered::LinearIR& linear_ir,
+ snippets::lowered::LinearIR::constExprIt& convert_it);
+ static bool fuse_store_convert(snippets::lowered::LinearIR& linear_ir,
+ snippets::lowered::LinearIR::constExprIt& convert_it);
};
} // namespace ov::intel_cpu::pass
diff --git a/src/plugins/intel_cpu/src/transformations/snippets/x64/pass/lowered/init_repacked_constant_inputs.cpp b/src/plugins/intel_cpu/src/transformations/snippets/x64/pass/lowered/init_repacked_constant_inputs.cpp
index e39c4acc501..edab4d2b410 100644
--- a/src/plugins/intel_cpu/src/transformations/snippets/x64/pass/lowered/init_repacked_constant_inputs.cpp
+++ b/src/plugins/intel_cpu/src/transformations/snippets/x64/pass/lowered/init_repacked_constant_inputs.cpp
@@ -87,7 +87,8 @@ bool InitRepackedConstantInputs::run(const snippets::lowered::LinearIR& linear_i
const auto& order = BrgemmExternalRepackingAdjuster::get_blk_order(planar_shape.size());
const auto& desc = std::make_shared<CpuBlockedMemoryDesc>(prc, Shape(planar_shape), blk_shape, order);
- ov::snippets::VectorDims src_offsets, dst_offsets;
+ ov::snippets::VectorDims src_offsets;
+ ov::snippets::VectorDims dst_offsets;
ov::snippets::utils::init_strides(shape, shape.size(), prc.size(), 0, src_offsets);
ov::snippets::utils::init_strides(blk_shape, blk_shape.size(), prc.size(), 0, dst_offsets);
// Last three dimensions of blocked shapes are processed in the kernel. To align with src, we removed last
diff --git a/src/plugins/intel_cpu/src/transformations/snippets/x64/pass/snippets_mark_skipped.cpp b/src/plugins/intel_cpu/src/transformations/snippets/x64/pass/snippets_mark_skipped.cpp
index bd0a86eee41..303a161230f 100644
--- a/src/plugins/intel_cpu/src/transformations/snippets/x64/pass/snippets_mark_skipped.cpp
+++ b/src/plugins/intel_cpu/src/transformations/snippets/x64/pass/snippets_mark_skipped.cpp
@@ -65,7 +65,7 @@
namespace ov::intel_cpu {
namespace {
-static const int DEFAULT_AXIS = 1;
+const int DEFAULT_AXIS = 1;
NodeFusingType GetNodeFusingType(const std::shared_ptr<const Node>& node) {
const auto& rt = node->get_rt_info();
const auto rinfo = rt.find("MayBeFusedInPlugin");
@@ -440,7 +440,7 @@ bool isSuitableParentForFusingSumActivation(const std::shared_ptr<const Node>& n
return false;
}
auto isFusedBiasNode = [](const std::shared_ptr<Node>& n) {
- if (!(ov::is_type<ov::op::v1::Add>(n) && GetNodeFusingType(n) == NodeFusingType::FusedWithConvolution)) {
+ if (!ov::is_type<ov::op::v1::Add>(n) || GetNodeFusingType(n) != NodeFusingType::FusedWithConvolution) {
return false;
}
const auto conv = n->get_input_source_output(0);
@@ -468,11 +468,10 @@ bool isSuitableParentForFusingSumActivation(const std::shared_ptr<const Node>& n
const auto channelAxis = 1;
return conv_shape[channelAxis].is_static() &&
conv_shape[channelAxis].get_length() == static_cast<int64_t>(bias_norm_dims[channelAxis]) &&
- bias_norm_dims[channelAxis] == static_cast<size_t>(shape_size(bias_norm_dims));
+ bias_norm_dims[channelAxis] == shape_size(bias_norm_dims);
};
auto isFusedFQNode = [&isFusedBiasNode](const std::shared_ptr<Node>& n) {
- if (!(ov::is_type<ov::op::v0::FakeQuantize>(n) &&
- GetNodeFusingType(n) == NodeFusingType::FusedWithConvolution)) {
+ if (!ov::is_type<ov::op::v0::FakeQuantize>(n) || GetNodeFusingType(n) != NodeFusingType::FusedWithConvolution) {
return false;
}
const auto& parent = n->get_input_node_shared_ptr(0);
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 9e3238057df..7bd571ea66a 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,12 +41,16 @@ 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, n, k;
+ size_t m;
+ size_t n;
+ size_t k;
std::tie(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, n_blk, k_blk;
+ 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 get_projected_blk = [](const size_t dim, const size_t blk) {
diff --git a/src/plugins/intel_cpu/src/transformations/tpp/x64/op/eltwise.cpp b/src/plugins/intel_cpu/src/transformations/tpp/x64/op/eltwise.cpp
index 81aa188121e..da72d0b1777 100644
--- a/src/plugins/intel_cpu/src/transformations/tpp/x64/op/eltwise.cpp
+++ b/src/plugins/intel_cpu/src/transformations/tpp/x64/op/eltwise.cpp
@@ -84,13 +84,16 @@ libxsmm_bitfield BinaryEltwiseTPP::get_broadcasting_flags(const snippets::Vector
snippets::VectorDims subshape_0 = get_subshape(shape_0);
snippets::VectorDims subshape_1 = get_subshape(shape_1);
- if (snippets::utils::is_dynamic_vdims(subshape_0) || snippets::utils::is_dynamic_vdims(subshape_1))
+ if (snippets::utils::is_dynamic_vdims(subshape_0) || snippets::utils::is_dynamic_vdims(subshape_1)) {
return LIBXSMM_MELTW_FLAG_BINARY_NONE;
+ }
if (subshape_0 == subshape_1) {
return LIBXSMM_MELTW_FLAG_BINARY_NONE;
- } else if (ov::shape_size(subshape_0) == 1) {
+ }
+ if (ov::shape_size(subshape_0) == 1) {
return LIBXSMM_MELTW_FLAG_BINARY_BCAST_SCALAR_IN_0;
- } else if (ov::shape_size(subshape_1) == 1) {
+ }
+ if (ov::shape_size(subshape_1) == 1) {
return LIBXSMM_MELTW_FLAG_BINARY_BCAST_SCALAR_IN_1;
} else {
libxsmm_bitfield flags = LIBXSMM_MELTW_FLAG_BINARY_NONE;
@@ -162,19 +165,19 @@ UNARY_AUX_METHODS(Relu)
Reciprocal::Reciprocal(const Output<Node>& arg)
: UnaryEltwiseTPP(LIBXSMM_MELTW_TYPE_UNARY_RECIPROCAL),
- ov::snippets::op::PowerStatic(arg, -1.f) {}
+ ov::snippets::op::PowerStatic(arg, -1.F) {}
UNARY_AUX_METHODS(Reciprocal)
Square::Square(const Output<Node>& arg)
: UnaryEltwiseTPP(LIBXSMM_MELTW_TYPE_UNARY_X2),
- ov::snippets::op::PowerStatic(arg, 2.f) {}
+ ov::snippets::op::PowerStatic(arg, 2.F) {}
UNARY_AUX_METHODS(Square)
SquareRoot::SquareRoot(const Output<Node>& arg)
: UnaryEltwiseTPP(LIBXSMM_MELTW_TYPE_UNARY_SQRT),
- ov::snippets::op::PowerStatic(arg, 0.5f) {}
+ ov::snippets::op::PowerStatic(arg, 0.5F) {}
UNARY_AUX_METHODS(SquareRoot)
diff --git a/src/plugins/intel_cpu/src/transformations/tpp/x64/op/equation.cpp b/src/plugins/intel_cpu/src/transformations/tpp/x64/op/equation.cpp
index 54e08082148..5f860746e67 100644
--- a/src/plugins/intel_cpu/src/transformations/tpp/x64/op/equation.cpp
+++ b/src/plugins/intel_cpu/src/transformations/tpp/x64/op/equation.cpp
@@ -47,8 +47,9 @@ std::shared_ptr<Node> EquationTPP::clone_with_new_inputs(const OutputVector& new
bool EquationTPP::visit_attributes(AttributeVisitor& visitor) {
std::ostringstream ss;
- for (size_t i = 0; i + 1 < m_op_descs.size(); i++)
+ for (size_t i = 0; i + 1 < m_op_descs.size(); i++) {
ss << m_op_descs[i] << ", ";
+ }
ss << m_op_descs.back();
std::string str = ss.str();
visitor.on_attribute("op_descs", str);
diff --git a/src/plugins/intel_cpu/src/transformations/tpp/x64/op/factory.cpp b/src/plugins/intel_cpu/src/transformations/tpp/x64/op/factory.cpp
index 468a8d2ad9f..7e4d51d9bf5 100644
--- a/src/plugins/intel_cpu/src/transformations/tpp/x64/op/factory.cpp
+++ b/src/plugins/intel_cpu/src/transformations/tpp/x64/op/factory.cpp
@@ -33,7 +33,7 @@ struct CustomPowerStaticBuilder : public NodeFactory::TPPCustomBuilder {
matcher = [](const std::shared_ptr<ov::Node>& n) {
std::set<float> supported_power{-1, 2, 0.5};
const auto& power_static = ov::as_type_ptr<const snippets::op::PowerStatic>(n);
- return power_static && supported_power.count(power_static->get_power());
+ return power_static && (supported_power.count(power_static->get_power()) != 0U);
};
builder = [](const std::shared_ptr<ov::Node>& n) {
const auto& power_static = ov::as_type_ptr<snippets::op::PowerStatic>(n);
@@ -41,11 +41,11 @@ struct CustomPowerStaticBuilder : public NodeFactory::TPPCustomBuilder {
const auto power = power_static->get_power();
const auto& input = n->input_value(0);
std::shared_ptr<ov::Node> tpp_node{nullptr};
- if (power == -1.f) {
+ if (power == -1.F) {
tpp_node = std::make_shared<Reciprocal>(input);
- } else if (power == 2.f) {
+ } else if (power == 2.F) {
tpp_node = std::make_shared<Square>(input);
- } else if (power == 0.5f) {
+ } else if (power == 0.5F) {
tpp_node = std::make_shared<SquareRoot>(input);
}
OPENVINO_ASSERT(tpp_node, "Failed to create TPP in power_static_builder");
@@ -117,7 +117,7 @@ bool NodeFactory::is_supported(const std::shared_ptr<ov::Node>& n) {
return in.get_element_type() == element::f32;
};
const bool all_inputs_fp32 = std::all_of(ins.begin(), ins.end(), is_fp32_input);
- return (m_direct_mapping.count(n->get_type_info()) ||
+ return ((m_direct_mapping.count(n->get_type_info()) != 0U) ||
std::any_of(m_custom_mapping.begin(), m_custom_mapping.end(), matches)) &&
all_inputs_fp32;
}
diff --git a/src/plugins/intel_cpu/src/transformations/tpp/x64/pass/fuse_tpp_to_equations.cpp b/src/plugins/intel_cpu/src/transformations/tpp/x64/pass/fuse_tpp_to_equations.cpp
index e154f98e108..7e15f80db12 100644
--- a/src/plugins/intel_cpu/src/transformations/tpp/x64/pass/fuse_tpp_to_equations.cpp
+++ b/src/plugins/intel_cpu/src/transformations/tpp/x64/pass/fuse_tpp_to_equations.cpp
@@ -95,8 +95,9 @@ bool FuseTPPToEquations::fuse_from_root(const NodePtr& root, const std::shared_p
auto equation = std::make_shared<op::EquationTPP>(eq_ivals, op_descs);
- for (auto& kv : node_replace_map)
+ for (auto& kv : node_replace_map) {
kv.second = equation;
+ }
replace_nodes(m, {}, node_replace_map);
for (const auto& in : equation->inputs()) {
auto subtensor = root_subtensor;
diff --git a/src/plugins/intel_cpu/src/transformations/tpp/x64/pass/scalar_to_scalar_tpp.cpp b/src/plugins/intel_cpu/src/transformations/tpp/x64/pass/scalar_to_scalar_tpp.cpp
index 81cd313de1e..be37eccc510 100644
--- a/src/plugins/intel_cpu/src/transformations/tpp/x64/pass/scalar_to_scalar_tpp.cpp
+++ b/src/plugins/intel_cpu/src/transformations/tpp/x64/pass/scalar_to_scalar_tpp.cpp
@@ -33,8 +33,9 @@ ScalarToScalarTPP::ScalarToScalarTPP() {
size_t num_connected_tpp = 0;
const auto& target_ins = node->get_output_target_inputs(0);
for (const auto& in : target_ins) {
- if (dynamic_cast<tpp::modifier::TensorProcessingPrimitive*>(in.get_node()))
+ if (dynamic_cast<tpp::modifier::TensorProcessingPrimitive*>(in.get_node())) {
num_connected_tpp++;
+ }
}
if (num_connected_tpp == 0) {
return false;
@@ -48,8 +49,9 @@ ScalarToScalarTPP::ScalarToScalarTPP() {
ov::replace_node_update_name(node, tpp_scalar);
const auto& out = tpp_scalar->output(0);
ov::snippets::lowered::PortDescriptorUtils::set_port_descriptor(out, {1});
- for (const auto& in : out.get_target_inputs())
+ for (const auto& in : out.get_target_inputs()) {
ov::snippets::lowered::PortDescriptorUtils::set_port_descriptor(in, {1});
+ }
return true;
};
diff --git a/src/plugins/intel_cpu/src/transformations/transformation_pipeline.cpp b/src/plugins/intel_cpu/src/transformations/transformation_pipeline.cpp
index f04850fceb9..1fa450e0d0f 100644
--- a/src/plugins/intel_cpu/src/transformations/transformation_pipeline.cpp
+++ b/src/plugins/intel_cpu/src/transformations/transformation_pipeline.cpp
@@ -252,7 +252,7 @@ namespace ov::intel_cpu {
using const_node_ptr = const std::shared_ptr<const ov::Node>;
-bool Transformations::is_decompression_multiply(const_node_ptr& node) const {
+bool Transformations::is_decompression_multiply(const_node_ptr& node) {
auto all_has_type = [](const std::set<ov::Input<ov::Node>>& consumers, const ov::DiscreteTypeInfo& type) {
return std::all_of(consumers.begin(), consumers.end(), [&type](const ov::Input<ov::Node>& input) {
return input.get_node()->get_type_info() == type;
@@ -621,7 +621,7 @@ void Transformations::PreLpt(const std::vector<ov::element::Type>& defaultPrecis
CPU_SET_CALLBACK_COMMON(
manager,
[](const_node_ptr& node) -> bool {
- return node->input_value(0).get_shape().size() <= 5lu &&
+ return node->input_value(0).get_shape().size() <= 5LU &&
node->input_value(0).get_shape().size() == node->get_output_shape(0).size();
},
ov::pass::ConvertSpaceToDepth,
@@ -631,7 +631,7 @@ void Transformations::PreLpt(const std::vector<ov::element::Type>& defaultPrecis
manager,
[](const_node_ptr& node) -> bool {
const auto& rank = node->input(0).get_partial_shape().rank().get_length();
- return rank == 4lu || rank == 5lu;
+ return rank == 4LU || rank == 5LU;
},
ov::pass::ConvertBatchToSpace,
ov::pass::ConvertSpaceToBatch);
@@ -766,7 +766,7 @@ void Transformations::PreLpt(const std::vector<ov::element::Type>& defaultPrecis
auto nmsCallback = []([[maybe_unused]] const_node_ptr& node) -> bool {
// TODO: remove nmsCallback at all
const bool isLegacyApi = false;
- return isLegacyApi ? false : true;
+ return !isLegacyApi;
};
CPU_SET_CALLBACK_COMMON(manager, nmsCallback, ov::pass::ConvertNMS9ToNMSIEInternal);
@@ -1189,7 +1189,7 @@ void Transformations::MainSnippets() {
// To avoid performance degradations, we disable MHA tokenization into Subgraphs in LLMs'.
// We consider the presence of `ScaledDotProductAttentionWithKVCache` ops
// in the model as a sign that this model is LLM.
- const auto is_LLM = ov::op::util::is_large_language_model(*model.get()) ||
+ const auto is_LLM = ov::op::util::is_large_language_model(*model) ||
ov::op::util::has_op_with_type<intel_cpu::ScaledDotProductAttentionWithKVCache>(model);
// CPU Plugin Subgraph supports f32, bf16, quantized and fp16(on avx_512_core_amx_fp16 target) BRGEMM
diff --git a/src/plugins/intel_cpu/src/transformations/transformation_pipeline.h b/src/plugins/intel_cpu/src/transformations/transformation_pipeline.h
index 5ca57d876d4..4d8d0702e1b 100644
--- a/src/plugins/intel_cpu/src/transformations/transformation_pipeline.h
+++ b/src/plugins/intel_cpu/src/transformations/transformation_pipeline.h
@@ -41,7 +41,7 @@ private:
void PostSnippets(void);
- bool is_decompression_multiply(const std::shared_ptr<const ov::Node>& node) const;
+ static bool is_decompression_multiply(const std::shared_ptr<const ov::Node>& node);
static bool fuse_type_to_convert(const std::shared_ptr<ov::Node>& node, const precisions_map& precisions);
static bool fuse_type_to_fq(const std::shared_ptr<ov::Node>& node, const precisions_map& precisions);
diff --git a/src/plugins/intel_cpu/src/utils/blob_dump.cpp b/src/plugins/intel_cpu/src/utils/blob_dump.cpp
index 4c8d4194062..ff54d3154ca 100644
--- a/src/plugins/intel_cpu/src/utils/blob_dump.cpp
+++ b/src/plugins/intel_cpu/src/utils/blob_dump.cpp
@@ -96,7 +96,7 @@ static DnnlBlockedMemoryDesc parse_header(IEB_HEADER& header) {
return DnnlBlockedMemoryDesc{prc, Shape(dims)};
}
-void BlobDumper::prepare_plain_data(const MemoryPtr& memory, std::vector<uint8_t>& data) const {
+void BlobDumper::prepare_plain_data(const MemoryPtr& memory, std::vector<uint8_t>& data) {
const auto& desc = memory->getDesc();
size_t data_size = desc.getShape().getElementsCount();
const auto size = data_size * desc.getPrecision().size();
@@ -288,7 +288,7 @@ BlobDumper BlobDumper::read(std::istream& stream) {
const auto desc = parse_header(header);
BlobDumper res(desc);
- stream.seekg(header.data_offset, stream.beg);
+ stream.seekg(header.data_offset, std::istream::beg);
stream.read(reinterpret_cast<char*>(res.getDataPtr()), header.data_size);
return res;
diff --git a/src/plugins/intel_cpu/src/utils/blob_dump.h b/src/plugins/intel_cpu/src/utils/blob_dump.h
index e196f56c974..c5699b695b5 100644
--- a/src/plugins/intel_cpu/src/utils/blob_dump.h
+++ b/src/plugins/intel_cpu/src/utils/blob_dump.h
@@ -31,7 +31,7 @@ namespace intel_cpu {
class BlobDumper {
MemoryPtr memory;
- void prepare_plain_data(const MemoryPtr& memory, std::vector<uint8_t>& data) const;
+ static void prepare_plain_data(const MemoryPtr& memory, std::vector<uint8_t>& data);
public:
BlobDumper() = default;
diff --git a/src/plugins/intel_cpu/src/utils/codec_xor.cpp b/src/plugins/intel_cpu/src/utils/codec_xor.cpp
index a4f211ab5cd..e60eafb6a32 100644
--- a/src/plugins/intel_cpu/src/utils/codec_xor.cpp
+++ b/src/plugins/intel_cpu/src/utils/codec_xor.cpp
@@ -28,7 +28,7 @@ void codec_xor(char* dst_str, const char* src_str, size_t len) {
std::string codec_xor_str(const std::string& source_str) {
std::string new_str(source_str);
- codec_xor(&new_str[0], &new_str[0], new_str.size());
+ codec_xor(new_str.data(), new_str.data(), new_str.size());
return new_str;
}
diff --git a/src/plugins/intel_cpu/src/utils/debug_capabilities.cpp b/src/plugins/intel_cpu/src/utils/debug_capabilities.cpp
index 0a5cd866c1d..0ebdd8f2f85 100644
--- a/src/plugins/intel_cpu/src/utils/debug_capabilities.cpp
+++ b/src/plugins/intel_cpu/src/utils/debug_capabilities.cpp
@@ -60,7 +60,7 @@ namespace ov::intel_cpu {
namespace {
size_t replace_all(std::string& inout, const std::string& what, const std::string& with) {
std::size_t count{};
- for (std::string::size_type pos{}; inout.npos != (pos = inout.find(what.data(), pos, what.length()));
+ for (std::string::size_type pos{}; std::string::npos != (pos = inout.find(what.data(), pos, what.length()));
pos += with.length(), ++count) {
inout.replace(pos, what.length(), with.data(), with.length());
}
@@ -505,7 +505,7 @@ public:
}
template <class Container>
- inline std::string join(const Container& strs) {
+ std::string join(const Container& strs) {
std::stringstream ss;
ss << "[" << ov::intel_cpu::join(strs, ',') << "]";
return ss.str();
@@ -517,7 +517,7 @@ std::ostream& operator<<(std::ostream& os, const PrintableModel& model) {
const std::string& tag = model.tag;
const std::string& prefix = model.prefix;
OstreamAttributeVisitor osvis(os);
- std::string sep = "";
+ std::string sep;
os << prefix;
for (const auto& op : f.get_results()) {
os << sep << op->get_name();
@@ -587,7 +587,7 @@ std::ostream& operator<<(std::ostream& os, const PrintableModel& model) {
auto cnt = msubgraph->get_internal_subgraphs_size();
for (size_t i = 0; i < cnt; i++) {
os << "\t\t MultiSubGraphOp " << tag << msubgraph->get_friendly_name() << "[" << i << "]" << '\n';
- os << PrintableModel(*msubgraph->get_function(i).get(), tag, prefix + "\t\t");
+ os << PrintableModel(*msubgraph->get_function(i), tag, prefix + "\t\t");
}
}
}
diff --git a/src/plugins/intel_cpu/src/utils/debug_capabilities.h b/src/plugins/intel_cpu/src/utils/debug_capabilities.h
index 03901b67d9f..85f140d686b 100644
--- a/src/plugins/intel_cpu/src/utils/debug_capabilities.h
+++ b/src/plugins/intel_cpu/src/utils/debug_capabilities.h
@@ -53,7 +53,7 @@ public:
operator bool() const {
return enabled;
}
- void break_at(const std::string& log);
+ static void break_at(const std::string& log);
};
class NodeDesc;
diff --git a/src/plugins/intel_cpu/src/utils/precision_support.cpp b/src/plugins/intel_cpu/src/utils/precision_support.cpp
index 8e76b67207c..622a5580d8f 100644
--- a/src/plugins/intel_cpu/src/utils/precision_support.cpp
+++ b/src/plugins/intel_cpu/src/utils/precision_support.cpp
@@ -18,11 +18,8 @@ namespace ov::intel_cpu {
static bool hasFP16HardwareSupport() {
#if defined(OPENVINO_ARCH_X86_64)
- if (dnnl::impl::cpu::x64::mayiuse(dnnl::impl::cpu::x64::avx512_core_fp16) ||
- dnnl::impl::cpu::x64::mayiuse(dnnl::impl::cpu::x64::avx2_vnni_2)) {
- return true;
- }
- return false;
+ return dnnl::impl::cpu::x64::mayiuse(dnnl::impl::cpu::x64::avx512_core_fp16) ||
+ dnnl::impl::cpu::x64::mayiuse(dnnl::impl::cpu::x64::avx2_vnni_2);
#elif defined(OV_CPU_WITH_ACL)
return arm_compute::CPUInfo::get().has_fp16();
#else
@@ -32,11 +29,8 @@ static bool hasFP16HardwareSupport() {
static bool hasBF16HardwareSupport() {
#if defined(OPENVINO_ARCH_X86_64)
- if (dnnl::impl::cpu::x64::mayiuse(dnnl::impl::cpu::x64::avx512_core) ||
- dnnl::impl::cpu::x64::mayiuse(dnnl::impl::cpu::x64::avx2_vnni_2)) {
- return true;
- }
- return false;
+ return dnnl::impl::cpu::x64::mayiuse(dnnl::impl::cpu::x64::avx512_core) ||
+ dnnl::impl::cpu::x64::mayiuse(dnnl::impl::cpu::x64::avx2_vnni_2);
#else
return false;
#endif
diff --git a/src/plugins/intel_cpu/src/utils/serialize.cpp b/src/plugins/intel_cpu/src/utils/serialize.cpp
index 7a5abd56d9a..c98b3471a4b 100644
--- a/src/plugins/intel_cpu/src/utils/serialize.cpp
+++ b/src/plugins/intel_cpu/src/utils/serialize.cpp
@@ -86,14 +86,14 @@ void ModelDeserializer::process_mmap(std::shared_ptr<ov::Model>& model,
bool is_valid_model = (hdr.custom_data_offset == sizeof(hdr) + hdr_pos) &&
(hdr.custom_data_size == hdr.consts_offset - hdr.custom_data_offset) &&
(hdr.consts_size == hdr.model_offset - hdr.consts_offset) &&
- ((hdr.model_size = file_size - hdr.model_offset) != 0u);
+ ((hdr.model_size = file_size - hdr.model_offset) != 0U);
if (!is_valid_model) {
OPENVINO_THROW("[CPU] Could not deserialize by device xml header.");
}
// Read model input/output precisions.
pugi::xml_document xml_in_out_doc;
- if (hdr.custom_data_size > 0lu) {
+ if (hdr.custom_data_size > 0LU) {
auto res = xml_in_out_doc.load_buffer(buffer_base + hdr.custom_data_offset,
hdr.custom_data_size,
pugi::parse_default,
@@ -120,13 +120,13 @@ void ModelDeserializer::process_mmap(std::shared_ptr<ov::Model>& model,
*xml_buff = m_cache_decrypt.m_decrypt_str(*xml_buff);
} else {
xml_buff->reserve(hdr.model_size + 1);
- m_cache_decrypt.m_decrypt_char(&((*xml_buff)[0]), buffer_base + hdr.model_offset, hdr.model_size);
+ m_cache_decrypt.m_decrypt_char((*xml_buff).data(), buffer_base + hdr.model_offset, hdr.model_size);
}
} else {
xml_buff->assign(buffer_base + hdr.model_offset, hdr.model_size);
}
std::shared_ptr<ov::AlignedBuffer> model_buf =
- std::make_shared<ov::SharedBuffer<std::shared_ptr<std::string>>>(&((*xml_buff)[0]), hdr.model_size, xml_buff);
+ std::make_shared<ov::SharedBuffer<std::shared_ptr<std::string>>>((*xml_buff).data(), hdr.model_size, xml_buff);
model = m_model_builder(model_buf, weights_buf);
@@ -137,9 +137,9 @@ void ModelDeserializer::process_mmap(std::shared_ptr<ov::Model>& model,
void ModelDeserializer::process_stream(std::shared_ptr<ov::Model>& model) {
const size_t hdr_pos = m_istream.tellg();
- m_istream.seekg(0, m_istream.end);
+ m_istream.seekg(0, std::istream::end);
const size_t file_size = m_istream.tellg();
- m_istream.seekg(hdr_pos, m_istream.beg);
+ m_istream.seekg(hdr_pos, std::istream::beg);
pass::StreamSerialize::DataHeader hdr = {};
m_istream.read(reinterpret_cast<char*>(&hdr), sizeof hdr);
@@ -148,7 +148,7 @@ void ModelDeserializer::process_stream(std::shared_ptr<ov::Model>& model) {
bool is_valid_model = (hdr.custom_data_offset == sizeof(hdr) + hdr_pos) &&
(hdr.custom_data_size == hdr.consts_offset - hdr.custom_data_offset) &&
(hdr.consts_size == hdr.model_offset - hdr.consts_offset) &&
- ((hdr.model_size = file_size - hdr.model_offset) != 0u);
+ ((hdr.model_size = file_size - hdr.model_offset) != 0U);
if (!is_valid_model) {
OPENVINO_THROW("[CPU] Could not deserialize by device xml header.");
}
diff --git a/src/plugins/intel_cpu/src/weights_cache.cpp b/src/plugins/intel_cpu/src/weights_cache.cpp
index 8fd71fbbf6a..a22b3645d04 100644
--- a/src/plugins/intel_cpu/src/weights_cache.cpp
+++ b/src/plugins/intel_cpu/src/weights_cache.cpp
@@ -55,10 +55,7 @@ WeightsSharing::SharedMemory::Ptr WeightsSharing::findOrCreate(const std::string
return false;
}
newPtr = ptr->sharedMemory.lock();
- if (!newPtr) {
- return false;
- }
- return true;
+ return static_cast<bool>(newPtr);
};
if (!isCached()) {