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
{{ message }}
Repository navigation
Implement a handle-based resource management layer #1303
Implement a new handle-based resource management layer in the cuda.core Python package, replacing direct lifetime management via __del__, __dealloc__, and similar destructors with the handle abstraction described in the attached proposal. The task includes updating existing CUDA resource wrappers (e.g., contexts, streams, device pointers) to own and interact with opaque handles rather than raw CUDA resources, ensuring referentially transparent lifetimes, structural dependency tracking, and correct automatic release when handles become unreachable.
I've seen noisy tracebacks like those below many times when testing interactively.
@Andy-Jost Do you want to track working on those here, or under a separate issue?
tests/memory_ipc/test_serialize.py::TestObjectSerializationDirect::test_main Traceback (most recent call last):
File "cuda/core/experimental/_memory/_device_memory_resource.pyx", line 593, in cuda.core.experimental._memory._device_memory_resource.DMR_close
HANDLE_RETURN(cydriver.cuMemPoolDestroy(self._handle))
File "cuda/core/experimental/_utils/cuda_utils.pyx", line 63, in cuda.core.experimental._utils.cuda_utils.HANDLE_RETURN
return _check_driver_error(err)
File "cuda/core/experimental/_utils/cuda_utils.pyx", line 81, in cuda.core.experimental._utils.cuda_utils._check_driver_error
raise CUDAError(f"{name.decode()}: {expl}")
cuda.core.experimental._utils.cuda_utils.CUDAError: CUDA_ERROR_INVALID_VALUE: This indicates that one or more of the parameters passed to the API call is not within an acceptable range of values.
Exception ignored in: 'cuda.core.experimental._memory._device_memory_resource.DeviceMemoryResource.__dealloc__'
Traceback (most recent call last):
File "cuda/core/experimental/_memory/_device_memory_resource.pyx", line 593, in cuda.core.experimental._memory._device_memory_resource.DMR_close
HANDLE_RETURN(cydriver.cuMemPoolDestroy(self._handle))
File "cuda/core/experimental/_utils/cuda_utils.pyx", line 63, in cuda.core.experimental._utils.cuda_utils.HANDLE_RETURN
return _check_driver_error(err)
File "cuda/core/experimental/_utils/cuda_utils.pyx", line 81, in cuda.core.experimental._utils.cuda_utils._check_driver_error
raise CUDAError(f"{name.decode()}: {expl}")
cuda.core.experimental._utils.cuda_utils.CUDAError: CUDA_ERROR_INVALID_VALUE: This indicates that one or more of the parameters passed to the API call is not within an acceptable range of values.
PASSED
tests/memory_ipc/test_serialize.py::TestObjectSerializationWithMR::test_main Error in sys.excepthook:
Original exception was:
PASSED
tests/memory_ipc/test_serialize.py::TestObjectPassing::test_main Traceback (most recent call last):
File "cuda/core/experimental/_utils/cuda_utils.pyx", line 63, in cuda.core.experimental._utils.cuda_utils.HANDLE_RETURN
return _check_driver_error(err)
File "cuda/core/experimental/_utils/cuda_utils.pyx", line 81, in cuda.core.experimental._utils.cuda_utils._check_driver_error
raise CUDAError(f"{name.decode()}: {expl}")
cuda.core.experimental._utils.cuda_utils.CUDAError: CUDA_ERROR_INVALID_VALUE: This indicates that one or more of the parameters passed to the API call is not within an acceptable range of values.
Exception ignored in: 'cuda.core.experimental._memory._device_memory_resource.DMR_deallocate'
Traceback (most recent call last):
File "cuda/core/experimental/_utils/cuda_utils.pyx", line 63, in cuda.core.experimental._utils.cuda_utils.HANDLE_RETURN
return _check_driver_error(err)
File "cuda/core/experimental/_utils/cuda_utils.pyx", line 81, in cuda.core.experimental._utils.cuda_utils._check_driver_error
raise CUDAError(f"{name.decode()}: {expl}")
cuda.core.experimental._utils.cuda_utils.CUDAError: CUDA_ERROR_INVALID_VALUE: This indicates that one or more of the parameters passed to the API call is not within an acceptable range of values.
Traceback (most recent call last):
File "cuda/core/experimental/_utils/cuda_utils.pyx", line 63, in cuda.core.experimental._utils.cuda_utils.HANDLE_RETURN
return _check_driver_error(err)
File "cuda/core/experimental/_utils/cuda_utils.pyx", line 81, in cuda.core.experimental._utils.cuda_utils._check_driver_error
raise CUDAError(f"{name.decode()}: {expl}")
cuda.core.experimental._utils.cuda_utils.CUDAError: CUDA_ERROR_INVALID_VALUE: This indicates that one or more of the parameters passed to the API call is not within an acceptable range of values.
Exception ignored in: 'cuda.core.experimental._memory._device_memory_resource.DMR_deallocate'
Traceback (most recent call last):
File "cuda/core/experimental/_utils/cuda_utils.pyx", line 63, in cuda.core.experimental._utils.cuda_utils.HANDLE_RETURN
return _check_driver_error(err)
File "cuda/core/experimental/_utils/cuda_utils.pyx", line 81, in cuda.core.experimental._utils.cuda_utils._check_driver_error
raise CUDAError(f"{name.decode()}: {expl}")
cuda.core.experimental._utils.cuda_utils.CUDAError: CUDA_ERROR_INVALID_VALUE: This indicates that one or more of the parameters passed to the API call is not within an acceptable range of values.
Error in sys.excepthook:
Original exception was:
PASSED
Hi @rwgk, yes it would be helpful to track these noisy tracebacks here. If we have instances that can be reliably reproduced, then they will help. This work is intended to fix those problems.
Activity
rwgk commentedon Dec 5, 2025
I've seen noisy tracebacks like those below many times when testing interactively.
@Andy-Jost Do you want to track working on those here, or under a separate issue?
rwgk commentedon Dec 5, 2025
FWIW — Interestingly, the
__dealloc__tracebacks do not show up in our CI logs. I looked a couple weeks ago, and now again.I really wonder what's different in the interactive tests.
Details:
Using the log archive from this run:
(no output)
Andy-Jost commentedon Dec 5, 2025
Hi @rwgk, yes it would be helpful to track these noisy tracebacks here. If we have instances that can be reliably reproduced, then they will help. This work is intended to fix those problems.
Andy-Jost commentedon Dec 5, 2025
In some cases when running under pytest, the
-sswitch is needed for__dealloc__problems to surface.rwgk commentedon Dec 5, 2025
Oh, that's probably it!
In the QA testing I always use
pytest -ra -s -v