@@ -697,15 +697,25 @@ BTBTAGE::update(const FetchStream &stream) {
697697 }
698698
699699 // Process each BTB entry
700+ bool hasRecomputedVsActualDiff = false ;
701+ bool hasRecomputedVsOriginalDiff = false ;
700702 for (auto &btb_entry : entries_to_update) {
701703 bool actual_taken = stream.exeTaken && stream.exeBranchInfo == btb_entry;
702704 TagePrediction recomputed;
703705 if (updateOnRead) { // if update on read is enabled, re-read providers using snapshot
704706 // Re-read providers using snapshot (do not rely on prediction-time main/alt)
705707 recomputed = generateSinglePrediction (btb_entry, startAddr, predMeta);
708+ // Track differences for statistics
709+ auto it = predMeta->preds .find (btb_entry.pc );
710+ if (it != predMeta->preds .end () && recomputed.taken != it->second .taken ) {
711+ hasRecomputedVsOriginalDiff = true ;
712+ }
706713 } else { // otherwise, use the prediction from the prediction-time main/alt
707714 recomputed = predMeta->preds [btb_entry.pc ];
708715 }
716+ if (recomputed.taken != actual_taken) {
717+ hasRecomputedVsActualDiff = true ;
718+ }
709719
710720 // Update predictor state and check if need to allocate new entry
711721 bool need_allocate = updatePredictorStateAndCheckAllocation (btb_entry, actual_taken, recomputed, stream);
@@ -750,6 +760,13 @@ BTBTAGE::update(const FetchStream &stream) {
750760 }
751761#endif
752762 }
763+ // Update recomputed difference statistics (per fetchBlock)
764+ if (hasRecomputedVsActualDiff) {
765+ tageStats.recomputedVsActualDiff ++;
766+ }
767+ if (hasRecomputedVsOriginalDiff) {
768+ tageStats.recomputedVsOriginalDiff ++;
769+ }
753770 if (getDelay () <2 ){
754771 checkUtageUpdateMisspred (stream);
755772 }
@@ -1011,6 +1028,8 @@ BTBTAGE::TageStats::TageStats(statistics::Group* parent, int numPredictors, int
10111028 ADD_STAT (updateAllocSuccess, statistics::units::Count::get (), " alloc success when update" ),
10121029 ADD_STAT (updateMispred, statistics::units::Count::get (), " mispred when update" ),
10131030 ADD_STAT (updateResetU, statistics::units::Count::get (), " reset u when update" ),
1031+ ADD_STAT (recomputedVsActualDiff, statistics::units::Count::get (), " fetchBlocks where recomputed.taken != actual_taken" ),
1032+ ADD_STAT (recomputedVsOriginalDiff, statistics::units::Count::get (), " fetchBlocks where recomputed.taken != original pred.taken" ),
10141033 ADD_STAT (updateBankConflict, statistics::units::Count::get (), " number of bank conflicts detected" ),
10151034 ADD_STAT (updateDeferredDueToConflict, statistics::units::Count::get (), " number of updates deferred due to bank conflict (retried later)" ),
10161035 ADD_STAT (updateBankConflictPerBank, statistics::units::Count::get (), " bank conflicts per bank" ),
0 commit comments