diff --git a/src/cpu/pred/ftb/decoupled_bpred.cc b/src/cpu/pred/ftb/decoupled_bpred.cc index 96b0d4baac..cdc9c76ead 100644 --- a/src/cpu/pred/ftb/decoupled_bpred.cc +++ b/src/cpu/pred/ftb/decoupled_bpred.cc @@ -2330,9 +2330,7 @@ DecoupledBPUWithFTB::makeNewPrediction(bool create_new_stream) // update ghr int shamt; std::tie(shamt, taken) = finalPred.getHistInfo(); - boost::to_string(s0History, buf1); histShiftIn(shamt, taken, s0History); - boost::to_string(s0History, buf2); historyManager.addSpeculativeHist(entry.startPC, shamt, taken, entry.predBranchInfo, fsqId); tage->checkFoldedHist(s0History, "speculative update"); @@ -2475,8 +2473,6 @@ DecoupledBPUWithFTB::checkHistory(const boost::dynamic_bitset<> &history) ideal_hash_hist.resize(comparable_size); sized_real_hist.resize(comparable_size); - boost::to_string(ideal_hash_hist, buf1); - boost::to_string(sized_real_hist, buf2); DPRINTF(DecoupleBP, "Ideal size:\t%u, real history size:\t%u, comparable size:\t%u\n", ideal_size, historyBits, comparable_size); diff --git a/src/cpu/pred/ftb/ftb_ittage.cc b/src/cpu/pred/ftb/ftb_ittage.cc index 141b37ac64..925677e476 100644 --- a/src/cpu/pred/ftb/ftb_ittage.cc +++ b/src/cpu/pred/ftb/ftb_ittage.cc @@ -348,18 +348,15 @@ FTBITTAGE::update(const FetchStream &entry) unsigned maskMaxNum = std::pow(2, (numPredictors - (pred.main_table + 1))); unsigned mask = allocLFSR.get() % maskMaxNum; bitset allocateLFSR(numPredictors - (pred.main_table + 1), mask); - std::string buf; - boost::to_string(allocateLFSR, buf); - DPRINTF(FTBITTAGE || debugFlag, "allocateLFSR %s, size %d\n", buf, allocateLFSR.size()); + auto flipped_usefulMask = pred.usefulMask.flip(); - boost::to_string(flipped_usefulMask, buf); - DPRINTF(FTBITTAGE || debugFlag, "pred usefulmask %s, size %d\n", buf, pred.usefulMask.size()); bitset masked = allocateLFSR & flipped_usefulMask; - boost::to_string(masked, buf); - DPRINTF(FTBITTAGE || debugFlag, "masked %s, size %d\n", buf, masked.size()); bitset allocate = masked.any() ? masked : flipped_usefulMask; - boost::to_string(allocate, buf); - DPRINTF(FTBITTAGE || debugFlag, "allocate %s, size %d\n", buf, allocate.size()); + DPRINTF(FTBITTAGE || debugFlag, "allocateLFSR %s, size %d\n", allocateLFSR, allocateLFSR.size()); + DPRINTF(FTBITTAGE || debugFlag, "pred usefulmask %s, size %d\n", flipped_usefulMask, + pred.usefulMask.size()); + DPRINTF(FTBITTAGE || debugFlag, "masked %s, size %d\n", masked, masked.size()); + DPRINTF(FTBITTAGE || debugFlag, "allocate %s, size %d\n", allocate, allocate.size()); bool allocateValid = flipped_usefulMask.any(); if (needToAllocate && allocateValid) { @@ -456,9 +453,7 @@ FTBITTAGE::satDecrement(int min, short &counter) void FTBITTAGE::doUpdateHist(const boost::dynamic_bitset<> &history, int shamt, bool taken) { - std::string buf; - boost::to_string(history, buf); - DPRINTF(FTBITTAGE || debugFlag, "in doUpdateHist, shamt %d, taken %d, history %s\n", shamt, taken, buf); + DPRINTF(FTBITTAGE || debugFlag, "in doUpdateHist, shamt %d, taken %d, history %s\n", shamt, taken, history); if (shamt == 0) { DPRINTF(FTBITTAGE || debugFlag, "shamt is 0, returning\n"); return; @@ -501,9 +496,7 @@ void FTBITTAGE::checkFoldedHist(const boost::dynamic_bitset<> &hist, const char * when) { DPRINTF(FTBITTAGE || debugFlag, "checking folded history when %s\n", when); - std::string hist_str; - boost::to_string(hist, hist_str); - DPRINTF(FTBITTAGE || debugFlag, "history:\t%s\n", hist_str.c_str()); + DPRINTF(FTBITTAGE || debugFlag, "history:\t%s\n", hist); for (int t = 0; t < numPredictors; t++) { for (int type = 0; type < 2; type++) { DPRINTF(FTBITTAGE || debugFlag, "t: %d, type: %d\n", t, type); diff --git a/src/cpu/pred/ftb/ftb_tage.cc b/src/cpu/pred/ftb/ftb_tage.cc index c55b89fe66..48e1060a4b 100644 --- a/src/cpu/pred/ftb/ftb_tage.cc +++ b/src/cpu/pred/ftb/ftb_tage.cc @@ -468,17 +468,9 @@ FTBTAGE::update(const FetchStream &entry) unsigned mask = allocLFSR.get() % maskMaxNum; bitset allocateLFSR(numPredictors - (pred.table + 1), mask); std::string buf; - boost::to_string(allocateLFSR, buf); - // DPRINTF(FTBTAGEUseful, "allocateLFSR %s, size %d\n", buf, allocateLFSR.size()); auto flipped_usefulMask = ~pred.usefulMask; - boost::to_string(flipped_usefulMask, buf); - // DPRINTF(FTBTAGEUseful, "pred usefulmask %s, size %d\n", buf, pred.usefulMask.size()); bitset masked = allocateLFSR & flipped_usefulMask; - boost::to_string(masked, buf); - // DPRINTF(FTBTAGEUseful, "masked %s, size %d\n", buf, masked.size()); bitset allocate = masked.any() ? masked : flipped_usefulMask; - boost::to_string(allocate, buf); - // DPRINTF(FTBTAGEUseful, "allocate %s, size %d\n", buf, allocate.size()); short newCounter = this_cond_actually_taken ? 0 : -1; bool allocateValid = flipped_usefulMask.any(); @@ -616,9 +608,7 @@ FTBTAGE::getUseAltIdx(Addr pc) { void FTBTAGE::doUpdateHist(const boost::dynamic_bitset<> &history, int shamt, bool taken) { - std::string buf; - boost::to_string(history, buf); - DPRINTF(FTBTAGE, "in doUpdateHist, shamt %d, taken %d, history %s\n", shamt, taken, buf); + DPRINTF(FTBTAGE, "in doUpdateHist, shamt %d, taken %d, history %s\n", shamt, taken, history); if (shamt == 0) { DPRINTF(FTBTAGE, "shamt is 0, returning\n"); return; @@ -666,10 +656,6 @@ FTBTAGE::recoverHist(const boost::dynamic_bitset<> &history, void FTBTAGE::checkFoldedHist(const boost::dynamic_bitset<> &hist, const char * when) { - // DPRINTF(FTBTAGE, "checking folded history when %s\n", when); - std::string hist_str; - boost::to_string(hist, hist_str); - // DPRINTF(FTBTAGE, "history:\t%s\n", hist_str.c_str()); for (int t = 0; t < numPredictors; t++) { for (int type = 0; type < 3; type++) { diff --git a/src/cpu/pred/stream/decoupled_bpred.cc b/src/cpu/pred/stream/decoupled_bpred.cc index d42e153f46..4f420d66d4 100644 --- a/src/cpu/pred/stream/decoupled_bpred.cc +++ b/src/cpu/pred/stream/decoupled_bpred.cc @@ -636,18 +636,15 @@ DecoupledStreamBPU::trapSquash(unsigned target_id, unsigned stream_id, historyManager.squash(stream_id, true, last_committed_pc, inst_pc.instAddr()); - boost::to_string(s0History, buf1); - boost::to_string(stream.history, buf2); - DPRINTF(DecoupleBP, "Recover history %s\nto %s\n", buf1.c_str(), - buf2.c_str()); + DPRINTF(DecoupleBP, "Recover history %s\nto %s\n", s0History, + stream.history); s0History = stream.history; streamTAGE->recoverFoldedHist(s0History); // streamTAGE->checkFoldedHist(s0History); auto hashed_path = computePathHash(last_committed_pc, inst_pc.instAddr()); histShiftIn(hashed_path, s0History); - boost::to_string(s0History, buf1); - DPRINTF(DecoupleBP, "Shift in history %s\n", buf1.c_str()); + DPRINTF(DecoupleBP, "Shift in history %s\n", s0History); checkHistory(s0History); @@ -1145,12 +1142,13 @@ DecoupledStreamBPU::makeNewPrediction(bool create_new_stream) auto hashed_path = computePathHash(s0UbtbPred.controlAddr, s0UbtbPred.nextStream); - boost::to_string(s0History, buf1); + if (debug::DecoupleBP) { + boost::to_string(s0History, buf1); + } histShiftIn(hashed_path, s0History); - boost::to_string(s0History, buf2); DPRINTF(DecoupleBP, "Update s0PC to %#lx\n", s0PC); - DPRINTF(DecoupleBP, "Update s0History from %s to %s\n", buf1.c_str(), - buf2.c_str()); + DPRINTF(DecoupleBP, "Update s0History from %s to %s\n", buf1, + s0History); DPRINTF(DecoupleBP, "Hashed path: %#lx\n", hashed_path); if (create_new_stream) { @@ -1206,8 +1204,7 @@ DecoupledStreamBPU::makeNewPrediction(bool create_new_stream) DPRINTF(DecoupleBP || debugFlagOn, "After pred, s0StreamStartPC=%#lx, s0PC=%#lx\n", s0StreamStartPC, s0PC); - boost::to_string(entry.history, buf1); - DPRINTF(DecoupleBP, "New prediction history: %s\n", buf1.c_str()); + DPRINTF(DecoupleBP, "New prediction history: %s\n", entry.history); std::tie(entry.isLoop, entry.loopTarget) = streamLoopPredictor->makeLoopPrediction(s0UbtbPred.controlAddr); if (s0UbtbPred.useLoopPrediction) { @@ -1268,13 +1265,11 @@ DecoupledStreamBPU::checkHistory(const boost::dynamic_bitset<> &history) ideal_hash_hist.resize(comparable_size); sized_real_hist.resize(comparable_size); - boost::to_string(ideal_hash_hist, buf1); - boost::to_string(sized_real_hist, buf2); DPRINTF(DecoupleBP, "Ideal size:\t%u, real history size:\t%u, comparable size:\t%u\n", ideal_size, historyBits, comparable_size); DPRINTF(DecoupleBP, "Ideal history:\t%s\nreal history:\t%s\n", - buf1.c_str(), buf2.c_str()); + ideal_hash_hist, sized_real_hist); assert(ideal_hash_hist == sized_real_hist); } diff --git a/src/cpu/pred/stream/modify_tage.cc b/src/cpu/pred/stream/modify_tage.cc index f3ea4798f5..1bb05cebb1 100644 --- a/src/cpu/pred/stream/modify_tage.cc +++ b/src/cpu/pred/stream/modify_tage.cc @@ -104,9 +104,7 @@ StreamTAGE::lookupHelper(bool flag, Addr last_chunk_start, Addr stream_start, alt_table = -1; alt_table_index = -1; - std::string buf1; - boost::to_string(history, buf1); - DPRINTF(DecoupleBP || debugFlagOn, "history: %s\n", buf1.c_str()); + DPRINTF(DecoupleBP || debugFlagOn, "history: %s\n", history); for (int i = numPredictors - 1; i >= 0; --i) { Addr tmp_index = getTageIndex(last_chunk_start, history, i, index_folded_hist); @@ -533,9 +531,7 @@ StreamTAGE::getTageTag(Addr pc, const bitset& history, int t, std::vector= 8); hash.resize(foldedLen); foldedHist ^= hash; - std::string buf2; - boost::to_string(foldedHist, buf2); - DPRINTF(DecoupleBP, "final foldedHist:\t%s\n", buf2.c_str()); + DPRINTF(DecoupleBP, "final foldedHist:\t%s\n", foldedHist); } } } @@ -580,24 +571,18 @@ StreamTAGE::maintainFoldedHist(const bitset& history, bitset hash) void StreamTAGE::checkFoldedHist(const bitset& history) { - std::string hist_str, hash_str; - boost::to_string(history, hist_str); - DPRINTF(DecoupleBP, "history:\t%s\n", hist_str.c_str()); + DPRINTF(DecoupleBP, "history:\t%s\n", history); // update the folded history when the global history is updated in the decoupled_bpred.cc for (int t = 1;t < numPredictors;t++) { for (int type = 0;type < 2;type++) { DPRINTF(DecoupleBP, "t: %d, type: %d\n", t, type); - std::string buf2, buf3; auto &foldedHist = type ? tagFoldedHist[t] : indexFoldedHist[t]; unsigned int foldedLen = type ? tableTagBits[t] : tableIndexBits[t]; - boost::to_string(foldedHist, buf2); // check history bitset idealHist(history); idealHist.resize(histLengths[t]); - std::string buf4; - boost::to_string(idealHist, buf4); - DPRINTF(DecoupleBP, "idealHist:\t%s\n", buf4.c_str()); + DPRINTF(DecoupleBP, "idealHist:\t%s\n", idealHist); bitset idealFoldedHist; idealFoldedHist.resize(foldedLen); @@ -605,8 +590,7 @@ StreamTAGE::checkFoldedHist(const bitset& history) idealFoldedHist[i % foldedLen] ^= idealHist[i]; } assert(foldedLen >= 8); - boost::to_string(idealFoldedHist, buf3); - DPRINTF(DecoupleBP, "idealFoldedHist:\t%s\tfoldedHist:\t%s\n", buf3.c_str(), buf2.c_str()); + DPRINTF(DecoupleBP, "idealFoldedHist:\t%s\tfoldedHist:\t%s\n", idealFoldedHist, foldedHist); assert(idealFoldedHist == foldedHist); } } @@ -615,28 +599,21 @@ StreamTAGE::checkFoldedHist(const bitset& history) void StreamTAGE::recoverFoldedHist(const bitset& history) { - std::string buf; - boost::to_string(history, buf); - DPRINTF(DecoupleBP, "recoverFoldedHist: %s\n", buf.c_str()); + DPRINTF(DecoupleBP, "recoverFoldedHist: %s\n", history); // manually compute the folded history for (int t = 1;t < numPredictors;t++) { for (int type = 0;type < 2;type++) { auto &foldedHist = type ? tagFoldedHist[t] : indexFoldedHist[t]; unsigned int foldedLen = type ? tableTagBits[t] : tableIndexBits[t]; - std::string buf0, buf1; - boost::to_string(foldedHist, buf0); + DPRINTF(DecoupleBP, "foldedHist:\t%s\tcleared:\t%s\n", foldedHist, foldedLen); foldedHist.clear(); foldedHist.resize(foldedLen); - boost::to_string(foldedHist, buf1); - DPRINTF(DecoupleBP, "foldedHist:\t%s\tcleared:\t%s\n", buf0.c_str(), buf1.c_str()); bitset tempHist(history); tempHist.resize(histLengths[t]); for (int j = 0;j < histLengths[t];j++) { foldedHist[j % foldedLen] ^= tempHist[j]; } - std::string buf2; - boost::to_string(foldedHist, buf2); - DPRINTF(DecoupleBP, "t:%d, type: %d, history:\t%s\n", t, type, buf2.c_str()); + DPRINTF(DecoupleBP, "t:%d, type: %d, history:\t%s\n", t, type, foldedHist); } } } diff --git a/src/cpu/pred/stream/ubtb.cc b/src/cpu/pred/stream/ubtb.cc index 8eb0f8134d..2bbe0d3d6c 100644 --- a/src/cpu/pred/stream/ubtb.cc +++ b/src/cpu/pred/stream/ubtb.cc @@ -122,8 +122,6 @@ StreamUBTB::update(/*const PredictionID fsq_id,*/ stream_start_pc); return; } - std::string buf; - boost::to_string(history, buf); // DPRINTF(DecoupleBP, // "StreamUBTB::update: fsq id: %d, control_pc: %#x, target: %#x, " // "is_conditional: %d, is_indirect: %d, "