嵌套循环中数组重用剖面的静态估计
Static Estimation of Reuse Profiles for Arrays in Nested Loops
AI总结:
本文提出一种无需运行程序的静态分析框架,通过分析循环边界和访问模式,在编译时预测嵌套循环中数组的重用距离和缓存命中率,相比传统动态工具 PARDA 在保持可比精度的同时实现数量级速度提升。
摘要:
高效的内存访问模式通过利用时间局部性和空间局部性,在决定应用程序整体性能方面起着至关重要的作用,从而最大化缓存局部性。重用距离直方图(Reuse Distance Histogram, RDH)是一种广泛使用的量化时间局部性的指标,用于测量对同一内存位置的连续访问之间的距离。传统上,计算 RDH 需要程序执行和内存轨迹收集,以获取动态内存访问行为。这种轨迹收集通常耗时、资源密集,并且不适合早期优化或大规模应用。另一方面,静态预测在估计 RDH 和缓存命中率方面提供了显著的加速。然而,这些方法缺乏准确性,因为预测是在不运行程序且不了解完整内存访问模式的情况下进行的,尤其是当数组在嵌套循环内部使用时。本文提出了一种新颖的静态分析框架,用于预测具有嵌套循环结构的程序中数组引用的重用剖面,且不需要任何运行时信息。通过分析循环边界、较小问题规模下的访问模式以及预测方程,我们的方法在编译时预测数组的访问模式,并估计重用距离和缓存命中率。本文扩展了我们之前的研究,纳入了更多分析,并通过处理以前未处理的重用模式来改进预测。我们针对一种被广泛接受的传统基于轨迹的性能分析工具——并行重用距离分析(Parallel Reuse Distance Analysis, PARDA)评估了我们的技术。结果表明,我们的静态预测器在实现可比精度的同时,在分析速度上提供了数量级的提升。这项工作为动态重用剖析提供了一种实用的替代方案,并为集成到编译器和静态性能建模工具中铺平了道路。
英文摘要:
Efficient memory access patterns play a crucial role in determining the overall performance of applications by exploiting temporal and spatial locality, thus maximizing cache locality. The Reuse Distance Histogram (RDH) is a widely used metric to quantify temporal locality, measuring the distance between consecutive accesses to the same memory location. Traditionally, calculating RDH requires program execution and memory trace collection to obtain dynamic memory access behavior. This trace collection is often time-consuming, resource-intensive, and unsuitable for early-stage optimization or large-scale applications. Static prediction, on the other hand, offers a significant speedup in estimating RDH and cache hit rates. However, these approaches lack accuracy, since the predictions come without running the program and knowing the complete memory access pattern, more specifically when arrays are used inside nested loops. This paper presents a novel static analysis framework for predicting the reuse profiles of array references in programs with nested loop structures, without requiring any runtime information. By analyzing loop bounds, access patterns in smaller problem sizes, and predictive equations, our method predicts access patterns of arrays and estimates reuse distances and cache hit rate at compile time. This paper extends our previous study by incorporating more analysis and improving prediction by addressing previously unhandled reuse patterns. We evaluate our technique against a widely accepted traditional trace-driven profiling tool, Parallel Reuse Distance Analysis (PARDA). The results demonstrate that our static predictor achieves comparable accuracy while offering orders-of-magnitude improvement in the analysis speed. This work offers a practical alternative to dynamic reuse profiling and paves the way for integration into compilers and static performance modeling tools.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。