Repository: pytorch
Issue: build libtorch in windows with intel oneapi base 2024 error
Labels: module: build,module: windows,triaged

### 🐛 Describe the bug

I want build a libtorch with mkl 2024, so I use 'git clone https://github.com/pytorch/pytorch'  'cd pytorch' 'git submodule sync' 'git submodule update --init --recursive' to get last main branche codes

build step：

"C:\Program Files (x86)\Intel\oneAPI\setvars.bat" intel64 vs2022

cmake -GNinja -DBUILD_PYTHON=False -DBUILD_TEST=False -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=E:\pytorch\install_path -DCMAKE_PREFIX_PATH=C:\Users\dell\miniconda3\envs\build_torch\Lib\site-packages -DJAVA_HOME=C:\Program Files\Java\jdk1.8.0_321 -DNUMPY_INCLUDE_DIR=C:\Users\dell\miniconda3\envs\build_torch\Lib\site-packages\numpy\core\include -DPYTHON_EXECUTABLE=C:\Users\dell\miniconda3\envs\build_torch\python.exe -DPYTHON_INCLUDE_DIR=C:\Users\dell\miniconda3\envs\build_torch\Include -DPYTHON_LIBRARY=C:\Users\dell\miniconda3\envs\build_torch/libs/python311.lib -DTORCH_BUILD_VERSION=2.4.0a0+gitb78e8c0 -DUSE_FBGEMM=ON -DUSE_FAKELOWP=ON -DUSE_ASAN=ON -DUSE_TSAN=ON -DUSE_NUMPY=False -DBUILD_BINARY=True -DUSE_CUDA=OFF -DUSE_VULKAN=OFF -DUSE_OPENCL=OFF -DUSE_MKL=ON -DUSE_MKLDNN=ON -DUSE_TBB=ON -DUSE_SYSTEM_TBB=ON -DONNX_ML=False -DUSE_MIMALLOC=True -DUSE_MKLDNN_CBLAS=ON ..\pytorch

cmake --build . --target install --config Release

but get build error：
C:\work\pytorch_to_onnx\pytorch\third_party\XNNPACK\src\f32-dwconv2d-chw\gen\f32-dwconv2d-chw-3x3p1-minmax-ssse3-6x4.c(156,48): error: '__builtin_ia32_palignr128' needs target feature ssse3
  156 |       const __m128 vi0x3456 = _mm_castsi128_ps(_mm_alignr_epi8(_mm_castps_si128(vi0x4567), _mm_castps_si128(vi0x0123), 12));
      |                                                ^
C:\PROGRA~2\Intel\oneAPI\compiler\latest\lib\clang\17\include\tmmintrin.h(152,13): note: expanded from macro '_mm_alignr_epi8'
  152 |   ((__m128i)__builtin_ia32_palignr128((__v16qi)(__m128i)(a), \
      |             ^
C:\work\pytorch_to_onnx\pytorch\third_party\XNNPACK\src\f32-dwconv2d-chw\gen\f32-dwconv2d-chw-3x3p1-minmax-ssse3-6x4.c(157,48): error: '__builtin_ia32_palignr128' needs target feature ssse3
  157 |       const __m128 vi1x3456 = _mm_castsi128_ps(_mm_alignr_epi8(_mm_castps_si128(vi1x4567), _mm_castps_si128(vi1x0123), 12));
      |                                                ^
C:\PROGRA~2\Intel\oneAPI\compiler\latest\lib\clang\17\include\tmmintrin.h(152,13): note: expanded from macro '_mm_alignr_epi8'
  152 |   ((__m128i)__builtin_ia32_palignr128((__v16qi)(__m128i)(a), \
      |             ^
C:\work\pytorch_to_onnx\pytorch\third_party\XNNPACK\src\f32-dwconv2d-chw\gen\f32-dwconv2d-chw-3x3p1-minmax-ssse3-6x4.c(158,48): error: '__builtin_ia32_palignr128' needs target feature ssse3
  158 |       const __m128 vi2x3456 = _mm_castsi128_ps(_mm_alignr_epi8(_mm_castps_si128(vi2x4567), _mm_castps_si128(vi2x0123), 12));
      |                                                ^
C:\PROGRA~2\Intel\oneAPI\compiler\latest\lib\clang\17\include\tmmintrin.h(152,13): note: expanded from macro '_mm_alignr_epi8'
  152 |   ((__m128i)__builtin_ia32_palignr128((__v16qi)(__m128i)(a), \
      |             ^
C:\work\pytorch_to_onnx\pytorch\third_party\XNNPACK\src\f32-dwconv2d-chw\gen\f32-dwconv2d-chw-3x3p1-minmax-ssse3-6x4.c(159,48): error: '__builtin_ia32_palignr128' needs target feature ssse3
  159 |       const __m128 vi3x3456 = _mm_castsi128_ps(_mm_alignr_epi8(_mm_castps_si128(vi3x4567), _mm_castps_si128(vi3x0123), 12));
      |                                                ^
C:\PROGRA~2\Intel\oneAPI\compiler\latest\lib\clang\17\include\tmmintrin.h(152,13): note: expanded from macro '_mm_alignr_epi8'
  152 |   ((__m128i)__builtin_ia32_palignr128((__v16qi)(__m128i)(a), \
      |             ^
C:\work\pytorch_to_onnx\pytorch\third_party\XNNPACK\src\f32-dwconv2d-chw\gen\f32-dwconv2d-chw-3x3p1-minmax-ssse3-6x4.c(160,48): error: '__builtin_ia32_palignr128' needs target feature ssse3
  160 |       const __m128 vi4x3456 = _mm_castsi128_ps(_mm_alignr_epi8(_mm_castps_si128(vi4x4567), _mm_castps_si128(vi4x0123), 12));
      |                                                ^
C:\PROGRA~2\Intel\oneAPI\compiler\latest\lib\clang\17\include\tmmintrin.h(152,13): note: expanded from macro '_mm_alignr_epi8'
  152 |   ((__m128i)__builtin_ia32_palignr128((__v16qi)(__m128i)(a), \
      |             ^
C:\work\pytorch_to_onnx\pytorch\third_party\XNNPACK\src\f32-dwconv2d-chw\gen\f32-dwconv2d-chw-3x3p1-minmax-ssse3-6x4.c(161,48): error: '__builtin_ia32_palignr128' needs target feature ssse3
  161 |       const __m128 vi5x3456 = _mm_castsi128_ps(_mm_alignr_epi8(_mm_castps_si128(vi5x4567), _mm_castps_si128(vi5x0123), 12));
      |                                                ^
C:\PROGRA~2\Intel\oneAPI\compiler\latest\lib\clang\17\include\tmmintrin.h(152,13): note: expanded from macro '_mm_alignr_epi8'
  152 |   ((__m128i)__builtin_ia32_palignr128((__v16qi)(__m128i)(a), \
      |             ^
C:\work\pytorch_to_onnx\pytorch\third_party\XNNPACK\src\f32-dwconv2d-chw\gen\f32-dwconv2d-chw-3x3p1-minmax-ssse3-6x4.c(162,48): error: '__builtin_ia32_palignr128' needs target feature ssse3
  162 |       const __m128 vi6x3456 = _mm_castsi128_ps(_mm_alignr_epi8(_mm_castps_si128(vi6x4567), _mm_castps_si128(vi6x0123), 12));
      |                                                ^
C:\PROGRA~2\Intel\oneAPI\compiler\latest\lib\clang\17\include\tmmintrin.h(152,13): note: expanded from macro '_mm_alignr_epi8'
  152 |   ((__m128i)__builtin_ia32_palignr128((__v16qi)(__m128i)(a), \
      |             ^
C:\work\pytorch_to_onnx\pytorch\third_party\XNNPACK\src\f32-dwconv2d-chw\gen\f32-dwconv2d-chw-3x3p1-minmax-ssse3-6x4.c(163,48): error: '__builtin_ia32_palignr128' needs target feature ssse3
  163 |       const __m128 vi7x3456 = _mm_castsi128_ps(_mm_alignr_epi8(_mm_castps_si128(vi7x4567), _mm_castps_si128(vi7x0123), 12));
      |                                                ^
C:\PROGRA~2\Intel\oneAPI\compiler\latest\lib\clang\17\include\tmmintrin.h(152,13): note: expanded from macro '_mm_alignr_epi8'
  152 |   ((__m128i)__builtin_ia32_palignr128((__v16qi)(__m128i)(a), \
      |             ^
C:\work\pytorch_to_onnx\pytorch\third_party\XNNPACK\src\f32-dwconv2d-chw\gen\f32-dwconv2d-chw-3x3p1-minmax-ssse3-6x4.c(193,48): error: '__builtin_ia32_palignr128' needs target feature ssse3
  193 |       const __m128 vi0x5678 = _mm_castsi128_ps(_mm_alignr_epi8(_mm_castps_si128(vi0x89AB), _mm_castps_si128(vi0x4567), 4));
      |                                                ^
C:\PROGRA~2\Intel\oneAPI\compiler\latest\lib\clang\17\include\tmmintrin.h(152,13): note: expanded from macro '_mm_alignr_epi8'
  152 |   ((__m128i)__builtin_ia32_palignr128((__v16qi)(__m128i)(a), \
      |             ^
C:\work\pytorch_to_onnx\pytorch\third_party\XNNPACK\src\f32-dwconv2d-chw\gen\f32-dwconv2d-chw-3x3p1-minmax-ssse3-6x4.c(194,48): error: '__builtin_ia32_palignr128' needs target feature ssse3
  194 |       const __m128 vi1x5678 = _mm_castsi128_ps(_mm_alignr_epi8(_mm_castps_si128(vi1x89AB), _mm_castps_si128(vi1x4567), 4));
      |                                                ^
C:\PROGRA~2\Intel\oneAPI\compiler\latest\lib\clang\17\include\tmmintrin.h(152,13): note: expanded from macro '_mm_alignr_epi8'
  152 |   ((__m128i)__builtin_ia32_palignr128((__v16qi)(__m128i)(a), \
      |             ^
C:\work\pytorch_to_onnx\pytorch\third_party\XNNPACK\src\f32-dwconv2d-chw\gen\f32-dwconv2d-chw-3x3p1-minmax-ssse3-6x4.c(195,48): error: '__builtin_ia32_palignr128' needs target feature ssse3
  195 |       const __m128 vi2x5678 = _mm_castsi128_ps(_mm_alignr_epi8(_mm_castps_si128(vi2x89AB), _mm_castps_si128(vi2x4567), 4));
      |                                                ^
C:\PROGRA~2\Intel\oneAPI\compiler\latest\lib\clang\17\include\tmmintrin.h(152,13): note: expanded from macro '_mm_alignr_epi8'
  152 |   ((__m128i)__builtin_ia32_palignr128((__v16qi)(__m128i)(a), \
      |             ^
C:\work\pytorch_to_onnx\pytorch\third_party\XNNPACK\src\f32-dwconv2d-chw\gen\f32-dwconv2d-chw-3x3p1-minmax-ssse3-6x4.c(196,48): error: '__builtin_ia32_palignr128' needs target feature ssse3
  196 |       const __m128 vi3x5678 = _mm_castsi128_ps(_mm_alignr_epi8(_mm_castps_si128(vi3x89AB), _mm_castps_si128(vi3x4567), 4));
      |                                                ^
C:\PROGRA~2\Intel\oneAPI\compiler\latest\lib\clang\17\include\tmmintrin.h(152,13): note: expanded from macro '_mm_alignr_epi8'
  152 |   ((__m128i)__builtin_ia32_palignr128((__v16qi)(__m128i)(a), \
      |             ^
C:\work\pytorch_to_onnx\pytorch\third_party\XNNPACK\src\f32-dwconv2d-chw\gen\f32-dwconv2d-chw-3x3p1-minmax-ssse3-6x4.c(197,48): error: '__builtin_ia32_palignr128' needs target feature ssse3
  197 |       const __m128 vi4x5678 = _mm_castsi128_ps(_mm_alignr_epi8(_mm_castps_si128(vi4x89AB), _mm_castps_si128(vi4x4567), 4));
      |                                                ^
C:\PROGRA~2\Intel\oneAPI\compiler\latest\lib\clang\17\include\tmmintrin.h(152,13): note: expanded from macro '_mm_alignr_epi8'
  152 |   ((__m128i)__builtin_ia32_palignr128((__v16qi)(__m128i)(a), \
      |             ^
C:\work\pytorch_to_onnx\pytorch\third_party\XNNPACK\src\f32-dwconv2d-chw\gen\f32-dwconv2d-chw-3x3p1-minmax-ssse3-6x4.c(198,48): error: '__builtin_ia32_palignr128' needs target feature ssse3
  198 |       const __m128 vi5x5678 = _mm_castsi128_ps(_mm_alignr_epi8(_mm_castps_si128(vi5x89AB), _mm_castps_si128(vi5x4567), 4));
      |                                                ^
C:\PROGRA~2\Intel\oneAPI\compiler\latest\lib\clang\17\include\tmmintrin.h(152,13): note: expanded from macro '_mm_alignr_epi8'
  152 |   ((__m128i)__builtin_ia32_palignr128((__v16qi)(__m128i)(a), \
      |             ^
C:\work\pytorch_to_onnx\pytorch\third_party\XNNPACK\src\f32-dwconv2d-chw\gen\f32-dwconv2d-chw-3x3p1-minmax-ssse3-6x4.c(199,48): error: '__builtin_ia32_palignr128' needs target feature ssse3
  199 |       const __m128 vi6x5678 = _mm_castsi128_ps(_mm_alignr_epi8(_mm_castps_si128(vi6x89AB), _mm_castps_si128(vi6x4567), 4));
      |                                                ^
C:\PROGRA~2\Intel\oneAPI\compiler\latest\lib\clang\17\include\tmmintrin.h(152,13): note: expanded from macro '_mm_alignr_epi8'
  152 |   ((__m128i)__builtin_ia32_palignr128((__v16qi)(__m128i)(a), \
      |             ^
C:\work\pytorch_to_onnx\pytorch\third_party\XNNPACK\src\f32-dwconv2d-chw\gen\f32-dwconv2d-chw-3x3p1-minmax-ssse3-6x4.c(200,48): error: '__builtin_ia32_palignr128' needs target feature ssse3
  200 |       const __m128 vi7x5678 = _mm_castsi128_ps(_mm_alignr_epi8(_mm_castps_si128(vi7x89AB), _mm_castps_si128(vi7x4567), 4));
      |                                                ^
C:\PROGRA~2\Intel\oneAPI\compiler\latest\lib\clang\17\include\tmmintrin.h(152,13): note: expanded from macro '_mm_alignr_epi8'
  152 |   ((__m128i)__builtin_ia32_palignr128((__v16qi)(__m128i)(a), \
      |             ^
C:\work\pytorch_to_onnx\pytorch\third_party\XNNPACK\src\f32-dwconv2d-chw\gen\f32-dwconv2d-chw-3x3p1-minmax-ssse3-6x4.c(290,48): error: '__builtin_ia32_palignr128' needs target feature ssse3
  290 |       const __m128 vi0x3456 = _mm_castsi128_ps(_mm_alignr_epi8(_mm_castps_si128(vi0x4567), _mm_castps_si128(vi0x0123), 12));
      |                                                ^
C:\PROGRA~2\Intel\oneAPI\compiler\latest\lib\clang\17\include\tmmintrin.h(152,13): note: expanded from macro '_mm_alignr_epi8'
  152 |   ((__m128i)__builtin_ia32_palignr128((__v16qi)(__m128i)(a), \
      |             ^
C:\work\pytorch_to_onnx\pytorch\third_party\XNNPACK\src\f32-dwconv2d-chw\gen\f32-dwconv2d-chw-3x3p1-minmax-ssse3-6x4.c(291,48): error: '__builtin_ia32_palignr128' needs target feature ssse3
  291 |       const __m128 vi1x3456 = _mm_castsi128_ps(_mm_alignr_epi8(_mm_castps_si128(vi1x4567), _mm_castps_si128(vi1x0123), 12));
      |                                                ^
C:\PROGRA~2\Intel\oneAPI\compiler\latest\lib\clang\17\include\tmmintrin.h(152,13): note: expanded from macro '_mm_alignr_epi8'
  152 |   ((__m128i)__builtin_ia32_palignr128((__v16qi)(__m128i)(a), \
      |             ^
C:\work\pytorch_to_onnx\pytorch\third_party\XNNPACK\src\f32-dwconv2d-chw\gen\f32-dwconv2d-chw-3x3p1-minmax-ssse3-6x4.c(292,48): error: '__builtin_ia32_palignr128' needs target feature ssse3
  292 |       const __m128 vi2x3456 = _mm_castsi128_ps(_mm_alignr_epi8(_mm_castps_si128(vi2x4567), _mm_castps_si128(vi2x0123), 12));
      |                                                ^
C:\PROGRA~2\Intel\oneAPI\compiler\latest\lib\clang\17\include\tmmintrin.h(152,13): note: expanded from macro '_mm_alignr_epi8'
  152 |   ((__m128i)__builtin_ia32_palignr128((__v16qi)(__m128i)(a), \
      |             ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
ninja: build stopped: subcommand failed.

how should i do?

### Versions

SHA-1: a01d35c7f68fe268e2bba4fc3774af7c869c0449

cc @malfet @seemethere @peterjc123 @mszhanyi @skyline75489 @nbcsm @vladimir-aubrecht @iremyux @Blackhex @cristianPanaite