constructive computer architecture tutorial 5: overcoming smips scheduling errors andy wright

22
Constructive Computer Architecture Tutorial 5: Overcoming SMIPS Scheduling Errors Andy Wright 6.S195 TA October 7, 2013 http://csg.csail.mit.edu/6.s195 T05-1

Upload: xuan

Post on 24-Feb-2016

48 views

Category:

Documents


0 download

DESCRIPTION

Constructive Computer Architecture Tutorial 5: Overcoming SMIPS Scheduling Errors Andy Wright 6.S195 TA. Introduction. Going to talk about the SMIPS 2 stage pipeline connected by FIFOs In the process of speeding it up, we are going to run into some scheduling errors - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Constructive Computer Architecture Tutorial  5: Overcoming SMIPS Scheduling Errors Andy Wright

Constructive Computer ArchitectureTutorial 5:Overcoming SMIPS Scheduling ErrorsAndy Wright6.S195 TA

October 7, 2013 http://csg.csail.mit.edu/6.s195 T05-1

Page 2: Constructive Computer Architecture Tutorial  5: Overcoming SMIPS Scheduling Errors Andy Wright

IntroductionGoing to talk about the SMIPS 2 stage pipeline connected by FIFOsIn the process of speeding it up, we are going to run into some scheduling errors To learn more about these errors we are going

to use tools built into the Bluespec GUIAfter we know where the scheduling errors are coming from, we are going to fix themFixing these scheduling errors will be very relevant to lab5!

October 7, 2013 T05-2http://csg.csail.mit.edu/6.s195

Page 3: Constructive Computer Architecture Tutorial  5: Overcoming SMIPS Scheduling Errors Andy Wright

SMIPS Fetch/Execute Division

Two rules connected by fifos.Not very fast, but can be sped up with a few additions.

October 7, 2013 T05-3http://csg.csail.mit.edu/6.s195

doFetch doExecute

d2e

redirectRegister File

Scoreboardremovesearch insert

wrrd1 rd2

Page 4: Constructive Computer Architecture Tutorial  5: Overcoming SMIPS Scheduling Errors Andy Wright

SMIPS 2 Cycle PipelineTwo sources of slowdowns: Control hazards

Branch misprediction Seen in Lab 4 Can be sped up with bypass redirect fifo

or a better branch predictor Read after write (RAW) hazards

Scoreboard forces stalling Can be sped up with a bypass register file

October 7, 2013 T05-4http://csg.csail.mit.edu/6.s195

Page 5: Constructive Computer Architecture Tutorial  5: Overcoming SMIPS Scheduling Errors Andy Wright

SMIPS Example – RAW

reg1 <- reg2 + 13

reg2 <- reg1 - 1

October 7, 2013 T05-5http://csg.csail.mit.edu/6.s195

doFetch doExecute

d2e

redirect … Register File

Scoreboardremovesearch insert

wrrd1 rd21 2

Page 6: Constructive Computer Architecture Tutorial  5: Overcoming SMIPS Scheduling Errors Andy Wright

SMIPS Example – Cycle 1

October 7, 2013 T05-6http://csg.csail.mit.edu/6.s195

doFetch doExecute

d2e

redirect … Register File

Scoreboardremovesearch insert

wrrd1 rd21 2

reg1 <- reg2 + 13

reg1 <- reg2 + 13

reg2 <- reg1 - 1 2

1

Page 7: Constructive Computer Architecture Tutorial  5: Overcoming SMIPS Scheduling Errors Andy Wright

SMIPS Example – Cycle 2

October 7, 2013 T05-7http://csg.csail.mit.edu/6.s195

doFetch doExecute

d2e

redirect … Register File

Scoreboardremovesearch insert

wrrd1 rd21 2

reg1 <- reg2 + 13

reg1 <- reg2 + 13

reg2 <- reg1 - 1 2

1

1

reg2 <- reg1 – 1

Stall due to Scoreboard!

Page 8: Constructive Computer Architecture Tutorial  5: Overcoming SMIPS Scheduling Errors Andy Wright

SMIPS Example – Cycle 3

October 7, 2013 T05-8http://csg.csail.mit.edu/6.s195

doFetch doExecute

d2e

redirect … Register File

Scoreboardremovesearch insert

wrrd1 rd21 2

reg1 <- reg2 + 13

reg2 <- reg1 - 1

reg2 <- reg1 – 1

Now this instruction is free to execute

Page 9: Constructive Computer Architecture Tutorial  5: Overcoming SMIPS Scheduling Errors Andy Wright

SMIPS Example – Cycle 3

October 7, 2013 T05-9http://csg.csail.mit.edu/6.s195

doFetch doExecute

d2e

redirect … Register File

Scoreboardremovesearch insert

wrrd1 rd21 2

reg1 <- reg2 + 13

reg2 <- reg1 - 1

reg2 <- reg1 – 1

2

1

Page 10: Constructive Computer Architecture Tutorial  5: Overcoming SMIPS Scheduling Errors Andy Wright

SMIPS Example – Cycle 4

October 7, 2013 T05-10http://csg.csail.mit.edu/6.s195

doFetch doExecute

d2e

redirect … Register File

Scoreboardremovesearch insert

wrrd1 rd21 2

reg1 <- reg2 + 13

reg2 <- reg1 - 1

reg2 <- reg1 – 1

2

1

2

Page 11: Constructive Computer Architecture Tutorial  5: Overcoming SMIPS Scheduling Errors Andy Wright

SMIPS Example – Cycle 5

October 7, 2013 T05-11http://csg.csail.mit.edu/6.s195

doFetch doExecute

d2e

redirect … Register File

Scoreboardremovesearch insert

wrrd1 rd21 2

reg1 <- reg2 + 13

reg2 <- reg1 - 1

Page 12: Constructive Computer Architecture Tutorial  5: Overcoming SMIPS Scheduling Errors Andy Wright

Processor Enhancements2 candidates: Bypass register file

Reduces RAW hazard penalty, but it introduces a long combinational path

Bypass redirect fifo Reduces misprediction penalty without

increasing the critical path significantlyBypass redirect fifo is a good first step, so lets start there.

October 7, 2013 T05-12http://csg.csail.mit.edu/6.s195

Page 13: Constructive Computer Architecture Tutorial  5: Overcoming SMIPS Scheduling Errors Andy Wright

Variation 1 – Before improvements

Standard CF fifos used for fetch to execute fifo and redirect fifo

Results from simulation can be found in the orig folder in the included code

October 7, 2013 T05-13http://csg.csail.mit.edu/6.s195

Page 14: Constructive Computer Architecture Tutorial  5: Overcoming SMIPS Scheduling Errors Andy Wright

Variation 1 - ResultsLooking at smips.out No scheduling warnings Between 0.5 and 1.0 IPC On average, 1 to 2 cycles per

instructionLooking at simOut Long misprediction penalty Fetch and Execute fire at the same time

October 7, 2013 T05-14http://csg.csail.mit.edu/6.s195

Page 15: Constructive Computer Architecture Tutorial  5: Overcoming SMIPS Scheduling Errors Andy Wright

Variation 2 – Shorter Misprediction Penalty?

This uses a bypass fifo for the redirect fifo in an attempt to reduce the misprediction penalty by a cycle.

Results from simulation can be found in the bad folder in the included code

October 7, 2013 T05-15http://csg.csail.mit.edu/6.s195

Page 16: Constructive Computer Architecture Tutorial  5: Overcoming SMIPS Scheduling Errors Andy Wright

Variation 2 - ResultsLooking at smips.out No scheduling warnings Less than 0.5 IPC More than 2 cycles per instruction on

averageLooking at simOut Same misprediction penalty Fetch and Execute don’t fire in the same

cycle

October 7, 2013 T05-16http://csg.csail.mit.edu/6.s195

Page 17: Constructive Computer Architecture Tutorial  5: Overcoming SMIPS Scheduling Errors Andy Wright

Scheduling AnalysisLook at scheduling analysis presentation to see how to use the Bluespec gui to get some additional scheduling information from the compiler.

October 7, 2013 T05-17http://csg.csail.mit.edu/6.s195

Page 18: Constructive Computer Architecture Tutorial  5: Overcoming SMIPS Scheduling Errors Andy Wright

Register FileThe current design of the register file forces read < writeWe want reads to happen functionally before writes, but we want writes to be scheduled before readsLet’s modify the register file to be conflict free!

October 7, 2013 T05-18http://csg.csail.mit.edu/6.s195

Page 19: Constructive Computer Architecture Tutorial  5: Overcoming SMIPS Scheduling Errors Andy Wright

Variation 3 – Shorter Misprediction Penalty!

This uses a CF register file to go along with the bypass fifo for the redirect fifo

Results from simulation can be found in the good folder in the included code

October 7, 2013 T05-19http://csg.csail.mit.edu/6.s195

Page 20: Constructive Computer Architecture Tutorial  5: Overcoming SMIPS Scheduling Errors Andy Wright

Variation 3 - ResultsLooking at smips.out No scheduling warnings Between 0.5 and 1.0 IPC Improvement over variations 1 and 2Looking at simOut Reduced misprediction penalty Fetch and Execute fire in the same

cycle

October 7, 2013 T05-20http://csg.csail.mit.edu/6.s195

Page 21: Constructive Computer Architecture Tutorial  5: Overcoming SMIPS Scheduling Errors Andy Wright

ConclusionWe had a plan to speed up the processor, but bluespec scheduling didn’t work outWe used the bluespec gui to debug our scheduling problemWe resolved a conflicting module by making it conflict free using EHRs and a canonicalize ruleWe ended up getting a faster processor!

October 7, 2013 T05-21http://csg.csail.mit.edu/6.s195

Page 22: Constructive Computer Architecture Tutorial  5: Overcoming SMIPS Scheduling Errors Andy Wright

Questions?

October 7, 2013 T05-22http://csg.csail.mit.edu/6.s195