Worked examples — Deep pipelining trade-offs
5.2.11 · D3· Hardware › Processor Datapath & Pipelining › Deep pipelining trade-offs
Yeh page Deep pipelining trade-offs ka drill ground hai. Parent note ne ideas build kiye; yahan hum har tarah ke numbers grind karte hain jo yeh topic throw kar sakta hai — badi depths, choti depths, woh degenerate case jahan extra stages kuch nahi karte, woh limit jab depth infinity tak jaati hai, ek real chip (Pentium 4), aur ek exam twist.
Ek bhi example se pehle, ek promise: neeche har symbol parent note mein earn kiya gaya hai. Quick refresh, plain words mein:
Frequency kyun hai aur kuch fancier nahi: frequency literally ka matlab hai "ek second mein kitne cycles fit hote hain", aur agar ek cycle seconds chalti hai, toh cycles ek second mein fit hoti hain. Agar nanoseconds ( s) mein hai, toh megahertz (MHz) deta hai, kyunki aur ticks/s.
The scenario matrix
Yeh topic jo bhi problem pose kar sakta hai woh in cells mein se kisi ek mein fall karta hai. Neeche ke worked examples mein cell(s) ka label hai jise woh cover karte hain, toh sab milke koi gap nahi chorte.
| Cell | Kya isko distinct banata hai | Covered by |
|---|---|---|
| A. Shallow depth | Chota (e.g. 5) — registers cycle ka ek chota hissa hain | Ex 1 |
| B. Deep depth | Bada (e.g. 20) — registers bada hissa khaate hain; diminishing returns visible | Ex 2 |
| C. Ratio comparison | ", se kitna better hai?" — woh marginal sawaal | Ex 3 |
| D. Limiting case | — speedup ki hard ceiling | Ex 4 |
| E. Degenerate input | , ya (bilkul pipeline nahi) — sanity anchors | Ex 5 |
| F. Hazards fold in | Branches CPI badhate hain; frequency win partly kha jaati hai | Ex 6 |
| G. Imbalanced stages | "Sirf evenly divide karo" wala trap — longest stage rules | Ex 7 |
| H. Real-world word problem | Pentium 4: frequency upar gaya par net performance flat raha | Ex 8 |
| I. Power / DVFS twist | Dynamic power scaling — exam-style curveball | Ex 9 |
Hum ek baseline machine reuse karte hain jab tak koi cell aur na kahe:
Example 1 — Shallow depth (Cell A)
Forecast: Pehle guess karo — kya speedup ke karib hoga, ya clearly kam? Ek number likho.
- Stage logic delay . Yeh step kyun? Even splitting ka matlab hai har stage ko kaam ka equal share milta hai; woh share hai aur yahi cycle ka useful part set karta hai.
- Cycle time . Yeh step kyun? Ek cycle slowest stage plus next stage mein cross karne ke toll se choti nahi ho sakti — register overhead hamesha pay karna padta hai.
- Frequency . Yeh step kyun? "Ek tick 2.2 ns leti hai" ko "kitne ticks per second" mein convert karte hain; woh ns ko MHz mein badalta hai.
- Speedup . Yeh step kyun? Unpipelined machine har instruction ns mein finish karta hai; pipeline har instruction ns mein finish karta hai jab pipe full ho jaati hai.
Verify: Cycle mein register overhead fraction hai — chota, jaise shallow pipelines ke liye promise kiya tha. Aur , toh hume ideal nahi mila: ns toll ne woh missing kha liya. Sanity: ns ✓.
Example 2 — Deep depth (Cell B)
Forecast: Humne Ex 1 se depth chaar guna badhayi (5→20). Kya speedup bhi tak chaar guna ho jaayega? Guess karo.
- . Kyun? Ab har stage woh kaam karta hai jo par ek-chauthaayi karta tha.
- . Kyun? Same toll (), lekin ab yeh ek choti cycle ka bada hissa hai.
- . Kyun? Ticks/s mein convert karo.
- . Kyun? Unpipelined ke mukable throughput ratio.
Verify: Ab overhead fraction hai — Ex 1 ke se tigunaH zyada. Yahi exactly wajah hai ki 5→20 stages jaana (ek deepening) sirf zyada speedup laya, nahi. Register toll har cycle ka zyada hissa chura raha hai. ✓
Example 3 — Marginal comparison (Cell C)
Forecast: Stages double kiye — kya frequency double ho jaayegi?
- , toh . Kyun? Same recipe.
- . Kyun? Ticks/s.
- . Kyun? Unpipelined ke mukable speedup.
- Ex 1 se ratio: . Yeh step kyun? Yeh depth double karne ka asli payoff hai — woh number jo ek designer actually care karta hai.
Verify: Humne double kiya lekin sirf mila, nahi. Woh missing register toll hai jo apne aap ko assert kar raha hai — aur neeche Figure 1 dikhata hai ki yeh point curve par exactly kahan baithta hai. ✓

Figure 1 padhna (upar ke numbers se jodo): dashed yellow line ideal speedup hai (jo tum paate agar hota, humara Ex 5a result). Solid blue curve hamare formula se real speedup hai. Teen white dots dhundho: par (Ex 1) padhta hai, par (yeh example), par (Ex 2). Blue aur yellow ke beech vertical gap dekho jo daayein jaate waqt badh rahi hai — woh badhta gap register toll hai, aur yahi wajah hai ki marginal ratio ideal se girikar hamare ho gayi. Pink dotted line par Ex 4 ki woh ceiling hai jiske taraf blue curve creep karta hai lekin kabhi touch nahi karta.
Example 4 — The limit (Cell D)
Forecast: Kya speedup hamesha badhta rehta hai, ya ek wall se takraata hai? Woh number kya hai?
- se shuru karo. Kyun? Yeh hamaara exact formula hai — abhi koi approximation nahi.
- Jab , term . Yeh step kyun? Ek fixed ko bade se divide karne par woh zero ki taraf shrink hota hai — har stage ka useful kaam gayab ho jaata hai.
- Toh . Kyun? Logic term gayab hone ke baad, sirf toll denominator mein bachta hai, aur woh ek fixed hai.
Verify: Chahe tum kitne bhi stages banao, is machine par tum kabhi beat nahi kar sakte. Bade se check karo: par, , speedup — 50 ki taraf creep kar raha hai lekin kabhi pahunch nahi raha. Figure 1 par yeh pink dotted asymptote hai. Yeh register-limited regime hai jiske baare mein parent note ne warning di thi. ✓
Example 5 — Degenerate inputs (Cell E)
Forecast: (a) mein speedup exactly kya hona chahiye? (b) mein koi speedup hona chahiye?
Case (a):
- . Kyun? Toll bilkul hata do.
- . Yeh step kyun? Zero overhead ke saath, speedup exactly ke barabar hai — woh ideal jo Figure 1 mein dashed yellow line represent karti hai.
Case (b):
- . Kyun? Ek "stage" sabhi logic hold karta hai, phir bhi result latch karne ke liye hum ek register toll pay karte hain.
- . Yeh step kyun? Register add karna lekin splitting nahi karna tumhe unpipelined se thoda slow bana deta hai — ek pure loss.
Verify: (a) confirm karta hai , theoretical best. (b) confirm karta hai kabhi worth it nahi (0.98 < 1) — pipelining tabhi pay karti hai jab aur frequency gain ek-time toll ko outweigh kare. Dono anchors theek behave kar rahe hain. ✓
Example 6 — Hazards fold in (Cell F)
Forecast: Frequency 20 stages par zyada hai. Kya effective speedup bhi hoga? Ya kam?
- Mispredictions per instruction . Kyun? instructions branches hain; unme se mispredicted hain.
- CPI (5-stage) . Yeh step kyun? Har misprediction stages flush karta hai; multiply karo kitni baar hota hai aur base CPI 1 mein add karo.
- CPI (20-stage) . Kyun? Ab instructions har misprediction par flush hote hain — lagbhag zyada dard.
- Effective speedup ratio . Yeh step kyun? Performance ; performances ka ratio = (frequency ratio) × (inverse CPI ratio).
- Compute: . Kyun? ka raw frequency gain khinchkar ho jaata hai kharab CPI ki wajah se.
Verify: Frequency akele ne kaha; hazards ne isse ghaatakar kar diya. CPI penalty () ne frequency win ka lagbhag kha liya. Isliye Branch Prediction accuracy deep pipelines mein life or death hai — dekhein bhi Pipeline Hazards. ✓
Example 7 — Imbalanced stages (Cell G)
Forecast: Average stage ns hai. Kya clock average par run karta hai?
- Sabse lamba stage dhundho. List mein maximum hai. Yeh step kyun? Har stage clock tick se pehle finish hona chahiye; clock slowest worker ka intezaar karta hai, kabhi average ka nahi.
- . Kyun? Longest stage plus fixed register toll.
- . Kyun? Unpipelined ke mukable throughput.
- Balanced Ex 3 se compare karo (). Yeh step kyun? Dikhata hai imbalance kitna costing karta hai.
Verify: Naive even-split ne predict kiya tha; real imbalanced pipeline sirf deliver karta hai — lagbhag ka loss, poori tarah uss ek ns stage ki wajah se. Delays ka sum ab bhi ns hai (average ), phir bhi max hi rule karta hai. Kabhi average mat lo — hamesha max lo. ✓

Figure 2 padhna (upar ke numbers se jodo): har blue bar ek stage ki logic delay hai; -axis stage number hai, -axis delay ns mein hai. Woh akela pink bar stage 4 hai ns par — sabse lamba. par khinchi pink dashed line woh hai jo actually set karti hai ( add karo toh milta hai). Yellow dotted line par average mark karti hai — notice karo yeh pink line ke neeche baithti hai, aur yahi poori baat hai: clock sabse lamba bar maanta hai, toh har chota stage (pink line ke neeche wale sabhi) bacha hua waqt idle rehte hain, use waste karte hain. Woh wasted gap hi wajah hai ki speedup se girikar ho gaya.
Example 8 — Real-world word problem: Pentium 4 (Cell H)
Forecast: zyada frequency — surely faster hoga?
- Performance = . Northwood ke liye: . Kyun? Throughput ticks/s divided by cycles/instruction hai.
- Prescott: . Yeh step kyun? Dono factors exactly se move kiye — ek help karta, ek hurt karta.
- Ratio . Kyun? Gains precisely cancel ho gaye.
Verify: Frequency badhi lekin performance badhi — zero net gain, bilkul wahi jo parent note ne "deep-pipeline wall" kaha tha. Saath hi dynamic power (Ex 9) badh gayi, toh Prescott per watt worse tha. Intel ka jawab: deep pipes ko chhhod ke 14-stage Core design apnaya jisme wider issue (Superscalar Architectures) aur better IPC tha. ✓
Example 9 — Power / DVFS twist (Cell I)
Forecast: Frequency badhi — kya power ki poori kahani bas yahi hai?
- Frequency ratio . Kyun? Examples 2 aur 3 se.
- Power ratio . Yeh step kyun? cancel ho jaata hai (constant rakha); capacitance aur frequency dono multiply hote hain.
- Evaluate: . Toh dynamic power factor se badhti hai. Yeh step kyun? Hum actually numbers multiply karte hain final answer paane ke liye — symbolic nahi chodna.
Verify: Power badhi jabki performance (roughly frequency, ) kam badhi — toh power performance se zyada tezi se badhi (), matlab worse efficiency (zyada watts per instruction). Yahi exactly wajah hai ki real chips neeche laate hain jab stages add karte hain, DVFS use karke; kyunki , thoda voltage drop bahut power recover karta hai. Aur registers mein clock distribution khud ek major power sink hai (Pentium 4 mein 30–40%). ✓
Recall Self-test — answers cover karo
Even 5→20 stages kya speedup ratio deta hai (register-limited)? ::: Lagbhag , nahi (Ex 2 ÷ Ex 1). Baseline machine par absolute speedup ceiling kya hai? ::: (Ex 4). Real register ke saath par speedup kya hai? ::: — unpipelined se thoda worse (Ex 5b). Imbalanced pipeline mein cycle time kya set karta hai? ::: Sabse lamba stage plus , kabhi average nahi (Ex 7). Prescott ka frequency performance kyun deta hai? ::: CPI bhi badhi, gain cancel ho gaya (Ex 8). Ex 9 mein dynamic power kis factor se badhi? ::: , frequency gain se zyada — worse efficiency.
Connections: Instruction Pipelining Basics · Pipeline Hazards · Branch Prediction · Superscalar Architectures · Clock Distribution and Skew · Dynamic Voltage and Frequency Scaling (DVFS) · Pentium 4 vs Core Microarchitecture · 5.2.11 Deep pipelining trade-offs (Hinglish)