diff --git a/src/cpu/pred/ftb/decoupled_bpred.cc b/src/cpu/pred/ftb/decoupled_bpred.cc index cdc9c76ead..97ab2047f0 100644 --- a/src/cpu/pred/ftb/decoupled_bpred.cc +++ b/src/cpu/pred/ftb/decoupled_bpred.cc @@ -563,7 +563,8 @@ DecoupledBPUWithFTB::DBPFTBStats::DBPFTBStats(statistics::Group* parent, unsigne ADD_STAT(controlCommitSquashOfUncond, statistics::units::Count::get(), "control squash of uncond branch at commit"), ADD_STAT(controlCommitSquashOfUncondDirect, statistics::units::Count::get(), "control squash of uncond direct branch at commit"), ADD_STAT(controlCommitSquashOfUncondIndirect, statistics::units::Count::get(), "control squash of indirect branch at commit"), - ADD_STAT(controlCommitSquashOfUncondReturn, statistics::units::Count::get(), "control squash of return branch at commit") + ADD_STAT(controlCommitSquashOfUncondReturn, statistics::units::Count::get(), "control squash of return branch at commit"), + ADD_STAT(ftqEndReasonDist, statistics::units::Count::get(), "distribution of ftq end reason") { predsOfEachStage.init(numStages); commitPredsFromEachStage.init(numStages+1); @@ -579,6 +580,11 @@ DecoupledBPUWithFTB::DBPFTBStats::DBPFTBStats(statistics::Group* parent, unsigne commitTrapSquashLatencyDist.init(1,16,1); commitNonControlSquashLatencyDist.init(1,16,1); updateLatencyDist.init(1,64,2); + ftqEndReasonDist.init(static_cast(FTQEndReason::NUM_REASONS)).flags(statistics::pdf); + ftqEndReasonDist.subname(static_cast(FTQEndReason::NOT_END), "not_end"); + ftqEndReasonDist.subname(static_cast(FTQEndReason::TAKEN), "taken"); + ftqEndReasonDist.subname(static_cast(FTQEndReason::SIZE_LIMIT), "size_limit"); + ftqEndReasonDist.subname(static_cast(FTQEndReason::LOOP_END), "loop_end"); } DecoupledBPUWithFTB::BpTrace::BpTrace(FetchStream &stream, const DynInstPtr &inst, bool mispred) @@ -798,6 +804,7 @@ DecoupledBPUWithFTB::decoupledPredict(const StaticInstPtr &inst, if (raw_taken) { if (current_loop_iter >= loop_iter - 1) { run_out_of_this_entry = true; + dbpFtbStats.ftqEndReasonDist[static_cast(FTQEndReason::LOOP_END)]++; if (loop_exit) { taken = false; lb.tryUnpin(); @@ -809,6 +816,7 @@ DecoupledBPUWithFTB::decoupledPredict(const StaticInstPtr &inst, } else { if (taken) { run_out_of_this_entry = true; + dbpFtbStats.ftqEndReasonDist[static_cast(FTQEndReason::TAKEN)]++; } } @@ -826,6 +834,7 @@ DecoupledBPUWithFTB::decoupledPredict(const StaticInstPtr &inst, inst->advancePC(*target); if (target->instAddr() >= end) { run_out_of_this_entry = true; + dbpFtbStats.ftqEndReasonDist[static_cast(FTQEndReason::SIZE_LIMIT)]++; } } DPRINTF(DecoupleBP, "Predict it %staken to %#lx\n", taken ? "" : "not ", diff --git a/src/cpu/pred/ftb/decoupled_bpred.hh b/src/cpu/pred/ftb/decoupled_bpred.hh index e7f28b2b10..2ff84d7b1a 100644 --- a/src/cpu/pred/ftb/decoupled_bpred.hh +++ b/src/cpu/pred/ftb/decoupled_bpred.hh @@ -8,6 +8,7 @@ #include #include "arch/generic/pcstate.hh" +#include "base/statistics.hh" #include "config/the_isa.hh" // #include "cpu/base.hh" #include "cpu/o3/cpu_def.hh" @@ -523,11 +524,19 @@ class DecoupledBPUWithFTB : public BPredUnit statistics::Scalar controlCommitSquashOfUncondIndirect; statistics::Scalar controlCommitSquashOfUncondReturn; - + statistics::Vector ftqEndReasonDist; DBPFTBStats(statistics::Group* parent, unsigned numStages, unsigned fsqSize); } dbpFtbStats; + enum class FTQEndReason { + NOT_END, + TAKEN, + SIZE_LIMIT, + LOOP_END, + NUM_REASONS + }; + public: void tick();