已阅读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. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 第6单元-演唱《海鸥》教案-2026-2027学年粤教花城版(新版)小学音乐六年级上册
- 九年级上册数学期中压轴专题01选填题分类训练 人教版12种类型60道 压轴题专项 解析版含答案详解
- 2025软考-初级网络管理员必背考点题及答案
- 2025放射技师X线摄影强化训练题及答案
- 2025初级护师相关专业知识综合演练及答案
- 2025临床检验技师临床生化检验考点速记题及答案
- 钢桁架焊接预热范围方案
- 塔吊基础浇筑及预埋施工工艺
- 顶管后背墙施工技术交底规范
- 关于项目延期的回复商洽函3篇
- 2026年家庭医生签约培训考试试题(附答案)
- 小学数学二年级上册《8的乘法口诀》课件
- C1科目一全真模拟考试题(含详细答案解析)
- T/TMAC 214-2025电子驻车制动系统(EPB)技术要求
- 《打造非遗文化视觉盛宴-网站的制作与美化》教学设计-2026-2027学年粤教版(新版)初中信息科技七年级全一册
- 267道英文字母专项测试题(含详细答案)
- 第9课 特殊关爱 助我成长 第2课时 课件(内嵌视频)2026-2027学年道德与法治六年级上册统编版
- 工厂化学品火灾应急演练脚本
- 近来被公开报道的起重大医院感染事件
- 苏TZG 01-2026 江苏省预应力混凝土空心方桩图则
- 2026年四川省拟任县处级领导干部理论(任职资格考试)全真模拟试题及答案
评论
0/150
提交评论