《高性能处理器》PPT课件.ppt_第1页
《高性能处理器》PPT课件.ppt_第2页
《高性能处理器》PPT课件.ppt_第3页
《高性能处理器》PPT课件.ppt_第4页
《高性能处理器》PPT课件.ppt_第5页
已阅读5页,还剩20页未读, 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

2019/11/30,USTCCSANHong,1,取指和取数都要访问同一个存储器Detectioniseasyinthiscase!(righthalfhighlightmeansread,lefthalfwrite),结构相关:由访存引起的结构相关,2019/11/30,USTCCSANHong,2,取指延迟一拍进行,结构相关的解决方案:阻塞,2019/11/30,USTCCSANHong,3,控制相关:WhatstheProblem?,Needaddresshere,Computeaddresshere,BranchDelay,例:BEQrs,rt,offsetifRrs=RrtthenPC尽快获得转移的目标地址(分支地址相关),2019/11/30,USTCCSANHong,4,Stall:waituntildecisionisclearImpact:2lostcycles(i.e.3clockcyclesperbranchinstruction)=slowMovedecisiontoendofdecodesave1cycleperbranch,ControlHazardSolution#1:Stall,2019/11/30,USTCCSANHong,5,Predict:guessonedirectionthenbackupifwrongImpact:0lostcyclesperbranchinstructionifright,1ifwrong(right50%oftime)Moredynamicscheme:historyof1branch(90%),ControlHazardSolution#2:Predict,2019/11/30,USTCCSANHong,6,DelayedBranch:Redefinebranchbehavior(takesplaceafternextinstruction)Impact:0clockcyclesperbranchinstructionifcanfindinstructiontoputin“slot”(50%oftime)Aslaunchmoreinstructionperclockcycle,lessuseful,ControlHazardSolution#3:DelayedBranch,2019/11/30,USTCCSANHong,7,DataHazardonR1,ReadAfterWrite(RAW)InstrJtriestoreadoperandbeforeInstrIwritesitCausedbya“Dependence”(incompilernomenclature).Thishazardresultsfromanactualneedforcommunication.,2019/11/30,USTCCSANHong,8,addr1,r2,r3,subr4,r1,r3,andr6,r1,r7,orr8,r1,r9,xorr10,r1,r11,DataHazardonr1:Readafterwritehazard(RAW),2019/11/30,USTCCSANHong,9,Instr.Order,Time(clockcycles),addr1,r2,r3,subr4,r1,r3,andr6,r1,r7,orr8,r1,r9,xorr10,r1,r11,IF,ID/RF,EX,MEM,WB,ALU,Im,Reg,Dm,Reg,Reg,Dm,Reg,Reg,Dm,Reg,Im,ALU,Reg,Dm,Reg,DataHazardonr1:Readafterwritehazard(RAW),Dependenciesbackwardsintimearehazards,2019/11/30,USTCCSANHong,10,Instr.Order,Time(clockcycles),addr1,r2,r3,subr4,r1,r3,andr6,r1,r7,orr8,r1,r9,xorr10,r1,r11,IF,ID/RF,EX,MEM,WB,ALU,Im,Reg,Dm,Reg,Reg,Dm,Reg,Reg,Dm,Reg,Im,ALU,Reg,Dm,Reg,DataHazardSolution:Forwarding,“Forward”resultfromonestagetoanother,2019/11/30,USTCCSANHong,11,Reg,Time(clockcycles),lwr1,0(r2),subr4,r1,r3,IF,ID/RF,EX,MEM,WB,ALU,Im,Reg,Dm,Reg,Dm,Reg,Forwarding(orBypassing):WhataboutLoads?,DependenciesbackwardsintimearehazardsDataHazardEvenwithForwardingCantsolvewithforwarding,Mustdelay/stallinstructiondependentonloads,2019/11/30,USTCCSANHong,12,Reg,Time(clockcycles),lwr1,0(r2),subr4,r1,r3,IF,ID/RF,EX,MEM,WB,ALU,Im,Reg,Dm,Stall,Forwarding(orBypassing):WhataboutLoads?,DependenciesbackwardsintimearehazardsDataHazardEvenwithForwardingCantsolvewithforwarding,Mustdelay/stallinstructiondependentonloads,2019/11/30,USTCCSANHong,13,Tryproducingfastcodefora=b+c;d=ef;assuminga,b,c,d,e,andfinmemory.Slowcode:LWRb,bLWRc,cADDRa,Rb,RcSWa,RaLWRe,eLWRf,fSUBRd,Re,RfSWd,Rd,SoftwareSchedulingtoAvoidLoadHazards,Fastcode:LWRb,bLWRc,cLWRe,eADDRa,Rb,RcLWRf,fSWa,RaSUBRd,Re,RfSWd,Rd,Compileroptimizesforperformance.Hardwarechecksforsafety.,2019/11/30,USTCCSANHong,14,DataHazardSolution(3):Out-of-OrderExecution,NeedtodetectdatadependencesatruntimeNeedofpreciseexceptions:Out-of-orderexecution,in-ordercompletion,TimeT1T2T3T4T5T6T7T8T9T10T11T12sub$2,$1,$3IFIDEXMEWBadd$14,$5,$4IFIDEXMEWBsw$15,100($6)IFIDEXMEWBand$12,$2,$3IF*IDEXMEWBor$13,$6,$2IFIDEXMEWB,2019/11/30,USTCCSANHong,15,DataHazardSolution(4):DataSpeculation,Inawide-issueprocessors,e.g.812instructionsperclockcycleLargerthanabasicblock(57instructions)Multiplebranchesusemultiple-branchprediction(e.g.tracecache)MultipledatadependencechainsveryhardtoexecutetheminthesameclockcycleValuespeculationisprimarilyusedtoresolvedatadependences:InthesameclockcycleLonglatencyoperations(e.g.loadoperations),2019/11/30,USTCCSANHong,16,DataHazardSolution(4):DataSpeculation,WhyisSpeculationUseful?Speculationletsalltheseinstructionruninparallelonasuperscalarmachine.addq$3$1$2addq$4$3$1addq$5$3$2WhatisValuePrediction?PredictthevalueofinstructionsbeforetheyareexecutedCp.BranchPredictioneliminatesthecontroldependencesPredictionDataarejusttwovalues(takenornottaken)ValuePredictioneliminatesthedatadependencesPredictionDataaretakenfromamuchlargerrangeofvalues,2019/11/30,USTCCSANHong,17,DataHazardSolution(4):DataSpeculation,ValueLocality:likelihoodofapreviously-seenvaluerecurringrepeatedlywithinastoragelocationObservedinanystoragelocationsRegistersCachememoryMainmemoryMostworkfocussingonvaluestoredinregisterstobreakpotentialdatadependences:registervaluelocalityWhyValuePrediction?Resultsofmanyinstructionscanbeaccuratelypredictedbeforetheyareissuedorexecuted.Dependentinstructionsarenolongerboundbytheserializationconstraintsimposedbydatadependences.Moreparallelismcanbeexplored.Predictionofvaluesfordependantinstructionscanleadtobeneficialspeculativeexecution,2019/11/30,USTCCSANHong,18,冗余指令,若将程序执行期间生成的每条静态指令的动态实例进行缓存,则每条生成结果的动态指令可归为以下三种类型:新结果指令:首次生成新值的动态指令5%重复结果指令:生成结果与对应静态指令的其它动态实例相同的动态指令80%90%可推导型指令:生成结果能用先前的结果推导出来的动态指令5%冗余指令重复型指令和可推导指令,2019/11/30,USTCCSANHong,19,Question:Wheredoesvaluelocalityoccur?,Single-cycleArithmetic(i.e.addq$1$2)Single-cycleLogical(i.ebis$1$2)Multi-cycleArithmetic(i.e.mulq$1$2)RegisterMove(i.e.cmov$1$2)IntegerLoad(i.e.ldq$18($2)StorewithbaseregisterupdateFPMultiplyFPAddFPMoveFPLoad,SomewhatYesNoYesYesNoSomewhatSomewhatYesYes,Howoftendoesthesamevalueresultfromthesameinstructiontwiceinarow?,SourceofValueLocality(Sourcesofvaluepredictability),2019/11/30,USTCCSANHong,20,Dataredundancy:textfileswithwhitespaces,emptycellsinspreadsheetsErrorcheckingProgramconstantsComputedbranchesVirtualfunctioncallsGluecode:allowcallingfromonecompilationunittoanotherAddressability:pointertablesstoreconstantaddressesloadedatruntimeCallcontexts:caller-saved/calleesavedregistersMemoryaliasresolution:conservativeassumptionsfromcompilerregardingaliasingRegisterspillcode,SourceofValueLocality(Sourcesofpredictability),2019/11/30,USTCCSANHong,21,ThreeGenericDataHazards,WriteAfterRead(WAR)InstrJwritesoperandbeforeInstrIreadsitCalledan“anti-dependence”bycompilerwriters.Thisresultsfromreuseofthename“r1”.CanthappeninDLX5stagepipelinebecause:Allinstructionstake5stages,andReadsarealwaysinstage2,andWritesarealwaysinstage5,2019/11/30,USTCCSANHong,22,ThreeGenericDataHazards,WriteAfterWrite(WAW)InstrJwritesoperandbeforeInstrIwritesit.Calledan“outputdependence”bycompilerwritersThisalsoresultsfromthereuseofname“r1”.CanthappeninDLX5stagepipelinebecause:Allinstructionstake5stages,andWritesarealwaysinstage5WillseeWARandWAWinmorecomplicatedpipes,2019/11/30,USTCCSANHong,23,总结:影响指令级并行性的因素,PipelineCPI=IdealpipelineCPI+Structuralstalls+RAWstalls+WARstalls+WAWstalls+Controls

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论