@@ -48,17 +48,17 @@ template <typename _KernelNameSpecialization1, typename _KernelNameSpecializatio
48
48
class dpnp_fft_fft_c_kernel ;
49
49
50
50
template <typename _DataType_input, typename _DataType_output>
51
- void dpnp_fft_fft_sycl_c (DPCTLSyclQueueRef q_ref,
52
- const void * array1_in,
53
- void * result_out,
54
- const shape_elem_type* input_shape,
55
- const shape_elem_type* output_shape,
56
- size_t shape_size,
57
- const size_t result_size,
58
- const size_t input_size,
59
- long axis,
60
- long input_boundarie,
61
- size_t inverse)
51
+ static void dpnp_fft_fft_sycl_c (DPCTLSyclQueueRef q_ref,
52
+ const void * array1_in,
53
+ void * result_out,
54
+ const shape_elem_type* input_shape,
55
+ const shape_elem_type* output_shape,
56
+ size_t shape_size,
57
+ const size_t result_size,
58
+ const size_t input_size,
59
+ long axis,
60
+ long input_boundarie,
61
+ size_t inverse)
62
62
{
63
63
if (!(input_size && result_size && shape_size))
64
64
{
@@ -71,9 +71,8 @@ void dpnp_fft_fft_sycl_c(DPCTLSyclQueueRef q_ref,
71
71
72
72
sycl::queue queue = *(reinterpret_cast <sycl::queue*>(q_ref));
73
73
74
- DPNPC_ptr_adapter<_DataType_input> input1_ptr (q_ref, array1_in, input_size);
75
- const _DataType_input* array_1 = input1_ptr.get_ptr ();
76
- _DataType_output* result = reinterpret_cast <_DataType_output*>(result_out);
74
+ _DataType_input* array_1 = static_cast <_DataType_input *>(const_cast <void *>(array1_in));
75
+ _DataType_output* result = static_cast <_DataType_output *>(result_out);
77
76
78
77
// kernel specific temporal data
79
78
shape_elem_type* output_shape_offsets =
@@ -171,29 +170,28 @@ void dpnp_fft_fft_sycl_c(DPCTLSyclQueueRef q_ref,
171
170
}
172
171
173
172
template <typename _DataType_input, typename _DataType_output, typename _Descriptor_type>
174
- void dpnp_fft_fft_mathlib_cmplx_to_cmplx_c (DPCTLSyclQueueRef q_ref,
175
- const void * array1_in,
176
- void * result_out,
177
- const shape_elem_type* input_shape,
178
- const shape_elem_type*,
179
- const size_t shape_size,
180
- const size_t input_size,
181
- const size_t result_size,
182
- _Descriptor_type& desc,
183
- size_t inverse,
184
- const size_t norm)
173
+ static void dpnp_fft_fft_mathlib_cmplx_to_cmplx_c (DPCTLSyclQueueRef q_ref,
174
+ const void * array1_in,
175
+ void * result_out,
176
+ const shape_elem_type* input_shape,
177
+ const shape_elem_type* result_shape ,
178
+ const size_t shape_size,
179
+ const size_t input_size,
180
+ const size_t result_size,
181
+ _Descriptor_type& desc,
182
+ size_t inverse,
183
+ const size_t norm)
185
184
{
186
- if (!shape_size)
187
- {
185
+ (void )result_shape;
186
+
187
+ if (!shape_size) {
188
188
return ;
189
189
}
190
190
191
191
sycl::queue queue = *(reinterpret_cast <sycl::queue*>(q_ref));
192
192
193
- DPNPC_ptr_adapter<_DataType_input> input1_ptr (q_ref, array1_in, input_size);
194
- DPNPC_ptr_adapter<_DataType_output> result_ptr (q_ref, result_out, result_size);
195
- _DataType_input* array_1 = input1_ptr.get_ptr ();
196
- _DataType_output* result = result_ptr.get_ptr ();
193
+ _DataType_input* array_1 = static_cast <_DataType_input *>(const_cast <void *>(array1_in));
194
+ _DataType_output* result = static_cast <_DataType_output *>(result_out);
197
195
198
196
const size_t n_iter =
199
197
std::accumulate (input_shape, input_shape + shape_size - 1 , 1 , std::multiplies<shape_elem_type>());
@@ -242,32 +240,29 @@ template <typename _KernelNameSpecialization1, typename _KernelNameSpecializatio
242
240
class dpnp_fft_fft_mathlib_real_to_cmplx_c_kernel ;
243
241
244
242
template <typename _DataType_input, typename _DataType_output, typename _Descriptor_type>
245
- DPCTLSyclEventRef dpnp_fft_fft_mathlib_real_to_cmplx_c (DPCTLSyclQueueRef q_ref,
246
- const void * array1_in,
247
- void * result_out,
248
- const shape_elem_type* input_shape,
249
- const shape_elem_type* result_shape,
250
- const size_t shape_size,
251
- const size_t input_size,
252
- const size_t result_size,
253
- _Descriptor_type& desc,
254
- size_t inverse,
255
- const size_t norm,
256
- const size_t real)
243
+ static DPCTLSyclEventRef dpnp_fft_fft_mathlib_real_to_cmplx_c (DPCTLSyclQueueRef q_ref,
244
+ const void * array1_in,
245
+ void * result_out,
246
+ const shape_elem_type* input_shape,
247
+ const shape_elem_type* result_shape,
248
+ const size_t shape_size,
249
+ const size_t input_size,
250
+ const size_t result_size,
251
+ _Descriptor_type& desc,
252
+ size_t inverse,
253
+ const size_t norm,
254
+ const size_t real)
257
255
{
258
- DPCTLSyclEventRef event_ref = nullptr ;;
259
- if (!shape_size)
260
- {
256
+ DPCTLSyclEventRef event_ref = nullptr ;
257
+ if (!shape_size) {
261
258
return event_ref;
262
259
}
263
260
264
- DPNPC_ptr_adapter<_DataType_input> input1_ptr (q_ref, array1_in, input_size);
265
- DPNPC_ptr_adapter<_DataType_output> result_ptr (q_ref, result_out, result_size * 2 , true , true );
266
- _DataType_input* array_1 = input1_ptr.get_ptr ();
267
- _DataType_output* result = result_ptr.get_ptr ();
268
-
269
261
sycl::queue queue = *(reinterpret_cast <sycl::queue*>(q_ref));
270
262
263
+ _DataType_input* array_1 = static_cast <_DataType_input *>(const_cast <void *>(array1_in));
264
+ _DataType_output* result = static_cast <_DataType_output *>(result_out);
265
+
271
266
const size_t n_iter =
272
267
std::accumulate (input_shape, input_shape + shape_size - 1 , 1 , std::multiplies<shape_elem_type>());
273
268
@@ -323,7 +318,8 @@ DPCTLSyclEventRef dpnp_fft_fft_mathlib_real_to_cmplx_c(DPCTLSyclQueueRef q_ref,
323
318
{
324
319
size_t j = global_id[1 ];
325
320
{
326
- *(reinterpret_cast <std::complex<_DataType_output>*>(result) + result_shift * (i + 1 ) - (j + 1 )) = std::conj (*(reinterpret_cast <std::complex<_DataType_output>*>(result) + result_shift * i + (j + 1 )));
321
+ *(reinterpret_cast <std::complex<_DataType_output>*>(result) + result_shift * (i + 1 ) - (j + 1 )) =
322
+ std::conj (*(reinterpret_cast <std::complex<_DataType_output>*>(result) + result_shift * i + (j + 1 )));
327
323
}
328
324
}
329
325
};
@@ -337,7 +333,10 @@ DPCTLSyclEventRef dpnp_fft_fft_mathlib_real_to_cmplx_c(DPCTLSyclQueueRef q_ref,
337
333
338
334
if (inverse) {
339
335
event.wait ();
340
- event = oneapi::mkl::vm::conj (queue, result_size, reinterpret_cast <std::complex<_DataType_output>*>(result), reinterpret_cast <std::complex<_DataType_output>*>(result));
336
+ event = oneapi::mkl::vm::conj (queue,
337
+ result_size,
338
+ reinterpret_cast <std::complex<_DataType_output>*>(result),
339
+ reinterpret_cast <std::complex<_DataType_output>*>(result));
341
340
}
342
341
343
342
event_ref = reinterpret_cast <DPCTLSyclEventRef>(&event);
@@ -411,21 +410,25 @@ DPCTLSyclEventRef dpnp_fft_fft_c(DPCTLSyclQueueRef q_ref,
411
410
else if constexpr (std::is_same<_DataType_input, int32_t >::value ||
412
411
std::is_same<_DataType_input, int64_t >::value)
413
412
{
414
- double * array1_copy = reinterpret_cast <double *>(dpnp_memory_alloc_c (input_size * sizeof (double )));
413
+ double * array1_copy = reinterpret_cast <double *>(dpnp_memory_alloc_c (q_ref, input_size * sizeof (double )));
415
414
416
415
shape_elem_type* copy_strides = reinterpret_cast <shape_elem_type*>(dpnp_memory_alloc_c (q_ref, sizeof (shape_elem_type)));
417
416
*copy_strides = 1 ;
418
417
shape_elem_type* copy_shape = reinterpret_cast <shape_elem_type*>(dpnp_memory_alloc_c (q_ref, sizeof (shape_elem_type)));
419
418
*copy_shape = input_size;
420
419
shape_elem_type copy_shape_size = 1 ;
421
- dpnp_copyto_c<_DataType_input, double >(q_ref, array1_copy, input_size, copy_shape_size, copy_shape, copy_strides,
422
- array1_in, input_size, copy_shape_size, copy_shape, copy_strides, NULL , dep_event_vec_ref);
420
+ event_ref = dpnp_copyto_c<_DataType_input, double >(q_ref, array1_copy, input_size, copy_shape_size, copy_shape, copy_strides,
421
+ array1_in, input_size, copy_shape_size, copy_shape, copy_strides, NULL , dep_event_vec_ref);
422
+ DPCTLEvent_WaitAndThrow (event_ref);
423
+ DPCTLEvent_Delete (event_ref);
423
424
424
425
desc_dp_real_t desc (dim);
425
426
event_ref = dpnp_fft_fft_mathlib_real_to_cmplx_c<double , double , desc_dp_real_t >(
426
427
q_ref, array1_copy, result_out, input_shape, result_shape, shape_size, input_size, result_size, desc, inverse, norm, 0 );
427
428
428
429
DPCTLEvent_WaitAndThrow (event_ref);
430
+ DPCTLEvent_Delete (event_ref);
431
+ event_ref = nullptr ;
429
432
430
433
dpnp_memory_free_c (q_ref, array1_copy);
431
434
dpnp_memory_free_c (q_ref, copy_strides);
@@ -475,6 +478,7 @@ void dpnp_fft_fft_c(const void* array1_in,
475
478
norm,
476
479
dep_event_vec_ref);
477
480
DPCTLEvent_WaitAndThrow (event_ref);
481
+ DPCTLEvent_Delete (event_ref);
478
482
}
479
483
480
484
template <typename _DataType_input, typename _DataType_output>
@@ -529,7 +533,6 @@ DPCTLSyclEventRef dpnp_fft_rfft_c(DPCTLSyclQueueRef q_ref,
529
533
530
534
size_t dim = input_shape[shape_size - 1 ];
531
535
532
-
533
536
if constexpr (std::is_same<_DataType_output, std::complex<float >>::value ||
534
537
std::is_same<_DataType_output, std::complex<double >>::value)
535
538
{
@@ -552,21 +555,25 @@ DPCTLSyclEventRef dpnp_fft_rfft_c(DPCTLSyclQueueRef q_ref,
552
555
else if constexpr (std::is_same<_DataType_input, int32_t >::value ||
553
556
std::is_same<_DataType_input, int64_t >::value)
554
557
{
555
- double * array1_copy = reinterpret_cast <double *>(dpnp_memory_alloc_c (input_size * sizeof (double )));
558
+ double * array1_copy = reinterpret_cast <double *>(dpnp_memory_alloc_c (q_ref, input_size * sizeof (double )));
556
559
557
560
shape_elem_type* copy_strides = reinterpret_cast <shape_elem_type*>(dpnp_memory_alloc_c (q_ref, sizeof (shape_elem_type)));
558
561
*copy_strides = 1 ;
559
562
shape_elem_type* copy_shape = reinterpret_cast <shape_elem_type*>(dpnp_memory_alloc_c (q_ref, sizeof (shape_elem_type)));
560
563
*copy_shape = input_size;
561
564
shape_elem_type copy_shape_size = 1 ;
562
- dpnp_copyto_c<_DataType_input, double >(q_ref, array1_copy, input_size, copy_shape_size, copy_shape, copy_strides,
563
- array1_in, input_size, copy_shape_size, copy_shape, copy_strides, NULL , dep_event_vec_ref);
565
+ event_ref = dpnp_copyto_c<_DataType_input, double >(q_ref, array1_copy, input_size, copy_shape_size, copy_shape, copy_strides,
566
+ array1_in, input_size, copy_shape_size, copy_shape, copy_strides, NULL , dep_event_vec_ref);
567
+ DPCTLEvent_WaitAndThrow (event_ref);
568
+ DPCTLEvent_Delete (event_ref);
564
569
565
570
desc_dp_real_t desc (dim);
566
571
event_ref = dpnp_fft_fft_mathlib_real_to_cmplx_c<double , double , desc_dp_real_t >(
567
572
q_ref, array1_copy, result_out, input_shape, result_shape, shape_size, input_size, result_size, desc, inverse, norm, 1 );
568
573
569
574
DPCTLEvent_WaitAndThrow (event_ref);
575
+ DPCTLEvent_Delete (event_ref);
576
+ event_ref = nullptr ;
570
577
571
578
dpnp_memory_free_c (q_ref, array1_copy);
572
579
dpnp_memory_free_c (q_ref, copy_strides);
@@ -603,6 +610,7 @@ void dpnp_fft_rfft_c(const void* array1_in,
603
610
norm,
604
611
dep_event_vec_ref);
605
612
DPCTLEvent_WaitAndThrow (event_ref);
613
+ DPCTLEvent_Delete (event_ref);
606
614
}
607
615
608
616
template <typename _DataType_input, typename _DataType_output>
0 commit comments