-
Notifications
You must be signed in to change notification settings - Fork 209
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve Cython Lifetime Management by Adding References in `DeviceBuf…
…fer` (#661) As discussed with @shwina @harrism and @kkraus14, this PR adds 2 properties to `DeviceBuffer` to allow for automatic reference counting of `MemoryResource` and `Stream` objects. This will prevent any `MemoryResource` from being destructed while any `DeviceBuffer` that needs the MR for deallocation is still alive. There are a few outstanding issues I could use input on: 1. The test `test_rmm_device_buffer` is failing due to the line: `sys.getsizeof(b) == b.size`. Need input on the best way forward. 1. This test is failing since `DeviceBuffer` is now involved in GC. Python automatically adds the GC memory overhead to `__size__` (see [here](https://github.com/python/cpython/blob/master/Python/sysmodule.c#L1701)) which makes it difficult to continue working the same way it has before. 1. Only options I can think of are: 1. Remove this check from the test or alter the "correct" value 1. Add `@cython.no_gc` which is very risky. 1. The current PR implementation includes cuda stream object reference counting but treats all `Stream` objects the same. @harrism mentioned only streams owned by RMM should be tracked this way but I am not sure if thats necessary or how to distinguish them at this point. Other than the above items, all test are passing and I ran this through the cuML test suite without any issues. Thanks for your help. Authors: - Michael Demoret (@mdemoret-nv) Approvers: - Keith Kraus (@kkraus14) URL: #661
- Loading branch information
1 parent
dc5889b
commit 230369d
Showing
5 changed files
with
58 additions
and
11 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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