Skip to content

Commit 53fe358

Browse files
Added more public API methods for _Memory object
1 parent 0e59572 commit 53fe358

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

dpctl/memory/_memory.pyx

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -752,10 +752,28 @@ def as_usm_memory(obj):
752752

753753

754754
cdef api DPCTLSyclUSMRef get_usm_pointer(_Memory obj):
755+
"Pointer of USM allocation"
755756
return obj.memory_ptr
756757

757-
cdef api DPCTLSyclContextRef get_context(_Memory obj):
758+
cdef api DPCTLSyclContextRef get_context_ref(_Memory obj):
759+
"Context reference to which USM allocation is bound"
758760
return obj.queue._context.get_context_ref()
759761

762+
cdef api DPCTLSyclQueueRef get_queue_ref(_Memory obj):
763+
"""Queue associated with this allocation, used
764+
for copying, population, etc."""
765+
return obj.queue.get_queue_ref()
766+
760767
cdef api size_t get_nbytes(_Memory obj):
768+
"Size of the allocation in bytes."
761769
return <size_t>obj.nbytes
770+
771+
cdef api object make_Memory(
772+
DPCTLSyclUSMRef ptr,
773+
size_t nbytes,
774+
DPCTLSyclQueueRef QRef,
775+
object owner
776+
):
777+
return _Memory.create_from_usm_pointer_size_qref(
778+
ptr, nbytes, QRef, memory_owner=owner
779+
)

0 commit comments

Comments
 (0)