changeset c9b1a0ed2311 in /z/repo/m5 details: http://repo.m5sim.org/m5?cmd=changeset;node=c9b1a0ed2311 description: inorder: timing for inst forwarding when insts execute, they mark the time they finish to be used for subsequent isnts they may need forwarding of data. However, the regdepmap was using the wrong value to index into the destination operands of the instruction to be forwarded. Thus, in some cases, we are checking to see if the 3rd destination register for an instruction is executed at a certain time, when there is only 1 dest. register valid. Thus, we get a bad, uninitialized time value that will stall forwarding causing performance loss but still the correct execution.
diffstat: 4 files changed, 30 insertions(+), 10 deletions(-) src/cpu/inorder/inorder_dyn_inst.cc | 15 +++++++++++++-- src/cpu/inorder/reg_dep_map.cc | 20 +++++++++++++++----- src/cpu/inorder/reg_dep_map.hh | 2 +- src/cpu/inorder/resources/use_def.cc | 3 +-- diffs (112 lines): diff -r ad784e759a74 -r c9b1a0ed2311 src/cpu/inorder/inorder_dyn_inst.cc --- a/src/cpu/inorder/inorder_dyn_inst.cc Fri Apr 02 15:28:22 2010 -0700 +++ b/src/cpu/inorder/inorder_dyn_inst.cc Sat Apr 10 23:31:36 2010 -0400 @@ -534,6 +534,10 @@ instResult[idx].type = Integer; instResult[idx].val.integer = val; instResult[idx].tick = curTick; + + DPRINTF(InOrderDynInst, "[tid:%i]: [sn:%i] Setting Result Int Reg. %i " + "being set to %#x (result-tick:%i).\n", + threadNumber, seqNum, idx, val, instResult[idx].tick); } /** Sets a FP register. */ @@ -542,8 +546,11 @@ { instResult[idx].val.dbl = val; instResult[idx].type = Float; + instResult[idx].tick = curTick; - instResult[idx].tick = curTick; + DPRINTF(InOrderDynInst, "[tid:%i]: [sn:%i] Setting Result Float Reg. %i " + "being set to %#x (result-tick:%i).\n", + threadNumber, seqNum, idx, val, instResult[idx].tick); } /** Sets a FP register as a integer. */ @@ -554,6 +561,10 @@ instResult[idx].type = Integer; instResult[idx].val.integer = val; instResult[idx].tick = curTick; + + DPRINTF(InOrderDynInst, "[tid:%i]: [sn:%i] Setting Result Float Reg. %i " + "being set to %#x (result-tick:%i).\n", + threadNumber, seqNum, idx, val, instResult[idx].tick); } /** Sets a misc. register. */ @@ -655,7 +666,7 @@ storeData = data; DPRINTF(InOrderDynInst, "[tid:%i]: [sn:%i] Setting store data to %#x.\n", - threadNumber, seqNum, memData); + threadNumber, seqNum, storeData); return cpu->write(this, data, addr, flags, res); } diff -r ad784e759a74 -r c9b1a0ed2311 src/cpu/inorder/reg_dep_map.cc --- a/src/cpu/inorder/reg_dep_map.cc Fri Apr 02 15:28:22 2010 -0700 +++ b/src/cpu/inorder/reg_dep_map.cc Sat Apr 10 23:31:36 2010 -0400 @@ -161,7 +161,7 @@ } ThePipeline::DynInstPtr -RegDepMap::canForward(unsigned reg_idx, unsigned src_idx, DynInstPtr inst) +RegDepMap::canForward(unsigned reg_idx, DynInstPtr inst) { std::list<DynInstPtr>::iterator list_it = regMap[reg_idx].begin(); std::list<DynInstPtr>::iterator list_end = regMap[reg_idx].end(); @@ -176,13 +176,23 @@ } if (forward_inst) { + int dest_reg_idx = forward_inst->getDestIdxNum(reg_idx); + assert(dest_reg_idx != -1); + if (forward_inst->isExecuted() && - forward_inst->readResultTime(src_idx) < curTick) { + forward_inst->readResultTime(dest_reg_idx) < curTick) { return forward_inst; } else { - DPRINTF(RegDepMap, "[sn:%i] Can't get value through forwarding, " - " [sn:%i] has not been executed yet.\n", - inst->seqNum, forward_inst->seqNum); + if (!forward_inst->isExecuted()) { + DPRINTF(RegDepMap, "[sn:%i] Can't get value through forwarding, " + " [sn:%i] has not been executed yet.\n", + inst->seqNum, forward_inst->seqNum); + } else if (forward_inst->readResultTime(dest_reg_idx) >= curTick) { + DPRINTF(RegDepMap, "[sn:%i] Can't get value through forwarding, " + " [sn:%i] executed on tick:%i.\n", + inst->seqNum, forward_inst->seqNum, forward_inst->readResultTime(dest_reg_idx)); + } + return NULL; } } else { diff -r ad784e759a74 -r c9b1a0ed2311 src/cpu/inorder/reg_dep_map.hh --- a/src/cpu/inorder/reg_dep_map.hh Fri Apr 02 15:28:22 2010 -0700 +++ b/src/cpu/inorder/reg_dep_map.hh Sat Apr 10 23:31:36 2010 -0400 @@ -77,7 +77,7 @@ /** Is the current instruction able to get a forwarded value from another instruction * for this destination register? */ - DynInstPtr canForward(unsigned reg_idx, unsigned src_idx, DynInstPtr inst); + DynInstPtr canForward(unsigned reg_idx, DynInstPtr inst); /** find an instruction to forward/bypass a value from */ DynInstPtr findBypassInst(unsigned idx); diff -r ad784e759a74 -r c9b1a0ed2311 src/cpu/inorder/resources/use_def.cc --- a/src/cpu/inorder/resources/use_def.cc Fri Apr 02 15:28:22 2010 -0700 +++ b/src/cpu/inorder/resources/use_def.cc Sat Apr 10 23:31:36 2010 -0400 @@ -196,8 +196,7 @@ } else { // Look for forwarding opportunities - DynInstPtr forward_inst = regDepMap[tid]->canForward(reg_idx, - ud_idx, + DynInstPtr forward_inst = regDepMap[tid]->canForward(reg_idx, inst); if (forward_inst) { _______________________________________________ m5-dev mailing list m5-dev@m5sim.org http://m5sim.org/mailman/listinfo/m5-dev