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
test(cuda.core): expand API validation and lifecycle coverage - #3535
Expand cuda.core test coverage for API validation, failure recovery, interoperability, and resource lifecycles.
Changes
Graphs and launches: test invalid adjacency batches without partial edge updates, adjacency self-subtraction, launch-priority validation, and preservation of captured kernel priority with GPU readback.
Memory and IPC: cover null VMM deallocation, empty-buffer IPC with explicit deallocation streams, resource representations, peer-access set operations, imported event flags, and buffer deserialization without a current context.
Streams and callbacks: verify that streams remain usable after rejecting invalid events and that empty ctypes callback payloads still invoke the callback.
Compatibility and recovery: strengthen CUDA 12 SM-resource option rejection and tensor-map rank validation; cover retrying a missing object-code file, import diagnostics, and cache accounting when files are replaced or disappear.
Validation
The PR contains 24 new test functions and strengthens 7 existing functions, totaling 50 parameterized test items.
No actionable comments were generated in the recent review.
Summary
Summary by CodeRabbit
Tests
Expanded coverage for CUDA graph adjacency updates, IPC event and memory sharing, and virtual memory behavior.
Added checks for stream recording, launch priorities, host callbacks, and recovery from import and resource-handling errors.
Improved validation coverage for tensor-view interoperability, program-cache edge cases, peer access, green-context options, and tensor-map rank errors.
The pull request adds regression tests across graph operations, CUDA IPC, memory and launch APIs, package imports, program-cache races, and tensor interoperability. It also adds child-process communication helpers used by IPC tests.
Tests cover invalid batch updates for predecessor and successor proxies, valid updates after rejection, and self-subtraction while preserving unrelated edges and nodes.
Launch priority validation and graph capture cuda_core/tests/test_launcher.py
Tests cover out-of-range priorities, missing current context, and priority preservation on a captured kernel node that executes successfully.
Host callbacks and stream recording cuda_core/tests/test_host_launch.py, cuda_core/tests/test_stream.py
Tests cover an empty callback payload and confirm that a valid event can be recorded after stream.record() rejects an invalid argument.
IPC Resource Exchange
Layer / File(s)
Summary
Child-process transport and event IPC cuda_core/tests/helpers/child_processes.py, cuda_core/tests/memory_ipc/test_event_ipc.py
Timed receive and exporter helpers support tests that import IPC event descriptors, check event properties and synchronization, and verify closure signaling.
The test exchanges an IPC memory resource and pickled buffer, then checks context creation, shared contents, context restoration, and the child-process update handshake.
Tests cover exporter identity, tensor metadata, owner retention, shared storage, and mutations through NumPy, Array Interface, and DLPack paths.
PyTorch stream ordering and dtype handling cuda_core/tests/test_utils_torch.py
Tests check producer-to-consumer stream dependencies and unsupported float8 and complex-half dtype errors.
Suggested reviewers:cpcloud, andy-jost
Change: Other
Merge Risk: Minimal · up to 624c6
This change adds regression tests and test helpers without altering production behavior. The earlier concern about message-text coupling in the stream test has been fixed, so no merge-blocking risk remains.
Security architecture risk: Minimal · up to 624c6
The PR expands regression coverage for existing CUDA Core behavior without changing production interfaces, access controls, or resource ownership.
Finishing Touches
Fix failing CI checks
Create a new PR
Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Reviewing files that changed from the base of the PR and between 27a7571 and 624c6be.
Files selected for processing: 3
cuda_core/tests/test_bindings_floor.py
cuda_core/tests/test_program_cache.py
cuda_core/tests/test_stream.py
Included review availability: This review used your included allowance. Your plan provides up to 12 included reviews per hour; 10 remain after this review.
suggestion: Remove the diagnostic-text constraint.
The match argument makes this test fail if the diagnostic changes while TypeError and stream recovery remain correct. Use pytest.raises(TypeError) and retain the recovery assertions.
As per coding guidelines, “Avoid asserting on ... error message substrings that are not part of the contract.”
suggestion: Remove the exact import-probe assertions.
Line 496 fixes the metadata lookup order. Line 541 fixes the import attempt count. Both assertions can reject a refactor that preserves the required import errors. Keep the existing exception, cause, dependency-name and diagnostic assertions instead.
As per coding guidelines, “Avoid asserting on internal call counts, private helper invocation order.”
suggestion: Make the first snapshot entry disappear.
os.scandir does not guarantee entry order. If a appears last, replacing continue with break in the snapshot's FileNotFoundError handler would still leave the tracker at 200 bytes and pass this test. Control the scan order so the test always checks that eviction counts the entries after the disappearance. (docs.python.org)
suggestion: Count a surviving temp file after the disappearing file.
With one temp file, _sum_tmp_sizes can stop at FileNotFoundError instead of continuing and still return the expected zero temp bytes. Yield a second temp file after inflight and include its bytes in the expected totals. The committed survivor cannot detect this regression because startup accounts for it before scanning temp files. (raw.githubusercontent.com)
Included review availability: This review used your included allowance. Your plan provides up to 12 included reviews per hour; 11 remain after this review.
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
cuda.coreEverything related to the cuda.core module
1 participant
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.
Description
Expand cuda.core test coverage for API validation, failure recovery, interoperability, and resource lifecycles.
Changes
Validation
The PR contains 24 new test functions and strengthens 7 existing functions, totaling 50 parameterized test items.