[doc-only] docs: clarify cuda.core concurrency and thread-safety policy#2318
Open
Andy-Jost wants to merge 1 commit into
Open
[doc-only] docs: clarify cuda.core concurrency and thread-safety policy#2318Andy-Jost wants to merge 1 commit into
Andy-Jost wants to merge 1 commit into
Conversation
Document the previously-implicit concurrency contract that was agreed in review threads but never written down: concurrent operations on the same cuda.core object are not guaranteed thread-safe and require external synchronization, while the library protects the integrity of its own internal state (caches, reference counting). - support.rst: user-facing "Concurrency and Thread Safety" section. - cuda_core/AGENTS.md: contributor-facing invariants (user-synchronized mutation, protecting internal cached state, GIL-held entry points, and releasing the GIL before entering the driver from callback/__del__ paths). Refs NVIDIA#1389, NVIDIA#2280, NVIDIA#350.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Documents cuda.core's concurrency and thread-safety expectations, which were previously agreed only in review threads (#2280) and never written down. Adds a user-facing policy and a contributor-facing set of invariants. Docs only; no code or behavior changes.
Changes
docs/source/support.rst: new "Concurrency and Thread Safety" section stating that concurrent operations on the same object are not guaranteed thread-safe and require external synchronization (consistent with the CUDA driver and with NumPy/CuPy/PyTorch convention), while the library protects the integrity of its own internal state. Links the tracking issue Address known thread-safety issues incuda.core#1389.cuda_core/AGENTS.md: new "Concurrency and free-threading" section capturing the invariants contributors and agents should uphold: same-object mutation is the caller's responsibility, protect internal cached/module-level state against refcount-corrupting races (critical sections/atomics/setdefault), entry points assume the GIL is held, and release the GIL before entering the driver from callback/__del__paths.Related Work
cuda.core#1389.