Re: [gem5-users] RISC-V ISA + Gathering stats for ROI only

2019-07-27 Thread Alec Roelke
Hi Marcelo,

You're right that RISC-V doesn't have m5_ops implemented yet, but one way
you could get an instruction count is by reading the INSTRET CSR in your
program just before your ROI, since that directly reads the CPU model's
instruction counter.

Hope this helps,
Alec Roelke

On Thu, Jul 25, 2019 at 9:18 AM Marcelo Brandalero <
marcelo.brandal...@gmail.com> wrote:

> Hi all,
>
> I have an application compiled for the RISC-V ISA running in gem5 SE mode.
> I want to profile, i.e. get the execution stats, only for a specific kernel
> / Region of Interest (ROI) inside the code.
>
> I understand the standard way to approach this would be to insert m5_ops
> that call m5_reset_stats() and m5_dump_stats() but, if I understand
> correctly, m5_ops support for RISC-V is still unavailable (thread from
> Dec 2017 ).
>
> Another way I see is to modify the configuration script by inserting calls
> to *system.cpu.scheduleInstStop *and scheduling an event triggered at a
> certain instruction count to reset and dump the stats. However, I cannot
> figure an easy way to find the exact instruction count where the ROI begins
> and ends.
>
> I wonder if there is another simple way to approach this. Is there some
> way to access the application's *stdout *from inside the python
> configuration script? This way I could insert printf("ROI BEGIN\n"); in my
> code, compile without any external library, and then run in gem5 while
> monitoring the *stdout* from inside the python script. When that output
> line is found, the events are triggered.
>
> Is there any suggestion on how to gathering stats for ROI only in a RISC-V
> program, considering the unavailability of m5_ops?
>
> Thank you and best regards
>
> --
> Marcelo Brandalero
> ___
> gem5-users mailing list
> gem5-users@gem5.org
> http://m5sim.org/cgi-bin/mailman/listinfo/gem5-users
___
gem5-users mailing list
gem5-users@gem5.org
http://m5sim.org/cgi-bin/mailman/listinfo/gem5-users

[gem5-users] RISC-V ISA + Gathering stats for ROI only

2019-07-25 Thread Marcelo Brandalero
Hi all,

I have an application compiled for the RISC-V ISA running in gem5 SE mode.
I want to profile, i.e. get the execution stats, only for a specific kernel
/ Region of Interest (ROI) inside the code.

I understand the standard way to approach this would be to insert m5_ops
that call m5_reset_stats() and m5_dump_stats() but, if I understand
correctly, m5_ops support for RISC-V is still unavailable (thread from Dec
2017 ).

Another way I see is to modify the configuration script by inserting calls
to *system.cpu.scheduleInstStop *and scheduling an event triggered at a
certain instruction count to reset and dump the stats. However, I cannot
figure an easy way to find the exact instruction count where the ROI begins
and ends.

I wonder if there is another simple way to approach this. Is there some way
to access the application's *stdout *from inside the python configuration
script? This way I could insert printf("ROI BEGIN\n"); in my code, compile
without any external library, and then run in gem5 while monitoring the
*stdout* from inside the python script. When that output line is found, the
events are triggered.

Is there any suggestion on how to gathering stats for ROI only in a RISC-V
program, considering the unavailability of m5_ops?

Thank you and best regards

-- 
Marcelo Brandalero
___
gem5-users mailing list
gem5-users@gem5.org
http://m5sim.org/cgi-bin/mailman/listinfo/gem5-users