Skip to content
Merged
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -196,3 +196,4 @@ cython_debug/

# Cursor
.cursorrules
.claude/settings.local.json
82 changes: 71 additions & 11 deletions cuda_bindings/pixi.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 10 additions & 1 deletion cuda_core/cuda/core/_memory/_buffer.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,11 @@ cdef class Buffer:
def is_managed(self) -> bool:
"""Return True if this buffer is CUDA managed (unified) memory, otherwise False."""
_init_mem_attrs(self)
return self._mem_attrs.is_managed
if self._mem_attrs.is_managed:
return True
# Pool-allocated managed memory does not set CU_POINTER_ATTRIBUTE_IS_MANAGED,
# so fall back to the memory resource when it advertises managed allocations.
return self._memory_resource is not None and self._memory_resource.is_managed

@property
def is_mapped(self) -> bool:
Expand Down Expand Up @@ -535,6 +539,11 @@ cdef class MemoryResource:
"""Whether buffers allocated by this resource are host-accessible."""
raise TypeError("MemoryResource.is_host_accessible must be implemented by subclasses.")

@property
def is_managed(self) -> bool:
"""Whether buffers allocated by this resource are CUDA managed (unified) memory."""
return False

@property
def device_id(self) -> int:
"""Device ID associated with this memory resource, or -1 if not applicable."""
Expand Down
5 changes: 5 additions & 0 deletions cuda_core/cuda/core/_memory/_managed_memory_resource.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,11 @@ cdef class ManagedMemoryResource(_MemPool):
"""Return True. This memory resource provides host-accessible buffers."""
return True

@property
def is_managed(self) -> bool:
"""Return True. This memory resource provides managed (unified) memory buffers."""
return True


IF CUDA_CORE_BUILD_MAJOR >= 13:
cdef tuple _VALID_LOCATION_TYPES = ("device", "host", "host_numa")
Expand Down
Loading
Loading