Skip to content

Commit 337becf

Browse files
authored
get rid of explicit instantiation in fft backend (#2374)
In this PR, explicit instantiation of `compute_fft_in_place` and `compute_fft_out_of_place` functions in the backend is replaced with including a template definition.
1 parent 764f92c commit 337becf

File tree

5 files changed

+6
-55
lines changed

5 files changed

+6
-55
lines changed

dpnp/backend/extensions/fft/CMakeLists.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,6 @@
2727
set(python_module_name _fft_impl)
2828
set(_module_src
2929
${CMAKE_CURRENT_SOURCE_DIR}/fft_py.cpp
30-
${CMAKE_CURRENT_SOURCE_DIR}/in_place.cpp
31-
${CMAKE_CURRENT_SOURCE_DIR}/out_of_place.cpp
3230
)
3331

3432
pybind11_add_module(${python_module_name} MODULE ${_module_src})

dpnp/backend/extensions/fft/in_place.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,3 +42,5 @@ std::pair<sycl::event, sycl::event>
4242
const std::vector<sycl::event> &depends);
4343

4444
} // namespace dpnp::extensions::fft
45+
46+
#include "in_place.tpp" // Include template definition

dpnp/backend/extensions/fft/in_place.cpp renamed to dpnp/backend/extensions/fft/in_place.tpp

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
// THE POSSIBILITY OF SUCH DAMAGE.
2424
//*****************************************************************************
2525

26+
#pragma once
2627
#include <stdexcept>
2728

2829
#include <oneapi/mkl.hpp>
@@ -32,7 +33,6 @@
3233

3334
#include "common.hpp"
3435
#include "fft_utils.hpp"
35-
#include "in_place.hpp"
3636
// dpctl tensor headers
3737
#include "utils/output_validation.hpp"
3838

@@ -107,21 +107,4 @@ std::pair<sycl::event, sycl::event>
107107
return std::make_pair(fft_event, args_ev);
108108
}
109109

110-
// Explicit instantiations
111-
// single precision c2c FFT
112-
template std::pair<sycl::event, sycl::event> compute_fft_in_place(
113-
DescriptorWrapper<mkl_dft::precision::SINGLE, mkl_dft::domain::COMPLEX>
114-
&descr,
115-
const dpctl::tensor::usm_ndarray &in_out,
116-
const bool is_forward,
117-
const std::vector<sycl::event> &depends);
118-
119-
// double precision c2c FFT
120-
template std::pair<sycl::event, sycl::event> compute_fft_in_place(
121-
DescriptorWrapper<mkl_dft::precision::DOUBLE, mkl_dft::domain::COMPLEX>
122-
&descr,
123-
const dpctl::tensor::usm_ndarray &in_out,
124-
const bool is_forward,
125-
const std::vector<sycl::event> &depends);
126-
127110
} // namespace dpnp::extensions::fft

dpnp/backend/extensions/fft/out_of_place.hpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,3 +43,5 @@ std::pair<sycl::event, sycl::event>
4343
const std::vector<sycl::event> &depends);
4444

4545
} // namespace dpnp::extensions::fft
46+
47+
#include "out_of_place.tpp" // Include template definition

dpnp/backend/extensions/fft/out_of_place.cpp renamed to dpnp/backend/extensions/fft/out_of_place.tpp

Lines changed: 1 addition & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
// THE POSSIBILITY OF SUCH DAMAGE.
2424
//*****************************************************************************
2525

26+
#pragma once
2627
#include <stdexcept>
2728

2829
#include <oneapi/mkl.hpp>
@@ -32,7 +33,6 @@
3233

3334
#include "common.hpp"
3435
#include "fft_utils.hpp"
35-
#include "out_of_place.hpp"
3636
// dpctl tensor headers
3737
#include "utils/memory_overlap.hpp"
3838
#include "utils/output_validation.hpp"
@@ -167,38 +167,4 @@ std::pair<sycl::event, sycl::event>
167167
return std::make_pair(fft_event, args_ev);
168168
}
169169

170-
// Explicit instantiations
171-
// single precision c2c FFT
172-
template std::pair<sycl::event, sycl::event> compute_fft_out_of_place(
173-
DescriptorWrapper<mkl_dft::precision::SINGLE, mkl_dft::domain::COMPLEX>
174-
&descr,
175-
const dpctl::tensor::usm_ndarray &in,
176-
const dpctl::tensor::usm_ndarray &out,
177-
const bool is_forward,
178-
const std::vector<sycl::event> &depends);
179-
180-
// double precision c2c FFT
181-
template std::pair<sycl::event, sycl::event> compute_fft_out_of_place(
182-
DescriptorWrapper<mkl_dft::precision::DOUBLE, mkl_dft::domain::COMPLEX>
183-
&descr,
184-
const dpctl::tensor::usm_ndarray &in,
185-
const dpctl::tensor::usm_ndarray &out,
186-
const bool is_forward,
187-
const std::vector<sycl::event> &depends);
188-
189-
// single precision r2c/c2r FFT
190-
template std::pair<sycl::event, sycl::event> compute_fft_out_of_place(
191-
DescriptorWrapper<mkl_dft::precision::SINGLE, mkl_dft::domain::REAL> &descr,
192-
const dpctl::tensor::usm_ndarray &in,
193-
const dpctl::tensor::usm_ndarray &out,
194-
const bool is_forward,
195-
const std::vector<sycl::event> &depends);
196-
197-
// double precision r2c/c2r FFT
198-
template std::pair<sycl::event, sycl::event> compute_fft_out_of_place(
199-
DescriptorWrapper<mkl_dft::precision::DOUBLE, mkl_dft::domain::REAL> &descr,
200-
const dpctl::tensor::usm_ndarray &in,
201-
const dpctl::tensor::usm_ndarray &out,
202-
const bool is_forward,
203-
const std::vector<sycl::event> &depends);
204170
} // namespace dpnp::extensions::fft

0 commit comments

Comments
 (0)