diff --git a/numba_cuda/numba/cuda/cudadrv/driver.py b/numba_cuda/numba/cuda/cudadrv/driver.py index 6b3d0afe9..05c73e807 100644 --- a/numba_cuda/numba/cuda/cudadrv/driver.py +++ b/numba_cuda/numba/cuda/cudadrv/driver.py @@ -2388,6 +2388,16 @@ def add_callback(self, callback, arg=None): callback will block later work in the stream and may block other callbacks from being executed. + .. warning:: + There is a potential for deadlock due to a lock ordering issue + between the GIL and the CUDA driver lock when using libraries + that call CUDA functions without releasing the GIL. This can + occur when the callback function, which holds the CUDA driver lock, + attempts to acquire the GIL while another thread that holds the GIL + is waiting for the CUDA driver lock. Consider using libraries that + properly release the GIL around CUDA operations or restructure + your code to avoid this situation. + Note: The driver function underlying this method is marked for eventual deprecation and may be replaced in a future CUDA release. @@ -2422,6 +2432,16 @@ def async_done(self) -> asyncio.futures.Future: """ Return an awaitable that resolves once all preceding stream operations are complete. The result of the awaitable is the current stream. + + .. warning:: + There is a potential for deadlock due to a lock ordering issue + between the GIL and the CUDA driver lock when using libraries + that call CUDA functions without releasing the GIL. This can + occur when the callback function (internally used by this method), + which holds the CUDA driver lock, attempts to acquire the GIL + while another thread that holds the GIL is waiting for the CUDA driver lock. + Consider using libraries that properly release the GIL around + CUDA operations or restructure your code to avoid this situation. """ loop = asyncio.get_running_loop() future = loop.create_future()