Allocation
本阶段主要完成两个任务:寄存器重命名(register renaming)和指令分发(instruction dispatch)。前者的作用是消除由于重用寄存器导致的伪数据依赖,后者是为了预定指令执行时所需要的资源。
指令分发(instruction dispatch)阶段预定的资源包括:entries in the issue queue, the reorder buffer 和 the load/store queue。如果任何一个要求的资源未就绪,那么指令就会被阻塞。
Sometimes, these resources are partitioned into multiple units, each one associated with some particular resources, so the allocation also has a side effect of determining which resources the instruction will later use for execution. For instance, there may be a different issue queue associated with each functional unit. In this case, the allocation also determines in which functional unit the instruction will be executed
只有在乱序处理器中间才使用寄存器重命名。乱序处理器中间指令的执行顺序受制于依赖关系而不是依赖于程序顺序。依赖关系分为两种:数据依赖和名称依赖。
r1 = r2 + r3 r1 = r2 + r3 r1 = r2 + r3
r4 = r1+r5 r1 = r4 + r5 r2 = r4 + r5
Data dependence Name dependence Name dependence
Read after write Write after Write Write after read
忽然发现,连Tomasulo如何实现消除名称依赖都是不知道如何实现的了。
可以通过将数据写入到不同的位置消除寄存器重命名,但是这需要过多的存储空间,而且导致数据局部性的消失。
相对于处理整个程序的指令的名称依赖,乱序处理器只是需要实现一个更加简单的目标,那就是消除正在被处理的指令的名称依赖。由于通用的指令窗口(instruction windows)大概是一百左右,为这些指令提供存储空间是可以接受。 本章重点关注寄存器操作数的重命名,在第六章中间将会分析内存作为操作数时候的重命名。
在Tomasulo 实现的IBM 360/91中间, destination operands were renamed using the identifier of the reservation station that would produce them。这一种策略已经被现在的处理器所放弃了,因为只有当指令执行结束之后才会释放Reservation Staion。在第六章中会讲到,当代的处理器会在发射完指令之后立刻释放发射队列(在Tomasulo的命名法中叫Reservation station)项。
当代的处理器使用三种策略实现重命名策略,分别是reorder buffer, rename buffer 和 merged register file。
使用Reorder Buffer实现重命名
在这一种方案中间,寄存器的值被存储在Reorder Buffer和the architectural register file中间。The reorder buffer (ROB) stores the results of noncommitted instructions, whereas the architectural register file stores the latest committed value for each architectural register。为此需要有一个Rename Table来指明一个architectural register的最新的definition是在Reorder Buffer中间还是architectural register file中间。 为了帮助Reorder Buffer中间的操作数,rename table中间也需要包含一个字段来描述改操作数在Reorder Buffer的位置。
所以什么叫做architectural 所以为什么只有在Reorder Buffer中间需要有一个ROB pointer,但是architectural register file 中间就是不需要的
当一条指令执行的时候,该指令的结果被放置到Reoder Buffer中间,当该指令被提交的时候,结果就会被复制到architectural register file中间。这一种策略可能会导致操作数在它的生命周期中间出现在两个位置里,这让读取该操作数含有一定的困难。
此方案被Intel Core 2所使用。
Woc, 完全不知道说了些啥玩意儿啊
使用Rename Buffer实现重命名
本策略和上面的策略稍有不同。由于大约有三分之一的指令是不会写寄存器文件,使用Reoder Buffer实现重命名会浪费大约三分之一的空间。Rename Buffer的想法是to have a separate structure for the result of in-flight(也就是未提交的) instructions.
IBM Power 3使用此策略。
使用Merged Register File实现重命名
In addition, there is a register map table that stores the latest assignment (physical register identifier) for each architectural register.
已经完全不知道在说什么了,继续看前面的章节。
本站所有文章转发 CSDN 将按侵权追究法律责任,其它情况随意。