Download presentation
Presentation is loading. Please wait.
Published byGarry Hawkins Modified over 6 years ago
1
Tutorial 7: SMIPS Epochs Constructive Computer Architecture
Andy Wright 6.175 TA October 7, 2013
2
N-Stage pipeline: Two predictors
eEpoch feEpoch eRecirect redirect PC fdEpoch dEpoch dRecirect deEpoch redirect PC miss pred? miss pred? Execute d2e Fetch PC Decode f2d ... Both Decode and Execute can redirect the PC; Execute redirect should never be overruled We will use separate epochs for each redirecting stage feEpoch and deEpoch are estimates of eEpoch at Fetch and Decode, respectively. deEpoch is updated by the incoming eEpoch fdEpoch is Fetch’s estimates of dEpoch Initially set all epochs to 0 Execute stage logic does not change October 27, 2014
3
Decode stage Redirection logic
eEpoch feEpoch eRecirect {pc, newPc, taken mispredict, ...} fdEpoch dEpoch dRecirect deEpoch {pc, newPc, idEp, ideEp...} miss pred? miss pred? {pc, ppc, ieEp, idEp} Execute d2e {..., ieEp} Fetch PC Decode f2d ... Is ieEp = deEp ? yes no Is idEp = dEp ? Current instruction is OK but Execute has redirected the pc; Set <deEp, dEp> to <ieEp, idEp> check the ppc prediction via BHT, Switch dEp if misprediction yes no Current instruction is OK; check the ppc prediction via BHT, Switch dEp if misprediction Wrong path instruction; drop it October 27, 2014
4
N-Stage pipeline: Two predictors Redirection logic
eEpoch feEpoch eRecirect {pc, newPc, taken mispredict, ...} fdEpoch dEpoch dRecirect deEpoch {pc, newPc, ieEp,ideEp...} miss pred? miss pred? {pc, ppc, ieEp, idEp} Execute d2e {..., ieEp} Fetch PC Decode f2d ... At execute: (correct pc?) if (ieEp!=eEp) then poison the instruction (correct ppc?) if (correct pc) & mispred then change eEp; For every non-poisoned control instruction send <pc, newPc, taken, mispred, ...> to Fetch for training and redirection At fetch: msg from execute: train btb & if (mispred) set pc, change feEp, msg from decode: if (no redirect message from Execute) if (ideEp=feEp) then set pc, change fdEp to idEp At decode: … make sure that the msg from Decode is not from a wrong path instruction October 27, 2014
5
now some coding ... 4-stage pipeline (F, D&R, E&M, W)
Direction predictor training is incompletely specified You will explore the effect of predictor training in the lab October 27, 2014
6
4-Stage pipeline with Branch Prediction
module mkProc(Proc); Reg#(Addr) pc <- mkRegU; RFile rf <- mkBypassRFile; IMemory iMem <- mkIMemory; DMemory dMem <- mkDMemory; Fifo#(1, Decode2Execute) d2e <- mkPipelineFifo; Fifo#(1, Exec2Commit) e2c <- mkPipelineFifo; Scoreboard#(2) sb <- mkPipelineScoreboard; Reg#(Bool) feEp <- mkReg(False); Reg#(Bool) fdEp <- mkReg(False); Reg#(Bool) dEp <- mkReg(False); Reg#(Bool) deEp <- mkReg(False); Reg#(Bool) eEp <- mkReg(False); Fifo#(ExecRedirect) redirect <- mkBypassFifo; Fifo#(DecRedirect) decRedirect <- mkBypassFifo; NextAddrPred#(16) btb <- mkBTB; DirPred#(1024) dirPred <- mkBHT; October 27, 2014 6
7
4-Stage-BP pipeline Fetch rule: multiple predictors
rule doFetch; let inst = iMem.req(pc); if(redirect.notEmpty) begin redirect.deq; btb.update(redirect.first); end if(redirect.notEmpty && redirect.first.mispredict) begin pc <= redirect.first.nextPc; feEp <= !feEp; end else if(decRedirect.notEmpty) begin if(decRedirect.first.eEp == feEp) begin fdEp <= !fdEp; pc <= decRedirect.first.nextPc; end decRedirect.deq; end; else begin let ppc = btb.predPc(pc); f2d.enq(Fetch2Decoode{pc: pc, ppc: ppc, inst: inst, eEp: feEp, dEp: fdEp}); end endrule Not enough information is being passed from Fetch to Decode to train BHT – lab problem October 27, 2014
8
4-Stage-BP pipeline Decode&RegRead Action
function Action decAndRegFetch(DInst dInst, Addr pc, Addr ppc, Bool eEp); action let stall = sb.search1(dInst.src1)|| sb.search2(dInst.src2); if(!stall) begin let rVal1 = rf.rd1(validRegValue(dInst.src1)); let rVal2 = rf.rd2(validRegValue(dInst.src2)); d2e.enq(Decode2Execute{pc: pc, ppc: ppc, dInst: dInst, epoch: eEp, rVal1: rVal1, rVal2: rVal2}); sb.insert(dInst.rDst); end endaction endfunction October 27, 2014
9
4-Stage-BP pipeline Decode&RegRead rule
rule doDecode; let x = f2d.first; let inst = x.inst; let pc = x.pc; let ppc = x.ppc; let idEp = x.dEp; let ieEp = x.eEp; let dInst = decode(inst); let nextPc = dirPrec.predAddr(pc, dInst); if(ieEp != deEp) begin // change Decode’s epochs and // continue normal instruction execution deEp <= ieEp; let newdEp = idEp; decAndRegRead(inst, pc, nextPc, ieEp); if(ppc != nextPc) begin newdEp = !newdEp; decRedirect.enq(DecRedirect{pc: pc, nextPc: nextPc, eEp: ieEp}); end dEp <= newdEp end else if(idEp == dEp) begin decAndRegRead(inst, pc, nextPc, ieEp); if(ppc != nextPc) begin dEp <= !dEp; decRedirect.enq(DecRedirect{pc: pc, newPc: newPc, eEp: ieEp}); end end // if idEp!=dEp then drop,ie, no action f2d.deq; endrule BHT update is missing– lab problem October 27, 2014
10
4-Stage-BP pipeline Execute rule: predictor training
rule doExecute; let x = d2e.first; let dInst = x.dInst; let pc = x.pc; let ppc = x.ppc; let epoch = x.epoch; let rVal1 = x.rVal1; let rVal2 = x.rVal2; if(epoch == eEpoch) begin let eInst = exec(dInst, rVal1, rVal2, pc, ppc); if(eInst.iType == Ld) eInst.data <- dMem.req(MemReq{op:Ld, addr:eInst.addr, data:?}); else if (eInst.iType == St) let d <- dMem.req(MemReq{op:St, addr:eInst.addr, data:eInst.data}); e2c.enq(Exec2Commit{dst:eInst.dst, data:eInst.data}); if(eInst.mispredict) eEpoch <= !eEpoch if(eInst.iType == J || eInst.iType == Jr || eInst.iType == Br) redirect.enq(Redirect{pc: pc, nextPc: eInst.addr, taken: eInst.brTaken, mispredict: eInst.mispredict, brType: eInst.iType}); end else e2c.enq(Exec2Commit{dst:Invalid, data:?}); d2e.deq; endrule October 27, 2014
11
4-Stage-BP pipeline Commit rule
rule doCommit; let dst = eInst.first.dst; let data = eInst.first.data; if(isValid(dst)) rf.wr(tuple2(validValue(dst), data); e2c.deq; sb.remove; endrule October 27, 2014 11
12
Uses of Jump Register (JR)
Switch statements (jump to address of matching case) Dynamic function call (jump to run-time function address) Subroutine returns (jump to return address) BTB works well if the same case is used repeatedly BTB works well if the same function is usually called, (e.g., in C++ programming, when objects have same type in virtual function call) BTB works well if return is usually to the same place However, often one function is called from many distinct call sites! How well does BTB or BHT work for each of these cases? October 27, 2014
13
Subroutine Return Stack
A small structure to accelerate JR for subroutine returns is typically much more accurate than BTBs fa() { fb(); } fb() { fc(); } fc() { fd(); } Push call address when function call executed Pop return address when subroutine return decoded k entries (typically k=8-16) pc of fd call pc of fc call pc of fb call October 27, 2014
14
Multiple Predictors: BTB + BHT + Ret Predictors
mispred insts must be filtered Next Addr Pred correct mispred correct JR pred tight loop Br Dir Pred, RAS P C Decode Reg Read Execute Write Back Instr type, PC relative targets available Simple conditions, register targets available Complex conditions available Need next PC immediately One of the PowerPCs has all the three predictors Performance analysis is quite difficult – depends upon the sizes of various tables and program behavior Correctness: The system must work even if every prediction is wrong October 27, 2014
15
October 7, 2013
16
Epoch Tutorial October 7, 2013
17
Handling Multiple Epochs
If only one epoch changes, it acts just like the case where there is only one epoch. First we are going to look at the execute epoch and the decode epoch separately. October 7, 2013
18
Correcting PC in Execute
IFetch Decode WB RFetch Exec Memory Register File Scoreboard DMem IMem eEpoch fEpoch PC Redirect 6 5 4 3 2 1 Mispredicted Write Back October 7, 2013
19
Correcting PC in Execute
IFetch Decode WB RFetch Exec Memory Register File Scoreboard DMem IMem eEpoch fEpoch PC Redirect 1 6 5 4 3 2 Poisoning Write Back October 7, 2013
20
Correcting PC in Execute
IFetch Decode WB RFetch Exec Memory Register File Scoreboard DMem IMem eEpoch fEpoch PC Redirect 2 1 6 5 4 3 Poisoning Write Back October 7, 2013
21
Correcting PC in Execute
IFetch Decode WB RFetch Exec Memory Register File Scoreboard DMem IMem eEpoch fEpoch PC Redirect 3 2 1 6 5 4 Poisoning Killing October 7, 2013
22
Correcting PC in Execute
IFetch Decode WB RFetch Exec Memory Register File Scoreboard DMem IMem eEpoch fEpoch PC Redirect 4 3 2 1 6 5 Executing Killing October 7, 2013
23
Correcting PC in Execute
IFetch Decode WB RFetch Exec Memory Register File Scoreboard DMem IMem eEpoch fEpoch PC Redirect 5 4 3 2 1 6 Executing Killing October 7, 2013
24
Correcting PC in Execute
IFetch Decode WB RFetch Exec Memory Register File Scoreboard DMem IMem eEpoch fEpoch PC Redirect 6 5 4 3 2 1 Executing Write Back October 7, 2013
25
Correcting PC in Decode
IFetch Decode WB RFetch Exec Memory Register File Scoreboard DMem IMem fEpoch PC Redirect 6 5 4 3 2 1 Mispredicted Write Back dEpoch October 7, 2013
26
Correcting PC in Decode
IFetch Decode WB RFetch Exec Memory Register File Scoreboard DMem IMem fEpoch PC Redirect 1 6 5 4 3 2 Killing Write Back dEpoch October 7, 2013
27
Correcting PC in Decode
IFetch Decode WB RFetch Exec Memory Register File Scoreboard DMem IMem fEpoch PC Redirect 2 1 5 4 3 Decoding Write Back dEpoch October 7, 2013
28
Correcting PC in Decode
IFetch Decode WB RFetch Exec Memory Register File Scoreboard DMem IMem fEpoch PC Redirect 3 2 1 5 4 Decoding Write Back dEpoch October 7, 2013
29
Correcting PC in Decode
IFetch Decode WB RFetch Exec Memory Register File Scoreboard DMem IMem fEpoch PC Redirect 4 3 2 1 5 Decoding Write Back dEpoch October 7, 2013
30
Correcting PC in Decode
IFetch Decode WB RFetch Exec Memory Register File Scoreboard DMem IMem fEpoch PC Redirect 5 4 3 2 1 Decoding Stall dEpoch October 7, 2013
31
Correcting PC in Decode
IFetch Decode WB RFetch Exec Memory Register File Scoreboard DMem IMem fEpoch PC Redirect 6 5 4 3 2 1 Decoding Write Back dEpoch October 7, 2013
32
Correcting PC in Both Decode and Execute
October 7, 2013
33
Correcting PC in Both Decode and Execute
IFetch Decode WB RFetch Exec Memory Register File Scoreboard DMem IMem eEpoch feEpoch PC Redirect Two separate FIFOs fdEpoch 6 5 4 3 2 1 Decoding Executing Write Back dEpoch deEpoch Fetch has local estimates of eEpoch and dEpoch Decode has a local estimate of eEpoch How does this work? October 7, 2013
34
Estimating eEpoch in Decode
IFetch Decode WB RFetch Exec Memory Register File Scoreboard DMem IMem eEpoch feEpoch PC Redirect 6 5 4 3 2 1 Decoding Mispredicted Write Back deEpoch October 7, 2013
35
Estimating eEpoch in Decode
IFetch Decode WB RFetch Exec Memory Register File Scoreboard DMem IMem eEpoch feEpoch PC Redirect 1 6 5 4 3 2 Decoding Poisoning Write Back deEpoch October 7, 2013
36
Estimating eEpoch in Decode
IFetch Decode WB RFetch Exec Memory Register File Scoreboard DMem IMem eEpoch feEpoch PC Redirect 2 1 6 5 4 3 Decoding Poisoning Write Back deEpoch October 7, 2013
37
Estimating eEpoch in Decode
IFetch Decode WB RFetch Exec Memory Register File Scoreboard DMem IMem eEpoch feEpoch PC Redirect 3 2 1 6 5 4 Decoding Poisoning Killing deEpoch October 7, 2013
38
Estimating eEpoch in Decode
IFetch Decode WB RFetch Exec Memory Register File Scoreboard DMem IMem eEpoch feEpoch PC Redirect 4 3 2 1 6 5 Decoding Executing Killing deEpoch October 7, 2013
39
Estimating eEpoch in Decode
IFetch Decode WB RFetch Exec Memory Register File Scoreboard DMem IMem eEpoch feEpoch PC Redirect 5 4 3 2 1 6 Decoding Executing Killing deEpoch October 7, 2013
40
Estimating eEpoch in Decode
IFetch Decode WB RFetch Exec Memory Register File Scoreboard DMem IMem eEpoch feEpoch PC Redirect 6 5 4 3 2 1 Decoding Executing Write Back deEpoch October 7, 2013
41
Estimating eEpoch in Decode
Decode has no way to know what the execute epoch really is. Its best guess is whatever execute epoch is coming in. It only keeps track of the old epoch to know if there was a change. In that case, it needs to change its decode epoch to match the incoming instruction October 7, 2013
42
Correcting PC from Multiple Stages Concurrently
What if decode and execute see mispredictions in the same cycle? If execute sees a misprediction, then the decode instruction is a wrong path instruction. The redirect coming from decode should be ignored by the fetch stage. October 7, 2013
43
Redirection in Execute then Decode
What if execute sees a misprediction, then decode sees one in the next cycle? The decode instruction will be a wrong path instruction, but the decode stage will not no it, so it will send a redirect message. The fetch stage should ignore this message. October 7, 2013
44
Redirection in Execute then Decode
IFetch Decode WB RFetch Exec Memory Register File Scoreboard DMem IMem eEpoch feEpoch PC Redirect fdEpoch 6 5 4 3 2 1 Decoding Mispredicted Write Back dEpoch deEpoch Assume this instruction is a mispredicted jump instruction. It will be in the decode stage next cycle October 7, 2013
45
Redirection in Execute then Decode
IFetch Decode WB RFetch Exec Memory Register File Scoreboard DMem IMem eEpoch feEpoch PC Redirect fdEpoch 1 6 5 4 3 2 Mispredicted Poisoning Write Back dEpoch deEpoch The decode stage’s estimate of eEpoch is old, so it isn’t able to recognize it is decoding a wrong path instruction. October 7, 2013
46
Redirection in Execute then Decode
IFetch Decode WB RFetch Exec Memory Register File Scoreboard DMem IMem eEpoch feEpoch PC Redirect fdEpoch 1 1 6 5 4 3 2 Mispredicted Poisoning Write Back dEpoch deEpoch Fetch will remove the redirection from the redirect FIFO without changing the PC because the execute epochs don’t match. October 7, 2013
47
Redirection in Execute then Decode
IFetch Decode WB RFetch Exec Memory Register File Scoreboard DMem IMem eEpoch feEpoch PC Redirect fdEpoch 2 1 6 5 4 3 Decoding Poisoning Write Back dEpoch deEpoch The Decode stage sees the change in the execute epoch and corrects its decode epoch to match the incoming instruction October 7, 2013
48
Redirection in Execute then Decode
IFetch Decode WB RFetch Exec Memory Register File Scoreboard DMem IMem eEpoch feEpoch PC Redirect fdEpoch 3 2 1 6 5 4 Decoding Poisoning Killing dEpoch deEpoch October 7, 2013
49
Redirection in Execute then Decode
IFetch Decode WB RFetch Exec Memory Register File Scoreboard DMem IMem eEpoch feEpoch PC Redirect fdEpoch 4 3 2 1 6 5 Decoding Executing Killing dEpoch deEpoch October 7, 2013
50
Redirection in Execute then Decode
IFetch Decode WB RFetch Exec Memory Register File Scoreboard DMem IMem eEpoch feEpoch PC Redirect fdEpoch 5 4 3 2 1 6 Decoding Executing Killing dEpoch deEpoch October 7, 2013
51
Redirection in Execute then Decode
IFetch Decode WB RFetch Exec Memory Register File Scoreboard DMem IMem eEpoch feEpoch PC Redirect fdEpoch 6 5 4 3 2 1 Decoding Executing Write Back dEpoch deEpoch October 7, 2013
52
Redirection in Decode then Execute
What if decode sees a misprediction, then execute sees one in the next cycle? The decode instruction will be a wrong path instruction, but it won’t be known to be wrong path until later October 7, 2013
53
Redirection in Decode then Execute
IFetch Decode WB RFetch Exec Memory Register File Scoreboard DMem IMem eEpoch feEpoch PC Redirect fdEpoch 6 5 4 3 2 1 Mispredicted Executing Write Back dEpoch feEpoch Assume this instruction is a mispredicted branch instruction. It will be in the execute stage next cycle October 7, 2013
54
Redirection in Decode then Execute
IFetch Decode WB RFetch Exec Memory Register File Scoreboard DMem IMem eEpoch feEpoch PC Redirect fdEpoch 1 6 5 4 3 2 Killing Mispredicted Write Back dEpoch feEpoch The PC was just “corrected” to a different wrong path instruction October 7, 2013
55
Redirection in Decode then Execute
IFetch Decode WB RFetch Exec Memory Register File Scoreboard DMem IMem eEpoch feEpoch PC Redirect fdEpoch 1 1 5 4 3 Decoding Poisoning Write Back dEpoch feEpoch The PC was just corrected to a correct path instruction October 7, 2013
56
Redirection in Decode then Execute
IFetch Decode WB RFetch Exec Memory Register File Scoreboard DMem IMem eEpoch feEpoch PC Redirect fdEpoch 2 1 1 5 4 Decoding Stalling Write Back dEpoch feEpoch October 7, 2013
57
Redirection in Decode then Execute
IFetch Decode WB RFetch Exec Memory Register File Scoreboard DMem IMem eEpoch feEpoch PC Redirect fdEpoch 3 2 1 1 5 Decoding Poisoning Killing dEpoch feEpoch October 7, 2013
58
Redirection in Decode then Execute
IFetch Decode WB RFetch Exec Memory Register File Scoreboard DMem IMem eEpoch feEpoch PC Redirect fdEpoch 4 3 2 1 1 Decoding Executing Stalling dEpoch feEpoch October 7, 2013
59
Redirection in Decode then Execute
IFetch Decode WB RFetch Exec Memory Register File Scoreboard DMem IMem eEpoch feEpoch PC Redirect fdEpoch 5 4 3 2 1 1 Decoding Executing Killing dEpoch feEpoch October 7, 2013
60
Redirection in Decode then Execute
IFetch Decode WB RFetch Exec Memory Register File Scoreboard DMem IMem eEpoch feEpoch PC Redirect fdEpoch 6 5 4 3 2 1 Decoding Executing Write Back dEpoch feEpoch October 7, 2013
61
Global Epoch States What if there were no estimates at epochs and everyone looked at the same epoch state How would this work? October 7, 2013
62
Global Epoch States Register File Scoreboard DMem IMem PC Redirect
IFetch Decode WB RFetch Exec Memory Register File Scoreboard DMem IMem PC Redirect 6 5 4 3 2 1 Decoding Executing Write Back dEpoch eEpoch October 7, 2013
63
Global Epoch States What if execute sees a misprediction, then decode sees one in the next cycle? The decode instruction will be a wrong path instruction, so it will not redirect the PC October 7, 2013
64
Global Epoch States Register File Scoreboard DMem IMem PC Redirect
IFetch Decode WB RFetch Exec Memory Register File Scoreboard DMem IMem PC Redirect Assume this instruction is a mispredicted jump instruction. 6 5 4 3 2 1 Decoding Mispredicted Write Back dEpoch eEpoch October 7, 2013
65
Global Epoch States Register File Scoreboard DMem IMem PC Redirect
IFetch Decode WB RFetch Exec Memory Register File Scoreboard DMem IMem PC Redirect 1 6 5 4 3 2 Killing Poisoning Write Back dEpoch eEpoch October 7, 2013
66
Global Epoch States Register File Scoreboard DMem IMem PC Redirect
IFetch Decode WB RFetch Exec Memory Register File Scoreboard DMem IMem PC Redirect 1 1 5 4 3 Decoding Poisoning Write Back dEpoch eEpoch October 7, 2013
67
Global Epoch States Register File Redirect Scoreboard PC IMem DMem
3 2 1 5 4 IFetch Decode RFetch Exec Memory WB Decoding Stalling Killing PC IMem DMem dEpoch eEpoch October 7, 2013
68
Global Epoch States Register File Redirect Scoreboard PC IMem DMem
4 3 2 1 5 IFetch Decode RFetch Exec Memory WB Decoding Executing Killing PC IMem DMem dEpoch eEpoch October 7, 2013
69
Global Epoch States Register File Redirect Scoreboard PC IMem DMem
5 4 3 2 1 IFetch Decode RFetch Exec Memory WB Decoding Executing Stalling PC IMem DMem dEpoch eEpoch October 7, 2013
70
Global Epoch States Register File Redirect Scoreboard PC IMem DMem
6 5 4 3 2 1 IFetch Decode RFetch Exec Memory WB Decoding Executing Write Back PC IMem DMem dEpoch eEpoch October 7, 2013
71
Global Epoch States What if decode sees a misprediction, then execute sees one in the next cycle? The decode instruction will be a wrong path instruction, but it won’t be known to be wrong path until later October 7, 2013
72
Global Epoch States Register File Redirect Scoreboard PC IMem DMem
Assume this instruction is a mispredicted branch instruction. Register File Redirect Scoreboard 6 5 4 3 2 1 IFetch Decode RFetch Exec Memory WB Mispredicted Executing Write Back PC IMem DMem dEpoch eEpoch October 7, 2013
73
Global Epoch States Register File Redirect Scoreboard PC IMem DMem
1 6 5 4 3 2 IFetch Decode RFetch Exec Memory WB Killing Mispredicted Write Back PC IMem DMem dEpoch eEpoch October 7, 2013
74
Global Epoch States Register File Redirect Scoreboard PC IMem DMem
1 1 5 4 3 IFetch Decode RFetch Exec Memory WB Killing Poisoning Write Back PC IMem DMem dEpoch eEpoch October 7, 2013
75
Global Epoch States Register File Redirect Scoreboard PC IMem DMem
2 1 5 4 IFetch Decode RFetch Exec Memory WB Decoding Stalling Write Back PC IMem DMem dEpoch eEpoch October 7, 2013
76
Global Epoch States Register File Redirect Scoreboard PC IMem DMem
3 2 1 5 IFetch Decode RFetch Exec Memory WB Decoding Stalling Killing PC IMem DMem dEpoch eEpoch October 7, 2013
77
Global Epoch States Register File Redirect Scoreboard PC IMem DMem
4 3 2 1 IFetch Decode RFetch Exec Memory WB Decoding Executing Stalling PC IMem DMem dEpoch eEpoch October 7, 2013
78
Global Epoch States Register File Redirect Scoreboard PC IMem DMem
5 4 3 2 1 IFetch Decode RFetch Exec Memory WB Decoding Executing Stalling PC IMem DMem dEpoch eEpoch October 7, 2013
79
Global Epoch States Register File Redirect Scoreboard PC IMem DMem
6 5 4 3 2 1 IFetch Decode RFetch Exec Memory WB Decoding Executing Write Back PC IMem DMem dEpoch eEpoch October 7, 2013
80
Implementing Global Epoch States
How do you implement this? There are multiple ways to do this, but the easiest way is to use EHRs October 7, 2013
81
Implementing Global Epoch States with EHRs
IFetch Decode WB RFetch Exec Memory Register File Scoreboard DMem IMem eEpoch[k] eEpoch[i] PC Redirect Each stage looks at a different port of each Epoch EHR. dEpoch[i] 6 5 4 3 2 1 Decoding Executing Write Back dEpoch[j] eEpoch[j] There’s still a problem! PC redirection and epoch update needs to be atomic! October 7, 2013
82
Implementing Global Epoch States with EHRs
Register File dEpoch[i] Scoreboard eEpoch[i] 6 5 4 3 2 1 IFetch Decode RFetch Exec Memory WB Decoding Executing Write Back PC[i] IMem PC[j] dEpoch[j] PC [k] eEpoch[k] DMem eEpoch[j] Make PC an EHR and have each pipeline stage redirect the PC directly October 7, 2013
83
New Logic for Global Epoch EHRs
Fetch Sends PC to instruction memory, pass current epoch states along with PC in fetch to decode FIFO Decode Kill in place if instruction epochs don’t match global epochs If current instruction is valid, but PPC is incorrect, update decode epoch and PC EHR Drop decode epoch from instruction structure sent to next stage Execute Poison if instruction execute epoch doesn’t match global execute epoch If current instruction is valid, but PPC is incorrect, update execute epoch and PC EHR Drop execute epoch from instruction structure passed to next stage October 7, 2013
84
Why is Fecth so Simple? Fetch stage used to have to prioritize between the two redirect FIFOs and drop decode redirection if the execute epochs don’t match Why isn’t this needed anymore? Try reasoning about this on your own October 7, 2013
85
How Does EHR Port Ordering Change Things?
Originally we had redirect FIFOs from Decode and Execute to Instruction Fetch. What ordering is this? Fetch – 2 Decode – 0 or 1 Execute – 0 or 1 (not the same as Decode) Does the order between Decode and Execute matter? Not much... Having Fetch use ports after Decode and Execute increase the length of combinational logic The order between Decode/Execute and Fetch matters most! (both for length of combinational logic and IPC) October 7, 2013
86
Questions? October 7, 2013
Similar presentations
© 2024 SlidePlayer.com. Inc.
All rights reserved.