@@ -707,15 +707,25 @@ BTBTAGE::update(const FetchStream &stream) {
707707 }
708708
709709 // Process each BTB entry
710+ bool hasRecomputedVsActualDiff = false ;
711+ bool hasRecomputedVsOriginalDiff = false ;
710712 for (auto &btb_entry : entries_to_update) {
711713 bool actual_taken = stream.exeTaken && stream.exeBranchInfo == btb_entry;
712714 TagePrediction recomputed;
713715 if (updateOnRead) { // if update on read is enabled, re-read providers using snapshot
714716 // Re-read providers using snapshot (do not rely on prediction-time main/alt)
715717 recomputed = generateSinglePrediction (btb_entry, startAddr, predMeta);
718+ // Track differences for statistics
719+ auto it = predMeta->preds .find (btb_entry.pc );
720+ if (it != predMeta->preds .end () && recomputed.taken != it->second .taken ) {
721+ hasRecomputedVsOriginalDiff = true ;
722+ }
716723 } else { // otherwise, use the prediction from the prediction-time main/alt
717724 recomputed = predMeta->preds [btb_entry.pc ];
718725 }
726+ if (recomputed.taken != actual_taken) {
727+ hasRecomputedVsActualDiff = true ;
728+ }
719729
720730 // Update predictor state and check if need to allocate new entry
721731 bool need_allocate = updatePredictorStateAndCheckAllocation (btb_entry, actual_taken, recomputed, stream);
@@ -760,6 +770,13 @@ BTBTAGE::update(const FetchStream &stream) {
760770 }
761771#endif
762772 }
773+ // Update recomputed difference statistics (per fetchBlock)
774+ if (hasRecomputedVsActualDiff) {
775+ tageStats.recomputedVsActualDiff ++;
776+ }
777+ if (hasRecomputedVsOriginalDiff) {
778+ tageStats.recomputedVsOriginalDiff ++;
779+ }
763780 if (getDelay () <2 ){
764781 checkUtageUpdateMisspred (stream);
765782 }
@@ -1026,6 +1043,8 @@ BTBTAGE::TageStats::TageStats(statistics::Group* parent, int numPredictors, int
10261043 ADD_STAT (updateAllocSuccess, statistics::units::Count::get (), " alloc success when update" ),
10271044 ADD_STAT (updateMispred, statistics::units::Count::get (), " mispred when update" ),
10281045 ADD_STAT (updateResetU, statistics::units::Count::get (), " reset u when update" ),
1046+ ADD_STAT (recomputedVsActualDiff, statistics::units::Count::get (), " fetchBlocks where recomputed.taken != actual_taken" ),
1047+ ADD_STAT (recomputedVsOriginalDiff, statistics::units::Count::get (), " fetchBlocks where recomputed.taken != original pred.taken" ),
10291048 ADD_STAT (updateBankConflict, statistics::units::Count::get (), " number of bank conflicts detected" ),
10301049 ADD_STAT (updateDeferredDueToConflict, statistics::units::Count::get (), " number of updates deferred due to bank conflict (retried later)" ),
10311050 ADD_STAT (updateBankConflictPerBank, statistics::units::Count::get (), " bank conflicts per bank" ),
0 commit comments