Automated code instrumentation, i.e. the insertion of measurement hooks into a target application by the compiler, is an established technique for collecting reliable, fine-grained performance data. The set of functions to instrument has to be selected with care, as instrumenting every available function typically yields too large a runtime overhead, thus skewing the measurement. No "one-suits-all" selection mechanism exists, since the instrumentation decision is dependent on the measurement objective, the limit for tolerable runtime overhead and peculiarities of the target application. The Compiler-assisted Performance Instrumentation (CaPI) tool assists in creating such instrumentation configurations, by enabling the user to combine different selection mechanisms as part of a configurable selection pipeline, operating on a statically constructed whole-program call-graph. Previously, CaPI relied on a static instrumentation workflow which made the process of refining the initial selection quite cumbersome for large-scale codes, as the application had to be recompiled after each adjustment. In this work, we present new runtime-adaptable instrumentation capabilities for CaPI which do not require recompilation when instrumentation changes are made. To this end, the XRay instrumentation feature of the LLVM compiler was extended to support the instrumentation of shared dynamic objects. An XRay-compatible runtime system was added to CaPI that instruments selected functions at program start, thereby significantly reducing the required time for selection refinements. Furthermore, an interface to the TALP tool for recording parallel efficiency metrics was implemented, alongside a specialized selection module for creating suitable coarse-grained region instrumentations.
翻译:自动代码仪器化(即由编译器在目标应用中插入测量钩子)是收集可靠细粒度性能数据的成熟技术。需谨慎选择待仪器化的函数集合,因为对所有可用函数进行仪器化通常会产生过大的运行时开销,从而扭曲测量结果。由于仪器化决策取决于测量目标、可容忍运行时开销上限以及目标应用的特性,因此不存在"万能型"选择机制。编译器辅助性能仪器工具(CaPI)通过支持用户将不同选择机制组合为可配置的选择流水线(基于静态构建的全程序调用图运行),协助创建此类仪器化配置。以往CaPI依赖静态仪器化工作流,导致大型代码库中优化初始选择过程相当繁琐——每次调整后需重新编译应用程序。本研究提出CaPI的新增运行时自适应仪器化能力,当仪器化方案变更时无需重新编译。为此,我们对LLVM编译器的XRay仪器化功能进行扩展,使其支持共享动态对象的仪器化。CaPI中新增了兼容XRay的运行时系统,可在程序启动时对选定的函数进行仪器化,从而显著缩短选择优化所需时间。此外,我们还实现了与TALP工具(用于记录并行效率指标)的接口,并开发了专用选择模块以创建合适的粗粒度区域仪器化。