Commit cb3c132
Fix is_managed reporting for pool-allocated managed memory (#1924)
* Fix is_managed reporting for pool-allocated managed memory
Pool-allocated managed memory via cuMemAllocFromPoolAsync (from a pool
created with CU_MEM_ALLOCATION_TYPE_MANAGED) does not set
CU_POINTER_ATTRIBUTE_IS_MANAGED=1. _query_memory_attrs therefore
classified the allocation as pinned host memory, causing
classify_dl_device to return kDLCUDAHost instead of kDLCUDAManaged.
CCCL's make_tma_descriptor only accepts kDLCUDA or kDLCUDAManaged, so
as_tensor_map() failed with "Device type must be kDLCUDA or
kDLCUDAManaged" on managed buffers.
Buffer.is_device_accessible / is_host_accessible already delegate to
the memory resource when one is attached. Apply the same pattern to
is_managed, and expose is_managed on the MemoryResource base
(defaulting to False) with ManagedMemoryResource overriding it to
True.
Also ignore .claude/settings.local.json in .gitignore.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* test(memory): add direct is_managed coverage for ManagedMemoryResource
The existing test_managed_buffer_dlpack_roundtrip_device_type uses a
DummyUnifiedMemoryResource backed by cuMemAllocManaged, which sets
CU_POINTER_ATTRIBUTE_IS_MANAGED and so never exercised the pool-allocated
path that surfaced the bug.
Add two targeted tests:
- test_managed_memory_resource_buffer_dlpack_device_type: allocates from
ManagedMemoryResource (cuMemAllocFromPoolAsync on a managed pool) and
asserts is_managed and kDLCUDAManaged through Buffer and view.
- test_non_managed_resources_report_not_managed: parametrized smoke test
ensuring DeviceMemoryResource and PinnedMemoryResource still report
is_managed=False so the new MemoryResource.is_managed default does not
silently misclassify non-managed resources.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* Fix Buffer.is_managed to merge driver and resource signals
Previous fix unconditionally delegated Buffer.is_managed to
_memory_resource.is_managed, which returns False for any
MemoryResource subclass that does not opt in. That broke
DummyUnifiedMemoryResource (and any user-defined MR wrapping
cuMemAllocManaged) where the driver pointer attribute correctly
reports IS_MANAGED=1 but the resource does not override is_managed.
Query the driver first; only fall back to the memory resource when
the driver does not report IS_MANAGED (the pool-allocated managed
memory path). This keeps both old-style cuMemAllocManaged buffers
and ManagedMemoryResource pool allocations correctly classified.
Also rework the regression test parametrization to skip the pinned
case when PinnedMemoryResource is unavailable (CUDA < 13.0), and pick
up the ruff-format reflow of the helper call site.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* chore: refresh pixi.lock for upstream package updates
Pick up cuda-nvrtc 13.2.78, libcufile 1.17.1.22, and other transitive
package updates from conda-forge.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>1 parent 62df918 commit cb3c132
File tree
6 files changed
+331
-175
lines changed- cuda_bindings
- cuda_core
- cuda/core/_memory
- tests
6 files changed
+331
-175
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
196 | 196 | | |
197 | 197 | | |
198 | 198 | | |
| 199 | + | |
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
391 | 391 | | |
392 | 392 | | |
393 | 393 | | |
394 | | - | |
| 394 | + | |
| 395 | + | |
| 396 | + | |
| 397 | + | |
| 398 | + | |
395 | 399 | | |
396 | 400 | | |
397 | 401 | | |
| |||
535 | 539 | | |
536 | 540 | | |
537 | 541 | | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
| 546 | + | |
538 | 547 | | |
539 | 548 | | |
540 | 549 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
121 | 121 | | |
122 | 122 | | |
123 | 123 | | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
124 | 129 | | |
125 | 130 | | |
126 | 131 | | |
| |||
0 commit comments