arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 2606.31368cs.SE
收藏

MOA:一种基于剖析引导的LLM框架,用于代码库规模的内存优化自动化

MOA: A Profiling-Guided LLM Framework for Memory-Optimization Automation at Codebase Scale

The University of Hong Kong(香港大学)

Jiaxi Liang, Yuanxiang Shi, Zezhou Yang, Chenxiong Qian

AI总结:

提出MOA框架,通过三个智能体自动检测和修复大规模代码库中的内存低效问题,在OpenHarmony上识别13种反模式,生成769个补丁,平均堆减少42.2%。

摘要:

现代大规模软件系统常常遭受普遍的内存低效问题(例如,膨胀、抖动),导致过度的资源成本和性能下降。现有的优化工作流缺乏端到端的自动化,迫使开发人员手动将复杂的工具输出综合为可操作且保持语义的修复,阻碍了大型代码库的可扩展性。为了解决这个问题,本文提出了MOA,一个LLM驱动的框架,自动检测和修复生产规模代码库中反复出现的内存低效问题。具体来说,MOA通过三个智能体运作:一个分析器,从剖析数据中挖掘反模式;一个检查器生成器,通过模板引导的细化合成静态分析器;以及一个补丁生成器,通过状态机驱动的工作流生成优化补丁。我们在OpenHarmony(一个拥有超过1亿行C/C++代码的开源操作系统)上的评估表明,MOA从3个剖析服务中识别出13种反模式(其中9种以前未知),在更广泛的7个服务中检测到超过10,000个低效问题,并生成了769个补丁,专家接受率为92.5%,平均实现了42.2%的堆减少和10.6%的二进制大小减少。我们设想MOA成为生产规模性能工程的一个有价值的工具。

英文摘要:

Modern large-scale software systems often suffer from pervasive memory inefficiencies (e.g., bloat, churn), leading to excessive resource costs and performance degradation. Existing optimization workflows lack end-to-end automation, forcing developers to manually synthesize complex tool outputs into actionable and semantics-preserving fixes, precluding scalability in large codebases. To address this, this paper presents MOA, an LLM-driven framework that automatically detects and repairs recurring memory inefficiencies across production-scale codebases. Specifically, MOA operates through three agents: an Analyzer that mines anti-patterns from profiling data, a Checker Generator that synthesizes static analyzers through template-guided refinement, and a Patcher that generates optimization patches via state-machine-driven workflows. Our evaluation on OpenHarmony, an open-source operating system with over 100 million lines of C/C++ code, shows that MOA identifies 13 anti-patterns (9 previously unknown) from 3 profiled services, detects over 10,000 inefficiencies across a broader set of 7 services, and generates 769 patches with 92.5% expert acceptance rate, achieving 42.2% heap reduction and 10.6% binary size reduction on average. We envision MOA as a valuable tool for performance engineering at production scale.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑