gem5-users@gem5.org

The gem5 Users mailing list

View all threads

Set max number of instructions to simulate using Board+Simulator API

HE
Hossam ElAtali
Thu, Sep 15, 2022 4:30 PM

Hi everyone,

I know how to set the max number of instructions using the fs.py scripts. Setting "maxinsts" causes the cpus' max_insts_any_thread variable to be set. However, I'm currently using the board and Simulator style of creating the run scripts so these variables aren't exposed in the processor object I give to the board. I've been going around the code base and trying out different ways to set max_insts_any_thread but I always end up with " ... has no parameter max_insts_any_thread". Any ideas? Thank you.

Best regards,
Hossam

Hi everyone, I know how to set the max number of instructions using the fs.py scripts. Setting "maxinsts" causes the cpus' max_insts_any_thread variable to be set. However, I'm currently using the board and Simulator style of creating the run scripts so these variables aren't exposed in the processor object I give to the board. I've been going around the code base and trying out different ways to set max_insts_any_thread but I always end up with " ... has no parameter max_insts_any_thread". Any ideas? Thank you. Best regards, Hossam
BB
Bobby Bruce
Thu, Sep 15, 2022 6:43 PM

Hey Hossam,

A better API for setting max number of instructions via the Simulator
module will be coming in v22.1, but in the meantime you can do something
like:

processor.get_cores()[0].get_simobject().max_insts_any_thread = <max insts>

With the above, the simulation will exit when any thread on the first core
reaches the max number of threads.

--
Dr. Bobby R. Bruce
Room 3050,
Kemper Hall, UC Davis
Davis,
CA, 95616

web: https://www.bobbybruce.net

On Thu, Sep 15, 2022 at 9:31 AM Hossam ElAtali hossam.elatali@uwaterloo.ca
wrote:

Hi everyone,

I know how to set the max number of instructions using the fs.py scripts.

Setting “maxinsts” causes the cpus’ max_insts_any_thread variable to be
set. However, I’m currently using the board and Simulator style of creating
the run scripts so these variables aren’t exposed in the processor object I
give to the board. I’ve been going around the code base and trying out
different ways to set max_insts_any_thread but I always end up with “ … has
no parameter max_insts_any_thread”. Any ideas? Thank you.

Best regards,

Hossam


gem5-users mailing list -- gem5-users@gem5.org
To unsubscribe send an email to gem5-users-leave@gem5.org

Hey Hossam, A better API for setting max number of instructions via the Simulator module will be coming in v22.1, but in the meantime you can do something like: ``` processor.get_cores()[0].get_simobject().max_insts_any_thread = <max insts> ``` With the above, the simulation will exit when any thread on the first core reaches the max number of threads. -- Dr. Bobby R. Bruce Room 3050, Kemper Hall, UC Davis Davis, CA, 95616 web: https://www.bobbybruce.net On Thu, Sep 15, 2022 at 9:31 AM Hossam ElAtali <hossam.elatali@uwaterloo.ca> wrote: > > Hi everyone, > > > > I know how to set the max number of instructions using the fs.py scripts. Setting “maxinsts” causes the cpus’ max_insts_any_thread variable to be set. However, I’m currently using the board and Simulator style of creating the run scripts so these variables aren’t exposed in the processor object I give to the board. I’ve been going around the code base and trying out different ways to set max_insts_any_thread but I always end up with “ … has no parameter max_insts_any_thread”. Any ideas? Thank you. > > > > Best regards, > > Hossam > > > > _______________________________________________ > gem5-users mailing list -- gem5-users@gem5.org > To unsubscribe send an email to gem5-users-leave@gem5.org
HE
Hossam ElAtali
Mon, Sep 26, 2022 5:03 PM

Hi Dr. Bruce,

Thanks a lot for the reply.

Setting the variable this way works, but only if I set it before the simulation starts completely. I looked at the source code and it seems max_insts_any_thread is only used to schedule an exit event in the BaseCPU::init() function. I’m guessing this is only called once at the very beginning. Is there a way to set the max instruction count when the simulation has exited (e.g., due to an m5 exit instruction) so that it runs for n instructions after this point?

Best regards,
Hossam

From: Bobby Bruce bbruce@ucdavis.edu
Sent: Thursday, September 15, 2022 2:43 PM
To: The gem5 Users mailing list gem5-users@gem5.org
Subject: [gem5-users] Re: Set max number of instructions to simulate using Board+Simulator API

Hey Hossam,

A better API for setting max number of instructions via the Simulator module will be coming in v22.1, but in the meantime you can do something like:

processor.get_cores()[0].get_simobject().max_insts_any_thread = <max insts>

With the above, the simulation will exit when any thread on the first core reaches the max number of threads.

--
Dr. Bobby R. Bruce
Room 3050,
Kemper Hall, UC Davis
Davis,
CA, 95616

web: https://www.bobbybruce.net

On Thu, Sep 15, 2022 at 9:31 AM Hossam ElAtali <hossam.elatali@uwaterloo.camailto:hossam.elatali@uwaterloo.ca> wrote:

Hi everyone,

I know how to set the max number of instructions using the fs.py scripts. Setting “maxinsts” causes the cpus’ max_insts_any_thread variable to be set. However, I’m currently using the board and Simulator style of creating the run scripts so these variables aren’t exposed in the processor object I give to the board. I’ve been going around the code base and trying out different ways to set max_insts_any_thread but I always end up with “ … has no parameter max_insts_any_thread”. Any ideas? Thank you.

Best regards,

Hossam


gem5-users mailing list -- gem5-users@gem5.orgmailto:gem5-users@gem5.org
To unsubscribe send an email to gem5-users-leave@gem5.orgmailto:gem5-users-leave@gem5.org

Hi Dr. Bruce, Thanks a lot for the reply. Setting the variable this way works, but only if I set it before the simulation starts completely. I looked at the source code and it seems max_insts_any_thread is only used to schedule an exit event in the BaseCPU::init() function. I’m guessing this is only called once at the very beginning. Is there a way to set the max instruction count when the simulation has exited (e.g., due to an m5 exit instruction) so that it runs for n instructions after this point? Best regards, Hossam From: Bobby Bruce <bbruce@ucdavis.edu> Sent: Thursday, September 15, 2022 2:43 PM To: The gem5 Users mailing list <gem5-users@gem5.org> Subject: [gem5-users] Re: Set max number of instructions to simulate using Board+Simulator API Hey Hossam, A better API for setting max number of instructions via the Simulator module will be coming in v22.1, but in the meantime you can do something like: ``` processor.get_cores()[0].get_simobject().max_insts_any_thread = <max insts> ``` With the above, the simulation will exit when any thread on the first core reaches the max number of threads. -- Dr. Bobby R. Bruce Room 3050, Kemper Hall, UC Davis Davis, CA, 95616 web: https://www.bobbybruce.net On Thu, Sep 15, 2022 at 9:31 AM Hossam ElAtali <hossam.elatali@uwaterloo.ca<mailto:hossam.elatali@uwaterloo.ca>> wrote: > > Hi everyone, > > > > I know how to set the max number of instructions using the fs.py scripts. Setting “maxinsts” causes the cpus’ max_insts_any_thread variable to be set. However, I’m currently using the board and Simulator style of creating the run scripts so these variables aren’t exposed in the processor object I give to the board. I’ve been going around the code base and trying out different ways to set max_insts_any_thread but I always end up with “ … has no parameter max_insts_any_thread”. Any ideas? Thank you. > > > > Best regards, > > Hossam > > > > _______________________________________________ > gem5-users mailing list -- gem5-users@gem5.org<mailto:gem5-users@gem5.org> > To unsubscribe send an email to gem5-users-leave@gem5.org<mailto:gem5-users-leave@gem5.org>
BB
Bobby Bruce
Tue, Sep 27, 2022 10:15 PM

I believe there is a way to do this after the simulation has instantiated.
You can schedule a stop on a core like so:

processor.cores[0].core.scheduleInstStop(0, 100, "m5_workbegin instruction
encountered")

which will schedule a "workbegin" exit event after 100 instructions in core
0.

While not available on the stable branch just yet, we are working on
exposing this in a more clean way via the stdlib on the develop branch:
https://gem5-review.googlesource.com/c/public/gem5/+/63153. You could
cherry pick this patch and use the API created here.

--
Dr. Bobby R. Bruce
Room 3050,
Kemper Hall, UC Davis
Davis,
CA, 95616

web: https://www.bobbybruce.net

On Mon, Sep 26, 2022 at 10:09 AM Hossam ElAtali hossam.elatali@uwaterloo.ca
wrote:

Hi Dr. Bruce,

Thanks a lot for the reply.

Setting the variable this way works, but only if I set it before the

simulation starts completely. I looked at the source code and it seems
max_insts_any_thread is only used to schedule an exit event in the
BaseCPU::init() function. I’m guessing this is only called once at the very
beginning. Is there a way to set the max instruction count when the
simulation has exited (e.g., due to an m5 exit instruction) so that it runs
for n instructions after this point?

Best regards,

Hossam

From: Bobby Bruce bbruce@ucdavis.edu
Sent: Thursday, September 15, 2022 2:43 PM
To: The gem5 Users mailing list gem5-users@gem5.org
Subject: [gem5-users] Re: Set max number of instructions to simulate

using Board+Simulator API

Hey Hossam,

A better API for setting max number of instructions via the Simulator

module will be coming in v22.1, but in the meantime you can do something
like:

processor.get_cores()[0].get_simobject().max_insts_any_thread = <max

insts>


With the above, the simulation will exit when any thread on the first

core reaches the max number of threads.

--
Dr. Bobby R. Bruce
Room 3050,
Kemper Hall, UC Davis
Davis,
CA, 95616

web: https://www.bobbybruce.net

On Thu, Sep 15, 2022 at 9:31 AM Hossam ElAtali <

Hi everyone,

I know how to set the max number of instructions using the fs.py

scripts. Setting “maxinsts” causes the cpus’ max_insts_any_thread variable
to be set. However, I’m currently using the board and Simulator style of
creating the run scripts so these variables aren’t exposed in the processor
object I give to the board. I’ve been going around the code base and trying
out different ways to set max_insts_any_thread but I always end up with “ …
has no parameter max_insts_any_thread”. Any ideas? Thank you.

Best regards,

Hossam


gem5-users mailing list -- gem5-users@gem5.org
To unsubscribe send an email to gem5-users-leave@gem5.org


gem5-users mailing list -- gem5-users@gem5.org
To unsubscribe send an email to gem5-users-leave@gem5.org

I believe there is a way to do this after the simulation has instantiated. You can schedule a stop on a core like so: ``` processor.cores[0].core.scheduleInstStop(0, 100, "m5_workbegin instruction encountered") ``` which will schedule a "workbegin" exit event after 100 instructions in core 0. While not available on the stable branch just yet, we are working on exposing this in a more clean way via the stdlib on the develop branch: https://gem5-review.googlesource.com/c/public/gem5/+/63153. You could cherry pick this patch and use the API created here. -- Dr. Bobby R. Bruce Room 3050, Kemper Hall, UC Davis Davis, CA, 95616 web: https://www.bobbybruce.net On Mon, Sep 26, 2022 at 10:09 AM Hossam ElAtali <hossam.elatali@uwaterloo.ca> wrote: > > Hi Dr. Bruce, > > > > Thanks a lot for the reply. > > > > Setting the variable this way works, but only if I set it before the simulation starts completely. I looked at the source code and it seems max_insts_any_thread is only used to schedule an exit event in the BaseCPU::init() function. I’m guessing this is only called once at the very beginning. Is there a way to set the max instruction count when the simulation has exited (e.g., due to an m5 exit instruction) so that it runs for n instructions after this point? > > > > Best regards, > > Hossam > > > > From: Bobby Bruce <bbruce@ucdavis.edu> > Sent: Thursday, September 15, 2022 2:43 PM > To: The gem5 Users mailing list <gem5-users@gem5.org> > Subject: [gem5-users] Re: Set max number of instructions to simulate using Board+Simulator API > > > > Hey Hossam, > > A better API for setting max number of instructions via the Simulator module will be coming in v22.1, but in the meantime you can do something like: > > ``` > processor.get_cores()[0].get_simobject().max_insts_any_thread = <max insts> > ``` > > With the above, the simulation will exit when any thread on the first core reaches the max number of threads. > > > -- > Dr. Bobby R. Bruce > Room 3050, > Kemper Hall, UC Davis > Davis, > CA, 95616 > > web: https://www.bobbybruce.net > > > On Thu, Sep 15, 2022 at 9:31 AM Hossam ElAtali < hossam.elatali@uwaterloo.ca> wrote: > > > > Hi everyone, > > > > > > > > I know how to set the max number of instructions using the fs.py scripts. Setting “maxinsts” causes the cpus’ max_insts_any_thread variable to be set. However, I’m currently using the board and Simulator style of creating the run scripts so these variables aren’t exposed in the processor object I give to the board. I’ve been going around the code base and trying out different ways to set max_insts_any_thread but I always end up with “ … has no parameter max_insts_any_thread”. Any ideas? Thank you. > > > > > > > > Best regards, > > > > Hossam > > > > > > > > _______________________________________________ > > gem5-users mailing list -- gem5-users@gem5.org > > To unsubscribe send an email to gem5-users-leave@gem5.org > > _______________________________________________ > gem5-users mailing list -- gem5-users@gem5.org > To unsubscribe send an email to gem5-users-leave@gem5.org