From ab7588feb5f893558932de69fde216c2b7dd8fa4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=98yvind=20Harboe?= Date: Tue, 3 Dec 2024 13:46:54 +0100 Subject: [PATCH] bazel-orfs: bump MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Øyvind Harboe --- BUILD.bazel | 6 +- MODULE.bazel | 2 +- report-wns.tcl | 12 --- wns_report.py | 216 --------------------------------------------- wns_report_test.py | 36 -------- 5 files changed, 4 insertions(+), 268 deletions(-) delete mode 100644 report-wns.tcl delete mode 100755 wns_report.py delete mode 100755 wns_report_test.py diff --git a/BUILD.bazel b/BUILD.bazel index ac1e542..0d28c44 100644 --- a/BUILD.bazel +++ b/BUILD.bazel @@ -1,5 +1,5 @@ load("@bazel-orfs//:openroad.bzl", "orfs_flow", "orfs_run") -load("@bazel-orfs//:sweep.bzl", "sweep") +load("@bazel-orfs//:sweep.bzl", "orfs_sweep") load(":write_binary.bzl", "write_binary") filegroup( @@ -451,9 +451,9 @@ BRANCH_PREDICTOR_VARIABLES = SKIP_REPORT_METRICS | FAST_BUILD_SETTINGS | { "BranchPredictor", ]] -sweep( +orfs_sweep( name = "BoomTile", - variables = BOOMTILE_VARIABLES, + arguments = BOOMTILE_VARIABLES, macros = [ ":" + m + "_generate_abstract" for m in boomtile_all_rams diff --git a/MODULE.bazel b/MODULE.bazel index 351e747..17460b0 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -15,7 +15,7 @@ module( bazel_dep(name = "bazel-orfs") git_override( module_name = "bazel-orfs", - commit = "3fff266e5a27adb21a2c58d8f52600e4d69bba39", + commit = "b12fc7a172d4211315ec36214f872595e084ab25", remote = "https://github.com/The-OpenROAD-Project/bazel-orfs.git", ) diff --git a/report-wns.tcl b/report-wns.tcl deleted file mode 100644 index f896420..0000000 --- a/report-wns.tcl +++ /dev/null @@ -1,12 +0,0 @@ -# Test this on some simple design in ORFS: -# make floorplan -# ODB_FILE=results/nangate45/gcd/base/2_floorplan.odb make run RUN_SCRIPT=~/megaboom/report-wns.tcl -source $::env(SCRIPTS_DIR)/open.tcl - -set paths [find_timing_paths -path_group reg2reg -sort_by_slack -group_count 1] -set path [lindex $paths 0] -set slack [get_property $path slack] - -puts "slack: $slack" -report_tns -report_cell_usage diff --git a/wns_report.py b/wns_report.py deleted file mode 100755 index fde1b98..0000000 --- a/wns_report.py +++ /dev/null @@ -1,216 +0,0 @@ -#!/usr/bin/env python3 -import os -import json -import re -import pathlib -import sys -from tabulate import tabulate - - -def transpose_table(table_data): - return list(map(list, zip(*table_data))) - - -# slack: 0.039060 -# Clock core_clock -# 0.00 source latency ctrl.state.out[0]$_DFF_P_/CK ^ -# 0.00 target latency ctrl.state.out[0]$_DFF_P_/CK ^ -# 0.00 CRPR -# -------------- -# 0.00 setup skew - - -# tns 0.00 -# Cell type report: Count Area -# Tap cell 48 12.77 -# Buffer 14 19.95 -# Inverter 85 51.34 -# Sequential cell 35 158.27 -# Multi-Input combinational cell 369 420.55 -# Total 551 662.87 -def parse_stats(report): - """Create a dictionary with the values above""" - stats = {} - report_start = False - for line in report.split("\n"): - if "slack" in line: - stats["slack"] = float(line.split()[1]) - if "tns" in line: - stats["tns"] = float(line.split()[1]) - if "setup skew" in line: - stats["skew"] = line.split()[0] - # First line is "Cell type report", last line is "Total", - # fish out the values in between - if "Cell type report" in line: - report_start = True - continue - if report_start: - # fish out using regex first number column and use the label as key - # and the first number as the value. - # - # use regex, because split() would get confused by space - # in the label - # use regex, but don't get confused by one or more spaces in the label - # Sequentialcell 35 158.27 - # Tap cell 48 12.77 - # Multi-Input combinational cell 369 420.55 - # some labels have spaces, some don't - m = re.match(r"\s*(\D+)(\d+)\s+(\d+\.\d+)", line) - if m: - stats[m.group(1).strip()] = int(m.group(2)) - if "Total" in line: - report_start = False - continue - - return stats - - -# Extract Elapsed Time line from log file -# Elapsed time: 0:04.26[h:]min:sec. CPU time: user 4.08 sys 0.17 (99%). \ -# Peak memory: 671508KB. -def print_log_dir_times(f): - first = True - totalElapsed = 0 - total_max_memory = 0 - - if not os.path.exists(f): - return "N/A" - - with open(f) as logfile: - found = False - for line in logfile: - elapsedTime = None - peak_memory = None - - if "Elapsed time" in line: - found = True - # Extract the portion that has the time - timePor = line.strip().replace("Elapsed time: ", "") - # Remove the units from the time portion - timePor = timePor.split("[h:]", 1)[0] - # Remove any fraction of a second - timePor = timePor.split(".", 1)[0] - # Calculate elapsed time that has this format 'h:m:s' - timeList = timePor.split(":") - if len(timeList) == 2: - # Only minutes and seconds are present - elapsedTime = int(timeList[0]) * 60 + int(timeList[1]) - elif len(timeList) == 3: - # Hours, minutes, and seconds are present - elapsedTime = ( - int(timeList[0]) * 3600 - + int(timeList[1]) * 60 - + int(timeList[2]) - ) - else: - print("Elapsed time not understood in", str(line), file=sys.stderr) - # Find Peak Memory - peak_memory = int( - int(line.split("Peak memory: ")[1].split("KB")[0]) / 1024 - ) - - if not found: - print("No elapsed time found in", str(f), file=sys.stderr) - - # Print the name of the step and the corresponding elapsed time - if elapsedTime is not None and peak_memory is not None: - if first: - first = False - totalElapsed += elapsedTime - total_max_memory = max(total_max_memory, int(peak_memory)) - - return totalElapsed - - -def main(): - if len(sys.argv) != 2: - print("Usage: python script.py ") - sys.exit(1) - - sweep_file = sys.argv[1] - with open(sweep_file, "r") as file: - sweep_json = json.load(file) - sweep = sweep_json["sweep"] - - log_dir = os.path.dirname(sorted(pathlib.Path(".").glob("**/*.log"))[0]) - logs = sorted(map(os.path.basename, pathlib.Path(log_dir).glob("*.log"))) - logs_dir = os.path.join(log_dir, "..") - - variables = sorted( - set(k for v in sweep.values() for k in v.get("variables", {}).keys()) - ) - - def read_file(variant): - with open( - os.path.join(os.path.dirname(sweep_file), "BoomTile_" + variant + ".txt"), - "r", - ) as file: - return file.read() - - stats = {variant: parse_stats(read_file(variant)) for variant in sweep} - names = sorted({name for stat in stats.values() for name in stat.keys()}) - variable_names = sorted( - set(k for v in sweep.values() for k in v.get("variables", {}).keys()) - ) - - table_data = None - - def previous_stage(previous_stage): - if len(previous_stage) == 0: - return "" - stage, previous = list(previous_stage.items())[0] - return f"{stage}: {previous}" - - for variant in sweep: - if table_data is None: - table_data = [ - ["Variant", "Description"] - + names - + variable_names - + ["dissolve", "previous_stage"] - + logs - ] - variables = sweep[variant].get("variables", {}) - table_data.append( - ( - [variant, sweep[variant].get("description", "")] - + [stats[variant][name] for name in names] - + [ - ( - variables.get(variable, "") - if sweep_json["base"].get(variable, "") - != variables.get(variable, "") - else "" - ) - for variable in variable_names - ] - + [ - " ".join(sweep[variant].get("dissolve", [])), - previous_stage(sweep[variant].get("previous_stage", {})), - ] - + [ - print_log_dir_times(os.path.join(logs_dir, variant, log)) - for log in logs - ] - ) - ) - - print("Stage: " + sweep_json["stage"]) - table_data = transpose_table(table_data) - table = tabulate(table_data[1:], table_data[0], tablefmt="github") - print(table) - - print() - print("Base configuration variables") - base_keys = sorted(sweep_json["base"].keys()) - print( - tabulate( - [[key, sweep_json["base"][key]] for key in base_keys], - ["Variable", "Value"], - tablefmt="github", - ) - ) - - -if __name__ == "__main__": - main() diff --git a/wns_report_test.py b/wns_report_test.py deleted file mode 100755 index b1762b2..0000000 --- a/wns_report_test.py +++ /dev/null @@ -1,36 +0,0 @@ -#!/usr/bin/env python3 -import wns_report - - -def test_parse_stats(): - report = """ - slack: 0.039060 - Clock core_clock - 0.00 source latency ctrl.state.out[0]$_DFF_P_/CK ^ - 0.00 target latency ctrl.state.out[0]$_DFF_P_/CK ^ - 0.00 CRPR - -------------- - 0.00 setup skew - - tns 0.00 - Cell type report: Count Area - Tap cell 48 12.77 - Buffer 14 19.95 - Inverter 85 51.34 - Sequential cell 35 158.27 - Multi-Input combinational cell 369 420.55 - Total 551 662.87 - """ - expected_stats = { - "slack": 0.03906, - "skew": "0.00", - "Tap cell": 48, - "Inverter": 85, - "Buffer": 14, - "Sequential cell": 35, - "Multi-Input combinational cell": 369, - "Total": 551, - "tns": 0.00, - } - - assert wns_report.parse_stats(report) == expected_stats