Docsity

Instruction Level Parallelism - Advanced Computer Architecture - Lecture Slides, Slides of Computer Science

Partial preview of the text

Download Instruction Level Parallelism - Advanced Computer Architecture - Lecture Slides and more Slides Computer Science in PDF only on Docsity!

Instruction Level Parallelism: Concepts

and Challenges

  • Instruction-level parallelism(ILP)
    • The potential of overlapping the execution of multiple instructions is called instruction-level parallelism.

Techniques to Reduce Pipeline CPI

  • Recall,
    • Pipeline CPI = Ideal pipeline CPI + Structural stalls + RAW stalls + WAR stalls + WAW stalls + Control stalls.
    • Instruction-level parallelism is to reduce the number of stalls.
    • How to find out ILP
      • Dynamically locate ILP by hardware
      • Statically locate ILP by software
    • Techniques that affect CPI (fig. 3.1 on page 173).

Loop-Level Parallelism

  • Parallelism among iterations of a loop.
    • Example: for(I=1; I<=100; I++) X[I]=X[I]+Y[I];
  • Each iteration of the loop can overlap with any other iteration in this example.
  • Techniques converting the loop-level parallelism into ILP
    • Loop unrolling
    • Use of vector instructions (Appendix G)
      • LOAD X; LOAD Y; ADD X, Y; STORE X
      • Originally used in mainframe and supercomputers.
      • Die away due to the effective use of pipelining in desktop and server processors
      • See a renaissance for use in graphics, DSP, and multimedia applications

Data Dependence and Hazards

  • To have ILP, instructions should have no dependence
  • A dependence indicates the possibility of a hazard,
    • Determines the order in which results must be calculated, and
    • Sets an upper bound on how much parallelism can possibly be exploited.
  • Overcome the limitation of dependence on ILP by
    • Maintaining the dependence but avoiding a hazard,
    • Eliminating a dependence by transforming the code.
  • Dependence types
    • Data dependence
      • Creating RAW, WAR, and WAW hazards
    • Name dependences
    • Control dependences

Control Dependence

  • A control dependence determines the

ordering of an instruction with respect to a

branch instruction.

  • Example: S1 is control dependent on p1, but not on p2. if p1 { S1; }; if p2 { S1; };

Two Constraints Imposed by Control

Dependences

  • An instruction that is control dependent on a branch cannot be moved before the branch so that its execution is no longer controlled by the branch.
  • An instruction that is not control dependent on a branch cannot be moved after the branch so that its execution is controlled by the branch.

Can We Violate Control Dependence?

  • Yes, we can
    • If we can ensure that violating the control dependence will not result in incorrectness of the programs, control dependence is not critical property that must be preserved.
    • Instead, the exception behavior and data flow critical to correctness of the program are normally preserved by data and control dependence

Preserving Exception Behavior

  • Preserving the exception behavior means that any changes in the ordering of instruction execution must not change how exceptions are raised in the program. - Often this is relaxed to mean that the reordering of instruction execution must not cause any new exceptions in the program. - Example DADDU R2, R3, R BEQZ R2, L LW R1, 0(R2) L1: … How about LW is moved before BEQZ and there is a memory exception while the branch is taken?

Speculation

  • Check whether an instruction can be executed

with violation of control dependence yet

preserve the exception behavior and the data

flow.

  • Example DADDU R1, R2, R BEQZ R12, skipnext DSUBU R4, R5, R DADDU R5, R4, R Skipnext: OR R7, R8, R
  • How about moving DSUBD before BEQZ if R4 were not used in taken path?

Overcoming Data Hazards with

Dynamic Scheduling

  • Basic idea: DIV.D F0, F2, F ADD.D F10, F0, F SUB.D F12, F8, F
  • SUB.D is stalled, but not data dependent on anything.
  • The major limitation of so-far introduced pipeline is in-order issuing of instructions.
  • To allow SUB.D to execute by dynamically scheduling the instructions, it create out-of-order execution, and thus out-of-order completion.

Support Dynamic Scheduling for the

Simple Five-Stage Pipeline

  • Divide the ID stage into the following two stages:
    • Issue: Decode instructions and check for structural hazards.
    • Read operands: Wait until no data hazards, then read operands.

Dynamic Scheduling Algorithms

  • Algorithms
    • Scoreboarding, originated from CDC 6600 (Appendix A). - Effective when there are sufficient resources and no data dependence.
    • Tomasulo algorithm, originated from IBM 360.
  • Both algorithms can be applied to pipelining

or multi-functional units implementations.

Concept of Register Renaming

  • Code before renaming DIV.D F0, F2, F ADD.D F6, F0, F S.D F6, 0(R1) SUB.D F8, F10, F MUL.D F6, F10, F
  • Code after renaming DIV.D F0, F2, F ADD.D S, F0, F S.D S, 0(R1) SUB.D T, F10, F MUL.D F6, F10, T

Basic Architecture for Tomasulo’s

Approach