diff --git a/manywheel/build_cpu.sh b/manywheel/build_cpu.sh index a2fd8745d..5b8277e44 100755 --- a/manywheel/build_cpu.sh +++ b/manywheel/build_cpu.sh @@ -23,7 +23,7 @@ if [[ "$GPU_ARCH_TYPE" == "xpu" ]]; then # Refer https://www.intel.com/content/www/us/en/developer/articles/tool/pytorch-prerequisites-for-intel-gpu/2-5.html source /opt/intel/oneapi/pytorch-gpu-dev-0.5/oneapi-vars.sh source /opt/intel/oneapi/pti/latest/env/vars.sh - export TORCH_XPU_ARCH_LIST=pvc,xe-lpg,ats-m150 + export USE_STATIC_MKL=1 fi WHEELHOUSE_DIR="wheelhouse$DIR_SUFFIX" @@ -60,6 +60,34 @@ DEPS_SONAME=( "libgomp.so.1" ) +if [[ "$GPU_ARCH_TYPE" == "xpu" ]]; then + echo "Bundling with xpu support package libs." + DEPS_LIST+=( + "/opt/intel/oneapi/compiler/latest/lib/libsycl-preview.so.7" + "/opt/intel/oneapi/compiler/latest/lib/libOpenCL.so.1" + "/opt/intel/oneapi/compiler/latest/lib/libxptifw.so" + "/opt/intel/oneapi/compiler/latest/lib/libsvml.so" + "/opt/intel/oneapi/compiler/latest/lib/libirng.so" + "/opt/intel/oneapi/compiler/latest/lib/libimf.so" + "/opt/intel/oneapi/compiler/latest/lib/libintlc.so.5" + "/opt/intel/oneapi/compiler/latest/lib/libpi_level_zero.so" + "/opt/intel/oneapi/pti/latest/lib/libpti_view.so.0.9" + "/opt/intel/oneapi/pti/latest/lib/libpti.so.0.9" + ) + DEPS_SONAME+=( + "libsycl-preview.so.7" + "libOpenCL.so.1" + "libxptifw.so" + "libsvml.so" + "libirng.so" + "libimf.so" + "libintlc.so.5" + "libpi_level_zero.so" + "libpti_view.so.0.9" + "libpti.so.0.9" + ) +fi + rm -rf /usr/local/cuda* SOURCE_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )" diff --git a/windows/internal/copy_xpu.bat b/windows/internal/copy_xpu.bat new file mode 100755 index 000000000..888952508 --- /dev/null +++ b/windows/internal/copy_xpu.bat @@ -0,0 +1,13 @@ +copy "%XPU_BUNDLE_ROOT%\compiler\latest\bin\common_clang64.dll" pytorch\torch\lib +copy "%XPU_BUNDLE_ROOT%\compiler\latest\bin\intelocl64.dll" pytorch\torch\lib +copy "%XPU_BUNDLE_ROOT%\compiler\latest\bin\libmmd.dll" pytorch\torch\lib +copy "%XPU_BUNDLE_ROOT%\compiler\latest\bin\onnxruntime.1.12.22.721.dll" pytorch\torch\lib +copy "%XPU_BUNDLE_ROOT%\compiler\latest\bin\pi_level_zero.dll" pytorch\torch\lib +copy "%XPU_BUNDLE_ROOT%\compiler\latest\bin\pi_win_proxy_loader.dll" pytorch\torch\lib +copy "%XPU_BUNDLE_ROOT%\compiler\latest\bin\svml_dispmd.dll" pytorch\torch\lib +copy "%XPU_BUNDLE_ROOT%\compiler\latest\bin\sycl7.dll" pytorch\torch\lib +copy "%XPU_BUNDLE_ROOT%\tbb\latest\bin\tbb12.dll" pytorch\torch\lib + +copy "%CONDA_LIB_PATH%\libiomp*5md.dll" pytorch\torch\lib +:: Should be set in build_pytorch.bat +copy "%libuv_ROOT%\bin\uv.dll" pytorch\torch\lib diff --git a/windows/xpu.bat b/windows/xpu.bat index 11f1528c1..f99b09f8e 100755 --- a/windows/xpu.bat +++ b/windows/xpu.bat @@ -21,19 +21,21 @@ set USE_CUDA=0 call internal\check_opts.bat IF ERRORLEVEL 1 goto :eof -if exist "%NIGHTLIES_PYTORCH_ROOT%" cd %NIGHTLIES_PYTORCH_ROOT%\.. -call %~dp0\internal\copy_cpu.bat -IF ERRORLEVEL 1 goto :eof - echo Activate XPU Bundle env set VS2022INSTALLDIR=%VS15INSTALLDIR% -call "%ProgramFiles(x86)%\Intel\oneAPI\setvars.bat" +set XPU_BUNDLE_ROOT=%ProgramFiles(x86)%\Intel\oneAPI +call "%XPU_BUNDLE_ROOT%\compiler\latest\env\vars.bat" +call "%XPU_BUNDLE_ROOT%\ocloc\latest\env\vars.bat" IF ERRORLEVEL 1 goto :eof -set USE_KINETO=0 + :: Workaround for https://github.com/pytorch/pytorch/issues/134989 set CMAKE_SHARED_LINKER_FLAGS=/FORCE:MULTIPLE set CMAKE_MODULE_LINKER_FLAGS=/FORCE:MULTIPLE set CMAKE_EXE_LINKER_FLAGS=/FORCE:MULTIPLE +if exist "%NIGHTLIES_PYTORCH_ROOT%" cd %NIGHTLIES_PYTORCH_ROOT%\.. +call %~dp0\internal\copy_xpu.bat +IF ERRORLEVEL 1 goto :eof + call %~dp0\internal\setup.bat IF ERRORLEVEL 1 goto :eof