Add pickle/cloudpickle regression tests for cuda.core objects#1810
Merged
Andy-Jost merged 1 commit intoNVIDIA:mainfrom Mar 23, 2026
Merged
Add pickle/cloudpickle regression tests for cuda.core objects#1810Andy-Jost merged 1 commit intoNVIDIA:mainfrom
Andy-Jost merged 1 commit intoNVIDIA:mainfrom
Conversation
Adds parametrized roundtrip tests covering both pickle and cloudpickle for Device, ObjectCode, IPCBufferDescriptor, and IPCEventDescriptor. These tests guard against the Cython @classmethod identity issue fixed in NVIDIA#1660 (cloudpickle fails when __reduce__ references a @classmethod). Closes NVIDIA#1671 Made-with: Cursor
This comment has been minimized.
This comment has been minimized.
rwgk
approved these changes
Mar 23, 2026
| # Fixtures - IPC samples (for pickle tests) | ||
| # ============================================================================= | ||
|
|
||
| POOL_SIZE = 2097152 |
Collaborator
There was a problem hiding this comment.
Nice-to-have: a comment to explain why this value was chosen.
| "sample_ipc_event_descriptor", | ||
| ] | ||
|
|
||
| PICKLE_MODULES = ["pickle", "cloudpickle"] |
Collaborator
There was a problem hiding this comment.
git grep cloudpickle doesn't have any hits. Could we add cloudpickle to dependency-groups.test in cuda_core/pyproject.toml?
|
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
Adds parametrized pickle/cloudpickle roundtrip tests to
test_object_protocols.pyforDevice,ObjectCode,IPCBufferDescriptor, andIPCEventDescriptor. These tests guard against the Cython@classmethodidentity issue fixed in #1660 where cloudpickle fails withPicklingError: Can't pickle ... it's not the same object as ....Changes
cuda_core/tests/test_object_protocols.py:PICKLE_TYPESandPICKLE_MODULESparametrization listssample_ipc_buffer_descriptor,sample_ipc_event_descriptor) with proper skip guards viaipc_devicetest_pickle_roundtripcovering bothpickleandcloudpicklewithimportorskipfor optional cloudpickle dependencyTest Coverage
main@staticmethodfix (back to@classmethod) causes exactly 3 cloudpickle failures, confirming the tests catch the original bugCloses #1671
Made with Cursor