Hi Andreas
I want to measure the stack distance for l2 cache. So, tried to place the
CommMonitor between toL2Bus.master and l2cache.cpu_side in BaseCPU.py as:
#self.toL2Bus.master = self.l2cache.cpu_side
#self._cached_ports = ['l2cache.mem_side']
self.l2MONITOR = CommMonitor()
self.l2MONITOR.stackdist = StackDistProbe(verify = True)
self.toL2Bus.master = self.l2MONITOR.slave
self.l2MONITOR.master = self.l2cache.cpu_side
self._cached_ports = ['l2cache.mem_side']
I tried assigning a StackDistProbe to the comm monitor as:
stackdist = Param.StackDistProbe(NULL)
I re-compiled as scons build/X86/gem5.debug. It worked fine. The error I
got while trying to run an example was
Traceback (most recent call last):
File "<string>", line 1, in <module>
File
"/home/bhaskar/Downloads/gem5-stable-a48faafdb3bf/src/python/m5/main.py",
line 389, in main
exec filecode in scope
File "configs/example/se.py", line 286, in <module>
Simulation.run(options, root, system, FutureClass)
File
"/home/bhaskar/Downloads/gem5-stable-a48faafdb3bf/configs/common/Simulation.py",
line 583, in run
m5.instantiate(checkpoint_dir)
File
"/home/bhaskar/Downloads/gem5-stable-a48faafdb3bf/src/python/m5/simulate.py",
line 114, in instantiate
for obj in root.descendants(): obj.createCCObject()
File
"/home/bhaskar/Downloads/gem5-stable-a48faafdb3bf/src/python/m5/SimObject.py",
line 1453, in createCCObject
self.getCCParams()
File
"/home/bhaskar/Downloads/gem5-stable-a48faafdb3bf/src/python/m5/SimObject.py",
line 1400, in getCCParams
value = value.getValue()
File
"/home/bhaskar/Downloads/gem5-stable-a48faafdb3bf/src/python/m5/SimObject.py",
line 1457, in getValue
return self.getCCObject()
File
"/home/bhaskar/Downloads/gem5-stable-a48faafdb3bf/src/python/m5/SimObject.py",
line 1435, in getCCObject
params = self.getCCParams()
File
"/home/bhaskar/Downloads/gem5-stable-a48faafdb3bf/src/python/m5/SimObject.py",
line 1400, in getCCParams
value = value.getValue()
File
"/home/bhaskar/Downloads/gem5-stable-a48faafdb3bf/src/python/m5/params.py",
line 248, in getValue
return [ v.getValue() for v in self ]
File
"/home/bhaskar/Downloads/gem5-stable-a48faafdb3bf/src/python/m5/SimObject.py",
line 1457, in getValue
return self.getCCObject()
File
"/home/bhaskar/Downloads/gem5-stable-a48faafdb3bf/src/python/m5/SimObject.py",
line 1435, in getCCObject
params = self.getCCParams()
File
"/home/bhaskar/Downloads/gem5-stable-a48faafdb3bf/src/python/m5/SimObject.py",
line 1400, in getCCParams
value = value.getValue()
File
"/home/bhaskar/Downloads/gem5-stable-a48faafdb3bf/src/python/m5/SimObject.py",
line 1457, in getValue
return self.getCCObject()
File
"/home/bhaskar/Downloads/gem5-stable-a48faafdb3bf/src/python/m5/SimObject.py",
line 1439, in getCCObject
% self.path()
RuntimeError: system.monitor.stackdist: Cycle found in configuration
hierarchy.
Can you please explain if I need to modify se.py for my purpose? Please
help me out through this as I am very new to gem5.
Thanks
Bhaskar
On Thu, Nov 5, 2015 at 1:50 PM, Andreas Hansson <[email protected]>
wrote:
> Hi Bhaskar,
>
> Have a look at tests/config/tgen-simple-mem.py.
>
> The comm monitor has a master and a slave port, and you need to connect it
> “between” two other modules. There are plenty examples on the mailing list
> for adding it between the L1 and L2, for example by changing BaseCpu.py (if
> you do, remember to recompile). Once you have instantiated the comm
> monitor, and connected it, run an experiment and make sure you get the
> stats in the stats.txt output. Also, if you install pydot, you can see the
> system topology in m5out/config.dot.pdf or config.dot.svg (the latter even
> has mouseover tooltips etc).
>
> When the things above are working, just assign a StackDistProbe to the
> comm monitor, as done in tests/config/tgen-simple-mem.py.
>
> Good luck.
>
> Andreas
>
> From: gem5-users <[email protected]> on behalf of Bhaskar
> Kalita <[email protected]>
> Reply-To: gem5 users mailing list <[email protected]>
> Date: Wednesday, 4 November 2015 at 20:23
> To: gem5 users mailing list <[email protected]>
> Subject: Re: [gem5-users] How to use stack distance calculator in gem5.
>
> Hi Andreas,
>
> Thanks for your response. Can you please tell me how to instantiate the
> probe. I tried modifying the se.py file as:
>
> # Create a separate clock domain for the CPUs
> system.cpu_clk_domain = SrcClockDomain(clock = options.cpu_clock,
> voltage_domain =
> system.cpu_voltage_domain)
>
> # to calculate stack distance
> system.monitor = CommMonitor()
> system.monitor.stackdist = StackDistProbe(verify = True)
>
>
> And also changed BaseCPU.py as:
>
> def addTwoLevelCacheHierarchy(self, ic, dc, l2c, iwc = None, dwc = None):
> self.addPrivateSplitL1Caches(ic, dc, iwc, dwc)
> self.toL2Bus = L2XBar()
> self.connectCachedPorts(self.toL2Bus)
> self.l2cache = l2c
> self.toL2Bus.master = self.l2cache.cpu_side
> self._cached_ports = ['l2cache.mem_side']
>
> # to calculate stack distance
> self.l2MONITOR = StackDistProbe(verify = True)
> self._cached_ports = self.l2MONITOR.slave
> self.l2MONITOR.master = l2cache.mem_side
>
> When I tried to run my program I got an error as "fatal: Communication
> monitor is not connected on both sides."
> Can you please tell me if I am approaching in the right direction and what
> are the other things to be done.
>
> Thanks
>
>
>
> On Mon, Nov 2, 2015 at 2:10 PM, Andreas Hansson <[email protected]>
> wrote:
>
>> Hi Bhaskar,
>>
>> There are a few steps you need to take, and it involves a few
>> widely-adopted gem5 concepts:
>>
>> - First, the stack distance calculator is a probe, and the output is in
>> the shape of gem5 stats. Thus, you need to instantiate the probe, and
>> attach it to a probe point.
>>
>> - Second, to be able to attach the probe in various locations in the
>> memory system (core to L1, before the L2, in front of the system memory),
>> we use a module called a CommMonitor, which has a bunch of generic stats,
>> but also suitable packet probe points.
>>
>> Consequently, you need to modify your script that assembles and
>> configures the system, in your case se.py, and instantiate a CommMonitor,
>> connect it where you want to monitor the communication, then instantiate a
>> StackDistProbe and attach it to the monitor you just instantiated. The bad
>> news is that it involves quite a few steps. The good news is that these are
>> all things you will need to do as a gem5 user in any case, so better get
>> used to it :-).
>>
>> For an example, have a look at one of the regression scripts,
>> tests/config/tgen-simple-mem.py. This script includes both trace
>> generation, and calculation of stack distance. Note that you don’t need to
>> set "verify = True" on the StackDistProbe. If you do you will calculate the
>> stack distance both using a clever algorithm, and a “naïve” stack which is
>> a lot slower.
>>
>> Andreas
>>
>>
>> From: gem5-users <[email protected]> on behalf of Bhaskar
>> Kalita <[email protected]>
>> Reply-To: gem5 users mailing list <[email protected]>
>> Date: Sunday, 1 November 2015 at 22:08
>> To: "[email protected]" <[email protected]>
>> Subject: [gem5-users] How to use stack distance calculator in gem5.
>>
>> Hi
>> I am Bhaskar. I am a final year B.E student. For my final year project I
>> am using the gem5 simulator. I need to collect the stack distance of
>> programs using gem5. I used the --debug-flag="StackDist", but it did not
>> print anything. I also tried setting the verifyStack flag in
>> mem/stack_dist_calc.hh to true as:
>> // Flag to enable verification of stack. (Slows down the simulation)
>> const bool verifyStack=true;
>> but it did not work too. For reference this is the command line am usuing:
>> build/X86/gem5.debug --debug-flag='StackDist' --debug-file='sdp.trc.gz'
>> --stats-file=forij.txt --dump-config=for.ini --json-config=for.json
>> configs/example/se.py --num-cpus=1 --cpu-type=DerivO3CPU --caches
>> --l1i_size=32kB --l1d_size=32kB --l2cache --num-l2caches=1 --l2_size=256kB
>> --l2_assoc=4 -c "bench/x86/forij;"
>>
>> Can you please guide me through my problem and tell me to do the
>> necessary steps.
>>
>> Thanks for your support
>>
>> -Bhaskar
>>
>>
>>
>> ------------------------------
>>
>> -- IMPORTANT NOTICE: The contents of this email and any attachments are
>> confidential and may also be privileged. If you are not the intended
>> recipient, please notify the sender immediately and do not disclose the
>> contents to any other person, use it for any purpose, or store or copy the
>> information in any medium. Thank you.
>>
>> _______________________________________________
>> gem5-users mailing list
>> [email protected]
>> http://m5sim.org/cgi-bin/mailman/listinfo/gem5-users
>>
>
>
> ------------------------------
>
> -- IMPORTANT NOTICE: The contents of this email and any attachments are
> confidential and may also be privileged. If you are not the intended
> recipient, please notify the sender immediately and do not disclose the
> contents to any other person, use it for any purpose, or store or copy the
> information in any medium. Thank you.
>
> _______________________________________________
> gem5-users mailing list
> [email protected]
> http://m5sim.org/cgi-bin/mailman/listinfo/gem5-users
>
_______________________________________________
gem5-users mailing list
[email protected]
http://m5sim.org/cgi-bin/mailman/listinfo/gem5-users