一句话:提出可扩展内存剖析框架 PROMPT,开发者仅需指定事件和核心逻辑即可快速构建高性能内存 profiler。
内存剖析能刻画程序动态内存行为,帮助调试、调优并支持基于推测的自动并行化等编译优化。不同场景需要不同的程序轨迹摘要,而实现实用内存 profiler 往往依赖深厚编译经验与大量优化工作。本文提出 PROMPT,一个用于快速构建内存 profiler 的可扩展框架。开发者只需指定剖析事件并定义核心剖析逻辑,无需处理自定义插桩及复杂剖析组件与优化。作者用 PROMPT 移植了两个先进内存 profiler 并保留全部功能:代码量减少超过 65%,剖析开销分别降低 5.3 倍和 7.1 倍。还为复杂编译器优化客户端构建定制工作流,以 570 行代码满足需求,开销降低超过 90%,鲁棒性优于原 profiler。
Memory profiling captures programs’ dynamic memory behavior, assisting programmers in debugging, tuning, and enabling advanced compiler optimizations like speculation-based automatic parallelization. As each use case demands its unique program trace summary, various memory profiler types have been developed. Yet, designing practical memory profilers often requires extensive compiler expertise, adeptness in program optimization, and significant implementation effort. This often results in a void where aspirations for fast and robust profilers remain unfulfilled. To bridge this gap, this paper presents PROMPT, a framework for streamlined development of fast memory profilers. With PROMPT, developers need only specify profiling events and define the core profiling logic, bypassing the complexities of custom instrumentation and intricate memory profiling components and optimizations. Two state-of-the-art memory profilers were ported with PROMPT where all features preserved. By focusing on the core profiling logic, the code was reduced by more than 65% and the profiling overhead was improved by 5.3× and 7.1× respectively. To further underscore PROMPT’s impact, a tailored memory profiling workflow was constructed for a sophisticated compiler optimization client. In 570 lines of code, this redesigned workflow satisfies the client’s memory profiling needs while achieving more than 90% reduction in profiling overhead and improved robustness compared to the original profilers.
@article{paperbot2539,
title = {PROMPT: A Fast and Extensible Memory Profiling Framework},
author = {Ziyang Xu and Yebin Chon and Yian Su and Zujun Tan and Sotiris Apostolakis and Simone Campanoni and David I. August},
journal = {Proceedings of the ACM on Programming Languages},
volume = {8},
number = {OOPSLA1},
year = {2024},
doi = {10.1145/3649827}
}