6.2.1 · D3 · HinglishGPU Architecture

Worked examplesGPU vs CPU design philosophy

4,345 words20 min read↑ Read in English

6.2.1 · D3 · Hardware › GPU Architecture › GPU vs CPU design philosophy

Yeh page GPU vs CPU design philosophy ki drill ground hai. Parent note ne tumhe bataya tha kyun CPUs latency ke peeche bhagte hain (ek kaam jaldi khatam karo) aur GPUs throughput ke peeche (ek second mein zyada se zyada kaam khatam karo). Yahan hum us idea ko har tarah ke workload ke saath takrate hain — jinmein GPU mileage laita hai, jinmein woh haarta hai, aur beech ke tricky edge cases.

Koi bhi number dekhne se pehle, poora battlefield samajh lete hain.

The scenario matrix

Har workload ko neeche diye gaye cell mein se ek mein daalo. Agar tum kisi nayi problem ko kisi cell mein classify kar sako, toh arithmetic karne se pehle hi jaante ho kaun jeega.

Cell Case class Kya cheez ise is class mein daalta hai Winner (expected)
A Massively parallel, independent Millions of tasks, koi task doosre par depend nahin karta GPU (big)
B Strictly sequential Har step ko pichle step ka result chahiye CPU
C Zero / degenerate size Bahut kam kaam () CPU (launch cost matters)
D Limiting case Task count badhta jaata hai bina ruke GPU (ratio → core ratio)
E Branch divergence Parallel hai lekin threads alag paths lete hain GPU, but degraded
F Memory-latency bound Bahut saari slow DRAM reads, thoda sa compute GPU (hides latency)
G Partly parallel (Amdahl) Ek serial fraction parallelize hone se mana karta hai Capped — dekho 9.1.02-Amdahls-law
H Real-world word problem Ek described situation, tumhe classify karna hai Story se decide karo
I Exam twist Ek cell jaisa lagta hai, actually doosra hai Dhyan se padho!

Neeche, har symbol wahi hai jo parent ke do performance models mein tha. Unhe dobara anchor karte hain taaki yeh page apne aap mein poori ho.

Recall The two formulas we will keep using

CPU (latency model): ek thread ke liye time, = instructions ki sankhya, = ek clock tick mein kitne instructions finish hote hain, = ticks per second. GPU (throughput model): saare tasks ke liye total time jo cores par spread hain, = fraction of cores jo busy hain, = cycles per instruction (ek GPU core ko ek CPU core se zyada clock ticks chahiye ek instruction ke liye — isliye hum isko se divide karne ke baad multiply karte hain).

Ab examples. Steps padhne se pehle winner guess karo.


Figure padho: left panel mein CPU ke magenta tiles hain, har ek par "625k" stamp hai — kuch cores bade bade slices khaa rahe hain. Right panel mein chote cores ka ek dense violet grid hai, har ek ke paas kaam ka ek chhota sa tukda. Orange caption "" bilkul step 5 hai: dono taraf ke tiles gino, ratio lo.

Figure — GPU vs CPU design philosophy



Figure padho: magenta curve actual speedup hai jaise log axis par badhta hai — yeh dotted "break-even" line se neeche shuru hota hai (CPU jeetta hai, step 2 ka small- region), ke paas orange dot par cross karta hai, phir chadhta hai aur step 4 ki violet dashed "" ceiling ki taraf flatten ho jaata hai. Yeh flattening hi limit ka visible roop hai.

Figure — GPU vs CPU design philosophy



Figure padho: teen curves (magenta , violet , orange ) sab processors badhne ke saath chadhti hain lekin har ek apni dashed ceiling = , , par flatten ho jaati hai. Serial slice jitni chhoti, ceiling utni unchi — lekin har curve badhna band ho jaati hai. Woh plateau step 3 ka visible roop hai.

Figure — GPU vs CPU design philosophy



Recall Rapid self-test (answers chhupa lo)

Independence bahut saare cores use karne ki permission hai ::: Iske bina tum ek core par stuck ho (cell B). GPU bade par bahut jeetta hai lekin uski speedup ceiling hai ::: core ratio (Ex. 1: ; Ex. 4 slower cores ke saath: ). Tiny wala kaam ::: CPU par fast chalta hai, kyunki GPU launch overhead () kaam ko dwarf karta hai (cell C). Warp divergence with 2 equal paths ka cost hai ::: (paths serialize hote hain; general: paths × path-length). serial code ke saath max speedup kabhi bhi ho sakta hai ::: by Amdahl (), chahe kitne bhi cores hon. GPU memory-bound blur par CPU ko harata hai ::: latency doosre warps ke peeche hide karke (latency ÷ overlapping cores = effective cost). Occupancy model mein enter karta hai cores ko shrink karke ::: (Ex. 7); pure penalty , jaise . Ek word problem solve karne ke liye poochho ::: "independent AND many?" — payroll → CPU, 2M particles → GPU (Ex. 8). Prefix sum parallel lagta hai lekin secretly hai ::: ek dependency chain (cell I); ek parallel scan ise stages tak cut karta hai.


Next: parent GPU vs CPU design philosophy aur 6.2.01 GPU vs CPU design philosophy (Hinglish) version dobara dekho, phir Example 5 ke peeche divergence machinery ke liye 6.3.01-SIMD-vs-SIMT mein jaao.