[gem5-users] Re: Stat dump after each N instructions - CPU and/or AMD GPU

2020-05-28 Thread Rajeev Pal via gem5-users
My understanding is that m5 ops need to be called from within a benchmark.
I am not sure how I can get the instruction count from within a benchmark.

But Matthew's idea works for the CPU side. Only issue is
cpu.simpoint_start_insts stops based on the instruction count of individual
cpus.
I would like to stop based on total instruction count of *all* cpus.
@Matthew: Do you have any idea as to how I can achieve this?

For the GPU side, I did a hack. For reference:
In wavefront.cc just after incrementing the *numInstrExecuted*, I totalled
numInstrExecuted (cu.numInstrExecuted.value()) for all CUs.
Then as pointed out by Muhammet, if I have reached my desired instruction
count, I schedule a Stats::schedStatEvent(true, true, curTick()+1, 0) for
the next tick.
I pass in the instruction count size as a parameter to each Wavefront from
python configs.

Thank you all.
This was very helpful.

On Wed, May 27, 2020 at 10:49 AM Poremba, Matthew 
wrote:

> [AMD Official Use Only - Internal Distribution Only]
>
>
>
> You could probably use the simpoint_start_insts vector param in CPU to
> have simulation exit to your python script and dump/reset stats there. For
> example:
>
>
>
> cpu.simpoint_start_insts = [x*N for x in range(1000)]
>
>
>
> where N is the instruction sample period. You’d have to know the
> approximate number of total instructions to figure out what to replace 1000
> with though.
>
>
>
>
>
> -Matt
>
>
>
> *From:* Matt Sinclair via gem5-users 
> *Sent:* Tuesday, May 26, 2020 7:39 PM
> *To:* Rajeev Pal 
> *Cc:* gem5 users mailing list ; Matt Sinclair <
> mattdsincl...@gmail.com>
> *Subject:* [gem5-users] Re: Stat dump after each N instructions - CPU
> and/or AMD GPU
>
>
>
> [CAUTION: External Email]
>
> Thanks, this is helpful Rajeev.  I am not an expert at this part of the
> simulator, but I believe the m5ops is indeed what you are looking for.
> After looking through the m5ops again, I don't think gem5 currently has
> exactly the feature you are looking for -- m5_dump_reset_stats is the
> closest, but it resets based on time, and you want instructions (as you and
> Muhammet discussed above).  So, my guess is that you should look at how
> m5_dump_reset_stats is implemented (start with include/gem5/m5ops.h), and
> create a new version of it that dumps/resets based on instructions instead.
>
>
>
> Matt
>
>
>
> On Tue, May 26, 2020 at 4:40 PM Rajeev Pal  wrote:
>
> schedStatEvent() would be helpful in case of tick based stat dumping.
>
> But I need instruction count based stat dumping.
>
>
>
> On Tue, May 26, 2020 at 5:28 PM Muhammet Abdullah Soytürk <
> muhammetabdullahsoyt...@gmail.com> wrote:
>
> I don't know how legal is this and whether it has side effects but you
> might try schedStatEvent
> <https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fgem5%2Fgem5%2Fblob%2Fmaster%2Fsrc%2Fsim%2Fstat_control.cc%23L248=02%7C01%7Cmatthew.poremba%40amd.com%7Cc1acc0e3db8b4b75f80b08d801e76d8e%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637261440774986854=LienH63%2FeykSsEWdBwDF2d2fqlBlqS7xzwpdZ8dqqco%3D=0>
> to schedule the dumps.
>
>
>
> Muhammet
>
>
>
> Matt Sinclair via gem5-users , 27 May 2020 Çar,
> 00:13 tarihinde şunu yazdı:
>
> I'm not sure if this is your ultimate problem, but if it only works on the
> CPU for the first N instructions, is N simply representing the point where
> you need a 64-bit counter instead of a 32-bit counter?
>
>
>
> Unfortunately I don't know the answer to your other questions, sorry.
> Perhaps you are thinking of the m5ops, which people often use for things
> like resetting stats:
> https://www.gem5.org/documentation/general_docs/m5ops/
> <https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.gem5.org%2Fdocumentation%2Fgeneral_docs%2Fm5ops%2F=02%7C01%7Cmatthew.poremba%40amd.com%7Cc1acc0e3db8b4b75f80b08d801e76d8e%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637261440774986854=rWt7oZcEP%2Fn%2FqZjELAJUtCNRvV8orNwTK0ebBVVM270%3D=0>
> ?
>
>
>
> Matt
>
>
>
> On Tue, May 26, 2020 at 2:12 PM Rajeev Pal via gem5-users <
> gem5-users@gem5.org> wrote:
>
> Hi All,
>
>
>
> Is it possible to dump and reset statistics after each N instructions for
> CPU and/or AMD GPU.
>
> I see that there is a *max_insts_any_thread* var for cpus. I was able to
> use it to stop simulation, dump and reset stats (from apu_se.py), but it
> only works for the *first* N instructions.
>
>
>
> (1) Is there any existing mechanism which I can leverage ?
>
>  There is a comInstEventQueue which I think is used to stop the
> simulation after first N instructions. Can I somehow us

[gem5-users] Re: Stat dump after each N instructions - CPU and/or AMD GPU

2020-05-27 Thread Poremba, Matthew via gem5-users
[AMD Official Use Only - Internal Distribution Only]

You could probably use the simpoint_start_insts vector param in CPU to have 
simulation exit to your python script and dump/reset stats there. For example:

cpu.simpoint_start_insts = [x*N for x in range(1000)]

where N is the instruction sample period. You'd have to know the approximate 
number of total instructions to figure out what to replace 1000 with though.


-Matt

From: Matt Sinclair via gem5-users 
Sent: Tuesday, May 26, 2020 7:39 PM
To: Rajeev Pal 
Cc: gem5 users mailing list ; Matt Sinclair 

Subject: [gem5-users] Re: Stat dump after each N instructions - CPU and/or AMD 
GPU

[CAUTION: External Email]
Thanks, this is helpful Rajeev.  I am not an expert at this part of the 
simulator, but I believe the m5ops is indeed what you are looking for.  After 
looking through the m5ops again, I don't think gem5 currently has exactly the 
feature you are looking for -- m5_dump_reset_stats is the closest, but it 
resets based on time, and you want instructions (as you and Muhammet discussed 
above).  So, my guess is that you should look at how m5_dump_reset_stats is 
implemented (start with include/gem5/m5ops.h), and create a new version of it 
that dumps/resets based on instructions instead.

Matt

On Tue, May 26, 2020 at 4:40 PM Rajeev Pal 
mailto:rjvpal0...@gmail.com>> wrote:
schedStatEvent() would be helpful in case of tick based stat dumping.
But I need instruction count based stat dumping.

On Tue, May 26, 2020 at 5:28 PM Muhammet Abdullah Soytürk 
mailto:muhammetabdullahsoyt...@gmail.com>> 
wrote:
I don't know how legal is this and whether it has side effects but you might 
try 
schedStatEvent<https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fgem5%2Fgem5%2Fblob%2Fmaster%2Fsrc%2Fsim%2Fstat_control.cc%23L248=02%7C01%7Cmatthew.poremba%40amd.com%7Cc1acc0e3db8b4b75f80b08d801e76d8e%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637261440774986854=LienH63%2FeykSsEWdBwDF2d2fqlBlqS7xzwpdZ8dqqco%3D=0>
 to schedule the dumps.

Muhammet

Matt Sinclair via gem5-users mailto:gem5-users@gem5.org>>, 
27 May 2020 Çar, 00:13 tarihinde şunu yazdı:
I'm not sure if this is your ultimate problem, but if it only works on the CPU 
for the first N instructions, is N simply representing the point where you need 
a 64-bit counter instead of a 32-bit counter?

Unfortunately I don't know the answer to your other questions, sorry.  Perhaps 
you are thinking of the m5ops, which people often use for things like resetting 
stats: 
https://www.gem5.org/documentation/general_docs/m5ops/<https://nam11.safelinks.protection.outlook.com/?url=https%3A%2F%2Fwww.gem5.org%2Fdocumentation%2Fgeneral_docs%2Fm5ops%2F=02%7C01%7Cmatthew.poremba%40amd.com%7Cc1acc0e3db8b4b75f80b08d801e76d8e%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637261440774986854=rWt7oZcEP%2Fn%2FqZjELAJUtCNRvV8orNwTK0ebBVVM270%3D=0>?

Matt

On Tue, May 26, 2020 at 2:12 PM Rajeev Pal via gem5-users 
mailto:gem5-users@gem5.org>> wrote:
Hi All,

Is it possible to dump and reset statistics after each N instructions for CPU 
and/or AMD GPU.
I see that there is a max_insts_any_thread var for cpus. I was able to use it 
to stop simulation, dump and reset stats (from apu_se.py), but it only works 
for the first N instructions.

(1) Is there any existing mechanism which I can leverage ?
 There is a comInstEventQueue which I think is used to stop the simulation 
after first N instructions. Can I somehow use this ?

(2) If not, then where and what sort of modifications will I need ? I need to 
do this for both CPU and AMD GPU.

Thank you,
Rajeev Pal
___
gem5-users mailing list -- gem5-users@gem5.org<mailto:gem5-users@gem5.org>
To unsubscribe send an email to 
gem5-users-le...@gem5.org<mailto:gem5-users-le...@gem5.org>
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s
___
gem5-users mailing list -- gem5-users@gem5.org<mailto:gem5-users@gem5.org>
To unsubscribe send an email to 
gem5-users-le...@gem5.org<mailto:gem5-users-le...@gem5.org>
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s
___
gem5-users mailing list -- gem5-users@gem5.org
To unsubscribe send an email to gem5-users-le...@gem5.org
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s

[gem5-users] Re: Stat dump after each N instructions - CPU and/or AMD GPU

2020-05-26 Thread Matt Sinclair via gem5-users
Thanks, this is helpful Rajeev.  I am not an expert at this part of the
simulator, but I believe the m5ops is indeed what you are looking for.
After looking through the m5ops again, I don't think gem5 currently has
exactly the feature you are looking for -- m5_dump_reset_stats is the
closest, but it resets based on time, and you want instructions (as you and
Muhammet discussed above).  So, my guess is that you should look at how
m5_dump_reset_stats is implemented (start with include/gem5/m5ops.h), and
create a new version of it that dumps/resets based on instructions instead.

Matt

On Tue, May 26, 2020 at 4:40 PM Rajeev Pal  wrote:

> schedStatEvent() would be helpful in case of tick based stat dumping.
> But I need instruction count based stat dumping.
>
> On Tue, May 26, 2020 at 5:28 PM Muhammet Abdullah Soytürk <
> muhammetabdullahsoyt...@gmail.com> wrote:
>
>> I don't know how legal is this and whether it has side effects but you
>> might try schedStatEvent
>> 
>> to schedule the dumps.
>>
>> Muhammet
>>
>> Matt Sinclair via gem5-users , 27 May 2020 Çar,
>> 00:13 tarihinde şunu yazdı:
>>
>>> I'm not sure if this is your ultimate problem, but if it only works on
>>> the CPU for the first N instructions, is N simply representing the point
>>> where you need a 64-bit counter instead of a 32-bit counter?
>>>
>>> Unfortunately I don't know the answer to your other questions, sorry.
>>> Perhaps you are thinking of the m5ops, which people often use for things
>>> like resetting stats:
>>> https://www.gem5.org/documentation/general_docs/m5ops/?
>>>
>>> Matt
>>>
>>> On Tue, May 26, 2020 at 2:12 PM Rajeev Pal via gem5-users <
>>> gem5-users@gem5.org> wrote:
>>>
 Hi All,

 Is it possible to dump and reset statistics after each N instructions
 for CPU and/or AMD GPU.
 I see that there is a *max_insts_any_thread* var for cpus. I was able
 to use it to stop simulation, dump and reset stats (from apu_se.py), but it
 only works for the *first* N instructions.

 (1) Is there any existing mechanism which I can leverage ?
  There is a comInstEventQueue which I think is used to stop the
 simulation after first N instructions. Can I somehow use this ?

 (2) If not, then where and what sort of modifications will I need ? I
 need to do this for both CPU and AMD GPU.

 Thank you,
 Rajeev Pal
 ___
 gem5-users mailing list -- gem5-users@gem5.org
 To unsubscribe send an email to gem5-users-le...@gem5.org
 %(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s
>>>
>>> ___
>>> gem5-users mailing list -- gem5-users@gem5.org
>>> To unsubscribe send an email to gem5-users-le...@gem5.org
>>> %(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s
>>
>>
___
gem5-users mailing list -- gem5-users@gem5.org
To unsubscribe send an email to gem5-users-le...@gem5.org
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s

[gem5-users] Re: Stat dump after each N instructions - CPU and/or AMD GPU

2020-05-26 Thread Rajeev Pal via gem5-users
schedStatEvent() would be helpful in case of tick based stat dumping.
But I need instruction count based stat dumping.

On Tue, May 26, 2020 at 5:28 PM Muhammet Abdullah Soytürk <
muhammetabdullahsoyt...@gmail.com> wrote:

> I don't know how legal is this and whether it has side effects but you
> might try schedStatEvent
> 
> to schedule the dumps.
>
> Muhammet
>
> Matt Sinclair via gem5-users , 27 May 2020 Çar,
> 00:13 tarihinde şunu yazdı:
>
>> I'm not sure if this is your ultimate problem, but if it only works on
>> the CPU for the first N instructions, is N simply representing the point
>> where you need a 64-bit counter instead of a 32-bit counter?
>>
>> Unfortunately I don't know the answer to your other questions, sorry.
>> Perhaps you are thinking of the m5ops, which people often use for things
>> like resetting stats:
>> https://www.gem5.org/documentation/general_docs/m5ops/?
>>
>> Matt
>>
>> On Tue, May 26, 2020 at 2:12 PM Rajeev Pal via gem5-users <
>> gem5-users@gem5.org> wrote:
>>
>>> Hi All,
>>>
>>> Is it possible to dump and reset statistics after each N instructions
>>> for CPU and/or AMD GPU.
>>> I see that there is a *max_insts_any_thread* var for cpus. I was able
>>> to use it to stop simulation, dump and reset stats (from apu_se.py), but it
>>> only works for the *first* N instructions.
>>>
>>> (1) Is there any existing mechanism which I can leverage ?
>>>  There is a comInstEventQueue which I think is used to stop the
>>> simulation after first N instructions. Can I somehow use this ?
>>>
>>> (2) If not, then where and what sort of modifications will I need ? I
>>> need to do this for both CPU and AMD GPU.
>>>
>>> Thank you,
>>> Rajeev Pal
>>> ___
>>> gem5-users mailing list -- gem5-users@gem5.org
>>> To unsubscribe send an email to gem5-users-le...@gem5.org
>>> %(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s
>>
>> ___
>> gem5-users mailing list -- gem5-users@gem5.org
>> To unsubscribe send an email to gem5-users-le...@gem5.org
>> %(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s
>
>
___
gem5-users mailing list -- gem5-users@gem5.org
To unsubscribe send an email to gem5-users-le...@gem5.org
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s

[gem5-users] Re: Stat dump after each N instructions - CPU and/or AMD GPU

2020-05-26 Thread Rajeev Pal via gem5-users
Pardon me, but I didn't mean that there is any limitation in the size of
the variable.
I tried it with 100 instructions, but I think it can be much larger.

My problem is how do I restart simulation after N=100 instructions
(from instruction number 101) and again stop after N=100 instructions.
(Total inst = 200). And I want to keep doing this over and till my program
ends (normally or via m5ops).

Also I am not sure whether m5ops will allow me to do the above based on
number of instructions.


On Tue, May 26, 2020 at 5:12 PM Matt Sinclair 
wrote:

> I'm not sure if this is your ultimate problem, but if it only works on the
> CPU for the first N instructions, is N simply representing the point where
> you need a 64-bit counter instead of a 32-bit counter?
>
> Unfortunately I don't know the answer to your other questions, sorry.
> Perhaps you are thinking of the m5ops, which people often use for things
> like resetting stats:
> https://www.gem5.org/documentation/general_docs/m5ops/?
>
> Matt
>
> On Tue, May 26, 2020 at 2:12 PM Rajeev Pal via gem5-users <
> gem5-users@gem5.org> wrote:
>
>> Hi All,
>>
>> Is it possible to dump and reset statistics after each N instructions for
>> CPU and/or AMD GPU.
>> I see that there is a *max_insts_any_thread* var for cpus. I was able to
>> use it to stop simulation, dump and reset stats (from apu_se.py), but it
>> only works for the *first* N instructions.
>>
>> (1) Is there any existing mechanism which I can leverage ?
>>  There is a comInstEventQueue which I think is used to stop the
>> simulation after first N instructions. Can I somehow use this ?
>>
>> (2) If not, then where and what sort of modifications will I need ? I
>> need to do this for both CPU and AMD GPU.
>>
>> Thank you,
>> Rajeev Pal
>> ___
>> gem5-users mailing list -- gem5-users@gem5.org
>> To unsubscribe send an email to gem5-users-le...@gem5.org
>> %(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s
>
>
___
gem5-users mailing list -- gem5-users@gem5.org
To unsubscribe send an email to gem5-users-le...@gem5.org
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s

[gem5-users] Re: Stat dump after each N instructions - CPU and/or AMD GPU

2020-05-26 Thread Muhammet Abdullah Soytürk via gem5-users
I don't know how legal is this and whether it has side effects but you
might try schedStatEvent
 to
schedule the dumps.

Muhammet

Matt Sinclair via gem5-users , 27 May 2020 Çar, 00:13
tarihinde şunu yazdı:

> I'm not sure if this is your ultimate problem, but if it only works on the
> CPU for the first N instructions, is N simply representing the point where
> you need a 64-bit counter instead of a 32-bit counter?
>
> Unfortunately I don't know the answer to your other questions, sorry.
> Perhaps you are thinking of the m5ops, which people often use for things
> like resetting stats:
> https://www.gem5.org/documentation/general_docs/m5ops/?
>
> Matt
>
> On Tue, May 26, 2020 at 2:12 PM Rajeev Pal via gem5-users <
> gem5-users@gem5.org> wrote:
>
>> Hi All,
>>
>> Is it possible to dump and reset statistics after each N instructions for
>> CPU and/or AMD GPU.
>> I see that there is a *max_insts_any_thread* var for cpus. I was able to
>> use it to stop simulation, dump and reset stats (from apu_se.py), but it
>> only works for the *first* N instructions.
>>
>> (1) Is there any existing mechanism which I can leverage ?
>>  There is a comInstEventQueue which I think is used to stop the
>> simulation after first N instructions. Can I somehow use this ?
>>
>> (2) If not, then where and what sort of modifications will I need ? I
>> need to do this for both CPU and AMD GPU.
>>
>> Thank you,
>> Rajeev Pal
>> ___
>> gem5-users mailing list -- gem5-users@gem5.org
>> To unsubscribe send an email to gem5-users-le...@gem5.org
>> %(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s
>
> ___
> gem5-users mailing list -- gem5-users@gem5.org
> To unsubscribe send an email to gem5-users-le...@gem5.org
> %(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s
___
gem5-users mailing list -- gem5-users@gem5.org
To unsubscribe send an email to gem5-users-le...@gem5.org
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s

[gem5-users] Re: Stat dump after each N instructions - CPU and/or AMD GPU

2020-05-26 Thread Matt Sinclair via gem5-users
I'm not sure if this is your ultimate problem, but if it only works on the
CPU for the first N instructions, is N simply representing the point where
you need a 64-bit counter instead of a 32-bit counter?

Unfortunately I don't know the answer to your other questions, sorry.
Perhaps you are thinking of the m5ops, which people often use for things
like resetting stats: https://www.gem5.org/documentation/general_docs/m5ops/
?

Matt

On Tue, May 26, 2020 at 2:12 PM Rajeev Pal via gem5-users <
gem5-users@gem5.org> wrote:

> Hi All,
>
> Is it possible to dump and reset statistics after each N instructions for
> CPU and/or AMD GPU.
> I see that there is a *max_insts_any_thread* var for cpus. I was able to
> use it to stop simulation, dump and reset stats (from apu_se.py), but it
> only works for the *first* N instructions.
>
> (1) Is there any existing mechanism which I can leverage ?
>  There is a comInstEventQueue which I think is used to stop the
> simulation after first N instructions. Can I somehow use this ?
>
> (2) If not, then where and what sort of modifications will I need ? I need
> to do this for both CPU and AMD GPU.
>
> Thank you,
> Rajeev Pal
> ___
> gem5-users mailing list -- gem5-users@gem5.org
> To unsubscribe send an email to gem5-users-le...@gem5.org
> %(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s
___
gem5-users mailing list -- gem5-users@gem5.org
To unsubscribe send an email to gem5-users-le...@gem5.org
%(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s