DPNP C++ backend kernel library 0.19.0dev3
Data Parallel Extension for NumPy*
Loading...
Searching...
No Matches
dpnp_iface.hpp
1//*****************************************************************************
2// Copyright (c) 2016-2025, Intel Corporation
3// All rights reserved.
4//
5// Redistribution and use in source and binary forms, with or without
6// modification, are permitted provided that the following conditions are met:
7// - Redistributions of source code must retain the above copyright notice,
8// this list of conditions and the following disclaimer.
9// - Redistributions in binary form must reproduce the above copyright notice,
10// this list of conditions and the following disclaimer in the documentation
11// and/or other materials provided with the distribution.
12//
13// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
14// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
16// ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
17// LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
18// CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
19// SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
20// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
21// CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
22// ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
23// THE POSSIBILITY OF SUCH DAMAGE.
24//*****************************************************************************
25
26/*
27 * This header file is for interface Cython with C++.
28 * It should not contains any backend specific headers (like SYCL or math
29 * library) because all included headers will be exposed in Cython compilation
30 * procedure
31 *
32 * We would like to avoid backend specific things in higher level Cython
33 * modules. Any backend interface functions and types should be defined here.
34 *
35 * Also, this file should contains documentation on functions and types
36 * which are used in the interface
37 */
38
39#pragma once
40#ifndef BACKEND_IFACE_H // Cython compatibility
41#define BACKEND_IFACE_H
42
43#include <cstdint>
44#include <vector>
45
46#ifdef _WIN32
47#define INP_DLLEXPORT __declspec(dllexport)
48#else
49#define INP_DLLEXPORT
50#endif
51
52#if defined(_MSC_VER)
53#include <BaseTsd.h>
54typedef SSIZE_T ssize_t;
55#endif
56
57typedef ssize_t shape_elem_type;
58
59#include <dpctl_sycl_interface.h>
60
61#include "dpnp_iface_random.hpp"
62
76INP_DLLEXPORT size_t dpnp_queue_is_cpu_c();
77
89INP_DLLEXPORT char *dpnp_memory_alloc_c(DPCTLSyclQueueRef q_ref,
90 size_t size_in_bytes);
91INP_DLLEXPORT char *dpnp_memory_alloc_c(size_t size_in_bytes);
92
93INP_DLLEXPORT void dpnp_memory_free_c(DPCTLSyclQueueRef q_ref, void *ptr);
94INP_DLLEXPORT void dpnp_memory_free_c(void *ptr);
95
96INP_DLLEXPORT void dpnp_memory_memcpy_c(DPCTLSyclQueueRef q_ref,
97 void *dst,
98 const void *src,
99 size_t size_in_bytes);
100INP_DLLEXPORT void
101 dpnp_memory_memcpy_c(void *dst, const void *src, size_t size_in_bytes);
102
116template <typename _DataType>
117INP_DLLEXPORT DPCTLSyclEventRef
118 dpnp_partition_c(DPCTLSyclQueueRef q_ref,
119 void *array,
120 void *array2,
121 void *result,
122 const size_t kth,
123 const shape_elem_type *shape,
124 const size_t ndim,
125 const DPCTLEventVectorRef dep_event_vec_ref);
126
127template <typename _DataType>
128INP_DLLEXPORT void dpnp_partition_c(void *array,
129 void *array2,
130 void *result,
131 const size_t kth,
132 const shape_elem_type *shape,
133 const size_t ndim);
134
145template <typename _DataType>
146INP_DLLEXPORT DPCTLSyclEventRef
147 dpnp_initval_c(DPCTLSyclQueueRef q_ref,
148 void *result1,
149 void *value,
150 size_t size,
151 const DPCTLEventVectorRef dep_event_vec_ref);
152
153template <typename _DataType>
154INP_DLLEXPORT void dpnp_initval_c(void *result1, void *value, size_t size);
155
167template <typename _DataType_input, typename _DataType_output>
168INP_DLLEXPORT DPCTLSyclEventRef
169 dpnp_modf_c(DPCTLSyclQueueRef q_ref,
170 void *array1_in,
171 void *result1_out,
172 void *result2_out,
173 size_t size,
174 const DPCTLEventVectorRef dep_event_vec_ref);
175
176template <typename _DataType_input, typename _DataType_output>
177INP_DLLEXPORT void dpnp_modf_c(void *array1_in,
178 void *result1_out,
179 void *result2_out,
180 size_t size);
181
191template <typename _DataType>
192INP_DLLEXPORT DPCTLSyclEventRef
193 dpnp_ones_c(DPCTLSyclQueueRef q_ref,
194 void *result,
195 size_t size,
196 const DPCTLEventVectorRef dep_event_vec_ref);
197
198template <typename _DataType>
199INP_DLLEXPORT void dpnp_ones_c(void *result, size_t size);
200
210template <typename _DataType>
211INP_DLLEXPORT DPCTLSyclEventRef
212 dpnp_ones_like_c(DPCTLSyclQueueRef q_ref,
213 void *result,
214 size_t size,
215 const DPCTLEventVectorRef dep_event_vec_ref);
216
217template <typename _DataType>
218INP_DLLEXPORT void dpnp_ones_like_c(void *result, size_t size);
219
229template <typename _DataType>
230INP_DLLEXPORT DPCTLSyclEventRef
231 dpnp_zeros_c(DPCTLSyclQueueRef q_ref,
232 void *result,
233 size_t size,
234 const DPCTLEventVectorRef dep_event_vec_ref);
235
236template <typename _DataType>
237INP_DLLEXPORT void dpnp_zeros_c(void *result, size_t size);
238
248template <typename _DataType>
249INP_DLLEXPORT DPCTLSyclEventRef
250 dpnp_zeros_like_c(DPCTLSyclQueueRef q_ref,
251 void *result,
252 size_t size,
253 const DPCTLEventVectorRef dep_event_vec_ref);
254
255template <typename _DataType>
256INP_DLLEXPORT void dpnp_zeros_like_c(void *result, size_t size);
257
258#endif // BACKEND_IFACE_H
DPCTLSyclEventRef dpnp_initval_c(DPCTLSyclQueueRef q_ref, void *result1, void *value, size_t size, const DPCTLEventVectorRef dep_event_vec_ref)
implementation of creating filled with value array function
size_t dpnp_queue_is_cpu_c()
SYCL queue device status.
DPCTLSyclEventRef dpnp_zeros_like_c(DPCTLSyclQueueRef q_ref, void *result, size_t size, const DPCTLEventVectorRef dep_event_vec_ref)
Implementation of zeros_like function.
DPCTLSyclEventRef dpnp_ones_c(DPCTLSyclQueueRef q_ref, void *result, size_t size, const DPCTLEventVectorRef dep_event_vec_ref)
Implementation of ones function.
DPCTLSyclEventRef dpnp_ones_like_c(DPCTLSyclQueueRef q_ref, void *result, size_t size, const DPCTLEventVectorRef dep_event_vec_ref)
Implementation of ones_like function.
char * dpnp_memory_alloc_c(DPCTLSyclQueueRef q_ref, size_t size_in_bytes)
SYCL queue memory allocation.
DPCTLSyclEventRef dpnp_modf_c(DPCTLSyclQueueRef q_ref, void *array1_in, void *result1_out, void *result2_out, size_t size, const DPCTLEventVectorRef dep_event_vec_ref)
modf function.
DPCTLSyclEventRef dpnp_zeros_c(DPCTLSyclQueueRef q_ref, void *result, size_t size, const DPCTLEventVectorRef dep_event_vec_ref)
Implementation of zeros function.
DPCTLSyclEventRef dpnp_partition_c(DPCTLSyclQueueRef q_ref, void *array, void *array2, void *result, const size_t kth, const shape_elem_type *shape, const size_t ndim, const DPCTLEventVectorRef dep_event_vec_ref)
Return a partitioned copy of an array.