Skip to content

Commit

Permalink
sweep: use bazel-orfs sweep
Browse files Browse the repository at this point in the history
Signed-off-by: Øyvind Harboe <[email protected]>
  • Loading branch information
oharboe committed Dec 2, 2024
1 parent 0dcd7f5 commit 448d3cd
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 115 deletions.
119 changes: 7 additions & 112 deletions BUILD.bazel
Original file line number Diff line number Diff line change
@@ -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(
Expand Down Expand Up @@ -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": [
Expand All @@ -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)",
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -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",
)

Expand Down
4 changes: 2 additions & 2 deletions etc/BuildMegaboom.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 448d3cd

Please sign in to comment.