Skip to content

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

[CPU] Replace `std::is_*` traits with C++17 `std::is_*_v` (#31641)

Arseniy Obolenskiy207e733b18ab
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 9c231b1a14e..1f4353657ff 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
@@ -245,9 +245,9 @@ void jit_load_emitter::emit_isa(const Xbyak::Reg64& reg_src, const int out_vec_i
*/
template <typename Vmm>
void jit_load_emitter::load_bytes(const Vmm& vmm, const Xbyak::Reg64& reg, int offset, int load_size) const {
- [[maybe_unused]] constexpr bool is_xmm = std::is_same<Vmm, Xbyak::Xmm>::value;
- [[maybe_unused]] constexpr bool is_ymm = std::is_same<Vmm, Xbyak::Ymm>::value;
- [[maybe_unused]] constexpr bool is_zmm = std::is_same<Vmm, Xbyak::Zmm>::value;
+ [[maybe_unused]] constexpr bool is_xmm = std::is_same_v<Vmm, Xbyak::Xmm>;
+ [[maybe_unused]] constexpr bool is_ymm = std::is_same_v<Vmm, Xbyak::Ymm>;
+ [[maybe_unused]] constexpr bool is_zmm = std::is_same_v<Vmm, Xbyak::Zmm>;
// Ensure data fits completely inside the Xmm/Ymm/Zmm register
if (load_size < 0 || load_size > 64) {
@@ -458,9 +458,9 @@ void jit_load_emitter::load_bytes_to_dword_extension(const Vmm& vmm,
int offset,
bool is_signed,
int load_size) const {
- [[maybe_unused]] constexpr bool is_xmm = std::is_same<Vmm, Xbyak::Xmm>::value;
- [[maybe_unused]] constexpr bool is_ymm = std::is_same<Vmm, Xbyak::Ymm>::value;
- [[maybe_unused]] constexpr bool is_zmm = std::is_same<Vmm, Xbyak::Zmm>::value;
+ [[maybe_unused]] constexpr bool is_xmm = std::is_same_v<Vmm, Xbyak::Xmm>;
+ [[maybe_unused]] constexpr bool is_ymm = std::is_same_v<Vmm, Xbyak::Ymm>;
+ [[maybe_unused]] constexpr bool is_zmm = std::is_same_v<Vmm, Xbyak::Zmm>;
// Ensure extended double words fit inside Zmm (32 * load_size <= 512)
// For Ymm register, load capacity is halved (32 * load_size <= 256)
@@ -556,9 +556,9 @@ void jit_load_emitter::load_words_to_dword_extension(const Vmm& vmm,
int offset,
ov::element::Type prc,
int load_size) const {
- [[maybe_unused]] constexpr bool is_xmm = std::is_same<Vmm, Xbyak::Xmm>::value;
- [[maybe_unused]] constexpr bool is_ymm = std::is_same<Vmm, Xbyak::Ymm>::value;
- [[maybe_unused]] constexpr bool is_zmm = std::is_same<Vmm, Xbyak::Zmm>::value;
+ [[maybe_unused]] constexpr bool is_xmm = std::is_same_v<Vmm, Xbyak::Xmm>;
+ [[maybe_unused]] constexpr bool is_ymm = std::is_same_v<Vmm, Xbyak::Ymm>;
+ [[maybe_unused]] constexpr bool is_zmm = std::is_same_v<Vmm, Xbyak::Zmm>;
bool is_bf16 = (prc == ov::element::bf16);
bool is_f16 = (prc == ov::element::f16);
@@ -674,9 +674,9 @@ void jit_load_emitter::load_words_to_dword_extension(const Vmm& vmm,
template <typename Vmm>
void jit_load_emitter::fill_with_default(const Vmm& vmm, const std::string& fill_value, const int& load_num) const {
- constexpr bool is_xmm = std::is_same<Vmm, Xbyak::Xmm>::value;
- constexpr bool is_ymm = std::is_same<Vmm, Xbyak::Ymm>::value;
- constexpr bool is_zmm = std::is_same<Vmm, Xbyak::Zmm>::value;
+ constexpr bool is_xmm = std::is_same_v<Vmm, Xbyak::Xmm>;
+ constexpr bool is_ymm = std::is_same_v<Vmm, Xbyak::Ymm>;
+ constexpr bool is_zmm = std::is_same_v<Vmm, Xbyak::Zmm>;
if (is_xmm || is_ymm) {
uint8 imm = 1;
@@ -887,9 +887,9 @@ void jit_store_emitter::emit_isa(const int in_vec_idx, const Xbyak::Reg64& reg_d
*/
template <typename Vmm>
void jit_store_emitter::store_bytes(const Xbyak::Reg64& reg, int offset, int store_size) const {
- [[maybe_unused]] constexpr bool is_xmm = std::is_same<Vmm, Xbyak::Xmm>::value;
- [[maybe_unused]] constexpr bool is_ymm = std::is_same<Vmm, Xbyak::Ymm>::value;
- [[maybe_unused]] constexpr bool is_zmm = std::is_same<Vmm, Xbyak::Zmm>::value;
+ [[maybe_unused]] constexpr bool is_xmm = std::is_same_v<Vmm, Xbyak::Xmm>;
+ [[maybe_unused]] constexpr bool is_ymm = std::is_same_v<Vmm, Xbyak::Ymm>;
+ [[maybe_unused]] constexpr bool is_zmm = std::is_same_v<Vmm, Xbyak::Zmm>;
// Ensure data fits completely inside the Xmm/Ymm/Zmm register
if (store_size < 0 || store_size > 64) {
@@ -1053,9 +1053,9 @@ void jit_store_emitter::store_dword_to_byte_extension(const Xbyak::Reg64& reg,
int offset,
bool is_signed,
int store_num) const {
- [[maybe_unused]] constexpr bool is_xmm = std::is_same<Vmm, Xbyak::Xmm>::value;
- [[maybe_unused]] constexpr bool is_ymm = std::is_same<Vmm, Xbyak::Ymm>::value;
- [[maybe_unused]] constexpr bool is_zmm = std::is_same<Vmm, Xbyak::Zmm>::value;
+ [[maybe_unused]] constexpr bool is_xmm = std::is_same_v<Vmm, Xbyak::Xmm>;
+ [[maybe_unused]] constexpr bool is_ymm = std::is_same_v<Vmm, Xbyak::Ymm>;
+ [[maybe_unused]] constexpr bool is_zmm = std::is_same_v<Vmm, Xbyak::Zmm>;
// Ensure data fits completely inside the Xmm/Ymm/Zmm register
// At most 8 dwords can fit inside the Ymm register
@@ -1219,9 +1219,9 @@ void jit_store_emitter::store_dword_to_word_extension(const Xbyak::Reg64& reg,
const bool is_f16 = (precision == ov::element::f16);
const bool is_signed = precision.is_signed();
- [[maybe_unused]] constexpr bool is_xmm = std::is_same<Vmm, Xbyak::Xmm>::value;
- [[maybe_unused]] constexpr bool is_ymm = std::is_same<Vmm, Xbyak::Ymm>::value;
- [[maybe_unused]] constexpr bool is_zmm = std::is_same<Vmm, Xbyak::Zmm>::value;
+ [[maybe_unused]] constexpr bool is_xmm = std::is_same_v<Vmm, Xbyak::Xmm>;
+ [[maybe_unused]] constexpr bool is_ymm = std::is_same_v<Vmm, Xbyak::Ymm>;
+ [[maybe_unused]] constexpr bool is_zmm = std::is_same_v<Vmm, Xbyak::Zmm>;
// Ensure data fits completely inside the Xmm/Ymm/Zmm register
// At most 4 dwords can fit inside the Xmm register
diff --git a/src/plugins/intel_cpu/src/nodes/color_convert.cpp b/src/plugins/intel_cpu/src/nodes/color_convert.cpp
index 97fab1a0e95..b220b2cba4c 100644
--- a/src/plugins/intel_cpu/src/nodes/color_convert.cpp
+++ b/src/plugins/intel_cpu/src/nodes/color_convert.cpp
@@ -453,7 +453,7 @@ void JitConverter<T[N]>::generate() {
const auto& u = std::get<1>(yuv);
const auto& v = std::get<2>(yuv);
- yuv_to_rgb(y, u, v, colorFormat, std::is_integral<T>::value);
+ yuv_to_rgb(y, u, v, colorFormat, std::is_integral_v<T>);
store(dst, y);
dst += step;
@@ -480,7 +480,7 @@ void JitConverter<T[N]>::generate() {
const auto& u = std::get<0>(uv_pair);
const auto& v = std::get<1>(uv_pair);
- yuv_to_rgb(y, u, v, colorFormat, std::is_integral<T>::value);
+ yuv_to_rgb(y, u, v, colorFormat, std::is_integral_v<T>);
store_tail(dst, y, u, v, width);
});
@@ -789,7 +789,7 @@ void JitConverter<T[N]>::generate() {
const auto& u = std::get<1>(yuv);
const auto& v = std::get<2>(yuv);
- yuv_to_rgb(y, u, v, colorFormat, std::is_integral<T>::value);
+ yuv_to_rgb(y, u, v, colorFormat, std::is_integral_v<T>);
store(dst, y);
dst += step;
@@ -816,7 +816,7 @@ void JitConverter<T[N]>::generate() {
unpack_uv(u, v);
- yuv_to_rgb(y, u, v, colorFormat, std::is_integral<T>::value);
+ yuv_to_rgb(y, u, v, colorFormat, std::is_integral_v<T>);
store_tail(dst, y, u, v, width);
});
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 136f4647f87..88e39e0b5b6 100644
--- a/src/plugins/intel_cpu/src/nodes/common/cpu_convert.cpp
+++ b/src/plugins/intel_cpu/src/nodes/common/cpu_convert.cpp
@@ -180,7 +180,7 @@ public:
fp8_emu_kmask_aux_,
fp8_emu_scratch_);
}
- const bool is_dst_bf16 = std::is_same<dst_t, ov::intel_cpu::bfloat16_t>::value;
+ const bool is_dst_bf16 = std::is_same_v<dst_t, ov::intel_cpu::bfloat16_t>;
if (is_dst_bf16 && mayiuse(cpu_isa_t::avx512_core)) {
uni_vcvtneps2bf16_ = std::make_shared<jit_uni_vcvtneps2bf16>(this, cpu_isa_t::avx512_core);
}
@@ -473,7 +473,7 @@ const std::tuple<U, U>& Range<T, U>::fit(const ov::element::Type& prec) {
// int64_t ubound = 9223372036854775807
// double dd_ubound = static_cast<double>(ubbound)
// static_cast<int64_t>(dd_ubound) will return -9223372036854775808
- if (!std::is_integral<U>::value) {
+ if (!std::is_integral_v<U>) {
std::get<0>(_range) = static_cast<U>(std::max(static_cast<double>(std::get<0>(_range)), lbound));
std::get<1>(_range) = static_cast<U>(std::min(static_cast<double>(std::get<1>(_range)), ubound));
}
@@ -511,8 +511,8 @@ const std::tuple<U, U>& Range<T, U>::fit(const ov::element::Type& prec) {
OPENVINO_THROW("Unsupported precision");
}
}();
- using ltype = std::conditional_t<std::is_floating_point<U>::value, double, int64_t>;
- using utype = std::conditional_t<std::is_floating_point<U>::value, double, uint64_t>;
+ using ltype = std::conditional_t<std::is_floating_point_v<U>, double, int64_t>;
+ using utype = std::conditional_t<std::is_floating_point_v<U>, double, uint64_t>;
std::get<0>(_range) =
static_cast<U>(std::max(static_cast<ltype>(std::get<0>(_range)), static_cast<ltype>(lbound)));
std::get<1>(_range) =
@@ -550,8 +550,8 @@ struct ConvertPrecision<std::tuple<src_t, dst_t>> {
// Align with the behavior of ngraph ref and jit implementation. Conversion from f8e4m3-inf
// to float should output float-inf instead of f8e4m3-max. Proper handling of special values
// (nan, inf, overflow) has already been assured by the conversion process.
- if (std::is_same<src_t, ov::float8_e4m3>::value || std::is_same<src_t, ov::float8_e5m2>::value ||
- std::is_same<dst_t, ov::float8_e4m3>::value || std::is_same<dst_t, ov::float8_e5m2>::value) {
+ if (std::is_same_v<src_t, ov::float8_e4m3> || std::is_same_v<src_t, ov::float8_e5m2> ||
+ std::is_same_v<dst_t, ov::float8_e4m3> || std::is_same_v<dst_t, ov::float8_e5m2>) {
parallel_for(ctx.size, [&](size_t i) {
dst[i] = static_cast<dst_t>(src[i]);
});
@@ -559,7 +559,7 @@ struct ConvertPrecision<std::tuple<src_t, dst_t>> {
return;
}
- if (std::is_integral<src_t>::value || ctx.interimPrc.is_real() || std::is_integral<dst_t>::value) {
+ if (std::is_integral_v<src_t> || ctx.interimPrc.is_real() || std::is_integral_v<dst_t>) {
parallel_for(ctx.size, [&, lbound = lbound, ubound = ubound](size_t i) {
dst[i] = static_cast<dst_t>(std::max(std::min(src[i], ubound), lbound));
});
@@ -628,7 +628,7 @@ struct ConvertPrecision<std::tuple<src_t, ov::float16>> {
auto [lbound, ubound] = ctx.range<src_t>();
- if (std::is_integral<src_t>::value) {
+ if (std::is_integral_v<src_t>) {
parallel_for(iterations, [&, lbound = lbound, ubound = ubound](size_t i) {
batch_type tmp;
const size_t offset = i * batch;
@@ -642,7 +642,7 @@ struct ConvertPrecision<std::tuple<src_t, ov::float16>> {
parallel_for(iterations, [&](size_t i) {
const size_t offset = i * batch;
const size_t current_batch_size = std::min(ctx.size - offset, batch);
- if (std::is_same<std::remove_cv_t<src_t>, float>::value) { // fp32 -> fp16
+ if (std::is_same_v<std::remove_cv_t<src_t>, float>) { // fp32 -> fp16
jit_convert(reinterpret_cast<const float*>(src) + offset, dst + offset, current_batch_size);
} else {
batch_type tmp;
@@ -680,7 +680,7 @@ struct ConvertPrecision<std::tuple<ov::float16, dst_t>> {
auto [lbound, ubound] = static_cast<std::tuple<float, float>>(ctx.range<ov::float16>());
- if (std::is_integral<dst_t>::value) {
+ if (std::is_integral_v<dst_t>) {
parallel_for(iterations, [&, lbound = lbound, ubound = ubound](size_t i) {
batch_type tmp;
const size_t offset = i * batch;
@@ -694,7 +694,7 @@ struct ConvertPrecision<std::tuple<ov::float16, dst_t>> {
parallel_for(iterations, [&](size_t i) {
const size_t offset = i * batch;
const size_t current_batch_size = std::min(ctx.size - offset, batch);
- if (std::is_same<std::remove_cv_t<dst_t>, float>::value) { // fp16 -> fp32
+ if (std::is_same_v<std::remove_cv_t<dst_t>, float>) { // fp16 -> fp32
jit_convert(src + offset, reinterpret_cast<float*>(dst) + offset, current_batch_size);
} else {
batch_type tmp;
diff --git a/src/plugins/intel_cpu/src/nodes/kernels/aarch64/sve_utils.hpp b/src/plugins/intel_cpu/src/nodes/kernels/aarch64/sve_utils.hpp
index 86f603d2f6d..a391f9709ec 100644
--- a/src/plugins/intel_cpu/src/nodes/kernels/aarch64/sve_utils.hpp
+++ b/src/plugins/intel_cpu/src/nodes/kernels/aarch64/sve_utils.hpp
@@ -57,7 +57,7 @@ size_t sve_vlen() {
template <typename TA, typename TB>
static void cvt_copy(TA* dst, TB* src, size_t n) {
size_t i = 0;
- if constexpr (std::is_same<TA, TB>::value) {
+ if constexpr (std::is_same_v<TA, TB>) {
auto pg_dst = sve_predicate<sizeof(TA)>();
auto vlen = sve_vlen<sizeof(TA)>();
for (; i + vlen <= n; i += vlen) {
@@ -68,7 +68,7 @@ static void cvt_copy(TA* dst, TB* src, size_t n) {
auto vb = svld1(pg_dst, src + i);
svst1(pg_dst, dst + i, vb);
return;
- } else if constexpr (std::is_same<TA, float>::value && std::is_same<TB, ov::float16>::value) {
+ } else if constexpr (std::is_same_v<TA, float> && std::is_same_v<TB, ov::float16>) {
auto src_ptr = reinterpret_cast<float16_t*>(src);
auto pg_vl2 = svwhilelt_b16(svcnth() / 2, svcnth());
auto vlen = svcnth() / 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 b1f44342417..39397afb179 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
@@ -273,9 +273,9 @@ void dequant(TDST* dst,
}
# if defined(HAVE_AVX512F)
-template <typename T,
- typename = typename std::
- enable_if<(std::is_same<T, ov::bfloat16>::value || std::is_same<T, ov::float16>::value), bool>::type>
+template <
+ typename T,
+ typename = typename std::enable_if<(std::is_same_v<T, ov::bfloat16> || std::is_same_v<T, ov::float16>), bool>::type>
static void pack_32x32_kernel(T* dst, T* src, size_t dst_stride, size_t src_stride) {
static const uint64_t idx[8] = {0, 4, 1, 5, 2, 6, 3, 7};
auto midx = _mm512_loadu_si512(idx);
@@ -297,9 +297,9 @@ static void pack_32x32_kernel(T* dst, T* src, size_t dst_stride, size_t src_stri
}
}
-template <typename T,
- typename = typename std::
- enable_if<(std::is_same<T, ov::bfloat16>::value || std::is_same<T, ov::float16>::value), bool>::type>
+template <
+ typename T,
+ typename = typename std::enable_if<(std::is_same_v<T, ov::bfloat16> || std::is_same_v<T, ov::float16>), bool>::type>
static void pack_32x16_kernel(T* dst, T* src, size_t dst_stride, size_t src_stride) {
static const uint64_t idx[8] = {0, 4, 1, 5, 2, 6, 3, 7};
auto midx = _mm512_loadu_si512(idx);
@@ -318,9 +318,9 @@ static void pack_32x16_kernel(T* dst, T* src, size_t dst_stride, size_t src_stri
}
}
-template <typename T,
- typename = typename std::
- enable_if<(std::is_same<T, ov::bfloat16>::value || std::is_same<T, ov::float16>::value), bool>::type>
+template <
+ typename T,
+ typename = typename std::enable_if<(std::is_same_v<T, ov::bfloat16> || std::is_same_v<T, ov::float16>), bool>::type>
static void pack_32xK_kernel(T* dst, T* src, size_t dst_stride, size_t src_stride, size_t K) {
static const uint64_t idx[8] = {0, 4, 1, 5, 2, 6, 3, 7};
auto midx = _mm512_loadu_si512(idx);
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 9b1589f3e50..10c55293e72 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
@@ -1460,8 +1460,8 @@ static void mha_single_token_kernel(const ov::intel_cpu::PlainTensor& query,
for (size_t iwork = start; iwork < end; ++iwork) {
auto* p = past_k_scale_zp.ptr<float>(pk, 0, h_group);
#if defined(__ARM_FEATURE_FP16_VECTOR_ARITHMETIC)
- if (std::is_same<T3, ov::float16>::value && std::is_same<T, ov::float16>::value &&
- std::is_same<T2, ov::float16>::value) {
+ if (std::is_same_v<T3, ov::float16> && std::is_same_v<T, ov::float16> &&
+ std::is_same_v<T2, ov::float16>) {
auto p_k = present_key.ptr<ov::float16>(0, h_group, pk);
prefetch_bytes(S, _MM_HINT_T0, 4096, p_k);
auto _qk = dot_product_fp16(query.ptr<ov::float16>(0, h_group),
@@ -1500,8 +1500,8 @@ static void mha_single_token_kernel(const ov::intel_cpu::PlainTensor& query,
auto b_kv = beams ? beams.ptr<int32_t>(b)[pk] : b;
auto* p = past_k_scale_zp.ptr<float>(pk, b_kv, h_group);
#if defined(__ARM_FEATURE_FP16_VECTOR_ARITHMETIC)
- if (std::is_same<T3, ov::float16>::value && std::is_same<T, ov::float16>::value &&
- std::is_same<T2, ov::float16>::value) {
+ if (std::is_same_v<T3, ov::float16> && std::is_same_v<T, ov::float16> &&
+ std::is_same_v<T2, ov::float16>) {
auto p_k = present_key.ptr<ov::float16>(b_kv, h_group, pk);
auto _qk = dot_product_fp16(query.ptr<ov::float16>(b, h_group),
p_k,
@@ -1540,8 +1540,8 @@ static void mha_single_token_kernel(const ov::intel_cpu::PlainTensor& query,
auto* p = past_k_scale_zp.ptr<float>(pk, b_kv, h_group);
for (size_t h = h_group * h_each_group_len; h < (h_group + 1) * h_each_group_len; h++) {
#if defined(__ARM_FEATURE_FP16_VECTOR_ARITHMETIC)
- if (std::is_same<T3, ov::float16>::value && std::is_same<T, ov::float16>::value &&
- std::is_same<T2, ov::float16>::value) {
+ if (std::is_same_v<T3, ov::float16> && std::is_same_v<T, ov::float16> &&
+ std::is_same_v<T2, ov::float16>) {
auto p_k = present_key.ptr<ov::float16>(b_kv, h_group, pk);
auto _qk = dot_product_fp16(query.ptr<ov::float16>(b, h, pq),
p_k,
diff --git a/src/plugins/intel_cpu/src/nodes/kernels/scaled_attn/paged_attn_kernel.hpp b/src/plugins/intel_cpu/src/nodes/kernels/scaled_attn/paged_attn_kernel.hpp
index 120a40c4d52..aa42ce9fc74 100644
--- a/src/plugins/intel_cpu/src/nodes/kernels/scaled_attn/paged_attn_kernel.hpp
+++ b/src/plugins/intel_cpu/src/nodes/kernels/scaled_attn/paged_attn_kernel.hpp
@@ -1560,7 +1560,7 @@ void dot_product_block_quantized_by_dims(TA* a,
svfloat32_t va;
pg_a = svwhilelt_b32(i, group_size);
pg_f16 = svand_z(svptrue_b16(), svwhilelt_b16(svcnth() / 2, svcnth()), svwhilelt_b16(i, group_size));
- if constexpr (std::is_same<TA, ov::float16>::value) {
+ if constexpr (std::is_same_v<TA, ov::float16>) {
auto load_src = svld1_f16(pg_f16, reinterpret_cast<float16_t*>(a + dst_offset + i));
auto src_interleave = svzip1_f16(load_src, scratch);
va = svcvt_f32_f16_z(pg_a, src_interleave);
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 f98b1a1aaf3..fa6a379bae6 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
@@ -787,7 +787,7 @@ template <x64::cpu_isa_t isa>
void jitUniGatherKernel<isa>::store(const Xbyak::Reg64& reg_dst, Vmm& vmmSrc) {
if (is_real16_to_f32) {
// keep reg_dst, incremented outside
- constexpr bool is_zmm = std::is_same<Vmm, Xbyak::Zmm>::value;
+ constexpr bool is_zmm = std::is_same_v<Vmm, Xbyak::Zmm>;
Xbyak::Ymm ymmSrc(vmmSrc.getIdx());
Xbyak::Xmm xmmSrc(vmmSrc.getIdx());
if (is_zmm) {
diff --git a/src/plugins/intel_cpu/src/nodes/kernels/x64/jit_kernel.hpp b/src/plugins/intel_cpu/src/nodes/kernels/x64/jit_kernel.hpp
index 2f2f565ca5a..62eb343aff0 100644
--- a/src/plugins/intel_cpu/src/nodes/kernels/x64/jit_kernel.hpp
+++ b/src/plugins/intel_cpu/src/nodes/kernels/x64/jit_kernel.hpp
@@ -734,7 +734,7 @@ void jit_kernel::copy(const Xbyak::Address& dst, const Xbyak::Reg64& src, const
template <typename DstT, size_t N, typename SrcT>
void jit_kernel::load(const variable<DstT[N]>& dst, const variable<SrcT>& src, size_t length) {
- static_assert(std::is_same<typename variable<SrcT>::reg_type, const Xbyak::Reg64>::value,
+ static_assert(std::is_same_v<typename variable<SrcT>::reg_type, const Xbyak::Reg64>,
"Source register must be Reg64");
using src_type = std::remove_cv_t<std::remove_pointer_t<SrcT>>;
@@ -774,7 +774,7 @@ void jit_kernel::load(const variable<DstT[N]>& dst, const variable<SrcT>& src, c
template <typename DstT, typename SrcT, size_t N>
void jit_kernel::store(const variable<DstT>& dst, const variable<SrcT[N]>& src, size_t length) {
- static_assert(std::is_same<typename variable<DstT>::reg_type, const Xbyak::Reg64>::value,
+ static_assert(std::is_same_v<typename variable<DstT>::reg_type, const Xbyak::Reg64>,
"Destination register must be Reg64");
using src_type = std::remove_cv_t<std::remove_pointer_t<SrcT>>;
diff --git a/src/plugins/intel_cpu/src/nodes/kernels/x64/registers_pool.hpp b/src/plugins/intel_cpu/src/nodes/kernels/x64/registers_pool.hpp
index 5d0f73a8236..e9a593beaea 100644
--- a/src/plugins/intel_cpu/src/nodes/kernels/x64/registers_pool.hpp
+++ b/src/plugins/intel_cpu/src/nodes/kernels/x64/registers_pool.hpp
@@ -147,14 +147,14 @@ public:
Xbyak::Opmask>::value,
"Unsupported TReg by RegistersPool::Reg. Please, use the following Xbyak registers either "
"Reg8, Reg16, Reg32, Reg64, Xmm, Ymm, Zmm or Opmask");
- if (std::is_base_of<Xbyak::Mmx, TReg>::value) {
+ if (std::is_base_of_v<Xbyak::Mmx, TReg>) {
return simdSet.countUnused();
}
- if (std::is_same<TReg, Xbyak::Reg8>::value || std::is_same<TReg, Xbyak::Reg16>::value ||
- std::is_same<TReg, Xbyak::Reg32>::value || std::is_same<TReg, Xbyak::Reg64>::value) {
+ if (std::is_same_v<TReg, Xbyak::Reg8> || std::is_same_v<TReg, Xbyak::Reg16> ||
+ std::is_same_v<TReg, Xbyak::Reg32> || std::is_same_v<TReg, Xbyak::Reg64>) {
return generalSet.countUnused();
}
- if (std::is_same<TReg, Xbyak::Opmask>::value) {
+ if (std::is_same_v<TReg, Xbyak::Opmask>) {
return countUnusedOpmask();
}
}
@@ -253,30 +253,30 @@ protected:
private:
template <typename TReg>
int getFree(int requestedIdx) {
- if (std::is_base_of<Xbyak::Mmx, TReg>::value) {
+ if (std::is_base_of_v<Xbyak::Mmx, TReg>) {
auto idx = simdSet.getUnused(requestedIdx);
simdSet.setAsUsed(idx);
return idx;
}
- if (std::is_same<TReg, Xbyak::Reg8>::value || std::is_same<TReg, Xbyak::Reg16>::value ||
- std::is_same<TReg, Xbyak::Reg32>::value || std::is_same<TReg, Xbyak::Reg64>::value) {
+ if (std::is_same_v<TReg, Xbyak::Reg8> || std::is_same_v<TReg, Xbyak::Reg16> ||
+ std::is_same_v<TReg, Xbyak::Reg32> || std::is_same_v<TReg, Xbyak::Reg64>) {
auto idx = generalSet.getUnused(requestedIdx);
generalSet.setAsUsed(idx);
return idx;
}
- if (std::is_same<TReg, Xbyak::Opmask>::value) {
+ if (std::is_same_v<TReg, Xbyak::Opmask>) {
return getFreeOpmask(requestedIdx);
}
}
template <typename TReg>
void returnToPool(const TReg& reg) {
- if (std::is_base_of<Xbyak::Mmx, TReg>::value) {
+ if (std::is_base_of_v<Xbyak::Mmx, TReg>) {
simdSet.setAsUnused(reg.getIdx());
- } else if (std::is_same<TReg, Xbyak::Reg8>::value || std::is_same<TReg, Xbyak::Reg16>::value ||
- std::is_same<TReg, Xbyak::Reg32>::value || std::is_same<TReg, Xbyak::Reg64>::value) {
+ } else if (std::is_same_v<TReg, Xbyak::Reg8> || std::is_same_v<TReg, Xbyak::Reg16> ||
+ std::is_same_v<TReg, Xbyak::Reg32> || std::is_same_v<TReg, Xbyak::Reg64>) {
generalSet.setAsUnused(reg.getIdx());
- } else if (std::is_same<TReg, Xbyak::Opmask>::value) {
+ } else if (std::is_same_v<TReg, Xbyak::Opmask>) {
returnOpmaskToPool(reg.getIdx());
}
}
diff --git a/src/plugins/intel_cpu/src/nodes/llm_mlp.cpp b/src/plugins/intel_cpu/src/nodes/llm_mlp.cpp
index dda86e86269..b794dc84068 100644
--- a/src/plugins/intel_cpu/src/nodes/llm_mlp.cpp
+++ b/src/plugins/intel_cpu/src/nodes/llm_mlp.cpp
@@ -117,7 +117,7 @@ public:
work.k0 = start_blkK * reg_blk_K_size;
work.k1 = (start_blkK + blk_K) * reg_blk_K_size;
work.quant_i8 = is_quantized;
- work.is_f16 = std::is_same<T, ov::float16>::value;
+ work.is_f16 = std::is_same_v<T, ov::float16>;
start_blkK += blk_K;
used_nthr++;
@@ -152,7 +152,7 @@ public:
const LLMMLPNode::Config& config,
MatrixDynQuantPerRow& src_dq,
float* w_scale) {
- static ReduceAdd2bh jit_reduce2cvt(true, std::is_same<T, ov::float16>::value);
+ static ReduceAdd2bh jit_reduce2cvt(true, std::is_same_v<T, ov::float16>);
ov::parallel_nt_static(m_threads_num, [&](const size_t ithr, [[maybe_unused]] const size_t nthr) {
auto& work = works[ithr];
@@ -214,8 +214,8 @@ public:
// and post-ops will compute silu(gate)*up in unit of 16 elements
// and store out as bfloat16.
void setup(void* p_weight_gate, void* p_weight_up, int stride, int N, int K, const LLMMLPNode::Config& config) {
- static GateUpCombine jit_gateup_silu(dnnl_eltwise_swish, std::is_same<T, ov::float16>::value);
- static GateUpCombine jit_gateup_gelu(dnnl_eltwise_gelu_tanh, std::is_same<T, ov::float16>::value);
+ static GateUpCombine jit_gateup_silu(dnnl_eltwise_swish, std::is_same_v<T, ov::float16>);
+ static GateUpCombine jit_gateup_gelu(dnnl_eltwise_gelu_tanh, std::is_same_v<T, ov::float16>);
if (config.act == LLMMLPNode::ACT_FN::GELU) {
jit_gateup = &jit_gateup_gelu;
@@ -263,7 +263,7 @@ public:
work.k0 = 0;
work.k1 = K;
work.quant_i8 = quantized_int8;
- work.is_f16 = std::is_same<T, ov::float16>::value;
+ work.is_f16 = std::is_same_v<T, ov::float16>;
used_nthr++;
}
@@ -370,7 +370,7 @@ struct LLMMLP::Executor : public LLMMLP::ExecutorBase {
: m_pnode(pnode),
m_config(config),
m_scrachPad(std::move(scrachPad)),
- m_rt_prec_f16(std::is_same<T, ov::float16>::value) {
+ m_rt_prec_f16(std::is_same_v<T, ov::float16>) {
PlainTensor w_gate(pnode->getSrcMemoryAtPort(1));
PlainTensor w_up(pnode->getSrcMemoryAtPort(2));
PlainTensor w_down(pnode->getSrcMemoryAtPort(3));
diff --git a/src/plugins/intel_cpu/src/nodes/qkv_proj.cpp b/src/plugins/intel_cpu/src/nodes/qkv_proj.cpp
index 63dea468b1b..5c32dc2eeb0 100644
--- a/src/plugins/intel_cpu/src/nodes/qkv_proj.cpp
+++ b/src/plugins/intel_cpu/src/nodes/qkv_proj.cpp
@@ -136,7 +136,7 @@ struct QKVProjection::Executor : public QKVProjection::ExecutorBase {
work.output_id = output_id;
work.p_raw_weights = pw;
work.quant_i8 = quantized_int8;
- work.is_f16 = std::is_same<T, ov::float16>::value;
+ work.is_f16 = std::is_same_v<T, ov::float16>;
}
start_blkN += blkN;
}
@@ -225,7 +225,7 @@ struct QKVProjection::Executor : public QKVProjection::ExecutorBase {
}
void execute() override {
- static ReduceAdd2bh jit_cvt(false, std::is_same<T, ov::float16>::value);
+ static ReduceAdd2bh jit_cvt(false, std::is_same_v<T, ov::float16>);
auto input = m_node->getSrcMemoryAtPort(0);
const auto& ishape = input->getStaticDims();
diff --git a/src/plugins/intel_cpu/src/nodes/range.cpp b/src/plugins/intel_cpu/src/nodes/range.cpp
index 36c5c32e1e6..945e2e2dd39 100644
--- a/src/plugins/intel_cpu/src/nodes/range.cpp
+++ b/src/plugins/intel_cpu/src/nodes/range.cpp
@@ -137,7 +137,7 @@ size_t Range::getWorkAmount(data_t* startPtr, data_t* stopPtr, data_t* stepPtr)
*stepPtr = getSrcDataAtPortAs<const data_t>(RANGE_DELTA)[0];
const data_t span = *stopPtr - *startPtr;
const data_t step = *stepPtr;
- if (std::is_same<data_t, int>::value) {
+ if (std::is_same_v<data_t, int>) {
auto iSpan = static_cast<int>(span);
auto iStep = static_cast<int>(step);
return static_cast<size_t>(div_up(iSpan < 0 ? -iSpan : iSpan, iStep < 0 ? -iStep : iStep));
diff --git a/src/plugins/intel_cpu/src/nodes/roi_align.cpp b/src/plugins/intel_cpu/src/nodes/roi_align.cpp
index 4d7a2d48921..911294f8c03 100644
--- a/src/plugins/intel_cpu/src/nodes/roi_align.cpp
+++ b/src/plugins/intel_cpu/src/nodes/roi_align.cpp
@@ -612,8 +612,8 @@ private:
// gather f32 data from reg_src with vmm_idx(data_size) to vmm_src with f32 precision
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;
+ constexpr bool is_ymm = std::is_same_v<Vmm, Xbyak::Ymm>;
+ constexpr bool is_zmm = std::is_same_v<Vmm, Xbyak::Zmm>;
if (is_zmm) {
kxnord(k_mask, k_mask, k_mask);
@@ -641,7 +641,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
void gather_bf16_to_f32_zmm(Vmm vmm_src, const reg64_t reg_src, const Vmm vmm_idx) {
- OPENVINO_ASSERT((std::is_same<Vmm, Xbyak::Zmm>::value),
+ OPENVINO_ASSERT((std::is_same_v<Vmm, Xbyak::Zmm>),
"bf16 is only supported from avx512_core platform for ROIAlign node.");
sub(rsp, v_len);
uni_vmovdqu(ptr[rsp], vmm_idx);
diff --git a/src/plugins/intel_cpu/tests/unit/shape_inference_test/proposal_shape_inference_test.cpp b/src/plugins/intel_cpu/tests/unit/shape_inference_test/proposal_shape_inference_test.cpp
index ab0346c6417..fb584bace06 100644
--- a/src/plugins/intel_cpu/tests/unit/shape_inference_test/proposal_shape_inference_test.cpp
+++ b/src/plugins/intel_cpu/tests/unit/shape_inference_test/proposal_shape_inference_test.cpp
@@ -5,8 +5,8 @@
#include <gmock/gmock.h>
#include "common_test_utils/test_assertions.hpp"
-#include "utils.hpp"
#include "openvino/op/proposal.hpp"
+#include "utils.hpp"
using namespace ov;
using namespace ov::intel_cpu;
@@ -24,9 +24,9 @@ protected:
}
static size_t exp_out_size() {
- if (std::is_same<op::v0::Proposal, TOp>::value) {
+ if (std::is_same_v<op::v0::Proposal, TOp>) {
return 1;
- } else if (std::is_same<op::v4::Proposal, TOp>::value) {
+ } else if (std::is_same_v<op::v4::Proposal, TOp>) {
return 2;
} else {
return 0;
diff --git a/src/plugins/intel_cpu/tests/unit/transformations/arm/convert_reduce_no_keep_dims.cpp b/src/plugins/intel_cpu/tests/unit/transformations/arm/convert_reduce_no_keep_dims.cpp
index 18f40a30521..1e0cca403b0 100644
--- a/src/plugins/intel_cpu/tests/unit/transformations/arm/convert_reduce_no_keep_dims.cpp
+++ b/src/plugins/intel_cpu/tests/unit/transformations/arm/convert_reduce_no_keep_dims.cpp
@@ -44,9 +44,9 @@ static std::shared_ptr<ov::Model> createRefGraph(std::shared_ptr<ov::opset1::Par
template <class T>
static bool registerAndRunReducePass(std::shared_ptr<ov::Model> model) {
ov::pass::Manager manager;
- if (std::is_base_of<ov::op::util::LogicalReductionKeepDims, T>::value) {
+ if (std::is_base_of_v<ov::op::util::LogicalReductionKeepDims, T>) {
manager.register_pass<ConvertReduction<ov::op::util::LogicalReductionKeepDims>>();
- } else if (std::is_base_of<ov::op::util::ArithmeticReductionKeepDims, T>::value) {
+ } else if (std::is_base_of_v<ov::op::util::ArithmeticReductionKeepDims, T>) {
manager.register_pass<ConvertReduction<ov::op::util::ArithmeticReductionKeepDims>>();
} else {
return false;
@@ -61,8 +61,8 @@ static ov::PartialShape dynamic_param_shape = ov::PartialShape{2, -1, 2, 9};
TYPED_TEST_SUITE_P(ConvertReduceNoKeepDimsTest);
TYPED_TEST_P(ConvertReduceNoKeepDimsTest, CheckConvertReduceTransformationIsAppliedForStaticShapes) {
- ov::element::Type_t dataType = std::is_base_of<ov::op::util::LogicalReductionKeepDims, TypeParam>::value ?
- ov::element::boolean : ov::element::f32;
+ ov::element::Type_t dataType =
+ std::is_base_of_v<ov::op::util::LogicalReductionKeepDims, TypeParam> ? ov::element::boolean : ov::element::f32;
auto param = std::make_shared<ov::opset1::Parameter>(dataType, static_param_shape);
auto model = createInitGraph<TypeParam>(param);
auto model_ref = createRefGraph<TypeParam>(param);
@@ -76,8 +76,8 @@ TYPED_TEST_P(ConvertReduceNoKeepDimsTest, CheckConvertReduceTransformationIsAppl
}
TYPED_TEST_P(ConvertReduceNoKeepDimsTest, CheckConvertReduceTransformationIsAppliedForDynaimcShapes) {
- ov::element::Type_t dataType = std::is_base_of<ov::op::util::LogicalReductionKeepDims, TypeParam>::value ?
- ov::element::boolean : ov::element::f32;
+ ov::element::Type_t dataType =
+ std::is_base_of_v<ov::op::util::LogicalReductionKeepDims, TypeParam> ? ov::element::boolean : ov::element::f32;
auto param = std::make_shared<ov::opset1::Parameter>(dataType, dynamic_param_shape);
auto model = createInitGraph<TypeParam>(param);
auto model_ref = createRefGraph<TypeParam>(param);