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 <matthew.pore...@amd.com> 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 <gem5-users@gem5.org> > *Sent:* Tuesday, May 26, 2020 7:39 PM > *To:* Rajeev Pal <rjvpal0...@gmail.com> > *Cc:* gem5 users mailing list <gem5-users@gem5.org>; 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 <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 < > 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&data=02%7C01%7Cmatthew.poremba%40amd.com%7Cc1acc0e3db8b4b75f80b08d801e76d8e%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637261440774986854&sdata=LienH63%2FeykSsEWdBwDF2d2fqlBlqS7xzwpdZ8dqqco%3D&reserved=0> > to schedule the dumps. > > > > Muhammet > > > > Matt Sinclair via gem5-users <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&data=02%7C01%7Cmatthew.poremba%40amd.com%7Cc1acc0e3db8b4b75f80b08d801e76d8e%7C3dd8961fe4884e608e11a82d994e183d%7C0%7C0%7C637261440774986854&sdata=rWt7oZcEP%2Fn%2FqZjELAJUtCNRvV8orNwTK0ebBVVM270%3D&reserved=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 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