You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fix managed memory misclassified as kDLCUDAHost in DLPack device mapping (#1863)
* Fix managed memory incorrectly classified as kDLCUDAHost in DLPack device mapping
_smv_get_dl_device() treated all buffers that are both device- and
host-accessible as kDLCUDAHost. Managed (unified) memory is also both-
accessible, so it was misclassified. CCCL's make_tma_descriptor then
rejected the descriptor with "Device type must be kDLCUDA or
kDLCUDAManaged".
Preserve the is_managed flag already queried via
CU_POINTER_ATTRIBUTE_IS_MANAGED in _query_memory_attrs(), expose it on
Buffer, and use it in _smv_get_dl_device() to return kDLCUDAManaged for
managed memory.
Fixes: https://nvbugspro.nvidia.com/bug/6044342
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* Fix managed memory DLPack device type on buffer-side export paths
Update setup_dl_tensor_device() and Buffer.__dlpack_device__() to emit
kDLCUDAManaged for managed memory, closing the gap where the Buffer ->
DLPack capsule -> StridedMemoryView path still misclassified managed
buffers as kDLCUDAHost. Add cross-reference comments to keep the three
classification sites aligned.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* Centralize DLPack device classification into classify_dl_device()
Extract the duplicated device-type mapping logic from
Buffer.__dlpack_device__(), setup_dl_tensor_device(), and
_smv_get_dl_device() into a single classify_dl_device() function
in _dlpack.pyx. All three call sites now delegate to it.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* Remove unused DLDeviceType import from _buffer.pyx
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
* Update tests for managed memory DLPack device classification
- Fix test_buffer_dunder_dlpack_device_success to expect kDLCUDAManaged
for unified memory instead of the old buggy kDLCUDAHost.
- Fix test_buffer_dlpack_failure_clean_up error message to match the
unified classify_dl_device error.
- Add test_managed_buffer_dlpack_roundtrip_device_type to cover the
Buffer -> DLPack capsule -> StridedMemoryView end-to-end path.
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
0 commit comments