Python/Cython wrappers for SYCL runtime objects: Device, Queue, Context, Event, Platform.
| File | Purpose |
|---|---|
_sycl_device.pyx |
SyclDevice wrapping sycl::device |
_sycl_queue.pyx |
SyclQueue wrapping sycl::queue |
_sycl_context.pyx |
SyclContext wrapping sycl::context |
_sycl_event.pyx |
SyclEvent wrapping sycl::event |
_sycl_platform.pyx |
SyclPlatform wrapping sycl::platform |
_sycl_device_factory.pyx |
Device enumeration and selection |
_sycl_queue_manager.pyx |
Queue management utilities |
_backend.pxd |
C API declarations from libsyclinterface |
enum_types.py |
Python enums for SYCL types |
# distutils: language = c++
# cython: language_level=3
# cython: linetrace=Truecdef class SyclDevice:
cdef DPCTLSyclDeviceRef _device_ref # C reference
def __dealloc__(self):
if self._device_ref is not NULL:
DPCTLDevice_Delete(self._device_ref)
cdef DPCTLSyclDeviceRef get_device_ref(self):
return self._device_ref- Store C references as
_*_refattributes - Always clean up in
__dealloc__with NULL check - Use
with nogil:for blocking C calls - Check NULL before using C API returns
SyclDeviceCreationErrorSyclQueueCreationErrorSyclContextCreationError
# cimport - C-level declarations (compile-time)
from ._backend cimport DPCTLSyclDeviceRef, DPCTLDevice_Create
# import - Python-level (runtime)
from . import _device_selection