Skip to content

Commit

Permalink
Collect Stats for WP is unavailable
Browse files Browse the repository at this point in the history
  • Loading branch information
krishnamtibrewala authored and cpepis committed Jan 22, 2025
1 parent d83aec0 commit 3de839b
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 4 deletions.
9 changes: 8 additions & 1 deletion inc/ooo_cpu.h
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,10 @@ struct cpu_stats {
uint64_t wrong_path_loads = 0;
uint64_t wrong_path_loads_executed = 0;
uint64_t non_branch_squashes = 0;
uint64_t fetch_mispred_block_cycles = 0;
uint64_t fetch_mispred_block_cycles = 0;

uint64_t lack_of_WP_inst_count = 0;
uint64_t lack_of_WP_inst_cycles = 0;

uint64_t lq_full_events = 0;
uint64_t sq_full_events = 0;
Expand Down Expand Up @@ -132,6 +135,10 @@ class O3_CPU : public champsim::operable
{
public:
uint32_t cpu = 0;

//for when we dont have wrong path instr available
uint64_t WP_insts_not_available_cycle = 0;
bool WP_insts_not_available = false;

// cycle
uint64_t begin_phase_cycle = 0;
Expand Down
19 changes: 16 additions & 3 deletions src/ooo_cpu.cc
Original file line number Diff line number Diff line change
Expand Up @@ -212,14 +212,16 @@ void O3_CPU::initialize_instruction()
#ifdef BGODALA
fmt::print("inserting ip: {:#x} wp: {}\n", inst.ip, inst.is_wrong_path);
#endif


// Following condition will be only true if the wrong path instructions are finished
if (in_wrong_path && !inst.is_wrong_path){
stop_fetch = true;
in_wrong_path = false;
in_wrong_path = false;
fetch_resume_cycle = std::numeric_limits<uint64_t>::max();
#ifdef BGODALA
fmt::print("wrong path over at ip: {:#x}\n", inst.ip);
fmt::print("wrong path over at ip: {:#x}\n", inst.ip);
#endif
WP_insts_not_available = true;
break;
}

Expand Down Expand Up @@ -441,6 +443,17 @@ long O3_CPU::fetch_instruction()
bool failed = false;

auto l1i_req_begin = std::find_if(std::begin(IFETCH_BUFFER), std::end(IFETCH_BUFFER), fetch_ready);

if(WP_insts_not_available && IFETCH_BUFFER.empty() && !WP_insts_not_available_cycle){
sim_stats.lack_of_WP_inst_count++;
WP_insts_not_available_cycle = current_cycle;
}

if (WP_insts_not_available_cycle && IFETCH_BUFFER.size()) {
sim_stats.lack_of_WP_inst_cycles += current_cycle - WP_insts_not_available_cycle;
WP_insts_not_available_cycle = 0;
}

for (auto to_read = L1I_BANDWIDTH; to_read > 0 && l1i_req_begin != std::end(IFETCH_BUFFER); --to_read) {
auto l1i_req_end = std::adjacent_find(l1i_req_begin, std::end(IFETCH_BUFFER), no_match_ip);
if (l1i_req_end != std::end(IFETCH_BUFFER)) {
Expand Down
1 change: 1 addition & 0 deletions src/plain_printer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ void champsim::plain_printer::print(O3_CPU::stats_type stats)
fmt::print(stream, "LQ Full Events {}\n", stats.lq_full_events);
fmt::print(stream, "SQ Full Events {}\n", stats.sq_full_events);
fmt::print(stream, "Non Branch Squashes {}\n", stats.non_branch_squashes);
fmt::print(stream, "WP Not Available Count {} Cycles {}\n", stats.lack_of_WP_inst_count, stats.lack_of_WP_inst_cycles);
fmt::print(stream, "\n");

fmt::print(stream, "Inst Stats\n");
Expand Down

0 comments on commit 3de839b

Please sign in to comment.