27
27
28
28
#include " dpnp_fptr.hpp"
29
29
#include " dpnp_iface.hpp"
30
+ #include " dpnpc_memory_adapter.hpp"
30
31
#include " queue_sycl.hpp"
31
32
32
33
template <typename _DataType, typename _ResultType>
@@ -35,16 +36,17 @@ class dpnp_all_c_kernel;
35
36
template <typename _DataType, typename _ResultType>
36
37
void dpnp_all_c (const void * array1_in, void * result1, const size_t size)
37
38
{
38
- cl::sycl::event event;
39
-
40
- const _DataType* array_in = reinterpret_cast <const _DataType*>(array1_in);
41
- _ResultType* result = reinterpret_cast <_ResultType*>(result1);
42
-
43
39
if (!array1_in || !result1)
44
40
{
45
41
return ;
46
42
}
47
43
44
+ cl::sycl::event event;
45
+ DPNPC_ptr_adapter<_DataType> input1_ptr (array1_in, size);
46
+ DPNPC_ptr_adapter<_ResultType> result1_ptr (result1, 1 , true , true );
47
+ const _DataType* array_in = input1_ptr.get_ptr ();
48
+ _ResultType* result = result1_ptr.get_ptr ();
49
+
48
50
result[0 ] = true ;
49
51
50
52
if (!size)
@@ -83,9 +85,13 @@ void dpnp_allclose_c(
83
85
return ;
84
86
}
85
87
86
- const _DataType1* array1 = reinterpret_cast <const _DataType1*>(array1_in);
87
- const _DataType2* array2 = reinterpret_cast <const _DataType2*>(array2_in);
88
- _ResultType* result = reinterpret_cast <_ResultType*>(result1);
88
+ cl::sycl::event event;
89
+ DPNPC_ptr_adapter<_DataType1> input1_ptr (array1_in, size);
90
+ DPNPC_ptr_adapter<_DataType2> input2_ptr (array2_in, size);
91
+ DPNPC_ptr_adapter<_ResultType> result1_ptr (result1, 1 , true , true );
92
+ const _DataType1* array1 = input1_ptr.get_ptr ();
93
+ const _DataType2* array2 = input2_ptr.get_ptr ();
94
+ _ResultType* result = result1_ptr.get_ptr ();
89
95
90
96
result[0 ] = true ;
91
97
@@ -94,8 +100,6 @@ void dpnp_allclose_c(
94
100
return ;
95
101
}
96
102
97
- cl::sycl::event event;
98
-
99
103
cl::sycl::range<1 > gws (size);
100
104
auto kernel_parallel_for_func = [=](cl::sycl::id<1 > global_id) {
101
105
size_t i = global_id[0 ];
@@ -122,16 +126,17 @@ class dpnp_any_c_kernel;
122
126
template <typename _DataType, typename _ResultType>
123
127
void dpnp_any_c (const void * array1_in, void * result1, const size_t size)
124
128
{
125
- cl::sycl::event event;
126
-
127
- const _DataType* array_in = reinterpret_cast <const _DataType*>(array1_in);
128
- _ResultType* result = reinterpret_cast <_ResultType*>(result1);
129
-
130
129
if (!array1_in || !result1)
131
130
{
132
131
return ;
133
132
}
134
133
134
+ cl::sycl::event event;
135
+ DPNPC_ptr_adapter<_DataType> input1_ptr (array1_in, size);
136
+ DPNPC_ptr_adapter<_ResultType> result1_ptr (result1, 1 , true , true );
137
+ const _DataType* array_in = input1_ptr.get_ptr ();
138
+ _ResultType* result = result1_ptr.get_ptr ();
139
+
135
140
result[0 ] = false ;
136
141
137
142
if (!size)
0 commit comments