From d6672a8e4ada6ca016b5910da6ef4afe5bdae208 Mon Sep 17 00:00:00 2001 From: Ayaka Yorihiro Date: Tue, 19 Nov 2024 09:24:35 -0500 Subject: [PATCH] Some bug fixes --- .../src/passes/profiler_instrumentation.rs | 23 +++++++++++-------- tools/profiler/new-parse-vcd.py | 5 ++-- tools/profiler/new-profiler-approach.sh | 4 ++-- 3 files changed, 19 insertions(+), 13 deletions(-) diff --git a/calyx-opt/src/passes/profiler_instrumentation.rs b/calyx-opt/src/passes/profiler_instrumentation.rs index b888cfe06..d5bb60b8a 100644 --- a/calyx-opt/src/passes/profiler_instrumentation.rs +++ b/calyx-opt/src/passes/profiler_instrumentation.rs @@ -82,15 +82,20 @@ impl Visitor for ProfilerInstrumentation { } } if let ir::PortParent::Cell(cell_ref) = &dst_borrow.parent { - if dst_borrow.name == "go" { - let cell_name = cell_ref.upgrade().borrow().name(); - match cell_invoke_map.get_mut(&group.name()) { - Some(vec_ref) => { - vec_ref.push(cell_name); - } - None => { - cell_invoke_map - .insert(group.name(), vec![cell_name]); + // we only want to add probes for cells that are non-primitive... for now. + if let ir::CellType::Component { name: _ } = + cell_ref.upgrade().borrow().prototype + { + if dst_borrow.name == "go" { + let cell_name = cell_ref.upgrade().borrow().name(); + match cell_invoke_map.get_mut(&group.name()) { + Some(vec_ref) => { + vec_ref.push(cell_name); + } + None => { + cell_invoke_map + .insert(group.name(), vec![cell_name]); + } } } } diff --git a/tools/profiler/new-parse-vcd.py b/tools/profiler/new-parse-vcd.py index 7bd3e65ae..0c18a3725 100644 --- a/tools/profiler/new-parse-vcd.py +++ b/tools/profiler/new-parse-vcd.py @@ -8,7 +8,7 @@ DELIMITER = "__" INVISIBLE = "gray" -TREE_PICTURE_LIMIT=100 +TREE_PICTURE_LIMIT=300 def remove_size_from_name(name: str) -> str: """ changes e.g. "state[2:0]" to "state" """ @@ -281,6 +281,7 @@ def read_component_cell_names_json(json_file): return full_main_component, full_cell_names_to_components def create_traces(active_element_probes_info, call_stack_probes_info, cell_caller_probes_info, total_cycles, cells_to_components, main_component): + timeline_map = {i : set() for i in range(total_cycles)} # first iterate through all of the profiled info for unit_name in active_element_probes_info: @@ -389,7 +390,7 @@ def create_tree(timeline_map): break # create nodes if prefix != "": - new_nodes = stack[i:] + new_nodes = stack[stack_len - i:] new_prefix = prefix else: new_nodes = stack diff --git a/tools/profiler/new-profiler-approach.sh b/tools/profiler/new-profiler-approach.sh index 0adcb2dea..8fb3e89fb 100644 --- a/tools/profiler/new-profiler-approach.sh +++ b/tools/profiler/new-profiler-approach.sh @@ -12,7 +12,7 @@ CALYX_DIR=$( dirname $( dirname ${SCRIPT_DIR} ) ) INPUT_FILE=$1 SIM_DATA_JSON=$2 name=$( echo "${INPUT_FILE}" | rev | cut -d/ -f1 | rev | cut -d. -f1 ) -DATA_DIR=${SCRIPT_DIR}/new-data/${name} +DATA_DIR=${SCRIPT_DIR}/data/${name} TMP_DIR=${DATA_DIR}/generated-data OUT_CSV=${TMP_DIR}/summary.csv @@ -47,7 +47,7 @@ if [ ! -d ${FLAMEGRAPH_DIR} ]; then ) fi -CALYX_ARGS=" -p static-inline -p compile-static -p compile-repeat -p compile-invoke -p profiler-instrumentation -p all" +CALYX_ARGS=" -p static-inline -p compile-static -p compile-repeat -p compile-invoke -p dead-group-removal -p profiler-instrumentation -p all" # Run component-cells backend to get cell information echo "[${SCRIPT_NAME}] Obtaining cell information from component-cells backend"