Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,8 @@ compile_commands.json

.vscode/
**/.DS_Store

# Large trace files
*.xz
*.gz
*.trace
2 changes: 1 addition & 1 deletion champsim_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"block_size": 64,
"page_size": 4096,
"heartbeat_frequency": 10000000,
"num_cores": 1,
"num_cores": 2,

"ooo_cpu": [
{
Expand Down
32 changes: 25 additions & 7 deletions src/champsim.cc
Original file line number Diff line number Diff line change
Expand Up @@ -145,8 +145,8 @@ phase_stats do_phase(const phase_info& phase, environment& env, std::vector<trac
// Phase complete
next_phase_complete[cpu.cpu] = next_phase_complete[cpu.cpu] || (cpu.sim_instr() >= length);

//halt cpu if warmup
if(next_phase_complete[cpu.cpu] && is_warmup && !cpu.halt) {
// Halt CPUs during warmup once their instruction budget is met
if (next_phase_complete[cpu.cpu] && is_warmup && !cpu.halt) {
cpu.halt = true;
fmt::print("{} halting CPU {} at instruction {} cycle {} for remainder of phase\n", phase_name, cpu.cpu, cpu.sim_instr(), cpu.sim_cycle());
}
Expand All @@ -158,18 +158,36 @@ phase_stats do_phase(const phase_info& phase, environment& env, std::vector<trac
op.end_phase(cpu.cpu);
}

fmt::print("{} finished CPU {} instructions: {} cycles: {} cumulative IPC: {:.4g} (Simulation time: {:%H hr %M min %S sec})\n", phase_name, cpu.cpu,
cpu.sim_instr(), cpu.sim_cycle(), std::ceil(cpu.sim_instr()) / std::ceil(cpu.sim_cycle()), elapsed_time());
if (!is_warmup) {
// Simulation phase: true ROI, from roi_stats
auto roi_instr = cpu.roi_instr();
auto roi_cycle = cpu.roi_cycle();
auto roi_ipc = std::ceil(roi_instr) / std::ceil(roi_cycle);
fmt::print("{} finished CPU {} instructions: {} cycles: {} cumulative IPC: {:.4g} (Simulation time: {:%H hr %M min %S sec})\n",
phase_name, cpu.cpu, roi_instr, roi_cycle, roi_ipc, elapsed_time());
} else {
// Warmup phase: just print using sim_instr/sim_cycle (per-phase progress)
auto w_instr = cpu.sim_instr();
auto w_cycle = cpu.sim_cycle();
auto w_ipc = std::ceil(w_instr) / std::ceil(w_cycle);
fmt::print("{} finished CPU {} instructions: {} cycles: {} cumulative IPC: {:.4g} (Simulation time: {:%H hr %M min %S sec})\n",
phase_name, cpu.cpu, w_instr, w_cycle, w_ipc, elapsed_time());
}
}
}

phase_complete = next_phase_complete;
}

for (O3_CPU& cpu : env.cpu_view()) {
fmt::print("{} complete CPU {} instructions: {} cycles: {} cumulative IPC: {:.4g} (Simulation time: {:%H hr %M min %S sec})\n", phase_name, cpu.cpu,
cpu.sim_instr(), cpu.sim_cycle(), std::ceil(cpu.sim_instr()) / std::ceil(cpu.sim_cycle()), elapsed_time());
}
if (!is_warmup) {
auto roi_instr = cpu.roi_instr();
auto roi_cycle = cpu.roi_cycle();
auto roi_ipc = std::ceil(roi_instr) / std::ceil(roi_cycle);
fmt::print("{} complete CPU {} instructions: {} cycles: {} cumulative IPC: {:.4g} (Simulation time: {:%H hr %M min %S sec})\n",
phase_name, cpu.cpu, roi_instr, roi_cycle, roi_ipc, elapsed_time());
}
}

phase_stats stats;
stats.name = phase.name;
Expand Down
12 changes: 8 additions & 4 deletions src/ooo_cpu.cc
Original file line number Diff line number Diff line change
Expand Up @@ -91,14 +91,18 @@ void O3_CPU::begin_phase()

void O3_CPU::end_phase(unsigned finished_cpu)
{
// Record where the phase ended (overwrite if this is later)
if (finished_cpu != this->cpu) {
return;
}

// Record where the phase ended for this CPU
sim_stats.end_instrs = num_retired;
sim_stats.end_cycles = current_time.time_since_epoch() / clock_period;

if (finished_cpu == this->cpu) {
finish_phase_instr = num_retired;
finish_phase_time = current_time;
finish_phase_instr = num_retired;
finish_phase_time = current_time;

if (!warmup) {
roi_stats = sim_stats;
}
}
Expand Down