Skip to content

Commit 2c9d5ec

Browse files
committed
minor fixes - still failing
1 parent 3684644 commit 2c9d5ec

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

cuda_core/cuda/core/experimental/_memory.pyx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ from __future__ import annotations
66

77
cimport cpython
88
from libc.stdint cimport uintptr_t, intptr_t
9-
from libc.string cimport memset
9+
from libc.string cimport memset, memcpy
1010

1111
from cuda.bindings cimport cydriver
1212

@@ -70,7 +70,7 @@ cdef class Buffer:
7070
@classmethod
7171
def _init(cls, ptr: DevicePointerT, size_t size, mr: MemoryResource | None = None):
7272
cdef Buffer self = Buffer.__new__(cls)
73-
self._ptr = <uintptr_t>(int(ptr))
73+
self._ptr = <intptr_t>(int(ptr))
7474
self._ptr_obj = ptr
7575
self._size = size
7676
self._mr = mr
@@ -158,7 +158,7 @@ cdef class Buffer:
158158
if not mr.is_ipc_enabled:
159159
raise RuntimeError("Memory resource is not IPC-enabled")
160160
cdef cydriver.CUmemPoolPtrExportData share_data
161-
share_data.reserved = ipc_buffer._reserved
161+
memcpy(share_data.reserved, <const void*><const char*>(ipc_buffer._reserved), sizeof(share_data.reserved))
162162
cdef cydriver.CUdeviceptr ptr
163163
with nogil:
164164
HANDLE_RETURN(cydriver.cuMemPoolImportPointer(&ptr, mr._mempool_handle, &share_data))
@@ -711,7 +711,7 @@ cdef class DeviceMemoryResource(_DeviceMemoryResourceBase, MemoryResource):
711711
def __dealloc__(self):
712712
self.close()
713713

714-
def close(self):
714+
cpdef close(self):
715715
"""Close the device memory resource and destroy the associated memory pool if owned."""
716716
if self._mempool_handle == NULL:
717717
return

0 commit comments

Comments
 (0)