diff --git a/dpctl/sycl_core.pyx b/dpctl/sycl_core.pyx index aa0b6e354f..9b20c1dddb 100644 --- a/dpctl/sycl_core.pyx +++ b/dpctl/sycl_core.pyx @@ -105,6 +105,15 @@ cdef class SyclContext: cdef DPPLSyclContextRef get_context_ref (self): return self._ctxt_ref + def addressof_ref (self): + """Returns the address of the DPPLSyclContextRef pointer as a + long. + + Returns: + The address of the DPPLSyclContextRef object used to create this + SyclContext cast to a long. + """ + return int(self._ctx_ref) cdef class SyclDevice: ''' Wrapper class for a Sycl Device @@ -163,6 +172,15 @@ cdef class SyclDevice: ''' return self._device_ref + def addressof_ref (self): + """Returns the address of the DPPLSyclDeviceRef pointer as a + long. + + Returns: + The address of the DPPLSyclDeviceRef object used to create this + SyclDevice cast to a long. + """ + return int(self._device_ref) cdef class SyclEvent: ''' Wrapper class for a Sycl Event @@ -187,6 +205,16 @@ cdef class SyclEvent: cpdef void wait (self): DPPLEvent_Wait(self._event_ref) + def addressof_ref (self): + """Returns the address of the C API DPPLSyclEventRef pointer as + a long. + + Returns: + The address of the DPPLSyclEventRef object used to create this + SyclEvent cast to a long. + """ + return int(self._event_ref) + cdef class SyclKernel: ''' Wraps a sycl::kernel object created from an OpenCL interoperability @@ -219,6 +247,15 @@ cdef class SyclKernel: ''' return self._kernel_ref + def addressof_ref (self): + """Returns the address of the C API DPPLSyclKernelRef pointer + as a long. + + Returns: + The address of the DPPLSyclKernelRef object used to create this + SyclKernel cast to a long. + """ + return int(self._kernel_ref) cdef class SyclProgram: ''' Wraps a sycl::program object created from an OpenCL interoperability @@ -250,6 +287,16 @@ cdef class SyclProgram: name = kernel_name.encode('utf8') return DPPLProgram_HasKernel(self._program_ref, name) + def addressof_ref (self): + """Returns the address of the C API DPPLSyclProgramRef pointer + as a long. + + Returns: + The address of the DPPLSyclProgramRef object used to create this + SyclProgram cast to a long. + """ + return int(self._program_ref) + import ctypes cdef class SyclQueue: @@ -380,6 +427,16 @@ cdef class SyclQueue: cdef DPPLSyclQueueRef get_queue_ref (self): return self._queue_ref + def addressof_ref (self): + """Returns the address of the C API DPPLSyclQueueRef pointer as + a long. + + Returns: + The address of the DPPLSyclQueueRef object used to create this + SyclQueue cast to a long. + """ + return int(self._queue_ref) + cpdef SyclEvent submit (self, SyclKernel kernel, list args, list gS, \ list lS = None, list dEvents = None):