5.3.10 · D1 · HinglishAdvanced Microarchitecture

FoundationsTournament and TAGE predictors

2,299 words10 min read↑ Read in English

5.3.10 · D1 · Hardware › Advanced Microarchitecture › Tournament and TAGE predictors

Parent note Tournament and TAGE predictors padhne se pehle, tumhe usmein aane wala har word aur symbol pata hona chahiye. Yeh page har ek ko scratch se build karta hai — pehle plain words mein, phir picture, phir yeh topic isके bina kyon nahi chal sakta. Upar se neeche padho; har idea uske upar wale pe lean karta hai.


1. Ek branch, aur "taken vs not-taken"

Picture: ek raaste mein fork. Car (processor ka execution flow) fork tak pahunchti hai aur use left ya right jaana hai.

  • Taken (T) = jump hota hai (branching road lo).
  • Not-taken (NT) = agli instruction pe fall through karo (seedha jao).

Outcome-notation, ek stream ki tarah likhi: T, T, T, T, NT matlab ek branch chaar baar taken hua phir ek baar not-taken — exactly waisa jaisa ek loop jo 4 baar run karta hai lagta hai.


2. PC — woh address jo ek branch ko naam deta hai

Picture: raaste mein har fork ke paas ek signpost hai jisme ek unique number thoka hua hai. Tumhare program ke do alag ifs do alag PCs pe baithe hain.

Topic ko isski kyun zaroorat hai: predictors har fork ke past behaviour ka ek notebook rakhte hain. Notebook ka sahi page dhundne ke liye, tum fork ko uske signpost se — uske PC se — lookup karte ho. Jab parent hash(PC) likhta hai, iska matlab hai "is address ko ek chhoti table-row number mein badlo taaki hum iska notebook page jaldi dhundh sakein."


3. GHR — global history register

Picture: ek conveyor belt jo, maan lo, pichhle 8 results hold karti hai. Naya result left se enter karta hai, sabse purana right se gir jaata hai.

Do flavours jo parent use karta hai:

  • Local history — ek alag belt jo sirf ek single branch ke liye rakhi jaati hai (sirf us fork ka apna past T/NT).
  • Global history (GHR)ek shared belt jo har branch ka outcome milaakar record karti hai.

4. Saturating counter — ek guess with confidence

Predictors sirf "T ya NT" store nahi karte. Woh store karte hain kitna sure hain, ek saturating counter use karke.

Ek 2-bit counter ke chaar states hain:

Value Name Predict
00 strongly NT NT
01 weakly NT NT
10 weakly T T
11 strongly T T

Picture: 4 notches wala ek slider. Har T use right nudge karta hai, har NT use left, lekin yeh kisi bhi end se aage nahi jaata.

Parent do counter shapes use karta hai — dono yaad karo:

  • 2-bit unsigned (0..3): selector aur base predictor ke liye use hota hai. Parent ke formula mein min(3, x+1) aur max(0, x-1) bas "count up but don't pass 3, count down but don't pass 0" hain.
  • 3-bit signed (−4..+3): TAGE ka prediction counter. Rule: T predict karo agar value ho, NT agar negative. Same idea, alag numbering.

5. Accuracy, error rate, aur symbols ,

Topic ko isski kyun zaroorat hai: tournament/TAGE ka poora reason ko chhota karna hai. Parent "local 85%, global 87%, tournament 90–93%" jaisi numbers compare karta hai — yeh sab ki values hain.


6. Tables, tags, aur "useful" bit (TAGE vocabulary)

TAGE apne notebooks ko tables ke roop mein store karta hai. Tumhe teen cheezein pata honi chahiye jo ek entry hold karti hai.

Picture: ek filing cabinet. Index drawer number hai; tag woh naam label hai jo tum check karte ho yeh ensure karne ke liye ki tumne apna folder pakda hai na kisi aur ka; counter folder ka content hai; useful bit ek sticky note hai jo kehti hai "mujhe rakho."

Lock karne wale symbols: base (no-history) table hai; tagged tables hain lengths ke saath. Parent ka "longest matching table" simply matlab hai: un sab drawers mein se jinke tag match kiya, woh use karo jiska sabse bada ho — sabse specific memory.


Prerequisite map

Branch: taken or not-taken

PC names each branch

Outcome stream T NT

History belts: local and global GHR

hash to a table row

Saturating counter: guess plus confidence

Selector 2-bit counter

TAGE 3-bit signed counter

Tag plus useful bit per entry

Geometric history lengths

Tournament predictor

TAGE predictor

5.3.10 Tournament and TAGE


Vault mein yeh kahan connect karte hain

  • History-belt idea seedha 5.3.8-Two-level-adaptive-predictors se grow karta hai.
  • Local vs global belts aur PC ko history ke saath hash karna 5.3.9-Gshare-and-local-predictors ka dil hai.
  • Kyon ek galat guess expensive hai yeh 5.4.2-Speculative-execution mein rehta hai aur 5.3.11-Branch-target-bufers ke saath phir se pay kiya jaata hai.
  • Cores mein history share karna 7.2.5-Cache-coherence-and-branch-predictors mein subtle issues raise karta hai.

Equipment checklist

Parent padhne se pehle har ek ka answer do — agar koi stumps kare, toh uska section dobara padho.

Ek branch ke do possible outcomes aur unke letters
Taken (T = jump hota hai) aur Not-taken (NT = fall through); T=1, NT=0.
PC kya identify karta hai
Ek instruction ka unique memory address — yeh naam deta hai kis branch ka hum prediction kar rahe hain.
hash(PC) kis liye hai
Ek bade address ko ek chhoti table-row index mein squash karna taaki hum iska notebook page jaldi dhundh sakein.
Local history vs global history (GHR)
Local = ek single branch ke apne past outcomes ki ek belt; GHR = sab branches ke recent outcomes ki ek shared belt.
ka matlab
Global history belt ke sabse recent bits; yeh hai ki hum kitna peeche dekhte hain.
Counters kyun saturate karte hain
Taaki ek odd outcome ek confident predictor ko flip na kar sake — yeh sirf repeated evidence ke baad switch karta hai.
2-bit counter states aur unki predictions
00 strongly-NT, 01 weakly-NT, 10 weakly-T, 11 strongly-T.
3-bit signed TAGE counter ka rule
Range −4..+3; T predict karo agar value ho, warna NT.
aur ka matlab
Count up but never past 3; count down but never below 0 — yaani saturation.
Accuracy aur error rate kya hain
= sahi guesses ka fraction (0–1); error = .
Ek oracle selector kya achieve karta hai
Hamesha behtar predictor choose karta hai, toh iska error do components ke error rates ka hota hai.
TAGE tagged entry ke teen fields
Tag (collision check), prediction counter (3-bit signed), useful bit (kya yeh entry apna kaam kar rahi hai).
Tag ki zaroorat kyun hai
Alag branches ek hi row mein hash ho sakti hain; tag confirm karta hai ki entry sach mein is branch ki hai.
"Geometric history lengths" ka matlab
Har table ki length pichli se multiply hoti hai (jaise 4,8,16,32), thodi tables ke saath memory depths ki wide range cover karta hai.