ScholarQuill logoScholarQuillUniversity Notes
My Semester
Explore Notes
Past Papers12 New
Video CoursesNew
Search
Settings
Study Tools
GPA/CGPA Calculator
Schedule & To-Do
Student Portal
Contact
Contact
ScholarQuill logo
My Semester
Explore Notes
Past Papers12 New
Video CoursesNew
Search
Settings
GPA/CGPA Calculator
Schedule & To-Do
Student Portal
Contact
ScholarQuill logoScholarQuillUniversity Notes
Study PortalCOMP3147Pipeline Performance A…
Ctrl + K
Login
Explore
Search
Semester
Papers
CGPA
    COMP3147

    Computer Architecture

    Progress0 / 24 done
    Topics24
    1Transistors and Digital logic2Hardware description languages (Verilog)
    3Instruction types and mixes4Addressing modes5RISC vs. CISC architectures6Exceptions in instruction sets
    7Data dependencies8Static scheduling9Pipeline performance analysis
    10Local scheduling11Loop unrolling and Software pipelining12Trace scheduling13Deferred exceptions and Predicated execution14IA64 architecture
    15Dynamical scheduling16Register renaming17Speculative execution18Trace cache
    19Cache coherency20Sequential consistency21Multithreading22Symmetric multiprocessing23Transactional memory
    24GPU programming
    5 min read
    Topic 9 of 24
    Topic Study Note Illustration
    09

    Pipeline performance analysis

    Pipeline performance analysis focuses on measuring how much improvement a pipelined processor achieves compared to a non-pipelined one, and how hazards, stalls, and pipeline depth affect performance.

    ⭐ Pipeline Performance Analysis

    Pipeline performance analysis focuses on measuring how much improvement a pipelined processor achieves compared to a non-pipelined one, and how hazards, stalls, and pipeline depth affect performance.


    ⭐ 1. Key Terms

    1. Pipeline

    A pipeline breaks instruction execution into stages (IF, ID, EX, MEM, WB) to overlap execution of multiple instructions.

    2. Throughput

    The number of instructions completed per unit time.

    3. Latency

    Time taken for a single instruction to pass through the entire pipeline.

    4. CPI (Cycles Per Instruction)

    Average number of clock cycles required per instruction.


    ⭐ 2. Ideal Pipeline Performance

    In an ideal pipeline with no stalls, no hazards, and perfect balance, the performance improves by a factor equal to the pipeline depth.

    Speedup Formula (Ideal):

    Speedup=Execution time (non-pipelined)Execution time (pipelined)\text{Speedup} = \frac{\text{Execution time (non-pipelined)}}{\text{Execution time (pipelined)}}Speedup=Execution time (pipelined)Execution time (non-pipelined)​

    For a pipeline with k stages:

    Speedup (ideal)=k\text{Speedup (ideal)} = kSpeedup (ideal)=k

    Ideal CPI:

    CPIideal=1\text{CPI}_{\text{ideal}} = 1CPIideal​=1

    Explanation:

    Once the pipeline is full, the CPU completes one instruction per cycle.


    ⭐ 3. Real Pipeline Performance

    Real pipelines include:

    • Data hazards
    • Control hazards
    • Structural hazards
    • Stalls
    • Branch mispredictions
    • Cache misses

    These reduce performance.

    Actual CPI:

    CPI∗actual=CPI∗ideal+Pipeline Stall Cycles per Instruction\text{CPI}*{\text{actual}} = \text{CPI}*{\text{ideal}} + \text{Pipeline Stall Cycles per Instruction}CPI∗actual=CPI∗ideal+Pipeline Stall Cycles per Instruction

    Since ideal CPI = 1:

    CPIactual=1+Stall Penalty\text{CPI}_{\text{actual}} = 1 + \text{Stall Penalty}CPIactual​=1+Stall Penalty

    ⭐ 4. Pipeline Speedup with Stalls

    Speedup=Non-pipelined execution timePipelined execution time\text{Speedup} = \frac{\text{Non-pipelined execution time}}{\text{Pipelined execution time}}Speedup=Pipelined execution timeNon-pipelined execution time​

    Since:

    • Non-pipelined CPI = number of stages = k
    • Pipelined CPI = 1+stall cycles1 + \text{stall cycles}1+stall cycles
    Speedup=k1+stall cycles\text{Speedup} = \frac{k}{1 + \text{stall cycles}}Speedup=1+stall cyclesk​

    ⭐ 5. Pipeline Throughput

    Definition

    Throughput = number of instructions completed per second.

    Throughput=1Cycle Time×CPI\text{Throughput} = \frac{1}{\text{Cycle Time} \times \text{CPI}}Throughput=Cycle Time×CPI1​

    With more pipeline stages (greater k), cycle time decreases, increasing throughput.


    ⭐ 6. Pipeline Latency

    Definition

    Latency is the time for one instruction to travel through all pipeline stages.

    Latency=k×Cycle Time\text{Latency} = k \times \text{Cycle Time}Latency=k×Cycle Time

    Note:

    • Pipelining does not reduce latency.
    • It reduces execution time for multiple instructions.

    ⭐ 7. Example of Pipeline Performance

    Consider a 5-stage pipeline:

    Non-pipelined:

    Each instruction = 5 cycles 10 instructions = 10 × 5 = 50 cycles

    Pipelined:

    Pipeline fill = 5 cycles Then 1 instruction per cycle:

    (5−1)+10=14 cycles(5 - 1) + 10 = 14 \text{ cycles}(5−1)+10=14 cycles

    Speedup:

    5014=3.57×\frac{50}{14} = 3.57\times1450​=3.57×

    (Not the ideal 5× because of pipeline fill time.)


    ⭐ 8. Effect of Hazards on Pipeline Performance

    Data Hazards (RAW)

    Cause stalls unless forwarding is used.

    If average load-use stall = 0.3 cycles:

    CPI=1+0.3=1.3\text{CPI} = 1 + 0.3 = 1.3CPI=1+0.3=1.3

    Control Hazards

    Branch mispredictions cause penalty cycles.

    If branch frequency = 20%, mispredict rate = 5%, penalty = 3 cycles:

    Penalty=0.20×0.05×3=0.03\text{Penalty} = 0.20 \times 0.05 \times 3 = 0.03Penalty=0.20×0.05×3=0.03 CPI=1+0.03=1.03\text{CPI} = 1 + 0.03 = 1.03CPI=1+0.03=1.03

    Structural Hazards

    Shared resources cause conflicts.

    Penalty added as additional stall cycles.


    ⭐ 9. Overall CPI Formula (All Hazards)

    CPI∗actual=1+Stalls∗data+Stalls∗control+Stalls∗structural\text{CPI}*{\text{actual}} = 1 + \text{Stalls}*{\text{data}} + \text{Stalls}*{\text{control}} + \text{Stalls}*{\text{structural}}CPI∗actual=1+Stalls∗data+Stalls∗control+Stalls∗structural

    ⭐ 10. Pipeline Efficiency

    Definition

    Pipeline efficiency = useful work / total cycles

    Efficiency=Number of instructionsPipeline cycles×Pipeline width\text{Efficiency} = \frac{\text{Number of instructions}}{\text{Pipeline cycles} \times \text{Pipeline width}}Efficiency=Pipeline cycles×Pipeline widthNumber of instructions​

    For scalar (width = 1):

    Efficiency=Number of instructionsPipeline cycles\text{Efficiency} = \frac{\text{Number of instructions}}{\text{Pipeline cycles}}Efficiency=Pipeline cyclesNumber of instructions​

    ⭐ 11. Factors Affecting Pipeline Performance

    1. Pipeline depth: More stages = faster clock but more hazard penalties.

    2. Hazard frequency: More RAW, WAR, WAW hazards → more stalls.

    3. Branch prediction accuracy: Better prediction → fewer control stalls.

    4. Instruction mix: High-load frequency → more load-use hazards.

    5. Compiler optimizations: Static scheduling can reduce stalls.

    6. Hardware support: Forwarding paths, hazard detection, branch prediction.


    ⭐ Exam-Focused Summary

    • Ideal speedup = pipeline stages
    • Actual CPI = 1 + stall cycles
    • Hazards (RAW, control, structural) increase CPI
    • Pipeline reduces throughput but not latency
    • Branch penalties and load-use stalls reduce efficiency
    • Speedup = k1+stall cycles\frac{k}{1 + \text{stall cycles}}1+stall cyclesk​
    ← Previous topic 8
    Static scheduling
    Next topic 10 →
    VLIW Pipelines: Local scheduling

    Past Papers

    Open this section to view and download past papers

    Click on Show Past Papers to load available exam papers.

    Reading Progress
    0%
    5mremaining
    896words
    Beginnerlevel
    On This Page

    No headings found

    Study Toolkit

    Subject Portal

    Computer Architecture