Skip to content

Rename StridedMemoryView.obj to StridedMemoryView.exporting_obj #182

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 17, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions cuda_core/cuda/core/experimental/_memoryview.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ cdef class StridedMemoryView:
device_id: int = None # -1 for CPU
device_accessible: bool = None
readonly: bool = None
obj: Any = None
exporting_obj: Any = None

def __init__(self, obj=None, stream_ptr=None):
if obj is not None:
Expand All @@ -50,7 +50,7 @@ cdef class StridedMemoryView:
+ f" device_id={self.device_id},\n"
+ f" device_accessible={self.device_accessible},\n"
+ f" readonly={self.readonly},\n"
+ f" obj={get_simple_repr(self.obj)})")
+ f" exporting_obj={get_simple_repr(self.exporting_obj)})")


cdef str get_simple_repr(obj):
Expand Down Expand Up @@ -173,7 +173,7 @@ cdef StridedMemoryView view_as_dlpack(obj, stream_ptr, view=None):
buf.device_id = device_id
buf.device_accessible = device_accessible
buf.readonly = is_readonly
buf.obj = obj
buf.exporting_obj = obj

cdef const char* used_name = (
DLPACK_VERSIONED_TENSOR_USED_NAME if versioned else DLPACK_TENSOR_USED_NAME)
Expand Down Expand Up @@ -252,7 +252,7 @@ cdef StridedMemoryView view_as_cai(obj, stream_ptr, view=None):
raise BufferError("stream=None is ambiguous with view()")

cdef StridedMemoryView buf = StridedMemoryView() if view is None else view
buf.obj = obj
buf.exporting_obj = obj
buf.ptr, buf.readonly = cai_data["data"]
buf.shape = cai_data["shape"]
# TODO: this only works for built-in numeric types
Expand Down
Loading