Exercises — Deep pipelining trade-offs
5.2.11 · D4· Hardware › Processor Datapath & Pipelining › Deep pipelining trade-offs
Yeh page ek self-test ladder hai. Har problem apna difficulty level batata hai (L1 → L5). Pehle Solution callout collapse karke try karo, phir open karke har step check karo. Saare numbers machine-verified hain.
Shuru karne se pehle, yeh pakka kar lete hain ki neeche use hone wale har symbol ka matlab pehle se clear ho — yahan kuch bhi bina plain-words meaning ke nahi aata.
Poori derivations ke liye Deep pipelining trade-offs dekho jinhe yeh problems drill karti hain.
Level 1 — Recognition
Problem 1.1
, , , aur ka matlab ek-ek sentence mein batao, aur woh formula likho jo inhe link karta hai.
Recall Solution 1.1
- = number of pipeline stages (ek positive integer, ).
- = ek stage ki combinational logic delay.
- = fixed per-stage pipeline-register overhead ( ke saath shrink nahi hota).
- = clock period = ek tick ka time.
- Link: Yeh kya kehta hai: jab hum stages badhate hain, pehla term shrink hota hai lekin doosra kabhi nahi hota.
Problem 1.2
Ek pipeline mein ns logic hai jise stages mein split kiya gaya hai, ns ke saath. , , aur (MHz mein) nikalo.
Recall Solution 1.2
- ns.
- ns.
- MHz. 1000 kyun? 1 ns s, isliye Hz MHz.
Problem 1.3
Sahi hai ya galat: "Zyada pipeline stages add karne se hamesha kam hota hai." Formula use karke explain karo.
Recall Solution 1.3
Galat (practice mein), sirf idealised logic-only model mein sahi. Pure model mein , badhane se shrink hota hai, isliye girta rehta hai — lekin sirf asymptotically ki taraf, kabhi usse neeche nahi. Reality mein logic infinitely divisible nahi hai (atomic stages hain), isliye kisi depth ke baad slowest stage shrink hona band ho jaata hai aur flat ho jaata hai. Toh honest answer hai: ideal model mein yeh kabhi nahi badhata, lekin benefit khatam ho jaata hai.
Level 2 — Application
Problem 2.1
Unpipelined logic ns, register overhead ns, perfect balance. , , aur stages ke liye ideal speedup compute karo. Do decimals tak round karo.
Recall Solution 2.1
Yeh formula kyun? Unpipelined mein, ek instruction poora finish karne mein leta hai. Ek full -stage pipeline, jab uske saare stages busy ho jaate hain, har clock tick mein ek instruction retire karta hai — yaani har mein ek. Toh per instruction time se tak girta hai, aur speedup un dono per-instruction times ka ratio hai: Isliye upar hai aur ek cycle neeche — hum "seconds per instruction, before vs after" compare kar rahe hain.
- : ; speedup .
- : ; speedup .
- : ; speedup . Kaisa dikhta hai — Figure s01 padho: blue curve yahi speedup vs hai. Teen coloured dots hamare answers mark karte hain (orange , green , gray ). Notice karo ki green aur gray dots ke beech gap double nahi hai orange aur green ke beech ke gap se — curve dashed red ceiling ki taraf bend ho raha hai. Woh bend IS diminishing returns, visible bana hua.

Problem 2.2
Upar ke result se, "diminishing returns" quantify karo: humne pipeline deeper ki — ideal speedup actually kis factor se bada?
Recall Solution 2.2
Depth bada. Speedup bada. Toh hardware depth sirf speed deta hai. Missing ne kha liya, jo ab har cycle ka hai (vs par ). Figure par: yeh exactly woh vertical distance hai gray dot se neeche wahan tak jahan ek straight line orange dot se land hoti — shortfall hai red ceiling jo curve ko flat kheench rahi hai.
Problem 2.3
Ek design mein ns aur ns hai. Maximum possible clock frequency kya hai (asymptotic limit jab ), MHz mein?
Recall Solution 2.3
Jab , , isliye ns. Ceiling kyun hai: tum kabhi ek cycle ko register handoff se chota nahi bana sakte. Yahi woh wall hai jisme deep pipelining run karti hai. (Yeh limit mathematical hai; real finite integer hai, isliye tum 2 GHz ko sirf approach kar sakte ho.)
Level 3 — Analysis
Problem 3.1
Branches har 5 instructions mein aate hain; prediction accuracy 90% hai; misprediction penalty cycles hai. 5-stage aur 20-stage pipeline ke liye effective CPI compute karo (data hazards ignore karo).
Recall Solution 3.1
Fraction of instructions jo branches hain . Mispredicted fraction per instruction. Stall CPI .
- 5-stage: ⇒ CPI .
- 20-stage: ⇒ CPI . Kya hota hai: har mispredict poori pipeline flush kar deta hai; lambi pipe mein zyada in-flight kaam barbaad hota hai. Branch Prediction aur Pipeline Hazards dekho.
Problem 3.2
20-stage pipeline ka clock 5-stage se tez hai. Problem 3.1 ke CPIs use karte hue, effective speedup (throughput ratio) nikalo. Kya frequency pay off hui?
Recall Solution 3.2
Throughput . Verdict: clock sirf throughput deta hai. CPI 1.08 se 1.38 ( worse) tak badha, frequency win ka karib ek chauthai mita diya. Complementary lever ke liye Superscalar Architectures dekho ( ki jagah IPC badhana).
Problem 3.3
Kis branch prediction accuracy par 20-stage pipeline ki control-stall CPI, problem 3.1 ki 5-stage pipeline ki control-stall CPI (jo 0.08 thi) ke barabar hogi? Branch frequency aur penalty rakho.
Recall Solution 3.3
set karo. Matlab: 20-stage pipe ke control stalls ko 5-stage pipe jitna kam rakhne ke liye, prediction ko 90% se ~97.9% tak jaana hoga. Isi liye deep pipelines ko excellent branch prediction chahiye — accuracy ki requirement depth ke saath badhti hai.
Level 4 — Synthesis
Problem 4.1
Dynamic power hai. Deeper pipeline ko badhata hai. Agar voltage aur capacitance constant rakhen, to dynamic power kis factor se badhega? Phir, agar designer ko 10% kam kar de ( pe), to net power factor kya hoga?
Recall Solution 4.1
Constant pe: , isliye power badhega. ke saath: power ke saath scale hota hai, isliye factor . Interpretation: 10% voltage cut ke baad bhi, power 21.5% badhta hai. Voltage reduction (Dynamic Voltage and Frequency Scaling (DVFS) ke peeche lever) tez jaane ki power cost ko soft karta hai lekin mita nahi sakta, kyunki power ke square par depend karta hai lekin par sirf linearly.
Problem 4.2 — Pentium 4 Prescott reconstruction
Northwood (20 stages) vs Prescott (31 stages): Prescott ne frequency badhayi lekin uska CPI bhi badh gaya. (a) Net performance factor compute karo. (b) Agar power bhi badhi, to Northwood ke relative performance-per-watt compute karo.
Recall Solution 4.2
(a) Performance : Koi net gain nahi — frequency win exactly CPI loss se cancel ho gayi. Yahi "deep-pipeline wall" hai. (b) Performance-per-watt . Verdict: same speed, power ⇒ efficiency do-tihai reh gayi. Isi liye Intel ne Core microarchitecture ke liye deep-pipeline path abandon kiya. Pentium 4 vs Core Microarchitecture dekho.
Problem 4.3
Do effects combine karo. ns, ns lo. Throughput index define karo jahan MHz aur hai (problem 3.1 ke branch model se). ke liye compute karo aur identify karo ki kaun sa throughput maximize karta hai.
Recall Solution 4.3
Yeh index kyun? ticks-per-second batata hai, ticks-per-instruction batata hai, isliye = instructions-per-second — actual useful-work rate. Divide karne se "cycle" unit cancel hoti hai aur work-per-time bachta hai, jo exactly woh hai jo hum maximize karna chahte hain. Hum ise sirf whole-number par evaluate karte hain kyunki stages integers hain. Har ek compute karo (frequency MHz mein, CPI dimensionless, MHz-per-instruction-cycle mein):
- : , CPI , .
- : , CPI , .
- : , CPI , .
- : , CPI , . Result: is range ke andar ke saath badhta hi rahta hai ( par peak) — kyunki 90% prediction CPI growth ko mild rakhti hai. Peak chote ki taraf move karta hai jab data hazards aur worse prediction add karo. Lesson: optimal depth poori tarah is par depend karta hai ki CPI kitni tezi se badhta hai. Figure s02 padho: blue curve yahi hai bina atomic floor ke — yeh poori range mein chadhta rahta hai, isi liye naive model tumhe kabhi rokne ko nahi kehta.

Level 5 — Mastery
Problem 5.1 — Imbalance ke saath true optimum derive karo
Suppose logic ko ek atomic floor se neeche split nahi kiya ja sakta: slowest stage hai jahan ns ek unsplittable operation hai (jaise cache access, Instruction Pipelining Basics dekho). ns aur ns ke saath, woh smallest nikalo jiske baad stages add karne se zero frequency benefit milta hai.
Recall Solution 5.1
Frequency tab improve hona band karti hai jab atomic floor tak girta hai, yaani jab : Integer-stage step: ek legal stage count nahi hai — ek whole number hona chahiye. Hum round up karte hain agla integer tak, kyunki woh pehla integer hai jis par actually hold karta hai ( par, , toh floor abhi tak reach nahi hua). ke liye, slowest stage ns par stuck hai, isliye ns aur MHz par freeze ho jaata hai chahe kitne bhi zyada stages add karo — lekin CPI ke saath badhta rehta hai. Toh ke baad, deeper strictly worse hai. Yahi stage imbalance "harmless" se "harmful" ban jaata hai.
Problem 5.2 — Full throughput optimisation
aur use karo. par throughput index compute karo aur true optimal depth batao.
Recall Solution 5.2
ab kyun aata hai: clock slowest stage set karta hai, aur koi bhi stage atomic floor ns se tez nahi ho sakta. Isliye cycle ka logic part hai: yeh follow karta hai jab tak woh se upar hai, phir par clamp hota hai. Sirf integer par evaluate karo:
- : , floor abhi active nahi, isliye ns, MHz; CPI ; .
- : , floor ab active hai, isliye ns, MHz; CPI ; .
- : floor active, MHz (frozen); CPI ; .
- : floor active, MHz (frozen); CPI ; . True optimal depth . List neeche padhte hue, tak chadhta hai jab hum floor reach karte hain, phir frequency freeze hone par lekin CPI badhte rehne par girta hai . Maximum exactly par hai — pehla integer jahan atomic floor clock cap karta hai. Uske baad, tum zyada registers aur zyada hazard stalls pay karte ho zero extra frequency ke liye, isliye throughput sirf gir sakta hai. Yahi honest sweet spot hai: depth ko floor tak push karo, phir ruko.
Problem 5.3 — Design judgement
Ek rival team depth ko 17 se 34 stages tak double karne ka proposal deta hai, "double the frequency" ka vaada karke. Problem 5.2 ke model ko dekhte hue, numbers ke saath do-line rebuttal likho.
Recall Solution 5.3
Rebuttal: Frequency double nahi hoti — slowest atomic stage already ns floor par hai, isliye se aage MHz par pinned rehti hai; 34 tak double karne se mein change hota hai. Lekin CPI se tak badhta hai, isliye throughput se tak girta hai — ek 20% loss — plus roughly double register power. Yahan depth double karna sirf cost hai, koi benefit nahi.
Recall Self-check summary (cloze)
Clock period hai ::: Woh quantity jo actually performance measure karti hai woh hai ::: throughput Ideal model mein par, bounded hai ::: se -stage pipe mein branch misprediction penalty hai ::: cycles True depth limit tab aata hai jab hit karta hai ::: atomic (unsplittable) stage floor ko, yaani