高级计算机体系结构设计及其在数据中心和云计算的应用Reducing Fetch Fragmentation (1/2)· Make |Fetch Group| < | L1-I LinelPCAInstInstInstInstTagInstInstInstInstInstInstInstInstDecoderCacheLineTagInstInstInistInist6InstInstInstInistTagInstInstInstInstCan deliverNinsns.when PC>N fromend of line
高级计算机体系结构设计及其在数据中心和云计算的应用 Reducing Fetch Fragmentation (1/2) • Make |Fetch Group| < |L1-I Line| Decoder Tag Inst Inst Inst Inst Inst Inst Inst Inst Tag Inst Inst Inst Inst Inst Inst Inst Inst Cache Line PC Decoder Tag Inst Inst Inst Inst Inst Inst Inst Inst Can deliver N insns. when PC > N from end of line
高级计算机体系结构设计及其在数据中心和云计算的应用Reducing Fetch Fragmentation (2/2) Needs a “rotator"to decode insns.in correct orderPCInstInstInstInstTagInstInstInstInstInstInstInstInstDecoderTagInstInstInistInstInstInstInstInstTagInistInistInstInistRoxaterInstInstInstInstAligned fetch group
高级计算机体系结构设计及其在数据中心和云计算的应用 Reducing Fetch Fragmentation (2/2) • Needs a “rotator” to decode insns. in correct order Decoder Tag Inst Inst Inst Inst Inst Inst Inst Inst Tag Inst Inst Inst Inst Inst Inst Inst Inst PC Decoder Tag Inst Inst Inst Inst Inst Inst Inst Inst Rotator Inst Inst Inst Inst Aligned fetch group
高级计算机体系结构设计及其在数据中心和云计算的应用Fragmentation due to Branches Fetch group is aligned, cache line size > fetch group- Taken branches still limit fetch widthTagInstInstInstInstTagInstBranchInstInstTagInstInstInistInstDecoderTagInistInstInstInstTagInlstInstIn'stInstxx
高级计算机体系结构设计及其在数据中心和云计算的应用 Fragmentation due to Branches • Fetch group is aligned, cache line size > fetch group – Taken branches still limit fetch width Decoder Tag Inst Inst Inst Inst Tag Inst Branch Inst Tag Inst Inst Inst Inst Inst Decoder Tag Inst Inst Inst Inst Tag Inst Inst Inst Inst X X
高级计算机体系结构设计及其在数据中心和云计算的应用Types of BranchesDirection:-Conditionalvs.UnconditionalTarget:-PC-encoded·PC-relative.Absolute offset-Computed(targetderivedfromregister)Need direction and target to find next fetch group
高级计算机体系结构设计及其在数据中心和云计算的应用 Types of Branches • Direction: – Conditional vs. Unconditional • Target: – PC-encoded • PC-relative • Absolute offset – Computed (target derived from register) Need direction and target to find next fetch group
高级计算机体系结构设计及其在数据中心和云计算的应用Branch Prediction OverviewUsetwohardwarepredictors-Directionpredictorguesses if branchistaken or not-taken Target predictor guesses the destination PCPredictions are based on history-Usepreviousbehaviorasindicationoffuturebehavior-Use historical context to disambiguate predictions
高级计算机体系结构设计及其在数据中心和云计算的应用 Branch Prediction Overview • Use two hardware predictors – Direction predictor guesses if branch is taken or not-taken – Target predictor guesses the destination PC • Predictions are based on history – Use previous behavior as indication of future behavior – Use historical context to disambiguate predictions