5.2.11 · D5 · HinglishProcessor Datapath & Pipelining

Question bankDeep pipelining trade-offs

2,360 words11 min read↑ Read in English

5.2.11 · D5 · Hardware › Processor Datapath & Pipelining › Deep pipelining trade-offs

Yeh ek concept-trap question bank hai parent topic ke liye. Neeche har item ek one-line reveal hai: prompt padho, apne dimaag mein jawab sochho, phir dekhlo. Goal arithmetic nahi hai (woh worked-example pages mein hai) — balki woh galat intuitions pakadna hai jo deep pipelining chup-chaap invite karta hai.

Shuru karne se pehle, woh kuch symbols jinhe hum baar baar use karte hain, simple language mein:

  • Stage — assembly line par ek work-station; ek instruction ek clock tick mein ek stage mein rehta hai.
  • (un-pipelined total logic delay) — woh time jitna lagta hai instruction ka saara combinational kaam ek lambe block mein karne mein, stages mein kaatne se pehle. Isse poori pizza-making ka time samjho end to end, bina kisi hand-off ke.
  • — stages ki sankhya jisme hum ko kaatthe hain.
  • (per-stage logic delay) — ek stage mein bacha combinational kaam. Agar hum ko evenly split karein, toh ; jab emphasise karna ho ki yeh sirf logic hai, register cost nahi, tab hum bhi likhte hain.
  • (register overhead) — stages ke beech kaam handover karne ka fixed per-stage tax: .
  • Cycle time () — ek tick kitni der chalti hai, jo slowest stage ki logic plus us overhead se set hoti hai: .
  • (clock frequency) — ek second mein kitni ticks hoti hain; yeh sirf cycle time ka ulta hai, . Chhota cycle matlab bada .
  • CPI — cycles per instruction; kitni ticks, average mein, har instruction actually cost karti hai jab stalls aur flushes count ho jaate hain.
  • IPC (instructions per cycle) — CPI ka doosra pehlu, ; kitna useful kaam har tick mein complete hota hai. Deep pipelines badhate hain lekin IPC girate hain.
  • Throughput — real delivered performance, ke barabar (ya ). aur CPI dono matter karte hain, yehi is page ka poora moral hai.
  • (load capacitance) aur (supply voltage) — dynamic-power law mein, woh electrical charge hai jo circuit ko har switch par swing karna padta hai (zyada registers matlab zyada ) aur woh voltage hai jis par woh swing karta hai.

Figure 1 (neeche) woh speedup curve plot karta hai. Apni ungli se trace karo: magenta line chhote par tezi se chadhti hai, phir modti hai aur violet dashed ceiling ko hug karti hai, jabki orange dotted "ideal" line (woh fantasy jahan ) hamesha chadhti rehti hai. Magenta aur orange ke beech ka gap hi register tax hai. Is page par har "diminishing returns" wala jawab actually usi bend ko point kar raha hai.

Figure — Deep pipelining trade-offs

Figure 2 (neeche) story ka doosra aadha dikhata hai. Har bar woh instructions ki sankhya hai jo ek galat branch guess throw away karta hai — height . Dekho yeh seedhi line ki tarah badhta hai: 5 stages par 4 flush, 31 par 30. Frequency (Figure 1) deta hai, hazards (Figure 2) waapis lete hain — aur lena depth ke saath tezi se badhta jaata hai.

Figure — Deep pipelining trade-offs

True or false — justify

A 20-stage pipeline runs 4× faster than a 5-stage one at the same logic
False — frequency tabhi badhti hai jab slowest stage 4× shrink kare, aur register overhead ek fixed tax hai jo stages ke patla hone par zyada share khaata hai, toh speedup 4× se kaafi kam rehta hai (yahi Figure 1 mein bend hai).
Making each stage do less work always shortens the clock period
False — yeh logic wala part toh shortens karta hai, lekin wahin rehta hai, toh jab tiny ho jaata hai toh period shrink karna band ho jaata hai (register-limited regime — Figure 1 ka flat part).
The purely analytical model says "deeper is always better"
True — cycle-time function ko ke respect mein differentiate karne par milta hai, jo hamesha negative hai, toh period girta rehta hai; model isliye galat hai kyunki woh hazards aur power ignore karta hai, math galat hai isliye nahi.
Branch misprediction penalty is a fixed 4 cycles regardless of depth
False — penalty roughly cycles hoti hai kyunki tum branch ke peeche fetch ki gayi har instruction flush karte ho; ek 20-stage pipeline ~19 throw away karta hai, ek 31-stage wala ~30 (yahi Figure 2 ki seedhi climb hai).
Doubling frequency doubles throughput, all else equal
True as a principle — throughput hai, toh agar CPI fixed rakha jaaye, double karne se woh double hoti hai; trap yeh hai ki deep pipelining shayad hi CPI ko fixed rakhti hai (zyada stalls aur flushes CPI upar push karte hain), toh practice mein doubling partly cancel ho jaati hai.
Adding pipeline registers costs power even when the pipeline is idle
True — clock network ko phir bhi saare register banks ko har tick toggle karna padta hai, isliye Pentium 4 apna 30–40% power sirf clock distribute karne mein lagata tha.
Perfect stage balance is achievable if you just divide the logic evenly
False — kuch operations atomic hote hain (ek cache access, ek TLB lookup) jo beech mein nahi kaate ja sakte, toh real stage delays uneven hote hain aur sabse lamba wala clock set karta hai.
Higher clock frequency alone made Pentium 4 Prescott faster than Northwood
False — frequency ~1.5× badhi lekin CPI bhi ~1.5× worsened longer misprediction penalty se, toh per-clock performance ~1.0× par aa gayi — essentially flat.
With perfect branch prediction, deep pipelining has no downside
False — 100% prediction par bhi tum register overhead, stage-imbalance waste, aur quadratically-scaling clock/register power pay karte ho.
The register overhead includes clock skew
True — ; skew registers ke across clock edge ki arrival-time mismatch hai, ek real fixed cost jo har stage ko budget karni padti hai.

Spot the error

"10 ns logic split into 10 stages gives exactly 1 ns cycle time."
Error — ns aur ke saath logic per stage ns hai, lekin cycle hai; saath hi real logic das equal 1 ns pieces mein split nahi hogi, toh sabse lamba stage govern karta hai.
"Deeper pipelines are always slower because hazards dominate."
Error — deeper pipelines aksar frequency badhate hain; net slower hain ya nahi yeh is par depend karta hai ki CPI penalty frequency gain se zyada hai ya kam, jo ek trade-off hai, guarantee nahi.
"Speedup from a -stage pipeline approaches as ."
Error — even splitting ke saath, ek fixed ceiling approach karta hai jo register delay se set hoti hai, se nahi (Figure 1 mein magenta orange se bend ho kar door jaati hai).
"A data hazard in a 31-stage pipeline is the same 1–2 cycle stall as in a 5-stage one."
Error — ek operand kai zyada stages downstream tak ready nahi ho sakta, toh bypassing zyada complex ho jaata hai aur residual stalls badhte hain; 1–2 cycle figure ek 5-stage artifact hai.
"Reducing voltage cancels the extra power of a deeper pipeline entirely."
Error — dynamic-power law mein (jahan = load capacitance, = supply voltage), kam karna help karta hai, lekin added registers badhate hain aur higher badhata hai, toh yeh sirf partly offset karta hai genuinely larger power draw ko — ko ke against trade karne ki technique DVFS hai, Dynamic Voltage and Frequency Scaling, jo Dynamic Voltage and Frequency Scaling (DVFS) mein cover ki gayi hai.
"CPI of 1 means the pipeline is optimal."
Error — CPI cycles per instruction count karta hai lekin yeh ignore karta hai ki har cycle kitni lambi hai; ek slow, low-CPI design ek fast, higher-CPI wale se haar sakta hai kyunki performance hai.
"Forwarding paths grow linearly with pipeline depth."
Error — potential source-to-destination bypasses ki sankhya ki tarah scale hoti hai, jo ek bada reason hai ki deep pipelines verify karna mushkil hota hai.

Why questions

Why does register overhead cap the speedup instead of hazards, in the idealized model?
Kyunki ideal model assume karta hai ki koi hazards nahi aur perfect balance hai, isliye sirf surviving fixed cost hai — toh jab badhta hai logic term vanish ho jaata hai aur curve Figure 1 mein violet ceiling par flatten ho jaati hai; hazards sirf realistic model mein enter karte hain.
Why did Intel abandon the deep-pipeline path for the Core architecture?
Kyunki Prescott ne "deep-pipeline wall" hit ki jo tum dono figures ko ek saath padh kar dekh sakte ho — Figure 1 ke frequency gains flat ho gaye the jabki Figure 2 ka flush penalty ~30 tak balloon ho gaya, toh falling IPC plus ~115 W power ne near-zero net gain diya; Core shallower (~14 stages) lekin wider gayi IPC badhane ke liye — dekho Pentium 4 vs Core Microarchitecture.
Why does a deeper pipeline make Branch Prediction more important, not less?
Kyunki misprediction penalty Figure 2 mein bar ki height () hai, har galat guess depth badhne par bahut zyada cost karta hai, toh same accuracy chup-chaap zyada throughput lose karne lagti hai — better prediction sirf aage khade rehne ke liye chahiye hoti hai.
Why do memory stages resist being sliced thinner?
Kyunki ek cache ya TLB access atomic aur variable-latency hoti hai (hit aur miss mein bahut alag time lagta hai); tum access ke beech mein pause nahi kar sakte, toh woh stage ek hard floor banata hai ki stage kitni short ho sakti hai, Figure 1 par tum kitna right travel kar sakte ho yeh cap karta hai.
Why is "more stages = higher IPC" the wrong expectation?
Kyunki extra stages frequency badhate hain (, Figure 1), IPC nahi; IPC aksar depth ke saath girta hai jab growing flush penalty (Figure 2) aur extra stalls CPI ko upar push karte hain — exactly wahi jo Prescott ka IPC ~1.5 se ~1.0 tak le gaya.
Why does the clock network dominate power in very deep pipelines?
Kyunki register banks mein se har ek ko high par har cycle clock kiya jaata hai, toh mein capacitance (zyada registers) aur dono saath badhte hain — dekho Clock Distribution and Skew.
Why can a superscalar design beat a deeper scalar one at the same frequency?
Kyunki ek cycle mein kai instructions issue karna CPI ko directly attack karta hai (IPC badhata hai, har tick mein zyada useful kaam), jabki pipe ko deep karna attack karta hai jabki CPI kharaab karta hai — often balance mein ek better trade.

Edge cases

What happens to speedup when ?
Tab aur exactly — yahi Figure 1 mein orange dotted "ideal" line hai jo kabhi nahi modti — isliye woh single term hai jo real (magenta) curve ko uski ceiling ki taraf kheenchta hai.
What is the pipeline period when logic delay ?
Yeh par flatten ho jaata hai — register-limited regime, Figure 1 ka flat right end — toh zyada stages add karne se essentially kuch nahi milta.
For a 2-stage pipeline () versus un-pipelined, does the formula still show a gain?
Haan — , jo 1 se upar hai jab bhi ; lekin note karo ki ek "1-stage pipeline" () sirf un-pipelined logic plus ek register hai, toh woh thoda slow hai — pipelining tabhi pay karti hai jab .
If branch prediction were perfect (100%), does the control-hazard penalty vanish for any ?
Haan, misprediction term (Figure 2 ke bars) depth se regardless zero ho jaati hai — lekin data hazards, stage imbalance, aur register/power costs rehte hain, toh depth ki phir bhi limits hain.
Where does the empirical sweet spot –15 come from?
Yeh wahan hai jahan dono figures importance mein cross karte hain: –15 tak Figure 1 ka frequency curve apna zyaadatar 2–3× gain capture kar chuka hota hai (register overhead cycle ka tolerable ~10–20% hai), jabki Figure 2 ka flush penalty abhi itna chhota hai ki ek 95%+ predictor CPI ko check mein rakh sakta hai — isse aage jaao toh hazard/power costs, flattening frequency benefit se tez badhte hain, toh measured throughput turn over kar leta hai. Yeh real designs ka ek empirical balance hai, clean closed-form root nahi.
What throughput trend appears as grows past that sweet spot?
Frequency gains flatten ho jaate hain (Figure 1 ki ceiling) jabki hazard penalties badhti rehti hain (Figure 2 ki seedhi line), toh throughput peak karta hai aur phir decrease hota hai — diminishing-then-negative returns region.
Recall Fastest gut-check

Real performance ==throughput == hai (jahan clock frequency hai), sirf nahi — deep pipelining hamesha numerator badhata hai lekin aksar denominator bhi badhata hai, aur register overhead cap karta hai ki numerator kitna ja sakta hai via .