Lecture 4 - Instruction Level Parallelism (ILP) Flashcards
(9 cards)
Introduction to Instruction Level Parallelism (ILP)
- Pipelining, introduced in 1985, became a universal technique to overlap instruction execution and exploit ILP.
- Two main approaches to ILP exist: hardware-based dynamic approaches (used in server and desktop processors, and modern phone/tablet processors) and compiler-based static approaches (less successful outside scientific applications).
- Key techniques include VLIW (Very Long Instruction Word), Out-of-order execution, Speculative Execution, Branch Prediction, and Superscalar processing.
In-Order vs Out-of-Order Execution
- In-order execution processes instructions in their original sequence. If one instruction stalls, all subsequent instructions stall.
- Reordering can be done in software by the compiler, programmer, or binary optimization tools.
- Out-of-order execution allows the processor to dynamically reorder instructions. If one instruction stalls, others may proceed.
- Instructions may commit out of order, but the semantics of in-order execution must be preserved.
Instruction Level Parallelism (ILP)
(What is the goal?) (What is ILP)
ILP is a form of parallelism that involves executing multiple instructions simultaneously.
- The goal of ILP is to minimize Cycles Per Instruction (CPI).
- Pipeline CPI = Ideal pipeline CPI + Structural stalls + Data hazard stalls + Control stalls.
- Parallelism within a basic block (straight-line code sequence) is limited (typically 3-6 instructions), and instructions are likely to depend on each other. Optimization must occur across branches.
- For single-issue processors, the ideal CPI is 1.
Data Dependence (What is LLP) (Name three types RWW, TOA)
- Data Dependency refers to a situation in which an instruction is dependent on a result from an earlier instruction.
- Dependent instructions cannot be executed simultaneously.
- There are three types of Data Dependencies:
- Raw (Read After Write), (True Dependency): Instruction reads a value before it has been written.
- WAW (Write After Write), (Output Dependency): Two instructions write to the same location, and the write operations are reordered.
- WAR (Write After Read), (Anti-Dependency): An Instruction writes to a location before a previous instruction reads it.
Loop Level Parallelism (LLP) (What is LLP) (How can it be achieved)
Loop-level parallelism is a form of parallelism that involves extracting parallel tasks from loops.
Loop-level parallelism can be achieved by unrolling loops statically or dynamically, or by using SIMD (vector processors and GPUs).
Data Hazards (Data Dependency) (Name examples)
- Types of data hazards: Read-after-write (RAW), Write-after-write (WAW), and Write-after-read (WAR).
- RAW (true dependency): Instruction reads a value before it has been written.
- WAW (output dependency): Two instructions write to the same location, and the write operations are reordered.
- WAR (antidependency): An instruction writes to a location before a previous instruction reads it.
Name Dependence
- Occurs when two instructions use the same name (register or memory location) without any flow of information.
- Not a true data dependence but can cause problems when reordering instructions.
- Anti-dependence (WAR) and output dependence (WAW) are examples. Renaming techniques can resolve these.
Control Dependences
- The ordering of an instruction relative to a branch instruction.
- A control-dependent instruction cannot be moved before the branch, and a control-independent instruction cannot be moved after the branch.
Compiler Techniques for Exposing ILP (Name techniques PLS)
- Pipeline scheduling: Separating dependent instructions by the pipeline latency of the source instruction.
- Loop unrolling: Replicating the loop body to reduce loop overhead and expose more parallelism.
- Strip mining: Handling loops with an unknown number of iterations by generating a pair of loops.