From 23103781431dac4859b0631c86b8eec3784cf908 Mon Sep 17 00:00:00 2001 From: Kanellopoulos Konstantinos Date: Wed, 10 Dec 2025 16:34:27 +0100 Subject: [PATCH] Fix warmup phase statistics and multicore CPU handling - Fix ROI stats reporting: use roi_instr/roi_cycle for simulation phases and sim_instr/sim_cycle for warmup phases - Fix end_phase() to only update roi_stats during simulation (not warmup) - Only call end_phase for the CPU that actually finished - Add trace file extensions to .gitignore (*.xz, *.gz, *.trace) - Update default config to 2 cores for testing multicore scenarios --- .gitignore | 5 +++++ champsim_config.json | 2 +- src/champsim.cc | 32 +++++++++++++++++++++++++------- src/ooo_cpu.cc | 12 ++++++++---- 4 files changed, 39 insertions(+), 12 deletions(-) diff --git a/.gitignore b/.gitignore index 63df0656db..3c57b7b9c8 100644 --- a/.gitignore +++ b/.gitignore @@ -30,3 +30,8 @@ compile_commands.json .vscode/ **/.DS_Store + +# Large trace files +*.xz +*.gz +*.trace diff --git a/champsim_config.json b/champsim_config.json index d8a33e13c6..248267442b 100644 --- a/champsim_config.json +++ b/champsim_config.json @@ -3,7 +3,7 @@ "block_size": 64, "page_size": 4096, "heartbeat_frequency": 10000000, - "num_cores": 1, + "num_cores": 2, "ooo_cpu": [ { diff --git a/src/champsim.cc b/src/champsim.cc index 405cb93273..ed11fe37a8 100644 --- a/src/champsim.cc +++ b/src/champsim.cc @@ -145,8 +145,8 @@ phase_stats do_phase(const phase_info& phase, environment& env, std::vector= 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()); } @@ -158,8 +158,21 @@ phase_stats do_phase(const phase_info& phase, environment& env, std::vectorcpu) { + 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; } }