Application profiling is an indispensable technique for many software development tasks, such as code optimization and memory management, where optimization decisions are tailored to specific program profiles. Unfortunately, modern applications codebases exhibit highly variant behavior across different inputs, creating challenges for conventional profiling approaches that rely on a single execution instance. In this paper, we propose \textbf{Phaedrus}, a new \textit{compiler-assisted deep learning framework} designed to predict dynamic program behaviors across varied execution scenarios, specifically focusing on dynamic function call prediction. Traditional profile-guided optimization methods struggle with the input-dependent variability of modern applications, where profiling on different inputs yields divergent application behaviors. To address this, Phaedrus proposes two new approaches: \textit{Application Profile Generalization}, which uses generative models trained on compressed and augmented \textit{Whole Program Path} (WPP) profiles to predict application behavior under unseen inputs, and \textit{Application Behavior Synthesis}, a profile-less approach where Large Language Models (LLMs) directly infer dynamic functions based on source code \& static compiler analysis, bypassing the need for traditional profiling. Our experiments show that \textit{Phaedrus} can achieve upto $10^7X$ reduction in WPP profile sizes, can predict dynamic hot functions that cover upto 85-99\% of the execution time, along with an average of \textbf{13.46\%} (upto \textbf{65\%}) reduction in application binary size reduction, without profiles.
翻译:应用性能剖析是众多软件开发任务(如代码优化与内存管理)中不可或缺的技术,其中优化决策需针对特定程序剖析结果进行定制。然而,现代应用程序代码库在不同输入下表现出高度可变的行为,这对依赖单一执行实例的传统剖析方法构成了挑战。本文提出 \textbf{Phaedrus}——一种新型的\textit{编译器辅助深度学习框架},旨在预测多样化执行场景下的动态程序行为,特别聚焦于动态函数调用预测。传统的基于剖析的优化方法难以应对现代应用程序的输入依赖性变异问题,即在不同输入下进行剖析会得到截然不同的应用行为。为解决此问题,Phaedrus 提出两种创新方法:\textit{应用剖析泛化}(通过基于压缩与增强的\textit{全程序路径}(WPP)剖析数据训练的生成模型,预测未见输入下的应用行为)与\textit{应用行为合成}(一种无需剖析的方法,利用大语言模型(LLMs)直接基于源代码与静态编译器分析推断动态函数,绕过了传统剖析需求)。实验表明,\textit{Phaedrus} 可实现高达 $10^7$ 倍的 WPP 剖析数据规模压缩,预测的动态热点函数可覆盖高达 85-99\% 的执行时间,并在无需剖析的情况下实现平均 \textbf{13.46\%}(最高 \textbf{65\%})的应用程序二进制文件体积缩减。