diff --git a/.github/scripts/build.sh b/.github/scripts/build.sh index 4e5ae4aa9a..419b0a465e 100755 --- a/.github/scripts/build.sh +++ b/.github/scripts/build.sh @@ -50,7 +50,6 @@ git submodule sync && git submodule update --init --recursive python -m pip install -r requirements.txt python -m pip install mkl-static mkl-include export USE_STATIC_MKL=1 -export USE_ONEMKL=1 export USE_XCCL=1 export PYTORCH_EXTRA_INSTALL_REQUIREMENTS=" \ intel-cmplr-lib-rt==2025.1.1 | \ diff --git a/.github/workflows/_windows_ut.yml b/.github/workflows/_windows_ut.yml index 6c168870a8..3c9d542a8f 100644 --- a/.github/workflows/_windows_ut.yml +++ b/.github/workflows/_windows_ut.yml @@ -115,7 +115,6 @@ jobs: pip install cmake setuptools==72.1.0 clang-format pip install mkl-static mkl-include set USE_STATIC_MKL=1 - set USE_ONEMKL=1 copy "%CONDA_PREFIX%\Library\bin\libiomp*5md.dll" .\torch\lib copy "%CONDA_PREFIX%\Library\bin\uv.dll" .\torch\lib if defined CMAKE_PREFIX_PATH ( diff --git a/cmake/ONEMKL.cmake b/cmake/ONEMKL.cmake index 04518f7a6f..aa04d4b0d7 100644 --- a/cmake/ONEMKL.cmake +++ b/cmake/ONEMKL.cmake @@ -1,12 +1,12 @@ -option(USE_ONEMKL "Build with ONEMKL XPU support" OFF) +option(USE_ONEMKL_XPU "Build with ONEMKL XPU support" ON) -if(DEFINED ENV{USE_ONEMKL}) - set(USE_ONEMKL $ENV{USE_ONEMKL}) +if(DEFINED ENV{USE_ONEMKL_XPU}) + set(USE_ONEMKL_XPU $ENV{USE_ONEMKL_XPU}) endif() -message(STATUS "USE_ONEMKL is set to ${USE_ONEMKL}") +message(STATUS "USE_ONEMKL_XPU is set to ${USE_ONEMKL_XPU}") -if(NOT USE_ONEMKL) +if(NOT USE_ONEMKL_XPU) return() endif() diff --git a/src/ATen/native/xpu/SpectralOps.cpp b/src/ATen/native/xpu/SpectralOps.cpp index 7ed5464288..16f5a92987 100644 --- a/src/ATen/native/xpu/SpectralOps.cpp +++ b/src/ATen/native/xpu/SpectralOps.cpp @@ -1,11 +1,11 @@ -#if defined(USE_ONEMKL) +#if defined(USE_ONEMKL_XPU) #include #else #include #include #include #include -#endif // USE_ONEMKL +#endif // USE_ONEMKL_XPU namespace at::native { @@ -16,13 +16,13 @@ Tensor _fft_c2c_xpu( bool forward) { TORCH_CHECK(self.is_complex()); -#if defined(USE_ONEMKL) +#if defined(USE_ONEMKL_XPU) return native::xpu::_fft_c2c_mkl(self, dim, normalization, forward); #else Tensor out_cpu = native::_fft_c2c_mkl( self.to(Device(at::kCPU)), dim, normalization, forward); return out_cpu.to(Device(at::kXPU)); -#endif // USE_ONEMKL +#endif // USE_ONEMKL_XPU } Tensor& _fft_c2c_xpu_out( @@ -33,7 +33,7 @@ Tensor& _fft_c2c_xpu_out( Tensor& out) { TORCH_CHECK(self.is_complex()); -#if defined(USE_ONEMKL) +#if defined(USE_ONEMKL_XPU) return native::xpu::_fft_c2c_mkl_out(self, dim, normalization, forward, out); #else Tensor out_cpu = native::_fft_c2c_mkl( @@ -41,7 +41,7 @@ Tensor& _fft_c2c_xpu_out( at::native::resize_output(out, out_cpu.sizes()); out.copy_(out_cpu); return out; -#endif // USE_ONEMKL +#endif // USE_ONEMKL_XPU } Tensor _fft_c2r_xpu( @@ -51,13 +51,13 @@ Tensor _fft_c2r_xpu( int64_t last_dim_size) { TORCH_CHECK(self.is_complex()); -#if defined(USE_ONEMKL) +#if defined(USE_ONEMKL_XPU) return native::xpu::_fft_c2r_mkl(self, dim, normalization, last_dim_size); #else Tensor out_cpu = native::_fft_c2r_mkl( self.to(Device(at::kCPU)), dim, normalization, last_dim_size); return out_cpu.to(Device(at::kXPU)); -#endif // USE_ONEMKL +#endif // USE_ONEMKL_XPU } Tensor& _fft_c2r_xpu_out( @@ -68,7 +68,7 @@ Tensor& _fft_c2r_xpu_out( Tensor& out) { TORCH_CHECK(self.is_complex()); -#if defined(USE_ONEMKL) +#if defined(USE_ONEMKL_XPU) return native::xpu::_fft_c2r_mkl_out( self, dim, normalization, last_dim_size, out); #else @@ -77,7 +77,7 @@ Tensor& _fft_c2r_xpu_out( at::native::resize_output(out, out_cpu.sizes()); out.copy_(out_cpu); return out; -#endif // USE_ONEMKL +#endif // USE_ONEMKL_XPU } Tensor _fft_r2c_xpu( @@ -87,13 +87,13 @@ Tensor _fft_r2c_xpu( bool onesided) { TORCH_CHECK(self.is_floating_point()); -#if defined(USE_ONEMKL) +#if defined(USE_ONEMKL_XPU) return native::xpu::_fft_r2c_mkl(self, dim, normalization, onesided); #else Tensor out_cpu = native::_fft_r2c_mkl( self.to(Device(at::kCPU)), dim, normalization, onesided); return out_cpu.to(Device(at::kXPU)); -#endif // USE_ONEMKL +#endif // USE_ONEMKL_XPU } Tensor& _fft_r2c_xpu_out( @@ -104,7 +104,7 @@ Tensor& _fft_r2c_xpu_out( Tensor& out) { TORCH_CHECK(self.is_floating_point()); -#if defined(USE_ONEMKL) +#if defined(USE_ONEMKL_XPU) return native::xpu::_fft_r2c_mkl_out(self, dim, normalization, onesided, out); #else Tensor out_cpu = native::_fft_r2c_mkl( @@ -112,7 +112,7 @@ Tensor& _fft_r2c_xpu_out( at::native::resize_output(out, out_cpu.sizes()); out.copy_(out_cpu); return out; -#endif // USE_ONEMKL +#endif // USE_ONEMKL_XPU } } // namespace at::native diff --git a/src/ATen/native/xpu/mkl/SpectralOps.cpp b/src/ATen/native/xpu/mkl/SpectralOps.cpp index 4f1e028b4a..372cb2ed88 100644 --- a/src/ATen/native/xpu/mkl/SpectralOps.cpp +++ b/src/ATen/native/xpu/mkl/SpectralOps.cpp @@ -1,4 +1,4 @@ -#if defined(USE_ONEMKL) +#if defined(USE_ONEMKL_XPU) #include #include #include @@ -591,4 +591,4 @@ Tensor& _fft_r2c_mkl_out( } } // namespace at::native::xpu -#endif // USE_ONEMKL +#endif // USE_ONEMKL_XPU diff --git a/src/BuildOnLinux.cmake b/src/BuildOnLinux.cmake index a946acae33..aee7118f01 100644 --- a/src/BuildOnLinux.cmake +++ b/src/BuildOnLinux.cmake @@ -145,8 +145,8 @@ foreach(lib ${TORCH_XPU_OPS_LIBRARIES}) target_link_libraries(${lib} PUBLIC ${SYCL_LIBRARY}) endforeach() -if(USE_ONEMKL) - target_compile_options(torch_xpu_ops PRIVATE "-DUSE_ONEMKL") +if(USE_ONEMKL_XPU) + target_compile_options(torch_xpu_ops PRIVATE "-DUSE_ONEMKL_XPU") target_include_directories(torch_xpu_ops PUBLIC ${TORCH_XPU_OPS_ONEMKL_INCLUDE_DIR}) target_link_libraries(torch_xpu_ops PUBLIC ${TORCH_XPU_OPS_ONEMKL_LIBRARIES}) -endif() \ No newline at end of file +endif() diff --git a/src/BuildOnWindows.cmake b/src/BuildOnWindows.cmake index 665fe56f30..77bd353d61 100644 --- a/src/BuildOnWindows.cmake +++ b/src/BuildOnWindows.cmake @@ -342,8 +342,8 @@ foreach(lib ${TORCH_XPU_OPS_LIBRARIES}) target_link_libraries(${lib} PUBLIC torch_cpu) endforeach() -if(USE_ONEMKL) - target_compile_options(torch_xpu_ops PRIVATE "-DUSE_ONEMKL") +if(USE_ONEMKL_XPU) + target_compile_options(torch_xpu_ops PRIVATE "-DUSE_ONEMKL_XPU") target_include_directories(torch_xpu_ops PUBLIC ${TORCH_XPU_OPS_ONEMKL_INCLUDE_DIR}) target_link_libraries(torch_xpu_ops PUBLIC ${TORCH_XPU_OPS_ONEMKL_LIBRARIES}) -endif() \ No newline at end of file +endif()