CPU如何重新排序指令 [英] How does CPU reorder instructions

查看:160
本文介绍了CPU如何重新排序指令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我最近阅读了有关CPU指令重新排序以提高效率的信息.但是我无法理解CPU如何重新排列其指令.我的意思是编译时间重排序是可以考虑的,因为编译器可以预见即将到来的代码.但是对于一个一个接一个地读取指令的CPU,它如何看待即将到来的指令以对其重新排序

解决方案

按照程序顺序将指令提取到指令队列中.从队列中将它们解码并移到保留站.这些保留站有效地进行了重新排序:当指令的参数可用时,将指令分派给执行单元执行,并且所有参数可用的时间通常与指令队列/内存中的顺序不符.

例如,使用 Tomasulo算法,请观看以下两个视频:

问题(和注册重命名): https://youtu.be/I2qMY0XvYHA?list=PLAwxTwgi4a

发货/重新排序: https://youtu.be/bEB7sZTP8zc?list=PLAwxTwgi4a

I've recently read about CPU instruction reordering for efficiency. But I'm not able to understand how CPU reorders its instructions. I mean compile time reordering is thinkable since the compiler can foresee the upcoming code. But for a CPU which reads instruction one after the other, how does it see upcoming instructions to reorder them

Instructions are fetched in program order into an instruction queue; from the queue they are decoded and moved into reservation stations. These reservation stations effectively do the reordering: instructions are dispatched for execution to execution units as their arguments become available and the time all the arguments become available generally does not correspond to the order in the instruction queue/memory.

For an example, using the Tomasulo Algorithm, see these two videos:

Issue (and register renaming): https://youtu.be/I2qMY0XvYHA?list=PLAwxTw4SYaPkNw98-MFodLzKgi6bYGjZs

Dispatch/reordering: https://youtu.be/bEB7sZTP8zc?list=PLAwxTw4SYaPkNw98-MFodLzKgi6bYGjZs

这篇关于CPU如何重新排序指令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆