oneapi-src / oneapi-src/unified-memory-framework
Expose allocation statistics for memory provideres (and pools?)
@KFilipek is already working on this.
Since Oct 25, 2024.
- Dominant language
- C
- Stars
- 98
- Forks
- 48
- Avg merge
- 3d 20h
- Merged PRs (30d)
- 6
Description
Rationale
When debugging/profiling applications it's often useful to know how many coarse-grain and/or fine-grain allocations there were (and size of those allocations). We should add a possibility to print those stats to stdout or a log file.
Description
Must-have stats:
- number of allocs
- number of frees
- total allocated memory size
Nice-to-have stats:
- distribution of allocation sizes (histogram)
- latency of allocations (p50, p90, p99), possibly per allocation size range (predefined, or specified by the user)
Stats collection and printing should be toggled using an env variable. We might want to specify how often the stats are printed (e.g. every Nth allocation/free or only when the provider/pool is destroyed). Whenever we print stats, we should also print a timestamp (this could allow visualizing memory usage).
API Changes
New env variable.
Implementation details
The implementation can be put in memory_provider.c / memory_pool.c so that we don't have to duplicate the logic for each pool/provider.
Contributor guide
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.
Assessment
This issue has not been assessed yet.