diff --git a/sw/dnn/layernorm/layout.csv b/sw/dnn/layernorm/layout.csv index 9fd0970bec..fed43ee3cb 100644 --- a/sw/dnn/layernorm/layout.csv +++ b/sw/dnn/layernorm/layout.csv @@ -1,3 +1,3 @@ - , setup, dma in, compute tile, dma out, dma in, compute tile, dma out -"range(0,8)", 1, , 3, , , 5, -8 , 1, 2, , 4, 5, , 7 + , setup, dma in, compute tile, dma out, dma in, compute tile, dma out +"[i*9+j+cfg['cluster']['cluster_base_hartid'] for i in range(cfg['s1_quadrant']['nr_clusters']) for j in range(8)]", 1, , 3, , , 5, +"[i*9+8+cfg['cluster']['cluster_base_hartid'] for i in range(cfg['s1_quadrant']['nr_clusters'])]" , 1, 2, , 4, 5, , 7 diff --git a/target/common/common.mk b/target/common/common.mk index 48b875f760..73abbdf08f 100644 --- a/target/common/common.mk +++ b/target/common/common.mk @@ -59,7 +59,8 @@ VLT_FLAGS += --unroll-count 1024 VLT_CFLAGS += -std=c++14 -pthread VLT_CFLAGS +=-I ${VLT_BUILDDIR} -I $(VLT_ROOT)/include -I $(VLT_ROOT)/include/vltstd -I $(VLT_FESVR)/include -I $(TB_DIR) -I ${MKFILE_DIR}/test -ANNOTATE_FLAGS ?= -q --keep-time +ANNOTATE_FLAGS ?= -q --keep-time +LAYOUT_EVENTS_FLAGS ?= --cfg=$(CFG) # We need a recent LLVM installation (>11) to compile Verilator. # We also need to link the binaries with LLVM's libc++. diff --git a/util/trace/layout_events.py b/util/trace/layout_events.py index ea877c53cb..0d0e914358 100755 --- a/util/trace/layout_events.py +++ b/util/trace/layout_events.py @@ -41,6 +41,7 @@ import csv import pandas as pd from math import isnan +import hjson def main(): @@ -55,10 +56,9 @@ def main(): metavar='', help='Layout CSV file') parser.add_argument( - '--num-clusters', - type=int, - default=1, - help='Number of clusters') + '--cfg', + type=str, + help='System configuration .hjson file') parser.add_argument( '-o', '--output', @@ -71,6 +71,11 @@ def main(): # Read input CSV df = pd.read_csv(args.csv) + # Read system configuration .hjson file + cfg = None + with open(args.cfg) as cfg_file: + cfg = hjson.load(cfg_file) + # Output CSV data data = [] columns = [] @@ -92,7 +97,9 @@ def main(): # which generates a list of hart IDs expr = row[0] code = compile(expr, "", "eval") - tids = eval(code, {}, {'num_clusters': args.num_clusters}) + # Symbols must be added to globals to be used in list comprehensions + # see https://bugs.python.org/issue36300 + tids = eval(code, {'cfg': cfg}, {'cfg': cfg}) if type(tids) == int: tids = [tids]