Hi Heng,
Thanks for your reply. Do you mean something like this? I changed atomic.cc
like this:

void AtomicSimpleCPU::drainResume()
{
    assert(!tickEvent.scheduled());
    if (switchedOut())
        return;

    DPRINTF(SimpleCPU, "Resume\n");
    verifyMemoryMode();

    assert(!threadContexts.empty());

    _status = BaseSimpleCPU::Idle;

* threadInfo[0]->thread->lastSuspend = curTick();*
    for (ThreadID tid = 0; tid < numThreads; tid++) {
        if (threadInfo[tid]->thread->status() == ThreadContext::Active) {
            threadInfo[tid]->execContextStats.notIdleFraction = 1;
            activeThreads.push_back(tid);
            _status = BaseSimpleCPU::Running;

            // Tick if any threads active
            if (!tickEvent.scheduled()) {
                schedule(tickEvent, nextCycle());
            }
        } else {
            threadInfo[tid]->execContextStats.notIdleFraction = 0;
        }
    }


    // Reschedule any power gating event (if any)
    schedulePowerGatingEvent();
}

After this change, I rebuilt gem5 and ran a simulation on simple.py. But
still, the number of cycles is very higher than the number of instructions.
system.cpu.numCycles                           524617
# Number of cpu cycles simulated (Cycle)
system.cpu.exec_context.thread_0.numInsts         6701
  # Number of instructions committed (Count)


I'm not sure if I'm missing something. Is this the right way to get the
cycles and the instructions? For SPEC2017, the stats are even more
complicated and I'm not sure what's the right way. Could you help me with
it? Thank you so much.

Best,
Farbin.

On Wed, Apr 12, 2023 at 5:23 PM HENG ZHUO <hzh...@wisc.edu> wrote:

> Hi,
> I ran into similar issues before. Say I did, boot the cpus with atomic
> cpu, then warmup the application with atomic cpu, then restore with atomic
> cpu for ROI data collection. With this, the final numcycles are counted
> including boot+warmup+roi, not just roi. If you did a finalTick/ frequency,
> that should match.
>
> Issue: in simple cpu, including both atomic and timing
> lastSuspend is 0 when resume, then when it try to increment cycles
> using lastActivate-lastSuspend, it includes all cycles before.
>
> My fix: add this line in
> AtomicSimpleCPU::drainResume()
> threadInfo[0]->thread->lastSuspend = curTick();
>
> So, whenever atomic cpu resume from checkpoint, it counts from that point.
> I hope this is what you were looking for. This can probably make to the
> mainline gem5 if my understanding of the issue is correct.
>
> Best,
> Heng
>
> On Apr 12, 2023, at 15:40, Farbin Fayza via gem5-users <
> gem5-users@gem5.org> wrote:
>
> Hi, I'm running SPEC2017 benchmark in full-system mode using
> the configs/example/gem5_library/x86-spec-cpu2017-benchmarks.py config
> file.
>
> In the outputs m5/stats.txt, there's no system.cpu.cpi metric mentioned.
> So, to calculate the CPI, I tried dividing 
> board.processor.switch0.core.numCycles
> by
> board.processor.switch0.core.exec_context.thread_0.numInsts. But it
> results in a large number (~10) which I don't think is the correct way to
> calculate CPI. Could anyone tell me what is the correct way to calculate
> the CPI based on the stats.txt results?
>
> Thanks,
> Farbin.
> _______________________________________________
> gem5-users mailing list -- gem5-users@gem5.org
> To unsubscribe send an email to gem5-users-le...@gem5.org
>
>
>
_______________________________________________
gem5-users mailing list -- gem5-users@gem5.org
To unsubscribe send an email to gem5-users-le...@gem5.org

Reply via email to