Skip to content

Commit 78a858c

Browse files
Implements #972 by adding dpctl/sycl.pxd
This Cython declaration file contains incomplete redeclarations of SYCL runtime classes, as well as wrap/unwrap casters to convert SyclInterface opaque pointers to these.
1 parent a798e90 commit 78a858c

File tree

1 file changed

+59
-0
lines changed

1 file changed

+59
-0
lines changed

dpctl/sycl.pxd

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
# Copyright 2022 Intel Corporation
2+
#
3+
# Licensed under the Apache License, Version 2.0 (the "License");
4+
# you may not use this file except in compliance with the License.
5+
# You may obtain a copy of the License at
6+
#
7+
# http://www.apache.org/licenses/LICENSE-2.0
8+
#
9+
# Unless required by applicable law or agreed to in writing, software
10+
# distributed under the License is distributed on an "AS IS" BASIS,
11+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
# See the License for the specific language governing permissions and
13+
# limitations under the License.
14+
15+
# distutils: language = c++
16+
# cython: language_level=3
17+
18+
# SYCL static imports for Cython
19+
20+
from . cimport _backend as dpctl_backend
21+
22+
23+
cdef extern from "CL/sycl.hpp" namespace "sycl":
24+
cdef cppclass queue "sycl::queue":
25+
pass
26+
27+
cdef cppclass device "sycl::device":
28+
pass
29+
30+
cdef cppclass context "sycl::context":
31+
pass
32+
33+
cdef cppclass event "sycl::event":
34+
pass
35+
36+
cdef cppclass kernel "sycl::kernel":
37+
pass
38+
39+
cdef cppclass executable_kernel_bundle \
40+
"sycl::kernel_bundle<sycl::bundle_state::executable>":
41+
pass
42+
43+
cdef extern from "syclinterface/dpctl_sycl_type_casters.hpp" \
44+
namespace "dpctl::syclinterface":
45+
# queue
46+
cdef dpctl_backend.DPCTLSyclQueueRef wrap_queue "dpctl::syclinterface::wrap<sycl::queue>" (const queue *)
47+
cdef queue * unwrap_queue "dpctl::syclinterface::unwrap<sycl::queue>" (dpctl_backend.DPCTLSyclQueueRef)
48+
49+
# device
50+
cdef dpctl_backend.DPCTLSyclDeviceRef wrap_device "dpctl::syclinterface::wrap<sycl::device>" (const device *)
51+
cdef device * unwrap_device "dpctl::syclinterface::unwrap<sycl::device>" (dpctl_backend.DPCTLSyclDeviceRef)
52+
53+
# context
54+
cdef dpctl_backend.DPCTLSyclContextRef wrap_context "dpctl::syclinterface::wrap<sycl::context>" (const context *)
55+
cdef context * unwrap_context "dpctl::syclinterface::unwrap<sycl::context>" (dpctl_backend.DPCTLSyclContextRef)
56+
57+
# event
58+
cdef dpctl_backend.DPCTLSyclEventRef wrap_event "dpctl::syclinterface::wrap<sycl::event>" (const event *)
59+
cdef event * unwrap_event "dpctl::syclinterface::unwrap<sycl::event>" (dpctl_backend.DPCTLSyclEventRef)

0 commit comments

Comments
 (0)