View Full Document

2 views

Unformatted text preview:

CMU 18 447 S 10 L12 1 2010 J C Hoe J F Mart nez 18 447 Lecture 12 Branch Prediction James C Hoe Dept of ECE CMU February 24 2010 Announcements 1 week to Spring break L b2 due Lab2 d this thi weekk Lab3 starts next week Handouts Control Speculation PC 4 Insth Insti Instj Instk Instl t0 t1 IFPC ID IFPC 4 Insth is a branch t2 t3 t4 CMU 18 447 S 10 L12 2 2010 J C Hoe J F Mart nez t5 ALU MEM ID ALU IFPC 8 ID firstIFopportunity to decode Insth target should we correct now Insth branch condition and target evaluated in ALU When a branch resolves branch target Instk is fetched all instructions fetched since insth so called wrong path instructions must be flushed Performance Impact correct guess no penalty incorrect guess 2 bubbles Assume CMU 18 447 S 10 L12 3 2010 J C Hoe J F Mart nez 86 of the time no data hazards 20 control flow instructions 70 of control flow instructions are taken IPC 1 1 0 20 0 7 2 1 1 0 14 2 1 1 28 0 78 probability of a wrong guess penalty for a wrong guess Can we reduce either of the two penalty terms Making a Better Guess CMU 18 447 S 10 L12 4 2010 J C Hoe J F Mart nez For ALU instructions can t do better than guessing nextPC PC 4 still ill tricky i k since i must guess nextPC PC before b f the h current instruction is fetched For Branch Jump instructions why not always guess in the taken direction since 70 correct again must guess nextPC before the branch instruction is fetched but branch target is encoded in the instruction Must make a guess based only on the current fetch PC Fortunately PC offset branch jump target is static We are allowed to be wrong some of the time CMU 18 447 S 10 L12 5 2010 J C Hoe J F Mart nez Branch Target Buffer Oracle BTB Oracle a giant table indexed by PC returns the guess for nextPC BTB When encountering a PC for the first time store in BTB PC 4 PC offset PC Instruction Memory if ALU LD ST if Branch or Jump if JR Effectively guessing branches are always taken IPC 1 1 0 20 0 3 2 0 89 PC BTB Reality CMU 18 447 S 10 L12 6



Access the best Study Guides, Lecture Notes and Practice Exams

Loading Unlocking...
Login

Join to view Branch Prediction and access 3M+ class-specific study document.

or
We will never post anything without your permission.
Don't have an account?
Sign Up

Join to view Branch Prediction and access 3M+ class-specific study document.

or

By creating an account you agree to our Privacy Policy and Terms Of Use

Already a member?