Skip to content

Commit 32ffad4

Browse files
authored
Merge pull request #4365 from oharboe/syn-local-signal
Local OpenROAD-SYN QoR signal: forced-engine variants, fast synth tier, asap7 suites, syn-dashboard
2 parents 66f174f + 5ff9d76 commit 32ffad4

12 files changed

Lines changed: 525 additions & 25 deletions

File tree

‎MODULE.bazel‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ bazel_dep(name = "bazel-orfs", version = "0.0.1")
101101

102102
bazel_dep(name = "bazel-orfs-verilog", dev_dependency = True)
103103

104-
BAZEL_ORFS_COMMIT = "6ebadeb4be5c9ada103081c9a5e668c014126616"
104+
BAZEL_ORFS_COMMIT = "3342596c1f7017b9fda5b4a55a25a54ff2aaedf8"
105105

106106
BAZEL_ORFS_REMOTE = "https://github.com/The-OpenROAD-Project/bazel-orfs.git"
107107

‎flow/designs/BUILD‎

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,12 @@
11
exports_files(["BUILD"])
2+
3+
# Local TL;DR of https://dashboard.precisioninno.com/: a GitHub-markdown
4+
# status table over the forced-engine OpenROAD-SYN QoR tests already
5+
# built in this workspace (see flow/designs/design.bzl). Reads
6+
# bazel-testlogs only — builds nothing, instant.
7+
#
8+
# bazelisk run //flow/designs:syn-dashboard
9+
alias(
10+
name = "syn-dashboard",
11+
actual = "//flow/util:synDashboard",
12+
)

‎flow/designs/README.md‎

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
# Fast local OpenROAD-SYN testing loop
2+
3+
The maintainers' QoR signal comes from Jenkins runs published at
4+
<https://dashboard.precisioninno.com/>. The targets described here are
5+
its local counterpart: the same designs, gated by the same
6+
`rules-base.json` files with the same `checkMetadata.py`, but built
7+
locally through Bazel so the loop can be sharpened onto exactly the
8+
design, engine, and stage being worked on — fast enough for an agent
9+
(e.g. Claude) to iterate against.
10+
11+
Every design gets manual forced-engine flow variants (see
12+
`design.bzl`), regardless of the engine its config.mk selects:
13+
14+
- `<name>_syn_*` pins `SYNTH_USE_SYN=1` (OpenROAD-SYN), so any design
15+
can be tested under SYN before its config.mk officially switches.
16+
- `<name>_yosys_*` pins the yosys engine, so the baseline stays
17+
reproducible after a design switches (asap7/gcd today).
18+
19+
Designs with a `rules-base.json` get two QoR tiers per variant:
20+
21+
- `<name>_<engine>_synth_test` — the fast tier: synthesis only,
22+
checked against the `synth__`/`constraints__` subset of the rules.
23+
Minutes. QoR-only — without LEC it cannot prove correctness, so use
24+
it to iterate, not to conclude.
25+
- `<name>_<engine>_test` — the full flow against all rules: the real,
26+
dashboard-equivalent gate. It reuses the fast tier's synthesis
27+
action, so escalating from fast to full never repeats synthesis.
28+
29+
## The loop
30+
31+
Build/test whatever is relevant to what you are changing — one design,
32+
one stage, one tier, or a whole suite:
33+
34+
```sh
35+
# fastest signal for one design
36+
bazelisk test //flow/designs/asap7/jpeg:jpeg_encoder_syn_synth_test
37+
38+
# the real gate for that design
39+
bazelisk test //flow/designs/asap7/jpeg:jpeg_encoder_syn_test
40+
41+
# a single stage, for triage
42+
bazelisk build //flow/designs/asap7/jpeg:jpeg_encoder_syn_route
43+
44+
# yosys A/B on an officially-SYN design
45+
bazelisk test //flow/designs/asap7/gcd:gcd_yosys_test
46+
47+
# suite-wide status (asap7): fast tier, then the full flows
48+
bazelisk test --keep_going //flow/designs/asap7:syn_synth_test
49+
bazelisk test --keep_going //flow/designs/asap7:syn_test
50+
```
51+
52+
Then display what you have — deliberately a separate concern from
53+
deciding what to test or build:
54+
55+
```sh
56+
bazelisk run //flow/designs:syn-dashboard
57+
```
58+
59+
It prints a GitHub-markdown TL;DR table of every forced-engine test
60+
result already in `bazel-testlogs` — pass/fail per tier and engine,
61+
failing rule fields, result age — without building anything. Paste it
62+
into a PR or issue as-is. Because the display reads whatever exists,
63+
the loop stays fast: iterate on the one target you care about, and the
64+
dashboard aggregates across everything you (or earlier sessions) have
65+
built so far.
66+
67+
The suites include designs that fail OpenROAD-SYN today on purpose —
68+
they are a status signal, not a green-only gate. A build failure (e.g.
69+
synthesis dies) records no test result at all, so run the suites with
70+
`--keep_going` and check their output for `FAILED TO BUILD`; designs
71+
too slow for the suites are listed in `SYN_SLOW_DESIGNS`
72+
(`asap7/BUILD`) and reproduced individually.

‎flow/designs/asap7/BUILD‎

Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
# OpenROAD-SYN test suites for asap7 — the local counterpart of the
2+
# Jenkins QoR signal (https://dashboard.precisioninno.com/).
3+
#
4+
# Every design gets manual forced-engine flow variants from the
5+
# config.mk DSL (see flow/designs/design.bzl): <name>_syn_* pins
6+
# SYNTH_USE_SYN=1 and <name>_yosys_* pins the yosys engine, regardless
7+
# of the config.mk default. Designs with a rules-base.json get two QoR
8+
# gates per variant, both checking the design's regular rules file with
9+
# the regular checkMetadata.py — congruent with what Jenkins measures:
10+
#
11+
# bazelisk test --keep_going //flow/designs/asap7:syn_synth_test
12+
# Fast tier: synthesis only, checks the synth__/constraints__ subset
13+
# of rules-base.json. Minutes-scale; QoR-only (no LEC), so it cannot
14+
# prove correctness — use it to iterate, not to conclude.
15+
#
16+
# bazelisk test --keep_going //flow/designs/asap7:syn_test
17+
# Full flow, all rules-base.json gates. The real signal; shares its
18+
# synthesis action with the fast tier.
19+
#
20+
# Sharpening the loop on one design or stage:
21+
#
22+
# bazelisk test //flow/designs/asap7/jpeg:jpeg_encoder_syn_synth_test
23+
# bazelisk test //flow/designs/asap7/jpeg:jpeg_encoder_syn_test
24+
# bazelisk build //flow/designs/asap7/jpeg:jpeg_encoder_syn_route
25+
# bazelisk test //flow/designs/asap7/gcd:gcd_yosys_test # yosys A/B
26+
#
27+
# Both suites deliberately include designs that fail OpenROAD-SYN today
28+
# — they are a status signal, not a green-only gate. A design can fail
29+
# by not synthesizing at all, or by missing rules-base.json gates that
30+
# its regular flow meets.
31+
32+
# Design directory -> DESIGN_NAME (bazel target prefix), ordered
33+
# fastest-first so --keep_going runs surface quick failures early.
34+
# Known failures / quirks are listed last. "minimal" is excluded: it
35+
# has no VERILOG_FILES and thus no generated design targets.
36+
#
37+
# Known OpenROAD-SYN failures today:
38+
# - mock-alu: SDC references yosys-style register names (*io_out_REG*)
39+
# absent from the SYN netlist.
40+
# - riscv32i: slang rejects procedural assignment to nets (dmem.v).
41+
# - mock-cpu: slang rejects endianness-mismatched part-select
42+
# (wptr_full.v).
43+
# - aes-block: hierarchical BLOCKS; synthesizes, but SYN area blows past
44+
# the yosys-derived rules-base.json gate.
45+
SYN_TEST_DESIGNS = {
46+
"gcd": "gcd", # smoketest, fast
47+
"uart": "uart",
48+
"mock-alu": "MockAlu",
49+
"riscv32i": "riscv_top",
50+
"aes": "aes_cipher_top",
51+
"aes_lvt": "aes_cipher_top",
52+
"aes-mbff": "aes_cipher_top",
53+
"jpeg": "jpeg_encoder",
54+
"jpeg_lvt": "jpeg_encoder",
55+
"ethmac": "ethmac",
56+
"ethmac_lvt": "ethmac",
57+
"mock-cpu": "mock_cpu",
58+
"gcd-ccs": "gcd", # CCS liberty
59+
"aes-block": "aes_cipher_top", # hierarchical BLOCKS
60+
}
61+
62+
# Designs whose OpenROAD-SYN run is too slow (or does not terminate) for
63+
# the suites. Their generated per-design targets stay tags=["manual"]
64+
# like all forced-engine targets, but they are deliberately left out of
65+
# the suites so those remain runnable; reproduce individually, e.g.
66+
# bazelisk build //flow/designs/asap7/ibex:ibex_core_syn_synth
67+
#
68+
# - ibex: sv_elaborate/synthesize/repair_design complete in seconds, but
69+
# report_metrics ("Report metrics stage 1, synth...") spins in STA for
70+
# hours (observed >2h on 48 threads with no progress).
71+
# - cva6: synthesize itself takes ~73s, but repair_design -pre_placement
72+
# was still running after 10+ minutes when the status sweep was cut
73+
# off; not yet characterized to completion.
74+
# - swerv_wrapper: largest design in the suite; not yet run to
75+
# completion under OpenROAD-SYN in this environment.
76+
# - riscv32i-mock-sram: hierarchical BLOCKS (fakeram) — the syn variant
77+
# first needs the block's full PnR flow for its abstract; not yet run
78+
# to completion.
79+
SYN_SLOW_DESIGNS = {
80+
"cva6": "cva6",
81+
"ibex": "ibex_core",
82+
"riscv32i-mock-sram": "riscv_top",
83+
"swerv_wrapper": "swerv_wrapper",
84+
}
85+
86+
# Explicitly listed manual tests DO run through a test_suite (the manual
87+
# tag only exempts them from wildcard expansion); the suites themselves
88+
# are manual so `bazelisk test //flow/...` does not pull them in either.
89+
test_suite(
90+
name = "syn_test",
91+
tags = ["manual"],
92+
tests = [
93+
"//flow/designs/asap7/{pkg}:{name}_syn_test".format(
94+
name = name,
95+
pkg = pkg,
96+
)
97+
for pkg, name in SYN_TEST_DESIGNS.items()
98+
],
99+
)
100+
101+
test_suite(
102+
name = "syn_synth_test",
103+
tags = ["manual"],
104+
tests = [
105+
"//flow/designs/asap7/{pkg}:{name}_syn_synth_test".format(
106+
name = name,
107+
pkg = pkg,
108+
)
109+
for pkg, name in SYN_TEST_DESIGNS.items()
110+
],
111+
)

‎flow/designs/asap7/gcd/BUILD‎

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@ load("@orfs_designs//:designs.bzl", "DESIGNS")
33
load("@rules_shell//shell:sh_test.bzl", "sh_test")
44
load("//flow/designs:design.bzl", "design")
55

6-
# SYNTH_USE_SYN is make-only for now: bazel-orfs's synth stage always
7-
# runs the yosys flow and neither stages the Verilog sources nor sets
8-
# VERILOG_FILES for the OpenROAD synthesis step, so the built-in
9-
# synthesizer opt-in must not reach the bazel arguments.
6+
# gcd's regular flow follows config.mk onto OpenROAD-SYN
7+
# (SYNTH_USE_SYN=1). The single-process comparison below deliberately
8+
# exercises the yosys netlist path (single_flow.tcl seeds from
9+
# 1_2_yosys.v), so it consumes the forced-yosys gcd_yosys_* variant the
10+
# config.mk DSL emits for every design (see flow/designs/design.bzl).
1011
design(
1112
config = "config.mk",
12-
local_arguments = ["SYNTH_USE_SYN"],
1313
)
1414

1515
# Stage-boundary .odb/.sdc stems shared by the normal per-stage flow
@@ -56,7 +56,7 @@ SINGLE_FLOW_EXTRA_OUTS = [
5656
# this package.
5757
orfs_run(
5858
name = "gcd_single_flow",
59-
src = ":gcd_synth",
59+
src = ":gcd_yosys_synth",
6060
outs = [
6161
"results/asap7/gcd/single/{}.{}".format(stem, ext)
6262
for stem in SINGLE_FLOW_STAGES.values()
@@ -79,11 +79,13 @@ orfs_run(
7979
variant = "single",
8080
)
8181

82-
# Normal-flow stage outputs, one filegroup per compared file.
82+
# Normal-flow stage outputs, one filegroup per compared file. Taken from
83+
# the yosys-engine variant above so both sides of the byte-compare start
84+
# from the same yosys netlist.
8385
[
8486
filegroup(
8587
name = "gcd_base_{}_{}".format(stage, ext),
86-
srcs = [":gcd_" + stage],
88+
srcs = [":gcd_yosys_" + stage],
8789
output_group = "{}.{}".format(stem, ext),
8890
)
8991
for stage, stem in SINGLE_FLOW_STAGES.items()

‎flow/designs/design.bzl‎

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
"""BUILD boilerplate for flow/designs/."""
22

3+
load("@bazel-orfs//:openroad.bzl", "orfs_flow")
34
load("@orfs_designs//:designs.bzl", "orfs_design")
45

56
# Per filegroup target: extensions included in the filegroup.
@@ -51,6 +52,65 @@ def _export_design_files():
5152
visibility = ["//visibility:private"],
5253
)
5354

55+
def _engine_variant_targets(
56+
name,
57+
platform,
58+
verilog_files,
59+
arguments,
60+
user_arguments,
61+
sources,
62+
user_sources,
63+
macros,
64+
stage_data,
65+
tags): # buildifier: disable=unused-variable
66+
"""Forced-engine flow variants for one design (orfs_design extra hook).
67+
68+
Emits, always tagged "manual" (even for CI designs, so only explicit
69+
invocations such as //flow/designs/asap7:syn_test run them), two full
70+
flows that pin the synthesis engine regardless of the config.mk
71+
default:
72+
73+
- variant "syn": SYNTH_USE_SYN=1 (OpenROAD-SYN) — lets any design be
74+
tested under OpenROAD-SYN before its config.mk officially switches.
75+
- variant "yosys": SYNTH_USE_SYN=0 — keeps the yosys baseline
76+
reproducible after a design officially switches (e.g. asap7/gcd).
77+
78+
When the design has a rules-base.json each variant gets the same QoR
79+
gates as the regular flow, congruent with the Jenkins/dashboard
80+
signal because they check the same rules file with the same script:
81+
82+
- <name>_<engine>_test: the full flow gated on all of rules-base.json
83+
(the real, dashboard-equivalent gate).
84+
- <name>_<engine>_synth_test: the fast tier — synthesis plus a check
85+
of only the synth__/constraints__ subset of rules-base.json.
86+
QoR-only (no LEC), but a minutes-scale iteration signal that shares
87+
its synth action with the full-flow variant.
88+
89+
The generated <name>_<engine>_update targets must NOT be run: they
90+
would overwrite the design's rules-base.json with the forced engine's
91+
numbers.
92+
"""
93+
for engine, use_syn in [("syn", "1"), ("yosys", "0")]:
94+
orfs_flow(
95+
name = name,
96+
verilog_files = verilog_files,
97+
pdk = "//flow:" + platform,
98+
arguments = arguments | {"SYNTH_USE_SYN": use_syn},
99+
user_arguments = user_arguments,
100+
# sources carries the auto-detected rules-base.json as
101+
# RULES_JSON, which gates the variant's tests.
102+
sources = sources,
103+
user_sources = user_sources,
104+
macros = macros,
105+
stage_data = stage_data,
106+
variant = engine,
107+
tags = ["manual"],
108+
test_kwargs = {"tags": ["manual"]},
109+
# Sibling packages consume stage outputs (e.g. asap7/gcd's
110+
# single-process comparison seeds from the yosys netlist).
111+
visibility = ["//visibility:public"],
112+
)
113+
54114
def design(config = "config.mk", user_arguments = [], user_sources = [], local_arguments = []):
55115
"""Standard BUILD body for flow/designs/<platform>/<design>/.
56116
@@ -75,6 +135,7 @@ def design(config = "config.mk", user_arguments = [], user_sources = [], local_a
75135
user_sources = user_sources,
76136
local_arguments = local_arguments,
77137
blender = True,
138+
extra = _engine_variant_targets,
78139
)
79140

80141
def files(group, extra_srcs = None):

‎flow/scripts/synth_syn.tcl‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,3 +75,12 @@ orfs_write_db $::env(RESULTS_DIR)/1_synth.odb
7575
# out by OpenSTA that has no dependencies. Sole writer of
7676
# 1_synth.sdc.
7777
orfs_write_sdc $::env(RESULTS_DIR)/1_synth.sdc
78+
79+
# Gate-level netlist for LEC (write_lec_verilog strips physical-only
80+
# masters, matching the CTS-stage LEC convention) and any other netlist
81+
# consumer. The Bazel synthesis action declares this file as an output,
82+
# so it must be written unconditionally. write_lec_verilog takes a bare
83+
# filename and prefixes $::env(RESULTS_DIR) itself, like the cts.tcl
84+
# call sites.
85+
source $::env(SCRIPTS_DIR)/lec_check.tcl
86+
write_lec_verilog 1_synth.v

‎flow/util/BUILD‎

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
load("@rules_python//python:defs.bzl", "py_library", "py_test")
1+
load("@rules_python//python:defs.bzl", "py_binary", "py_library", "py_test")
22
load("@rules_python//python:pip.bzl", "compile_pip_requirements")
33

44
exports_files(["open_plots.sh"])
@@ -33,6 +33,14 @@ filegroup(
3333
visibility = ["//visibility:public"],
3434
)
3535

36+
# TL;DR markdown dashboard over locally built OpenROAD-SYN QoR tests;
37+
# run via the //flow/designs:syn-dashboard alias.
38+
py_binary(
39+
name = "synDashboard",
40+
srcs = ["synDashboard.py"],
41+
visibility = ["//flow/designs:__pkg__"],
42+
)
43+
3644
py_library(
3745
name = "genMetrics_lib",
3846
srcs = ["genMetrics.py"],

‎flow/util/checkMetadata.py‎

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,14 @@
3333
)
3434
parser.add_argument("--metadata", "-m", required=True, help="The metadata file")
3535
parser.add_argument("--rules", "-r", required=True, nargs="+", help="The rules file")
36+
parser.add_argument(
37+
"--only-prefix",
38+
nargs="+",
39+
default=None,
40+
help="Check only rules whose field starts with one of these prefixes. "
41+
"Lets a partial run (e.g. synthesis-only) be gated by a full-flow "
42+
"rules file without tripping the missing-field error.",
43+
)
3644
args = parser.parse_args()
3745

3846
with open(args.metadata) as metadataFile:
@@ -46,6 +54,13 @@
4654
else:
4755
print(f"[WARN] File {filePath} not found")
4856

57+
if args.only_prefix:
58+
rules = {
59+
field: rule
60+
for field, rule in rules.items()
61+
if any(field.startswith(prefix) for prefix in args.only_prefix)
62+
}
63+
4964
if len(rules) == 0:
5065
print("No rules")
5166
sys.exit(1)

0 commit comments

Comments
 (0)