DLX Instruction Fetch Execute Addr Calc Instr Decode

  • Slides: 46
Download presentation

Επεξεργαστής DLX Instruction Fetch Execute Addr. Calc Instr. Decode Reg. Fetch Memory Access Write

Επεξεργαστής DLX Instruction Fetch Execute Addr. Calc Instr. Decode Reg. Fetch Memory Access Write Back MUX RD RD WB Data RD MUX Sign Imm Extend MEM/WB Μνήμη Δεδομένων EX/MEM ALU MUX RS 2 ID/EX Imm Opcode RS 1 Return PC (Addr + 8) Branch? Reg File IF/ID PC Μνήμη Adder Εντολών 4 Adder Next PC

Τεχνικές ελάττωσης stalls. CPI = Ideal CPI + Structural stalls + RAW stalls +

Τεχνικές ελάττωσης stalls. CPI = Ideal CPI + Structural stalls + RAW stalls + WAR stalls + WAW stalls + Control stalls Στο 1ο παράδειγμα (in order execution) είχαμε 2 RAW stalls και κανένα άλλο stall. Στο 2ο παράδειγμα (out order execution) είχαμε 1 Structural stall και κανένα άλλο stall. Θα μελετήσουμε δύο ειδών τεχνικές Δυναμικές δρομολόγηση εντολών (hardware) • Scoreboard (ελάττωση RAW stalls) • Register Renaming α)Tomasulo β)Reorder Buffer (ελάττωση WAR και WAW stalls) • Branch prediction (ελάττωση Control stalls) Στατικές (shoftware/compiler) • Loop Unrolling • Software Pipelining • Trace Scheduling

Αρχιτεκτονική Scoreboard (CDC 6600) Registers FP Mult FP Divide FP Add Integer SCOREBOARD Functional

Αρχιτεκτονική Scoreboard (CDC 6600) Registers FP Mult FP Divide FP Add Integer SCOREBOARD Functional Units FP Mult Memory

Four Stages of Scoreboard Control • Issue—decode εντολή & έλεγξε για structural hazards (ID

Four Stages of Scoreboard Control • Issue—decode εντολή & έλεγξε για structural hazards (ID 1) – Instructions issued in program order (for hazard checking) – Don’t issue if structural hazard – Don’t issue if instruction is output dependent on any previously issued but uncompleted instruction (no WAW hazards) • Read operands—περίμενε μέχρι να μην υπάρχουν data hazards, μετά διάβασε μεταβλητές (ID 2) – All real dependencies (RAW hazards) resolved in this stage, since we wait for instructions to write back data. – No forwarding of data in this model!

Four Stages of Scoreboard Control • Execution— εκτέλεση στην αριθμητική μονάδα (EX) – The

Four Stages of Scoreboard Control • Execution— εκτέλεση στην αριθμητική μονάδα (EX) – The functional unit begins execution upon receiving operands. When the result is ready, it notifies the scoreboard that it has completed execution. • Write result—Τέλος Εκτέλεσης (WB) – Stall μέχρι να μην υπάρχει WAR hazards με προηγούμενες εντολές: Παράδειγμα: DIV. D F 0, F 2, F 4 ADD. D F 10, F 8 SUB. D F 8, F 14 CDC 6600 scoreboard would stall SUBD until ADDD reads operands

3 μέρη του Scoreboard • Instruction status: Σε ποιο από τα 4 στάδια είναι

3 μέρη του Scoreboard • Instruction status: Σε ποιο από τα 4 στάδια είναι η εντολή • Functional unit status: —Δείχνει την κατάσταση του functional unit (FU). 9 πεδία για κάθε functional unit Busy: Indicates whether the unit is busy or not Op: Operation to perform in the unit (e. g. , + or –) Fi: Destination register Fj, Fk: Source-register numbers Qj, Qk: Functional units producing source registers Fj, Fk Rj, Rk: Flags indicating when Fj, Fk are ready • Register result status—Δείχνει ποιο functional unit θα γράψει κάθε register, αν υπάρχει κάποια. Blank when no pending instructions will write that register

Παράδειγμα Scoreboard

Παράδειγμα Scoreboard

Detailed Scoreboard Pipeline Control Instruction status Wait until Bookkeeping Issue Busy (FU)=No and result(D)=0

Detailed Scoreboard Pipeline Control Instruction status Wait until Bookkeeping Issue Busy (FU)=No and result(D)=0 (struct hazard, WAW) Busy(FU) yes; Op(FU) op; Fi(FU) `D’; Fj(FU) `S 1’; Fk(FU) `S 2’; Qj Result(‘S 1’); Qk Result(`S 2’); Rj not Qj; Rk not Qk; Result(‘D’) FU; Read operands Rj and Rk (RAW) Rj No; Rk No Execution complete Functional unit done Write result f((Fj(f) Fi(FU) or Rj(f)=No) & f(if Qj(f)=FU then Rj(f) Yes); (Fk(f) Fi(FU) or f(if Qk(f)=FU then Rj(f) Yes); Rk( f )=No)) Result(Fi(FU)) 0; Busy(FU) No (WAR)

Παράδειγμα Scoreboard : Κύκλος 2 • Issue Δεύτερο LD; Structural Hazard.

Παράδειγμα Scoreboard : Κύκλος 2 • Issue Δεύτερο LD; Structural Hazard.

Παράδειγμα Scoreboard : Κύκλος 3 • Issue MULT; In order issue.

Παράδειγμα Scoreboard : Κύκλος 3 • Issue MULT; In order issue.

Παράδειγμα Scoreboard : Κύκλος 62 • In-order issue; out-of-order execute & commit

Παράδειγμα Scoreboard : Κύκλος 62 • In-order issue; out-of-order execute & commit

CDC 6600 Scoreboard • Speedup 1. 7 from compiler; 2. 5 by hand BUT

CDC 6600 Scoreboard • Speedup 1. 7 from compiler; 2. 5 by hand BUT slow memory (no cache) limits benefit • Limitations of 6600 scoreboard: – No forwarding hardware – Limited to instructions in basic block (small window) – Small number of functional units (structural hazards), especially integer/load store units – Do not issue on structural hazards – Wait for WAR hazards – Prevent WAW hazards