ScholarQuill logoScholarQuillUniversity Notes
  • Notes
  • Past Papers
  • Blogs
  • Todo
Login
ScholarQuill logoScholarQuillUniversity Notes
Login
NotesPast PapersBlogsTodo
More
SubjectsDiscussionCGPA CalculatorGPA CalculatorStudent PortalCourse Outline
About
About usPrivacy PolicyReportContact
Notes
Past Papers
Blogs
Todo
Analytics
    Current Subject
    🧩
    Computer Architecture
    COMP3147
    Progress0 / 24 topics
    Topics
    1. Digital Hardware Design: Transistors and Digital logic2. Hardware description languages (Verilog)3. Instruction Set Architecture: Instruction types and mixes4. Addressing modes5. RISC vs. CISC architectures6. Exceptions in instruction sets7. Scalar Pipelines: Data dependencies8. Static scheduling9. Pipeline performance analysis10. VLIW Pipelines: Local scheduling11. Loop unrolling and Software pipelining12. Trace scheduling13. Deferred exceptions and Predicated execution14. IA64 architecture15. Dynamic Pipelines: Dynamical scheduling16. Register renaming17. Speculative execution18. Trace cache19. Thread-Level Parallelism: Cache coherency20. Sequential consistency21. Multithreading22. Symmetric multiprocessing23. Transactional memory24. Data-Level Parallelism: GPU programming
    COMP3147›Pipeline performance analysis
    Computer ArchitectureTopic 9 of 24

    Pipeline performance analysis

    5 minread
    896words
    Beginnerlevel

    ⭐ 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 load past papers

    Click on Show Past Papers to see past papers.
    On This Page
      Reading Stats
      Est. reading time5 min
      Word count896
      Code examples0
      DifficultyBeginner