From 235b62303682c590d211d95c9c73100c54f784c0 Mon Sep 17 00:00:00 2001 From: Oleksandr Pavlyk Date: Fri, 13 Nov 2020 14:20:40 -0600 Subject: [PATCH] Add _Memory.get_pointer_type static method --- dpctl/memory/_memory.pxd | 2 ++ dpctl/memory/_memory.pyx | 8 ++++++++ 2 files changed, 10 insertions(+) diff --git a/dpctl/memory/_memory.pxd b/dpctl/memory/_memory.pxd index b475627800..231b2a9c18 100644 --- a/dpctl/memory/_memory.pxd +++ b/dpctl/memory/_memory.pxd @@ -45,6 +45,8 @@ cdef class _Memory: @staticmethod cdef SyclDevice get_pointer_device(DPPLSyclUSMRef p, SyclContext ctx) + @staticmethod + cdef bytes get_pointer_type(DPPLSyclUSMRef p, SyclContext ctx) cdef class MemoryUSMShared(_Memory): diff --git a/dpctl/memory/_memory.pyx b/dpctl/memory/_memory.pyx index d985b519d7..a5d82171f7 100644 --- a/dpctl/memory/_memory.pyx +++ b/dpctl/memory/_memory.pyx @@ -429,10 +429,18 @@ cdef class _Memory: @staticmethod cdef SyclDevice get_pointer_device(DPPLSyclUSMRef p, SyclContext ctx): + """Returns sycl device used to allocate given pointer `p` in given sycl context `ctx`""" cdef DPPLSyclDeviceRef dref = DPPLUSM_GetPointerDevice(p, ctx.get_context_ref()) return SyclDevice._create(dref) + @staticmethod + cdef bytes get_pointer_type(DPPLSyclUSMRef p, SyclContext ctx): + """Returns USM-type of given pointer `p` in given sycl context `ctx`""" + cdef const char * usm_type = DPPLUSM_GetPointerType(p, ctx.get_context_ref()) + + return usm_type + cdef class MemoryUSMShared(_Memory): """