Skip to content

Commit

Permalink
aladdin: Enable memory traffic tracing.
Browse files Browse the repository at this point in the history
This requires the probotuf library to be installed, and this brings the
Aladdin submodule pointer up to date with the necessary changes in
Aladdin as well.

To trace scratchpad and/or cache traffic on a per-accelerator basis,
include the attribute `record_memory_traffic = True` in the gem5.cfg
file for each accelerator, or mark it as default to trace all
accelerators in the system.

To trace all memory traffic going to/from main memory (which applies to
the entire system), add `--record-dram-traffic` to the command line
options (after aladdin_se.py).

Change-Id: I2a7ce01ef37155ca611972afe543239fb95c88d8
  • Loading branch information
xyzsam committed Mar 3, 2017
1 parent 5520e40 commit a33917e
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 7 deletions.
2 changes: 2 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ before_install:
- sudo apt-get install -y swig
- sudo apt-get install -y m4
- sudo apt-get install -y libz-dev
- sudo apt-get install -y libprotobuf-dev
- sudo apt-get install -y protobuf-compiler
# These are Aladdin dependencies.
- sudo apt-get install -y libboost-graph-dev
- sudo apt-get install -y libboost-regex-dev
Expand Down
6 changes: 5 additions & 1 deletion configs/aladdin/aladdin_se.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,10 @@ def get_processes(options):
# Set the globally required parameters.
datapath = HybridDatapath(
clk_domain = clk_domain,
benchName = config.get(accel, "bench_name"),
benchName = accel,
# TODO: Ideally bench_name would change to output_prefix but that's a
# pretty big breaking change.
outputPrefix = config.get(accel, "bench_name"),
traceFileName = config.get(accel, "trace_file_name"),
configFileName = config.get(accel, "config_file_name"),
acceleratorName = "datapath%d" % config.getint(accel, "accelerator_id"),
Expand All @@ -226,6 +229,7 @@ def get_processes(options):
datapath.pipelinedDma = config.getboolean(accel, "pipelined_dma")
datapath.ignoreCacheFlush = config.getboolean(accel, "ignore_cache_flush")
datapath.invalidateOnDmaStore = config.getboolean(accel, "invalidate_on_dma_store")
datapath.recordMemoryTrace = config.getboolean(accel, "record_memory_trace")
if memory_type == "cache":
datapath.cacheSize = config.get(accel, "cache_size")
datapath.cacheBandwidth = config.get(accel, "cache_bandwidth")
Expand Down
8 changes: 4 additions & 4 deletions configs/common/CacheConfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -186,11 +186,11 @@ def config_cache(options, system):
hit_latency=datapath.cacheHitLatency,
response_latency=datapath.cacheHitLatency)
if options.l2cache:
datapath.addPrivateL1Dcache(aladdin_dcache, system.tol2bus)
datapath.connectPrivateScratchpad(system.membus)
datapath.addPrivateL1Dcache(system, aladdin_dcache, system.tol2bus)
datapath.connectPrivateScratchpad(system, system.membus)
else:
datapath.addPrivateL1Dcache(aladdin_dcache, system.membus)
datapath.connectPrivateScratchpad(system.membus)
datapath.addPrivateL1Dcache(system, aladdin_dcache, system.membus)
datapath.connectPrivateScratchpad(system, system.membus)
return system

# ExternalSlave provides a "port", but when that port connects to a cache,
Expand Down
11 changes: 10 additions & 1 deletion configs/common/MemConfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
import m5
from m5.defines import buildEnv
import m5.objects
from m5.objects import CommMonitor
from m5.util import addToPath, fatal
import inspect
import sys
Expand Down Expand Up @@ -200,7 +201,15 @@ def config_mem(options, system):

# Connect the controllers to the membus
for i in xrange(len(system.mem_ctrls)):
system.mem_ctrls[i].port = system.membus.master
if options.record_dram_traffic:
monitor = CommMonitor(
trace_enable=True, trace_file="dram_%d.trc.gz" % i)
system.membus.master = monitor.slave
monitor.master = system.mem_ctrls[i].port
monitor_name = "dram_%d_monitor" % i
setattr(system, monitor_name, monitor)
else:
system.mem_ctrls[i].port = system.membus.master

## Aladdin memory configuration
#if options.aladdin:
Expand Down
2 changes: 2 additions & 0 deletions configs/common/Options.py
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,8 @@ def addCommonOptions(parser):
parser.add_option("--l2_hit_latency", type="int", default="20")
parser.add_option("--cacheline_size", type="int", default=64)
parser.add_option("--xbar_width", type="int", default=8)
parser.add_option("--record-dram-traffic", action="store_true",
help="Record DRAM memory traffic packets to file (requires protobuf).")

# Aladdin Options
parser.add_option("--accel_cfg_file", default=None,
Expand Down
2 changes: 1 addition & 1 deletion src/aladdin

0 comments on commit a33917e

Please sign in to comment.