Skip to content

[CPU] msvc: suppress warning in nodes/mlas directory#35777

Merged
maxnick merged 7 commits into
openvinotoolkit:masterfrom
azhai219:az/cpu_src_binskim_patch2
Jun 25, 2026
Merged

[CPU] msvc: suppress warning in nodes/mlas directory#35777
maxnick merged 7 commits into
openvinotoolkit:masterfrom
azhai219:az/cpu_src_binskim_patch2

Conversation

@azhai219

Copy link
Copy Markdown
Contributor

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).

@azhai219 azhai219 requested review from a team as code owners May 11, 2026 08:50
@github-actions github-actions Bot added the category: CPU OpenVINO CPU plugin label May 11, 2026
@azhai219 azhai219 force-pushed the az/cpu_src_binskim_patch2 branch 13 times, most recently from 43ed0b1 to b236914 Compare May 13, 2026 05:03
@azhai219 azhai219 force-pushed the az/cpu_src_binskim_patch2 branch from b236914 to c2e9de4 Compare May 13, 2026 06:38
@azhai219 azhai219 force-pushed the az/cpu_src_binskim_patch2 branch 10 times, most recently from 189e26e to af061e6 Compare May 15, 2026 05:51
@azhai219 azhai219 force-pushed the az/cpu_src_binskim_patch2 branch from c3350b7 to 6189484 Compare June 17, 2026 08:54
auto sign_of_stride = stride < 0 ? -1 : 1;

iter_count = full_dims[axis] / abs_stride;
iter_count = static_cast<int32_t>(full_dims[axis] / abs_stride);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

iter_ocunt is int. Why do we cast to int32_t and not int?
Applicable for all the places where int32_t is used

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

iter_ocunt is int. Why do we cast to int32_t and not int? Applicable for all the places where int32_t is used

I have reviewed all the int32_t in the patch. int is recovered unless int32_t is necessary.
Also, I removed the MSVC warnings option in the top CMakeLists.txt. Help review it again. Thanks.
@EgorDuplensky

@github-actions github-actions Bot added the category: build OpenVINO cmake script / infra label Jun 22, 2026
@azhai219 azhai219 force-pushed the az/cpu_src_binskim_patch2 branch 3 times, most recently from e394d0f to 001443a Compare June 22, 2026 08:24
@azhai219 azhai219 requested a review from EgorDuplensky June 22, 2026 08:27
float* C,
const int64_t ldc,
size_t thread_num) {
int32_t thread_num) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please revise every int32_t case

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

int32_t case

only 4 static_cast<int32_t>(...) imported in the below files. That is because the context itself is int32_t. We should keep the syntax aligned. Other int32_t have been replaced with int.

  • src/plugins/intel_cpu/src/nodes/gather_nd.cpp
  • src/plugins/intel_cpu/src/nodes/gather_tree.cpp
  • src/plugins/intel_cpu/src/nodes/multiclass_nms.cpp
  • src/plugins/intel_cpu/src/shape_inference/custom/reshape.cpp

@EgorDuplensky

@azhai219 azhai219 force-pushed the az/cpu_src_binskim_patch2 branch 2 times, most recently from cea5105 to 4e469c2 Compare June 24, 2026 02:54
@azhai219 azhai219 requested a review from EgorDuplensky June 24, 2026 05:25
vlen(vlen),
dataElPerVec(vlen / jcp.dataTypeSize),
idxElPerVec(vlen / indicesTypeSize),
vlen(static_cast<uint32_t>(vlen)),

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what warning do we fix here?
vlen argument is uint64_t and vlen member variable is also uint64_t

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

E:\xiuchuan\dev\openvino\src\plugins\intel_cpu\src\nodes\kernels\x64\gather_uni_kernel.cpp(431,21): warning C4244: 'argument': conversion from 'uint64_t' to 'uint32_t', possible loss of data [E:\xiuchuan\dev\openvino\build\src\plugins\intel_cpu\openvino_intel_cpu_plugin.vcxproj]
E:\xiuchuan\dev\openvino\src\plugins\intel_cpu\src\nodes\kernels\x64\gather_uni_kernel.cpp(527,21): warning C4244: 'argument': conversion from 'uint64_t' to 'uint32_t', possible loss of data [E:\xiuchuan\dev\openvino\build\src\plugins\intel_cpu\openvino_intel_cpu_plugin.vcxproj]
E:\xiuchuan\dev\openvino\src\plugins\intel_cpu\src\nodes\kernels\x64\gather_uni_kernel.cpp(1107,20): warning C4244: 'argument': conversion from 'uint64_t' to 'uint32_t', possible loss of data [E:\xiuchuan\dev\openvino\build\src\plugins\intel_cpu\openvino_intel_cpu_plugin.vcxproj]

const GridSampleKernelConfParams& jcp,
dnnl::impl::cpu::x64::cpu_isa_t isa,
uint64_t vlen)
uint32_t vlen)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what warning do we fix here?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

E:\xiuchuan\dev\openvino\src\plugins\intel_cpu\src\nodes\kernels\x64\grid_sample.cpp(343,18): warning C4244: 'argument': conversion from 'uint64_t' to 'uint32_t', possible loss of data [E:\xiuchuan\dev\openvino\build\src\plugins\intel_cpu\openvino_intel_cpu_plugin.vcxproj]
E:\xiuchuan\dev\openvino\src\plugins\intel_cpu\src\nodes\kernels\x64\grid_sample.cpp(350,18): warning C4244: 'argument': conversion from 'uint64_t' to 'uint32_t', possible loss of data [E:\xiuchuan\dev\openvino\build\src\plugins\intel_cpu\openvino_intel_cpu_plugin.vcxproj]
E:\xiuchuan\dev\openvino\src\plugins\intel_cpu\src\nodes\kernels\x64\grid_sample.cpp(373,18): warning C4244: 'argument': conversion from 'uint64_t' to 'uint32_t', possible loss of data [E:\xiuchuan\dev\openvino\build\src\plugins\intel_cpu\openvino_intel_cpu_plugin.vcxproj]
E:\xiuchuan\dev\openvino\src\plugins\intel_cpu\src\nodes\kernels\x64\grid_sample.cpp(379,18): warning C4244: 'argument': conversion from 'uint64_t' to 'uint32_t', possible loss of data [E:\xiuchuan\dev\openvino\build\src\plugins\intel_cpu\openvino_intel_cpu_plugin.vcxproj]
E:\xiuchuan\dev\openvino\src\plugins\intel_cpu\src\nodes\kernels\x64\grid_sample.cpp(441,37): warning C4244: 'argument': conversion from 'uint64_t' to 'uint32_t', possible loss of data [E:\xiuchuan\dev\openvino\build\src\plugins\intel_cpu\openvino_intel_cpu_plugin.vcxproj]
E:\xiuchuan\dev\openvino\src\plugins\intel_cpu\src\nodes\kernels\x64\grid_sample.cpp(447,22): warning C4244: 'argument': conversion from 'uint64_t' to 'uint32_t', possible loss of data [E:\xiuchuan\dev\openvino\build\src\plugins\intel_cpu\openvino_intel_cpu_plugin.vcxproj]
E:\xiuchuan\dev\openvino\src\plugins\intel_cpu\src\nodes\kernels\x64\grid_sample.cpp(448,19): warning C4244: 'argument': conversion from 'uint64_t' to 'uint32_t', possible loss of data [E:\xiuchuan\dev\openvino\build\src\plugins\intel_cpu\openvino_intel_cpu_plugin.vcxproj]
E:\xiuchuan\dev\openvino\src\plugins\intel_cpu\src\nodes\kernels\x64\grid_sample.cpp(502,37): warning C4244: 'argument': conversion from 'uint64_t' to 'uint32_t', possible loss of data [E:\xiuchuan\dev\openvino\build\src\plugins\intel_cpu\openvino_intel_cpu_plugin.vcxproj]
E:\xiuchuan\dev\openvino\src\plugins\intel_cpu\src\nodes\kernels\x64\grid_sample.cpp(508,22): warning C4244: 'argument': conversion from 'uint64_t' to 'uint32_t', possible loss of data [E:\xiuchuan\dev\openvino\build\src\plugins\intel_cpu\openvino_intel_cpu_plugin.vcxproj]
E:\xiuchuan\dev\openvino\src\plugins\intel_cpu\src\nodes\kernels\x64\grid_sample.cpp(509,19): warning C4244: 'argument': conversion from 'uint64_t' to 'uint32_t', possible loss of data [E:\xiuchuan\dev\openvino\build\src\plugins\intel_cpu\openvino_intel_cpu_plugin.vcxproj]
E:\xiuchuan\dev\openvino\src\plugins\intel_cpu\src\nodes\kernels\x64\grid_sample.cpp(559,22): warning C4244: 'argument': conversion from 'uint64_t' to 'uint32_t', possible loss of data [E:\xiuchuan\dev\openvino\build\src\plugins\intel_cpu\openvino_intel_cpu_plugin.vcxproj]
E:\xiuchuan\dev\openvino\src\plugins\intel_cpu\src\nodes\kernels\x64\grid_sample.cpp(579,22): warning C4244: 'argument': conversion from 'uint64_t' to 'uint32_t', possible loss of data [E:\xiuchuan\dev\openvino\build\src\plugins\intel_cpu\openvino_intel_cpu_plugin.vcxproj]
E:\xiuchuan\dev\openvino\src\plugins\intel_cpu\src\nodes\kernels\x64\grid_sample.cpp(600,37): warning C4244: 'argument': conversion from 'uint64_t' to 'uint32_t', possible loss of data [E:\xiuchuan\dev\openvino\build\src\plugins\intel_cpu\openvino_intel_cpu_plugin.vcxproj]
E:\xiuchuan\dev\openvino\src\plugins\intel_cpu\src\nodes\kernels\x64\grid_sample.cpp(609,22): warning C4244: 'argument': conversion from 'uint64_t' to 'uint32_t', possible loss of data [E:\xiuchuan\dev\openvino\build\src\plugins\intel_cpu\openvino_intel_cpu_plugin.vcxproj]
E:\xiuchuan\dev\openvino\src\plugins\intel_cpu\src\nodes\kernels\x64\grid_sample.cpp(610,19): warning C4244: 'argument': conversion from 'uint64_t' to 'uint32_t', possible loss of data [E:\xiuchuan\dev\openvino\build\src\plugins\intel_cpu\openvino_intel_cpu_plugin.vcxproj]
E:\xiuchuan\dev\openvino\src\plugins\intel_cpu\src\nodes\kernels\x64\grid_sample.cpp(287,28): warning C4244: 'argument': conversion from 'uint64_t' to 'uint32_t', possible loss of data [E:\xiuchuan\dev\openvino\build\src\plugins\intel_cpu\openvino_intel_cpu_plugin.vcxproj]
      E:\xiuchuan\dev\openvino\src\plugins\intel_cpu\src\nodes\kernels\x64\grid_sample.cpp(287,28):
      the template instantiation context (the oldest one first) is
          E:\xiuchuan\dev\openvino\src\plugins\intel_cpu\src\nodes\kernels\x64\grid_sample.cpp(73,42):
          see reference to class template instantiation 'ov::intel_cpu::kernel::GridSampleKernel<dnnl::impl::cpu::x64::avx512_core>' being compiled
          E:\xiuchuan\dev\openvino\src\plugins\intel_cpu\src\nodes\kernels\x64\grid_sample.cpp(279,43):
          while compiling class template member function 'void ov::intel_cpu::kernel::GridSampleKernel<dnnl::impl::cpu::x64::avx512_core>::spatialLoop(void)'
              E:\xiuchuan\dev\openvino\src\plugins\intel_cpu\src\nodes\kernels\x64\grid_sample.cpp(260,20):
              see the first reference to 'ov::intel_cpu::kernel::GridSampleKernel<dnnl::impl::cpu::x64::avx512_core>::spatialLoop' in 'ov::intel_cpu::kernel::GridSampleKernel<dnnl::impl::cpu::x64::avx512_core>::process'
              E:\xiuchuan\dev\openvino\src\plugins\intel_cpu\src\nodes\kernels\x64\grid_sample.cpp(66,12):
              see the first reference to 'ov::intel_cpu::kernel::GridSampleKernel<dnnl::impl::cpu::x64::avx512_core>::process' in 'ov::intel_cpu::kernel::GridSampleKernel<dnnl::impl::cpu::x64::avx512_core>::generate'

E:\xiuchuan\dev\openvino\src\plugins\intel_cpu\src\nodes\kernels\x64\grid_sample.cpp(294,28): warning C4244: 'argument': conversion from 'uint64_t' to 'uint32_t', possible loss of data [E:\xiuchuan\dev\openvino\build\src\plugins\intel_cpu\openvino_intel_cpu_plugin.vcxproj]
E:\xiuchuan\dev\openvino\src\plugins\intel_cpu\src\nodes\kernels\x64\grid_sample.cpp(295,21): warning C4244: 'argument': conversion from 'uint64_t' to 'uint32_t', possible loss of data [E:\xiuchuan\dev\openvino\build\src\plugins\intel_cpu\openvino_intel_cpu_plugin.vcxproj]

auto r32Ones = getReg32();
Xbyak::Reg64 r64Ones(r32Ones.getIdx());
auto elPerVec = x64::cpu_isa_traits_t<x64::sse41>::vlen / typeSize;
auto elPerVec = static_cast<uint32_t>(x64::cpu_isa_traits_t<x64::sse41>::vlen / typeSize);

@EgorDuplensky EgorDuplensky Jun 24, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what warning do we fix here?
There are many similar uint32_t changes made. I guess this question is applicable for all of them

@azhai219 azhai219 Jun 24, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@EgorDuplensky
That is because jit kernel like cmp use int32_t. If uint64_t is kept, more static_cast<uint32_t> will be imported in the jit kernel. If we cast at the beginning, we will save more cast in the kernel. Above comments are also the same reason.

@azhai219 azhai219 force-pushed the az/cpu_src_binskim_patch2 branch from 9bc460c to 4e469c2 Compare June 24, 2026 09:47
@azhai219 azhai219 requested a review from EgorDuplensky June 24, 2026 10:08
@azhai219 azhai219 force-pushed the az/cpu_src_binskim_patch2 branch from 4e469c2 to 34923ed Compare June 24, 2026 14:09
@maxnick maxnick added this to the 2026.3 milestone Jun 25, 2026
@maxnick maxnick added this pull request to the merge queue Jun 25, 2026
Merged via the queue into openvinotoolkit:master with commit fadc486 Jun 25, 2026
243 of 251 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

category: build OpenVINO cmake script / infra category: CPU OpenVINO CPU plugin

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants