Skip to content

Commit 19f6278

Browse files
committed
build: patch bazel-orfs to register injected SYNTH_NUM_PARTITIONS
bazel-orfs auto-injects SYNTH_NUM_PARTITIONS into the orfs_flow() arguments dict when SYNTH_HIERARCHICAL=1, but its check_variables() walks every key in arguments and fails on anything not in the downstream variables.yaml -- so the validator was complaining about a variable bazel-orfs put there itself. ORFS doesn't read it, so adding it to ORFS variables.yaml is wrong. Patch private/stages.bzl to populate BAZEL_VARIABLE_TO_STAGES with SYNTH_NUM_PARTITIONS and merge BAZEL_STAGE_TO_VARIABLES into ALL_STAGE_TO_VARIABLES (it was previously declared as an empty dict and never used). To be upstreamed. Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
1 parent e65643e commit 19f6278

3 files changed

Lines changed: 53 additions & 0 deletions

File tree

‎MODULE.bazel‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,10 @@ BAZEL_ORFS_REMOTE = "https://github.com/The-OpenROAD-Project/bazel-orfs.git"
3535
git_override(
3636
module_name = "bazel-orfs",
3737
commit = BAZEL_ORFS_COMMIT,
38+
patch_strip = 1,
39+
patches = [
40+
"//bazel/bazel-orfs-patches:0001-stages-register-bazel-injected-vars-in-validator.patch",
41+
],
3842
remote = BAZEL_ORFS_REMOTE,
3943
)
4044

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
diff --git a/private/stages.bzl b/private/stages.bzl
2+
index 8c1391a..28e8afa 100644
3+
--- a/private/stages.bzl
4+
+++ b/private/stages.bzl
5+
@@ -6,9 +6,31 @@ load("//private:utils.bzl", "flatten", "set", "union")
6+
# A stage argument is used in one or more stages. This is metainformation
7+
# about the ORFS code that there is no known nice way for ORFS to
8+
# provide.
9+
-BAZEL_VARIABLE_TO_STAGES = {}
10+
+#
11+
+# Variables auto-injected by bazel-orfs (not present in ORFS variables.yaml)
12+
+# are registered here so that check_variables() does not flag them as
13+
+# unknown when downstream callers see them in arguments.
14+
+BAZEL_VARIABLE_TO_STAGES = {
15+
+ # Set in orfs_design.bzl when SYNTH_HIERARCHICAL=1.
16+
+ "SYNTH_NUM_PARTITIONS": ["synth"],
17+
+}
18+
19+
-BAZEL_STAGE_TO_VARIABLES = {}
20+
+BAZEL_STAGE_TO_VARIABLES = {
21+
+ stage: [v for v, stages in BAZEL_VARIABLE_TO_STAGES.items() if stage in stages]
22+
+ for stage in [
23+
+ "synth",
24+
+ "floorplan",
25+
+ "place",
26+
+ "cts",
27+
+ "grt",
28+
+ "route",
29+
+ "final",
30+
+ "generate_abstract",
31+
+ "generate_metadata",
32+
+ "test",
33+
+ "update_rules",
34+
+ ]
35+
+}
36+
37+
ALL_STAGES = [
38+
"synth",
39+
@@ -135,7 +157,8 @@ ORFS_STAGE_TO_VARIABLES = {
40+
}
41+
42+
ALL_STAGE_TO_VARIABLES = {
43+
- stage: ORFS_STAGE_TO_VARIABLES.get(stage, [])
44+
+ stage: ORFS_STAGE_TO_VARIABLES.get(stage, []) +
45+
+ BAZEL_STAGE_TO_VARIABLES.get(stage, [])
46+
for stage in ALL_STAGES
47+
}
48+
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
exports_files(glob(["*.patch"]))

0 commit comments

Comments
 (0)