循环中的软件端分支预测
By-Software Branch Prediction in Loops
AI总结:
针对负载依赖分支难预测的问题,提出软件到硬件的分支预解析机制,通过编译器生成预执行代码结合循环结构提前传递分支结果,支持展开、向量化优化降开销,在相关工作负载上显著提升分支预测准确率与性能。
摘要:
负载依赖分支(Load-Dependent Branches, LDB)通常在其局部或全局历史中不呈现规律模式,因此本质上难以被传统分支预测器正确预测。我们提出一种软件到硬件的分支预解析机制,允许软件在取到分支指令之前,将分支结果传递给处理器前端。编译器遍(compiler pass)会识别通向分支的指令链(即分支反向切片),并生成预执行代码,从而在前端观测到分支结果之前就生成这些结果。循环结构有助于将分支结果与其对应的分支指令动态实例明确映射。我们的方法还支持以任意复杂的模式选择性覆盖循环迭代空间。我们的预执行方法可实现循环展开、向量化等重要优化,从而大幅降低预执行开销。在选自SPEC CPU 2017的部分工作负载以及图分析工作负载上的实验结果显示,与搭载TAGE-SC-L-64KB分支预测器的核心相比,该方法使每千条指令误预测数(MPKI)最高降低95%(平均21%),加速比最高达39%(平均7%),每周期指令数(IPC)最高提升3倍(平均23%)。
英文摘要:
Load-Dependent Branches (LDB) often do not exhibit regular patterns in their local or global history and thus are inherently hard to predict correctly by conventional branch predictors. We propose a software-to-hardware branch pre-resolution mechanism that allows software to pass branch outcomes to the processor frontend ahead of fetching the branch instruction. A compiler pass identifies the instruction chain leading to the branch (the branch backslice) and generates the pre-execute code that produces the branch outcomes ahead of the frontend observing them. The loop structure helps to unambiguously map the branch outcomes to their corresponding dynamic instances of the branch instruction. Our approach also allows for covering the loop iteration space selectively, with arbitrarily complex patterns. Our method for pre-execution enables important optimizations such as unrolling and vectorization, in order to substantially reduce the pre-execution overhead. Experimental results on select workloads from SPEC CPU 2017 and graph analytics workloads show up to 95% reduction of MPKI (21% on average), up to 39% speedup (7% on average), and up to 3x improvement on IPC (23% on average) compared to a core with TAGE-SC-L-64KB branch predictor.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。