DiffTune:用学习的可微代理优化CPU模拟器参数
DiffTune: Optimizing CPU Simulator Parameters with Learned Differentiable Surrogates
摘要:
CPU模拟器是建模CPU执行行为的有用工具。然而,由于设置其细粒度参数的成本和复杂性,例如单个指令的延迟,它们遭受不准确性。这种复杂性源于设计基准和度量框架所需的专业知识,这些基准和度量框架可以在如此细的粒度上精确地度量参数的值。在某些情况下,这些参数不一定有物理实现,因此基本上是近似的,甚至是不可测量的。在本文中,我们提出了DiffTune,一个系统,用于学习的x86基本块CPU模拟器的参数,从粗粒度的端到端的测量。给定一个模拟器,DiffTune首先用一个可微的替代函数(另一个近似原始函数的函数)替换原始模拟器来学习它的参数;通过使替代函数可微,DiffTune然后能够应用基于梯度的优化技术,即使原始函数是不可微的,例如CPU模拟器的情况。有了这个可微分的替代,DiffTune然后应用基于梯度的优化来产生模拟器参数的值,这些值最小化模拟器在地面真实端到端性能测量数据集上的误差。最后,将学习的参数插回原始模拟器。DiffTune能够自动学习llvm-mca的英特尔x86仿真模型中的整套微体系结构特定参数,llvm-mca是基于LLVM指令调度模型的基本块CPU仿真器。DiffTune的学习参数导致llvm-mca的平均误差不仅匹配而且降低了其原始的专家提供的参数值。
英文摘要:
CPU simulators are useful tools for modeling CPU execution behavior. However, they suffer from inaccuracies due to the cost and complexity of setting their fine-grained parameters, such as the latencies of individual instructions. This complexity arises from the expertise required to design benchmarks and measurement frameworks that can precisely measure the values of parameters at such fine granularity. In some cases, these parameters do not necessarily have a physical realization and are therefore fundamentally approximate, or even unmeasurable. In this paper we present DiffTune, a system for learning the parameters of x86 basic block CPU simulators from coarse-grained end-to-end measurements. Given a simulator, DiffTune learns its parameters by first replacing the original simulator with a differentiable surrogate, another function that approximates the original function; by making the surrogate differentiable, DiffTune is then able to apply gradient-based optimization techniques even when the original function is non-differentiable, such as is the case with CPU simulators. With this differentiable surrogate, DiffTune then applies gradient-based optimization to produce values of the simulator's parameters that minimize the simulator's error on a dataset of ground truth end-to-end performance measurements. Finally, the learned parameters are plugged back into the original simulator. DiffTune is able to automatically learn the entire set of microarchitecture-specific parameters within the Intel x86 simulation model of llvm-mca, a basic block CPU simulator based on LLVM's instruction scheduling model. DiffTune's learned parameters lead llvm-mca to an average error that not only matches but lowers that of its original, expert-provided parameter values.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。