Skip to content

Commit 260573c

Browse files
Added public C functions to access data payload of USMMemory* objects (#541)
1 parent 58f78f5 commit 260573c

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

dpctl/memory/_memory.pyx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -706,3 +706,13 @@ def as_usm_memory(obj):
706706
"USM allocation represented by argument {}".
707707
format(obj)
708708
)
709+
710+
711+
cdef public DPCTLSyclUSMRef get_usm_pointer(_Memory obj):
712+
return obj.memory_ptr
713+
714+
cdef public DPCTLSyclContextRef get_context(_Memory obj):
715+
return obj.queue._context.get_context_ref()
716+
717+
cdef public size_t get_nbytes(_Memory obj):
718+
return <size_t>obj.nbytes

0 commit comments

Comments
 (0)