From 448d3cd838cc6025b636e2d6e4d740269689ad63 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=98yvind=20Harboe?= Date: Mon, 2 Dec 2024 13:58:38 +0100 Subject: [PATCH] sweep: use bazel-orfs sweep MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Øyvind Harboe --- BUILD.bazel | 119 +++---------------------------------------- MODULE.bazel | 2 +- etc/BuildMegaboom.sh | 4 +- 3 files changed, 10 insertions(+), 115 deletions(-) diff --git a/BUILD.bazel b/BUILD.bazel index 65c9c76..ac1e542 100644 --- a/BUILD.bazel +++ b/BUILD.bazel @@ -1,4 +1,5 @@ load("@bazel-orfs//:openroad.bzl", "orfs_flow", "orfs_run") +load("@bazel-orfs//:sweep.bzl", "sweep") load(":write_binary.bzl", "write_binary") filegroup( @@ -400,22 +401,6 @@ BOOMTILE_VARIABLES = SKIP_REPORT_METRICS | FAST_BUILD_SETTINGS | { "HOLD_SLACK_MARGIN": "-200", } -SWEEP_JSON = { - "base": BOOMTILE_VARIABLES, - "sweep": {variant: SWEEP[variant] for variant in SWEEP}, - "stage": "cts", - "stages": [ - "floorplan", - "place", - "cts", - ], -} - -write_binary( - name = "sweep.json", - data = str(SWEEP_JSON), -) - BOOMTILE_SOURCES = { "synth": [":constraints-boomtile"], "floorplan": [ @@ -426,8 +411,6 @@ BOOMTILE_SOURCES = { boomtile_all_rams = boom_regfile_rams.keys() + all_srams.keys() -ALL_VARIANTS = SWEEP | OTHER_VARIANTS - BRANCH_PREDICTOR_VARIABLES = SKIP_REPORT_METRICS | FAST_BUILD_SETTINGS | { "PDN_TCL": "$(PLATFORM_DIR)/openRoad/pdn/BLOCKS_grid_strategy.tcl", "IO_CONSTRAINTS": "$(location :io-boomtile)", @@ -468,84 +451,17 @@ BRANCH_PREDICTOR_VARIABLES = SKIP_REPORT_METRICS | FAST_BUILD_SETTINGS | { "BranchPredictor", ]] -[orfs_flow( +sweep( name = "BoomTile", - arguments = BOOMTILE_VARIABLES | ALL_VARIANTS[variant].get("variables", {}), + variables = BOOMTILE_VARIABLES, macros = [ ":" + m + "_generate_abstract" for m in boomtile_all_rams - if m not in ALL_VARIANTS[variant].get("dissolve", []) - ] + ALL_VARIANTS[variant].get("macros", []), - previous_stage = ALL_VARIANTS[variant].get("previous_stage", {}), - renamed_inputs = ALL_VARIANTS[variant].get("renamed_inputs", {}), - # Explictily set arguments for a stage when stages are not listed in - # variables.yaml or we want to explicitly set a multi-stage argument - # for a specific stage, e.g. SETUP_SLACK_MARGIN could be useful to - # have a different value for floorplan, cts and grt. - stage_arguments = { - }, - # Starlark does not have sets, nor can we define functions in BUILD files - # Use a dict to get a set of keys - stage_sources = { - key: (ALL_VARIANTS[variant].get("stage_sources", {}).get(key, []) + BOOMTILE_SOURCES.get(key, [])) - for key in { - key: "dummy" - for key in (BOOMTILE_SOURCES.keys() + ALL_VARIANTS[variant].get("stage_sources", {}).keys()) - }.keys() - }, - variant = variant, - verilog_files = all_source_files, -) for variant in ALL_VARIANTS] - -[filegroup( - name = "BoomTile_" + variant + "_odb", - srcs = [":BoomTile_" + ("" if variant == "base" else variant + "_") + SWEEP_JSON["stage"]], - output_group = ("5_1_grt" if SWEEP_JSON["stage"] == "grt" else str(SWEEP_JSON["stages"].index(SWEEP_JSON["stage"]) + 2) + "_" + SWEEP_JSON["stage"]) + - ".odb", - visibility = [":__subpackages__"], -) for variant in SWEEP] - -[orfs_run( - name = "BoomTile_" + variant + "_report", - src = ":BoomTile_" + ("" if variant == "base" else variant + "_") + SWEEP_JSON["stage"], - outs = [ - "BoomTile_" + variant + ".txt", ], - arguments = { - "ODB_FILE": "$(location :BoomTile_" + variant + "_odb)", - }, - data = [":BoomTile_" + variant + "_odb"], - extra_args = "> $WORK_HOME/BoomTile_" + variant + ".txt", - script = ":report-wns.tcl", -) for variant in SWEEP] - -[filegroup( - name = "BoomTile_" + variant + "_logs", - srcs = [":BoomTile_" + ("" if variant == "base" else variant + "_") + stage for stage in SWEEP_JSON["stages"]], - output_group = "logs", - visibility = [":__subpackages__"], -) for variant in SWEEP] - -# This can be built in parallel, but grt needs to be build in serial -filegroup( - name = "sweep_parallel", - srcs = ["BoomTile_" + ("" if variant == "base" else variant + "_") + "cts" for variant in SWEEP], - visibility = ["//visibility:public"], -) - -genrule( - name = "wns_report", - srcs = [ - "wns_report.py", - "sweep.json", - ] + [":BoomTile_" + variant + ".txt" for variant in SWEEP] + - [":BoomTile_" + variant + "_logs" for variant in SWEEP], - outs = ["BoomTile_wns_report.md"], - cmd = ( - "$(location :wns_report.py) > $@" + - " $(location :sweep.json)" - ), - visibility = ["//visibility:public"], + stage_sources = BOOMTILE_SOURCES, + verilog_files = all_source_files, + sweep = SWEEP, + other_variants = OTHER_VARIANTS, ) # fish out the file that we want as input to the "naja" rule @@ -588,27 +504,6 @@ genrule( " -f verilog -t verilog -i $(location :BoomTile_synth_unedited) -o $@"), ) -filegroup( - name = "repair_logs", - srcs = [ - ":BoomTile_" + ("" if variant == "base" else variant + "_") + stage - for stage in SWEEP_JSON["stages"] - for variant in SWEEP - ], - output_group = "logs", -) - -genrule( - name = "plot_repair", - srcs = [ - "plot-retiming.py", - "repair_logs", - ], - outs = ["retiming.pdf"], - cmd = "$(location plot-retiming.py) $(location retiming.pdf) $(locations :repair_logs)", - visibility = ["//visibility:public"], -) - # Use the macro placement from a different flow orfs_run( name = "write_macro_placement", diff --git a/MODULE.bazel b/MODULE.bazel index 0899fde..351e747 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -15,7 +15,7 @@ module( bazel_dep(name = "bazel-orfs") git_override( module_name = "bazel-orfs", - commit = "994975a0a850f85890c3b30b78285cb72d8b5315", + commit = "3fff266e5a27adb21a2c58d8f52600e4d69bba39", remote = "https://github.com/The-OpenROAD-Project/bazel-orfs.git", ) diff --git a/etc/BuildMegaboom.sh b/etc/BuildMegaboom.sh index e7a5a54..aa0f0b1 100755 --- a/etc/BuildMegaboom.sh +++ b/etc/BuildMegaboom.sh @@ -8,10 +8,10 @@ exec 2>&1 # Check GCP service account entitlements first test/cred_helper_test.py -bazel build sweep_parallel --keep_going +bazel build BoomTile_sweep_parallel --keep_going # If we're not sweeping grt, then we could have # started wns_report sooner, but at least we're not # running multiple grt builds in parallel, which makes # the server fall over. -bazel build --jobs 1 wns_report BoomTile_grt --keep_going +bazel build --jobs 1 BoomTile_wns_report BoomTile_grt --keep_going cat bazel-bin/BoomTile_wns_report.md