Docsity

Hardware Buffering-Advance Computer Architecture-Lecture Slides, Slides of Advanced Computer Architecture

Partial preview of the text

Download Hardware Buffering-Advance Computer Architecture-Lecture Slides and more Slides Advanced Computer Architecture in PDF only on Docsity!

Method: 4 Hardware Buffering

  1. What branch action (Taken / not- taken) is assumed by the compiler? - The compiler accomplishes this by using either of the following two approaches:

Method: 4 Hardware Buffering

– For single branch

only 1 bit is used to tell

whether the speculated

instruction has come from the

branch taken or not-taken path

Method: 4 Hardware Buffering

  1. The instructions marked as speculative are placed in the re- order buffer
  2. The re-order buffer tracks when instructions are ready to commit and delays the “Write - back”

Method: 4 Hardware Buffering

  1. The speculative instructions are not allowed to commit until:
    • Either the branches have been speculatively moved and are ready to commit;
    • Or corresponding sentinel is reached

Memory Reference Speculation

With so much discussion in respect of preserve exception behavior of speculated instructions using hardware support, let us extend our discussion on the compile time hardware support for memory reference speculation

H/W support for Memory Disambiguation (Address Certainty)

While reducing the critical path length of the code, i.e., to optimize codes, it may be desirable to move the LOAD(s) across STORE(s) For example, in the following code segment if the latency of LOAD is high, it may be desirable to move LOAD before STORE

H/W support for Memory Disambiguation (Address Certainty)

For example, in the following code segment; if the latency of LOAD is high, it may be desirable to move LOAD before STORE for desirable optimization

H/W support for Memory Disambiguation (Address Certainty)

..... SD R1, 0(R2) LD R3, 0(R4) ADD R3, R3, # ……

LD R3, 0(R4) ..... SD R1, 0(R2) ADD R3, R3, # ……

H/W support for Memory Disambiguation (Address Certainty)

This issue can be resolved by providing rum-time memory address (certainty) disambiguation In order to resolve this issue, two special instructions are included in the ISA These instructions are …..

H/W support for Memory Disambiguation

LDS R1, 0(R2) ;Load Speculatively

  • This instruction initiates a load a normal load instruction
  • A log entry is made in a table to store the memory location ..... SD R1, 0(R2) LD R3, 0(R4) ADD R3, R3, #

LD R3, 0(R4) ..... SD R1, 0(R2) ADD R3, R3, #

H/W support for Memory Disambiguation

Here, LOAD is speculatively moved across the STORE, and The LDV instruction is left at the original place of LOAD instruction (i.e., after the STORE instruction, in this example) which acts like a guardian and checks for the address conflict

H/W support for Memory Disambiguation

When the speculated load LDS is executed, the hardware saves the address of the accessed memory location in log table and finds ….

1: If the subsequent STORE changes the location before the check instruction LDV, then speculation has failed; whereas ……

Handling Failure…

1: If only the load instruction was speculated then it is sufficient to redo the load

  • This is accomplished by using LDV instruction, which supplies target register in addition to memory address

H/W support for Memory Disambiguation

2: If the additional instruction (LDV) is also speculated then

  • re-execute all the speculated instruction, starting with the LOAD, using a fix-up sequence
  • Here, the check instruction (LDV) specifies the address of the fix-up code