Skip to content

Commit e1e6c97

Browse files
committed
bazel: enable blender 3D-viewer targets on every supported-PDK design
Flip `blender = True` once, globally, in flow/designs/design.bzl's design() wrapper. Every design routes through this single funnel, so this is the only ORFS-side line that changes. Two small bazel-orfs patches make the global flip safe: 0002-blender.bzl-export-blender_supports_pdk-predicate.patch Exposes `blender_supports_pdk(pdk)`. Lets callers ask "does this PDK have a BlenderGDS stackup?" without provoking the loud fail() in _pdk_to_blendergds (which we keep — it's a useful guard for anyone calling orfs_blender() directly with a bogus PDK). 0003-orfs_design.bzl-forward-blender-silently-skip-unsupp.patch Adds a `blender = False` parameter to orfs_design() and forwards it to orfs_flow(). When True but the design's PDK is unsupported (asap7, nangate45, …) the request silently downgrades to False, so no `_blender*` targets are declared and @blender / @blendergds are never referenced by analysis. Confirmed behaviour after these patches: * `bazelisk query //flow/designs/sky130hd/gcd:all` shows the 5 `gcd_final_blender*` targets (sky130hd is supported). * `bazelisk query //flow/designs/asap7/gcd:all` shows none of them (asap7 has no BlenderGDS stackup — silent skip). * `bazelisk query 'tests(//flow/designs/sky130hd/gcd:all)'` returns only `gcd_test` — `tags = ["manual"]` keeps the blender targets out of `bazelisk test //...` wildcards. `bazelisk build //flow/designs/sky130hd/gcd:gcd_final_blender_html` runs the full physical-design flow to completion and then fails at the orfs_gds klayout-merge step (klayout looks up klayout_tech.lef under the non-sandbox execroot rather than the active processwrapper sandbox). That failure is in bazel-orfs's orfs_gds rule and surfaces because orfs_blender exercises orfs_gds with the host PATH klayout for the first time on this design; it is independent of these patches and will be triaged separately. bazel-orfs patches are vendored under patches/bazel-orfs/ via the existing git_override(patches=…) mechanism. Upstreaming is deferred until the orfs_gds klayout-merge issue is sorted out, to minimise bazel-orfs churn. Signed-off-by: Øyvind Harboe <oyvind.harboe@zylin.com>
1 parent 7daba05 commit e1e6c97

4 files changed

Lines changed: 119 additions & 1 deletion

File tree

MODULE.bazel

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,13 @@ BAZEL_ORFS_REMOTE = "https://github.com/The-OpenROAD-Project/bazel-orfs.git"
4949
git_override(
5050
module_name = "bazel-orfs",
5151
commit = BAZEL_ORFS_COMMIT,
52-
remote = BAZEL_ORFS_REMOTE,
5352
patch_strip = 1,
5453
patches = [
5554
"//patches/bazel-orfs:0001-flow.bzl-pull-synth-into-generate_metadata-data-deps.patch",
55+
"//patches/bazel-orfs:0002-blender.bzl-export-blender_supports_pdk-predicate.patch",
56+
"//patches/bazel-orfs:0003-orfs_design.bzl-forward-blender-silently-skip-unsupp.patch",
5657
],
58+
remote = BAZEL_ORFS_REMOTE,
5759
)
5860

5961
git_override(

flow/designs/design.bzl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ def design(config = "config.mk", user_arguments = [], user_sources = [], local_a
7474
user_arguments = user_arguments,
7575
user_sources = user_sources,
7676
local_arguments = local_arguments,
77+
blender = True,
7778
)
7879

7980
def files(group, extra_srcs = None):
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
From 151270e17f51ab260bf0e9ad8479ccf009b02c5f Mon Sep 17 00:00:00 2001
2+
From: =?UTF-8?q?=C3=98yvind=20Harboe?= <oyvind@ascenium.com>
3+
Date: Sat, 16 May 2026 14:35:12 +0200
4+
Subject: [PATCH 2/3] blender.bzl: export blender_supports_pdk predicate
5+
MIME-Version: 1.0
6+
Content-Type: text/plain; charset=UTF-8
7+
Content-Transfer-Encoding: 8bit
8+
9+
Lets higher-level macros decide whether to request blender = True from
10+
orfs_flow without provoking the loud fail() in _pdk_to_blendergds.
11+
12+
The next commit teaches orfs_design() to silently downgrade
13+
blender = True to False when the design's PDK has no BlenderGDS
14+
stackup, so a single project-wide `blender = True` flip in
15+
flow/designs/design.bzl on the ORFS side works across all PDKs.
16+
17+
Signed-off-by: Øyvind Harboe <oyvind@ascenium.com>
18+
---
19+
private/blender.bzl | 10 ++++++++++
20+
1 file changed, 10 insertions(+)
21+
22+
diff --git a/private/blender.bzl b/private/blender.bzl
23+
index 444c65c..bcafae6 100644
24+
--- a/private/blender.bzl
25+
+++ b/private/blender.bzl
26+
@@ -52,6 +52,16 @@ def _pdk_to_blendergds(pdk):
27+
)
28+
return _PDK_TO_BLENDERGDS[short]
29+
30+
+def blender_supports_pdk(pdk):
31+
+ """True iff orfs_blender() will accept this PDK label.
32+
+
33+
+ Lets higher-level macros (e.g. orfs_design) decide whether to request
34+
+ `blender = True` from orfs_flow without provoking the loud fail() in
35+
+ _pdk_to_blendergds. Accepts either a bare short name (`"sky130hd"`)
36+
+ or a label (`"//flow:sky130hd"`).
37+
+ """
38+
+ return _pdk_short_name(pdk) in _PDK_TO_BLENDERGDS
39+
+
40+
def _find_addon_root(addon_files):
41+
"""Locate the BlenderGDS addon root via the dir of __init__.py."""
42+
for f in addon_files:
43+
--
44+
2.51.0
45+
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
From cc811f203317da88f41bf6fcf19172e67b8ac797 Mon Sep 17 00:00:00 2001
2+
From: =?UTF-8?q?=C3=98yvind=20Harboe?= <oyvind@ascenium.com>
3+
Date: Sat, 16 May 2026 14:35:45 +0200
4+
Subject: [PATCH 3/3] orfs_design.bzl: forward blender, silently skip
5+
unsupported PDKs
6+
MIME-Version: 1.0
7+
Content-Type: text/plain; charset=UTF-8
8+
Content-Transfer-Encoding: 8bit
9+
10+
Add a pass-through `blender =` parameter to orfs_design(). When True,
11+
forward to orfs_flow() — but only if the design's PDK has a BlenderGDS
12+
stackup (per blender_supports_pdk). On unsupported PDKs the request
13+
silently downgrades to False so no blender targets are declared and
14+
@blender / @blendergds are never referenced by analysis.
15+
16+
Lets the ORFS-side design() wrapper turn on blender = True once,
17+
globally, without having to enumerate the supported PDK set itself.
18+
19+
Signed-off-by: Øyvind Harboe <oyvind@ascenium.com>
20+
---
21+
private/orfs_design.bzl | 12 +++++++++++-
22+
1 file changed, 11 insertions(+), 1 deletion(-)
23+
24+
diff --git a/private/orfs_design.bzl b/private/orfs_design.bzl
25+
index d53d4bd..c663be0 100644
26+
--- a/private/orfs_design.bzl
27+
+++ b/private/orfs_design.bzl
28+
@@ -10,6 +10,10 @@ The orfs_designs repository rule (designs.bzl) must be instantiated
29+
first to parse all config.mk files and generate the DESIGNS dict.
30+
"""
31+
32+
+load(
33+
+ "//private:blender.bzl",
34+
+ "blender_supports_pdk",
35+
+)
36+
load(
37+
"//private:flow.bzl",
38+
"orfs_flow",
39+
@@ -47,7 +51,7 @@ def _convert_sources(sources, pkg):
40+
result[var] = converted
41+
return result
42+
43+
-def orfs_design(name = None, config = "config.mk", platform = None, design = None, designs = None, mock_openroad = None, mock_yosys = None, user_arguments = [], user_sources = [], local_arguments = []): # buildifier: disable=unused-variable
44+
+def orfs_design(name = None, config = "config.mk", platform = None, design = None, designs = None, mock_openroad = None, mock_yosys = None, user_arguments = [], user_sources = [], local_arguments = [], blender = False): # buildifier: disable=unused-variable
45+
"""Create orfs_flow() targets for a design based on its parsed config.mk.
46+
47+
Usage:
48+
@@ -92,6 +96,11 @@ def orfs_design(name = None, config = "config.mk", platform = None, design = Non
49+
which appears verbatim inside VERILOG_FILES). These are
50+
dropped entirely before orfs_flow() is invoked — neither
51+
validated against variables.yaml nor exposed as env vars.
52+
+ blender: if True, request the orfs_flow blender 3D-viewer targets
53+
+ for this design. Silently downgraded to False on PDKs that
54+
+ have no BlenderGDS stackup (see blender_supports_pdk in
55+
+ private/blender.bzl), so callers can flip this on globally
56+
+ without having to enumerate supported PDKs.
57+
"""
58+
if designs == None:
59+
fail("orfs_design() requires designs: load orfs_design from @orfs_designs//:designs.bzl")
60+
@@ -233,6 +242,7 @@ def orfs_design(name = None, config = "config.mk", platform = None, design = Non
61+
macros = macros if macros else [],
62+
stage_data = {"synth": extra_data} if extra_data else {},
63+
tags = tags,
64+
+ blender = blender and blender_supports_pdk("//flow:" + platform),
65+
)
66+
67+
# Lint flow — fast validation with mock-openroad (only if configured)
68+
--
69+
2.51.0
70+

0 commit comments

Comments
 (0)