performance - 英特尔 CPU 指令队列提供静态分支预测?

标签 performance assembly x86 cpu-architecture branch-prediction

在英特尔手册的第 3 卷中,它包含硬件事件计数器的描述:

BACLEAR_FORCE_IQ

Counts number of times a BACLEAR was forced by the Instruction Queue. The IQ is also responsible for providing conditional branch prediction direction based on a static scheme and dynamic data provided by the L2 Branch Prediction Unit. If the conditional branch target is not found in the Target Array and the IQ predicts that the branch is taken, then the IQ will force the Branch Address Calculator to issue a BACLEAR. Each BACLEAR asserted by the BAC generates approximately an 8 cycle bubble in the instruction fetch pipeline.



我一直认为分支地址计算器执行静态预测算法(当分支目标缓冲区不包含分支条目时)?

有人可以确认以上两个中哪一个是正确的吗?我找不到任何东西。

最佳答案

If the conditional branch target is not found in the Target Array



怎么查不到?您用位掩码对其进行掩码以查找表中的索引并获取下一个分支目标。

好吧,如果您在阅读结果后检查调用地址是否与结果上的标签不匹配,那么您将获得“未接受”结果。

在这一点上,我们进入了语句的第二部分。

and the IQ predicts that the branch is taken



所以分支目标说“不采取”和智商预测它将采取我们有矛盾。

为了解决IQ获胜的矛盾,因为分支目标只是“如果我们跳,我们就跳这里”,但智商预测我们是否跳基于更多的逻辑。

因此

then the IQ will force the Branch Address Calculator to issue a BACLEAR. Each BACLEAR asserted by the BAC generates approximately an 8 cycle bubble in the instruction fetch pipeline.



这在 14-19 级管道中很好。 8 个周期是如果 IQ 可以从指令中读取实际目标地址(与 PC 结合),如果需要在寄存器中读取值(可能尚未退休),则可能需要更长的时间。

关于performance - 英特尔 CPU 指令队列提供静态分支预测?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31642902/

相关文章:

c - 了解使用 SSE 指令进行矢量化

c - 在调用传递多个参数的函数时处理进入堆栈的被调用者寄存器

ruby - 针对每一行的多个(15+)正则表达式解析文本正文的最佳方法是什么?

Swift 协议(protocol)性能

c - 如何比较映射和读取性能

assembly - 在 WinDbg 中编辑程序集

c++ - 跟踪英特尔 PIN 中的 native 指令

c++ - cmake生成汇编文件然后编译成可执行文件

c - 在制作大缓冲区时,使用 malloc 分配缓冲区是否比使用静态分配的缓冲区更快?

assembly - 如果汇编程序的 CALLed 代码块中没有 return 语句怎么办