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.
It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.
Expanded coverage for graph adjacency updates, IPC events and shared memory, and virtual memory behavior.
Added checks for stream recording, launch priorities, host callbacks, import and module-loading recovery, and memory-resource representations.
Improved validation of tensor-view interoperability, program-cache edge cases, peer access, green-context options, tensor-map ranks, and buffer handling during stream capture.
Added PyTorch integration coverage for strided and transposed tensor views, shared data, and graph dependencies.
The pull request adds regression tests across graph, IPC, memory, launch, package-loading, program-cache, tensor-map, and tensor-interoperability behavior. It also adds child-process communication helpers for 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.
Change: Other
Merge Risk: Low · previous review 41669
This PR only adds tests. A few new assertions depend on exact error wording and on internal call counts, so a harmless later refactor could break them. Production behavior is unaffected, and the issue is a small cleanup that is safe to address before or after merge.
Security architecture risk: Minimal · up to 41669
The PR expands regression coverage without changing the shipped CUDA Core API, runtime behavior, or deployment. The new cross-process tests exchange data only with child processes they start themselves.
- [ ] Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
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.
Reviewing files that changed from the base of the PR and between 624c6be and 3c49074.
Files selected for processing: 12
cuda_core/tests/memory_ipc/test_event_ipc.py
cuda_core/tests/memory_ipc/test_serialize.py
cuda_core/tests/memory_ipc/test_vmm_ipc.py
cuda_core/tests/test_bindings_floor.py
cuda_core/tests/test_green_context.py
cuda_core/tests/test_host_launch.py
cuda_core/tests/test_memory.py
cuda_core/tests/test_memory_peer_access.py
cuda_core/tests/test_module.py
cuda_core/tests/test_program_cache.py
cuda_core/tests/test_tensor_map.py
cuda_core/tests/test_utils.py
Included review availability: This review used your included allowance. Your plan provides up to 12 included reviews per hour; 11 remain after this review.
suggestion: Assert rejection without fixing the diagnostic wording.
The match=message check couples these tests to internal error wording and CUDA version text. A diagnostic-only change would fail the tests even if rejection and resource recovery remain correct. Keep the RuntimeError assertion and the resource-state checks.
As per coding guidelines, “Avoid asserting on … error message substrings that are not part of the contract.”
suggestion: Remove the private-operation assertions.
The exception assertions already check import rejection, diagnostics, and exception chaining. Requiring probes, scans, directory_checks, and attempts also requires specific internal operations. A behavior-preserving import refactor can therefore fail these tests.
Keep the exception assertions and remove the operation counters and their assertions.
As per coding guidelines, “Avoid asserting on internal call counts, private helper invocation order.”
Reviewing files that changed from the base of the PR and between 18efdae and 416691b.
Files selected for processing: 9
cuda_core/tests/memory_ipc/test_event_ipc.py
cuda_core/tests/memory_ipc/test_serialize.py
cuda_core/tests/memory_ipc/test_vmm_ipc.py
cuda_core/tests/test_bindings_floor.py
cuda_core/tests/test_green_context.py
cuda_core/tests/test_host_launch.py
cuda_core/tests/test_memory.py
cuda_core/tests/test_program_cache.py
cuda_core/tests/test_tensor_map.py
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 moduletestImprovements or additions to tests
2 participants
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.