Skip to content
Open
Changes from 1 commit
Commits
Show all changes
63 commits
Select commit Hold shift + click to select a range
abdec47
wip
rparolin Mar 17, 2026
c418050
wip
rparolin Mar 17, 2026
b879fa5
fixing ci compiler errors
rparolin Mar 17, 2026
04ee3de
skipping tests that aren't supported
rparolin Mar 17, 2026
9ab3f46
cu12 support
rparolin Mar 17, 2026
bd75bc3
Merge branch 'main' into rparolin/managed_mem_advise_prefetch
rparolin Mar 17, 2026
1b1343b
Merge branch 'main' into rparolin/managed_mem_advise_prefetch
rparolin Mar 17, 2026
a948066
Moving to function from Buffer class methods to free standing functio…
rparolin Mar 17, 2026
1457599
precommit format
rparolin Mar 17, 2026
acb4024
iterating on implementation
rparolin Mar 18, 2026
d10ab07
Simplify managed-memory helpers: remove long-form aliases, cache look…
rparolin Mar 18, 2026
ae1de36
Merge branch 'main' into rparolin/managed_mem_advise_prefetch
rparolin Mar 18, 2026
c250c92
fix(test): reset _V2_BINDINGS cache so legacy-signature tests take th…
rparolin Mar 18, 2026
89329d9
fix(test): require concurrent_managed_access for advise tests that hi…
rparolin Mar 18, 2026
8a75d1b
fix: validate managed buffer before checking discard_prefetch binding…
rparolin Mar 18, 2026
9e9b1e0
refactor: extract managed memory ops into dedicated _managed_memory_o…
rparolin Mar 18, 2026
90f0711
pre-commit fix
rparolin Mar 18, 2026
b4d252c
Removing blank file
rparolin Mar 19, 2026
faaa1d8
wip
rparolin Mar 19, 2026
18786be
Merge branch 'main' into rparolin/managed_mem_advise_prefetch
rparolin Apr 6, 2026
9766ddc
Merge remote-tracking branch 'upstream/main' into rparolin/managed_me…
rparolin Apr 27, 2026
cf2f20d
fix(cuda.core): update binding_version import after upstream merge
rparolin Apr 27, 2026
db3bac2
revert: drop managed_memory shim in cuda.core.experimental
rparolin Apr 27, 2026
20d036e
feat(cuda.core): add Location dataclass for managed memory
rparolin Apr 27, 2026
c2dae53
feat(cuda.core): add _coerce_location helper
rparolin Apr 28, 2026
935c8ba
test(cuda.core): update monkeypatch target after binding_version rename
rparolin Apr 28, 2026
dc46535
refactor(cuda.core): tighten memory-attr query
rparolin Apr 28, 2026
818f5d2
feat(cuda.core): unified 1..N managed_memory.prefetch with cydriver
rparolin Apr 28, 2026
e296e72
feat(cuda.core): add managed_memory.discard
rparolin Apr 28, 2026
e697131
feat(cuda.core): unified 1..N managed_memory.discard_prefetch with cy…
rparolin Apr 28, 2026
3bc1021
feat(cuda.core): unified 1..N managed_memory.advise + drop legacy app…
rparolin Apr 28, 2026
fa23869
refactor(cuda.core): use Buffer.is_managed property in managed_memory…
rparolin Apr 28, 2026
68bdd14
docs(cuda.core): document Location, discard, and 1..N managed_memory ops
rparolin Apr 28, 2026
b4d9cbf
chore(cuda.core): drop narrative comments and tighten _coerce_locatio…
rparolin Apr 28, 2026
ee96758
chore(cuda.core): satisfy pre-commit hooks
rparolin Apr 28, 2026
d6f60f2
refactor(cuda.core): move managed_memory ops to cuda.core.utils
rparolin Apr 28, 2026
3176271
chore(cuda.core): use __all__ in utils instead of per-import noqa
rparolin Apr 28, 2026
782f6a9
chore(cuda.core): collapse nested if in Location.__post_init__ (SIM102)
rparolin Apr 28, 2026
0789bf6
test(cuda.core): share one DummyUnifiedMemoryResource per batched test
rparolin Apr 28, 2026
e0c782a
test(cuda.core): query all buffers before closing in test_batched_sam…
rparolin Apr 28, 2026
10de998
review(cuda.core): address PR #1775 feedback
rparolin Apr 30, 2026
ab9a3ab
test(cuda.core): split managed-memory ops tests into tests/memory/
rparolin Apr 30, 2026
a3f342f
test(cuda.core): fix options regex for AdviseOptions ("an" vs "a")
rparolin Apr 30, 2026
c2a9662
chore(cuda.core): drop unused utils import + trailing blank lines
rparolin Apr 30, 2026
bede674
feat(cuda.core): add ManagedBuffer subclass + Host location
rparolin Apr 30, 2026
f59af4e
chore(cuda.core): simplify ManagedBuffer per /simplify review
rparolin Apr 30, 2026
5147a7d
ci: re-trigger CI (transient cuInit INVALID_DEVICE on l4 runner)
rparolin Apr 30, 2026
2151e61
refactor(cuda.core): use libcpp.vector for batched-op C arrays (R14)
rparolin May 1, 2026
5c6d054
fix(cuda.core): restore CUDA_ERROR_NOT_INITIALIZED auto-init in _quer…
rparolin May 1, 2026
47d5609
refactor(cuda.core): make Host a plain class instead of a dataclass (R1)
rparolin May 1, 2026
a40bb81
feat(cuda.core)!: drop int location shorthand from managed-memory ops…
rparolin May 1, 2026
c43e81e
docs(cuda.core): add AccessedBySet to api_private.rst (R5)
rparolin May 1, 2026
71e9daa
docs(cuda.core): note the legacy NUMA round-trip limitation on prefer…
rparolin May 1, 2026
df928a0
refactor(cuda.core): use collections.abc.Sequence for input checks (R…
rparolin May 1, 2026
f522916
refactor(cuda.core): narrow Buffer.from_handle to Buffer-only (R3)
rparolin May 1, 2026
6204c57
refactor(cuda.core): single API surface per operation (R9, R10, R11)
rparolin May 1, 2026
36012fd
refactor(cuda.core): build advise reverse-lookup eagerly at module lo…
rparolin May 1, 2026
067fb15
refactor(cuda.core): factor shared body of _do_batch_{prefetch,discar…
rparolin May 1, 2026
a9cd713
test(cuda.core): reuse production _get_int_attr in managed-memory tes…
rparolin May 1, 2026
d75a7bd
feat(cuda.core): cu12 fallback for prefetch_batch (N3)
rparolin May 1, 2026
0af5bd4
test(cuda.core): cover AccessedBySet read methods (N7)
rparolin May 1, 2026
b0d1a21
feat(cuda.core): cu13 NUMA round-trip for ManagedBuffer.preferred_loc…
rparolin May 1, 2026
4c228eb
docs(cuda.core): replace stale utils autosummary entries
rparolin May 1, 2026
File filter

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
refactor(cuda.core): tighten memory-attr query
Address review feedback on _buffer.pyx:

- Restore `inline` on `_init_mem_attrs` and `_query_memory_attrs`.
- Set `out.is_managed = (is_managed != 0)` once outside the if/elif,
  rather than per-branch (driver leaves the attribute zero for
  non-managed pointers, so all three branches converged on the same
  value anyway).
- Add a TODO noting that HMM/ATS-enabled sysmem should also report
  `is_managed=True`; the CU_POINTER_ATTRIBUTE_IS_MANAGED query does
  not capture that yet.

The Cython modernization of _managed_memory_ops.pyx (cimport cydriver,
IF/ELSE for the 12/13 ABI split) is folded into Tasks 5-8 where the
public API is being rewritten anyway; doing it here would mean
rewriting the same call sites twice.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
  • Loading branch information
rparolin and claude committed Apr 28, 2026
commit dc4653513bc04d1ce1fe1214630fdf628f13ef8a
11 changes: 6 additions & 5 deletions cuda_core/cuda/core/_memory/_buffer.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -422,14 +422,14 @@ cdef class Buffer:

# Memory Attribute Query Helpers
# ------------------------------
cdef void _init_mem_attrs(Buffer self):
cdef inline void _init_mem_attrs(Buffer self):
"""Initialize memory attributes by querying the pointer."""
if not self._mem_attrs_inited:
_query_memory_attrs(self._mem_attrs, as_cu(self._h_ptr))
self._mem_attrs_inited = True


cdef int _query_memory_attrs(
cdef inline int _query_memory_attrs(
_MemAttrs& out,
cydriver.CUdeviceptr ptr
) except -1 nogil:
Expand All @@ -456,12 +456,15 @@ cdef int _query_memory_attrs(
ret = cydriver.cuPointerGetAttributes(3, attrs, <void**>vals, ptr)
HANDLE_RETURN(ret)

Comment thread
rparolin marked this conversation as resolved.
# TODO: HMM/ATS-enabled sysmem should also report is_managed=True; the
# CU_POINTER_ATTRIBUTE_IS_MANAGED query does not capture that yet.
out.is_managed = is_managed != 0

if memory_type == 0:
# unregistered host pointer
out.is_host_accessible = True
out.is_device_accessible = False
out.device_id = -1
out.is_managed = False
elif (
is_managed
or memory_type == cydriver.CUmemorytype.CU_MEMORYTYPE_HOST
Expand All @@ -470,12 +473,10 @@ cdef int _query_memory_attrs(
out.is_host_accessible = True
out.is_device_accessible = True
out.device_id = device_id
out.is_managed = is_managed != 0
elif memory_type == cydriver.CUmemorytype.CU_MEMORYTYPE_DEVICE:
out.is_host_accessible = False
out.is_device_accessible = True
out.device_id = device_id
out.is_managed = False
else:
with cython.gil:
raise ValueError(f"Unsupported memory type: {memory_type}")
Expand Down