Verify if the default value of the direction and placement used in the function <function name> aligns with the related compute function call.

Detailed Help#

By default, the parameter direction_and_placement is not passed for dpct::fft::fft_engine::create(), dpct::fft::fft_engine::commit(), or dpct::fft::fft_engine::estimate_size(). In this case, a forward direction (if the current FFT is complex-to-complex) and out-of-place (false) are used as the default values in this API. The configuration of the direction and placement is reset when executing dpct::fft::fft_engine::compute() according to the argument passed with the compute() API. There might be performance issues caused by the reconfiguration.

To avoid the potential performance issues, specify the parameter direction_and_placement explicitly when calling dpct::fft::fft_engine::create() or dpct::fft::fft_engine::commit(), then the direction and placement information passed by the compute() API is ignored and no reconfiguration happens.

Suggestions to Fix#

If you received a warning for dpct::fft::fft_engine::create() or dpct::fft::fft_engine::commit():

  • If you are using an internal workspace and do not care about performance, you can ignore this warning.

  • If you do care about performance, or if you are using an external workspace, specify the direction_and_placement parameter correctly.

If you received this warning for dpct::fft::fft_engine::estimate_size(), you need to specify the direction_and_placement parameter correctly.

For example, this original CUDA* code:

1void foo(cufftHandle plan, float2 *idata, float2 *odata) {
2  size_t worksize;
3  cufftMakePlan1d(plan, 7, CUFFT_C2C, 2, &worksize);
4  cufftExecC2C(plan, idata, odata, CUFFT_INVERSE);

results in the following migrated SYCL code:

 1void foo(dpct::fft::fft_engine_ptr plan, sycl::float2 *idata,
 2         sycl::float2 *odata) {
 3  size_t worksize;
 4  /*
 5  DPCT1100:0: Currently the DFT external workspace feature in the Intel(R)
 6  oneAPI Math Kernel Library (oneMKL) is only supported on GPU devices. Use the
 7  internal workspace if your code should run on non-GPU devices.
 8  */
 9  /*
10  DPCT1099:1: Verify if the default value of the direction and placement used in
11  the function "commit" aligns with the related "compute" function call.
12  */
13  plan->commit(&dpct::get_in_order_queue(), 7,
14               dpct::fft::fft_type::complex_float_to_complex_float, 2,
15               &worksize);
16  plan->compute<sycl::float2, sycl::float2>(idata, odata,
17                                            dpct::fft::fft_direction::backward);

which is rewritten to:

 1void foo(dpct::fft::fft_engine_ptr plan, sycl::float2 *idata,
 2         sycl::float2 *odata) {
 3  // idata and odata are different memory
 4  size_t worksize;
 5  plan->commit(
 6      &dpct::get_in_order_queue(), 7,
 7      dpct::fft::fft_type::complex_float_to_complex_float, 2, &worksize,
 8      std::make_pair(
 9          dpct::fft::fft_direction::backward /*In the next compute() function,
10             the direction is backward. So no need to change here.*/
11          ,
12          false /*is_inplace. In the next compute() function, idata and
13                   odata are different memory, so set false here*/
14          ));
15  plan->compute<sycl::float2, sycl::float2>(idata, odata,
16                                            dpct::fft::fft_direction::backward);