Skip to content

Commit fadc486

Browse files
authored
[CPU] msvc: suppress warning in nodes/mlas directory (#35777)
### Details: - *fix the warning in cpu nodes/mlas directory code base in msvc* ### Tickets: - *184181* ### AI Assistance: - *AI assistance used: no / yes* - *If yes, summarize how AI was used and what human validation was performed (build/tests/manual checks).*
1 parent 6f75563 commit fadc486

134 files changed

Lines changed: 955 additions & 834 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

src/plugins/intel_cpu/CMakeLists.txt

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,10 @@ endif()
88

99
set(TARGET_NAME "openvino_intel_cpu_plugin")
1010

11-
if(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
12-
# C4267, 4244 issues from oneDNN headers conversion from 'XXX' to 'YYY', possible loss of data
13-
ov_add_compiler_flags(/wd4018)
14-
ov_add_compiler_flags(/wd4267)
15-
ov_add_compiler_flags(/wd4244)
16-
# mkldnn headers: '<<': result of 32-bit shift implicitly converted to 64 bits
17-
ov_add_compiler_flags(/wd4334)
18-
# oneDNN arm64: unary minus operator applied to unsigned type, result still unsigned
19-
ov_add_compiler_flags(/wd4146)
20-
elseif (OV_COMPILER_IS_INTEL_LLVM AND WIN32)
11+
if (OV_COMPILER_IS_INTEL_LLVM AND WIN32)
2112
ov_add_compiler_flags("/Wno-microsoft-include")
2213
endif()
14+
2315
if(NOT BUILD_SHARED_LIBS)
2416
# Symbols are located in both src and include folders
2517
file(GLOB_RECURSE onednn_files

src/plugins/intel_cpu/src/cpu_parallel.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,13 @@
44

55
#include "cpu_parallel.hpp"
66

7-
#include <cstddef>
87
#include <memory>
98

109
#include "openvino/runtime/intel_cpu/properties.hpp"
1110
#include "thread_pool_imp.hpp"
1211

1312
namespace ov::intel_cpu {
14-
CpuParallel::CpuParallel(ov::intel_cpu::TbbPartitioner partitioner, size_t multiplier)
13+
CpuParallel::CpuParallel(ov::intel_cpu::TbbPartitioner partitioner, int multiplier)
1514
: m_partitioner(partitioner),
1615
m_multiplier(multiplier) {
1716
m_partitioner =

src/plugins/intel_cpu/src/cpu_parallel.hpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,22 +21,21 @@ class CpuParallel {
2121
CpuParallel() = delete;
2222
CpuParallel(CpuParallel&) = delete;
2323
CpuParallel(ov::intel_cpu::TbbPartitioner partitioner = ov::intel_cpu::TbbPartitioner::STATIC,
24-
size_t multiplier = default_multiplier);
24+
int multiplier = default_multiplier);
2525
~CpuParallel() = default;
2626

2727
[[nodiscard]] ov::intel_cpu::TbbPartitioner get_partitioner() const {
2828
return m_partitioner;
2929
}
30-
[[nodiscard]] size_t get_multiplier() const {
30+
[[nodiscard]] int get_multiplier() const {
3131
return m_multiplier;
3232
}
3333
[[nodiscard]] std::shared_ptr<ThreadPool> get_thread_pool() const {
3434
return m_thread_pool;
3535
}
3636
[[nodiscard]] int get_num_threads() const {
37-
int num = m_partitioner == ov::intel_cpu::TbbPartitioner::STATIC
38-
? parallel_get_max_threads()
39-
: parallel_get_max_threads() * static_cast<int>(m_multiplier);
37+
int num = m_partitioner == ov::intel_cpu::TbbPartitioner::STATIC ? parallel_get_max_threads()
38+
: parallel_get_max_threads() * m_multiplier;
4039
return num;
4140
}
4241
[[nodiscard]] static int get_num_worker_threads() {

src/plugins/intel_cpu/src/emitters/plugin/x64/jit_bf16_emitters.hpp

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -59,17 +59,21 @@ class jit_uni_vcvtneps2bf16 : public jit_emitter {
5959
using Vmm = typename dnnl::impl::utils::
6060
conditional3<isa == dnnl::impl::cpu::x64::sse41, Xmm, isa == dnnl::impl::cpu::x64::avx2, Ymm, Zmm>::type;
6161

62-
auto in = Vmm(in_vec_idxs[0]);
62+
const auto to_reg_idx = [](size_t idx) {
63+
return static_cast<int>(idx);
64+
};
65+
66+
auto in = Vmm(to_reg_idx(in_vec_idxs[0]));
6367
if (mode_ == conversion_mode::saturation_mode) {
64-
auto vmm_temp = Vmm(out_vec_idxs[0]);
68+
auto vmm_temp = Vmm(to_reg_idx(out_vec_idxs[0]));
6569

6670
h->uni_vmaxps(vmm_temp, in, table_val("bf16_min"));
6771
h->uni_vminps(vmm_temp, vmm_temp, table_val("bf16_max"));
6872

6973
if (dnnl::impl::cpu::x64::mayiuse(dnnl::impl::cpu::x64::avx512_core)) {
7074
h->vfixupimmps(vmm_temp, in, table_val("selector"), 0);
7175
} else {
72-
auto mask = Vmm(aux_vec_idxs[0]);
76+
auto mask = Vmm(to_reg_idx(aux_vec_idxs[0]));
7377
h->uni_vcmpps(mask, in, in, 0x03); // _CMP_UNORD_Q
7478
h->uni_vblendvps(vmm_temp, vmm_temp, table_val("nan"), mask);
7579
h->uni_vcmpps(mask, in, table_val("inf"), 0x00); // _CMP_EQ_OQ
@@ -81,12 +85,12 @@ class jit_uni_vcvtneps2bf16 : public jit_emitter {
8185
}
8286

8387
if (dnnl::impl::cpu::x64::mayiuse(dnnl::impl::cpu::x64::avx512_core_bf16)) {
84-
auto out = Ymm(out_vec_idxs[0]);
88+
auto out = Ymm(to_reg_idx(out_vec_idxs[0]));
8589
h->vcvtneps2bf16(out, in);
8690
} else if (host_isa_ == dnnl::impl::cpu::x64::cpu_isa_t::avx512_core) {
87-
auto aux = Zmm(aux_vec_idxs[0]);
88-
auto aux1 = Zmm(aux_vec_idxs[1]);
89-
auto out = Ymm(out_vec_idxs[0]);
91+
auto aux = Zmm(to_reg_idx(aux_vec_idxs[0]));
92+
auto aux1 = Zmm(to_reg_idx(aux_vec_idxs[1]));
93+
auto out = Ymm(to_reg_idx(out_vec_idxs[0]));
9094

9195
h->uni_vpsrld(aux, in, 16);
9296
h->vpandd(aux, aux, table_val("one"));
@@ -97,11 +101,11 @@ class jit_uni_vcvtneps2bf16 : public jit_emitter {
97101
h->vpsrad(aux, aux, 16);
98102
h->vpmovdw(out, aux);
99103
} else if (dnnl::impl::cpu::x64::mayiuse(dnnl::impl::cpu::x64::cpu_isa_t::avx2_vnni_2)) {
100-
auto out = Xmm(out_vec_idxs[0]);
104+
auto out = Xmm(to_reg_idx(out_vec_idxs[0]));
101105
h->vcvtneps2bf16(out, in, PreferredEncoding::VexEncoding);
102106
} else { // round_to_nearest_even emulation
103-
auto aux = Vmm(aux_vec_idxs[0]);
104-
auto out = Xmm(out_vec_idxs[0]);
107+
auto aux = Vmm(to_reg_idx(aux_vec_idxs[0]));
108+
auto out = Xmm(to_reg_idx(out_vec_idxs[0]));
105109

106110
if (host_isa_ == dnnl::impl::cpu::x64::cpu_isa_t::avx2) {
107111
h->uni_vandps(aux, in, table_val("rounding"));

src/plugins/intel_cpu/src/emitters/plugin/x64/jit_emitter.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@
1010
#include <cassert>
1111
#include <cpu/x64/cpu_isa_traits.hpp>
1212
#include <cstddef>
13-
#include <cstdint>
1413
#include <memory>
1514
#include <set>
1615
#include <vector>
@@ -192,8 +191,8 @@ void jit_emitter::emitter_preamble(const std::vector<size_t>& in_idxs,
192191
aux_gpr_idxs.erase(aux_gpr_idxs.end() - 1);
193192
}
194193

195-
for (uint64_t preserved_gpr_idx : preserved_gpr_idxs) {
196-
h->push(Reg64(preserved_gpr_idx));
194+
for (auto preserved_gpr_idx : preserved_gpr_idxs) {
195+
h->push(Reg64(static_cast<int>(preserved_gpr_idx)));
197196
}
198197

199198
if (!preserved_vec_idxs.empty()) {

src/plugins/intel_cpu/src/emitters/snippets/x64/jit_loop_base_emitters.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ void jit_loop_end_base_emitter::apply_increments_to_ptrs(const std::vector<size_
179179
h->ptr[reg_increments.value() + idx * sizeof(int64_t)]);
180180
} else {
181181
// Use pre-computed increment value from loop_args (already scaled)
182-
h->add(Reg64(static_cast<int>(data_ptr_reg_idxs[idx])), increment);
182+
h->add(Reg64(static_cast<int>(data_ptr_reg_idxs[idx])), static_cast<uint32_t>(increment));
183183
}
184184
}
185185
}

src/plugins/intel_cpu/src/memory_desc/cpu_blocked_memory_desc.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -296,7 +296,7 @@ MemoryDescPtr CpuBlockedMemoryDesc::cloneWithNewDimsImp(const VectorDims& dims)
296296
}
297297

298298
// TODO [DS]: add stride recalculation for strided blobs
299-
for (int i = strides.size() - 2; i >= 0; i--) {
299+
for (auto i = static_cast<int>(strides.size() - 2); i >= 0; i--) {
300300
if (strides[i] == Shape::UNDEFINED_DIM) {
301301
break;
302302
}

src/plugins/intel_cpu/src/memory_desc/dnnl_blocked_memory_desc.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ DnnlBlockedMemoryDesc::DnnlBlockedMemoryDesc(ov::element::Type prc,
194194
desc.get()->format_kind = dnnl_blocked;
195195
desc.get()->extra.flags = 0;
196196
desc.get()->data_type = memory::convert_to_c(DnnlExtensionUtils::ElementTypeToDataType(prc));
197-
desc.get()->ndims = dims.size();
197+
desc.get()->ndims = static_cast<int>(dims.size());
198198
desc.get()->offset0 = DnnlExtensionUtils::convertToDnnlDim(offsetPadding);
199199
std::copy(dims.begin(), dims.end(), desc.get()->dims);
200200

@@ -227,7 +227,7 @@ DnnlBlockedMemoryDesc::DnnlBlockedMemoryDesc(ov::element::Type prc,
227227

228228
// Fill blocking desc
229229
auto& dnn_blk_desc = desc.get()->format_desc.blocking;
230-
dnn_blk_desc.inner_nblks = inner_ndims;
230+
dnn_blk_desc.inner_nblks = static_cast<int>(inner_ndims);
231231
std::copy(dnnlBlkDims.end() - inner_ndims, dnnlBlkDims.end(), dnn_blk_desc.inner_blks);
232232
std::copy(order.end() - inner_ndims, order.end(), dnn_blk_desc.inner_idxs);
233233

@@ -474,8 +474,8 @@ static dnnl::memory::desc cloneDescWithNewDims(const dnnl::memory::desc& desc,
474474
std::vector<int> perm(convert_to_vector<int, size_t>(order.data(), mklDims.size()));
475475
auto innerBlks = clonedDesc.get_inner_blks();
476476
auto innerIdxs = clonedDesc.get_inner_idxs();
477-
std::vector<int> innerBlksInt(innerBlks.begin(), innerBlks.end());
478-
std::vector<int> innerIdxsInt(innerIdxs.begin(), innerIdxs.end());
477+
std::vector<int> innerBlksInt(convert_to_vector<int>(innerBlks.data(), innerBlks.size()));
478+
std::vector<int> innerIdxsInt(convert_to_vector<int>(innerIdxs.data(), innerIdxs.size()));
479479

480480
auto retCode = dnnl::impl::fill_blocked(*clonedDesc.get(), perm, innerBlksInt, innerIdxsInt);
481481
OPENVINO_ASSERT(retCode == dnnl::impl::status::success,
@@ -497,7 +497,7 @@ MemoryDescPtr DnnlBlockedMemoryDesc::cloneWithNewDimsImp(const VectorDims& dims)
497497
"Can't clone desc if new dims are undefined");
498498

499499
// TODO [DS]: add stride recalculation for strided blobs
500-
for (int i = strides.size() - 2; i >= 0; i--) {
500+
for (auto i = static_cast<int>(strides.size() - 2); i >= 0; i--) {
501501
if (strides[i] == Shape::UNDEFINED_DIM) {
502502
break;
503503
}

src/plugins/intel_cpu/src/mlas/sgemm.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ void mlas_sgemm(const char* transa,
3838
const float beta,
3939
float* C,
4040
const int64_t ldc,
41-
size_t thread_num) {
41+
int thread_num) {
4242
// C = alpha*op( A )op( B ) + beta * C
4343
MLAS_SGEMM_DATA_PARAMS sgemmParam;
4444
sgemmParam.BIsPacked = false;
@@ -70,7 +70,7 @@ void mlas_sgemm_compute(const char* transa,
7070
float* C,
7171
const int64_t ldc,
7272
const float* bias,
73-
size_t thread_num) {
73+
int thread_num) {
7474
// C = alpha*op( A )op( B ) + beta * C
7575
ov::cpu::OVMlasThreadPool threadPool(0 == thread_num ? parallel_get_max_threads() : thread_num);
7676
MLAS_SGEMM_DATA_PARAMS sgemmParam;

src/plugins/intel_cpu/src/mlas/sgemm.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ void mlas_sgemm(const char* transa,
6262
float beta,
6363
float* C,
6464
int64_t ldc,
65-
size_t thread_num = 0);
65+
int thread_num = 0);
6666

6767
/**
6868
* @brief SGEMM with B matrix prepacked
@@ -98,5 +98,5 @@ void mlas_sgemm_compute(const char* transa,
9898
float* C,
9999
int64_t ldc,
100100
const float* bias = nullptr,
101-
size_t thread_num = 0);
101+
int thread_num = 0);
102102
} // namespace ov::intel_cpu

0 commit comments

Comments
 (0)