Skip to content

Commit 3475b8e

Browse files
authored
Rename USE_ONEMKL as USE_ONEMKL_XPU and set it as default ON (#1642)
- USE_ONEMKL (for oneMKL XPU) may be confused with USE_MKL (for oneMKL CPU). New name USE_ONEMKL_XPU provides better readability. - Set USE_ONEMKL_XPU as default ON.
1 parent f1ca919 commit 3475b8e

File tree

7 files changed

+27
-29
lines changed

7 files changed

+27
-29
lines changed

.github/scripts/build.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@ git submodule sync && git submodule update --init --recursive
5050
python -m pip install -r requirements.txt
5151
python -m pip install mkl-static mkl-include
5252
export USE_STATIC_MKL=1
53-
export USE_ONEMKL=1
5453
export USE_XCCL=1
5554
export PYTORCH_EXTRA_INSTALL_REQUIREMENTS=" \
5655
intel-cmplr-lib-rt==2025.1.1 | \

.github/workflows/_windows_ut.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,6 @@ jobs:
115115
pip install cmake setuptools==72.1.0 clang-format
116116
pip install mkl-static mkl-include
117117
set USE_STATIC_MKL=1
118-
set USE_ONEMKL=1
119118
copy "%CONDA_PREFIX%\Library\bin\libiomp*5md.dll" .\torch\lib
120119
copy "%CONDA_PREFIX%\Library\bin\uv.dll" .\torch\lib
121120
if defined CMAKE_PREFIX_PATH (

cmake/ONEMKL.cmake

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
option(USE_ONEMKL "Build with ONEMKL XPU support" OFF)
1+
option(USE_ONEMKL_XPU "Build with ONEMKL XPU support" ON)
22

3-
if(DEFINED ENV{USE_ONEMKL})
4-
set(USE_ONEMKL $ENV{USE_ONEMKL})
3+
if(DEFINED ENV{USE_ONEMKL_XPU})
4+
set(USE_ONEMKL_XPU $ENV{USE_ONEMKL_XPU})
55
endif()
66

7-
message(STATUS "USE_ONEMKL is set to ${USE_ONEMKL}")
7+
message(STATUS "USE_ONEMKL_XPU is set to ${USE_ONEMKL_XPU}")
88

9-
if(NOT USE_ONEMKL)
9+
if(NOT USE_ONEMKL_XPU)
1010
return()
1111
endif()
1212

src/ATen/native/xpu/SpectralOps.cpp

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
1-
#if defined(USE_ONEMKL)
1+
#if defined(USE_ONEMKL_XPU)
22
#include <ATen/native/xpu/mkl/SpectralOps.h>
33
#else
44
#include <ATen/native/Resize.h>
55
#include <ATen/ops/_fft_c2c_native.h>
66
#include <ATen/ops/_fft_c2r_native.h>
77
#include <ATen/ops/_fft_r2c_native.h>
8-
#endif // USE_ONEMKL
8+
#endif // USE_ONEMKL_XPU
99

1010
namespace at::native {
1111

@@ -16,13 +16,13 @@ Tensor _fft_c2c_xpu(
1616
bool forward) {
1717
TORCH_CHECK(self.is_complex());
1818

19-
#if defined(USE_ONEMKL)
19+
#if defined(USE_ONEMKL_XPU)
2020
return native::xpu::_fft_c2c_mkl(self, dim, normalization, forward);
2121
#else
2222
Tensor out_cpu = native::_fft_c2c_mkl(
2323
self.to(Device(at::kCPU)), dim, normalization, forward);
2424
return out_cpu.to(Device(at::kXPU));
25-
#endif // USE_ONEMKL
25+
#endif // USE_ONEMKL_XPU
2626
}
2727

2828
Tensor& _fft_c2c_xpu_out(
@@ -33,15 +33,15 @@ Tensor& _fft_c2c_xpu_out(
3333
Tensor& out) {
3434
TORCH_CHECK(self.is_complex());
3535

36-
#if defined(USE_ONEMKL)
36+
#if defined(USE_ONEMKL_XPU)
3737
return native::xpu::_fft_c2c_mkl_out(self, dim, normalization, forward, out);
3838
#else
3939
Tensor out_cpu = native::_fft_c2c_mkl(
4040
self.to(Device(at::kCPU)), dim, normalization, forward);
4141
at::native::resize_output(out, out_cpu.sizes());
4242
out.copy_(out_cpu);
4343
return out;
44-
#endif // USE_ONEMKL
44+
#endif // USE_ONEMKL_XPU
4545
}
4646

4747
Tensor _fft_c2r_xpu(
@@ -51,13 +51,13 @@ Tensor _fft_c2r_xpu(
5151
int64_t last_dim_size) {
5252
TORCH_CHECK(self.is_complex());
5353

54-
#if defined(USE_ONEMKL)
54+
#if defined(USE_ONEMKL_XPU)
5555
return native::xpu::_fft_c2r_mkl(self, dim, normalization, last_dim_size);
5656
#else
5757
Tensor out_cpu = native::_fft_c2r_mkl(
5858
self.to(Device(at::kCPU)), dim, normalization, last_dim_size);
5959
return out_cpu.to(Device(at::kXPU));
60-
#endif // USE_ONEMKL
60+
#endif // USE_ONEMKL_XPU
6161
}
6262

6363
Tensor& _fft_c2r_xpu_out(
@@ -68,7 +68,7 @@ Tensor& _fft_c2r_xpu_out(
6868
Tensor& out) {
6969
TORCH_CHECK(self.is_complex());
7070

71-
#if defined(USE_ONEMKL)
71+
#if defined(USE_ONEMKL_XPU)
7272
return native::xpu::_fft_c2r_mkl_out(
7373
self, dim, normalization, last_dim_size, out);
7474
#else
@@ -77,7 +77,7 @@ Tensor& _fft_c2r_xpu_out(
7777
at::native::resize_output(out, out_cpu.sizes());
7878
out.copy_(out_cpu);
7979
return out;
80-
#endif // USE_ONEMKL
80+
#endif // USE_ONEMKL_XPU
8181
}
8282

8383
Tensor _fft_r2c_xpu(
@@ -87,13 +87,13 @@ Tensor _fft_r2c_xpu(
8787
bool onesided) {
8888
TORCH_CHECK(self.is_floating_point());
8989

90-
#if defined(USE_ONEMKL)
90+
#if defined(USE_ONEMKL_XPU)
9191
return native::xpu::_fft_r2c_mkl(self, dim, normalization, onesided);
9292
#else
9393
Tensor out_cpu = native::_fft_r2c_mkl(
9494
self.to(Device(at::kCPU)), dim, normalization, onesided);
9595
return out_cpu.to(Device(at::kXPU));
96-
#endif // USE_ONEMKL
96+
#endif // USE_ONEMKL_XPU
9797
}
9898

9999
Tensor& _fft_r2c_xpu_out(
@@ -104,15 +104,15 @@ Tensor& _fft_r2c_xpu_out(
104104
Tensor& out) {
105105
TORCH_CHECK(self.is_floating_point());
106106

107-
#if defined(USE_ONEMKL)
107+
#if defined(USE_ONEMKL_XPU)
108108
return native::xpu::_fft_r2c_mkl_out(self, dim, normalization, onesided, out);
109109
#else
110110
Tensor out_cpu = native::_fft_r2c_mkl(
111111
self.to(Device(at::kCPU)), dim, normalization, onesided);
112112
at::native::resize_output(out, out_cpu.sizes());
113113
out.copy_(out_cpu);
114114
return out;
115-
#endif // USE_ONEMKL
115+
#endif // USE_ONEMKL_XPU
116116
}
117117

118118
} // namespace at::native

src/ATen/native/xpu/mkl/SpectralOps.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#if defined(USE_ONEMKL)
1+
#if defined(USE_ONEMKL_XPU)
22
#include <ATen/native/Resize.h>
33
#include <ATen/native/SpectralOpsUtils.h>
44
#include <ATen/native/xpu/mkl/SpectralOps.h>
@@ -591,4 +591,4 @@ Tensor& _fft_r2c_mkl_out(
591591
}
592592

593593
} // namespace at::native::xpu
594-
#endif // USE_ONEMKL
594+
#endif // USE_ONEMKL_XPU

src/BuildOnLinux.cmake

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -145,8 +145,8 @@ foreach(lib ${TORCH_XPU_OPS_LIBRARIES})
145145
target_link_libraries(${lib} PUBLIC ${SYCL_LIBRARY})
146146
endforeach()
147147

148-
if(USE_ONEMKL)
149-
target_compile_options(torch_xpu_ops PRIVATE "-DUSE_ONEMKL")
148+
if(USE_ONEMKL_XPU)
149+
target_compile_options(torch_xpu_ops PRIVATE "-DUSE_ONEMKL_XPU")
150150
target_include_directories(torch_xpu_ops PUBLIC ${TORCH_XPU_OPS_ONEMKL_INCLUDE_DIR})
151151
target_link_libraries(torch_xpu_ops PUBLIC ${TORCH_XPU_OPS_ONEMKL_LIBRARIES})
152-
endif()
152+
endif()

src/BuildOnWindows.cmake

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -342,8 +342,8 @@ foreach(lib ${TORCH_XPU_OPS_LIBRARIES})
342342
target_link_libraries(${lib} PUBLIC torch_cpu)
343343
endforeach()
344344

345-
if(USE_ONEMKL)
346-
target_compile_options(torch_xpu_ops PRIVATE "-DUSE_ONEMKL")
345+
if(USE_ONEMKL_XPU)
346+
target_compile_options(torch_xpu_ops PRIVATE "-DUSE_ONEMKL_XPU")
347347
target_include_directories(torch_xpu_ops PUBLIC ${TORCH_XPU_OPS_ONEMKL_INCLUDE_DIR})
348348
target_link_libraries(torch_xpu_ops PUBLIC ${TORCH_XPU_OPS_ONEMKL_LIBRARIES})
349-
endif()
349+
endif()

0 commit comments

Comments
 (0)