Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions numba_cuda/numba/cuda/cudadrv/driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down Expand Up @@ -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()
Expand Down