运行时文件配置与相位迁移检测的硬软件协同技巧
Hardware-Software Collaborative Techniques for Runtime Profiling andPhase Transition Detection
-
摘要: 对于像 Itanium 这样 EPIC 处理器来说,编译器需要一些关于用户程序的了解才能生成更加高效的代码。静态编译器是通过用其训练数据对该程序进行文件配置来获得这种信息的。人们越来越把兴趣放到了运行时用实际输入数据进行文件配置和优化上。这样,这个程序就可以在运行时进行再优化,以适应“阶段”的改变。这种“运行时的剖析和优化”环境需要高效收集程序的文件配置信息。最常见的文件配置信息是块 / 边和路径文件配置信息。最著名的边和路径文件配置算法在文后的文献 4 , 5 中有介绍。 然而,用户程序中的工具( instrumented )代码一般会带来约 30% 的块 / 边文件配置开销和 40% 的路径文件配置开销。我们对于 Itanium 处理器的经验表明,对于 SPECint95 来说,块文件配置的开销从 14%~42% 不等。在动态优化的情况下,这种开销在执行一个用户程序的过程中是不能令人接受的。 最新的研究集中在了基于采样的文件配置上,以减少文件配置的开销。基于采样的文件配置很可能会损失文件配置信息的准确性。它还会带来因软件中断而造成的明显的运行时开销。我们对能够在无明显运行时开销情况下获得准确文件配置信息的方法感兴趣。 动态优化依赖于运行时的文件配置信息来提高程序执行的性能。传统的文件配置技巧会造成明显的开销,而且不适合于动态优化。 在这里,我们提出一个方法,它能够结合软硬件的支持来大大减小文件配置的开销并检测阶段迁移。我们首先把重点放在块文件配置上,即找到基本块在用户程序的执行频度,再把这一技巧扩展到边文件配置和阶段迁移的检测上。为了获得块文件配置信息,传统的块文件配置技巧会向每以个需要文件配置的块插入一个 load 、一个 increment 和一个 store 。 我们在本文中提出的新的文件配置技巧可以把软硬件的能力集成,实现近似零开销的文件配置。编译器把文件配置请求作为分枝指令中的几位信息传递给硬件,处理器在可用的空闲槽或指定的硬件上异步地执行文件配置操作。我们利用一个 Itanium research 编译器来实现这一技巧的编译器工具化。 我们的结果证明,就程序调度周期而言,准确的块文件配置对用户的程序造成的开销极小。例如, SPECint95 基准测试程序的平均开销为 0.6% 。这种新的文件配置所要求的硬件支持是非常实际的。我们还扩展了该技巧来收集用于连续相位迁移检测的边配置文件。我们相信,对于 EPIC 处理器(如安腾处理器)而言,我们的硬软件协同方案将能使许多配置文件驱动的动态优化得以实现。Abstract: Dynamic optimization relies on runtime profile information to improvethe performance of program execution. Traditional profiling techniquesincur significant overhead and are not suitable for dynamicoptimization. In this paper, a new profiling technique is proposed, thatincorporates the strength of both software and hardware to achievenear-zero overhead profiling. The compiler passes profiling requests asa few bits of information in branch instructions to the hardware, andthe processor executes profiling operations asynchronously in availablefree slots or on dedicated hardware. The compiler instrumentation ofthis technique is implemented using an Itanium research compiler.The result shows that the accurate block profiling incurs very littleoverhead to the user program in terms of the program scheduling cycles.For example, the average overhead is 0.6% for the SPECint95 benchmarks.The hardware support required for the new profiling is practical.The technique is extended to collect edge profiles for continuous phasetransition detection. It is believed that the hardware-softwarecollaborative scheme will enable many profile-driven dynamicoptimizations for EPIC processors such as the Itanium processors.