sstsimulator / sst-elements

SST Architectural Simulation Components and Libraries
http://www.sst-simulator.org
Other
92 stars 119 forks source link

segmentation fault in using memHierarchy.ScratchCPU, Scratchpad, and standardInterface #2006

Open prateek22sri opened 1 year ago

prateek22sri commented 1 year ago

The following config file leads to a segfault. A few questions:

  1. What am I doing wrong?
  2. How to debug such issues?
  3. I am trying to implement one host with multiple banks of scratchpad memory. Will I be able to do that with this method?
import sst
# from mhlib import componentlist

cpu = sst.Component("core", "memHierarchy.ScratchCPU")
cpu_params = {
    ¦   "scratchSize" : 1024,   # 1K scratch
    ¦   "maxAddr" : 4096,       # 4K mem
    ¦   "scratchLineSize" : 64,
    ¦   "memLineSize" : 64,
    ¦   "clock" : "1GHz",
    ¦   "maxOutstandingRequests" : 16,
    ¦   "maxRequestsPerCycle" : 2,
    ¦   "reqsToIssue" : 500,
    ¦   "verbose" : 1
    ¦   }
cpu.addParams(cpu_params)

iface = cpu.setSubComponent("memory", "memHierarchy.standardInterface")

scratchpad = sst.Component("scratch", "memHierarchy.Scratchpad")
scratchpad_params = {
    ¦   "debug" : 0,
    ¦   "debug_level" : 10,
    ¦   "clock" : "2GHz",
    ¦   "size" : "1KiB",
    ¦   "scratch_line_size" : 64,
    ¦   "memory_line_size" : 64,
    ¦   "backing" : "none",
    ¦   }
scratchpad.addParams(scratchpad_params)

# Enable statistics
# # sst.setStatisticLoadLevel(7)
# # sst.setStatisticOutput("sst.statOutputConsole")
# # for a in componentlist:
# #         sst.enableAllStatisticsForComponentType(a)

link = sst.Link("component_link")
link.connect(
    ¦   (iface, "port", "1000ps"),
    ¦   (scratchpad, "cpu", "1000ps")
    ¦   )
gvoskuilen commented 1 year ago

@prateek22sri Are you still encountering this segfault? Can you add the location of the segfault you see?

The primary difference between memH's scratchpad & memory is that scratchpad allows copying data in and out ("put", "get") from memory. This config doesn't have a memory, it's possible that is the cause of the segfault but I'm not certain without seeing the error. If you don't want a memory in the system, one option would be to use a CPU connected to a memory to model the scratchpad instead.