一句话:提出首个可扩展的解析式缓存模型,通过分块计算避免 Presburger 求解器最坏复杂度,将大型仿射程序分析从数小时降至秒级。
编译器常用无噪声的性能模型指导优化,其中缓存缺失率估计可服务于超优化、最坏执行时间分析与手工调优。然而已有面向仿射程序的解析缓存模型只能处理 PolyBench 级别的小程序:它们把整个程序交给 Presburger 求解器,在庞大的公式上执行昂贵运算,因而无法扩展到代码行数高出几个数量级的生产级程序。Falcon 将缓存分析计算拆分为互不触发求解器最坏渐进行为的小块,并有效利用并行。作者在 46 个 TorchVision 神经网络上评估:Falcon 的几何平均运行时间为 44.9 秒,而此前最先进的模型超过 32 分钟,并在 54% 的网络上触及四小时上限;Falcon 最多 3 分 3 秒即可完成。其在 16 核上的运行比单线程快 8.2 倍;对程序做局部修改后,平均仅需 513 毫秒(几何平均)即可增量更新预测。
Compilers often use performance models to decide how to optimize code. This is often preferred over using hardware performance measurements, since hardware measurements can be expensive, limited by hardware availability, and makes the output of compilation non-deterministic. Analytical models, on the other hand, serve as efficient and noise-free performance indicators. Since many optimizations focus on improving memory performance, memory cache miss rate estimations can serve as an effective and noise-free performance indicator for superoptimizers, worst-case execution time analyses, manual program optimization, and many other performance-focused use cases. Existing methods to model the cache behavior of affine programs work on small programs such as those in the Polybench benchmark but do not scale to the larger programs we would like to optimize in production, which can be orders of magnitude bigger by lines of code. These analytical approaches hand off the whole program to a Presburger solver and perform expensive mathematical operations on the huge resulting formulas. We develop a scalable cache model for affine programs that splits the computation into smaller pieces that do not trigger the worst-case asymptotic behavior of these solvers. We evaluate our approach on 46 TorchVision neural networks, finding that our model has a geomean runtime of 44.9 seconds compared to over 32 minutes for the state-of-the-art prior cache model, and the latter is actually smaller than the true value because the prior model reached our four-hour time limit on 54% of the networks, and this limit was never reached by our tool. Our model exploits parallelism effectively: running it on sixteen cores is 8.2x faster than running it single-threaded. While the state-of-the-art model takes over four hours to analyze a majority of the benchmark programs, Falcon produces results in at most 3 minutes and 3 seconds; moreover, after a local modification to the program being analyzed, our model efficiently updates the predictions in 513 ms on average (geomean). Thus, we provide the first scalable analytical cache model. CCS Concepts: • Software and its engineering → Compilers .
@article{PitchanathanGG24,
title = {Falcon: A Scalable Analytical Cache Model},
author = {Arjun Pitchanathan and Kunwar Grover and Tobias Grosser},
journal = {Proceedings of the ACM on Programming Languages},
volume = {8},
number = {PLDI},
year = {2024},
doi = {10.1145/3656452}
}