Skip to content

4.1 Dynamic Scheduling

Method: out-of-order execution

alt text

  • 部件空闲,才可以进入 IS 段
  • 没有 Data harzard,才可以进入 RO 段
  • 写后读冲突不能 WB

Q_j, Q_k: 操作数正被哪个部件占用

R_j, R_k:

  • "yes" - 操作数 ready 但是 not read
  • "no" & "Q_j == null" - 操作数 is read
  • "no" & "Q_j != null" - 操作数 not ready
name busy Op F_i F_j F_k Q_j Q_k R_j R_k
Integer no
Mult1 yes MUL F0 F2 F4 no no
Mult2 no
Add yes ADD F6 F8 F2 no no
Divide yes DIV F10 F0 F6 Mult1 no yes

问题 - 写后读只能检测,没有处理

Tomasulo's Approach

  • 保留栈没有全满 - 可以进入流水线(进行重命名)
  • 操作数 ready 后,可以执行
  • 当写回时,具体的值会替换掉对应的命名
  • 可以在写 CBD 的同时替换

问题 - load store 同一个地址会有冲突

alt text

填表确实不太会填,要好好看看


Hardware-Based Speculation

commit 顺序与流入顺序相同

前面与托马斯洛算法相同(替换还是在 WB 阶段,而不是 commit)

当前面的指令都 commit,才能 commit

alt text

4.3 Exploiting ILP Using Multiple Issue and Static Scheduling

alt text

多流出

超长指令字 - 在 EX 段拆成多条指令并行

超流水 - 每 \(\Delta t\) 时间流入一条指令(相当于十级流水线

Cache 安全专题

Cache 侧信道攻击

Meltdown

乱序执行

  • Cache 访问过的数据,再次访问时间短
  • Cache 没访问过的数据,访问时间长

根据时间差,可以判断 Cache 里放的什么

Spectre

分支预测执行需要的数据已经放在了 Cache 中

缓解措施:限制预测,降低性能