intel / intel-extension-for-pytorch

A Python package for extending the official PyTorch that can easily obtain performance on Intel platform
Apache License 2.0
1.64k stars 254 forks source link

XPU failed to compile with latest DPC++ on Windows #404

Open Gentoli opened 1 year ago

Gentoli commented 1 year ago

Describe the issue

Compiling produces an error in included headers from dpcpp. I cannot find a way to get an older version of DPC++.

DPC++ version: 2023.2.0 IPEX version: v2.0.110 (https://github.com/intel/intel-extension-for-pytorch/commit/509a3789d7a6b1f67fda0b2b8b785a81d1ce221d)

Logs (env setup by python setup.py bdist_wheel):

(ipex-build) PS C:\Users\<user>\source\builds\ipex\intel-extension-for-pytorch\build\Release\csrc\gpu> ninja -j1 --quiet
FAILED: csrc/gpu/CMakeFiles/intel-ext-pt-gpu.dir/aten/core/detail/Hooks.cpp.obj
C:\PROGRA~2\Intel\oneAPI\compiler\latest\windows\bin\icx.exe  /nologo /TP -DBUILD_IPEX_MAIN_LIB -DBUILD_SIMPLE_TRACE -DUSE_CHANNELS_LAST_1D -DUSE_MULTI_CONTEXT -DUSE_ONEMKL -DUSE_PERSIST_STREAM -DUSE_PRIMITIVE_CACHE -DUSE_PROFILER -DUSE_QUEUE_BARRIER -DUSE_SCRATCHPAD_MODE -DUSE_SPLIT_FP64_LOOPS -Dintel_ext_pt_gpu_EXPORTS -IC:\Users\<user>\source\builds\ipex\intel-extension-for-pytorch\third_party\oneDNN\include -IC:\Users\<user>\source\builds\ipex\intel-extension-for-pytorch\build\Release\csrc\gpu\csrc\gpu\oneDNN\include -IC:\Users\<user>\source\builds\ipex\intel-extension-for-pytorch\third_party\oneDNN\src -IC:\Users\<user>\source\builds\ipex\intel-extension-for-pytorch\third_party\oneDNN\src\..\include -IC:\Users\<user>\miniconda3\envs\ipex-build\Lib\site-packages\torch\include -IC:\Users\<user>\miniconda3\envs\ipex-build\Lib\site-packages\torch\include\torch\csrc\api\include -I"C:\Program Files (x86)\Intel\oneAPI\compiler\latest\windows\include" -IC:\Users\<user>\source\builds\ipex\intel-extension-for-pytorch\csrc\gpu -IC:\Users\<user>\source\builds\ipex\intel-extension-for-pytorch\csrc\gpu\aten -IC:\Users\<user>\source\builds\ipex\intel-extension-for-pytorch\csrc -IC:\Users\<user>\source\builds\ipex\intel-extension-for-pytorch\build\Release\csrc\gpu\csrc\aten\generated\ATen -I"C:\Program Files (x86)\Intel\oneAPI\mkl\latest\include" /DWIN32 /D_WINDOWS /W3 /GR /EHsc -Wno-narrowing -Wall -Wextra -Wno-missing-field-initializers -Wno-type-limits -Wno-array-bounds -Wno-write-strings -Wno-unknown-pragmas -Wno-sign-compare -Wno-deprecated-copy -Wno-unused-parameter -Wno-unused-variable -Wno-unused-function -Wno-unused-result -Wno-unused-local-typedefs -Wno-strict-overflow -Wno-strict-aliasing -Wno-ignored-qualifiers -Wno-pass-failed -Wno-error=deprecated-declarations -Wno-error=pedantic -Wno-error=redundant-decls -Wno-error=old-style-cast -Wno-self-assign-overloaded -Wno-implicit-const-int-float-conversion -Wno-unused-command-line-argument -Wno-inline-namespace-reopened-noninline -Wno-unused-const-variable -Wno-uninitialized  /MD /O2 /Ob2 /DNDEBUG -Qstd:c++17 -fsycl /EHsc -fhonor-nans -fhonor-infinities -fno-associative-math -fno-approx-func -fno-sycl-instrument-device-code -fsycl-max-parallel-link-jobs=32 -fsycl-targets=spir64_gen,spir64 -fsycl-link-huge-device-code -QMD -QMT csrc\gpu\CMakeFiles\intel-ext-pt-gpu.dir\aten\core\detail\Hooks.cpp.obj -QMF csrc\gpu\CMakeFiles\intel-ext-pt-gpu.dir\aten\core\detail\Hooks.cpp.obj.d /Focsrc\gpu\CMakeFiles\intel-ext-pt-gpu.dir\aten\core\detail\Hooks.cpp.obj /Fdcsrc\gpu\CMakeFiles\intel-ext-pt-gpu.dir\ -c C:\Users\<user>\source\builds\ipex\intel-extension-for-pytorch\csrc\gpu\aten\core\detail\Hooks.cpp
icx: warning: unknown argument ignored in clang-cl: '-fhonor-nans' [-Wunknown-argument]
icx: warning: unknown argument ignored in clang-cl: '-fhonor-infinities' [-Wunknown-argument]
icx: warning: unknown argument ignored in clang-cl: '-fno-associative-math' [-Wunknown-argument]
icx: warning: unknown argument ignored in clang-cl: '-fno-approx-func' [-Wunknown-argument]
icx: warning: unknown argument ignored in clang-cl: '-fsycl-link-huge-device-code' [-Wunknown-argument]
In file included from C:\Users\<user>\source\builds\ipex\intel-extension-for-pytorch\csrc\gpu\aten\core\detail\Hooks.cpp:1:
In file included from C:\Users\<user>\source\builds\ipex\intel-extension-for-pytorch\csrc\gpu\utils/DPCPP.h:4:
In file included from C:\PROGRA~2\Intel\oneAPI\compiler\latest\windows\bin-llvm\..\include\sycl/sycl.hpp:11:
In file included from C:\PROGRA~2\Intel\oneAPI\compiler\latest\windows\bin-llvm\..\include\sycl/accessor.hpp:26:
In file included from C:\PROGRA~2\Intel\oneAPI\compiler\latest\windows\bin-llvm\..\include\sycl/buffer.hpp:17:
In file included from C:\PROGRA~2\Intel\oneAPI\compiler\latest\windows\bin-llvm\..\include\sycl/ext/oneapi/accessor_property_list.hpp:26:
C:\PROGRA~2\Intel\oneAPI\compiler\latest\windows\bin-llvm\..\include\sycl/detail/property_list_base.hpp(125,12): error: no member named 'iter_swap' in namespace 'std'
      std::iter_swap(It, MPropsWithData.end() - 1);
      ~~~~~^
weynaa commented 1 year ago

Hi,

I encountered the same problem with dpc++: https://community.intel.com/t5/Intel-oneAPI-Data-Parallel-C/oneAPI-2023-2-0-samples-do-not-compile-on-Windows-with-VS2022/td-p/1512948#M3222. Unfortuantely, it seems like oneAPI 2023.2 is broken on the latest Visual Studio 2022 compiler versions. I had to roll back my Visual Studio installation to an older version based on this compatilibty matrix: https://www.intel.com/content/www/us/en/developer/articles/reference-implementation/intel-compilers-compatibility-with-microsoft-visual-studio-and-xcode.html

jingxu10 commented 1 year ago

@min-jean-cho

Nuullll commented 1 year ago

https://community.intel.com/t5/Intel-oneAPI-Data-Parallel-C/oneAPI-2023-2-0-samples-do-not-compile-on-Windows-with-VS2022/m-p/1516401/highlight/true#M3235 works for me.

Added one line to C:\Program Files (x86)\Intel\oneAPI\compiler\2023.2.1\windows\include\sycl\detail\property_list_base.hpp

5745839083d1f39ec4f96b0a51175805