-
Notifications
You must be signed in to change notification settings - Fork 227
Allow buffers imported via IPC to be re-exported #1299
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
|
/ok to test c82c120 |
This comment has been minimized.
This comment has been minimized.
c82c120 to
b0bd08e
Compare
|
/ok to test b363790 |
rwgk
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
| self._ptr_obj = ptr | ||
| self._size = size | ||
| self._memory_resource = mr | ||
| self._ipc_data = IPCDataForBuffer(ipc_descriptor, True) if ipc_descriptor is not None else None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Optional: This would be more readable with is_mapped=True.
I'd do that systematically for all IPCDataForBuffer and IPCDataForMR calls (I think there are only four calls).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. I actually had exactly that initially but noticed that Cython passes the keyword arguments as true keywords (in a dict) -- I had hoped that it would perform some magic, since the call target is a cdef function. Within this project, it's hard to know how to trade readability off against performance.
|
Enable IPC Buffer Re-export and Add
Buffer.is_mappedPropertySummary
This PR enhances the CUDA IPC (Inter-Process Communication) functionality to support re-exporting buffers that were originally imported from another process. It also introduces a new
Buffer.is_mappedproperty to track whether a buffer was mapped into the current process via IPC.Key Changes
1. New
Buffer.is_mappedPropertyis_mappedproperty toBufferclass to indicate if a buffer was imported via IPCTruefor buffers imported viaBuffer.from_ipc_descriptor()Falsefor locally-allocated buffers2. Enable Re-export of Imported Buffers
RuntimeError("Imported memory resource cannot be exported")3. IPC Data Structure Improvements
IPCDataintoIPCDataForMR: Tracks IPC state for memory resources (allocation handle + mapped flag)IPCDataForBuffer: Tracks IPC state for individual buffers (descriptor + mapped flag)_ipc_datamember toBufferclass to track IPC-related metadata4. Enhanced Testing
TestIpcReexportvalidates the 3-process chain scenario:is_mappedassertions throughout IPC teststest_ipc_send_buffersto class-based test structureTestExportImportedMRerror test (no longer an error)