COMP 206: Computer Architecture and Implementation - PowerPoint PPT Presentation

About This Presentation
Title:

COMP 206: Computer Architecture and Implementation

Description:

uses this information to dynamically schedule instructions ... blank when no pending instructions will write that register. 9. Scoreboard Example Cycle 0 ... – PowerPoint PPT presentation

Number of Views:35
Avg rating:3.0/5.0
Slides: 35
Provided by: Montek5
Learn more at: http://www.cs.unc.edu
Category:

less

Transcript and Presenter's Notes

Title: COMP 206: Computer Architecture and Implementation


1
COMP 206Computer Architecture and Implementation
  • Montek Singh
  • Wed., Sep 25, 2002
  • Topic Instruction-Level Parallelism
  • (Dynamic Scheduling Scoreboarding)

2
What is a Scoreboard?
  • A Scoreboard is a table maintained by the
    hardware
  • keeps track of instructions being fetched,
    issued, executed etc.
  • keeps track of the resources (functional units
    and operands) they use/need
  • keeps track of which instructions modify which
    registers
  • uses this information to dynamically schedule
    instructions
  • very similar to a pen and paper calculation
  • simple step-by-step procedure easily implemented
    in hardware

3
MIPS with a Scoreboard
4
Dynamic Scheduling with a Scoreboard
  • Original development in CDC 6600
  • Simplified example in HP3 for MIPS FP operations
    (Read Section A.8)
  • Using neither renaming nor forwarding
  • Values always move from registers to function
    units, and from function units back to registers
  • However, write-back of results happen as soon as
    possible, not in a statically scheduled slot
  • Out-of-order completion can give rise to WAR and
    WAW hazards
  • Remember machine knows original program order
    (needed for hazard detection)
  • Machine model
  • 2 FP multipliers (10 cycles), 1 FP adder (2
    cycles), 1 FP divider (40 cycles)
  • 1 integer unit for everything else (incl. memory
    references)

5
Scoreboard Implications
  • Out-of-order completion ? WAW, WAR hazards?
  • for WAW stall in Issue until previous write
    completes
  • for WAR stall in Write Result until previous
    read completes
  • Need to have multiple instructions in execution
    phase
  • ? multiple execution units or pipelined execution
    units
  • Scoreboard keeps track of dependences, state of
    operations
  • Scoreboard replaces ID, EX, WB with 4 stages

6
Four Stages of Scoreboard Control
  • Issue decode instr. check for structural
    hazards (ID1)
  • If functional unit is free and no WAW hazard with
    other active instruction
  • scoreboard issues the instruction to the
    functional unit and updates its internal data
    structure.
  • If a structural or WAW hazard exists
  • instruction issue stalls
  • unless there is buffering between fetch and
    issue, no further instructions issue until these
    hazards are cleared.
  • Read operands wait until no data hazards, then
    read (ID2)
  • A source operand is available if no earlier
    issued active instruction is going to write it.
  • When all source operands are available
  • scoreboard tells the functional unit to proceed
    to read the operands from registers and begin
    execution.
  • Thus, scoreboard resolves RAW hazards dynamically
    in this step
  • instructions may be sent into execution out of
    order

7
Four Stages of Scoreboard Control (cont.)
  • Execution operate on operands
  • The functional unit begins execution upon
    receiving operands
  • When result is ready, it notifies the scoreboard
  • Write Result finish execution (WB)
  • Once scoreboard is aware that functional unit has
    completed execution, scoreboard checks for WAR
    hazards.
  • If no WAR hazard
  • it writes results
  • If WAR hazard
  • it stalls the completing instruction
  • Example
  • DIV.D F0,F2,F4
  • ADD.D F10,F0,F8
  • SUB.D F8,F8,F14
  • CDC 6600 scoreboard would stall SUB.D until ADD.D
    reads ops

8
Three Parts of the Scoreboard
  • Instruction status Which of 4 steps instruction
    is in
  • Functional unit (FU) status Indicates state of
    FU
  • Nine fields for each 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 registers
  • Qj, Qk Functional units producing source
    registers Fj, Fk
  • Rj, Rk Flags indicating when Fj, Fk are ready
  • Register result status Indicates which
    functional unit will write each register, if any
  • blank when no pending instructions will write
    that register

9
Scoreboard Example Cycle 0
10
Scoreboard Example Cycle 1
First LD issues
11
Scoreboard Example Cycle 2
Structural hazard on Integer unit second LD
stalls in IF stage
12
Scoreboard Example Cycle 3
Second LD is still stalled
13
Scoreboard Example Cycle 4
Second LD still stalled first LD done
14
Scoreboard Example Cycle 5
Second LD issues as the structural hazard on
Integer unit has cleared
15
Scoreboard Example Cycle 6
MULT issues
16
Scoreboard Example Cycle 7
SUBD issues MULT stalled on LD
17
Scoreboard Example Cycle 8a
DIVD issues SUBD stalled on LD
18
Scoreboard Example Cycle 8b
LD writes F2 MULT and SUBD enabled
19
Scoreboard Example Cycle 9
MULT and SUBD read operands and enter execution
20
Scoreboard Example Cycle 10
Structural hazard on Add unit stalls the final
ADDD
21
Scoreboard Example Cycle 11
SUBD and MULT are still in execution
22
Scoreboard Example Cycle 12
SUBD writes results Add unit free structural
hazard resolves
23
Scoreboard Example Cycle 13
Note WAR hazard between DIVD and ADDD
24
Scoreboard Example Cycle 14
MULT still executing DIVD stalled on F0 (RAW
hazard)
25
Scoreboard Example Cycle 15
MULT still executing
26
Scoreboard Example Cycle 16
ADDD completes execution, ready to write result
into F6
27
Scoreboard Example Cycle 17
WAR hazard ADDD stalls in Write Result stage
28
Scoreboard Example Cycle 18
DIVD stalled (RAW hazard on F0), ADDD stalled
(WAR hazard on F6)
29
Scoreboard Example Cycle 19
MULT completes execution
30
Scoreboard Example Cycle 20
MULT writes result DIVD can proceed to read
operands at next cycle
31
Scoreboard Example Cycle 21
DIVD reads operands WAR hazard on F6 is resolved
32
Scoreboard Example Cycle 22
40 cycle Divide!
ADDD completes writing of result
33
Scoreboard Example Cycle 61
DIVD completes execution ready to write result
34
Scoreboard Summary
  • CDC designers measured performance improvement of
    1.7 for compiled FORTRAN code, 2.5 for assembly
  • No pipeline scheduling in software
  • Slow memory (no cache)
  • Limitations of 6600 scoreboard
  • No forwarding
  • Limited to instructions in basic block (small
    issue window)
  • Number of functional units (structural hazards)
  • Wait for WAR hazards
  • Prevent WAW hazards
Write a Comment
User Comments (0)
About PowerShow.com