Application profiling is an indispensable technique for many software development tasks, such as code and memory layout optimizations, where optimization decisions are tailored to specific program profiles. Unfortunately, modern application codebases exhibit highly variant behavior across different inputs, creating challenges for conventional profiling approaches that rely on a single representative 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 instances, specifically focusing on dynamic function call prediction.Such predicted call sequences are then used for producing optimized code pertinent to a given input. 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 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, and \textit{Application Profile Generalization}, which uses generative models trained on compressed and augmented \textit{Whole Program Path} (WPP) based function profiles to predict application behavior under unseen inputs. Our experiments show that \textit{Phaedrus} can achieve upto $10^7X$ reduction in WPP function profile sizes, can predict most frequently executed functions that cover upto 85-99\% of the execution time, along with an average of 13.19\% (upto 65\%) reduction in application binary size, and an average of 6.08\% (upto 20\%) performance improvement over the traditional profile-guided optimization, without any execution.
翻译:应用性能剖析是许多软件开发任务(如代码与内存布局优化)中不可或缺的技术,其中优化决策需针对特定的程序剖析结果进行定制。然而,现代应用程序代码库在不同输入下表现出高度可变的行为,这对依赖单一代表性执行实例的传统剖析方法构成了挑战。本文提出 **Phaedrus**——一种新型的**编译器辅助深度学习框架**,旨在预测不同执行实例间的动态程序行为,特别聚焦于动态函数调用预测。所预测的调用序列随后将用于生成与给定输入相关的优化代码。传统的基于剖析的优化方法难以应对现代应用程序的输入依赖性变异问题,即在不同的输入上进行剖析会导致差异显著的应用程序行为。为解决这一问题,Phaedrus 提出两种新方法:**应用行为合成**(一种无需剖析的方法,通过大型语言模型直接基于源代码与静态编译器分析推断动态函数,从而绕过传统剖析过程)以及**应用剖析泛化**(该方法使用基于压缩和增强的**全程序路径**函数剖析训练的生成模型,以预测未见输入下的应用程序行为)。实验表明,**Phaedrus** 能够实现高达 $10^7$ 倍的全程序路径函数剖析规模缩减,可预测覆盖高达 85-99% 执行时间的最频繁执行函数,同时在不执行任何程序的情况下,相比传统基于剖析的优化方法,平均减少 13.19%(最高 65%)的应用程序二进制文件大小,并获得平均 6.08%(最高 20%)的性能提升。