Maano ek memory operation L=400 cycles leta hai. Ek SM 1 warp-instruction per cycle issue kar sakta hai (single scheduler ke liye; modern SMs mein 4 schedulers hote hain, lekin simple shuru karte hain).
Goal: Pipeline full rakho—har cycle 1 instruction issue karo.
Problem: Jo warp memory load issue karta hai use result ready hone se pehle L cycles wait karna padta hai.
Solution: Us wait ke dauran issue karne ke liye Ldoosre warp-instructions ready rakho.
Isliye:
Warps needed≥Instructions per Warp per CycleL
Agar har warp scheduled hone par 1 instruction/cycle issue karta hai:
Warps≥L
L=400 cycles ke liye → 1 scheduler ke saath latency fully hide karne ke liye 400 warp-instructions in flight chahiye. 4 schedulers aur pipelined execution wale modern SMs is concurrency ka bahut saara hissa har cycle supply karte hain. Practice mein, 16-32 active warps zyaadatar kernels ke liye kaafi hote hain kyunki:
Har warp mein multiple instructions in flight (ILP)
Compute aur memory ops ka mix
4 schedulers consecutive cycles mein alag-alag warps se issue karte hain (SM-wide MLP)
32 threads per warp kyun?
Historical reason: SIMD width hardware complexity vs. parallelism ko balance karta hai. 32 lanes matlab 32-wide vector ALUs, jo transistor budgets aur memory coalescing patterns mein fit hote hain (cache lines 128B = 32× 4-byte floats hoti hain).
Socho tum homework kar rahe ho. Har question padne mein 2 minute lagte hain, solve karne mein 10 second. Agar sirf 1 question hai, toh tum 2 minute idle baithe rehte ho uska wait karte. Boring!
Lekin agar 12 questions hain, toh tum Question 1 padhte ho, phir jab book Question 2 "load" kar rahi hoti hai, tum Question 1 solve karte ho. Tum kabhi wait nahi karte—hamesha kuch na kuch karte rehte ho. (Question 1 padhne mein phir bhi poore 2 minute lagte hain—tum bas us time ko doosre kaam se bharte ho, book ko faster load nahi karte.)
GPU ke paas 1000 questions aur 1000 brains hone jaisa hai. Har brain (thread) ek question pakadta hai. Jab ek brain "book" (memory) load hone ka wait karta hai, 999 doosre solve karte rehte hain. Jab tak tum cycle back karte ho, pehle brain ki book ready hoti hai.
Occupancy hai: "Tumhare kitne brains busy hain?" Agar 1000 mein se 500 brains ke paas questions hain, occupancy 50% hai. Jitne zyada busy brains, utna kam waiting.
SM par active warps aur maximum possible warps ka ratio, usually percentage mein express kiya jaata hai (jaise 32/64 = 50%).
High occupancy latency kyun hide karta hai?
Kaafi saare active warps ke saath, warp scheduler hamesha ek ready warp execute karne ke liye dhundh sakta hai jab doosre memory ya ALU results ka wait kar rahe hote hain, stalls eliminate ho jaate hain.
Occupancy limit karne wale teen main factors kya hain?
(1) Registers per thread, (2) Shared memory per block, (3) Maximum blocks per SM. Occupancy in constraints ka minimum hoti hai.
Kya warps add karne se single memory load ki latency kam hoti hai?
Nahi. Concurrency (Little's Law) tumhe kaafi saare loads overlap karne deti hai taaki SM idle na ho, lekin har load ki intrinsic ~400-cycle latency unchanged rehti hai.
Little's Law se latency hiding requirement derive karo
Latency L cycles hide karne ke liye throughput T ops/cycle par, L×T operations in flight chahiye. 400-cycle memory latency aur 1 warp-instruction/cycle ke liye, ~400 warp-instructions outstanding chahiye (lekin ILP + SM-wide MLP + 4 schedulers distinct warps ko 16-32 tak reduce kar dete hain).
100% occupancy hamesha optimal kyun nahi hota?
~50% ke baad, gains plateau ho jaate hain. High occupancy cache pressure aur register spills badha sakta hai, performance hurt kar sakta hai. Goal zero stalls hai, maximum threads nahi.
A100 ka warps per SM mein maximum occupancy kitna hai?
64 warps/SM (2048 threads, kyunki har warp = 32 threads).
Agar ek kernel A100 (65,536 regs/SM) par 80 registers/thread use kare, toh occupancy kya hogi?
Ek single warp kitne outstanding memory requests sustain karta hai?
Ek time par ek memory instruction (jo uncoalesced hone par kuch transactions mein split ho sakti hai). Concurrency SM-wide kaafi warps mein aati hai, ek warp se 32 independent requests nahi aate.
Nahi. Global stores buffer hote hain aur asynchronously retire hote hain (background mein drain hote hain), isliye tum normally store latency ko critical-path memory time mein nahi jodte.
Low occupancy performance kyun hurt nahi karta?
Jab kernel compute-bound hota hai high instruction-level parallelism (ILP) ke saath, ya jab achieved throughput pehle se hardware saturate kar raha hota hai bawajood kam active warps ke.