JuliaData / JuliaData/MemPool.jl
Add data pinning
Nobody has claimed this yet.
- Dominant language
- Julia
- Stars
- 25
- Forks
- 16
- Avg merge
- 4h 56m
- Merged PRs (30d)
- 1
Description
The API that poolget provides, while simple, is unfortunately harmful to swap-to-disk and related use cases, as it does not indicate when the returned data is no longer in use. In a sense, this is by design - Dagger does not know whether values returned by poolget escape via user code, and how long their lifetime might be, so it cannot reasonably assert that the data is no longer being accessed at some point in time.
However, we should not be forced to live without such guarantees, as it makes any improvements to the storage system questionably beneficial. Thankfully, with the advent of improved escape analysis in Julia's compiler, it should be possible for Dagger to sometimes determine the lifetime of a piece of data, and so communicate this information to MemPool. The form of this will result in at least one new public "unpin", function, which will pair with either poolget or a new "pin" function, to assert the end of the returned value's lifetime. At the point when memory is fully unpinned, MemPool will be free to take aggressive steps to delete the data and free up memory, instead of just hoping that the GC will do a good job. Of course, not all accesses may have known lifetime, so we'll need to allow such calls to disable pinning and revert back to GC-managed deallocation.
This mechanism can be beneficial for any kind of data which can be explicitly deleted, such as GPU arrays, or another user-defined type with an available memory free function.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by understanding the existing poolget API and how MemPool currently relies on GC-managed deallocation. Define the public pin/unpin behavior, including a way to opt out when lifetimes are unknown, and determine how explicit unpinning should enable freeing data such as GPU arrays; the issue does not name specific files or tests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- julia
- Domain
- databases, performance
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100